@arenarium/maps 1.0.4 → 1.0.6

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 CHANGED
@@ -1 +1,729 @@
1
- (function(y,q){typeof exports=="object"&&typeof module<"u"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(y=typeof globalThis<"u"?globalThis:y||self,q(y.arenarium={}))})(this,function(y){"use strict";var Ft;var bt=Array.isArray,Dt=Array.prototype.indexOf,Ct=Array.from,St=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,lt=Object.isExtensible;const M=2,et=4,ut=8,At=16,C=32,I=64,V=128,S=256,B=512,w=1024,U=2048,P=4096,Y=8192,j=16384,kt=32768,Ot=65536,Rt=1<<19,Mt=1<<20,at=1<<21;function It(t){return t===this.v}function Pt(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}let X=!1,An=!1;function Lt(){X=!0}const qt=2;let p=null;function ot(t){p=t}function Vt(t,n=!1,r){var l=p={p,c:null,d:!1,e:null,m:!1,s:t,x:null,l:null};X&&!n&&(p.l={s:null,u:null,r1:[],r2:jt(!1)}),Xt(()=>{l.d=!0})}function Bt(t){const n=p;if(n!==null){const o=n.e;if(o!==null){var r=d,l=c;n.e=null;try{for(var u=0;u<o.length;u++){var e=o[u];k(e.effect),A(e.reaction),tn(e.fn)}}finally{k(r),A(l)}}p=n.p,n.m=!0}return{}}function Ut(){return!X||p!==null&&p.l===null}const Yt=new Map;function jt(t,n){var r={f:0,v:t,reactions:null,equals:It,rv:0,wv:0};return r}var it,st,ft,_t;function $t(){if(it===void 0){it=window,st=/Firefox/.test(navigator.userAgent);var t=Element.prototype,n=Node.prototype,r=Text.prototype;ft=rt(n,"firstChild").get,_t=rt(n,"nextSibling").get,lt(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),lt(r)&&(r.__t=void 0)}}function Ht(t=""){return document.createTextNode(t)}function Wt(t){return ft.call(t)}function Kt(t){return _t.call(t)}function vt(t){var n=t.effects;if(n!==null){t.effects=null;for(var r=0;r<n.length;r+=1)F(n[r])}}function Gt(t){for(var n=t.parent;n!==null;){if((n.f&M)===0)return n;n=n.parent}return null}function zt(t){var n,r=d;k(Gt(t));try{vt(t),n=mt(t)}finally{k(r)}return n}function Jt(t){var n=zt(t),r=(b||(t.f&S)!==0)&&t.deps!==null?P:w;x(t,r),t.equals(n)||(t.v=n,t.wv=un())}function Qt(t,n){var r=n.last;r===null?n.last=n.first=t:(r.next=t,t.prev=r,n.last=t)}function $(t,n,r,l=!0){var u=d,e={ctx:p,deps:null,nodes_start:null,nodes_end:null,f:t|U,first:null,fn:n,last:null,next:null,parent:u,prev:null,teardown:null,transitions:null,wv:0};if(r)try{nt(e),e.f|=kt}catch(i){throw F(e),i}else n!==null&&xt(e);var o=r&&e.deps===null&&e.first===null&&e.nodes_start===null&&e.teardown===null&&(e.f&(Mt|V))===0;if(!o&&l&&(u!==null&&Qt(e,u),c!==null&&(c.f&M)!==0)){var f=c;(f.effects??(f.effects=[])).push(e)}return e}function Xt(t){const n=$(ut,null,!1);return x(n,w),n.teardown=t,n}function Zt(t){const n=$(I,t,!0);return(r={})=>new Promise(l=>{r.outro?ln(n,()=>{F(n),l(void 0)}):(F(n),l(void 0))})}function tn(t){return $(et,t,!1)}function nn(t,n=!0){return $(ut|C,t,!0,n)}function ct(t){var n=t.teardown;if(n!==null){const r=c;A(null);try{n.call(null)}finally{A(r)}}}function pt(t,n=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var l=r.next;(r.f&I)!==0?r.parent=null:F(r,n),r=l}}function rn(t){for(var n=t.first;n!==null;){var r=n.next;(n.f&C)===0&&F(n),n=r}}function F(t,n=!0){var r=!1;if((n||(t.f&Rt)!==0)&&t.nodes_start!==null){for(var l=t.nodes_start,u=t.nodes_end;l!==null;){var e=l===u?null:Kt(l);l.remove(),l=e}r=!0}pt(t,n&&!r),z(t,0),x(t,j);var o=t.transitions;if(o!==null)for(const i of o)i.stop();ct(t);var f=t.parent;f!==null&&f.first!==null&&dt(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function dt(t){var n=t.parent,r=t.prev,l=t.next;r!==null&&(r.next=l),l!==null&&(l.prev=r),n!==null&&(n.first===t&&(n.first=l),n.last===t&&(n.last=r))}function ln(t,n){var r=[];ht(t,r,!0),en(r,()=>{F(t),n&&n()})}function en(t,n){var r=t.length;if(r>0){var l=()=>--r||n();for(var u of t)u.out(l)}else n()}function ht(t,n,r){if((t.f&Y)===0){if(t.f^=Y,t.transitions!==null)for(const o of t.transitions)(o.is_global||r)&&n.push(o);for(var l=t.first;l!==null;){var u=l.next,e=(l.f&Ot)!==0||(l.f&C)!==0;ht(l,n,e?r:!1),l=u}}}let H=!1,Z=!1,W=null,N=!1,K=[],kn=[],c=null,L=!1;function A(t){c=t}let d=null;function k(t){d=t}let O=null,g=null,h=0,E=null,gt=1,wt=0,b=!1;function un(){return++gt}function tt(t){var s;var n=t.f;if((n&U)!==0)return!0;if((n&P)!==0){var r=t.deps,l=(n&S)!==0;if(r!==null){var u,e,o=(n&B)!==0,f=l&&d!==null&&!b,i=r.length;if(o||f){var _=t,T=_.parent;for(u=0;u<i;u++)e=r[u],(o||!((s=e==null?void 0:e.reactions)!=null&&s.includes(_)))&&(e.reactions??(e.reactions=[])).push(_);o&&(_.f^=B),f&&T!==null&&(T.f&S)===0&&(_.f^=S)}for(u=0;u<i;u++)if(e=r[u],tt(e)&&Jt(e),e.wv>t.wv)return!0}(!l||d!==null&&!b)&&x(t,w)}return!1}function an(t,n){for(var r=n;r!==null;){if((r.f&V)!==0)try{r.fn(t);return}catch{r.f^=V}r=r.parent}throw H=!1,t}function on(t){return(t.f&j)===0&&(t.parent===null||(t.parent.f&V)===0)}function G(t,n,r,l){if(H){if(r===null&&(H=!1),on(n))throw t;return}r!==null&&(H=!0);{an(t,n);return}}function Et(t,n,r=!0){var l=t.reactions;if(l!==null)for(var u=0;u<l.length;u++){var e=l[u];O!=null&&O.includes(t)||((e.f&M)!==0?Et(e,n,!1):n===e&&(r?x(e,U):(e.f&w)!==0&&x(e,P),xt(e)))}}function mt(t){var v;var n=g,r=h,l=E,u=c,e=b,o=O,f=p,i=L,_=t.f;g=null,h=0,E=null,b=(_&S)!==0&&(L||!N||c===null),c=(_&(C|I))===0?t:null,O=null,ot(t.ctx),L=!1,wt++,t.f|=at;try{var T=(0,t.fn)(),s=t.deps;if(g!==null){var a;if(z(t,h),s!==null&&h>0)for(s.length=h+g.length,a=0;a<g.length;a++)s[h+a]=g[a];else t.deps=s=g;if(!b)for(a=h;a<s.length;a++)((v=s[a]).reactions??(v.reactions=[])).push(t)}else s!==null&&h<s.length&&(z(t,h),s.length=h);if(Ut()&&E!==null&&!L&&s!==null&&(t.f&(M|P|U))===0)for(a=0;a<E.length;a++)Et(E[a],t);return u!==null&&(wt++,E!==null&&(l===null?l=E:l.push(...E))),T}finally{g=n,h=r,E=l,c=u,b=e,O=o,ot(f),L=i,t.f^=at}}function sn(t,n){let r=n.reactions;if(r!==null){var l=Dt.call(r,t);if(l!==-1){var u=r.length-1;u===0?r=n.reactions=null:(r[l]=r[u],r.pop())}}r===null&&(n.f&M)!==0&&(g===null||!g.includes(n))&&(x(n,P),(n.f&(S|B))===0&&(n.f^=B),vt(n),z(n,0))}function z(t,n){var r=t.deps;if(r!==null)for(var l=n;l<r.length;l++)sn(t,r[l])}function nt(t){var n=t.f;if((n&j)===0){x(t,w);var r=d,l=p,u=N;d=t,N=!0;try{(n&At)!==0?rn(t):pt(t),ct(t);var e=mt(t);t.teardown=typeof e=="function"?e:null,t.wv=gt;var o=t.deps,f}catch(i){G(i,t,r,l||t.ctx)}finally{N=u,d=r}}}function fn(){try{Pt()}catch(t){if(W!==null)G(t,W,null);else throw t}}function _n(){var t=N;try{var n=0;for(N=!0;K.length>0;){n++>1e3&&fn();var r=K,l=r.length;K=[];for(var u=0;u<l;u++){var e=cn(r[u]);vn(e)}}}finally{Z=!1,N=t,W=null,Yt.clear()}}function vn(t){var n=t.length;if(n!==0)for(var r=0;r<n;r++){var l=t[r];if((l.f&(j|Y))===0)try{tt(l)&&(nt(l),l.deps===null&&l.first===null&&l.nodes_start===null&&(l.teardown===null?dt(l):l.fn=null))}catch(u){G(u,l,null,l.ctx)}}}function xt(t){Z||(Z=!0,queueMicrotask(_n));for(var n=W=t;n.parent!==null;){n=n.parent;var r=n.f;if((r&(I|C))!==0){if((r&w)===0)return;n.f^=w}}K.push(n)}function cn(t){for(var n=[],r=t;r!==null;){var l=r.f,u=(l&(C|I))!==0,e=u&&(l&w)!==0;if(!e&&(l&Y)===0){if((l&et)!==0)n.push(r);else if(u)r.f^=w;else{var o=c;try{c=r,tt(r)&&nt(r)}catch(_){G(_,r,null,r.ctx)}finally{c=o}}var f=r.first;if(f!==null){r=f;continue}}var i=r.parent;for(r=r.next;r===null&&i!==null;)r=i.next,i=i.parent}return n}const pn=-7169;function x(t,n){t.f=t.f&pn|n}const dn=["touchstart","touchmove"];function hn(t){return dn.includes(t)}const gn=new Set,Tt=new Set;function J(t){var Nt;var n=this,r=n.ownerDocument,l=t.type,u=((Nt=t.composedPath)==null?void 0:Nt.call(t))||[],e=u[0]||t.target,o=0,f=t.__root;if(f){var i=u.indexOf(f);if(i!==-1&&(n===document||n===window)){t.__root=n;return}var _=u.indexOf(n);if(_===-1)return;i<=_&&(o=i)}if(e=u[o]||t.target,e!==n){St(t,"currentTarget",{configurable:!0,get(){return e||r}});var T=c,s=d;A(null),k(null);try{for(var a,v=[];e!==null;){var m=e.assignedSlot||e.parentNode||e.host||null;try{var D=e["__"+l];if(D!=null&&(!e.disabled||t.target===e))if(bt(D)){var[Cn,...Sn]=D;Cn.apply(e,[t,...Sn])}else D.call(e,t)}catch(Q){a?v.push(Q):a=Q}if(t.cancelBubble||m===n||m===null)break;e=m}if(a){for(let Q of v)queueMicrotask(()=>{throw Q});throw a}}finally{t.__root=n,delete t.currentTarget,A(T),k(s)}}}function wn(t){var n=document.createElement("template");return n.innerHTML=t,n.content}function En(t,n){var r=d;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=n)}function mn(t,n){var r=(n&qt)!==0,l,u=!t.startsWith("<!>");return()=>{l===void 0&&(l=wn(u?t:"<!>"+t),l=Wt(l));var e=r||st?document.importNode(l,!0):l.cloneNode(!0);return En(e,e),e}}function xn(t,n){t!==null&&t.before(n)}function Tn(t,n){return yn(t,n)}const R=new Map;function yn(t,{target:n,anchor:r,props:l={},events:u,context:e,intro:o=!0}){$t();var f=new Set,i=s=>{for(var a=0;a<s.length;a++){var v=s[a];if(!f.has(v)){f.add(v);var m=hn(v);n.addEventListener(v,J,{passive:m});var D=R.get(v);D===void 0?(document.addEventListener(v,J,{passive:m}),R.set(v,1)):R.set(v,D+1)}}};i(Ct(gn)),Tt.add(i);var _=void 0,T=Zt(()=>{var s=r??n.appendChild(Ht());return nn(()=>{if(e){Vt({});var a=p;a.c=e}u&&(l.$$events=u),_=t(s,l)||{},e&&Bt()}),()=>{var m;for(var a of f){n.removeEventListener(a,J);var v=R.get(a);--v===0?(document.removeEventListener(a,J),R.delete(a)):R.set(a,v)}Tt.delete(i),s!==r&&((m=s.parentNode)==null||m.removeChild(s))}});return Fn.set(_,T),_}let Fn=new WeakMap;const Nn="5";typeof window<"u"&&((Ft=window.__svelte??(window.__svelte={})).v??(Ft.v=new Set)).add(Nn),Lt();var bn=mn('<div class="title svelte-1tbngqp"></div>');function yt(t){const n="Arenarium Maps";var r=bn();r.textContent=n,xn(t,r)}function Dn(t){const n=document.getElementById(t);if(!n)throw new Error(`Element with id ${t} not found`);Tn(yt,{target:n})}y.Map=yt,y.mountMap=Dn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
1
+ (function(ss,Bc){typeof exports=="object"&&typeof module<"u"?Bc(exports):typeof define=="function"&&define.amd?define(["exports"],Bc):(ss=typeof globalThis<"u"?globalThis:ss||self,Bc(ss.arenarium={}))})(this,function(ss){"use strict";var cf;var ip=Array.isArray,Wm=Array.prototype.indexOf,Hm=Array.from,Km=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,Xm=Object.prototype,Ym=Array.prototype,Jm=Object.getPrototypeOf,rp=Object.isExtensible;function Qm(b){for(var g=0;g<b.length;g++)b[g]()}const ln=2,np=4,Oc=8,Sh=16,fa=32,Qs=64,jc=128,Ir=256,Nc=512,jr=1024,os=2048,eo=4096,Zc=8192,Vc=16384,eg=32768,tg=65536,ap=1<<19,sp=1<<20,Mh=1<<21,al=Symbol("$state"),ig=Symbol("legacy props");function op(b){return b===this.v}function rg(b,g){return b!=b?g==g:b!==g||b!==null&&typeof b=="object"||typeof b=="function"}function lp(b){return!rg(b,this.v)}function ng(b){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ag(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function sg(b){throw new Error("https://svelte.dev/e/effect_orphan")}function og(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function lg(b){throw new Error("https://svelte.dev/e/props_invalid_value")}function cg(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ug(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function hg(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let uv=!1;const dg=1,pg=4,fg=8,mg=16,gg=1,_g=2,ur=Symbol();function yg(b){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let rr=null;function cp(b){rr=b}function up(b,g=!1,T){var C=rr={p:rr,c:null,d:!1,e:null,m:!1,s:b,x:null,l:null};Sp(()=>{C.d=!0})}function hp(b){const g=rr;if(g!==null){b!==void 0&&(g.x=b);const S=g.e;if(S!==null){var T=Yt,C=kt;g.e=null;try{for(var F=0;F<S.length;F++){var O=S[F];ma(O.effect),hn(O.reaction),Eh(O.fn)}}finally{ma(T),hn(C)}}rr=g.p,g.m=!0}return b||{}}function dp(){return!0}function ls(b,g){if(typeof b!="object"||b===null||al in b)return b;const T=Jm(b);if(T!==Xm&&T!==Ym)return b;var C=new Map,F=ip(b),O=Dn(0),S=kt,c=_e=>{var me=kt;hn(S);var ze;return ze=_e(),hn(me),ze};return F&&C.set("length",Dn(b.length)),new Proxy(b,{defineProperty(_e,me,ze){(!("value"in ze)||ze.configurable===!1||ze.enumerable===!1||ze.writable===!1)&&cg();var Ze=C.get(me);return Ze===void 0?(Ze=c(()=>Dn(ze.value)),C.set(me,Ze)):cn(Ze,c(()=>ls(ze.value))),!0},deleteProperty(_e,me){var ze=C.get(me);if(ze===void 0)me in _e&&C.set(me,c(()=>Dn(ur)));else{if(F&&typeof me=="string"){var Ze=C.get("length"),Ae=Number(me);Number.isInteger(Ae)&&Ae<Ze.v&&cn(Ze,Ae)}cn(ze,ur),pp(O)}return!0},get(_e,me,ze){var Ve;if(me===al)return b;var Ze=C.get(me),Ae=me in _e;if(Ze===void 0&&(!Ae||(Ve=Js(_e,me))!=null&&Ve.writable)&&(Ze=c(()=>Dn(ls(Ae?_e[me]:ur))),C.set(me,Ze)),Ze!==void 0){var le=Nr(Ze);return le===ur?void 0:le}return Reflect.get(_e,me,ze)},getOwnPropertyDescriptor(_e,me){var ze=Reflect.getOwnPropertyDescriptor(_e,me);if(ze&&"value"in ze){var Ze=C.get(me);Ze&&(ze.value=Nr(Ze))}else if(ze===void 0){var Ae=C.get(me),le=Ae==null?void 0:Ae.v;if(Ae!==void 0&&le!==ur)return{enumerable:!0,configurable:!0,value:le,writable:!0}}return ze},has(_e,me){var le;if(me===al)return!0;var ze=C.get(me),Ze=ze!==void 0&&ze.v!==ur||Reflect.has(_e,me);if(ze!==void 0||Yt!==null&&(!Ze||(le=Js(_e,me))!=null&&le.writable)){ze===void 0&&(ze=c(()=>Dn(Ze?ls(_e[me]):ur)),C.set(me,ze));var Ae=Nr(ze);if(Ae===ur)return!1}return Ze},set(_e,me,ze,Ze){var ri;var Ae=C.get(me),le=me in _e;if(F&&me==="length")for(var Ve=ze;Ve<Ae.v;Ve+=1){var Nt=C.get(Ve+"");Nt!==void 0?cn(Nt,ur):Ve in _e&&(Nt=c(()=>Dn(ur)),C.set(Ve+"",Nt))}Ae===void 0?(!le||(ri=Js(_e,me))!=null&&ri.writable)&&(Ae=c(()=>Dn(void 0)),cn(Ae,c(()=>ls(ze))),C.set(me,Ae)):(le=Ae.v!==ur,cn(Ae,c(()=>ls(ze))));var Gt=Reflect.getOwnPropertyDescriptor(_e,me);if(Gt!=null&&Gt.set&&Gt.set.call(Ze,ze),!le){if(F&&typeof me=="string"){var _i=C.get("length"),si=Number(me);Number.isInteger(si)&&si>=_i.v&&cn(_i,si+1)}pp(O)}return!0},ownKeys(_e){Nr(O);var me=Reflect.ownKeys(_e).filter(Ae=>{var le=C.get(Ae);return le===void 0||le.v!==ur});for(var[ze,Ze]of C)Ze.v!==ur&&!(ze in _e)&&me.push(ze);return me},setPrototypeOf(){ug()}})}function pp(b,g=1){cn(b,b.v+g)}const sl=new Map;function fp(b,g){var T={f:0,v:b,reactions:null,equals:op,rv:0,wv:0};return T}function Dn(b,g){const T=fp(b);return Dg(T),T}function xg(b,g=!1){const T=fp(b);return g||(T.equals=lp),T}function cn(b,g,T=!1){kt!==null&&!un&&dp()&&(kt.f&(ln|Sh))!==0&&!(Wi!=null&&Wi.includes(b))&&hg();let C=T?ls(g):g;return vg(b,C)}function vg(b,g){if(!b.equals(g)){var T=b.v;ll?sl.set(b,g):sl.set(b,T),b.v=g,b.wv=Fp(),mp(b,os),Yt!==null&&(Yt.f&jr)!==0&&(Yt.f&(fa|Qs))===0&&(Cr===null?Lg([b]):Cr.push(b))}return g}function mp(b,g){var T=b.reactions;if(T!==null)for(var C=T.length,F=0;F<C;F++){var O=T[F],S=O.f;(S&os)===0&&(Ln(O,g),(S&(jr|Ir))!==0&&((S&ln)!==0?mp(O,eo):Ah(O)))}}var Ih,gp,_p,yp;function bg(){if(Ih===void 0){Ih=window,gp=/Firefox/.test(navigator.userAgent);var b=Element.prototype,g=Node.prototype,T=Text.prototype;_p=Js(g,"firstChild").get,yp=Js(g,"nextSibling").get,rp(b)&&(b.__click=void 0,b.__className=void 0,b.__attributes=null,b.__style=void 0,b.__e=void 0),rp(T)&&(T.__t=void 0)}}function xp(b=""){return document.createTextNode(b)}function Ch(b){return _p.call(b)}function vp(b){return yp.call(b)}function ol(b,g){return Ch(b)}function bp(b,g=1,T=!1){let C=b;for(;g--;)C=vp(C);return C}function wp(b){var g=ln|os,T=kt!==null&&(kt.f&ln)!==0?kt:null;return Yt===null||T!==null&&(T.f&Ir)!==0?g|=Ir:Yt.f|=sp,{ctx:rr,deps:null,effects:null,equals:op,f:g,fn:b,reactions:null,rv:0,v:null,wv:0,parent:T??Yt}}function Tp(b){var g=b.effects;if(g!==null){b.effects=null;for(var T=0;T<g.length;T+=1)cs(g[T])}}function wg(b){for(var g=b.parent;g!==null;){if((g.f&ln)===0)return g;g=g.parent}return null}function Tg(b){var g,T=Yt;ma(wg(b));try{Tp(b),g=Op(b)}finally{ma(T)}return g}function Pp(b){var g=Tg(b),T=(ga||(b.f&Ir)!==0)&&b.deps!==null?eo:jr;Ln(b,T),b.equals(g)||(b.v=g,b.wv=Fp())}function Pg(b){Yt===null&&kt===null&&sg(),kt!==null&&(kt.f&Ir)!==0&&Yt===null&&ag(),ll&&ng()}function Sg(b,g){var T=g.last;T===null?g.last=g.first=b:(T.next=b,b.prev=T,g.last=b)}function to(b,g,T,C=!0){var F=Yt,O={ctx:rr,deps:null,nodes_start:null,nodes_end:null,f:b|os,first:null,fn:g,last:null,next:null,parent:F,prev:null,teardown:null,transitions:null,wv:0};if(T)try{kh(O),O.f|=eg}catch(_e){throw cs(O),_e}else g!==null&&Ah(O);var S=T&&O.deps===null&&O.first===null&&O.nodes_start===null&&O.teardown===null&&(O.f&(sp|jc))===0;if(!S&&C&&(F!==null&&Sg(O,F),kt!==null&&(kt.f&ln)!==0)){var c=kt;(c.effects??(c.effects=[])).push(O)}return O}function Sp(b){const g=to(Oc,null,!1);return Ln(g,jr),g.teardown=b,g}function Mp(b){Pg();var g=Yt!==null&&(Yt.f&fa)!==0&&rr!==null&&!rr.m;if(g){var T=rr;(T.e??(T.e=[])).push({fn:b,effect:Yt,reaction:kt})}else{var C=Eh(b);return C}}function Mg(b){const g=to(Qs,b,!0);return(T={})=>new Promise(C=>{T.outro?zg(g,()=>{cs(g),C(void 0)}):(cs(g),C(void 0))})}function Eh(b){return to(np,b,!1)}function Ig(b){return to(Oc,b,!0)}function Ip(b,g=[],T=wp){const C=g.map(T);return Cp(()=>b(...C.map(Nr)))}function Cp(b,g=0){return to(Oc|Sh|g,b,!0)}function Cg(b,g=!0){return to(Oc|fa,b,!0,g)}function Ep(b){var g=b.teardown;if(g!==null){const T=ll,C=kt;Dp(!0),hn(null);try{g.call(null)}finally{Dp(T),hn(C)}}}function zp(b,g=!1){var T=b.first;for(b.first=b.last=null;T!==null;){var C=T.next;(T.f&Qs)!==0?T.parent=null:cs(T,g),T=C}}function Eg(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&ap)!==0)&&b.nodes_start!==null){for(var C=b.nodes_start,F=b.nodes_end;C!==null;){var O=C===F?null:vp(C);C.remove(),C=O}T=!0}zp(b,g&&!T),Xc(b,0),Ln(b,Vc);var S=b.transitions;if(S!==null)for(const _e of S)_e.stop();Ep(b);var c=b.parent;c!==null&&c.first!==null&&kp(b),b.next=b.prev=b.teardown=b.ctx=b.deps=b.fn=b.nodes_start=b.nodes_end=null}function kp(b){var g=b.parent,T=b.prev,C=b.next;T!==null&&(T.next=C),C!==null&&(C.prev=T),g!==null&&(g.first===b&&(g.first=C),g.last===b&&(g.last=T))}function zg(b,g){var T=[];Ap(b,T,!0),kg(T,()=>{cs(b),g&&g()})}function kg(b,g){var T=b.length;if(T>0){var C=()=>--T||g();for(var F of b)F.out(C)}else g()}function Ap(b,g,T){if((b.f&Zc)===0){if(b.f^=Zc,b.transitions!==null)for(const S of b.transitions)(S.is_global||T)&&g.push(S);for(var C=b.first;C!==null;){var F=C.next,O=(C.f&tg)!==0||(C.f&fa)!==0;Ap(C,g,O?T:!1),C=F}}}let Uc=[];function Ag(){var b=Uc;Uc=[],Qm(b)}function Rp(b){Uc.length===0&&queueMicrotask(Ag),Uc.push(b)}let $c=!1,zh=!1,Gc=null,us=!1,ll=!1;function Dp(b){ll=b}let qc=[],hv=[],kt=null,un=!1;function hn(b){kt=b}let Yt=null;function ma(b){Yt=b}let Wi=null;function Rg(b){Wi=b}function Dg(b){kt!==null&&kt.f&Mh&&(Wi===null?Rg([b]):Wi.push(b))}let Hi=null,hr=0,Cr=null;function Lg(b){Cr=b}let Lp=1,Wc=0,ga=!1;function Fp(){return++Lp}function Hc(b){var Ze;var g=b.f;if((g&os)!==0)return!0;if((g&eo)!==0){var T=b.deps,C=(g&Ir)!==0;if(T!==null){var F,O,S=(g&Nc)!==0,c=C&&Yt!==null&&!ga,_e=T.length;if(S||c){var me=b,ze=me.parent;for(F=0;F<_e;F++)O=T[F],(S||!((Ze=O==null?void 0:O.reactions)!=null&&Ze.includes(me)))&&(O.reactions??(O.reactions=[])).push(me);S&&(me.f^=Nc),c&&ze!==null&&(ze.f&Ir)===0&&(me.f^=Ir)}for(F=0;F<_e;F++)if(O=T[F],Hc(O)&&Pp(O),O.wv>b.wv)return!0}(!C||Yt!==null&&!ga)&&Ln(b,jr)}return!1}function Fg(b,g){for(var T=g;T!==null;){if((T.f&jc)!==0)try{T.fn(b);return}catch{T.f^=jc}T=T.parent}throw $c=!1,b}function Bg(b){return(b.f&Vc)===0&&(b.parent===null||(b.parent.f&jc)===0)}function Kc(b,g,T,C){if($c){if(T===null&&($c=!1),Bg(g))throw b;return}T!==null&&($c=!0);{Fg(b,g);return}}function Bp(b,g,T=!0){var C=b.reactions;if(C!==null)for(var F=0;F<C.length;F++){var O=C[F];Wi!=null&&Wi.includes(b)||((O.f&ln)!==0?Bp(O,g,!1):g===O&&(T?Ln(O,os):(O.f&jr)!==0&&Ln(O,eo),Ah(O)))}}function Op(b){var le;var g=Hi,T=hr,C=Cr,F=kt,O=ga,S=Wi,c=rr,_e=un,me=b.f;Hi=null,hr=0,Cr=null,ga=(me&Ir)!==0&&(un||!us||kt===null),kt=(me&(fa|Qs))===0?b:null,Wi=null,cp(b.ctx),un=!1,Wc++,b.f|=Mh;try{var ze=(0,b.fn)(),Ze=b.deps;if(Hi!==null){var Ae;if(Xc(b,hr),Ze!==null&&hr>0)for(Ze.length=hr+Hi.length,Ae=0;Ae<Hi.length;Ae++)Ze[hr+Ae]=Hi[Ae];else b.deps=Ze=Hi;if(!ga)for(Ae=hr;Ae<Ze.length;Ae++)((le=Ze[Ae]).reactions??(le.reactions=[])).push(b)}else Ze!==null&&hr<Ze.length&&(Xc(b,hr),Ze.length=hr);if(dp()&&Cr!==null&&!un&&Ze!==null&&(b.f&(ln|eo|os))===0)for(Ae=0;Ae<Cr.length;Ae++)Bp(Cr[Ae],b);return F!==null&&(Wc++,Cr!==null&&(C===null?C=Cr:C.push(...Cr))),ze}finally{Hi=g,hr=T,Cr=C,kt=F,ga=O,Wi=S,cp(c),un=_e,b.f^=Mh}}function Og(b,g){let T=g.reactions;if(T!==null){var C=Wm.call(T,b);if(C!==-1){var F=T.length-1;F===0?T=g.reactions=null:(T[C]=T[F],T.pop())}}T===null&&(g.f&ln)!==0&&(Hi===null||!Hi.includes(g))&&(Ln(g,eo),(g.f&(Ir|Nc))===0&&(g.f^=Nc),Tp(g),Xc(g,0))}function Xc(b,g){var T=b.deps;if(T!==null)for(var C=g;C<T.length;C++)Og(b,T[C])}function kh(b){var g=b.f;if((g&Vc)===0){Ln(b,jr);var T=Yt,C=rr,F=us;Yt=b,us=!0;try{(g&Sh)!==0?Eg(b):zp(b),Ep(b);var O=Op(b);b.teardown=typeof O=="function"?O:null,b.wv=Lp;var S=b.deps,c}catch(_e){Kc(_e,b,T,C||b.ctx)}finally{us=F,Yt=T}}}function jg(){try{og()}catch(b){if(Gc!==null)Kc(b,Gc,null);else throw b}}function Ng(){var b=us;try{var g=0;for(us=!0;qc.length>0;){g++>1e3&&jg();var T=qc,C=T.length;qc=[];for(var F=0;F<C;F++){var O=Vg(T[F]);Zg(O)}}}finally{zh=!1,us=b,Gc=null,sl.clear()}}function Zg(b){var g=b.length;if(g!==0)for(var T=0;T<g;T++){var C=b[T];if((C.f&(Vc|Zc))===0)try{Hc(C)&&(kh(C),C.deps===null&&C.first===null&&C.nodes_start===null&&(C.teardown===null?kp(C):C.fn=null))}catch(F){Kc(F,C,null,C.ctx)}}}function Ah(b){zh||(zh=!0,queueMicrotask(Ng));for(var g=Gc=b;g.parent!==null;){g=g.parent;var T=g.f;if((T&(Qs|fa))!==0){if((T&jr)===0)return;g.f^=jr}}qc.push(g)}function Vg(b){for(var g=[],T=b;T!==null;){var C=T.f,F=(C&(fa|Qs))!==0,O=F&&(C&jr)!==0;if(!O&&(C&Zc)===0){if((C&np)!==0)g.push(T);else if(F)T.f^=jr;else{var S=kt;try{kt=T,Hc(T)&&kh(T)}catch(me){Kc(me,T,null,T.ctx)}finally{kt=S}}var c=T.first;if(c!==null){T=c;continue}}var _e=T.parent;for(T=T.next;T===null&&_e!==null;)T=_e.next,_e=_e.parent}return g}function Nr(b){var g=b.f,T=(g&ln)!==0;if(kt!==null&&!un){if(!(Wi!=null&&Wi.includes(b))){var C=kt.deps;b.rv<Wc&&(b.rv=Wc,Hi===null&&C!==null&&C[hr]===b?hr++:Hi===null?Hi=[b]:(!ga||!Hi.includes(b))&&Hi.push(b))}}else if(T&&b.deps===null&&b.effects===null){var F=b,O=F.parent;O!==null&&(O.f&Ir)===0&&(F.f^=Ir)}return T&&(F=b,Hc(F)&&Pp(F)),ll&&sl.has(b)?sl.get(b):b.v}function Yc(b){var g=un;try{return un=!0,b()}finally{un=g}}const Ug=-7169;function Ln(b,g){b.f=b.f&Ug|g}const $g=["touchstart","touchmove"];function Gg(b){return $g.includes(b)}function qg(b){var g=kt,T=Yt;hn(null),ma(null);try{return b()}finally{hn(g),ma(T)}}const jp=new Set,Rh=new Set;function Wg(b,g,T,C={}){function F(O){if(C.capture||cl.call(g,O),!O.cancelBubble)return qg(()=>T==null?void 0:T.call(this,O))}return b.startsWith("pointer")||b.startsWith("touch")||b==="wheel"?Rp(()=>{g.addEventListener(b,F,C)}):g.addEventListener(b,F,C),F}function Hg(b,g,T,C,F){var O={capture:C,passive:F},S=Wg(b,g,T,O);(g===document.body||g===window||g===document)&&Sp(()=>{g.removeEventListener(b,S,O)})}function Kg(b){for(var g=0;g<b.length;g++)jp.add(b[g]);for(var T of Rh)T(b)}function cl(b){var si;var g=this,T=g.ownerDocument,C=b.type,F=((si=b.composedPath)==null?void 0:si.call(b))||[],O=F[0]||b.target,S=0,c=b.__root;if(c){var _e=F.indexOf(c);if(_e!==-1&&(g===document||g===window)){b.__root=g;return}var me=F.indexOf(g);if(me===-1)return;_e<=me&&(S=_e)}if(O=F[S]||b.target,O!==g){Km(b,"currentTarget",{configurable:!0,get(){return O||T}});var ze=kt,Ze=Yt;hn(null),ma(null);try{for(var Ae,le=[];O!==null;){var Ve=O.assignedSlot||O.parentNode||O.host||null;try{var Nt=O["__"+C];if(Nt!=null&&(!O.disabled||b.target===O))if(ip(Nt)){var[Gt,..._i]=Nt;Gt.apply(O,[b,..._i])}else Nt.call(O,b)}catch(ri){Ae?le.push(ri):Ae=ri}if(b.cancelBubble||Ve===g||Ve===null)break;O=Ve}if(Ae){for(let ri of le)queueMicrotask(()=>{throw ri});throw Ae}}finally{b.__root=g,delete b.currentTarget,hn(ze),ma(Ze)}}}function Xg(b){var g;g=document.head.appendChild(xp());try{Cp(()=>b(g),ap)}finally{}}function Yg(b){var g=document.createElement("template");return g.innerHTML=b,g.content}function Np(b,g){var T=Yt;T.nodes_start===null&&(T.nodes_start=b,T.nodes_end=g)}function Dh(b,g){var T=(g&gg)!==0,C=(g&_g)!==0,F,O=!b.startsWith("<!>");return()=>{F===void 0&&(F=Yg(O?b:"<!>"+b),T||(F=Ch(F)));var S=C||gp?document.importNode(F,!0):F.cloneNode(!0);if(T){var c=Ch(S),_e=S.lastChild;Np(c,_e)}else Np(S,S);return S}}function Lh(b,g){b!==null&&b.before(g)}function Jg(b,g){var T=g==null?"":typeof g=="object"?g+"":g;T!==(b.__t??(b.__t=b.nodeValue))&&(b.__t=T,b.nodeValue=T+"")}function Qg(b,g){return e_(b,g)}const io=new Map;function e_(b,{target:g,anchor:T,props:C={},events:F,context:O,intro:S=!0}){bg();var c=new Set,_e=Ze=>{for(var Ae=0;Ae<Ze.length;Ae++){var le=Ze[Ae];if(!c.has(le)){c.add(le);var Ve=Gg(le);g.addEventListener(le,cl,{passive:Ve});var Nt=io.get(le);Nt===void 0?(document.addEventListener(le,cl,{passive:Ve}),io.set(le,1)):io.set(le,Nt+1)}}};_e(Hm(jp)),Rh.add(_e);var me=void 0,ze=Mg(()=>{var Ze=T??g.appendChild(xp());return Cg(()=>{if(O){up({});var Ae=rr;Ae.c=O}F&&(C.$$events=F),me=b(Ze,C)||{},O&&hp()}),()=>{var Ve;for(var Ae of c){g.removeEventListener(Ae,cl);var le=io.get(Ae);--le===0?(document.removeEventListener(Ae,cl),io.delete(Ae)):io.set(Ae,le)}Rh.delete(_e),Ze!==T&&((Ve=Ze.parentNode)==null||Ve.removeChild(Ze))}});return t_.set(me,ze),me}let t_=new WeakMap;const Zp=[...`
2
+ \r\f \v\uFEFF`];function i_(b,g,T){var C=b==null?"":""+b;if(g&&(C=C?C+" "+g:g),T){for(var F in T)if(T[F])C=C?C+" "+F:F;else if(C.length)for(var O=F.length,S=0;(S=C.indexOf(F,S))>=0;){var c=S+O;(S===0||Zp.includes(C[S-1]))&&(c===C.length||Zp.includes(C[c]))?C=(S===0?"":C.substring(0,S))+C.substring(c+1):S=c}}return C===""?null:C}function Vp(b,g=!1){var T=g?" !important;":";",C="";for(var F in b){var O=b[F];O!=null&&O!==""&&(C+=" "+F+": "+O+T)}return C}function r_(b,g){if(g){var T="",C,F;return Array.isArray(g)?(C=g[0],F=g[1]):C=g,C&&(T+=Vp(C)),F&&(T+=Vp(F,!0)),T=T.trim(),T===""?null:T}return String(b)}function Up(b,g,T,C,F,O){var S=b.__className;if(S!==T||S===void 0){var c=i_(T,C,O);c==null?b.removeAttribute("class"):b.className=c,b.__className=T}else if(O&&F!==O)for(var _e in O){var me=!!O[_e];(F==null||me!==!!F[_e])&&b.classList.toggle(_e,me)}return O}function Fh(b,g={},T,C){for(var F in T){var O=T[F];g[F]!==O&&(T[F]==null?b.style.removeProperty(F):b.style.setProperty(F,O,C))}}function n_(b,g,T,C){var F=b.__style;if(F!==g){var O=r_(g,C);O==null?b.removeAttribute("style"):b.style.cssText=O,b.__style=g}else C&&(Array.isArray(C)?(Fh(b,T==null?void 0:T[0],C[0]),Fh(b,T==null?void 0:T[1],C[1],"important")):Fh(b,T,C));return C}function $p(b,g){return b===g||(b==null?void 0:b[al])===g}function a_(b={},g,T,C){return Eh(()=>{var F,O;return Ig(()=>{F=O,O=[],Yc(()=>{b!==T(...O)&&(g(b,...O),F&&$p(T(...F),b)&&g(null,...F))})}),()=>{Rp(()=>{O&&$p(T(...O),b)&&g(null,...O)})}}),b}let Jc=!1;function s_(b){var g=Jc;try{return Jc=!1,[b(),Jc]}finally{Jc=g}}function Gp(b){var g;return((g=b.ctx)==null?void 0:g.d)??!1}function hs(b,g,T,C){var Xi;var F=(T&dg)!==0,O=!0,S=(T&fg)!==0,c=(T&mg)!==0,_e=!1,me;S?[me,_e]=s_(()=>b[g]):me=b[g];var ze=al in b||ig in b,Ze=S&&(((Xi=Js(b,g))==null?void 0:Xi.set)??(ze&&g in b&&(ht=>b[g]=ht)))||void 0,Ae=C,le=!0,Ve=!1,Nt=()=>(Ve=!0,le&&(le=!1,c?Ae=Yc(C):Ae=C),Ae);me===void 0&&C!==void 0&&(Ze&&O&&lg(),me=Nt(),Ze&&Ze(me));var Gt;if(Gt=()=>{var ht=b[g];return ht===void 0?Nt():(le=!0,Ve=!1,ht)},(T&pg)===0)return Gt;if(Ze){var _i=b.$$legacy;return function(ht,bt){return arguments.length>0?((!bt||_i||_e)&&Ze(bt?Gt():ht),ht):Gt()}}var si=!1,ri=xg(me),At=wp(()=>{var ht=Gt(),bt=Nr(ri);return si?(si=!1,bt):ri.v=ht});return S&&Nr(At),F||(At.equals=lp),function(ht,bt){if(arguments.length>0){const Ct=bt?Nr(At):S?ls(ht):ht;if(!At.equals(Ct)){if(si=!0,cn(ri,Ct),Ve&&Ae!==void 0&&(Ae=Ct),Gp(At))return ht;Yc(()=>Nr(At))}return ht}return Gp(At)?At.v:Nr(At)}}function o_(b){rr===null&&yg(),Mp(()=>{const g=Yc(b);if(typeof g=="function")return g})}const l_="5";typeof window<"u"&&((cf=window.__svelte??(window.__svelte={})).v??(cf.v=new Set)).add(l_);var c_=Dh("<span> </span>");function qp(b,g){let T=hs(g,"color",3,"inherit"),C=hs(g,"size",3,24),F=hs(g,"scale",3,1),O=hs(g,"weight",3,"normal"),S=hs(g,"transition",3,""),c=hs(g,"filled",3,!1),_e=C()+"px";var me=c_();let ze,Ze;var Ae=ol(me);Ip(le=>{ze=Up(me,1,"material-symbols-rounded icon svelte-1b6sfbe",null,ze,le),Ze=n_(me,"",Ze,{scale:F(),color:T(),transition:S(),"font-weight":O(),"font-size":_e,width:_e,height:_e}),Jg(Ae,g.name)},[()=>({filled:c()})]),Lh(b,me)}const u_={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}}]},h_={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 St;(function(b){b.assertEqual=F=>F;function g(F){}b.assertIs=g;function T(F){throw new Error}b.assertNever=T,b.arrayToEnum=F=>{const O={};for(const S of F)O[S]=S;return O},b.getValidEnumValues=F=>{const O=b.objectKeys(F).filter(c=>typeof F[F[c]]!="number"),S={};for(const c of O)S[c]=F[c];return b.objectValues(S)},b.objectValues=F=>b.objectKeys(F).map(function(O){return F[O]}),b.objectKeys=typeof Object.keys=="function"?F=>Object.keys(F):F=>{const O=[];for(const S in F)Object.prototype.hasOwnProperty.call(F,S)&&O.push(S);return O},b.find=(F,O)=>{for(const S of F)if(O(S))return S},b.isInteger=typeof Number.isInteger=="function"?F=>Number.isInteger(F):F=>typeof F=="number"&&isFinite(F)&&Math.floor(F)===F;function C(F,O=" | "){return F.map(S=>typeof S=="string"?`'${S}'`:S).join(O)}b.joinValues=C,b.jsonStringifyReplacer=(F,O)=>typeof O=="bigint"?O.toString():O})(St||(St={}));var Bh;(function(b){b.mergeShapes=(g,T)=>({...g,...T})})(Bh||(Bh={}));const Ke=St.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fn=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=St.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"]),d_=b=>JSON.stringify(b,null,2).replace(/"([^"]+)":/g,"$1:");class dr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=C=>{this.issues=[...this.issues,C]},this.addIssues=(C=[])=>{this.issues=[...this.issues,...C]};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(O){return O.message},C={_errors:[]},F=O=>{for(const S of O.issues)if(S.code==="invalid_union")S.unionErrors.map(F);else if(S.code==="invalid_return_type")F(S.returnTypeError);else if(S.code==="invalid_arguments")F(S.argumentsError);else if(S.path.length===0)C._errors.push(T(S));else{let c=C,_e=0;for(;_e<S.path.length;){const me=S.path[_e];_e===S.path.length-1?(c[me]=c[me]||{_errors:[]},c[me]._errors.push(T(S))):c[me]=c[me]||{_errors:[]},c=c[me],_e++}}};return F(this),C}static assert(g){if(!(g instanceof dr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,St.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=T=>T.message){const T={},C=[];for(const F of this.issues)F.path.length>0?(T[F.path[0]]=T[F.path[0]]||[],T[F.path[0]].push(g(F))):C.push(g(F));return{formErrors:C,fieldErrors:T}}get formErrors(){return this.flatten()}}dr.create=b=>new dr(b);const ro=(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,St.jsonStringifyReplacer)}`;break;case Fe.unrecognized_keys:T=`Unrecognized key(s) in object: ${St.joinValues(b.keys,", ")}`;break;case Fe.invalid_union:T="Invalid input";break;case Fe.invalid_union_discriminator:T=`Invalid discriminator value. Expected ${St.joinValues(b.options)}`;break;case Fe.invalid_enum_value:T=`Invalid enum value. Expected ${St.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}"`:St.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,St.assertNever(b)}return{message:T}};let Wp=ro;function p_(b){Wp=b}function Qc(){return Wp}const eu=b=>{const{data:g,path:T,errorMaps:C,issueData:F}=b,O=[...T,...F.path||[]],S={...F,path:O};if(F.message!==void 0)return{...F,path:O,message:F.message};let c="";const _e=C.filter(me=>!!me).slice().reverse();for(const me of _e)c=me(S,{data:g,defaultError:c}).message;return{...F,path:O,message:c}},f_=[];function Ge(b,g){const T=Qc(),C=eu({issueData:g,data:b.data,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,T,T===ro?void 0:ro].filter(F=>!!F)});b.common.issues.push(C)}class ji{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,T){const C=[];for(const F of T){if(F.status==="aborted")return ot;F.status==="dirty"&&g.dirty(),C.push(F.value)}return{status:g.value,value:C}}static async mergeObjectAsync(g,T){const C=[];for(const F of T){const O=await F.key,S=await F.value;C.push({key:O,value:S})}return ji.mergeObjectSync(g,C)}static mergeObjectSync(g,T){const C={};for(const F of T){const{key:O,value:S}=F;if(O.status==="aborted"||S.status==="aborted")return ot;O.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),O.value!=="__proto__"&&(typeof S.value<"u"||F.alwaysSet)&&(C[O.value]=S.value)}return{status:g.value,value:C}}}const ot=Object.freeze({status:"aborted"}),no=b=>({status:"dirty",value:b}),Ki=b=>({status:"valid",value:b}),Oh=b=>b.status==="aborted",jh=b=>b.status==="dirty",ds=b=>b.status==="valid",ul=b=>typeof Promise<"u"&&b instanceof Promise;function tu(b,g,T,C){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 Hp(b,g,T,C,F){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 hl,dl;class dn{constructor(g,T,C,F){this._cachedPath=[],this.parent=g,this.data=T,this._path=C,this._key=F}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(ds(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 dr(b.common.issues);return this._error=T,this._error}}};function dt(b){if(!b)return{};const{errorMap:g,invalid_type_error:T,required_error:C,description:F}=b;if(g&&(T||C))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:F}:{errorMap:(S,c)=>{var _e,me;const{message:ze}=b;return S.code==="invalid_enum_value"?{message:ze??c.defaultError}:typeof c.data>"u"?{message:(_e=ze??C)!==null&&_e!==void 0?_e:c.defaultError}:S.code!=="invalid_type"?{message:c.defaultError}:{message:(me=ze??T)!==null&&me!==void 0?me:c.defaultError}},description:F}}class gt{get description(){return this._def.description}_getType(g){return Fn(g.data)}_getOrReturnCtx(g,T){return T||{common:g.parent.common,data:g.data,parsedType:Fn(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new ji,ctx:{common:g.parent.common,data:g.data,parsedType:Fn(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const T=this._parse(g);if(ul(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 C=this.safeParse(g,T);if(C.success)return C.data;throw C.error}safeParse(g,T){var C;const F={common:{issues:[],async:(C=T==null?void 0:T.async)!==null&&C!==void 0?C:!1,contextualErrorMap:T==null?void 0:T.errorMap},path:(T==null?void 0:T.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Fn(g)},O=this._parseSync({data:g,path:F.path,parent:F});return Kp(F,O)}"~validate"(g){var T,C;const F={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Fn(g)};if(!this["~standard"].async)try{const O=this._parseSync({data:g,path:[],parent:F});return ds(O)?{value:O.value}:{issues:F.common.issues}}catch(O){!((C=(T=O==null?void 0:O.message)===null||T===void 0?void 0:T.toLowerCase())===null||C===void 0)&&C.includes("encountered")&&(this["~standard"].async=!0),F.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:F}).then(O=>ds(O)?{value:O.value}:{issues:F.common.issues})}async parseAsync(g,T){const C=await this.safeParseAsync(g,T);if(C.success)return C.data;throw C.error}async safeParseAsync(g,T){const C={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:Fn(g)},F=this._parse({data:g,path:C.path,parent:C}),O=await(ul(F)?F:Promise.resolve(F));return Kp(C,O)}refine(g,T){const C=F=>typeof T=="string"||typeof T>"u"?{message:T}:typeof T=="function"?T(F):T;return this._refinement((F,O)=>{const S=g(F),c=()=>O.addIssue({code:Fe.custom,...C(F)});return typeof Promise<"u"&&S instanceof Promise?S.then(_e=>_e?!0:(c(),!1)):S?!0:(c(),!1)})}refinement(g,T){return this._refinement((C,F)=>g(C)?!0:(F.addIssue(typeof T=="function"?T(C,F):T),!1))}_refinement(g){return new Ur({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 Vr.create(this)}promise(){return lo.create(this,this._def)}or(g){return gl.create([this,g],this._def)}and(g){return _l.create(this,g,this._def)}transform(g){return new Ur({...dt(this._def),schema:this,typeName:at.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const T=typeof g=="function"?g:()=>g;return new wl({...dt(this._def),innerType:this,defaultValue:T,typeName:at.ZodDefault})}brand(){return new Vh({typeName:at.ZodBranded,type:this,...dt(this._def)})}catch(g){const T=typeof g=="function"?g:()=>g;return new Tl({...dt(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 Pl.create(this,g)}readonly(){return Sl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const m_=/^c[^\s-]{8,}$/i,g_=/^[0-9a-z]+$/,__=/^[0-9A-HJKMNP-TV-Z]{26}$/i,y_=/^[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,x_=/^[a-z0-9_-]{21}$/i,v_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,b_=/^[-+]?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)?)??$/,w_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Nh;const P_=/^(?:(?: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])$/,S_=/^(?:(?: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])$/,M_=/^(([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]))$/,I_=/^(([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])$/,C_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,E_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xp="((\\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])))",z_=new RegExp(`^${Xp}$`);function Yp(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 k_(b){return new RegExp(`^${Yp(b)}$`)}function Jp(b){let g=`${Xp}T${Yp(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 A_(b,g){return!!((g==="v4"||!g)&&P_.test(b)||(g==="v6"||!g)&&M_.test(b))}function R_(b,g){if(!v_.test(b))return!1;try{const[T]=b.split("."),C=T.replace(/-/g,"+").replace(/_/g,"/").padEnd(T.length+(4-T.length%4)%4,"="),F=JSON.parse(atob(C));return!(typeof F!="object"||F===null||!F.typ||!F.alg||g&&F.alg!==g)}catch{return!1}}function D_(b,g){return!!((g==="v4"||!g)&&S_.test(b)||(g==="v6"||!g)&&I_.test(b))}class Zr extends gt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ke.string){const O=this._getOrReturnCtx(g);return Ge(O,{code:Fe.invalid_type,expected:Ke.string,received:O.parsedType}),ot}const C=new ji;let F;for(const O of this._def.checks)if(O.kind==="min")g.data.length<O.value&&(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.too_small,minimum:O.value,type:"string",inclusive:!0,exact:!1,message:O.message}),C.dirty());else if(O.kind==="max")g.data.length>O.value&&(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.too_big,maximum:O.value,type:"string",inclusive:!0,exact:!1,message:O.message}),C.dirty());else if(O.kind==="length"){const S=g.data.length>O.value,c=g.data.length<O.value;(S||c)&&(F=this._getOrReturnCtx(g,F),S?Ge(F,{code:Fe.too_big,maximum:O.value,type:"string",inclusive:!0,exact:!0,message:O.message}):c&&Ge(F,{code:Fe.too_small,minimum:O.value,type:"string",inclusive:!0,exact:!0,message:O.message}),C.dirty())}else if(O.kind==="email")w_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"email",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="emoji")Nh||(Nh=new RegExp(T_,"u")),Nh.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"emoji",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="uuid")y_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"uuid",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="nanoid")x_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"nanoid",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="cuid")m_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"cuid",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="cuid2")g_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"cuid2",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="ulid")__.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"ulid",code:Fe.invalid_string,message:O.message}),C.dirty());else if(O.kind==="url")try{new URL(g.data)}catch{F=this._getOrReturnCtx(g,F),Ge(F,{validation:"url",code:Fe.invalid_string,message:O.message}),C.dirty()}else O.kind==="regex"?(O.regex.lastIndex=0,O.regex.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"regex",code:Fe.invalid_string,message:O.message}),C.dirty())):O.kind==="trim"?g.data=g.data.trim():O.kind==="includes"?g.data.includes(O.value,O.position)||(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.invalid_string,validation:{includes:O.value,position:O.position},message:O.message}),C.dirty()):O.kind==="toLowerCase"?g.data=g.data.toLowerCase():O.kind==="toUpperCase"?g.data=g.data.toUpperCase():O.kind==="startsWith"?g.data.startsWith(O.value)||(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.invalid_string,validation:{startsWith:O.value},message:O.message}),C.dirty()):O.kind==="endsWith"?g.data.endsWith(O.value)||(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.invalid_string,validation:{endsWith:O.value},message:O.message}),C.dirty()):O.kind==="datetime"?Jp(O).test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.invalid_string,validation:"datetime",message:O.message}),C.dirty()):O.kind==="date"?z_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.invalid_string,validation:"date",message:O.message}),C.dirty()):O.kind==="time"?k_(O).test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.invalid_string,validation:"time",message:O.message}),C.dirty()):O.kind==="duration"?b_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"duration",code:Fe.invalid_string,message:O.message}),C.dirty()):O.kind==="ip"?A_(g.data,O.version)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"ip",code:Fe.invalid_string,message:O.message}),C.dirty()):O.kind==="jwt"?R_(g.data,O.alg)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"jwt",code:Fe.invalid_string,message:O.message}),C.dirty()):O.kind==="cidr"?D_(g.data,O.version)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"cidr",code:Fe.invalid_string,message:O.message}),C.dirty()):O.kind==="base64"?C_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"base64",code:Fe.invalid_string,message:O.message}),C.dirty()):O.kind==="base64url"?E_.test(g.data)||(F=this._getOrReturnCtx(g,F),Ge(F,{validation:"base64url",code:Fe.invalid_string,message:O.message}),C.dirty()):St.assertNever(O);return{status:C.value,value:g.data}}_regex(g,T,C){return this.refinement(F=>g.test(F),{validation:T,code:Fe.invalid_string,...et.errToObj(C)})}_addCheck(g){return new Zr({...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,C;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:(C=g==null?void 0:g.local)!==null&&C!==void 0?C:!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 Zr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zr({...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}}Zr.create=b=>{var g;return new Zr({checks:[],typeName:at.ZodString,coerce:(g=b==null?void 0:b.coerce)!==null&&g!==void 0?g:!1,...dt(b)})};function L_(b,g){const T=(b.toString().split(".")[1]||"").length,C=(g.toString().split(".")[1]||"").length,F=T>C?T:C,O=parseInt(b.toFixed(F).replace(".","")),S=parseInt(g.toFixed(F).replace(".",""));return O%S/Math.pow(10,F)}class _a extends gt{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 O=this._getOrReturnCtx(g);return Ge(O,{code:Fe.invalid_type,expected:Ke.number,received:O.parsedType}),ot}let C;const F=new ji;for(const O of this._def.checks)O.kind==="int"?St.isInteger(g.data)||(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.invalid_type,expected:"integer",received:"float",message:O.message}),F.dirty()):O.kind==="min"?(O.inclusive?g.data<O.value:g.data<=O.value)&&(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.too_small,minimum:O.value,type:"number",inclusive:O.inclusive,exact:!1,message:O.message}),F.dirty()):O.kind==="max"?(O.inclusive?g.data>O.value:g.data>=O.value)&&(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.too_big,maximum:O.value,type:"number",inclusive:O.inclusive,exact:!1,message:O.message}),F.dirty()):O.kind==="multipleOf"?L_(g.data,O.value)!==0&&(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.not_multiple_of,multipleOf:O.value,message:O.message}),F.dirty()):O.kind==="finite"?Number.isFinite(g.data)||(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.not_finite,message:O.message}),F.dirty()):St.assertNever(O);return{status:F.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,C,F){return new _a({...this._def,checks:[...this._def.checks,{kind:g,value:T,inclusive:C,message:et.toString(F)}]})}_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"&&St.isInteger(g.value))}get isFinite(){let g=null,T=null;for(const C of this._def.checks){if(C.kind==="finite"||C.kind==="int"||C.kind==="multipleOf")return!0;C.kind==="min"?(T===null||C.value>T)&&(T=C.value):C.kind==="max"&&(g===null||C.value<g)&&(g=C.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,...dt(b)});class ya extends gt{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 C;const F=new ji;for(const O of this._def.checks)O.kind==="min"?(O.inclusive?g.data<O.value:g.data<=O.value)&&(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.too_small,type:"bigint",minimum:O.value,inclusive:O.inclusive,message:O.message}),F.dirty()):O.kind==="max"?(O.inclusive?g.data>O.value:g.data>=O.value)&&(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.too_big,type:"bigint",maximum:O.value,inclusive:O.inclusive,message:O.message}),F.dirty()):O.kind==="multipleOf"?g.data%O.value!==BigInt(0)&&(C=this._getOrReturnCtx(g,C),Ge(C,{code:Fe.not_multiple_of,multipleOf:O.value,message:O.message}),F.dirty()):St.assertNever(O);return{status:F.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,C,F){return new ya({...this._def,checks:[...this._def.checks,{kind:g,value:T,inclusive:C,message:et.toString(F)}]})}_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,...dt(b)})};class pl extends gt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ke.boolean){const C=this._getOrReturnCtx(g);return Ge(C,{code:Fe.invalid_type,expected:Ke.boolean,received:C.parsedType}),ot}return Ki(g.data)}}pl.create=b=>new pl({typeName:at.ZodBoolean,coerce:(b==null?void 0:b.coerce)||!1,...dt(b)});class ps extends gt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ke.date){const O=this._getOrReturnCtx(g);return Ge(O,{code:Fe.invalid_type,expected:Ke.date,received:O.parsedType}),ot}if(isNaN(g.data.getTime())){const O=this._getOrReturnCtx(g);return Ge(O,{code:Fe.invalid_date}),ot}const C=new ji;let F;for(const O of this._def.checks)O.kind==="min"?g.data.getTime()<O.value&&(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.too_small,message:O.message,inclusive:!0,exact:!1,minimum:O.value,type:"date"}),C.dirty()):O.kind==="max"?g.data.getTime()>O.value&&(F=this._getOrReturnCtx(g,F),Ge(F,{code:Fe.too_big,message:O.message,inclusive:!0,exact:!1,maximum:O.value,type:"date"}),C.dirty()):St.assertNever(O);return{status:C.value,value:new Date(g.data.getTime())}}_addCheck(g){return new ps({...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}}ps.create=b=>new ps({checks:[],coerce:(b==null?void 0:b.coerce)||!1,typeName:at.ZodDate,...dt(b)});class iu extends gt{_parse(g){if(this._getType(g)!==Ke.symbol){const C=this._getOrReturnCtx(g);return Ge(C,{code:Fe.invalid_type,expected:Ke.symbol,received:C.parsedType}),ot}return Ki(g.data)}}iu.create=b=>new iu({typeName:at.ZodSymbol,...dt(b)});class fl extends gt{_parse(g){if(this._getType(g)!==Ke.undefined){const C=this._getOrReturnCtx(g);return Ge(C,{code:Fe.invalid_type,expected:Ke.undefined,received:C.parsedType}),ot}return Ki(g.data)}}fl.create=b=>new fl({typeName:at.ZodUndefined,...dt(b)});class ml extends gt{_parse(g){if(this._getType(g)!==Ke.null){const C=this._getOrReturnCtx(g);return Ge(C,{code:Fe.invalid_type,expected:Ke.null,received:C.parsedType}),ot}return Ki(g.data)}}ml.create=b=>new ml({typeName:at.ZodNull,...dt(b)});class ao extends gt{constructor(){super(...arguments),this._any=!0}_parse(g){return Ki(g.data)}}ao.create=b=>new ao({typeName:at.ZodAny,...dt(b)});class fs extends gt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Ki(g.data)}}fs.create=b=>new fs({typeName:at.ZodUnknown,...dt(b)});class Bn extends gt{_parse(g){const T=this._getOrReturnCtx(g);return Ge(T,{code:Fe.invalid_type,expected:Ke.never,received:T.parsedType}),ot}}Bn.create=b=>new Bn({typeName:at.ZodNever,...dt(b)});class ru extends gt{_parse(g){if(this._getType(g)!==Ke.undefined){const C=this._getOrReturnCtx(g);return Ge(C,{code:Fe.invalid_type,expected:Ke.void,received:C.parsedType}),ot}return Ki(g.data)}}ru.create=b=>new ru({typeName:at.ZodVoid,...dt(b)});class Vr extends gt{_parse(g){const{ctx:T,status:C}=this._processInputParams(g),F=this._def;if(T.parsedType!==Ke.array)return Ge(T,{code:Fe.invalid_type,expected:Ke.array,received:T.parsedType}),ot;if(F.exactLength!==null){const S=T.data.length>F.exactLength.value,c=T.data.length<F.exactLength.value;(S||c)&&(Ge(T,{code:S?Fe.too_big:Fe.too_small,minimum:c?F.exactLength.value:void 0,maximum:S?F.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:F.exactLength.message}),C.dirty())}if(F.minLength!==null&&T.data.length<F.minLength.value&&(Ge(T,{code:Fe.too_small,minimum:F.minLength.value,type:"array",inclusive:!0,exact:!1,message:F.minLength.message}),C.dirty()),F.maxLength!==null&&T.data.length>F.maxLength.value&&(Ge(T,{code:Fe.too_big,maximum:F.maxLength.value,type:"array",inclusive:!0,exact:!1,message:F.maxLength.message}),C.dirty()),T.common.async)return Promise.all([...T.data].map((S,c)=>F.type._parseAsync(new dn(T,S,T.path,c)))).then(S=>ji.mergeArray(C,S));const O=[...T.data].map((S,c)=>F.type._parseSync(new dn(T,S,T.path,c)));return ji.mergeArray(C,O)}get element(){return this._def.type}min(g,T){return new Vr({...this._def,minLength:{value:g,message:et.toString(T)}})}max(g,T){return new Vr({...this._def,maxLength:{value:g,message:et.toString(T)}})}length(g,T){return new Vr({...this._def,exactLength:{value:g,message:et.toString(T)}})}nonempty(g){return this.min(1,g)}}Vr.create=(b,g)=>new Vr({type:b,minLength:null,maxLength:null,exactLength:null,typeName:at.ZodArray,...dt(g)});function so(b){if(b instanceof ii){const g={};for(const T in b.shape){const C=b.shape[T];g[T]=fn.create(so(C))}return new ii({...b._def,shape:()=>g})}else return b instanceof Vr?new Vr({...b._def,type:so(b.element)}):b instanceof fn?fn.create(so(b.unwrap())):b instanceof va?va.create(so(b.unwrap())):b instanceof pn?pn.create(b.items.map(g=>so(g))):b}class ii extends gt{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=St.objectKeys(g);return this._cached={shape:g,keys:T}}_parse(g){if(this._getType(g)!==Ke.object){const me=this._getOrReturnCtx(g);return Ge(me,{code:Fe.invalid_type,expected:Ke.object,received:me.parsedType}),ot}const{status:C,ctx:F}=this._processInputParams(g),{shape:O,keys:S}=this._getCached(),c=[];if(!(this._def.catchall instanceof Bn&&this._def.unknownKeys==="strip"))for(const me in F.data)S.includes(me)||c.push(me);const _e=[];for(const me of S){const ze=O[me],Ze=F.data[me];_e.push({key:{status:"valid",value:me},value:ze._parse(new dn(F,Ze,F.path,me)),alwaysSet:me in F.data})}if(this._def.catchall instanceof Bn){const me=this._def.unknownKeys;if(me==="passthrough")for(const ze of c)_e.push({key:{status:"valid",value:ze},value:{status:"valid",value:F.data[ze]}});else if(me==="strict")c.length>0&&(Ge(F,{code:Fe.unrecognized_keys,keys:c}),C.dirty());else if(me!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const me=this._def.catchall;for(const ze of c){const Ze=F.data[ze];_e.push({key:{status:"valid",value:ze},value:me._parse(new dn(F,Ze,F.path,ze)),alwaysSet:ze in F.data})}}return F.common.async?Promise.resolve().then(async()=>{const me=[];for(const ze of _e){const Ze=await ze.key,Ae=await ze.value;me.push({key:Ze,value:Ae,alwaysSet:ze.alwaysSet})}return me}).then(me=>ji.mergeObjectSync(C,me)):ji.mergeObjectSync(C,_e)}get shape(){return this._def.shape()}strict(g){return et.errToObj,new ii({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(T,C)=>{var F,O,S,c;const _e=(S=(O=(F=this._def).errorMap)===null||O===void 0?void 0:O.call(F,T,C).message)!==null&&S!==void 0?S:C.defaultError;return T.code==="unrecognized_keys"?{message:(c=et.errToObj(g).message)!==null&&c!==void 0?c:_e}:{message:_e}}}:{}})}strip(){return new ii({...this._def,unknownKeys:"strip"})}passthrough(){return new ii({...this._def,unknownKeys:"passthrough"})}extend(g){return new ii({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new ii({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 ii({...this._def,catchall:g})}pick(g){const T={};return St.objectKeys(g).forEach(C=>{g[C]&&this.shape[C]&&(T[C]=this.shape[C])}),new ii({...this._def,shape:()=>T})}omit(g){const T={};return St.objectKeys(this.shape).forEach(C=>{g[C]||(T[C]=this.shape[C])}),new ii({...this._def,shape:()=>T})}deepPartial(){return so(this)}partial(g){const T={};return St.objectKeys(this.shape).forEach(C=>{const F=this.shape[C];g&&!g[C]?T[C]=F:T[C]=F.optional()}),new ii({...this._def,shape:()=>T})}required(g){const T={};return St.objectKeys(this.shape).forEach(C=>{if(g&&!g[C])T[C]=this.shape[C];else{let O=this.shape[C];for(;O instanceof fn;)O=O._def.innerType;T[C]=O}}),new ii({...this._def,shape:()=>T})}keyof(){return Qp(St.objectKeys(this.shape))}}ii.create=(b,g)=>new ii({shape:()=>b,unknownKeys:"strip",catchall:Bn.create(),typeName:at.ZodObject,...dt(g)}),ii.strictCreate=(b,g)=>new ii({shape:()=>b,unknownKeys:"strict",catchall:Bn.create(),typeName:at.ZodObject,...dt(g)}),ii.lazycreate=(b,g)=>new ii({shape:b,unknownKeys:"strip",catchall:Bn.create(),typeName:at.ZodObject,...dt(g)});class gl extends gt{_parse(g){const{ctx:T}=this._processInputParams(g),C=this._def.options;function F(O){for(const c of O)if(c.result.status==="valid")return c.result;for(const c of O)if(c.result.status==="dirty")return T.common.issues.push(...c.ctx.common.issues),c.result;const S=O.map(c=>new dr(c.ctx.common.issues));return Ge(T,{code:Fe.invalid_union,unionErrors:S}),ot}if(T.common.async)return Promise.all(C.map(async O=>{const S={...T,common:{...T.common,issues:[]},parent:null};return{result:await O._parseAsync({data:T.data,path:T.path,parent:S}),ctx:S}})).then(F);{let O;const S=[];for(const _e of C){const me={...T,common:{...T.common,issues:[]},parent:null},ze=_e._parseSync({data:T.data,path:T.path,parent:me});if(ze.status==="valid")return ze;ze.status==="dirty"&&!O&&(O={result:ze,ctx:me}),me.common.issues.length&&S.push(me.common.issues)}if(O)return T.common.issues.push(...O.ctx.common.issues),O.result;const c=S.map(_e=>new dr(_e));return Ge(T,{code:Fe.invalid_union,unionErrors:c}),ot}}get options(){return this._def.options}}gl.create=(b,g)=>new gl({options:b,typeName:at.ZodUnion,...dt(g)});const On=b=>b instanceof xl?On(b.schema):b instanceof Ur?On(b.innerType()):b instanceof vl?[b.value]:b instanceof xa?b.options:b instanceof bl?St.objectValues(b.enum):b instanceof wl?On(b._def.innerType):b instanceof fl?[void 0]:b instanceof ml?[null]:b instanceof fn?[void 0,...On(b.unwrap())]:b instanceof va?[null,...On(b.unwrap())]:b instanceof Vh||b instanceof Sl?On(b.unwrap()):b instanceof Tl?On(b._def.innerType):[];class nu extends gt{_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 C=this.discriminator,F=T.data[C],O=this.optionsMap.get(F);return O?T.common.async?O._parseAsync({data:T.data,path:T.path,parent:T}):O._parseSync({data:T.data,path:T.path,parent:T}):(Ge(T,{code:Fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[C]}),ot)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,T,C){const F=new Map;for(const O of T){const S=On(O.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const c of S){if(F.has(c))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(c)}`);F.set(c,O)}}return new nu({typeName:at.ZodDiscriminatedUnion,discriminator:g,options:T,optionsMap:F,...dt(C)})}}function Zh(b,g){const T=Fn(b),C=Fn(g);if(b===g)return{valid:!0,data:b};if(T===Ke.object&&C===Ke.object){const F=St.objectKeys(g),O=St.objectKeys(b).filter(c=>F.indexOf(c)!==-1),S={...b,...g};for(const c of O){const _e=Zh(b[c],g[c]);if(!_e.valid)return{valid:!1};S[c]=_e.data}return{valid:!0,data:S}}else if(T===Ke.array&&C===Ke.array){if(b.length!==g.length)return{valid:!1};const F=[];for(let O=0;O<b.length;O++){const S=b[O],c=g[O],_e=Zh(S,c);if(!_e.valid)return{valid:!1};F.push(_e.data)}return{valid:!0,data:F}}else return T===Ke.date&&C===Ke.date&&+b==+g?{valid:!0,data:b}:{valid:!1}}class _l extends gt{_parse(g){const{status:T,ctx:C}=this._processInputParams(g),F=(O,S)=>{if(Oh(O)||Oh(S))return ot;const c=Zh(O.value,S.value);return c.valid?((jh(O)||jh(S))&&T.dirty(),{status:T.value,value:c.data}):(Ge(C,{code:Fe.invalid_intersection_types}),ot)};return C.common.async?Promise.all([this._def.left._parseAsync({data:C.data,path:C.path,parent:C}),this._def.right._parseAsync({data:C.data,path:C.path,parent:C})]).then(([O,S])=>F(O,S)):F(this._def.left._parseSync({data:C.data,path:C.path,parent:C}),this._def.right._parseSync({data:C.data,path:C.path,parent:C}))}}_l.create=(b,g,T)=>new _l({left:b,right:g,typeName:at.ZodIntersection,...dt(T)});class pn extends gt{_parse(g){const{status:T,ctx:C}=this._processInputParams(g);if(C.parsedType!==Ke.array)return Ge(C,{code:Fe.invalid_type,expected:Ke.array,received:C.parsedType}),ot;if(C.data.length<this._def.items.length)return Ge(C,{code:Fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;!this._def.rest&&C.data.length>this._def.items.length&&(Ge(C,{code:Fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T.dirty());const O=[...C.data].map((S,c)=>{const _e=this._def.items[c]||this._def.rest;return _e?_e._parse(new dn(C,S,C.path,c)):null}).filter(S=>!!S);return C.common.async?Promise.all(O).then(S=>ji.mergeArray(T,S)):ji.mergeArray(T,O)}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,...dt(g)})};class yl extends gt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:T,ctx:C}=this._processInputParams(g);if(C.parsedType!==Ke.object)return Ge(C,{code:Fe.invalid_type,expected:Ke.object,received:C.parsedType}),ot;const F=[],O=this._def.keyType,S=this._def.valueType;for(const c in C.data)F.push({key:O._parse(new dn(C,c,C.path,c)),value:S._parse(new dn(C,C.data[c],C.path,c)),alwaysSet:c in C.data});return C.common.async?ji.mergeObjectAsync(T,F):ji.mergeObjectSync(T,F)}get element(){return this._def.valueType}static create(g,T,C){return T instanceof gt?new yl({keyType:g,valueType:T,typeName:at.ZodRecord,...dt(C)}):new yl({keyType:Zr.create(),valueType:g,typeName:at.ZodRecord,...dt(T)})}}class au extends gt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:T,ctx:C}=this._processInputParams(g);if(C.parsedType!==Ke.map)return Ge(C,{code:Fe.invalid_type,expected:Ke.map,received:C.parsedType}),ot;const F=this._def.keyType,O=this._def.valueType,S=[...C.data.entries()].map(([c,_e],me)=>({key:F._parse(new dn(C,c,C.path,[me,"key"])),value:O._parse(new dn(C,_e,C.path,[me,"value"]))}));if(C.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const _e of S){const me=await _e.key,ze=await _e.value;if(me.status==="aborted"||ze.status==="aborted")return ot;(me.status==="dirty"||ze.status==="dirty")&&T.dirty(),c.set(me.value,ze.value)}return{status:T.value,value:c}})}else{const c=new Map;for(const _e of S){const me=_e.key,ze=_e.value;if(me.status==="aborted"||ze.status==="aborted")return ot;(me.status==="dirty"||ze.status==="dirty")&&T.dirty(),c.set(me.value,ze.value)}return{status:T.value,value:c}}}}au.create=(b,g,T)=>new au({valueType:g,keyType:b,typeName:at.ZodMap,...dt(T)});class ms extends gt{_parse(g){const{status:T,ctx:C}=this._processInputParams(g);if(C.parsedType!==Ke.set)return Ge(C,{code:Fe.invalid_type,expected:Ke.set,received:C.parsedType}),ot;const F=this._def;F.minSize!==null&&C.data.size<F.minSize.value&&(Ge(C,{code:Fe.too_small,minimum:F.minSize.value,type:"set",inclusive:!0,exact:!1,message:F.minSize.message}),T.dirty()),F.maxSize!==null&&C.data.size>F.maxSize.value&&(Ge(C,{code:Fe.too_big,maximum:F.maxSize.value,type:"set",inclusive:!0,exact:!1,message:F.maxSize.message}),T.dirty());const O=this._def.valueType;function S(_e){const me=new Set;for(const ze of _e){if(ze.status==="aborted")return ot;ze.status==="dirty"&&T.dirty(),me.add(ze.value)}return{status:T.value,value:me}}const c=[...C.data.values()].map((_e,me)=>O._parse(new dn(C,_e,C.path,me)));return C.common.async?Promise.all(c).then(_e=>S(_e)):S(c)}min(g,T){return new ms({...this._def,minSize:{value:g,message:et.toString(T)}})}max(g,T){return new ms({...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)}}ms.create=(b,g)=>new ms({valueType:b,minSize:null,maxSize:null,typeName:at.ZodSet,...dt(g)});class oo extends gt{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 C(c,_e){return eu({data:c,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,Qc(),ro].filter(me=>!!me),issueData:{code:Fe.invalid_arguments,argumentsError:_e}})}function F(c,_e){return eu({data:c,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,Qc(),ro].filter(me=>!!me),issueData:{code:Fe.invalid_return_type,returnTypeError:_e}})}const O={errorMap:T.common.contextualErrorMap},S=T.data;if(this._def.returns instanceof lo){const c=this;return Ki(async function(..._e){const me=new dr([]),ze=await c._def.args.parseAsync(_e,O).catch(le=>{throw me.addIssue(C(_e,le)),me}),Ze=await Reflect.apply(S,this,ze);return await c._def.returns._def.type.parseAsync(Ze,O).catch(le=>{throw me.addIssue(F(Ze,le)),me})})}else{const c=this;return Ki(function(..._e){const me=c._def.args.safeParse(_e,O);if(!me.success)throw new dr([C(_e,me.error)]);const ze=Reflect.apply(S,this,me.data),Ze=c._def.returns.safeParse(ze,O);if(!Ze.success)throw new dr([F(ze,Ze.error)]);return Ze.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new oo({...this._def,args:pn.create(g).rest(fs.create())})}returns(g){return new oo({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,T,C){return new oo({args:g||pn.create([]).rest(fs.create()),returns:T||fs.create(),typeName:at.ZodFunction,...dt(C)})}}class xl extends gt{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})}}xl.create=(b,g)=>new xl({getter:b,typeName:at.ZodLazy,...dt(g)});class vl extends gt{_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}}vl.create=(b,g)=>new vl({value:b,typeName:at.ZodLiteral,...dt(g)});function Qp(b,g){return new xa({values:b,typeName:at.ZodEnum,...dt(g)})}class xa extends gt{constructor(){super(...arguments),hl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const T=this._getOrReturnCtx(g),C=this._def.values;return Ge(T,{expected:St.joinValues(C),received:T.parsedType,code:Fe.invalid_type}),ot}if(tu(this,hl)||Hp(this,hl,new Set(this._def.values)),!tu(this,hl).has(g.data)){const T=this._getOrReturnCtx(g),C=this._def.values;return Ge(T,{received:T.data,code:Fe.invalid_enum_value,options:C}),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(C=>!g.includes(C)),{...this._def,...T})}}hl=new WeakMap,xa.create=Qp;class bl extends gt{constructor(){super(...arguments),dl.set(this,void 0)}_parse(g){const T=St.getValidEnumValues(this._def.values),C=this._getOrReturnCtx(g);if(C.parsedType!==Ke.string&&C.parsedType!==Ke.number){const F=St.objectValues(T);return Ge(C,{expected:St.joinValues(F),received:C.parsedType,code:Fe.invalid_type}),ot}if(tu(this,dl)||Hp(this,dl,new Set(St.getValidEnumValues(this._def.values))),!tu(this,dl).has(g.data)){const F=St.objectValues(T);return Ge(C,{received:C.data,code:Fe.invalid_enum_value,options:F}),ot}return Ki(g.data)}get enum(){return this._def.values}}dl=new WeakMap,bl.create=(b,g)=>new bl({values:b,typeName:at.ZodNativeEnum,...dt(g)});class lo extends gt{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 C=T.parsedType===Ke.promise?T.data:Promise.resolve(T.data);return Ki(C.then(F=>this._def.type.parseAsync(F,{path:T.path,errorMap:T.common.contextualErrorMap})))}}lo.create=(b,g)=>new lo({type:b,typeName:at.ZodPromise,...dt(g)});class Ur extends gt{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:C}=this._processInputParams(g),F=this._def.effect||null,O={addIssue:S=>{Ge(C,S),S.fatal?T.abort():T.dirty()},get path(){return C.path}};if(O.addIssue=O.addIssue.bind(O),F.type==="preprocess"){const S=F.transform(C.data,O);if(C.common.async)return Promise.resolve(S).then(async c=>{if(T.value==="aborted")return ot;const _e=await this._def.schema._parseAsync({data:c,path:C.path,parent:C});return _e.status==="aborted"?ot:_e.status==="dirty"||T.value==="dirty"?no(_e.value):_e});{if(T.value==="aborted")return ot;const c=this._def.schema._parseSync({data:S,path:C.path,parent:C});return c.status==="aborted"?ot:c.status==="dirty"||T.value==="dirty"?no(c.value):c}}if(F.type==="refinement"){const S=c=>{const _e=F.refinement(c,O);if(C.common.async)return Promise.resolve(_e);if(_e instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(C.common.async===!1){const c=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});return c.status==="aborted"?ot:(c.status==="dirty"&&T.dirty(),S(c.value),{status:T.value,value:c.value})}else return this._def.schema._parseAsync({data:C.data,path:C.path,parent:C}).then(c=>c.status==="aborted"?ot:(c.status==="dirty"&&T.dirty(),S(c.value).then(()=>({status:T.value,value:c.value}))))}if(F.type==="transform")if(C.common.async===!1){const S=this._def.schema._parseSync({data:C.data,path:C.path,parent:C});if(!ds(S))return S;const c=F.transform(S.value,O);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:C.data,path:C.path,parent:C}).then(S=>ds(S)?Promise.resolve(F.transform(S.value,O)).then(c=>({status:T.value,value:c})):S);St.assertNever(F)}}Ur.create=(b,g,T)=>new Ur({schema:b,typeName:at.ZodEffects,effect:g,...dt(T)}),Ur.createWithPreprocess=(b,g,T)=>new Ur({schema:g,effect:{type:"preprocess",transform:b},typeName:at.ZodEffects,...dt(T)});class fn extends gt{_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,...dt(g)});class va extends gt{_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,...dt(g)});class wl extends gt{_parse(g){const{ctx:T}=this._processInputParams(g);let C=T.data;return T.parsedType===Ke.undefined&&(C=this._def.defaultValue()),this._def.innerType._parse({data:C,path:T.path,parent:T})}removeDefault(){return this._def.innerType}}wl.create=(b,g)=>new wl({innerType:b,typeName:at.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...dt(g)});class Tl extends gt{_parse(g){const{ctx:T}=this._processInputParams(g),C={...T,common:{...T.common,issues:[]}},F=this._def.innerType._parse({data:C.data,path:C.path,parent:{...C}});return ul(F)?F.then(O=>({status:"valid",value:O.status==="valid"?O.value:this._def.catchValue({get error(){return new dr(C.common.issues)},input:C.data})})):{status:"valid",value:F.status==="valid"?F.value:this._def.catchValue({get error(){return new dr(C.common.issues)},input:C.data})}}removeCatch(){return this._def.innerType}}Tl.create=(b,g)=>new Tl({innerType:b,typeName:at.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...dt(g)});class su extends gt{_parse(g){if(this._getType(g)!==Ke.nan){const C=this._getOrReturnCtx(g);return Ge(C,{code:Fe.invalid_type,expected:Ke.nan,received:C.parsedType}),ot}return{status:"valid",value:g.data}}}su.create=b=>new su({typeName:at.ZodNaN,...dt(b)});const F_=Symbol("zod_brand");class Vh extends gt{_parse(g){const{ctx:T}=this._processInputParams(g),C=T.data;return this._def.type._parse({data:C,path:T.path,parent:T})}unwrap(){return this._def.type}}class Pl extends gt{_parse(g){const{status:T,ctx:C}=this._processInputParams(g);if(C.common.async)return(async()=>{const O=await this._def.in._parseAsync({data:C.data,path:C.path,parent:C});return O.status==="aborted"?ot:O.status==="dirty"?(T.dirty(),no(O.value)):this._def.out._parseAsync({data:O.value,path:C.path,parent:C})})();{const F=this._def.in._parseSync({data:C.data,path:C.path,parent:C});return F.status==="aborted"?ot:F.status==="dirty"?(T.dirty(),{status:"dirty",value:F.value}):this._def.out._parseSync({data:F.value,path:C.path,parent:C})}}static create(g,T){return new Pl({in:g,out:T,typeName:at.ZodPipeline})}}class Sl extends gt{_parse(g){const T=this._def.innerType._parse(g),C=F=>(ds(F)&&(F.value=Object.freeze(F.value)),F);return ul(T)?T.then(F=>C(F)):C(T)}unwrap(){return this._def.innerType}}Sl.create=(b,g)=>new Sl({innerType:b,typeName:at.ZodReadonly,...dt(g)});function ef(b,g){const T=typeof b=="function"?b(g):typeof b=="string"?{message:b}:b;return typeof T=="string"?{message:T}:T}function tf(b,g={},T){return b?ao.create().superRefine((C,F)=>{var O,S;const c=b(C);if(c instanceof Promise)return c.then(_e=>{var me,ze;if(!_e){const Ze=ef(g,C),Ae=(ze=(me=Ze.fatal)!==null&&me!==void 0?me:T)!==null&&ze!==void 0?ze:!0;F.addIssue({code:"custom",...Ze,fatal:Ae})}});if(!c){const _e=ef(g,C),me=(S=(O=_e.fatal)!==null&&O!==void 0?O:T)!==null&&S!==void 0?S:!0;F.addIssue({code:"custom",..._e,fatal:me})}}):ao.create()}const B_={object:ii.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 O_=(b,g={message:`Input not instance of ${b.name}`})=>tf(T=>T instanceof b,g),rf=Zr.create,nf=_a.create,j_=su.create,N_=ya.create,af=pl.create,Z_=ps.create,V_=iu.create,U_=fl.create,$_=ml.create,G_=ao.create,q_=fs.create,W_=Bn.create,H_=ru.create,K_=Vr.create,X_=ii.create,Y_=ii.strictCreate,J_=gl.create,Q_=nu.create,ey=_l.create,ty=pn.create,iy=yl.create,ry=au.create,ny=ms.create,ay=oo.create,sy=xl.create,oy=vl.create,ly=xa.create,cy=bl.create,uy=lo.create,sf=Ur.create,hy=fn.create,dy=va.create,py=Ur.createWithPreprocess,fy=Pl.create;var mn=Object.freeze({__proto__:null,defaultErrorMap:ro,setErrorMap:p_,getErrorMap:Qc,makeIssue:eu,EMPTY_PATH:f_,addIssueToContext:Ge,ParseStatus:ji,INVALID:ot,DIRTY:no,OK:Ki,isAborted:Oh,isDirty:jh,isValid:ds,isAsync:ul,get util(){return St},get objectUtil(){return Bh},ZodParsedType:Ke,getParsedType:Fn,ZodType:gt,datetimeRegex:Jp,ZodString:Zr,ZodNumber:_a,ZodBigInt:ya,ZodBoolean:pl,ZodDate:ps,ZodSymbol:iu,ZodUndefined:fl,ZodNull:ml,ZodAny:ao,ZodUnknown:fs,ZodNever:Bn,ZodVoid:ru,ZodArray:Vr,ZodObject:ii,ZodUnion:gl,ZodDiscriminatedUnion:nu,ZodIntersection:_l,ZodTuple:pn,ZodRecord:yl,ZodMap:au,ZodSet:ms,ZodFunction:oo,ZodLazy:xl,ZodLiteral:vl,ZodEnum:xa,ZodNativeEnum:bl,ZodPromise:lo,ZodEffects:Ur,ZodTransformer:Ur,ZodOptional:fn,ZodNullable:va,ZodDefault:wl,ZodCatch:Tl,ZodNaN:su,BRAND:F_,ZodBranded:Vh,ZodPipeline:Pl,ZodReadonly:Sl,custom:tf,Schema:gt,ZodSchema:gt,late:B_,get ZodFirstPartyTypeKind(){return at},coerce:{string:b=>Zr.create({...b,coerce:!0}),number:b=>_a.create({...b,coerce:!0}),boolean:b=>pl.create({...b,coerce:!0}),bigint:b=>ya.create({...b,coerce:!0}),date:b=>ps.create({...b,coerce:!0})},any:G_,array:K_,bigint:N_,boolean:af,date:Z_,discriminatedUnion:Q_,effect:sf,enum:ly,function:ay,instanceof:O_,intersection:ey,lazy:sy,literal:oy,map:ry,nan:j_,nativeEnum:cy,never:W_,null:$_,nullable:dy,number:nf,object:X_,oboolean:()=>af().optional(),onumber:()=>nf().optional(),optional:hy,ostring:()=>rf().optional(),pipeline:fy,preprocess:py,promise:uy,record:iy,set:ny,strictObject:Y_,string:rf,symbol:V_,transformer:sf,tuple:ty,undefined:U_,union:J_,unknown:q_,void:H_,NEVER:ot,ZodIssueCode:Fe,quotelessJson:d_,ZodError:dr});const my=mn.object({container:mn.string().or(mn.instanceof(HTMLElement)),position:mn.object({center:mn.object({lat:mn.number(),lng:mn.number()}),zoom:mn.number()}),theme:mn.literal("dark").or(mn.literal("light"))}),gy=512,_y=0,yy=18;function xy(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var ou={exports:{}};/**
3
+ * MapLibre GL JS
4
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.3.0/LICENSE.txt
5
+ */var vy=ou.exports,of;function by(){return of||(of=1,function(b,g){(function(T,C){b.exports=C()})(vy,function(){var T={},C={};function F(S,c,_e){if(C[S]=_e,S==="index"){var me="var sharedModule = {}; ("+C.shared+")(sharedModule); ("+C.worker+")(sharedModule);",ze={};return C.shared(ze),C.index(T,ze),typeof window<"u"&&T.setWorkerUrl(window.URL.createObjectURL(new Blob([me],{type:"text/javascript"}))),T}}F("shared",["exports"],function(S){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(M){M(P)})).then(p,m)}y((a=a.apply(r,t||[])).next())})}function _e(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var me,ze;function Ze(){if(ze)return me;function r(t,n){this.x=t,this.y=n}return ze=1,me=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},me}typeof SuppressedError=="function"&&SuppressedError;var Ae,le,Ve=_e(Ze()),Nt=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}(),Gt=_e(Nt);let _i,si;function ri(){return _i==null&&(_i=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),_i}function At(){if(si==null&&(si=!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){si=!0;break}}}return si||!1}var Xi,ht=1e-6,bt=typeof Float32Array<"u"?Float32Array:Array;function Ct(){var r=new bt(9);return bt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function jn(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 Jt(){var r=new bt(3);return bt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function pr(r,t,n){var a=new bt(3);return a[0]=r,a[1]=t,a[2]=n,a}function $r(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 nr(){var r=new bt(4);return bt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ei(){var r=new bt(2);return bt!=Float32Array&&(r[0]=0,r[1]=0),r}function gs(r,t){var n=new bt(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)}),Jt(),Xi=new bt(4),bt!=Float32Array&&(Xi[0]=0,Xi[1]=0,Xi[2]=0,Xi[3]=0),Jt(),pr(1,0,0),pr(0,1,0),nr(),nr(),Ct(),Ei();const Mt=8192;function ba(r,t,n){return t*(Mt/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function gn(r,t){return(r%t+t)%t}function Nn(r,t,n){return r*(1-n)+t*n}function Zn(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 wa(r,t,n,a){const l=new Gt(r,t,n,a);return d=>l.solve(d)}const Er=wa(.25,.1,.25,1);function fr(r,t,n){return Math.min(n,Math.max(t,r))}function ar(r,t,n){const a=n-t,l=((r-t)%a+a)%a+t;return l===t?n:l}function Ti(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let Vn=1;function Un(r,t,n){const a={};for(const l in r)a[l]=t.call(this,r[l],l,r);return a}function $n(r,t,n){const a={};for(const l in r)t.call(this,r[l],l,r)&&(a[l]=r[l]);return a}function Yi(r){return Array.isArray(r)?r.map(Yi):typeof r=="object"&&r?Un(r,Yi):r}const _s={};function zi(r){_s[r]||(typeof console<"u"&&console.warn(r),_s[r]=!0)}function ui(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function Gr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Qt=null;function Gn(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const qn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function mr(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,M,k,R){const L=4*Math.max(1,0),j=(Math.max(0,M)-M)*k*4+L,$=4*k,H=Math.max(0,P),re=Math.max(0,M);return{rect:{x:H,y:re,width:Math.min(v.width,P+k)-H,height:Math.min(v.height,M+R)-re},layout:[{offset:j,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 _n,yn;function gr(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function _r(r){return r/Math.PI*180}const Ta={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Pa={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ys="AbortError";function Wn(){return new Error(ys)}const xn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Sa(r){return xn.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const qr="global-dispatcher";class zr 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 Wr=()=>Gr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Ma=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=Sa(r.url);if(a)return a(r,t);if(Gr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:qr},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(Wr())&&!/^\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:Wr(),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 zr(0,v.message,a.url,new Blob)}if(!p.ok){const v=yield p.blob();throw new zr(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 Wn();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if(Gr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:qr},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 zr(y.status,y.statusText,a.url,v))}},l.signal.addEventListener("abort",()=>{y.abort(),p(Wn())}),y.send(a.body)})}(r,t)};function xs(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 co(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function Hr(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={}){Ti(this,n),this.type=t}}class N extends ce{constructor(t,n={}){super("error",Ti({error:t},n))}}class V{on(t,n){return this._listeners=this._listeners||{},co(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return Hr(t,n,this._listeners),Hr(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},co(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)Hr(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Ti(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof N&&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 we(r,t,n){he(t,{command:"removeSource",args:[r]}),n[r]=!0}function ye(r,t,n,a){we(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 xe{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 yt={kind:"null"},ke={kind:"number"},qe={kind:"string"},Oe={kind:"boolean"},st={kind:"color"},qt={kind:"projectionDefinition"},Kr={kind:"object"},it={kind:"value"},hi={kind:"collator"},Lt={kind:"formatted"},uo={kind:"padding"},Ia={kind:"resolvedImage"},vn={kind:"variableAnchorOffsetCollection"};function Ni(r,t){return{kind:"array",itemType:r,N:t}}function Ut(r){if(r.kind==="array"){const t=Ut(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const Uh=[yt,ke,qe,Oe,st,qt,Lt,Kr,Ni(it),uo,Ia,vn];function Ca(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ca(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 Uh)if(!Ca(n,t))return null}}return`Expected ${Ut(r)} but found ${Ut(t)} instead.`}function Ml(r,t){return t.some(n=>n.kind===r.kind)}function bn(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 Ea(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const lu=.96422,cu=.82521,uu=4/29,za=6/29,hu=3*za*za,$h=za*za*za,du=Math.PI/180,vs=180/Math.PI;function pu(r){return(r%=360)<0&&(r+=360),r}function fu([r,t,n,a]){let l,d;const p=Il((.2225045*(r=Hn(r))+.7168786*(t=Hn(t))+.0606169*(n=Hn(n)))/1);r===t&&t===n?l=d=p:(l=Il((.4360747*r+.3850649*t+.1430804*n)/lu),d=Il((.0139322*r+.0971045*t+.7141733*n)/cu));const m=116*p-16;return[m<0?0:m,500*(l-p),200*(p-d),a]}function Hn(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Il(r){return r>$h?Math.pow(r,1/3):r/hu+uu}function mu([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*ho(l),d=lu*ho(d),p=cu*ho(p),[Cl(3.1338561*d-1.6168667*l-.4906146*p),Cl(-.9787684*d+1.9161415*l+.033454*p),Cl(.0719453*d-.2289914*l+1.4052427*p),a]}function Cl(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function ho(r){return r>za?r*r*r:hu*(r-uu)}function bs(r){return parseInt(r.padEnd(2,r),16)/255}function yr(r,t){return pt(t?r/100:r,0,1)}function pt(r,t,n){return Math.min(Math.max(t,r),n)}function Kn(r){return!r.some(Number.isNaN)}const wn={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 Xr(r,t,n){return r+n*(t-r)}function ka(r,t,n){return r.map((a,l)=>Xr(a,t[l],n))}class xt{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 xt)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=wn[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[bs(a.slice(m,m+=p)),bs(a.slice(m,m+=p)),bs(a.slice(m,m+=p)),bs(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,M,k,R,L,j,$,H,re]=p,X=[P||" ",R||" ",$].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const A=[v,k,j].join(""),U=A==="%%%"?100:A===""?255:0;if(U){const J=[pt(+y/U,0,1),pt(+M/U,0,1),pt(+L/U,0,1),H?yr(+H,re):1];if(Kn(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,M,k,R,L]=d,j=[y||" ",P||" ",k].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const $=[+m,pt(+v,0,100),pt(+M,0,100),R?yr(+R,L):1];if(Kn($))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=pu(H),re/=100,X/=100,[U(0),U(8),U(4),A]}($)}}}(t);return n?new xt(...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]=fu(t),p=Math.sqrt(a*a+l*l);return[Math.round(1e4*p)?pu(Math.atan2(l,a)*vs):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",fu(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]=ka(t.rgb,n.rgb,a);return new xt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[v,P,M,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,M!==1&&M!==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[j,$,H,re]=function([X,A,U,J]){return X=isNaN(X)?0:X*du,mu([U,Math.cos(X)*A,Math.sin(X)*A,J])}([R,L??Xr(p,P,a),Xr(m,M,a),Xr(y,k,a)]);return new xt(j,$,H,re,!1)}case"lab":{const[d,p,m,y]=mu(ka(t.lab,n.lab,a));return new xt(d,p,m,y,!1)}}}}xt.black=new xt(0,0,0,1),xt.white=new xt(1,1,1,1),xt.transparent=new xt(0,0,0,0),xt.red=new xt(1,0,0,1);class sr{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 ws=["bottom","center","top"];class Aa{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 Li{constructor(t){this.sections=t}static fromString(t){return new Li([new Aa(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 Li?t:Li.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Pi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Pi)return t;if(typeof t=="number")return new Pi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const 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 Pi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new Pi(ka(t.values,n.values,a))}}class Zt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const po=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Fi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Fi)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"||!po.has(a)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Fi(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 Zt(`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 Zt(`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,M]=d[m+1];p.push([Xr(y,P,a),Xr(v,M,a)])}return new Fi(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 di{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new di(t,n,a)}static parse(t){return t instanceof di?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new di(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new di(t.from,t.to,t.transition):typeof t=="string"?new di(t,t,1):void 0}}function gu(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 Tn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof di||r instanceof xt||r instanceof sr||r instanceof Li||r instanceof Pi||r instanceof Fi||r instanceof Zi)return!0;if(Array.isArray(r)){for(const t of r)if(!Tn(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Tn(r[t]))return!1;return!0}return!1}function Vt(r){if(r===null)return yt;if(typeof r=="string")return qe;if(typeof r=="boolean")return Oe;if(typeof r=="number")return ke;if(r instanceof xt)return st;if(r instanceof di)return qt;if(r instanceof sr)return hi;if(r instanceof Li)return Lt;if(r instanceof Pi)return uo;if(r instanceof Fi)return vn;if(r instanceof Zi)return Ia;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const l=Vt(a);if(n){if(n===l)continue;n=it;break}n=l}return Ni(n||it,t)}return Kr}function Ra(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof xt||r instanceof di||r instanceof Li||r instanceof Pi||r instanceof Fi||r instanceof Zi?r.toString():JSON.stringify(r)}class Pn{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(!Tn(t[1]))return n.error("invalid value");const a=t[1];let l=Vt(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 Pn(l,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ts={string:qe,number:ke,boolean:Oe,object:Kr};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 Ts)||v==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ts[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(!Ts[d])throw new Error(`Types doesn't contain name = ${d}`);a=Ts[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(!Ca(this.type,Vt(a)))return a;if(n===this.args.length-1)throw new Zt(`Expected value to be of type ${Ut(this.type)}, but found ${Ut(Vt(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Ft={"to-boolean":Oe,"to-color":st,"to-number":ke,"to-string":qe};class kr{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(!Ft[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=Ft[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 kr(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 xt)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.`:gu(n[0],n[1],n[2],n[3]),!a))return new xt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Zt(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=Pi.parse(n);if(l)return l}throw new Zt(`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=Fi.parse(n);if(l)return l}throw new Zt(`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 Zt(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return Li.fromString(Ra(this.args[0].evaluate(t)));case"resolvedImage":return Zi.fromString(Ra(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ra(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const wt=["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"?wt[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]=xt.parse(t)),n}}class Da{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 kr(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 Pn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new ct;try{p=new Pn(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 Da(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=Ca(t,n);return a&&this.error(a),a}}class _t{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 _t(a,l):null}outputDefined(){return this.result.outputDefined()}}class La{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 La(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 xr{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,ke),l=n.parse(t[2],2,Ni(n.expectedType||it));return a&&l?new xr(l.type.itemType,a,l):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new Zt(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new Zt(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new Zt(`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 Ps{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?Ml(a.type,[Oe,qe,ke,yt,it])?new Ps(a,l):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ut(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!bn(n,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${Ut(Vt(n))} instead.`);if(!bn(a,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${Ut(Vt(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ss{constructor(t,n,a){this.type=ke,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(!Ml(a.type,[Oe,qe,ke,yt,it]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ut(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,ke);return d?new Ss(a,l,d):null}return new Ss(a,l)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!bn(n,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${Ut(Vt(n))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),bn(a,["string"])){const d=a.indexOf(n,l);return d===-1?-1:[...a.slice(0,d)].length}if(bn(a,["array"]))return a.indexOf(n,l);throw new Zt(`Expected second argument to be of type array or string, but found ${Ut(Vt(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class fo{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 M=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,Vt(L)))return null}else a=Vt(L);if(d[String(L)]!==void 0)return k.error("Branch labels must be unique.");d[String(L)]=p.length}const R=n.parse(M,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 fo(a,l,m,d,p,y):null}evaluate(t){const n=this.input.evaluate(t);return(Vt(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 Ms{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 Ms(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 Is{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,ke);if(!a||!l)return null;if(!Ml(a.type,[Ni(it),qe,it]))return n.error(`Expected first argument to be of type array or string, but found ${Ut(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,ke);return d?new Is(a.type,a,l,d):null}return new Is(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)),bn(n,["string"]))return[...n].slice(a,l).join("");if(bn(n,["array"]))return n.slice(a,l);throw new Zt(`Expected first argument to be of type array or string, but found ${Ut(Vt(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function mo(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 Zt("Input is not a number.");p=m-1}return 0}class Fa{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,ke);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 M=n.parse(y,P,d);if(!M)return null;d=d||M.type,l.push([m,M])}return new Fa(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[mo(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 _u(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Xn,Si,go=function(){if(Si)return Xn;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 Si=1,Xn=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))}},Xn}(),yu=_u(go);class ki{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=oi(n,t.base,a,l);else if(t.name==="linear")d=oi(n,1,a,l);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new yu(p[0],p[1],p[2],p[3]).solve(oi(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,ke),!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],M=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(M,R,y);if(!L)return null;y=y||L.type,m.push([P,L])}return Ea(y,ke)||Ea(y,qt)||Ea(y,st)||Ea(y,uo)||Ea(y,vn)||Ea(y,Ni(ke))?new ki(y,a,l,d,m):n.error(`Type ${Ut(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=mo(n,l),m=ki.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 Xr(y,v,m);case"color":return xt.interpolate(y,v,m);case"padding":return Pi.interpolate(y,v,m);case"variableAnchorOffsetCollection":return Fi.interpolate(y,v,m);case"array":return ka(y,v,m);case"projectionDefinition":return di.interpolate(y,v,m)}case"interpolate-hcl":return xt.interpolate(y,v,m,"hcl");case"interpolate-lab":return xt.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 oi(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 vr={color:xt.interpolate,number:Xr,padding:Pi.interpolate,variableAnchorOffsetCollection:Fi.interpolate,array:ka};class Ba{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=>Ca(l,m.type));return new Ba(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 El(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 xu(r,t,n,a){return a.compare(t,n)===0}function Yr(r,t,n){const a=r!=="=="&&r!=="!=";return class qm{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(!El(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${Ut(y.type)}'.`);let v=p.parse(d[2],2,it);if(!v)return null;if(!El(m,v.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${Ut(v.type)}'.`);if(y.type.kind!==v.type.kind&&y.type.kind!=="value"&&v.type.kind!=="value")return p.error(`Cannot compare types '${Ut(y.type)}' and '${Ut(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,hi),!P)return null}return new qm(y,v,P)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=Vt(p),v=Vt(m);if(y.kind!==v.kind||y.kind!=="string"&&y.kind!=="number")throw new Zt(`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=Vt(p),v=Vt(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 zl=Yr("==",function(r,t,n){return t===n},xu),Gh=Yr("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!xu(0,t,n,a)}),_o=Yr("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),yo=Yr(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),br=Yr("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),vu=Yr(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class Yn{constructor(t,n,a){this.type=hi,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 Yn(l,d,p)}evaluate(t){return new sr(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 kl{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,ke);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,ke),!m))return null;let y=null;return l["max-fraction-digits"]&&(y=n.parse(l["max-fraction-digits"],1,ke),!y)?null:new kl(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 Oa{constructor(t){this.type=Lt,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,ke),!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 M=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!ws.includes(m["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(M=n.parse(m["vertical-align"],1,qe),!M)return null}const k=l[l.length-1];k.scale=y,k.font=v,k.textColor=P,k.verticalAlign=M}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 Oa(l)}evaluate(t){return new Li(this.sections.map(n=>{const a=n.content.evaluate(t);return Vt(a)===Ia?new Aa("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new Aa(Ra(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 Al{constructor(t){this.type=Ia,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 Al(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 Rl{constructor(t){this.type=ke,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 ${Ut(a.type)} instead.`):new Rl(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 Zt(`Expected value to be of type string or array, but found ${Ut(Vt(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Ar=8192;function qh(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*Ar),Math.round(a*l*Ar)]}function ja(r,t){const n=Math.pow(2,t.z);return[(l=(r[0]/Ar+t.x)/n,360*l-180),(a=(r[1]/Ar+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,l}function Cs(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 Na(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function bu(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 xo(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&&!(!Pu(r,t,n,a)||!Pu(n,a,r,t));var l,d}function wu(r,t,n){for(const a of n)for(let l=0;l<a.length-1;++l)if(xo(r,t,a[l],a[l+1]))return!0;return!1}function Za(r,t,n=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(bu(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 Wh(r,t){for(const n of t)if(Za(r,n))return!0;return!1}function Tu(r,t){for(const n of r)if(!Za(n,t))return!1;for(let n=0;n<r.length-1;++n)if(wu(r[n],r[n+1],t))return!1;return!0}function Hh(r,t){for(const n of t)if(Tu(r,n))return!0;return!1}function Pu(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 vo(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=qh(r[l][p],n);Cs(t,m),d.push(m)}a.push(d)}return a}function Dl(r,t,n){const a=[];for(let l=0;l<r.length;l++){const d=vo(r[l],t,n);a.push(d)}return a}function Ll(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}Cs(t,r)}function Su(r,t,n,a){const l=Math.pow(2,a.z)*Ar,d=[a.x*Ar,a.y*Ar],p=[];for(const m of r)for(const y of m){const v=[y.x+d[0],y.y+d[1]];Ll(v,t,n,l),p.push(v)}return p}function Mu(r,t,n,a){const l=Math.pow(2,a.z)*Ar,d=[a.x*Ar,a.y*Ar],p=[];for(const y of r){const v=[];for(const P of y){const M=[P.x+d[0],P.y+d[1]];Cs(t,M),v.push(M)}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)Ll(v,t,n,l)}var m;return p}class Jn{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(Tn(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 Jn(a,{type:"MultiPolygon",coordinates:l})}else if(a.type==="Feature"){const l=a.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Jn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Jn(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=vo(a.coordinates,d,p),y=Su(n.geometry(),l,d,p);if(!Na(l,d))return!1;for(const v of y)if(!Za(v,m))return!1}if(a.type==="MultiPolygon"){const m=Dl(a.coordinates,d,p),y=Su(n.geometry(),l,d,p);if(!Na(l,d))return!1;for(const v of y)if(!Wh(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=vo(a.coordinates,d,p),y=Mu(n.geometry(),l,d,p);if(!Na(l,d))return!1;for(const v of y)if(!Tu(v,m))return!1}if(a.type==="MultiPolygon"){const m=Dl(a.coordinates,d,p),y=Mu(n.geometry(),l,d,p);if(!Na(l,d))return!1;for(const v of y)if(!Hh(v,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let bo=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 Iu(r,t,n=0,a=r.length-1,l=Kh){for(;a>n;){if(a-n>600){const y=a-n+1,v=t-n+1,P=Math.log(y),M=.5*Math.exp(2*P/3),k=.5*Math.sqrt(P*M*(y-M)/y)*(v-y/2<0?-1:1);Iu(r,t,Math.max(n,Math.floor(t-v*M/y+k)),Math.min(a,Math.floor(t+(y-v)*M/y+k)),l)}const d=r[t];let p=n,m=a;for(Es(r,n,t),l(r[a],d)>0&&Es(r,n,a);p<m;){for(Es(r,p,m),p++,m--;l(r[p],d)<0;)p++;for(;l(r[m],d)>0;)m--}l(r[n],d)===0?Es(r,n,m):(m++,Es(r,m,a)),m<=t&&(n=m+1),t<=m&&(a=m-1)}}function Es(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Kh(r,t){return r<t?-1:r>t?1:0}function zs(r,t){if(r.length<=1)return[r];const n=[];let a,l;for(const d of r){const p=Xh(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||(Iu(n[d],t,1,n[d].length-1,Cu),n[d]=n[d].slice(0,t));return n}function Cu(r,t){return t.area-r.area}function Xh(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 Eu=1/298.257223563,Fl=Eu*(2-Eu),Bl=Math.PI/180;class Ol{constructor(t){const n=6378.137*Bl*1e3,a=Math.cos(t*Bl),l=1/(1-Fl*(1-a*a)),d=Math.sqrt(l);this.kx=n*d*a,this.ky=n*d*l*(1-Fl)}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],M=this.wrap(t[y+1][0]-v)*this.kx,k=(t[y+1][1]-P)*this.ky,R=0;M===0&&k===0||(R=(this.wrap(n[0]-v)*this.kx*M+(n[1]-P)*this.ky*k)/(M*M+k*k),R>1?(v=t[y+1][0],P=t[y+1][1]):R>0&&(v+=M/this.kx*R,P+=k/this.ky*R)),M=this.wrap(n[0]-v)*this.kx,k=(n[1]-P)*this.ky;const L=M*M+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 zu(r,t){return t[0]-r[0]}function wo(r){return r[1]-r[0]+1}function Rr(r,t){return r[1]>=r[0]&&r[1]<t}function jl(r,t){if(r[0]>r[1])return[null,null];const n=wo(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 Nl(r,t){if(!Rr(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)Cs(n,r[a]);return n}function Zl(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Cs(t,a);return t}function ku(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Tt(r,t,n){if(!ku(r)||!ku(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 Qn(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function Vl(r,t,n,a,l){const d=Math.min(Qn(r,[n,a],l),Qn(t,[n,a],l)),p=Math.min(Qn(n,[r,t],l),Qn(a,[r,t],l));return Math.min(d,p)}function Yh(r,t,n,a,l){if(!Rr(t,r.length)||!Rr(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],M=n[v+1];if(xo(m,y,P,M))return 0;d=Math.min(d,Vl(m,y,P,M,l))}}return d}function Jh(r,t,n,a,l){if(!Rr(t,r.length)||!Rr(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 Qh(r,t,n){if(Za(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,Qn(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 ed(r,t,n,a){if(!Rr(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(Za(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,M=P-1;v<P;M=v++){const k=y[M],R=y[v];if(xo(p,m,k,R))return 0;l=Math.min(l,Vl(p,m,k,R,a))}}return l}function Au(r,t){for(const n of r)for(const a of n)if(Za(a,t,!0))return!0;return!1}function td(r,t,n,a=1/0){const l=Zl(r),d=Zl(t);if(a!==1/0&&Tt(l,d,n)>=a)return a;if(Na(l,d)){if(Au(r,t))return 0}else if(Au(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 M=m[P],k=m[y];for(const R of t)for(let L=0,j=R.length,$=j-1;L<j;$=L++){const H=R[$],re=R[L];if(xo(M,k,H,re))return 0;p=Math.min(p,Vl(M,k,H,re,n))}}return p}function Ru(r,t,n,a,l,d){if(!d)return;const p=Tt(Nl(a,d),l,n);p<t&&r.push([p,d,[0,0]])}function To(r,t,n,a,l,d,p){if(!d||!p)return;const m=Tt(Nl(a,d),Nl(l,p),n);m<t&&r.push([m,d,p])}function Po(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 bo([[0,[0,r.length-1],[0,0]]],zu),m=Zl(n);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const v=y[1],P=t?50:100;if(wo(v)<=P){if(!Rr(v,r.length))return NaN;if(t){const M=ed(r,v,n,a);if(isNaN(M)||M===0)return M;d=Math.min(d,M)}else for(let M=v[0];M<=v[1];++M){const k=Qh(r[M],n,a);if(d=Math.min(d,k),d===0)return 0}}else{const M=jl(v,t);Ru(p,d,a,r,m,M[0]),Ru(p,d,a,r,m,M[1])}}return d}function So(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 bo([[0,[0,r.length-1],[0,n.length-1]]],zu);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const v=y[1],P=y[2],M=t?50:100,k=a?50:100;if(wo(v)<=M&&wo(P)<=k){if(!Rr(v,r.length)&&Rr(P,n.length))return NaN;let R;if(t&&a)R=Yh(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 j=P[0];j<=P[1];++j)if(R=Qn(n[j],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 j=v[0];j<=v[1];++j)if(R=Qn(r[j],L,l),p=Math.min(p,R),p===0)return p}else R=Jh(r,v,n,P,l),p=Math.min(p,R)}else{const R=jl(v,t),L=jl(P,a);To(m,p,l,r,n,R[0],L[0]),To(m,p,l,r,n,R[0],L[1]),To(m,p,l,r,n,R[1],L[0]),To(m,p,l,r,n,R[1],L[1])}}return p}function Ul(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 ea{constructor(t,n){this.type=ke,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(Tn(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new ea(a,a.features.map(l=>Ul(l.geometry)).flat());if(a.type==="Feature")return new ea(a,Ul(a.geometry));if("type"in a&&"coordinates"in a)return new ea(a,Ul(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=>ja([y.x,y.y],n.canonical));if(l.length===0)return NaN;const p=new Ol(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,So(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,So(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Po(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=>ja([y.x,y.y],n.canonical));if(l.length===0)return NaN;const p=new Ol(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,So(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,So(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Po(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=zs(l,0).map(y=>y.map(v=>v.map(P=>ja([P.x,P.y],n.canonical)))),p=new Ol(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,Po([y.coordinates],!1,v,p,m));break;case"LineString":m=Math.min(m,Po(y.coordinates,!0,v,p,m));break;case"Polygon":m=Math.min(m,td(v,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Va={"==":zl,"!=":Gh,">":yo,"<":_o,">=":vu,"<=":br,array:Vi,at:xr,boolean:Vi,case:Ms,coalesce:Ba,collator:Yn,format:Oa,image:Al,in:Ps,"index-of":Ss,interpolate:ki,"interpolate-hcl":ki,"interpolate-lab":ki,length:Rl,let:_t,literal:Pn,match:fo,number:Vi,"number-format":kl,object:Vi,slice:Is,step:Fa,string:Vi,"to-boolean":kr,"to-color":kr,"to-number":kr,"to-string":kr,var:La,within:Jn,distance:ea};class or{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=or.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 Da(n.registry,Mo,n.path,null,n.scope);const M=[];let k=!1;for(let R=1;R<t.length;R++){const L=t[R],j=Array.isArray(v)?v[R-1]:v.type,$=y.parse(L,1+M.length,j);if(!$){k=!0;break}M.push($)}if(!k)if(Array.isArray(v)&&v.length!==M.length)y.error(`Expected ${v.length} arguments, but found ${M.length} instead.`);else{for(let R=0;R<M.length;R++){const L=Array.isArray(v)?v[R]:v.type,j=M[R];y.concat(R+1).checkSubtype(L,j.type)}if(y.errors.length===0)return new or(a,d,P,M)}}if(m.length===1)n.errors.push(...y.errors);else{const v=(m.length?m:p).map(([M])=>{return k=M,Array.isArray(k)?`(${k.map(Ut).join(", ")})`:`(${Ut(k.type)}...)`;var k}).join(" | "),P=[];for(let M=1;M<t.length;M++){const k=n.parse(t[M],1+P.length);if(!k)return null;P.push(Ut(k.type))}n.error(`Expected arguments of type ${v}, but found (${P.join(", ")}) instead.`)}return null}static register(t,n){or.definitions=n;for(const a in n)t[a]=or}}function Du(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=gu(t,n,a,d);if(p)throw new Zt(p);return new xt(t/255,n/255,a/255,d,!1)}function Lu(r,t){return r in t}function $l(r,t){const n=t[r];return n===void 0?null:n}function ta(r){return{type:r}}function Mo(r){if(r instanceof La)return Mo(r.boundExpression);if(r instanceof or&&r.name==="error"||r instanceof Yn||r instanceof Jn||r instanceof ea)return!1;const t=r instanceof kr||r instanceof Vi;let n=!0;return r.eachChild(a=>{n=t?n&&Mo(a):n&&a instanceof Pn}),!!n&&Io(r)&&Co(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Io(r){if(r instanceof or&&(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 Jn||r instanceof ea)return!1;let t=!0;return r.eachChild(n=>{t&&!Io(n)&&(t=!1)}),t}function ks(r){if(r instanceof or&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!ks(n)&&(t=!1)}),t}function Co(r,t){if(r instanceof or&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!Co(a,t)&&(n=!1)}),n}function Fu(r){return{result:"success",value:r}}function Ua(r){return{result:"error",value:r}}function $a(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Bu(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Gl(r){return!!r.expression&&r.expression.interpolated}function vt(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Eo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ql(r){return r}function Ou(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||(Gl(t)?"exponential":"interval");if(n||t.type==="padding"){const P=n?xt.parse:Pi.parse;(r=nt({},r)).stops&&(r.stops=r.stops.map(M=>[M[0],P(M[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=Nu;else if(d==="interval")m=ju;else if(d==="categorical"){m=id,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=rd}if(a){const P={},M=[];for(let L=0;L<r.stops.length;L++){const j=r.stops[L],$=j[0].zoom;P[$]===void 0&&(P[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},M.push($)),P[$].stops.push([j[0].value,j[1]])}const k=[];for(const L of M)k.push([P[L].zoom,Ou(P[L],t)]);const R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:ki.interpolationFactor.bind(void 0,R),zoomStops:k.map(L=>L[0]),evaluate:({zoom:L},j)=>Nu({stops:k,base:r.base},t,L).evaluate(L,j)}}if(l){const P=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:P,interpolationFactor:ki.interpolationFactor.bind(void 0,P),zoomStops:r.stops.map(M=>M[0]),evaluate:({zoom:M})=>m(r,t,M,y,v)}}return{kind:"source",evaluate(P,M){const k=M&&M.properties?M.properties[r.property]:void 0;return k===void 0?As(r.default,t.default):m(r,t,k,y,v)}}}function As(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function id(r,t,n,a,l){return As(typeof n===l?a[n]:void 0,r.default,t.default)}function ju(r,t,n){if(vt(n)!=="number")return As(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=mo(r.stops.map(d=>d[0]),n);return r.stops[l][1]}function Nu(r,t,n){const a=r.base!==void 0?r.base:1;if(vt(n)!=="number")return As(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=mo(r.stops.map(P=>P[0]),n),p=function(P,M,k,R){const L=R-k,j=P-k;return L===0?0:M===1?j/L:(Math.pow(M,j)-1)/(Math.pow(M,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=vr[t.type]||ql;return typeof m.evaluate=="function"?{evaluate(...P){const M=m.evaluate.apply(void 0,P),k=y.evaluate.apply(void 0,P);if(M!==void 0&&k!==void 0)return v(M,k,p,r.colorSpace)}}:v(m,y,p,r.colorSpace)}function rd(r,t,n){switch(t.type){case"color":n=xt.parse(n);break;case"formatted":n=Li.fromString(n.toString());break;case"resolvedImage":n=Zi.fromString(n.toString());break;case"padding":n=Pi.parse(n);break;default:vt(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return As(n,r.default,t.default)}or.register(Va,{error:[{kind:"error"},[qe],(r,[t])=>{throw new Zt(t.evaluate(r))}],typeof:[qe,[it],(r,[t])=>Ut(Vt(t.evaluate(r)))],"to-rgba":[Ni(ke,4),[st],(r,[t])=>{const[n,a,l,d]=t.evaluate(r).rgb;return[255*n,255*a,255*l,d]}],rgb:[st,[ke,ke,ke],Du],rgba:[st,[ke,ke,ke,ke],Du],has:{type:Oe,overloads:[[[qe],(r,[t])=>Lu(t.evaluate(r),r.properties())],[[qe,Kr],(r,[t,n])=>Lu(t.evaluate(r),n.evaluate(r))]]},get:{type:it,overloads:[[[qe],(r,[t])=>$l(t.evaluate(r),r.properties())],[[qe,Kr],(r,[t,n])=>$l(t.evaluate(r),n.evaluate(r))]]},"feature-state":[it,[qe],(r,[t])=>$l(t.evaluate(r),r.featureState||{})],properties:[Kr,[],r=>r.properties()],"geometry-type":[qe,[],r=>r.geometryType()],id:[it,[],r=>r.id()],zoom:[ke,[],r=>r.globals.zoom],"heatmap-density":[ke,[],r=>r.globals.heatmapDensity||0],"line-progress":[ke,[],r=>r.globals.lineProgress||0],accumulated:[it,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ke,ta(ke),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[ke,ta(ke),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:ke,overloads:[[[ke,ke],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[ke],(r,[t])=>-t.evaluate(r)]]},"/":[ke,[ke,ke],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[ke,[ke,ke],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[ke,[],()=>Math.LN2],pi:[ke,[],()=>Math.PI],e:[ke,[],()=>Math.E],"^":[ke,[ke,ke],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[ke,[ke],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[ke,[ke],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[ke,[ke],(r,[t])=>Math.log(t.evaluate(r))],log2:[ke,[ke],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[ke,[ke],(r,[t])=>Math.sin(t.evaluate(r))],cos:[ke,[ke],(r,[t])=>Math.cos(t.evaluate(r))],tan:[ke,[ke],(r,[t])=>Math.tan(t.evaluate(r))],asin:[ke,[ke],(r,[t])=>Math.asin(t.evaluate(r))],acos:[ke,[ke],(r,[t])=>Math.acos(t.evaluate(r))],atan:[ke,[ke],(r,[t])=>Math.atan(t.evaluate(r))],min:[ke,ta(ke),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[ke,ta(ke),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[ke,[ke],(r,[t])=>Math.abs(t.evaluate(r))],round:[ke,[ke],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[ke,[ke],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[ke,[ke],(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)],[ta(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)],[ta(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,ta(it),(r,t)=>t.map(n=>Ra(n.evaluate(r))).join("")],"resolved-locale":[qe,[hi],(r,[t])=>t.evaluate(r).resolvedLocale()]});class Ga{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new ct,this._defaultValue=n?(a=n).type==="color"&&Eo(a.default)?new xt(0,0,0,0):a.type==="color"?xt.parse(a.default)||null:a.type==="padding"?Pi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Fi.parse(a.default)||null:a.type==="projectionDefinition"?di.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 Zt(`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 Rs(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Va}function zo(r,t){const n=new Da(Va,Mo,[],t?function(l){const d={color:st,string:qe,number:ke,enum:qe,boolean:Oe,formatted:Lt,padding:uo,projectionDefinition:qt,resolvedImage:Ia,variableAnchorOffsetCollection:vn};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?Fu(new Ga(a,t)):Ua(n.errors)}class Wl{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!ks(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 Hl{constructor(t,n,a,l){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!ks(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?ki.interpolationFactor(this.interpolationType,t,n,a):0}}function Zu(r,t){const n=zo(r,t);if(n.result==="error")return n;const a=n.value.expression,l=Io(a);if(!l&&!$a(t))return Ua([new Je("","data expressions not supported")]);const d=Co(a,["zoom"]);if(!d&&!Bu(t))return Ua([new Je("","zoom expressions not supported")]);const p=Ds(a);return p||d?p instanceof Je?Ua([p]):p instanceof ki&&!Gl(t)?Ua([new Je("",'"interpolate" expressions cannot be used with this property')]):Fu(p?new Hl(l?"camera":"composite",n.value,p.labels,p instanceof ki?p.interpolation:void 0):new Wl(l?"constant":"source",n.value)):Ua([new Je("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ko{constructor(t,n){this._parameters=t,this._specification=n,nt(this,Ou(this._parameters,this._specification))}static deserialize(t){return new ko(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ds(r){let t=null;if(r instanceof _t)t=Ds(r.result);else if(r instanceof Ba){for(const n of r.args)if(t=Ds(n),t)break}else(r instanceof Fa||r instanceof ki)&&r.input instanceof or&&r.input.name==="zoom"&&(t=r);return t instanceof Je||r.eachChild(n=>{const a=Ds(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 Ao(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(!Ao(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const nd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Kl(r){if(r==null)return{filter:()=>!0,needGeometry:!1};Ao(r)||(r=Ls(r));const t=zo(r,nd);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:Xl(r)}}function Vu(r,t){return r<t?-1:r>t?1:0}function Xl(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(Xl(r[t]))return!0;return!1}function Ls(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?Ro(r[1],r[2],"=="):t==="!="?qa(Ro(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Ro(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(Ls))):t==="all"?["all"].concat(r.slice(1).map(Ls)):t==="none"?["all"].concat(r.slice(1).map(Ls).map(qa)):t==="in"?Do(r[1],r.slice(2)):t==="!in"?qa(Do(r[1],r.slice(2))):t==="has"?Lo(r[1]):t!=="!has"||qa(Lo(r[1]));var n}function Ro(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 Do(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(Vu)]]:["filter-in-small",r,["literal",t]]}}function Lo(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function qa(r){return["!",r]}function Wa(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+=`${Wa(d)},`;return`${l}]`}const n=Object.keys(r).sort();let a="{";for(let l=0;l<n.length;l++)a+=`${JSON.stringify(n[l])}:${Wa(r[n[l]])},`;return`${a}}`}function ad(r){let t="";for(const n of Y)t+=`/${Wa(r[n])}`;return t}function Uu(r){const t=r.value;return t?[new xe(r.key,t,"constants have been deprecated as of v8")]:[]}function ei(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function ia(r){if(Array.isArray(r))return r.map(ia);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=ia(r[n]);return t}return ei(r)}function lr(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=vt(n);if(v!=="object")return[new xe(t,n,`object expected, ${v} found`)];for(const P in n){const M=P.split(".")[0],k=a[M]||a["*"];let R;if(l[M])R=l[M];else if(a[M])R=m;else if(l["*"])R=l["*"];else{if(!a["*"]){y.push(new xe(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 xe(t,n,`missing required property "${P}"`));return y}function Yl(r){const t=r.value,n=r.valueSpec,a=r.style,l=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(vt(t)!=="array")return[new xe(d,t,`array expected, ${vt(t)} found`)];if(n.length&&t.length!==n.length)return[new xe(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new xe(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),vt(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 Fo(r){const t=r.key,n=r.value,a=r.valueSpec;let l=vt(n);return l==="number"&&n!=n&&(l="NaN"),l!=="number"?[new xe(t,n,`number expected, ${l} found`)]:"minimum"in a&&n<a.minimum?[new xe(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new xe(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Jl(r){const t=r.valueSpec,n=ei(r.value.type);let a,l,d,p={};const m=n!=="categorical"&&r.value.property===void 0,y=!m,v=vt(r.value.stops)==="array"&&vt(r.value.stops[0])==="array"&&vt(r.value.stops[0][0])==="object",P=lr({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 xe(R.key,R.value,'identity function may not have a "stops" property')];let L=[];const j=R.value;return L=L.concat(Yl({key:R.key,value:j,valueSpec:R.valueSpec,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,arrayElementValidator:M})),vt(j)==="array"&&j.length===0&&L.push(new xe(R.key,j,"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 xe(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||P.push(new xe(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!Gl(r.valueSpec)&&P.push(new xe(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(y&&!$a(r.valueSpec)?P.push(new xe(r.key,r.value,"property functions not supported")):m&&!Bu(r.valueSpec)&&P.push(new xe(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!v||r.value.property!==void 0||P.push(new xe(r.key,r.value,'"property" property is required')),P;function M(R){let L=[];const j=R.value,$=R.key;if(vt(j)!=="array")return[new xe($,j,`array expected, ${vt(j)} found`)];if(j.length!==2)return[new xe($,j,`array length 2 expected, length ${j.length} found`)];if(v){if(vt(j[0])!=="object")return[new xe($,j,`object expected, ${vt(j[0])} found`)];if(j[0].zoom===void 0)return[new xe($,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new xe($,j,"object stop key must have value")];if(d&&d>ei(j[0].zoom))return[new xe($,j[0].zoom,"stop zoom values must appear in ascending order")];ei(j[0].zoom)!==d&&(d=ei(j[0].zoom),l=void 0,p={}),L=L.concat(lr({key:`${$}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{zoom:Fo,value:k}}))}else L=L.concat(k({key:`${$}[0]`,value:j[0],validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec},j));return Rs(ia(j[1]))?L.concat([new xe(`${$}[1]`,j[1],"expressions are not allowed in function stops.")]):L.concat(R.validateSpec({key:`${$}[1]`,value:j[1],valueSpec:t,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec}))}function k(R,L){const j=vt(R.value),$=ei(R.value),H=R.value!==null?R.value:L;if(a){if(j!==a)return[new xe(R.key,H,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new xe(R.key,H,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&n!=="categorical"){let re=`number expected, ${j} found`;return $a(t)&&n===void 0&&(re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new xe(R.key,H,re)]}return n!=="categorical"||j!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&j==="number"&&l!==void 0&&$<l?[new xe(R.key,H,"stop domain values must appear in ascending order")]:(l=$,n==="categorical"&&$ in p?[new xe(R.key,H,"stop domain values must be unique")]:(p[$]=!0,[])):[new xe(R.key,H,`integer expected, found ${$}`)]}}function Jr(r){const t=(r.expressionContext==="property"?Zu:zo)(ia(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new xe(`${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 xe(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"&&!ks(n))return[new xe(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!ks(n))return[new xe(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Co(n,["zoom","feature-state"]))return[new xe(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Io(n))return[new xe(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fs(r){const t=r.key,n=r.value,a=r.valueSpec,l=[];return Array.isArray(a.values)?a.values.indexOf(ei(n))===-1&&l.push(new xe(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(ei(n))===-1&&l.push(new xe(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),l}function Bo(r){return Ao(ia(r.value))?Jr(nt({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ql(r)}function Ql(r){const t=r.value,n=r.key;if(vt(t)!=="array")return[new xe(n,t,`array expected, ${vt(t)} found`)];const a=r.styleSpec;let l,d=[];if(t.length<1)return[new xe(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Fs({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),ei(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ei(t[1])==="$type"&&d.push(new xe(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new xe(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=vt(t[1]),l!=="string"&&d.push(new xe(`${n}[1]`,t[1],`string expected, ${l} found`)));for(let p=2;p<t.length;p++)l=vt(t[p]),ei(t[1])==="$type"?d=d.concat(Fs({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 xe(`${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(Ql({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":l=vt(t[1]),t.length!==2?d.push(new xe(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new xe(`${n}[1]`,t[1],`string expected, ${l} found`))}return d}function $u(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 xe(n,p,`unknown property "${m}"`)];let M;if(vt(p)==="string"&&$a(P)&&!P.tokens&&(M=/^{([^}]+)}$/.exec(p)))return[new xe(n,p,`"${m}" does not support interpolation syntax
6
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(M[1])} }\`.`)];const k=[];return r.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&k.push(new xe(n,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Eo(ia(p))&&ei(p.type)==="identity"&&k.push(new xe(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 ec(r){return $u(r,"paint")}function tc(r){return $u(r,"layout")}function Ha(r){let t=[];const n=r.value,a=r.key,l=r.style,d=r.styleSpec;n.type||n.ref||t.push(new xe(a,n,'either "type" or "ref" is required'));let p=ei(n.type);const m=ei(n.ref);if(n.id){const y=ei(n.id);for(let v=0;v<r.arrayIndex;v++){const P=l.layers[v];ei(P.id)===y&&t.push(new xe(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 xe(a,n[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{ei(v.id)===m&&(y=v)}),y?y.ref?t.push(new xe(a,n.ref,"ref cannot reference another ref layer")):p=ei(y.type):t.push(new xe(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&&ei(y.type);y?v==="vector"&&p==="raster"?t.push(new xe(a,n.source,`layer "${n.id}" requires a raster source`)):v!=="raster-dem"&&p==="hillshade"?t.push(new xe(a,n.source,`layer "${n.id}" requires a raster-dem source`)):v==="raster"&&p!=="raster"?t.push(new xe(a,n.source,`layer "${n.id}" requires a vector source`)):v!=="vector"||n["source-layer"]?v==="raster-dem"&&p!=="hillshade"?t.push(new xe(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 xe(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new xe(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new xe(a,n.source,`source "${n.source}" not found`))}else t.push(new xe(a,n,'missing required property "source"'));return t=t.concat(lr({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:Bo,layout:y=>lr({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":v=>tc(nt({layerType:p},v))}}),paint:y=>lr({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":v=>ec(nt({layerType:p},v))}})}})),t}function ra(r){const t=r.value,n=r.key,a=vt(t);return a!=="string"?[new xe(n,t,`string expected, ${a} found`)]:[]}const Gu={promoteId:function({key:r,value:t}){if(vt(t)==="string")return ra({key:r,value:t});{const n=[];for(const a in t)n.push(...ra({key:`${r}.${a}`,value:t[a]}));return n}}};function qu(r){const t=r.value,n=r.key,a=r.styleSpec,l=r.style,d=r.validateSpec;if(!t.type)return[new xe(n,t,'"type" is required')];const p=ei(t.type);let m;switch(p){case"vector":case"raster":return m=lr({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:Gu,validateSpec:d}),m;case"raster-dem":return m=function(y){var v;const P=(v=y.sourceName)!==null&&v!==void 0?v:"",M=y.value,k=y.styleSpec,R=k.source_raster_dem,L=y.style;let j=[];const $=vt(M);if(M===void 0)return j;if($!=="object")return j.push(new xe("source_raster_dem",M,`object expected, ${$} found`)),j;const H=ei(M.encoding)==="custom",re=["redFactor","greenFactor","blueFactor","baseShift"],X=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const A in M)!H&&re.includes(A)?j.push(new xe(A,M[A],`In "${P}": "${A}" is only valid when "encoding" is set to "custom". ${X} encoding found`)):R[A]?j=j.concat(y.validateSpec({key:A,value:M[A],valueSpec:R[A],validateSpec:y.validateSpec,style:L,styleSpec:k})):j.push(new xe(A,M[A],`unknown property "${A}"`));return j}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=lr({key:n,value:t,valueSpec:a.source_geojson,style:l,styleSpec:a,validateSpec:d,objectElementValidators:Gu}),t.cluster)for(const y in t.clusterProperties){const[v,P]=t.clusterProperties[y],M=typeof v=="string"?[v,["accumulated"],["get",y]]:v;m.push(...Jr({key:`${n}.${y}.map`,value:P,expressionContext:"cluster-map"})),m.push(...Jr({key:`${n}.${y}.reduce`,value:M,expressionContext:"cluster-reduce"}))}return m;case"video":return lr({key:n,value:t,valueSpec:a.source_video,style:l,validateSpec:d,styleSpec:a});case"image":return lr({key:n,value:t,valueSpec:a.source_image,style:l,validateSpec:d,styleSpec:a});case"canvas":return[new xe(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Fs({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wu(r){const t=r.value,n=r.styleSpec,a=n.light,l=r.style;let d=[];const p=vt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new xe("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 xe(m,t[m],`unknown property "${m}"`)])}return d}function Hu(r){const t=r.value,n=r.styleSpec,a=n.sky,l=r.style,d=vt(t);if(t===void 0)return[];if(d!=="object")return[new xe("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 xe(m,t[m],`unknown property "${m}"`)]);return p}function Ku(r){const t=r.value,n=r.styleSpec,a=n.terrain,l=r.style;let d=[];const p=vt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new xe("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 xe(m,t[m],`unknown property "${m}"`)]);return d}function Ka(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 xe(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 xe(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(lr({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return ra({key:a,value:n})}const Xa={"*":()=>[],array:Yl,boolean:function(r){const t=r.value,n=r.key,a=vt(t);return a!=="boolean"?[new xe(n,t,`boolean expected, ${a} found`)]:[]},number:Fo,color:function(r){const t=r.key,n=r.value,a=vt(n);return a!=="string"?[new xe(t,n,`color expected, ${a} found`)]:xt.parse(String(n))?[]:[new xe(t,n,`color expected, "${n}" found`)]},constants:Uu,enum:Fs,filter:Bo,function:Jl,layer:Ha,object:lr,source:qu,light:Wu,sky:Hu,terrain:Ku,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,l=r.style,d=vt(t);if(t===void 0)return[];if(d!=="object")return[new xe("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 xe(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=vt(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 xe(t,n,`projection expected, invalid type "${a}" found`)]:[new xe(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:ra,formatted:function(r){return ra(r).length===0?[]:Jr(r)},resolvedImage:function(r){return ra(r).length===0?[]:Jr(r)},padding:function(r){const t=r.key,n=r.value;if(vt(n)==="array"){if(n.length<1||n.length>4)return[new xe(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 Fo({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=vt(n),l=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new xe(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(Fs({key:`${t}[${p}]`,value:n[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(Yl({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:l}));return d},sprite:Ka};function Ai(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=Ai,n.expression&&Eo(ei(t))?Jl(r):n.expression&&Rs(ia(t))?Jr(r):n.type&&Xa[n.type]?Xa[n.type](r):lr(nt({},r,{valueSpec:n.type?a[n.type]:n}))}function Ya(r){const t=r.value,n=r.key,a=ra(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new xe(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new xe(n,t,'"glyphs" url must include a "{range}" token'))),a}function cr(r,t=D){let n=[];return n=n.concat(Ai({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:Ai,objectElementValidators:{glyphs:Ya,"*":()=>[]}})),r.constants&&(n=n.concat(Uu({key:"constants",value:r.constants}))),Xu(n)}function Dr(r){return function(t){return r({...t,validateSpec:Ai})}}function Xu(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function Ui(r){return function(...t){return Xu(r.apply(this,t))}}cr.source=Ui(Dr(qu)),cr.sprite=Ui(Dr(Ka)),cr.glyphs=Ui(Dr(Ya)),cr.light=Ui(Dr(Wu)),cr.sky=Ui(Dr(Hu)),cr.terrain=Ui(Dr(Ku)),cr.layer=Ui(Dr(Ha)),cr.filter=Ui(Dr(Bo)),cr.paintProperty=Ui(Dr(ec)),cr.layoutProperty=Ui(Dr(tc));const na=cr,ic=na.light,sd=na.sky,rc=na.paintProperty,od=na.layoutProperty;function Ja(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new N(new Error(a.message))),n=!0;return n}class Bs{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,M=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(M[L+0],M[L+1],M[L+2],M[L+3]):t<=M[L+2]&&n<=M[L+3]&&a>=M[L+0]&&l>=M[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),M=this._convertToCellCoord(a),k=this._convertToCellCoord(l);for(let R=v;R<=M;R++)for(let L=P;L<=k;L++){const j=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,j,p,m,y))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,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 Bs(t.buffer)}}const Ji={};function Ue(r,t,n={}){if(Ji[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),Ji[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}Ue("Object",Object),Ue("TransferableGridIndex",Bs),Ue("Color",xt),Ue("Error",Error),Ue("AJAXError",zr),Ue("ResolvedImage",Zi),Ue("StylePropertyFunction",ko),Ue("StyleExpression",Ga,{omit:["_evaluator"]}),Ue("ZoomDependentExpression",Hl),Ue("ZoomConstantExpression",Wl),Ue("CompoundExpression",or,{omit:["_evaluate"]});for(const r in Va)Va[r]._classRegistryKey||Ue(`Expression_${r}`,Va[r]);function Yu(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Qa(r){return r.$name||r.constructor._classRegistryKey}function Ju(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=Qa(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||Yu(r)||Gn(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function aa(r,t){if(Ju(r))return(Yu(r)||Gn(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(aa(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=Qa(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Ji[n])throw new Error(`${n} is not registered.`);const{klass:a}=Ji[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)||Ji[n].omit.indexOf(d)>=0)continue;const p=r[d];l[d]=Ji[n].shallow.indexOf(d)>=0?p:aa(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 Sn(r){if(Ju(r))return r;if(Array.isArray(r))return r.map(Sn);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=Qa(r)||"Object";if(!Ji[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=Ji[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]=Ji[t].shallow.indexOf(l)>=0?d:Sn(d)}return a}class nc{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 ft={"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 Oo(r){for(const t of r)if(sc(t.charCodeAt(0)))return!0;return!1}function Qu(r){for(const t of r)if(!ld(t.charCodeAt(0)))return!1;return!0}function Os(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 eh=Os(["Arab","Dupl","Mong","Ougr","Syrc"]);function ld(r){return!eh.test(String.fromCodePoint(r))}const ac=Os(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function sc(r){return!(r!==746&&r!==747&&(r<4352||!(ft["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||ft["CJK Compatibility"](r)||ft["CJK Strokes"](r)||!(!ft["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||ft["Enclosed CJK Letters and Months"](r)||ft["Ideographic Description Characters"](r)||ft.Kanbun(r)||ft.Katakana(r)&&r!==12540||!(!ft["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)||!(!ft["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||ft["Vertical Forms"](r)||ft["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||ac.test(String.fromCodePoint(r)))))}function oc(r){return!(sc(r)||function(t){return!!(ft["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||ft["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)||ft["Letterlike Symbols"](t)||ft["Number Forms"](t)||ft["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)||ft["Control Pictures"](t)&&t!==9251||ft["Optical Character Recognition"](t)||ft["Enclosed Alphanumerics"](t)||ft["Geometric Shapes"](t)||ft["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||ft["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||ft["CJK Symbols and Punctuation"](t)||ft.Katakana(t)||ft["Private Use Area"](t)||ft["CJK Compatibility Forms"](t)||ft["Small Form Variants"](t)||ft["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 th=Os(["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 lc(r){return th.test(String.fromCodePoint(r))}function cd(r,t){return!(!t&&lc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||ft.Khmer(r))}function ud(r){for(const t of r)if(lc(t.charCodeAt(0)))return!0;return!1}const Qr=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(Qr.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 Bt{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 nc,this.transition={})}isSupportedScript(t){return function(n,a){for(const l of n)if(!cd(l.charCodeAt(0),a))return!1;return!0}(t,Qr.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 js{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,l){if(Eo(a))return new ko(a,l);if(Rs(a)){const d=Zu(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=xt.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Fi.parse(a):l.type==="projectionDefinition"&&typeof a=="string"&&(d=di.parse(a)):d=Pi.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 jo{constructor(t){this.property=t,this.value=new js(t,void 0)}transitioned(t,n){return new ih(this.property,this.value,n,Ti({},t.transition,this.transition),t.now)}untransitioned(){return new ih(this.property,this.value,null,{},0)}}class Ns{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Yi(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new jo(this._values[t].property)),this._values[t].value=new js(this._values[t].property,n===null?void 0:Yi(n))}getTransition(t){return Yi(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new jo(this._values[t].property)),this._values[t].transition=Yi(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 No(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 No(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class ih{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,Zn(m))}}return d}}class No{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const l=new Zs(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 hd{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Yi(this._values[t].value)}setValue(t,n){this._values[t]=new js(this._values[t].property,n===null?void 0:Yi(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 Zs(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(t,n,a);return l}}class Lr{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 Zs{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=vr[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 Lr(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 Lr(this,{kind:"constant",value:void 0},t.parameters);const l=vr[this.specification.type];if(l){const d=l(t.value.value,n.value.value,a);return new Lr(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 Zo extends tt{possiblyEvaluate(t,n,a,l){if(t.value===void 0)return new Lr(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 Lr(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 Lr(this,{kind:"constant",value:d},n)}return new Lr(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 cc{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 Bt(Math.floor(n.zoom-1),n)),t.expression.evaluate(new Bt(Math.floor(n.zoom),n)),t.expression.evaluate(new Bt(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 uc{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 js(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new jo(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=l.possiblyEvaluate({})}}}Ue("DataDrivenProperty",tt),Ue("DataConstantProperty",Xe),Ue("CrossFadedDataDrivenProperty",Zo),Ue("CrossFadedProperty",cc),Ue("ColorRampProperty",uc);const rh="-transition";class Bi 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 hd(n.layout)),n.paint)){this._transitionablePaint=new Ns(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 Zs(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(od,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(rh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(rc,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(rh))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),$n(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)&&Ja(this,t.call(na,{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 Lr&&$a(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const dd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Vs{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 Wt{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 ti(r,t=1){let n=0,a=0;return{members:r.map(l=>{const d=dd[l.type].BYTES_PER_ELEMENT,p=n=nh(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:nh(n,Math.max(a,t)),alignment:t}}function nh(r,t){return Math.ceil(r/t)*t}class Us extends Wt{_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}}Us.prototype.bytesPerElement=4,Ue("StructArrayLayout2i4",Us);class Fr extends Wt{_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}}Fr.prototype.bytesPerElement=6,Ue("StructArrayLayout3i6",Fr);class Vo extends Wt{_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}}Vo.prototype.bytesPerElement=8,Ue("StructArrayLayout4i8",Vo);class $s extends Wt{_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}}$s.prototype.bytesPerElement=12,Ue("StructArrayLayout2i4i12",$s);class Uo extends Wt{_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}}Uo.prototype.bytesPerElement=8,Ue("StructArrayLayout2i4ub8",Uo);class sa extends Wt{_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}}sa.prototype.bytesPerElement=8,Ue("StructArrayLayout2f8",sa);class hc extends Wt{_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 M=this.length;return this.resize(M+1),this.emplace(M,t,n,a,l,d,p,m,y,v,P)}emplace(t,n,a,l,d,p,m,y,v,P,M){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]=M,t}}hc.prototype.bytesPerElement=20,Ue("StructArrayLayout10ui20",hc);class es extends Wt{_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,M,k){const R=this.length;return this.resize(R+1),this.emplace(R,t,n,a,l,d,p,m,y,v,P,M,k)}emplace(t,n,a,l,d,p,m,y,v,P,M,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]=M,this.int16[L+10]=k,this.int16[L+11]=R,t}}es.prototype.bytesPerElement=24,Ue("StructArrayLayout4i4ui4i24",es);class oa extends Wt{_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}}oa.prototype.bytesPerElement=12,Ue("StructArrayLayout3f12",oa);class dc extends Wt{_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}}dc.prototype.bytesPerElement=4,Ue("StructArrayLayout1ul4",dc);class $o extends Wt{_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 M=10*t,k=5*t;return this.int16[M+0]=n,this.int16[M+1]=a,this.int16[M+2]=l,this.int16[M+3]=d,this.int16[M+4]=p,this.int16[M+5]=m,this.uint32[k+3]=y,this.uint16[M+8]=v,this.uint16[M+9]=P,t}}$o.prototype.bytesPerElement=20,Ue("StructArrayLayout6i1ul2ui20",$o);class la extends Wt{_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}}la.prototype.bytesPerElement=12,Ue("StructArrayLayout2i2i2i12",la);class pc extends Wt{_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}}pc.prototype.bytesPerElement=16,Ue("StructArrayLayout2f1f2i16",pc);class fc extends Wt{_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}}fc.prototype.bytesPerElement=16,Ue("StructArrayLayout2ub2f2i16",fc);class Gs extends Wt{_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}}Gs.prototype.bytesPerElement=6,Ue("StructArrayLayout3ui6",Gs);class mc extends Wt{_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,M,k,R,L,j,$,H){const re=this.length;return this.resize(re+1),this.emplace(re,t,n,a,l,d,p,m,y,v,P,M,k,R,L,j,$,H)}emplace(t,n,a,l,d,p,m,y,v,P,M,k,R,L,j,$,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]=M,this.float32[A+7]=k,this.float32[A+8]=R,this.uint8[U+36]=L,this.uint8[U+37]=j,this.uint8[U+38]=$,this.uint32[A+10]=H,this.int16[X+22]=re,t}}mc.prototype.bytesPerElement=48,Ue("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",mc);class u extends Wt{_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,M,k,R,L,j,$,H,re,X,A,U,J,fe,Ce,ge,ve,Re,Ee){const De=this.length;return this.resize(De+1),this.emplace(De,t,n,a,l,d,p,m,y,v,P,M,k,R,L,j,$,H,re,X,A,U,J,fe,Ce,ge,ve,Re,Ee)}emplace(t,n,a,l,d,p,m,y,v,P,M,k,R,L,j,$,H,re,X,A,U,J,fe,Ce,ge,ve,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]=M,this.uint16[Pe+10]=k,this.uint16[Pe+11]=R,this.uint16[Pe+12]=L,this.uint16[Pe+13]=j,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]=ge,this.float32[$e+13]=ve,this.float32[$e+14]=Re,this.uint16[Pe+30]=Ee,this.uint16[Pe+31]=De,t}}u.prototype.bytesPerElement=64,Ue("StructArrayLayout8i15ui1ul2f2ui64",u);class e extends Wt{_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,Ue("StructArrayLayout1f4",e);class i extends Wt{_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,Ue("StructArrayLayout1ui2f12",i);class s extends Wt{_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,Ue("StructArrayLayout1ul2ui8",s);class o extends Wt{_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,Ue("StructArrayLayout2ui4",o);class h extends Wt{_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,Ue("StructArrayLayout1ui2",h);class f extends Wt{_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,Ue("StructArrayLayout4f16",f);class _ extends Vs{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 Ve(this.anchorPointX,this.anchorPointY)}}_.prototype.size=20;class x extends $o{get(t){return new _(this,t)}}Ue("CollisionBoxArray",x);class w extends Vs{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 mc{get(t){return new w(this,t)}}Ue("PlacedSymbolArray",I);class z extends Vs{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 E extends u{get(t){return new z(this,t)}}Ue("SymbolInstanceArray",E);class B extends e{getoffsetX(t){return this.float32[1*t+0]}}Ue("GlyphOffsetArray",B);class Z extends Fr{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ue("SymbolLineVertexArray",Z);class q extends Vs{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)}}Ue("TextAnchorOffsetArray",G);class W extends Vs{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)}}Ue("FeatureIndexArray",K);class Q extends Us{}class ee extends Us{}class te extends Us{}class se extends $s{}class ie extends Uo{}class pe extends sa{}class de extends hc{}class Te extends es{}class Se extends oa{}class be extends dc{}class Be extends la{}class Le extends fc{}class Me extends Gs{}class We extends o{}const lt=ti([{name:"a_pos",components:2,type:"Int16"}],4),{members:Pt}=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&&zi(`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 Et(r,t){return 256*(r=fr(Math.floor(r),0,255))+fr(Math.floor(t),0,255)}ut.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ue("SegmentVector",ut);const Dt=ti([{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 Ot,It,zt,ni={exports:{}},pi={exports:{}},yi={exports:{}},Gi=function(){if(zt)return ni.exports;zt=1;var r=(Ot||(Ot=1,pi.exports=function(n,a){var l,d,p,m,y,v,P,M;for(d=n.length-(l=3&n.length),p=a,y=3432918353,v=461845907,M=0;M<d;)P=255&n.charCodeAt(M)|(255&n.charCodeAt(++M))<<8|(255&n.charCodeAt(++M))<<16|(255&n.charCodeAt(++M))<<24,++M,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(M+2))<<16;case 2:P^=(255&n.charCodeAt(M+1))<<8;case 1:p^=P=(65535&(P=(P=(65535&(P^=255&n.charCodeAt(M)))*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}),pi.exports),t=(It||(It=1,yi.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}),yi.exports);return ni.exports=r,ni.exports.murmur3=r,ni.exports.murmur2=t,ni.exports}(),en=_e(Gi);class Br{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,l){this.ids.push(Mn(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=Mn(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 In(a,l,0,a.length-1),n&&n.push(a.buffer,l.buffer),{ids:a,positions:l}}static deserialize(t){const n=new Br;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function Mn(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:en(String(r))}function In(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;ca(r,d,p),ca(t,3*d,3*p),ca(t,3*d+1,3*p+1),ca(t,3*d+2,3*p+2)}p-n<a-p?(In(r,t,n,p),n=p+1):(In(r,t,p+1,a),a=p)}}function ca(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}Ue("FeaturePositionMap",Br);class Or{constructor(t,n){this.gl=t.gl,this.location=n}}class tn extends Or{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Qi extends Or{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 rn extends Or{constructor(t,n){super(t,n),this.current=xt.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 ua=new Float32Array(16);function ha(r){return[Et(255*r.r,255*r.g),Et(255*r.b,255*r.a)]}class Ht{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 rn(t,n):new tn(t,n)}}class Kt{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 Qi(t,n):new tn(t,n)}}class li{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 Bt(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=ha(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 Rt{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 Bt(this.zoom),n,{},l,[],d),m=this.expression.evaluate(new Bt(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=ha(a),p=ha(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=fr(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,n,a){return new tn(t,n)}}class Cn{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 M=t;M<n;M++)this.zoomInPaintVertexArray.emplace(M,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(M,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,Dt.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Dt.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ah{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 Lr&&$a(p.property.specification)))continue;const m=pd(d,t.type),y=p.value,v=p.property.specification.type,P=p.property.useIntegerZoom,M=p.property.specification["property-type"],k=M==="cross-faded"||M==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=k?new Kt(y.value,m):new Ht(y.value,m,v),l.push(`/u_${d}`);else if(y.kind==="source"||k){const R=sh(d,v,"source");this.binders[d]=k?new Cn(y,v,P,n,R,t.id):new li(y,m,v,R),l.push(`/a_${d}`)}else{const R=sh(d,v,"composite");this.binders[d]=new Rt(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 li||n instanceof Rt?n.maxValue:0}populatePaintArrays(t,n,a,l,d){for(const p in this.binders){const m=this.binders[p];(m instanceof li||m instanceof Rt||m instanceof Cn)&&m.populatePaintArray(t,n,a,l,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const l=this.binders[a];l instanceof Kt&&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 M in this.binders){const k=this.binders[M];if((k instanceof li||k instanceof Rt||k instanceof Cn)&&k.expression.isStateDependent===!0){const R=l.paint.get(M);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 Ht||a instanceof Kt)&&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 li||a instanceof Rt)for(let l=0;l<a.paintVertexAttributes.length;l++)t.push(a.paintVertexAttributes[l].name);else if(a instanceof Cn)for(let l=0;l<Dt.members.length;l++)t.push(Dt.members[l].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Ht||a instanceof Kt||a instanceof Rt)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 Ht||d instanceof Kt||d instanceof Rt){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 Cn){const l=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(a instanceof li||a instanceof Rt)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof li||a instanceof Rt||a instanceof Cn)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof li||n instanceof Rt||n instanceof Cn)&&n.destroy()}}}class da{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new ah(l,n,a);this.needsUpload=!1,this._featureMap=new Br,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 pd(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 sh(r,t,n){const a={color:{source:sa,composite:f},number:{source:e,composite:sa}},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]}Ue("ConstantBinder",Ht),Ue("CrossFadedConstantBinder",Kt),Ue("SourceExpressionBinder",li),Ue("CrossFadedCompositeBinder",Cn),Ue("CompositeExpressionBinder",Rt),Ue("ProgramConfiguration",ah,{omit:["_buffers"]}),Ue("ProgramConfigurationSet",da);const gc=Math.pow(2,14)-1,En=-gc-1;function zn(r){const t=Mt/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=fr(m,En,gc),p.y=fr(y,En,gc),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&zi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function kn(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?zn(r):[]}}const _c=-32768;function yc(r,t,n,a,l){r.emplaceBack(_c+8*t+a,_c+8*n+l)}class Go{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 da(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:M,index:k,sourceLayerIndex:R}of t){const L=this.layers[0]._featureFilter.needGeometry,j=kn(P,L);if(!this.layers[0]._featureFilter.filter(new Bt(this.zoom),j,a))continue;const $=m?p.evaluate(j,{},a):void 0,H={id:M,properties:P.properties,type:P.type,sourceLayerIndex:R,index:k,geometry:L?j.geometry:zn(P),patterns:{},sortKey:$};d.push(H)}m&&d.sort((P,M)=>P.sortKey-M.sortKey);for(const P of d){const{geometry:M,index:k,sourceLayerIndex:R}=P,L=t[k].feature;this.addFeature(P,M,k,a,v),n.featureIndex.insert(L,M,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,Pt),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,M=v.y;if(P<0||P>=Mt||M<0||M>=Mt)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 j=0;j<m;j++)yc(this.layoutVertexArray,P,M,p[j],p[L]);for(let L=0;L<m-1;L++)for(let j=0;j<m-1;j++){const $=R+L*m+j,H=R+(L+1)*m+j;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 qo(r,t){for(let n=0;n<r.length;n++)if(qs(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(qs(r,t[n]))return!0;return!!fd(r,t)}function Iy(r,t,n){return!!qs(r,t)||!!md(t,r,n)}function uf(r,t){if(r.length===1)return df(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let l=0;l<a.length;l++)if(qs(r,a[l]))return!0}for(let n=0;n<r.length;n++)if(df(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(fd(r,t[n]))return!0;return!1}function Cy(r,t,n){if(r.length>1){if(fd(r,t))return!0;for(let a=0;a<t.length;a++)if(md(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(md(r[a],t,n))return!0;return!1}function fd(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(Ey(a,l,t[d],t[d+1]))return!0}return!1}function Ey(r,t,n,a){return ui(r,n,a)!==ui(t,n,a)&&ui(r,t,n)!==ui(r,t,a)}function md(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(hf(r,t[l-1],t[l])<a)return!0;return!1}function hf(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 df(r,t){for(let n=0;n<r.length;n++)if(qs(r[n],t))return!0;return!1}function qs(r,t){let n=!1;for(let a=0,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 zy(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=ui(r,t,n[0]);return d!==ui(r,t,n[1])||d!==ui(r,t,n[2])||d!==ui(r,t,n[3])}function xc(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function oh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function lh(r,t,n,a,l){if(!t[0]&&!t[1])return r;const d=Ve.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 pf,ff;Ue("CircleBucket",Go,{omit:["layers"]});var ky={get paint(){return ff=ff||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 pf=pf||new $i({"circle-sort-key":new tt(D.layout_circle["circle-sort-key"])})}};class Ay extends Bi{constructor(t){super(t,ky)}createBucket(t){return new Go(t)}queryRadius(t){const n=t;return xc("circle-radius",this,n)+xc("circle-stroke-width",this,n)+oh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:l,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const v=lh(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),M=this.paint.get("circle-pitch-alignment")==="map",k=M?v:function(L,j,$,H){return L.map(re=>mf(re,j,$,H))}(v,d,m,y),R=M?P*p:P;for(const L of l)for(const j of L){const $=M?j:mf(j,d,m,y);let H=R;const re=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?H*=re/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(H*=d.cameraToCenterDistance/re),Iy(k,$,H))return!0}return!1}}function mf(r,t,n,a){const l=t.projectTileCoordinates(r.x,r.y,n,a).point;return new Ve((.5*l.x+.5)*t.width,(.5*-l.y+.5)*t.height)}class gf extends Go{}let _f;Ue("HeatmapBucket",gf,{omit:["layers"]});var Ry={get paint(){return _f=_f||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 uc(D.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Xe(D.paint_heatmap["heatmap-opacity"])})}};function gd(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 yf(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const l=gd({},{width:t,height:n},a);_d(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 _d(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 M=0;M<l.width*d;M++)m[P+M]=p[v+M]}return t}class vc{constructor(t,n){gd(this,t,1,n)}resize(t){yf(this,t,1)}clone(){return new vc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,l,d){_d(t,n,a,l,d,1)}}class wr{constructor(t,n){gd(this,t,4,n)}resize(t){yf(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new wr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,l,d){_d(t,n,a,l,d,4)}}function xf(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,l=r.image||new wr({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:M,end:k}=r.clips[p];d(m,v,M*(1-P)+k*P)}else for(let p=0,m=0;p<n;p++,m+=4)d(0,m,p/(n-1));return l}Ue("AlphaImage",vc),Ue("RGBAImage",wr);const yd="big-fb";class Dy extends Bi{createBucket(t){return new gf(t)}constructor(t){super(t,Ry),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xf({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(yd)&&this.heatmapFbos.delete(yd)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let vf;var Ly={get paint(){return vf=vf||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 Fy extends Bi{constructor(t){super(t,Ly)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const By=ti([{name:"a_pos",components:2,type:"Int16"}],4),{members:Oy}=By;function xd(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 vd(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 bf(r,t,n,a,l){let d;if(l===function(p,m,y,v){let P=0;for(let M=m,k=y-v;M<y;M+=v)P+=(p[k]-p[M])*(p[M+1]+p[k+1]),k=M;return P}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=Sf(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=Sf(p/a|0,r[p],r[p+1],d);return d&&Wo(d,d.next)&&(Pc(d),d=d.next),d}function Ws(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!Wo(a,a.next)&&ai(a.prev,a,a.next)!==0)a=a.next;else{if(Pc(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function bc(r,t,n,a,l,d,p){if(!r)return;!p&&d&&function(y,v,P,M){let k=y;do k.z===0&&(k.z=bd(k.x,k.y,v,P,M)),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,j=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<j&&(A++,X=X.nextZ,X);J++);let U=j;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,j*=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?Ny(r,a,l,d):jy(r))t.push(y.i,r.i,v.i),Pc(r),r=v.next,m=v.next;else if((r=v)===m){p?p===1?bc(r=Zy(Ws(r),t),t,n,a,l,d,2):p===2&&Vy(r,t,n,a,l,d):bc(Ws(r),t,n,a,l,d,1);break}}}function jy(r){const t=r.prev,n=r,a=r.next;if(ai(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),M=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>=M&&L.y<=R&&wc(l,m,d,y,p,v,L.x,L.y)&&ai(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Ny(r,t,n,a){const l=r.prev,d=r,p=r.next;if(ai(l,d,p)>=0)return!1;const m=l.x,y=d.x,v=p.x,P=l.y,M=d.y,k=p.y,R=Math.min(m,y,v),L=Math.min(P,M,k),j=Math.max(m,y,v),$=Math.max(P,M,k),H=bd(R,L,t,n,a),re=bd(j,$,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<=j&&X.y>=L&&X.y<=$&&X!==l&&X!==p&&wc(m,P,y,M,v,k,X.x,X.y)&&ai(X.prev,X,X.next)>=0||(X=X.prevZ,A.x>=R&&A.x<=j&&A.y>=L&&A.y<=$&&A!==l&&A!==p&&wc(m,P,y,M,v,k,A.x,A.y)&&ai(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;X&&X.z>=H;){if(X.x>=R&&X.x<=j&&X.y>=L&&X.y<=$&&X!==l&&X!==p&&wc(m,P,y,M,v,k,X.x,X.y)&&ai(X.prev,X,X.next)>=0)return!1;X=X.prevZ}for(;A&&A.z<=re;){if(A.x>=R&&A.x<=j&&A.y>=L&&A.y<=$&&A!==l&&A!==p&&wc(m,P,y,M,v,k,A.x,A.y)&&ai(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function Zy(r,t){let n=r;do{const a=n.prev,l=n.next.next;!Wo(a,l)&&Tf(a,n,n.next,l)&&Tc(a,l)&&Tc(l,a)&&(t.push(a.i,n.i,l.i),Pc(n),Pc(n.next),n=r=l),n=n.next}while(n!==r);return Ws(n)}function Vy(r,t,n,a,l,d){let p=r;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Wy(p,m)){let y=Pf(p,m);return p=Ws(p,p.next),y=Ws(y,y.next),bc(p,t,n,a,l,d,0),void bc(y,t,n,a,l,d,0)}m=m.next}p=p.next}while(p!==r)}function Uy(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 $y(r,t){const n=function(l,d){let p=d;const m=l.x,y=l.y;let v,P=-1/0;if(Wo(l,p))return p;do{if(Wo(l,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>P&&(P=j,v=p.x<p.next.x?p:p.next,j===m))return v}p=p.next}while(p!==d);if(!v)return null;const M=v,k=v.x,R=v.y;let L=1/0;p=v;do{if(m>=p.x&&p.x>=k&&m!==p.x&&wf(y<R?m:P,y,k,R,y<R?P:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);Tc(p,l)&&(j<L||j===L&&(p.x>v.x||p.x===v.x&&Gy(v,p)))&&(v=p,L=j)}p=p.next}while(p!==M);return v}(r,t);if(!n)return t;const a=Pf(n,r);return Ws(a,a.next),Ws(n,n.next)}function Gy(r,t){return ai(r.prev,r,t.prev)<0&&ai(t.next,r,r.next)<0}function bd(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 qy(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 wf(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 wc(r,t,n,a,l,d,p,m){return!(r===p&&t===m)&&wf(r,t,n,a,l,d,p,m)}function Wy(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&&Tf(l,l.next,n,a))return!0;l=l.next}while(l!==n);return!1}(r,t)&&(Tc(r,t)&&Tc(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)&&(ai(r.prev,r,t.prev)||ai(r,t.prev,t))||Wo(r,t)&&ai(r.prev,r,r.next)>0&&ai(t.prev,t,t.next)>0)}function ai(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function Wo(r,t){return r.x===t.x&&r.y===t.y}function Tf(r,t,n,a){const l=uh(ai(r,t,n)),d=uh(ai(r,t,a)),p=uh(ai(n,a,r)),m=uh(ai(n,a,t));return l!==d&&p!==m||!(l!==0||!ch(r,n,t))||!(d!==0||!ch(r,a,t))||!(p!==0||!ch(n,r,a))||!(m!==0||!ch(n,t,a))}function ch(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 uh(r){return r>0?1:r<0?-1:0}function Tc(r,t){return ai(r.prev,r,r.next)<0?ai(r,t,r.next)>=0&&ai(r,r.prev,t)>=0:ai(r,t,r.prev)<0||ai(r,r.next,t)<0}function Pf(r,t){const n=wd(r.i,r.x,r.y),a=wd(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 Sf(r,t,n,a){const l=wd(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 Pc(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 wd(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Ho{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 hh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}hh.noSubdivision=new hh({fill:new Ho(0,0),line:new Ho(0,0),tile:new Ho(0,0),stencil:new Ho(0,0),circle:1}),Ue("SubdivisionGranularityExpression",Ho),Ue("SubdivisionGranularitySetting",hh);const Ko=-32768,Sc=32767;class Hy{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Mt/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],M=l[2*y],k=l[2*y+1];(l[2*v]-M)*(l[2*P+1]-k)-(l[2*v+1]-k)*(l[2*P]-M)>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 j=0;j<3;j++){const $=p[2*j],H=p[2*j+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 M=Math.floor(m/this._granularityCellSize),k=Math.ceil(v/this._granularityCellSize),R=Math.floor(y/this._granularityCellSize),L=Math.ceil(P/this._granularityCellSize);if(M!==k||R!==L)for(let j=R;j<L;j++){const $=this._scanlineGenerateVertexRingForCellRow(j,p,d);Ky(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],M=n[(2*(m+1)+1)%6],k=n[2*(m+2)%6],R=n[(2*(m+2)+1)%6],L=P-y,j=M-v,$=L===0,H=j===0,re=(l-v)/j,X=(d-v)/j,A=Math.min(re,X),U=Math.max(re,X);if(!H&&(A>=1||U<=0)||H&&(v<l||v>d)){M>=l&&M<=d&&p.push(a[(m+1)%3]);continue}!H&&A>0&&p.push(this._vertexToIndex(y+L*A,v+j*A));const J=y+L*Math.max(A,0),fe=y+L*Math.min(U,1);$||this._generateIntraEdgeVertices(p,y,v,P,M,J,fe),!H&&U<1&&p.push(this._vertexToIndex(y+L*U,v+j*U)),(H||M>=l&&M<=d)&&p.push(a[(m+1)%3]),!H&&(M<=l||M>=d)&&this._generateInterEdgeVertices(p,y,v,P,M,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,M=P?Math.min(n,l):Math.min(p,m),k=P?Math.max(n,l):Math.max(p,m),R=Math.floor(M/this._granularityCellSize)+1,L=Math.ceil(k/this._granularityCellSize)-1;if(P?n<l:p<m)for(let j=R;j<=L;j++){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+v*($-n)/y))}else for(let j=L;j>=R;j--){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+v*($-n)/y))}}_generateInterEdgeVertices(t,n,a,l,d,p,m,y,v,P){const M=d-a,k=p-l,R=m-d,L=(v-d)/R,j=(P-d)/R,$=Math.min(L,j),H=Math.max(L,j),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,ge=p+(n-p)*Math.min((v-m)/Ce,(P-m)/Ce);X=Math.floor(Math.min(ge,y)/this._granularityCellSize)+1,A=Math.ceil(Math.max(ge,y)/this._granularityCellSize)-1,U=y<ge}const fe=M>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=Hs(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===Ko&&(t[n+1]=-32767),a===Sc&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,l,d,p){l>d!=(p===Ko)?(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=Mt,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],v=t[m-1],P=t[m],M=l[2*y],k=l[2*y+1],R=l[2*v],L=l[2*v+1],j=l[2*P],$=l[2*P+1];n&&(k===0&&L===0&&this._generatePoleQuad(t,y,v,M,R,Ko),L===0&&$===0&&this._generatePoleQuad(t,v,P,R,j,Ko),$===0&&k===0&&this._generatePoleQuad(t,P,y,j,M,Ko)),a&&(k===d&&L===d&&this._generatePoleQuad(t,y,v,M,R,Sc),L===d&&$===d&&this._generatePoleQuad(t,v,P,R,j,Sc),$===d&&k===d&&this._generatePoleQuad(t,P,y,j,M,Sc))}}_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 M=0;M<P.length;M++)v.push(P[M].x),v.push(P[M].y)}return{flattened:v,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(v,P,M=2){const k=P&&P.length,R=k?P[0]*M:v.length;let L=bf(v,0,R,M,!0);const j=[];if(!L||L.next===L.prev)return j;let $,H,re;if(k&&(L=function(X,A,U,J){const fe=[];for(let Ce=0,ge=A.length;Ce<ge;Ce++){const ve=bf(X,A[Ce]*J,Ce<ge-1?A[Ce+1]*J:X.length,J,!1);ve===ve.next&&(ve.steiner=!0),fe.push(qy(ve))}fe.sort(Uy);for(let Ce=0;Ce<fe.length;Ce++)U=$y(fe[Ce],U);return U}(v,P,L,M)),v.length>80*M){$=1/0,H=1/0;let X=-1/0,A=-1/0;for(let U=M;U<R;U+=M){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 bc(L,j,M,$,H,re,0),j}(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 Mf(r,t,n,a=!0){return new Hy(n,t).subdividePolygonInternal(r,a)}function Hs(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(Mt/t),m=[];m.push(new Ve(r[0].x,r[0].y));const y=r.length,v=d?y:y-1;for(let P=0;P<v;P++){const M=r[P],k=P<y-1?r[P+1]:r[0],R=M.x,L=M.y,j=k.x,$=k.y,H=R!==j,re=L!==$;if(!H&&!re)continue;const X=j-R,A=$-L,U=Math.abs(X),J=Math.abs(A);let fe=R,Ce=L;for(;;){const ve=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-ve),De=Math.abs(Ce-Re),Pe=Math.abs(fe-j),$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=ve,Ce+=A*Qe;const He=new Ve(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 Ve(Math.round(fe),Ce);m[m.length-1].x===He.x&&m[m.length-1].y===He.y||m.push(He)}}const ge=new Ve(j,$);m[m.length-1].x===ge.x&&m[m.length-1].y===ge.y||m.push(ge)}return m}function Ky(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]],M=r[2*t[v]],k=r[2*t[p]],R=r[2*t[p]+1],L=r[2*t[m]+1];let j=!1;if(P<M)j=!0;else if(P>M)j=!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>((M-k)*$+(r[2*t[v]+1]-R)*H)*re&&(j=!0)}if(j){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 If(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 M=t.prepareSegment(v,n,a),k=M.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(k+d[j],k+d[j+1],k+d[j+2]);let R,L;M.vertexLength+=v,M.primitiveLength+=d.length/3,P&&(L=p.prepareSegment(v,n,m),R=L.vertexLength,L.vertexLength+=v);for(let j=0;j<l.length;j+=2)r(l[j],l[j+1]);if(P)for(let j=0;j<y.length;j++){const $=y[j];for(let H=1;H<$.length;H+=2)m.emplaceBack(R+$[H-1],R+$[H]);L.primitiveLength+=$.length/2}}else(function(M,k,R,L,j,$){const H=[];for(let J=0;J<L.length/2;J++)H.push(-1);const re={count:0};let X=0,A=M.getOrCreateLatestSegment(k,R),U=A.vertexLength;for(let J=2;J<j.length;J+=3){const fe=j[J-2],Ce=j[J-1],ge=j[J];let ve=H[fe]<X,Re=H[Ce]<X,Ee=H[ge]<X;A.vertexLength+((ve?1:0)+(Re?1:0)+(Ee?1:0))>ut.MAX_VERTEX_ARRAY_LENGTH&&(A=M.createNewSegment(k,R),X=re.count,ve=!0,Re=!0,Ee=!0,U=0);const De=Mc(H,L,$,re,fe,ve,A),Pe=Mc(H,L,$,re,Ce,Re,A),$e=Mc(H,L,$,re,ge,Ee,A);R.emplaceBack(U+De-X,U+Pe-X,U+$e-X),A.primitiveLength++}})(t,n,a,l,d,r),P&&function(M,k,R,L,j,$){const H=[];for(let J=0;J<L.length/2;J++)H.push(-1);const re={count:0};let X=0,A=M.getOrCreateLatestSegment(k,R),U=A.vertexLength;for(let J=0;J<j.length;J++){const fe=j[J];for(let Ce=1;Ce<j[J].length;Ce+=2){const ge=fe[Ce-1],ve=fe[Ce];let Re=H[ge]<X,Ee=H[ve]<X;A.vertexLength+((Re?1:0)+(Ee?1:0))>ut.MAX_VERTEX_ARRAY_LENGTH&&(A=M.createNewSegment(k,R),X=re.count,Re=!0,Ee=!0,U=0);const De=Mc(H,L,$,re,ge,Re,A),Pe=Mc(H,L,$,re,ve,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 Mc(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 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.layoutVertexArray=new te,this.indexArray=new Me,this.indexArray2=new We,this.programConfigurations=new da(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=xd("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 M=this.layers[0]._featureFilter.needGeometry,k=kn(m,M);if(!this.layers[0]._featureFilter.filter(new Bt(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:M?k.geometry:zn(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 M=vd("fill",this.layers,m,this.zoom,n);this.patternFeatures.push(M)}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,Oy),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 zs(n,500)){const y=Mf(m,l,p.fill.getGranularityForZoomLevel(l.z)),v=this.layoutVertexArray;If((P,M)=>{v.emplaceBack(P,M)},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 Cf,Ef;Ue("FillBucket",Td,{omit:["layers","patternFeatures"]});var Xy={get paint(){return Ef=Ef||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 Zo(D.paint_fill["fill-pattern"])})},get layout(){return Cf=Cf||new $i({"fill-sort-key":new tt(D.layout_fill["fill-sort-key"])})}};class Yy extends Bi{constructor(t){super(t,Xy)}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 Td(t)}queryRadius(){return oh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:l}){return uf(lh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,l),n)}isTileClipped(){return!0}}const Jy=ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Qy=ti([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ex}=Jy;var Pd,zf,Sd,kf,Md,Af,Rf,dh={};function Df(){if(zf)return Pd;zf=1;var r=Ze();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()],M=y._values[m.readVarint()];y.properties[P]=M}}(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 Pd=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,M=[];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&&M.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&&M.push(d),M},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,M=-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>M&&(M=y),(v+=l.readSVarint())<k&&(k=v),v>R&&(R=v);else if(p!==7)throw new Error("unknown command "+p)}return[P,k,M,R]},t.prototype.toGeoJSON=function(l,d,p){var m,y,v=this.extent*Math.pow(2,p),P=this.extent*l,M=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+M)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<k.length;m++)j[m]=k[m][0];L(k=j);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),$},Pd}function Lf(){if(kf)return Sd;kf=1;var r=Df();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 Sd=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)},Sd}function Ff(){return Rf||(Rf=1,dh.VectorTile=function(){if(Af)return Md;Af=1;var r=Lf();function t(n,a,l){if(n===3){var d=new r(l,l.readVarint()+l.pos);d.length&&(a[d.name]=d)}}return Md=function(n,a){this.layers=n.readFields(t,{},a)},Md}(),dh.VectorTileFeature=Df(),dh.VectorTileLayer=Lf()),dh}var Ic=_e(Ff());const tx=Ic.VectorTileFeature.types,Id=Math.pow(2,13);function Cc(r,t,n,a,l,d,p,m){r.emplaceBack(t,n,2*Math.floor(a*Id)+p,l*Id*2,d*Id*2,Math.round(m))}class Cd{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 da(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=xd("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=kn(l,y);if(!this.layers[0]._featureFilter.filter(new Bt(this.zoom),v,a))continue;const P={id:d,sourceLayerIndex:m,index:p,geometry:y?v.geometry:zn(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(vd("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,ex),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Qy.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 zs(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,M=Math.floor(y.x/y.sampleCount),k=Math.floor(y.y/y.sampleCount);for(let R=0;R<P;R++)this.centroidVertexArray.emplaceBack(M,k)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,l)}processPolygon(t,n,a,l,d){if(l.length<1||Bf(l[0]))return;for(const M of l)M.length!==0&&ix(t,M);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(n.z),y=tx[a.type]==="Polygon";for(const M of l){if(M.length===0||Bf(M))continue;const k=Hs(M,m,y);this._generateSideFaces(k,p)}if(!y)return;const v=Mf(l,n,m,!1),P=this.layoutVertexArray;If((M,k)=>{Cc(P,M,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(rx(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),Cc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Cc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Cc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Cc(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 ix(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 rx(r,t){return r.x===t.x&&(r.x<0||r.x>Mt)||r.y===t.y&&(r.y<0||r.y>Mt)}function Bf(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Mt)||r.every(t=>t.y<0)||r.every(t=>t.y>Mt)}let Of;Ue("FillExtrusionBucket",Cd,{omit:["layers","features"]});var nx={get paint(){return Of=Of||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 Zo(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 ax extends Bi{constructor(t){super(t,nx)}createBucket(t){return new Cd(t)}queryRadius(){return oh(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=lh(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),M=function(R,L,j){const $=[];for(const H of R){const re=[H.x,H.y,0,1];$r(re,re,L),$.push(new Ve(re[0]/re[3],re[1]/re[3]))}return $}(y,m),k=function(R,L,j,$){const H=[],re=[],X=$[8]*L,A=$[9]*L,U=$[10]*L,J=$[11]*L,fe=$[8]*j,Ce=$[9]*j,ge=$[10]*j,ve=$[11]*j;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],mt=$[2]*$e+$[6]*Qe+$[14],Xt=$[3]*$e+$[7]*Qe+$[15],mi=mt+U,Di=Xt+J,Pr=Ye+fe,tr=He+Ce,Mi=mt+ge,$t=Xt+ve,xi=new Ve((Ye+X)/Di,(He+A)/Di);xi.z=mi/Di,Ee.push(xi);const Ii=new Ve(Pr/$t,tr/$t);Ii.z=Mi/$t,De.push(Ii)}H.push(Ee),re.push(De)}return[H,re]}(l,P,v,m);return function(R,L,j){let $=1/0;uf(j,L)&&($=jf(j,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];qo(j,J)&&($=Math.min($,jf(j,J)))}}return $!==1/0&&$}(k[0],k[1],M)}}function Ec(r,t){return r.x*t.x+r.y*t.y}function jf(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=Ec(m,m),M=Ec(m,y),k=Ec(y,y),R=Ec(v,m),L=Ec(v,y),j=P*k-M*M,$=(k*R-M*L)/j,H=(P*L-M*R)/j,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 sx=ti([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ox}=sx,lx=ti([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cx}=lx,ux=Ic.VectorTileFeature.types,hx=Math.cos(Math.PI/180*37.5),Nf=Math.pow(2,14)/.5;class Ed{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 da(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=xd("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 M=this.layers[0]._featureFilter.needGeometry,k=kn(m,M);if(!this.layers[0]._featureFilter.filter(new Bt(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:M?k.geometry:zn(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 M=vd("line",this.layers,m,this.zoom,n);this.patternFeatures.push(M)}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,cx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ox),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"),M=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const k of n)this.addLine(k,t,y,v,P,M,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=Hs(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=ux[n.type]==="Polygon";let P=t.length;for(;P>=2&&t[P-1].equals(t[P-2]);)P--;let M=0;for(;M<P-1&&t[M].equals(t[M+1]);)M++;if(P<(v?3:2))return;a==="bevel"&&(d=1.05);const k=this.overscaling<=16?15*Mt/(512*this.overscaling):0,R=this.segments.prepareSegment(10*P,this.layoutVertexArray,this.indexArray);let L,j,$,H,re;this.e1=this.e2=-1,v&&(L=t[P-2],re=t[M].sub(L)._unit()._perp());for(let X=M;X<P;X++){if($=X===P-1?v?t[M+1]:void 0:t[X+1],$&&t[X].equals($))continue;re&&(H=re),L&&(j=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),ge=J<hx&&j&&$,ve=H.x*re.y-H.y*re.x>0;if(ge&&X>M){const De=L.dist(j);if(De>2*k){const Pe=L.sub(L.sub(j)._mult(k/De)._round());this.updateDistance(j,Pe),this.addCurrentVertex(Pe,H,0,0,R),j=Pe}}const Re=j&&$;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")),j&&this.updateDistance(j,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*(ve?-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=ve?De:0,$e=ve?0:De;if(j&&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 Xt=He-.5;He+=He*Xt*(He-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*Xt*Xt+(.848013+U*(.215638*U-1.06021)))}const mt=re.sub(H)._mult(He)._add(H)._unit()._mult(ve?-1:1);this.addHalfVertex(L,mt.x,mt.y,!1,ve,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=j?1:-1;this.addCurrentVertex(L,A,De,De,R)}else Ee==="round"&&(j&&(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(ge&&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>Nf/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*(Nf-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 Zf,Vf;Ue("LineBucket",Ed,{omit:["layers","patternFeatures"]});var Uf={get paint(){return Vf=Vf||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 cc(D.paint_line["line-dasharray"]),"line-pattern":new Zo(D.paint_line["line-pattern"]),"line-gradient":new uc(D.paint_line["line-gradient"])})},get layout(){return Zf=Zf||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 dx extends tt{possiblyEvaluate(t,n){return n=new Bt(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=Ti({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,l)}}let ph;class px extends Bi{constructor(t){super(t,Uf),this.gradientVersion=0,ph||(ph=new dx(Uf.paint.properties["line-width"].specification),ph.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 Fa,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"]=ph.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ed(t)}queryRadius(t){const n=t,a=$f(xc("line-width",this,n),xc("line-gap-width",this,n)),l=xc("line-offset",this,n);return a/2+Math.abs(l)+oh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:l,transform:d,pixelsToTileUnits:p}){const m=lh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*$f(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,M){const k=[];for(let R=0;R<P.length;R++){const L=P[R],j=[];for(let $=0;$<L.length;$++){const H=L[$-1],re=L[$],X=L[$+1],A=$===0?new Ve(0,0):re.sub(H)._unit()._perp(),U=$===L.length-1?new Ve(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),j.push(J._mult(M)._add(re))}k.push(j)}return k}(l,v*p)),function(P,M,k){for(let R=0;R<M.length;R++){const L=M[R];if(P.length>=3){for(let j=0;j<L.length;j++)if(qs(P,L[j]))return!0}if(Cy(P,L,k))return!0}return!1}(m,l,y)}isTileClipped(){return!0}}function $f(r,t){return t>0?t+2*r:r}const fx=ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),mx=ti([{name:"a_projected_pos",components:3,type:"Float32"}],4);ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const gx=ti([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ti([{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 Gf=ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),_x=ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function yx(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()),Qr.applyArabicShaping&&(l=Qr.applyArabicShaping(l)),l}(a.text,t,n)}),r}ti([{name:"triangle",components:3,type:"Uint16"}]),ti([{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"}]),ti([{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"}]),ti([{type:"Float32",name:"offsetX"}]),ti([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ti([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const zc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var qf,zd,Wf,fi=24,kd={};function xx(){return qf||(qf=1,kd.read=function(r,t,n,a,l){var d,p,m=8*l-a-1,y=(1<<m)-1,v=y>>1,P=-7,M=n?l-1:0,k=n?-1:1,R=r[t+M];for(M+=k,d=R&(1<<-P)-1,R>>=-P,P+=m;P>0;d=256*d+r[t+M],M+=k,P-=8);for(p=d&(1<<-P)-1,d>>=-P,P+=a;P>0;p=256*p+r[t+M],M+=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)},kd.write=function(r,t,n,a,l,d){var p,m,y,v=8*d-l-1,P=(1<<v)-1,M=P>>1,k=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=a?0:d-1,L=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=P):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+M>=1?k/y:k*Math.pow(2,1-M))*y>=2&&(p++,y/=2),p+M>=P?(m=0,p=P):p+M>=1?(m=(t*y-1)*Math.pow(2,l),p+=M):(m=t*Math.pow(2,M-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*j}),kd}function Hf(){if(Wf)return zd;Wf=1,zd=t;var r=xx();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 M(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 j(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,ge=this.pos;this.type=7&fe,A(Ce,U,this),this.pos===ge&&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,ge,ve){var Re,Ee,De=ve.buf;if(Re=(112&(Ee=De[ve.pos++]))>>4,Ee<128||(Re|=(127&(Ee=De[ve.pos++]))<<3,Ee<128)||(Re|=(127&(Ee=De[ve.pos++]))<<10,Ee<128)||(Re|=(127&(Ee=De[ve.pos++]))<<17,Ee<128)||(Re|=(127&(Ee=De[ve.pos++]))<<24,Ee<128)||(Re|=(1&(Ee=De[ve.pos++]))<<31,Ee<128))return p(Ce,Re,ge);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 ge="",ve=fe;ve<Ce;){var Re,Ee,De,Pe=J[ve],$e=null,Qe=Pe>239?4:Pe>223?3:Pe>191?2:1;if(ve+Qe>Ce)break;Qe===1?Pe<128&&($e=Pe):Qe===2?(192&(Re=J[ve+1]))==128&&($e=(31&Pe)<<6|63&Re)<=127&&($e=null):Qe===3?(Ee=J[ve+2],(192&(Re=J[ve+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[ve+2],De=J[ve+3],(192&(Re=J[ve+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,ge+=String.fromCharCode($e>>>10&1023|55296),$e=56320|1023&$e),ge+=String.fromCharCode($e),ve+=Qe}return ge}(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(ge,ve,Re){Re.buf[Re.pos++]=127&ge|128,ge>>>=7,Re.buf[Re.pos++]=127&ge|128,ge>>>=7,Re.buf[Re.pos++]=127&ge|128,ge>>>=7,Re.buf[Re.pos++]=127&ge|128,Re.buf[Re.pos]=127&(ge>>>=7)}(fe,0,J),function(ge,ve){var Re=(7&ge)<<4;ve.buf[ve.pos++]|=Re|((ge>>>=3)?128:0),ge&&(ve.buf[ve.pos++]=127&ge|((ge>>>=7)?128:0),ge&&(ve.buf[ve.pos++]=127&ge|((ge>>>=7)?128:0),ge&&(ve.buf[ve.pos++]=127&ge|((ge>>>=7)?128:0),ge&&(ve.buf[ve.pos++]=127&ge|((ge>>>=7)?128:0),ge&&(ve.buf[ve.pos++]=127&ge)))))}(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,ge){for(var ve,Re,Ee=0;Ee<Ce.length;Ee++){if((ve=Ce.charCodeAt(Ee))>55295&&ve<57344){if(!Re){ve>56319||Ee+1===Ce.length?(fe[ge++]=239,fe[ge++]=191,fe[ge++]=189):Re=ve;continue}if(ve<56320){fe[ge++]=239,fe[ge++]=191,fe[ge++]=189,Re=ve;continue}ve=Re-55296<<10|ve-56320|65536,Re=null}else Re&&(fe[ge++]=239,fe[ge++]=191,fe[ge++]=189,Re=null);ve<128?fe[ge++]=ve:(ve<2048?fe[ge++]=ve>>6|192:(ve<65536?fe[ge++]=ve>>12|224:(fe[ge++]=ve>>18|240,fe[ge++]=ve>>12&63|128),fe[ge++]=ve>>6&63|128),fe[ge++]=63&ve|128)}return ge}(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,M,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,j,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)}},zd}var Ad=_e(Hf());const Rd=3;function vx(r,t,n){r===1&&n.readMessage(bx,t)}function bx(r,t,n){if(r===3){const{id:a,bitmap:l,width:d,height:p,left:m,top:y,advance:v}=n.readMessage(wx,{});t.push({id:a,bitmap:new vc({width:d+2*Rd,height:p+2*Rd},l),metrics:{width:d,height:p,left:m,top:y,advance:v}})}}function wx(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 Tx=Rd;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 er=1;class Dd{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+er,this.paddedRect.y+er]}get br(){return[this.paddedRect.x+this.paddedRect.w-er,this.paddedRect.y+this.paddedRect.h-er]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*er)/this.pixelRatio,(this.paddedRect.h-2*er)/this.pixelRatio]}}class Xf{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 wr({width:p||1,height:m||1});for(const v in t){const P=t[v],M=a[v].paddedRect;wr.copy(P.data,y,{x:0,y:0},{x:M.x+er,y:M.y+er},P.data)}for(const v in n){const P=n[v],M=l[v].paddedRect,k=M.x+er,R=M.y+er,L=P.data.width,j=P.data.height;wr.copy(P.data,y,{x:0,y:0},{x:k,y:R},P.data),wr.copy(P.data,y,{x:0,y:j-1},{x:k,y:R-1},{width:L,height:1}),wr.copy(P.data,y,{x:0,y:0},{x:k,y:R+j},{width:L,height:1}),wr.copy(P.data,y,{x:L-1,y:0},{x:k-1,y:R},{width:1,height:j}),wr.copy(P.data,y,{x:0,y:0},{x:k+L,y:R},{width:1,height:j})}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*er,h:d.data.height+2*er};a.push(p),n[l]=new Dd(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 ts;Ue("ImagePosition",Dd),Ue("ImageAtlas",Xf),S.ah=void 0,(ts=S.ah||(S.ah={}))[ts.none=0]="none",ts[ts.horizontal=1]="horizontal",ts[ts.vertical=2]="vertical",ts[ts.horizontalOnly=3]="horizontalOnly";const fh=-17;class kc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const l=new kc;return l.scale=t||1,l.fontStack=n,l.verticalAlign=a||"bottom",l}static forImage(t,n){const a=new kc;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class Xo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new Xo;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&&oc(l)&&!zc[t[a+1]]||d&&oc(d)&&!zc[t[a-1]]||!zc[t[a]]?t[a]:zc[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&gh[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&gh[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 Xo;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(kc.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 zi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(kc.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):zi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function mh(r,t,n,a,l,d,p,m,y,v,P,M,k,R,L){const j=Xo.fromFeature(r,l);let $;M===S.ah.vertical&&j.verticalizePunctuation();const{processBidirectionalText:H,processStyledBidirectionalText:re}=Qr;if(H&&j.sections.length===1){$=[];const U=H(j.toString(),Ld(j,v,d,t,a,R));for(const J of U){const fe=new Xo;fe.text=J,fe.sections=j.sections;for(let Ce=0;Ce<J.length;Ce++)fe.sectionIndex.push(0);$.push(fe)}}else if(re){$=[];const U=re(j.text,j.sectionIndex,Ld(j,v,d,t,a,R));for(const J of U){const fe=new Xo;fe.text=J[0],fe.sectionIndex=J[1],fe.sections=j.sections,$.push(fe)}}else $=function(U,J){const fe=[],Ce=U.text;let ge=0;for(const ve of J)fe.push(U.substring(ge,ve)),ge=ve;return ge<Ce.length&&fe.push(U.substring(ge,Ce.length)),fe}(j,Ld(j,v,d,t,a,R));const X=[],A={positionedLines:X,text:j.toString(),top:P[1],bottom:P[1],left:P[0],right:P[0],writingMode:M,iconsInText:!1,verticalizable:!1};return function(U,J,fe,Ce,ge,ve,Re,Ee,De,Pe,$e,Qe){let Ye=0,He=0,mt=0,Xt=0;const mi=Ee==="right"?1:Ee==="left"?0:.5,Di=fi/Qe;let Pr=0;for(const $t of ge){$t.trim();const xi=$t.getMaxScale(),Ii={positionedGlyphs:[],lineOffset:0};U.positionedLines[Pr]=Ii;const Ci=Ii.positionedGlyphs;let qi=0;if(!$t.length()){He+=ve,++Pr;continue}const Sr=Ix(Ce,$t,Di);for(let ir=0;ir<$t.length();ir++){const gi=$t.getSection(ir),bi=$t.getSectionIndex(ir),wi=$t.getCharCode(ir),ci=Cx(De,$e,wi);let jt;if(gi.imageName){if(U.iconsInText=!0,gi.scale=gi.scale*Di,jt=zx(gi,ci,xi,Sr,Ce),!jt)continue;qi=Math.max(qi,jt.imageOffset)}else if(jt=Ex(gi,wi,ci,Sr,J,fe),!jt)continue;const{rect:nn,metrics:el,baselineOffset:an}=jt;Ci.push({glyph:wi,imageName:gi.imageName,x:Ye,y:He+an+fh,vertical:ci,scale:gi.scale,fontStack:gi.fontStack,sectionIndex:bi,metrics:el,rect:nn}),ci?(U.verticalizable=!0,Ye+=(gi.imageName?el.advance:fi)*gi.scale+Pe):Ye+=el.advance*gi.scale+Pe}Ci.length!==0&&(mt=Math.max(Ye-Pe,mt),kx(Ci,0,Ci.length-1,mi)),Ye=0,Ii.lineOffset=Math.max(qi,(xi-1)*fi);const vi=ve*xi+qi;He+=vi,Xt=Math.max(vi,Xt),++Pr}const{horizontalAlign:tr,verticalAlign:Mi}=Fd(Re);(function($t,xi,Ii,Ci,qi,Sr,vi,ir,gi){const bi=(xi-Ii)*qi;let wi=0;wi=Sr!==vi?-ir*Ci-fh:-Ci*gi*vi+.5*vi;for(const ci of $t)for(const jt of ci.positionedGlyphs)jt.x+=bi,jt.y+=wi})(U.positionedLines,mi,tr,Mi,mt,Xt,ve,He,ge.length),U.top+=-Mi*He,U.bottom=U.top+He,U.left+=-tr*mt,U.right=U.left+mt}(A,t,n,a,$,p,m,y,M,v,k,L),!function(U){for(const J of U)if(J.positionedGlyphs.length!==0)return!1;return!0}(X)&&A}const gh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Px={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},Sx={40:!0};function Yf(r,t,n,a,l,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*fi/d+l:0}{const p=n[t.fontStack],m=p&&p[r];return m?m.metrics.advance*t.scale+l:0}}function Jf(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 Mx(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 Qf(r,t,n,a,l,d){let p=null,m=Jf(t,n,l,d);for(const y of a){const v=Jf(t-y.x,n,l,d)+y.badness;v<=m&&(p=y,m=v)}return{index:r,x:t,priorBreak:p,badness:m}}function em(r){return r?em(r.priorBreak).concat(r.index):[]}function Ld(r,t,n,a,l,d){if(!r)return[];const p=[],m=function(M,k,R,L,j,$){let H=0;for(let re=0;re<M.length();re++){const X=M.getSection(re);H+=Yf(M.getCharCode(re),X,L,j,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 M=0;M<r.length();M++){const k=r.getSection(M),R=r.getCharCode(M);if(gh[R]||(v+=Yf(R,k,a,l,t,d)),M<r.length()-1){const L=!((P=R)<11904)&&(!!ft["CJK Compatibility Forms"](P)||!!ft["CJK Compatibility"](P)||!!ft["CJK Strokes"](P)||!!ft["CJK Symbols and Punctuation"](P)||!!ft["Enclosed CJK Letters and Months"](P)||!!ft["Halfwidth and Fullwidth Forms"](P)||!!ft["Ideographic Description Characters"](P)||!!ft["Vertical Forms"](P)||ac.test(String.fromCodePoint(P)));(Px[R]||L||k.imageName||M!==r.length()-2&&Sx[r.getCharCode(M+1)])&&p.push(Qf(M+1,v,m,p,Mx(R,r.getCharCode(M+1),L&&y),!1))}}var P;return em(Qf(r.length(),v,m,p,0,!0))}function Fd(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 Ix(r,t,n){const a=t.getMaxScale()*fi,{maxImageWidth:l,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,l*n),horizontalLineContentHeight:p}}function tm(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function Cx(r,t,n){return!(r===S.ah.horizontal||!t&&!sc(n)||t&&(gh[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function Ex(r,t,n,a,l,d){const p=d[r.fontStack],m=function(v,P,M,k){if(v&&v.rect)return v;const R=P[M.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*fi;else{const v=tm(r.verticalAlign);y=(a.horizontalLineContentHeight-r.scale*fi)*v}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function zx(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:er,top:-3,advance:t?m[1]:m[0]};let v;if(t)v=a.verticalLineContentWidth-m[1]*r.scale;else{const P=tm(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-fi*n}}function kx(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 Ax(r,t,n){const{horizontalAlign:a,verticalAlign:l}=Fd(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 im(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 rm(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,M,k,R;n==="width"||n==="both"?(R=l[0]+y-a[3],M=l[0]+v+a[1]):(R=l[0]+(y+v-p.displaySize[0])/2,M=R+p.displaySize[0]);const L=t.top*d,j=t.bottom*d;return n==="height"||n==="both"?(P=l[1]+L-a[0],k=l[1]+j+a[2]):(P=l[1]+(L+j-p.displaySize[1])/2,k=P+p.displaySize[1]),{image:p,top:P,right:M,bottom:k,left:R,collisionPadding:m}}const Ac=255,An=128,is=Ac*An;function nm(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Bt(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 Bt(m)),maxSize:n.evaluate(new Bt(y)),interpolationType:l}}}function Bd(r,t,n){let a="never";const l=r.get(t);return l?a=l:r.get(n)&&(a="always"),a}const Rx=Ic.VectorTileFeature.types,Dx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function _h(r,t,n,a,l,d,p,m,y,v,P,M,k){const R=m?Math.min(is,Math.round(m[0])):0,L=m?Math.min(is,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*M,256*k)}function Od(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 Lx(r){for(const t of r.sections)if(ud(t.text))return!0;return!1}class jd{constructor(t){this.layoutVertexArray=new Te,this.indexArray=new Me,this.programConfigurations=t,this.segments=new ut,this.dynamicLayoutVertexArray=new Se,this.opacityVertexArray=new be,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,fx.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,mx.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Dx,!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())}}Ue("SymbolBuffers",jd);class Nd{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,gx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ue("CollisionBuffers",Nd);class Yo{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=nm(this.zoom,n["text-size"]),this.iconSizeData=nm(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=Bd(a,"text-overlap","text-allow-overlap")!=="never"||Bd(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=>S.ah[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new jd(new da(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new jd(new da(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new B,this.lineVertexArray=new Z,this.symbolInstances=new E,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=zc[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 Li&&!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,M=d.get("symbol-sort-key");if(this.features=[],!v&&!P)return;const k=n.iconDependencies,R=n.glyphDependencies,L=n.availableImages,j=new Bt(this.zoom);for(const{feature:$,id:H,index:re,sourceLayerIndex:X}of t){const A=l._featureFilter.needGeometry,U=kn($,A);if(!l._featureFilter.filter(j,U,a))continue;let J,fe;if(A||(U.geometry=zn($)),v){const ge=l.getValueAndResolveTokens("text-field",U,a,L),ve=Li.factory(ge),Re=this.hasRTLText=this.hasRTLText||Lx(ve);(!Re||Qr.getRTLTextPluginStatus()==="unavailable"||Re&&Qr.isParsed())&&(J=yx(ve,l,U))}if(P){const ge=l.getValueAndResolveTokens("icon-image",U,a,L);fe=ge instanceof Zi?ge:Zi.fromString(ge)}if(!J&&!fe)continue;const Ce=this.sortFeaturesByKey?M.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:Rx[$.type],sortKey:Ce}),fe&&(k[fe.name]=!0),J){const ge=p.evaluate(U,{},a).join(","),ve=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.ah.vertical)>=0;for(const Re of J.sections)if(Re.image)k[Re.image.name]=!0;else{const Ee=Oo(J.toString()),De=Re.fontStack||ge,Pe=R[De]=R[De]||{};this.calculateGlyphDependencies(Re.text,Pe,ve,this.allowVerticalPlacement,Ee)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const H={},re={},X=[];let A=0;function U(ge){X.push($[ge]),A++}function J(ge,ve,Re){const Ee=re[ge];return delete re[ge],re[ve]=Ee,X[Ee].geometry[0].pop(),X[Ee].geometry[0]=X[Ee].geometry[0].concat(Re[0]),Ee}function fe(ge,ve,Re){const Ee=H[ve];return delete H[ve],H[ge]=Ee,X[Ee].geometry[0].shift(),X[Ee].geometry[0]=Re[0].concat(X[Ee].geometry[0]),Ee}function Ce(ge,ve,Re){const Ee=Re?ve[0][ve[0].length-1]:ve[0][0];return`${ge}:${Ee.x}:${Ee.y}`}for(let ge=0;ge<$.length;ge++){const ve=$[ge],Re=ve.geometry,Ee=ve.text?ve.text.toString():null;if(!Ee){U(ge);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(ge),H[De]=A-1,re[Pe]=A-1)}return X.filter(ge=>ge.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,M,k){const R=t.indexArray,L=t.layoutVertexArray,j=t.segments.prepareSegment(4*n.length,L,R,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,H=j.vertexLength,re=this.allowVerticalPlacement&&m===S.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:ge,pixelOffsetTL:ve,pixelOffsetBR:Re,minFontScaleX:Ee,minFontScaleY:De,glyphOffset:Pe,isSDF:$e,sectionIndex:Qe}=n[A],Ye=j.vertexLength,He=Pe[1];_h(L,y.x,y.y,U.x,He+U.y,ge.x,ge.y,a,$e,ve.x,ve.y,Ee,De),_h(L,y.x,y.y,J.x,He+J.y,ge.x+ge.w,ge.y,a,$e,Re.x,ve.y,Ee,De),_h(L,y.x,y.y,fe.x,He+fe.y,ge.x,ge.y+ge.h,a,$e,ve.x,Re.y,Ee,De),_h(L,y.x,y.y,Ce.x,He+Ce.y,ge.x+ge.w,ge.y+ge.h,a,$e,Re.x,Re.y,Ee,De),Od(t.dynamicLayoutVertexArray,y,re),R.emplaceBack(Ye,Ye+2,Ye+1),R.emplaceBack(Ye+1,Ye+2,Ye+3),j.vertexLength+=4,j.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,M)}_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,M=d.collisionVertexArray,k=m.anchorX,R=m.anchorY;this._addCollisionDebugVertex(P,M,p,k,R,new Ve(t,n)),this._addCollisionDebugVertex(P,M,p,k,R,new Ve(a,n)),this._addCollisionDebugVertex(P,M,p,k,R,new Ve(a,l)),this._addCollisionDebugVertex(P,M,p,k,R,new Ve(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 Nd(Be,Gf.members,We),this.iconCollisionBox=new Nd(Be,Gf.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 M=n;M<a;M++){const k=t.get(M);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 M=l;M<d;M++){const k=t.get(M);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 M=p;M<m;M++){const k=t.get(M);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 M=y;M<v;M++){const k=t.get(M);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 am,sm;Ue("SymbolBucket",Yo,{omit:["layers","collisionBoxArray","features","compareText"]}),Yo.MAX_GLYPHS=65535,Yo.addDynamicAttributes=Od;var Zd={get paint(){return sm=sm||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 am=am||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 om{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:yt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(t.formattedSection))return n.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ue("FormatSectionOverride",om,{omit:["defaultValue"]});class yh extends Bi{constructor(t){super(t,Zd)}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()||Rs(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 Yo(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Zd.paint.overridableProperties){if(!yh.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new om(n),l=new Ga(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new Wl("source",l):new Hl("composite",l,n.value.zoomStops),this.paint._values[t]=new Lr(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&yh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),l=Zd.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 Li)p(a.value.value.sections);else if(a.value.kind==="source"){const m=v=>{d||(v instanceof Pn&&Vt(v.value)===Lt?p(v.value.sections):v instanceof Oa?p(v.sections):v.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let lm;var Fx={get paint(){return lm=lm||new $i({"background-color":new Xe(D.paint_background["background-color"]),"background-pattern":new cc(D.paint_background["background-pattern"]),"background-opacity":new Xe(D.paint_background["background-opacity"])})}};class Bx extends Bi{constructor(t){super(t,Fx)}}let cm;var Ox={get paint(){return cm=cm||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 jx extends Bi{constructor(t){super(t,Ox)}}class Nx extends Bi{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 Zx{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 Vx={once:!0},Vd=63710088e-1;class rs{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 rs(ar(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 Vd*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof rs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new rs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new rs(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 um=2*Math.PI*Vd;function hm(r){return um*Math.cos(r*Math.PI/180)}function dm(r){return(180+r)/360}function pm(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function fm(r,t){return r/hm(t)}function Ud(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function mm(r,t){return r*hm(Ud(t))}class Rc{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=rs.convert(t);return new Rc(dm(a.lng),pm(a.lat),fm(n,a.lat))}toLngLat(){return new rs(360*this.x-180,Ud(this.y))}toAltitude(){return mm(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/um*(t=Ud(this.y),1/Math.cos(t*Math.PI/180));var t}}function gm(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 $d{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=Jo(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=gm(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),v=gm(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+v[0]+","+v[1]);var d,p,m,y,v;const P=function(M,k,R){let L,j="";for(let $=M;$>0;$--)L=1<<$-1,j+=(k&L?1:0)+(R&L?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,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 Ve((t.x*n-this.x)*Mt,(t.y*n-this.y)*Mt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class _m{constructor(t,n){this.wrap=t,this.canonical=n,this.key=Jo(t,n.z,n.z,n.x,n.y)}}class Tr{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 $d(a,+l,+d),this.key=Jo(n,t,a,l,d)}clone(){return new Tr(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 Tr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Tr(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?Jo(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):Jo(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 Tr(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 Tr(n,this.wrap,n,a,l),new Tr(n,this.wrap,n,a+1,l),new Tr(n,this.wrap,n,a,l+1),new Tr(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 Tr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Tr(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 _m(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Rc(t.x-this.wrap,t.y))}}function Jo(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)}Ue("CanonicalTileID",$d),Ue("OverscaledTileID",Tr,{omit:["terrainRttPosMatrix32f"]});class ym{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 zi(`"${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 M=this.get(v,P);M>this.max&&(this.max=M),M<this.min&&(this.min=M)}}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 wr({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 M=l;M<d;M++)this.data[this._idx(M,P)]=t.data[this._idx(M+y,P+v)]}}Ue("DEMData",ym);class xm{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 vm{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 bm{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Bs(Mt,16,0),this.grid3D=new Bs(Mt,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],M=[1/0,1/0,-1/0,-1/0];for(let k=0;k<P.length;k++){const R=P[k];M[0]=Math.min(M[0],R.x),M[1]=Math.min(M[1],R.y),M[2]=Math.max(M[2],R.x),M[3]=Math.max(M[3],R.y)}M[0]<Mt&&M[1]<Mt&&M[2]>=0&&M[3]>=0&&y.insert(m,M[0],M[1],M[2],M[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ic.VectorTile(new Ad(this.rawTileData)).layers,this.sourceLayerCoder=new xm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,l){this.loadVTLayers();const d=t.params,p=Mt/t.tileSize/t.scale,m=Kl(d.filter),y=t.queryGeometry,v=t.queryPadding*p,P=Tm(y),M=this.grid.query(P.minX-v,P.minY-v,P.maxX+v,P.maxY+v),k=Tm(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 ve of A)if(U<=ve.x&&J<=ve.y&&fe>=ve.x&&Ce>=ve.y)return!0;const ge=[new Ve(U,J),new Ve(U,Ce),new Ve(fe,Ce),new Ve(fe,J)];if(A.length>2){for(const ve of ge)if(qs(A,ve))return!0}for(let ve=0;ve<A.length-1;ve++)if(zy(A[ve],A[ve+1],ge))return!0;return!1}(t.cameraQueryGeometry,$-v,H-v,re+v,X+v));for(const $ of R)M.push($);M.sort(Ux);const L={};let j;for(let $=0;$<M.length;$++){const H=M[$];if(H===j)continue;j=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=zn(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,M){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 $=kn(L,!0);if(!d.filter(new Bt(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new Bt(this.tileID.overscaledZ),L))return;const j=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={};j&&P&&(X=P.getState(re.sourceLayer||"_geojsonTileLayer",j));const A=Ti({},v[H]);A.paint=wm(A.paint,re.paint,L,X,m),A.layout=wm(A.layout,re.layout,L,X,m);const U=!M||M(L,re,X);if(!U)continue;const J=new vm(L,this.z,this.x,this.y,j);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=Kl(d);for(const M of t)this.loadMatchingFeature(v,a,l,M,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 wm(r,t,n,a,l){return Un(r,(d,p)=>{const m=t instanceof Zs?t.get(p):null;return m&&m.evaluate?m.evaluate(n,a,l):m})}function Tm(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 Ux(r,t){return t-r}function Pm(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],M=m[v+1];P.x<t&&M.x<t||(P.x<t?P=new Ve(t,P.y+(t-P.x)/(M.x-P.x)*(M.y-P.y))._round():M.x<t&&(M=new Ve(t,P.y+(t-P.x)/(M.x-P.x)*(M.y-P.y))._round()),P.y<n&&M.y<n||(P.y<n?P=new Ve(P.x+(n-P.y)/(M.y-P.y)*(M.x-P.x),n)._round():M.y<n&&(M=new Ve(P.x+(n-P.y)/(M.y-P.y)*(M.x-P.x),n)._round()),P.x>=a&&M.x>=a||(P.x>=a?P=new Ve(a,P.y+(a-P.x)/(M.x-P.x)*(M.y-P.y))._round():M.x>=a&&(M=new Ve(a,P.y+(a-P.x)/(M.x-P.x)*(M.y-P.y))._round()),P.y>=l&&M.y>=l||(P.y>=l?P=new Ve(P.x+(l-P.y)/(M.y-P.y)*(M.x-P.x),l)._round():M.y>=l&&(M=new Ve(P.x+(l-P.y)/(M.y-P.y)*(M.x-P.x),l)._round()),y&&P.equals(y[y.length-1])||(y=[P],d.push(y)),y.push(M)))))}}return d}Ue("FeatureIndex",bm,{omit:["rawTileData","sourceLayerCoder"]});class ns extends Ve{constructor(t,n,a,l){super(t,n),this.angle=a,l!==void 0&&(this.segment=l)}clone(){return new ns(this.x,this.y,this.angle,this.segment)}}function Sm(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],M=r[p+1];if(!M)return!1;let k=r[p-1].angleTo(P)-P.angleTo(M);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(M)}return!0}function Mm(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function Im(r,t,n){return r?.6*t*n:0}function Cm(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function $x(r,t,n,a,l,d){const p=Im(n,l,d),m=Cm(n,a)*d;let y=0;const v=Mm(r)/2;for(let P=0;P<r.length-1;P++){const M=r[P],k=r[P+1],R=M.dist(k);if(y+R>v){const L=(v-y)/R,j=vr.number(M.x,k.x,L),$=vr.number(M.y,k.y,L),H=new ns(j,$,k.angleTo(M),P);return H._round(),!p||Sm(r,H,m,p,t)?H:void 0}y+=R}}function Gx(r,t,n,a,l,d,p,m,y){const v=Im(a,d,p),P=Cm(a,l),M=P*p,k=r[0].x===0||r[0].x===y||r[0].y===0||r[0].y===y;return t-M<t/4&&(t=M+t/4),Em(r,k?t/2*m%t:(P/2+2*d)*p*m%t,t,v,n,M,k,!1,y)}function Em(r,t,n,a,l,d,p,m,y){const v=d/2,P=Mm(r);let M=0,k=t-n,R=[];for(let L=0;L<r.length-1;L++){const j=r[L],$=r[L+1],H=j.dist($),re=$.angleTo(j);for(;k+n<M+H;){k+=n;const X=(k-M)/H,A=vr.number(j.x,$.x,X),U=vr.number(j.y,$.y,X);if(A>=0&&A<y&&U>=0&&U<y&&k-v>=0&&k+v<=P){const J=new ns(A,U,re,L);J._round(),a&&!Sm(r,J,d,a,l)||R.push(J)}}M+=H}return m||R.length||p||(R=Em(r,M/2,n,a,l,d,p,!0,y)),R}Ue("Anchor",ns);const Dc=er;function zm(r,t,n,a){const l=[],d=r.image,p=d.pixelRatio,m=d.paddedRect.w-2*Dc,y=d.paddedRect.h-2*Dc;let v={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const P=d.stretchX||[[0,m]],M=d.stretchY||[[0,y]],k=(Pe,$e)=>Pe+$e[1]-$e[0],R=P.reduce(k,0),L=M.reduce(k,0),j=m-R,$=y-L;let H=0,re=R,X=0,A=L,U=0,J=j,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=im(r)),H=xh(P,0,Pe[0]),X=xh(M,0,Pe[1]),re=xh(P,Pe[0],Pe[2]),A=xh(M,Pe[1],Pe[3]),U=Pe[0]-H,fe=Pe[1]-X,J=$e-re,Ce=Qe-A}const ge=v.x1,ve=v.y1,Re=v.x2-ge,Ee=v.y2-ve,De=(Pe,$e,Qe,Ye)=>{const He=vh(Pe.stretch-H,re,Re,ge),mt=bh(Pe.fixed-U,J,Pe.stretch,R),Xt=vh($e.stretch-X,A,Ee,ve),mi=bh($e.fixed-fe,Ce,$e.stretch,L),Di=vh(Qe.stretch-H,re,Re,ge),Pr=bh(Qe.fixed-U,J,Qe.stretch,R),tr=vh(Ye.stretch-X,A,Ee,ve),Mi=bh(Ye.fixed-fe,Ce,Ye.stretch,L),$t=new Ve(He,Xt),xi=new Ve(Di,Xt),Ii=new Ve(Di,tr),Ci=new Ve(He,tr),qi=new Ve(mt/p,mi/p),Sr=new Ve(Pr/p,Mi/p),vi=t*Math.PI/180;if(vi){const bi=Math.sin(vi),wi=Math.cos(vi),ci=[wi,-bi,bi,wi];$t._matMult(ci),xi._matMult(ci),Ci._matMult(ci),Ii._matMult(ci)}const ir=Pe.stretch+Pe.fixed,gi=$e.stretch+$e.fixed;return{tl:$t,tr:xi,bl:Ci,br:Ii,tex:{x:d.paddedRect.x+Dc+ir,y:d.paddedRect.y+Dc+gi,w:Qe.stretch+Qe.fixed-ir,h:Ye.stretch+Ye.fixed-gi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qi,pixelOffsetBR:Sr,minFontScaleX:J/p/Re,minFontScaleY:Ce/p/Ee,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Pe=km(P,j,R),$e=km(M,$,L);for(let Qe=0;Qe<Pe.length-1;Qe++){const Ye=Pe[Qe],He=Pe[Qe+1];for(let mt=0;mt<$e.length-1;mt++)l.push(De(Ye,$e[mt],He,$e[mt+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 xh(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 km(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+Dc,stretch:n}),a}function vh(r,t,n,a){return r/t*n+a}function bh(r,t,n,a){return r-t*n/a}class wh{constructor(t,n,a,l,d,p,m,y,v,P){var M;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 j=R-k;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const k=!((M=p.image)===null||M===void 0)&&M.content&&(p.image.textFitWidth||p.image.textFitHeight)?im(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 Ve(k.x1,k.y1),j=new Ve(k.x2,k.y1),$=new Ve(k.x1,k.y2),H=new Ve(k.x2,k.y2),re=P*Math.PI/180;L._rotate(re),j._rotate(re),$._rotate(re),H._rotate(re),k.x1=Math.min(L.x,j.x,$.x,H.x),k.x2=Math.max(L.x,j.x,$.x,H.x),k.y1=Math.min(L.y,j.y,$.y,H.y),k.y2=Math.max(L.y,j.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 qx{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 Wx(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 qx([],Hx);if(y===0)return new Ve(a,l);for(let R=a;R<d;R+=y)for(let L=l;L<p;L+=y)P.push(new Qo(R+v,L+v,v,r));let M=function(R){let L=0,j=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;j+=(U.x+J.x)*fe,$+=(U.y+J.y)*fe,L+=3*fe}return new Qo(j/L,$/L,0,R)}(r),k=P.length;for(;P.length;){const R=P.pop();(R.d>M.d||!M.d)&&(M=R,n&&console.log("found best %d after %d probes",Math.round(1e4*R.d)/1e4,k)),R.max-M.d<=t||(v=R.h/2,P.push(new Qo(R.p.x-v,R.p.y-v,v,r)),P.push(new Qo(R.p.x+v,R.p.y-v,v,r)),P.push(new Qo(R.p.x-v,R.p.y+v,v,r)),P.push(new Qo(R.p.x+v,R.p.y+v,v,r)),k+=4)}return n&&(console.log(`num probes: ${k}`),console.log(`best distance: ${M.d}`)),M.p}function Hx(r,t){return t.max-r.max}function Qo(r,t,n,a){this.p=new Ve(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,M=v.length,k=M-1;P<M;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,hf(l,R,L))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ri;S.ay=void 0,(Ri=S.ay||(S.ay={}))[Ri.center=1]="center",Ri[Ri.left=2]="left",Ri[Ri.right=3]="right",Ri[Ri.top=4]="top",Ri[Ri.bottom=5]="bottom",Ri[Ri["top-left"]=6]="top-left",Ri[Ri["top-right"]=7]="top-right",Ri[Ri["bottom-left"]=8]="bottom-left",Ri[Ri["bottom-right"]=9]="bottom-right";const as=7,Gd=Number.POSITIVE_INFINITY;function Am(r,t){return t[1]!==Gd?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-as;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+as}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-as;break;case"bottom-right":case"bottom-left":d=-p+as;break;case"bottom":d=-a+as;break;case"top":d=a-as}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 Rm(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],M=m[v+1].map(k=>k*fi);P.startsWith("top")?M[1]-=as:P.startsWith("bottom")&&(M[1]+=as),y[v+1]=M}return new Fi(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)*fi,Gd]:l.get("text-offset").evaluate(t,{},n).map(v=>v*fi);const y=[];for(const v of p)y.push(v,Am(v,m));return new Fi(y)}return null}function qd(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 Kx(r,t,n,a,l,d,p,m,y,v,P,M){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),j=Lm(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,mt=1){const Xt=Qe.get("icon-padding").evaluate(Ye,{},He),mi=Xt&&Xt.values;return[mi[0]*mt,mi[1]*mt,mi[2]*mt,mi[3]*mt]}(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",ge=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",ve=R.get("symbol-placement"),Re=A/2,Ee=R.get("icon-text-fit");let De;a&&Ee!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(De=rm(a,n.vertical,Ee,R.get("icon-text-fit-padding"),L,$)),j&&(a=rm(a,j,Ee,R.get("icon-text-fit-padding"),L,$)));const Pe=P?M.line.getGranularityForZoomLevel(P.z):1,$e=(Qe,Ye)=>{Ye.x<0||Ye.x>=Mt||Ye.y<0||Ye.y>=Mt||function(He,mt,Xt,mi,Di,Pr,tr,Mi,$t,xi,Ii,Ci,qi,Sr,vi,ir,gi,bi,wi,ci,jt,nn,el,an,Jx){const tl=He.addToLineVertexArray(mt,Xt);let Ks,il,rl,nl,jm=0,Nm=0,Zm=0,Vm=0,ep=-1,tp=-1;const pa={};let Um=en("");if(He.allowVerticalPlacement&&mi.vertical){const Oi=Mi.layout.get("text-rotate").evaluate(jt,{},an)+90;rl=new wh($t,mt,xi,Ii,Ci,mi.vertical,qi,Sr,vi,Oi),tr&&(nl=new wh($t,mt,xi,Ii,Ci,tr,gi,bi,vi,Oi))}if(Di){const Oi=Mi.layout.get("icon-rotate").evaluate(jt,{}),Mr=Mi.layout.get("icon-text-fit")!=="none",Xs=zm(Di,Oi,el,Mr),on=tr?zm(tr,Oi,el,Mr):void 0;il=new wh($t,mt,xi,Ii,Ci,Di,gi,bi,!1,Oi),jm=4*Xs.length;const Ys=He.iconSizeData;let Rn=null;Ys.kind==="source"?(Rn=[An*Mi.layout.get("icon-size").evaluate(jt,{})],Rn[0]>is&&zi(`${He.layerIds[0]}: Value for "icon-size" is >= ${Ac}. Reduce your "icon-size".`)):Ys.kind==="composite"&&(Rn=[An*nn.compositeIconSizes[0].evaluate(jt,{},an),An*nn.compositeIconSizes[1].evaluate(jt,{},an)],(Rn[0]>is||Rn[1]>is)&&zi(`${He.layerIds[0]}: Value for "icon-size" is >= ${Ac}. Reduce your "icon-size".`)),He.addSymbols(He.icon,Xs,Rn,ci,wi,jt,S.ah.none,mt,tl.lineStartIndex,tl.lineLength,-1,an),ep=He.icon.placedSymbolArray.length-1,on&&(Nm=4*on.length,He.addSymbols(He.icon,on,Rn,ci,wi,jt,S.ah.vertical,mt,tl.lineStartIndex,tl.lineLength,-1,an),tp=He.icon.placedSymbolArray.length-1)}const $m=Object.keys(mi.horizontal);for(const Oi of $m){const Mr=mi.horizontal[Oi];if(!Ks){Um=en(Mr.text);const on=Mi.layout.get("text-rotate").evaluate(jt,{},an);Ks=new wh($t,mt,xi,Ii,Ci,Mr,qi,Sr,vi,on)}const Xs=Mr.positionedLines.length===1;if(Zm+=Dm(He,mt,Mr,Pr,Mi,vi,jt,ir,tl,mi.vertical?S.ah.horizontal:S.ah.horizontalOnly,Xs?$m:[Oi],pa,ep,nn,an),Xs)break}mi.vertical&&(Vm+=Dm(He,mt,mi.vertical,Pr,Mi,vi,jt,ir,tl,S.ah.vertical,["vertical"],pa,tp,nn,an));const Qx=Ks?Ks.boxStartIndex:He.collisionBoxArray.length,ev=Ks?Ks.boxEndIndex:He.collisionBoxArray.length,tv=rl?rl.boxStartIndex:He.collisionBoxArray.length,iv=rl?rl.boxEndIndex:He.collisionBoxArray.length,rv=il?il.boxStartIndex:He.collisionBoxArray.length,nv=il?il.boxEndIndex:He.collisionBoxArray.length,av=nl?nl.boxStartIndex:He.collisionBoxArray.length,sv=nl?nl.boxEndIndex:He.collisionBoxArray.length;let sn=-1;const Ph=(Oi,Mr)=>Oi&&Oi.circleDiameter?Math.max(Oi.circleDiameter,Mr):Mr;sn=Ph(Ks,sn),sn=Ph(rl,sn),sn=Ph(il,sn),sn=Ph(nl,sn);const Gm=sn>-1?1:0;Gm&&(sn*=Jx/fi),He.glyphOffsetArray.length>=Yo.MAX_GLYPHS&&zi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),jt.sortKey!==void 0&&He.addToSortKeyRanges(He.symbolInstances.length,jt.sortKey);const ov=Rm(Mi,jt,an),[lv,cv]=function(Oi,Mr){const Xs=Oi.length,on=Mr==null?void 0:Mr.values;if((on==null?void 0:on.length)>0)for(let Ys=0;Ys<on.length;Ys+=2){const Rn=on[Ys+1];Oi.emplaceBack(S.ay[on[Ys]],Rn[0],Rn[1])}return[Xs,Oi.length]}(He.textAnchorOffsets,ov);He.symbolInstances.emplaceBack(mt.x,mt.y,pa.right>=0?pa.right:-1,pa.center>=0?pa.center:-1,pa.left>=0?pa.left:-1,pa.vertical||-1,ep,tp,Um,Qx,ev,tv,iv,rv,nv,av,sv,xi,Zm,Vm,jm,Nm,Gm,0,qi,sn,lv,cv)}(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,ge,L,t,d,v,P,p)};if(ve==="line")for(const Qe of Pm(t.geometry,0,0,Mt,Mt)){const Ye=Hs(Qe,Pe),He=Gx(Ye,A,fe,n.vertical||j,a,24,re,r.overscaling,Mt);for(const mt of He)j&&Xx(r,j.text,Re,mt)||$e(Ye,mt)}else if(ve==="line-center"){for(const Qe of t.geometry)if(Qe.length>1){const Ye=Hs(Qe,Pe),He=$x(Ye,fe,n.vertical||j,a,24,re);He&&$e(Ye,He)}}else if(t.type==="Polygon")for(const Qe of zs(t.geometry,0)){const Ye=Wx(Qe,16);$e(Hs(Qe[0],Pe,!0),new ns(Ye.x,Ye.y,0))}else if(t.type==="LineString")for(const Qe of t.geometry){const Ye=Hs(Qe,Pe);$e(Ye,new ns(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 ns(Ye.x,Ye.y,0))}function Dm(r,t,n,a,l,d,p,m,y,v,P,M,k,R,L){const j=function(re,X,A,U,J,fe,Ce,ge){const ve=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=Tx+1,Qe=!0,Ye=1,He=0;const mt=(J||ge)&&De.vertical,Xt=De.metrics.advance*De.scale/2;if(ge&&X.verticalizable&&(He=Ee.lineOffset/2-(De.imageName?-(fi-De.metrics.width*De.scale)/2:(De.scale-1)*fi)),De.imageName){const bi=Ce[De.imageName];Qe=bi.sdf,Ye=bi.pixelRatio,$e=er/Ye}const mi=J?[De.x+Xt,De.y]:[0,0];let Di=J?[0,0]:[De.x+Xt+A[0],De.y+A[1]-He],Pr=[0,0];mt&&(Pr=Di,Di=[0,0]);const tr=De.metrics.isDoubleResolution?2:1,Mi=(De.metrics.left-$e)*De.scale-Xt+Di[0],$t=(-De.metrics.top-$e)*De.scale+Di[1],xi=Mi+Pe.w/tr*De.scale/Ye,Ii=$t+Pe.h/tr*De.scale/Ye,Ci=new Ve(Mi,$t),qi=new Ve(xi,$t),Sr=new Ve(Mi,Ii),vi=new Ve(xi,Ii);if(mt){const bi=new Ve(-Xt,Xt-fh),wi=-Math.PI/2,ci=fi/2-Xt,jt=new Ve(5-fh-ci,-(De.imageName?ci:0)),nn=new Ve(...Pr);Ci._rotateAround(wi,bi)._add(jt)._add(nn),qi._rotateAround(wi,bi)._add(jt)._add(nn),Sr._rotateAround(wi,bi)._add(jt)._add(nn),vi._rotateAround(wi,bi)._add(jt)._add(nn)}if(ve){const bi=Math.sin(ve),wi=Math.cos(ve),ci=[wi,-bi,bi,wi];Ci._matMult(ci),qi._matMult(ci),Sr._matMult(ci),vi._matMult(ci)}const ir=new Ve(0,0),gi=new Ve(0,0);Re.push({tl:Ci,tr:qi,bl:Sr,br:vi,tex:Pe,writingMode:X.writingMode,glyphOffset:mi,sectionIndex:De.sectionIndex,isSDF:Qe,pixelOffsetTL:ir,pixelOffsetBR:gi,minFontScaleX:0,minFontScaleY:0})}return Re}(0,n,m,l,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let H=null;$.kind==="source"?(H=[An*l.layout.get("text-size").evaluate(p,{})],H[0]>is&&zi(`${r.layerIds[0]}: Value for "text-size" is >= ${Ac}. Reduce your "text-size".`)):$.kind==="composite"&&(H=[An*R.compositeTextSizes[0].evaluate(p,{},L),An*R.compositeTextSizes[1].evaluate(p,{},L)],(H[0]>is||H[1]>is)&&zi(`${r.layerIds[0]}: Value for "text-size" is >= ${Ac}. Reduce your "text-size".`)),r.addSymbols(r.text,j,H,m,d,p,v,t,y.lineStartIndex,y.lineLength,k,L);for(const re of P)M[re]=r.text.placedSymbolArray.length-1;return 4*j.length}function Lm(r){for(const t in r)return r[t];return null}function Xx(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 Fm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Wd{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=Fm[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 Wd(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=Fm.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 Hd(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,M=y.pop()||0,k=y.pop()||0;if(M-k<=m){for(let $=k;$<=M;$++){const H=p[2*$],re=p[2*$+1];H>=t&&H<=a&&re>=n&&re<=l&&v.push(d[$])}continue}const R=k+M>>1,L=p[2*R],j=p[2*R+1];L>=t&&L<=a&&j>=n&&j<=l&&v.push(d[R]),(P===0?t<=L:n<=j)&&(y.push(k),y.push(R-1),y.push(1-P)),(P===0?a>=L:l>=j)&&(y.push(R+1),y.push(M),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,M=m.pop()||0,k=m.pop()||0;if(M-k<=p){for(let $=k;$<=M;$++)Om(d[2*$],d[2*$+1],t,n)<=v&&y.push(l[$]);continue}const R=k+M>>1,L=d[2*R],j=d[2*R+1];Om(L,j,t,n)<=v&&y.push(l[R]),(P===0?t-a<=L:n-a<=j)&&(m.push(k),m.push(R-1),m.push(1-P)),(P===0?t+a>=L:n+a>=j)&&(m.push(R+1),m.push(M),m.push(1-P))}return y}}function Hd(r,t,n,a,l,d){if(l-a<=n)return;const p=a+l>>1;Bm(r,t,p,a,l,d),Hd(r,t,n,a,p-1,1-d),Hd(r,t,n,p+1,l,1-d)}function Bm(r,t,n,a,l,d){for(;l>a;){if(l-a>600){const v=l-a+1,P=n-a+1,M=Math.log(v),k=.5*Math.exp(2*M/3),R=.5*Math.sqrt(M*k*(v-k)/v)*(P-v/2<0?-1:1);Bm(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(Lc(r,t,a,n),t[2*l+d]>p&&Lc(r,t,a,l);m<y;){for(Lc(r,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?Lc(r,t,a,y):(y++,Lc(r,t,y,l)),y<=n&&(a=y+1),n<=y&&(l=y-1)}}function Lc(r,t,n,a){Kd(r,n,a),Kd(t,2*n,2*a),Kd(t,2*n+1,2*a+1)}function Kd(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Om(r,t,n,a){const l=r-n,d=t-a;return l*l+d*d}var Xd;S.ck=void 0,(Xd=S.ck||(S.ck={})).create="create",Xd.load="load",Xd.fullLoad="fullLoad";let Th=null,Fc=[];const Yd=1e3/60,Jd="loadTime",Qd="fullLoadTime",Yx={mark(r){performance.mark(r)},frame(r){const t=r;Th!=null&&Fc.push(t-Th),Th=t},clearMetrics(){Th=null,Fc=[],performance.clearMeasures(Jd),performance.clearMeasures(Qd);for(const r in S.ck)performance.clearMarks(S.ck[r])},getPerformanceMetrics(){performance.measure(Jd,S.ck.create,S.ck.load),performance.measure(Qd,S.ck.create,S.ck.fullLoad);const r=performance.getEntriesByName(Jd)[0].duration,t=performance.getEntriesByName(Qd)[0].duration,n=Fc.length,a=1/(Fc.reduce((d,p)=>d+p,0)/n/1e3),l=Fc.filter(d=>d>Yd).reduce((d,p)=>d+(p-Yd)/Yd,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:l/(n+l)*100,totalFrames:n}}};S.$=Rc,S.A=bt,S.B=vr,S.C=Bt,S.D=Xe,S.E=V,S.F=sd,S.G=function(r){if(Qt==null){const t=r.navigator?r.navigator.userAgent:null;Qt=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Qt},S.H=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Zx(()=>this.process()),this.subscription=gr(this.target,"message",n=>this.receive(n),!1),this.globalScope=Gr(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?gr(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)},Vx):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:aa(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(Gr(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(Sn(t.error)):l.resolve(Sn(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=Sn(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?aa(t):null,data:aa(n,a)};this.target.postMessage(l,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=Dd,S.J=qr,S.K=function(){var r=new bt(16);return bt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},S.L=function(r,t,n){var a,l,d,p,m,y,v,P,M,k,R,L,j=n[0],$=n[1],H=n[2];return t===r?(r[12]=t[0]*j+t[4]*$+t[8]*H+t[12],r[13]=t[1]*j+t[5]*$+t[9]*H+t[13],r[14]=t[2]*j+t[6]*$+t[10]*H+t[14],r[15]=t[3]*j+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],M=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]=M,r[9]=k,r[10]=R,r[11]=L,r[12]=a*j+m*$+M*H+t[12],r[13]=l*j+y*$+k*H+t[13],r[14]=d*j+v*$+R*H+t[14],r[15]=p*j+P*$+L*H+t[15]),r},S.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},S.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],M=t[8],k=t[9],R=t[10],L=t[11],j=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*M+J*j,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])*M+(J=n[7])*j,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])*M+(J=n[11])*j,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])*M+(J=n[15])*j,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},S.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},S.P=Ve,S.Q=rs,S.R=wr,S.S=pm,S.T=Ns,S.U=dm,S.V=ri,S.W=At,S.X=mr,S.Y=Tr,S.Z=Mt,S._=c,S.a=xn,S.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],M=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+M*a,r[7]=y*l+k*a,r[8]=v*l-d*a,r[9]=P*l-p*a,r[10]=M*l-m*a,r[11]=k*l-y*a,r},S.a0=25,S.a1=$d,S.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const l=window.document.createElement("source");xs(a)||(t.crossOrigin="Anonymous"),l.src=a,t.appendChild(l)}})},S.a3=xe,S.a4=function(){return Vn++},S.a5=x,S.a6=Yo,S.a7=Kl,S.a8=kn,S.a9=vm,S.aA=qd,S.aB=Fd,S.aC=Wd,S.aD=ti,S.aE=hh,S.aF=Q,S.aG=ut,S.aH=Me,S.aI=function(r){return Math.pow(2,r)},S.aJ=85.051129,S.aK=fm,S.aL=ar,S.aM=_r,S.aN=mm,S.aO=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r},S.aP=function(r,t,n){return r[0]=t[0]+n[0],r[1]=t[1]+n[1],r[2]=t[2]+n[2],r},S.aQ=function(r){var t=new bt(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},S.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},S.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},S.aT=function(r,t){var n=t[0],a=t[1],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},S.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},S.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},S.aW=_m,S.aX=Jo,S.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},S.aZ=function(r){var t=new bt(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},S.a_=function(r,t,n){var a=Math.sin(n),l=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],v=t[4],P=t[5],M=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+M*a,r[3]=y*l+k*a,r[4]=v*l-d*a,r[5]=P*l-p*a,r[6]=M*l-m*a,r[7]=k*l-y*a,r},S.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},S.ab=function(r){return Math.log(r)/Math.LN2},S.ac=function(r){var t=r[0],n=r[1];return t*t+n*n},S.ad=function(r){return r*Math.PI/180},S.ae=fr,S.af=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},S.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?fr(ki.interpolationFactor(l,t,d,p),0,1):0;r.kind==="camera"?a=vr.number(r.minSize,r.maxSize,m):n=m}return{uSizeT:n,uSize:a}},S.ai=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:l}){return r.kind==="source"?a/An:r.kind==="composite"?vr.number(a/An,l/An,n):t},S.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],M=t[9],k=t[10],R=t[11],L=t[12],j=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*j-M*L,ge=P*$-k*L,ve=P*H-R*L,Re=M*$-k*j,Ee=M*H-R*j,De=k*H-R*$,Pe=re*De-X*Ee+A*Re+U*ve-J*ge+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]=(j*fe-$*J+H*U)*Pe,r[3]=(k*J-M*fe-R*U)*Pe,r[4]=(y*ve-p*De-v*ge)*Pe,r[5]=(n*De-l*ve+d*ge)*Pe,r[6]=($*A-L*fe-H*X)*Pe,r[7]=(P*fe-k*A+R*X)*Pe,r[8]=(p*Ee-m*ve+v*Ce)*Pe,r[9]=(a*ve-n*Ee-d*Ce)*Pe,r[10]=(L*J-j*A+H*re)*Pe,r[11]=(M*A-P*J-R*re)*Pe,r[12]=(m*ge-p*Re-y*Ce)*Pe,r[13]=(n*Re-a*ge+l*Ce)*Pe,r[14]=(j*X-L*U-$*re)*Pe,r[15]=(P*U-M*X+k*re)*Pe,r):null},S.ak=Ei,S.al=function(r){return Math.hypot(r[0],r[1])},S.am=function(r){return r[0]=0,r[1]=0,r},S.an=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},S.ao=Od,S.ap=$r,S.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 Ve(r.x+v*d,r.y+v*l)},S.ar=Pm,S.as=qo,S.at=jn,S.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]},S.av=fi,S.aw=ba,S.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]:ba(t,n[0],r.zoom),l?n[1]:ba(t,n[1],r.zoom)]},S.az=Bd,S.b=Gn,S.b$=r=>r.type==="symbol",S.b0=function(){const r=new Float32Array(16);return jn(r),r},S.b1=function(){const r=new Float64Array(16);return jn(r),r},S.b2=function(){return new Float64Array(16)},S.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),M=Math.sin(p),k=Math.cos(p),R=Math.sin(m),L=Math.cos(m);l[0]=v*k*L-P*M*R,l[1]=P*M*L+v*k*R,l[2]=P*k*R-v*M*L,l[3]=P*k*L+v*M*R}(a,r,t-90,n),a},S.b4=function(r,t,n,a){var l,d,p,m,y,v=t[0],P=t[1],M=t[2],k=t[3],R=n[0],L=n[1],j=n[2],$=n[3];return(d=v*R+P*L+M*j+k*$)<0&&(d=-d,R=-R,L=-L,j=-j,$=-$),1-d>ht?(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*M+y*j,r[3]=m*k+y*$,r},S.b5=function(r){const t=new Float64Array(9);var n,a,l,d,p,m,y,v,P,M,k,R,L,j,$,H,re,X;M=(l=(a=r)[0])*(y=l+l),k=(d=a[1])*y,L=(p=a[2])*y,j=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-M-$,n[7]=j-H,n[2]=L-re,n[5]=j+H,n[8]=1-M-R;const A=_r(-Math.asin(fr(t[2],-1,1)));let U,J;return Math.hypot(t[5],t[8])<.001?(U=0,J=-_r(Math.atan2(t[3],t[4]))):(U=_r(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),J=_r(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:A+90,bearing:J}},S.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},S.b7=xt,S.b8=tn,S.b9=Ko,S.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)||we(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]}):ye(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),M=p.reduce(Ne,{}),k=m.reduce(Ne,{}),R=v.slice(),L=Object.create(null);let j,$,H,re,X;for(let A=0,U=0;A<v.length;A++)j=v[A],Object.prototype.hasOwnProperty.call(k,j)?U++:(he(y,{command:"removeLayer",args:[j]}),R.splice(R.indexOf(j,U),1));for(let A=0,U=0;A<P.length;A++)j=P[P.length-1-A],R[R.length-1-A]!==j&&(Object.prototype.hasOwnProperty.call(M,j)?(he(y,{command:"removeLayer",args:[j]}),R.splice(R.lastIndexOf(j,R.length-U),1)):U++,re=R[R.length-A],he(y,{command:"addLayer",args:[k[j],re]}),R.splice(R.length-A,0,j),L[j]=!0);for(let A=0;A<P.length;A++)if(j=P[A],$=M[j],H=k[j],!L[j]&&!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,j,null,"setLayoutProperty"),Ie($.paint,H.paint,y,j,null,"setPaintProperty"),ne($.filter,H.filter)||he(y,{command:"setFilter",args:[j,H.filter]}),ne($.minzoom,H.minzoom)&&ne($.maxzoom,H.maxzoom)||he(y,{command:"setLayerZoomRange",args:[j,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,j,X.slice(6),"setPaintProperty"):ne($[X],H[X])||he(y,{command:"setLayerProperty",args:[j,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,j,X.slice(6),"setPaintProperty"):ne($[X],H[X])||he(y,{command:"setLayerProperty",args:[j,X,H[X]]}))}else he(y,{command:"removeLayer",args:[j]}),re=R[R.lastIndexOf(j)+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},S.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},S.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},S.bD=Un,S.bE=$n,S.bF=class extends Or{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},S.bG=rn,S.bH=class extends Or{constructor(r,t){super(r,t),this.current=ua}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},S.bI=Qi,S.bJ=class extends Or{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},S.bK=class extends Or{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},S.bL=Ct,S.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},S.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},S.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},S.bP=class extends pc{},S.bQ=_x,S.bR=class extends Gs{},S.bS=yd,S.bT=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},S.bU=xf,S.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},S.bW=class extends Vo{},S.bX=class extends h{},S.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]},S.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],M=r[9],k=r[10],R=r[11],L=r[12],j=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],ge=t[7],ve=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)<=ht*Math.max(1,Math.abs(n),Math.abs(re))&&Math.abs(a-X)<=ht*Math.max(1,Math.abs(a),Math.abs(X))&&Math.abs(l-A)<=ht*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(d-U)<=ht*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-J)<=ht*Math.max(1,Math.abs(p),Math.abs(J))&&Math.abs(m-fe)<=ht*Math.max(1,Math.abs(m),Math.abs(fe))&&Math.abs(y-Ce)<=ht*Math.max(1,Math.abs(y),Math.abs(Ce))&&Math.abs(v-ge)<=ht*Math.max(1,Math.abs(v),Math.abs(ge))&&Math.abs(P-ve)<=ht*Math.max(1,Math.abs(P),Math.abs(ve))&&Math.abs(M-Re)<=ht*Math.max(1,Math.abs(M),Math.abs(Re))&&Math.abs(k-Ee)<=ht*Math.max(1,Math.abs(k),Math.abs(Ee))&&Math.abs(R-De)<=ht*Math.max(1,Math.abs(R),Math.abs(De))&&Math.abs(L-Pe)<=ht*Math.max(1,Math.abs(L),Math.abs(Pe))&&Math.abs(j-$e)<=ht*Math.max(1,Math.abs(j),Math.abs($e))&&Math.abs($-Qe)<=ht*Math.max(1,Math.abs($),Math.abs(Qe))&&Math.abs(H-Ye)<=ht*Math.max(1,Math.abs(H),Math.abs(Ye))},S.b_=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.ba=Sc,S.bb=Ho,S.bc=Nn,S.bd=Zn,S.be=di,S.bf=function(r,t,n,a,l){return Nn(a,l,fr((r-t)/(n-t),0,1))},S.bg=gn,S.bh=function(){return new Float64Array(4)},S.bi=function(){return new Float64Array(3)},S.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},S.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},S.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},S.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],M=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-M*a,r[3]=y*l-k*a,r[8]=d*a+v*l,r[9]=p*a+P*l,r[10]=m*a+M*l,r[11]=y*a+k*l,r},S.bn=function(r,t){const n=gn(r,360),a=gn(t,360),l=a-n,d=a>n?l-360:l+360;return Math.abs(l)<Math.abs(d)?l:d},S.bo=function(r){return r[0]=0,r[1]=0,r[2]=0,r},S.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},S.bq=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},S.br=Vd,S.bs=function(r,t){const n=gn(r,2*Math.PI),a=gn(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},S.bt=function(r){return Math.hypot(r[0],r[1],r[2])},S.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},S.bv=nc,S.bw=Wr,S.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},S.by=function(r){if(r.type==="custom")return new Nx(r);switch(r.type){case"background":return new Bx(r);case"circle":return new Ay(r);case"fill":return new Yy(r);case"fill-extrusion":return new ax(r);case"heatmap":return new Dy(r);case"hillshade":return new Fy(r);case"line":return new px(r);case"raster":return new jx(r);case"symbol":return new yh(r)}},S.bz=Yi,S.c=Wn,S.c0=r=>r.type==="circle",S.c1=r=>r.type==="heatmap",S.c2=r=>r.type==="line",S.c3=r=>r.type==="fill",S.c4=r=>r.type==="fill-extrusion",S.c5=r=>r.type==="hillshade",S.c6=r=>r.type==="raster",S.c7=r=>r.type==="background",S.c8=r=>r.type==="custom",S.c9=wa,S.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}},S.cB=function(r,t,n,a,l){return c(this,void 0,void 0,function*(){if(At())try{return yield mr(r,t,n,a,l)}catch{}return function(d,p,m,y,v){const P=d.width,M=d.height;_n&&yn||(_n=new OffscreenCanvas(P,M),yn=_n.getContext("2d",{willReadFrequently:!0})),_n.width=P,_n.height=M,yn.drawImage(d,0,0,P,M);const k=yn.getImageData(p,m,y,v);return yn.clearRect(0,0,P,M),k.data}(r,t,n,a,l)})},S.cC=ym,S.cD=_e,S.cE=Ze,S.cF=Ff,S.cG=Hf,S.cH=zo,S.cI=Qr,S.ca=function(r,t,n){const a=gs(t.x-n.x,t.y-n.y),l=gs(r.x-n.x,r.y-n.y);var d,p;return _r(Math.atan2(a[0]*l[1]-a[1]*l[0],(d=a)[0]*(p=l)[0]+d[1]*p[1]))},S.cb=Er,S.cc=function(r,t){return Pa[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},S.cd=function(r,t){return Ta[t]&&"touches"in r},S.ce=function(r){return Ta[r]||Pa[r]},S.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},S.cg=function(r,t){const{x:n,y:a}=Rc.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},S.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},S.ci=class extends Fr{},S.cj=Yx,S.cl=function(r){return r.message===ys},S.cm=zr,S.cn=function(r,t){xn.REGISTERED_PROTOCOLS[r]=t},S.co=function(r){delete xn.REGISTERED_PROTOCOLS[r]},S.cp=function(r,t){const n={};for(let l=0;l<r.length;l++){const d=t&&t[r[l].id]||ad(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},S.cq=Ue,S.cr=xm,S.cs=bm,S.ct=Xf,S.cu=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Mt/(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 Bt(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Bt(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Bt(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:v,maxZoom:P}=r.bucket.textSizeData;l.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Bt(v),r.canonical),a["text-size"].possiblyEvaluate(new Bt(P),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:v,maxZoom:P}=r.bucket.iconSizeData;l.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Bt(v),r.canonical),a["icon-size"].possiblyEvaluate(new Bt(P),r.canonical)]}const d=n.get("text-line-height")*fi,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(","),M=y.evaluate(v,{},r.canonical),k=l.layoutTextSize.evaluate(v,{},r.canonical),R=l.layoutIconSize.evaluate(v,{},r.canonical),L={horizontal:{},vertical:void 0},j=v.text;let $,H=[0,0];if(j){const A=j.toString(),U=n.get("text-letter-spacing").evaluate(v,{},r.canonical)*fi,J=Qu(A)?U:0,fe=n.get("text-anchor").evaluate(v,{},r.canonical),Ce=Rm(t,v,r.canonical);if(!Ce){const Ee=n.get("text-radial-offset").evaluate(v,{},r.canonical);H=Ee?Am(fe,[Ee*fi,Gd]):n.get("text-offset").evaluate(v,{},r.canonical).map(De=>De*fi)}let ge=p?"center":n.get("text-justify").evaluate(v,{},r.canonical);const ve=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(v,{},r.canonical)*fi:1/0,Re=()=>{r.bucket.allowVerticalPlacement&&Oo(A)&&(L.vertical=mh(j,r.glyphMap,r.glyphPositions,r.imagePositions,P,ve,d,fe,"left",J,H,S.ah.vertical,!0,k,M))};if(!p&&Ce){const Ee=new Set;if(ge==="auto")for(let Pe=0;Pe<Ce.values.length;Pe+=2)Ee.add(qd(Ce.values[Pe]));else Ee.add(ge);let De=!1;for(const Pe of Ee)if(!L.horizontal[Pe])if(De)L.horizontal[Pe]=L.horizontal[0];else{const $e=mh(j,r.glyphMap,r.glyphPositions,r.imagePositions,P,ve,d,"center",Pe,J,H,S.ah.horizontal,!1,k,M);$e&&(L.horizontal[Pe]=$e,De=$e.positionedLines.length===1)}Re()}else{ge==="auto"&&(ge=qd(fe));const Ee=mh(j,r.glyphMap,r.glyphPositions,r.imagePositions,P,ve,d,fe,ge,J,H,S.ah.horizontal,!1,k,M);Ee&&(L.horizontal[ge]=Ee),Re(),Oo(A)&&p&&m&&(L.vertical=mh(j,r.glyphMap,r.glyphPositions,r.imagePositions,P,ve,d,fe,ge,J,H,S.ah.vertical,!1,k,M))}}let re=!1;if(v.icon&&v.icon.name){const A=r.imageMap[v.icon.name];A&&($=Ax(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&&zi("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=Lm(L.horizontal)||L.vertical;r.bucket.iconsInText=!!X&&X.iconsInText,(X||$)&&Kx(r.bucket,v,L,$,r.imageMap,l,k,R,H,re,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},S.cv=Ed,S.cw=Td,S.cx=Cd,S.cy=Ic,S.cz=Ad,S.d=xs,S.e=Ti,S.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.`)}}),S.g=Sa,S.h=r=>new Promise((t,n)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=qn})},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):qn}),S.i=Gr,S.j=(r,t)=>Ma(Ti(r,{type:"json"}),t),S.k=N,S.l=ce,S.m=Ma,S.n=(r,t)=>Ma(Ti(r,{type:"arrayBuffer"}),t),S.o=function(r){return new Ad(r).readFields(vx,[])},S.p=Kf,S.q=vc,S.r=$i,S.s=gr,S.t=ic,S.u=ft,S.v=D,S.w=zi,S.x=Ja,S.y=na,S.z=function([r,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(n),y:r*Math.sin(t)*Math.sin(n),z:r*Math.cos(n)}}}),F("worker",["./shared"],function(S){class c{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,V){for(const Y of N){this._layerConfigs[Y.id]=Y;const ae=this._layers[Y.id]=S.by(Y);ae._featureFilter=S.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=S.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 we=ne.sourceLayer||"_geojsonTileLayer";let ye=oe[we];ye||(ye=oe[we]=[]),ye.push(ae)}}}class _e{constructor(N){const V={},D=[];for(const he in N){const oe=N[he],we=V[he]={};for(const ye in oe){const ue=oe[+ye];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),we[ye]={rect:Ie,metrics:ue.metrics}}}const{w:Y,h:ae}=S.p(D),ne=new S.q({width:Y||1,height:ae||1});for(const he in N){const oe=N[he];for(const we in oe){const ye=oe[+we];if(!ye||ye.bitmap.width===0||ye.bitmap.height===0)continue;const ue=V[he][we].rect;S.q.copy(ye.bitmap,ne,{x:0,y:0},{x:ue.x+1,y:ue.y+1},ye.bitmap)}}this.image=ne,this.positions=V}}S.cq("GlyphAtlas",_e);class me{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,V,D,Y,ae){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const ne=new S.cr(Object.keys(N.layers).sort()),he=new S.cs(this.tileID,this.promoteId);he.bucketLayerIDs=[];const oe={},we={featureIndex:he,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D,subdivisionGranularity:ae},ye=V.familiesBySource[this.source];for(const Oe in ye){const st=N.layers[Oe];if(!st)continue;st.version===1&&S.w(`Vector tile source "${this.source}" layer "${Oe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qt=ne.encode(Oe),Kr=[];for(let it=0;it<st.length;it++){const hi=st.feature(it),Lt=he.getId(hi,Oe);Kr.push({feature:hi,id:Lt,index:it,sourceLayerIndex:qt})}for(const it of ye[Oe]){const hi=it[0];hi.source!==this.source&&S.w(`layer.source = ${hi.source} does not equal this.source = ${this.source}`),hi.minzoom&&this.zoom<Math.floor(hi.minzoom)||hi.maxzoom&&this.zoom>=hi.maxzoom||hi.visibility!=="none"&&(ze(it,this.zoom,D),(oe[hi.id]=hi.createBucket({index:he.bucketLayerIDs.length,layers:it,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qt,sourceID:this.source})).populate(Kr,we,this.tileID.canonical),he.bucketLayerIDs.push(it.map(Lt=>Lt.id)))}}const ue=S.bD(we.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(we.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 xe=Object.keys(we.patternDependencies);let nt=Promise.resolve({});if(xe.length){const Oe=new AbortController;this.inFlightDependencies.push(Oe),nt=Y.sendAsync({type:"GI",data:{icons:xe,source:this.source,tileID:this.tileID,type:"patterns"}},Oe)}const[Je,rt,yt]=yield Promise.all([Ie,Ne,nt]),ke=new _e(Je),qe=new S.ct(rt,yt);for(const Oe in oe){const st=oe[Oe];st instanceof S.a6?(ze(st.layers,this.zoom,D),S.cu({bucket:st,glyphMap:Je,glyphPositions:ke.positions,imageMap:rt,imagePositions:qe.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:we.subdivisionGranularity})):st.hasPattern&&(st instanceof S.cv||st instanceof S.cw||st instanceof S.cx)&&(ze(st.layers,this.zoom,D),st.addFeatures(we,this.tileID.canonical,qe.patternPositions))}return this.status="done",{buckets:Object.values(oe).filter(Oe=>!Oe.isEmpty()),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ke.image,imageAtlas:qe,glyphMap:this.returnDependencies?Je:null,iconMap:this.returnDependencies?rt:null,glyphPositions:this.returnDependencies?ke.positions:null}})}}function ze(ce,N,V){const D=new S.C(N);for(const Y of ce)Y.recalculate(D,V)}class Ze{constructor(N,V,D){this.actor=N,this.layerIndex=V,this.availableImages=D,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,V){return S._(this,void 0,void 0,function*(){const D=yield S.n(N.request,V);try{return{vectorTile:new S.cy.VectorTile(new S.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 ${N.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(N){return S._(this,void 0,void 0,function*(){const V=N.uid,D=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cA(N.request),Y=new me(N);this.loading[V]=Y;const ae=new AbortController;Y.abort=ae;try{const ne=yield this.loadVectorTile(N,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 we={};if(D){const ue=D.finish();ue&&(we.resourceTiming=JSON.parse(JSON.stringify(ue)))}Y.vectorTile=ne.vectorTile;const ye=Y.parse(ne.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[V]=Y,this.fetching[V]={rawTileData:he,cacheControl:oe,resourceTiming:we};try{const ue=yield ye;return S.e({rawTileData:he.slice(0)},ue,oe,we)}finally{delete this.fetching[V]}}catch(ne){throw delete this.loading[V],Y.status="done",this.loaded[V]=Y,ne}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const V=N.uid;if(!this.loaded||!this.loaded[V])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const D=this.loaded[V];if(D.showCollisionBoxes=N.showCollisionBoxes,D.status==="parsing"){const Y=yield D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let ae;if(this.fetching[V]){const{rawTileData:ne,cacheControl:he,resourceTiming:oe}=this.fetching[V];delete this.fetching[V],ae=S.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,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const V=this.loading,D=N.uid;V&&V[D]&&V[D].abort&&(V[D].abort.abort(),delete V[D])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ae{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:V,encoding:D,rawImageData:Y,redFactor:ae,greenFactor:ne,blueFactor:he,baseShift:oe}=N,we=Y.width+2,ye=Y.height+2,ue=S.b(Y)?new S.R({width:we,height:ye},yield S.cB(Y,-1,-1,we,ye)):Y,Ie=new S.cC(V,ue,D,ae,ne,he,oe);return this.loaded=this.loaded||{},this.loaded[V]=Ie,Ie})}removeTile(N){const V=this.loaded,D=N.uid;V&&V[D]&&delete V[D]}}var le,Ve,Nt=function(){if(Ve)return le;function ce(V,D){if(V.length!==0){N(V[0],D);for(var Y=1;Y<V.length;Y++)N(V[Y],!D)}}function N(V,D){for(var Y=0,ae=0,ne=0,he=V.length,oe=he-1;ne<he;oe=ne++){var we=(V[ne][0]-V[oe][0])*(V[oe][1]+V[ne][1]),ye=Y+we;ae+=Math.abs(Y)>=Math.abs(we)?Y-ye+we:we-ye+Y,Y=ye}Y+ae>=0!=!!D&&V.reverse()}return Ve=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}}(),Gt=S.cD(Nt);const _i=S.cy.VectorTileFeature.prototype.toGeoJSON;class si{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const V of this._feature.geometry)N.push([new S.P(V[0],V[1])]);return N}{const N=[];for(const V of this._feature.geometry){const D=[];for(const Y of V)D.push(new S.P(Y[0],Y[1]));N.push(D)}return N}}toGeoJSON(N,V,D){return _i.call(this,N,V,D)}}class ri{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new si(this._features[N])}}var At,Xi,ht,bt={exports:{}},Ct=function(){if(ht)return bt.exports;ht=1;var ce=S.cG(),N=function(){if(Xi)return At;Xi=1;var ye=S.cE(),ue=S.cF().VectorTileFeature;function Ie(Ne,xe){this.options=xe||{},this.features=Ne,this.length=Ne.length}function je(Ne,xe){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=xe||4096}return At=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 xe=0;xe<Ne.length;xe++){for(var nt=Ne[xe],Je=[],rt=0;rt<nt.length;rt++)Je.push(new ye(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,xe=1/0,nt=-1/0,Je=1/0,rt=-1/0,yt=0;yt<Ne.length;yt++)for(var ke=Ne[yt],qe=0;qe<ke.length;qe++){var Oe=ke[qe];xe=Math.min(xe,Oe.x),nt=Math.max(nt,Oe.x),Je=Math.min(Je,Oe.y),rt=Math.max(rt,Oe.y)}return[xe,Je,nt,rt]},je.prototype.toGeoJSON=ue.prototype.toGeoJSON,At}();function V(ye){var ue=new ce;return function(Ie,je){for(var Ne in Ie.layers)je.writeMessage(3,D,Ie.layers[Ne])}(ye,ue),ue.finish()}function D(ye,ue){var Ie;ue.writeVarintField(15,ye.version||1),ue.writeStringField(1,ye.name||""),ue.writeVarintField(5,ye.extent||4096);var je={keys:[],values:[],keycache:{},valuecache:{}};for(Ie=0;Ie<ye.length;Ie++)je.feature=ye.feature(Ie),ue.writeMessage(2,Y,je);var Ne=je.keys;for(Ie=0;Ie<Ne.length;Ie++)ue.writeStringField(3,Ne[Ie]);var xe=je.values;for(Ie=0;Ie<xe.length;Ie++)ue.writeMessage(4,we,xe[Ie])}function Y(ye,ue){var Ie=ye.feature;Ie.id!==void 0&&ue.writeVarintField(1,Ie.id),ue.writeMessage(2,ae,ye),ue.writeVarintField(3,Ie.type),ue.writeMessage(4,oe,Ie)}function ae(ye,ue){var Ie=ye.feature,je=ye.keys,Ne=ye.values,xe=ye.keycache,nt=ye.valuecache;for(var Je in Ie.properties){var rt=Ie.properties[Je],yt=xe[Je];if(rt!==null){yt===void 0&&(je.push(Je),xe[Je]=yt=je.length-1),ue.writeVarint(yt);var ke=typeof rt;ke!=="string"&&ke!=="boolean"&&ke!=="number"&&(rt=JSON.stringify(rt));var qe=ke+":"+rt,Oe=nt[qe];Oe===void 0&&(Ne.push(rt),nt[qe]=Oe=Ne.length-1),ue.writeVarint(Oe)}}}function ne(ye,ue){return(ue<<3)+(7&ye)}function he(ye){return ye<<1^ye>>31}function oe(ye,ue){for(var Ie=ye.loadGeometry(),je=ye.type,Ne=0,xe=0,nt=Ie.length,Je=0;Je<nt;Je++){var rt=Ie[Je],yt=1;je===1&&(yt=rt.length),ue.writeVarint(ne(1,yt));for(var ke=je===3?rt.length-1:rt.length,qe=0;qe<ke;qe++){qe===1&&je!==1&&ue.writeVarint(ne(2,ke-1));var Oe=rt[qe].x-Ne,st=rt[qe].y-xe;ue.writeVarint(he(Oe)),ue.writeVarint(he(st)),Ne+=Oe,xe+=st}je===3&&ue.writeVarint(ne(7,1))}}function we(ye,ue){var Ie=typeof ye;Ie==="string"?ue.writeStringField(1,ye):Ie==="boolean"?ue.writeBooleanField(7,ye):Ie==="number"&&(ye%1!=0?ue.writeDoubleField(3,ye):ye<0?ue.writeSVarintField(6,ye):ue.writeVarintField(5,ye))}return bt.exports=V,bt.exports.fromVectorTileJs=V,bt.exports.fromGeojsonVt=function(ye,ue){ue=ue||{};var Ie={};for(var je in ye)Ie[je]=new N(ye[je].features,ue),Ie[je].name=je,Ie[je].version=ue.version,Ie[je].extent=ue.extent;return V({layers:Ie})},bt.exports.GeoJSONWrapper=N,bt.exports}(),jn=S.cD(Ct);const Jt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ce=>ce},pr=Math.fround||($r=new Float32Array(1),ce=>($r[0]=+ce,$r[0]));var $r;const nr=3,Ei=5,gs=6;class Mt{constructor(N){this.options=Object.assign(Object.create(Jt),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:V,minZoom:D,maxZoom:Y}=this.options;V&&console.time("total time");const ae=`prepare ${N.length} points`;V&&console.time(ae),this.points=N;const ne=[];for(let oe=0;oe<N.length;oe++){const we=N[oe];if(!we.geometry)continue;const[ye,ue]=we.geometry.coordinates,Ie=pr(Nn(ye)),je=pr(Zn(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 we=+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()-we)}return V&&console.timeEnd("total time"),this}getClusters(N,V){let D=((N[0]+180)%360+360)%360-180;const Y=Math.max(-90,Math.min(90,N[1]));let ae=N[2]===180?180:((N[2]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[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(Nn(D),Zn(ne),Nn(ae),Zn(Y)),we=he.data,ye=[];for(const ue of oe){const Ie=this.stride*ue;ye.push(we[Ie+Ei]>1?ba(we,Ie,this.clusterProps):this.points[we[Ie+nr]])}return ye}getChildren(N){const V=this._getOriginId(N),D=this._getOriginZoom(N),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),we=[];for(const ye of oe){const ue=ye*this.stride;ne[ue+4]===N&&we.push(ne[ue+Ei]>1?ba(ne,ue,this.clusterProps):this.points[ne[ue+nr]])}if(we.length===0)throw new Error(Y);return we}getLeaves(N,V,D){const Y=[];return this._appendLeaves(Y,N,V=V||10,D=D||0,0),Y}getTile(N,V,D){const Y=this.trees[this._limitZoom(N)],ae=Math.pow(2,N),{extent:ne,radius:he}=this.options,oe=he/ne,we=(D-oe)/ae,ye=(D+1+oe)/ae,ue={features:[]};return this._addTileFeatures(Y.range((V-oe)/ae,we,(V+1+oe)/ae,ye),Y.data,V,D,ae,ue),V===0&&this._addTileFeatures(Y.range(1-oe/ae,we,1,ye),Y.data,ae,D,ae,ue),V===ae-1&&this._addTileFeatures(Y.range(0,we,oe/ae,ye),Y.data,-1,D,ae,ue),ue.features.length?ue:null}getClusterExpansionZoom(N){let V=this._getOriginZoom(N)-1;for(;V<=this.options.maxZoom;){const D=this.getChildren(N);if(V++,D.length!==1)break;N=D[0].properties.cluster_id}return V}_appendLeaves(N,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(N,oe.cluster_id,D,Y,ae):ae<Y?ae++:N.push(he),N.length===D)break}return ae}_createTree(N){const V=new S.aC(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let D=0;D<N.length;D+=this.stride)V.add(N[D],N[D+1]);return V.finish(),V.data=N,V}_addTileFeatures(N,V,D,Y,ae,ne){for(const he of N){const oe=he*this.stride,we=V[oe+Ei]>1;let ye,ue,Ie;if(we)ye=gn(V,oe,this.clusterProps),ue=V[oe],Ie=V[oe+1];else{const xe=this.points[V[oe+nr]];ye=xe.properties;const[nt,Je]=xe.geometry.coordinates;ue=Nn(nt),Ie=Zn(Je)}const je={type:1,geometry:[[Math.round(this.options.extent*(ue*ae-D)),Math.round(this.options.extent*(Ie*ae-Y))]],tags:ye};let Ne;Ne=we||this.options.generateId?V[oe+nr]:this.points[V[oe+nr]].id,Ne!==void 0&&(je.id=Ne),ne.features.push(je)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,V){const{radius:D,extent:Y,reduce:ae,minPoints:ne}=this.options,he=D/(Y*Math.pow(2,V)),oe=N.data,we=[],ye=this.stride;for(let ue=0;ue<oe.length;ue+=ye){if(oe[ue+2]<=V)continue;oe[ue+2]=V;const Ie=oe[ue],je=oe[ue+1],Ne=N.within(oe[ue],oe[ue+1],he),xe=oe[ue+Ei];let nt=xe;for(const Je of Ne){const rt=Je*ye;oe[rt+2]>V&&(nt+=oe[rt+Ei])}if(nt>xe&&nt>=ne){let Je,rt=Ie*xe,yt=je*xe,ke=-1;const qe=((ue/ye|0)<<5)+(V+1)+this.points.length;for(const Oe of Ne){const st=Oe*ye;if(oe[st+2]<=V)continue;oe[st+2]=V;const qt=oe[st+Ei];rt+=oe[st]*qt,yt+=oe[st+1]*qt,oe[st+4]=qe,ae&&(Je||(Je=this._map(oe,ue,!0),ke=this.clusterProps.length,this.clusterProps.push(Je)),ae(Je,this._map(oe,st)))}oe[ue+4]=qe,we.push(rt/nt,yt/nt,1/0,qe,-1,nt),ae&&we.push(ke)}else{for(let Je=0;Je<ye;Je++)we.push(oe[ue+Je]);if(nt>1)for(const Je of Ne){const rt=Je*ye;if(!(oe[rt+2]<=V)){oe[rt+2]=V;for(let yt=0;yt<ye;yt++)we.push(oe[rt+yt])}}}}return we}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,V,D){if(N[V+Ei]>1){const ne=this.clusterProps[N[V+gs]];return D?Object.assign({},ne):ne}const Y=this.points[N[V+nr]].properties,ae=this.options.map(Y);return D&&ae===Y?Object.assign({},ae):ae}}function ba(ce,N,V){return{type:"Feature",id:ce[N+nr],properties:gn(ce,N,V),geometry:{type:"Point",coordinates:[(D=ce[N],360*(D-.5)),wa(ce[N+1])]}};var D}function gn(ce,N,V){const D=ce[N+Ei],Y=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,ae=ce[N+gs],ne=ae===-1?{}:Object.assign({},V[ae]);return Object.assign(ne,{cluster:!0,cluster_id:ce[N+nr],point_count:D,point_count_abbreviated:Y})}function Nn(ce){return ce/360+.5}function Zn(ce){const N=Math.sin(ce*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function wa(ce){const N=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function Er(ce,N,V,D){let Y=D;const ae=N+(V-N>>1);let ne,he=V-N;const oe=ce[N],we=ce[N+1],ye=ce[V],ue=ce[V+1];for(let Ie=N+3;Ie<V;Ie+=3){const je=fr(ce[Ie],ce[Ie+1],oe,we,ye,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-N>3&&Er(ce,N,ne,D),ce[ne+2]=Y,V-ne>3&&Er(ce,ne,V,D))}function fr(ce,N,V,D,Y,ae){let ne=Y-V,he=ae-D;if(ne!==0||he!==0){const oe=((ce-V)*ne+(N-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=N-D,ne*ne+he*he}function ar(ce,N,V,D){const Y={id:ce??null,type:N,geometry:V,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Ti(Y,V);else if(N==="Polygon")Ti(Y,V[0]);else if(N==="MultiLineString")for(const ae of V)Ti(Y,ae);else if(N==="MultiPolygon")for(const ae of V)Ti(Y,ae[0]);return Y}function Ti(ce,N){for(let V=0;V<N.length;V+=3)ce.minX=Math.min(ce.minX,N[V]),ce.minY=Math.min(ce.minY,N[V+1]),ce.maxX=Math.max(ce.maxX,N[V]),ce.maxY=Math.max(ce.maxY,N[V+1])}function Vn(ce,N,V,D){if(!N.geometry)return;const Y=N.geometry.coordinates;if(Y&&Y.length===0)return;const ae=N.geometry.type,ne=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let he=[],oe=N.id;if(V.promoteId?oe=N.properties[V.promoteId]:V.generateId&&(oe=D||0),ae==="Point")Un(Y,he);else if(ae==="MultiPoint")for(const we of Y)Un(we,he);else if(ae==="LineString")$n(Y,he,ne,!1);else if(ae==="MultiLineString"){if(V.lineMetrics){for(const we of Y)he=[],$n(we,he,ne,!1),ce.push(ar(oe,"LineString",he,N.properties));return}Yi(Y,he,ne,!1)}else if(ae==="Polygon")Yi(Y,he,ne,!0);else{if(ae!=="MultiPolygon"){if(ae==="GeometryCollection"){for(const we of N.geometry.geometries)Vn(ce,{id:oe,geometry:we,properties:N.properties},V,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const we of Y){const ye=[];Yi(we,ye,ne,!0),he.push(ye)}}ce.push(ar(oe,ae,he,N.properties))}function Un(ce,N){N.push(_s(ce[0]),zi(ce[1]),0)}function $n(ce,N,V,D){let Y,ae,ne=0;for(let oe=0;oe<ce.length;oe++){const we=_s(ce[oe][0]),ye=zi(ce[oe][1]);N.push(we,ye,0),oe>0&&(ne+=D?(Y*ye-we*ae)/2:Math.sqrt(Math.pow(we-Y,2)+Math.pow(ye-ae,2))),Y=we,ae=ye}const he=N.length-3;N[2]=1,Er(N,0,he,V),N[he+2]=1,N.size=Math.abs(ne),N.start=0,N.end=N.size}function Yi(ce,N,V,D){for(let Y=0;Y<ce.length;Y++){const ae=[];$n(ce[Y],ae,V,D),N.push(ae)}}function _s(ce){return ce/360+.5}function zi(ce){const N=Math.sin(ce*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function ui(ce,N,V,D,Y,ae,ne,he){if(D/=N,ae>=(V/=N)&&ne<D)return ce;if(ne<V||ae>=D)return null;const oe=[];for(const we of ce){const ye=we.geometry;let ue=we.type;const Ie=Y===0?we.minX:we.minY,je=Y===0?we.maxX:we.maxY;if(Ie>=V&&je<D){oe.push(we);continue}if(je<V||Ie>=D)continue;let Ne=[];if(ue==="Point"||ue==="MultiPoint")Gr(ye,Ne,V,D,Y);else if(ue==="LineString")Qt(ye,Ne,V,D,Y,!1,he.lineMetrics);else if(ue==="MultiLineString")qn(ye,Ne,V,D,Y,!1);else if(ue==="Polygon")qn(ye,Ne,V,D,Y,!0);else if(ue==="MultiPolygon")for(const xe of ye){const nt=[];qn(xe,nt,V,D,Y,!0),nt.length&&Ne.push(nt)}if(Ne.length){if(he.lineMetrics&&ue==="LineString"){for(const xe of Ne)oe.push(ar(we.id,ue,xe,we.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(ar(we.id,ue,Ne,we.tags))}}return oe.length?oe:null}function Gr(ce,N,V,D,Y){for(let ae=0;ae<ce.length;ae+=3){const ne=ce[ae+Y];ne>=V&&ne<=D&&mr(N,ce[ae],ce[ae+1],ce[ae+2])}}function Qt(ce,N,V,D,Y,ae,ne){let he=Gn(ce);const oe=Y===0?_n:yn;let we,ye,ue=ce.start;for(let nt=0;nt<ce.length-3;nt+=3){const Je=ce[nt],rt=ce[nt+1],yt=ce[nt+2],ke=ce[nt+3],qe=ce[nt+4],Oe=Y===0?Je:rt,st=Y===0?ke:qe;let qt=!1;ne&&(we=Math.sqrt(Math.pow(Je-ke,2)+Math.pow(rt-qe,2))),Oe<V?st>V&&(ye=oe(he,Je,rt,ke,qe,V),ne&&(he.start=ue+we*ye)):Oe>D?st<D&&(ye=oe(he,Je,rt,ke,qe,D),ne&&(he.start=ue+we*ye)):mr(he,Je,rt,yt),st<V&&Oe>=V&&(ye=oe(he,Je,rt,ke,qe,V),qt=!0),st>D&&Oe<=D&&(ye=oe(he,Je,rt,ke,qe,D),qt=!0),!ae&&qt&&(ne&&(he.end=ue+we*ye),N.push(he),he=Gn(ce)),ne&&(ue+=we)}let Ie=ce.length-3;const je=ce[Ie],Ne=ce[Ie+1],xe=Y===0?je:Ne;xe>=V&&xe<=D&&mr(he,je,Ne,ce[Ie+2]),Ie=he.length-3,ae&&Ie>=3&&(he[Ie]!==he[0]||he[Ie+1]!==he[1])&&mr(he,he[0],he[1],he[2]),he.length&&N.push(he)}function Gn(ce){const N=[];return N.size=ce.size,N.start=ce.start,N.end=ce.end,N}function qn(ce,N,V,D,Y,ae){for(const ne of ce)Qt(ne,N,V,D,Y,ae,!1)}function mr(ce,N,V,D){ce.push(N,V,D)}function _n(ce,N,V,D,Y,ae){const ne=(ae-N)/(D-N);return mr(ce,ae,V+(Y-V)*ne,1),ne}function yn(ce,N,V,D,Y,ae){const ne=(ae-V)/(Y-V);return mr(ce,N+(D-N)*ne,ae,1),ne}function gr(ce,N){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=_r(Y.geometry,N);else if(ae==="MultiLineString"||ae==="Polygon"){ne=[];for(const he of Y.geometry)ne.push(_r(he,N))}else if(ae==="MultiPolygon"){ne=[];for(const he of Y.geometry){const oe=[];for(const we of he)oe.push(_r(we,N));ne.push(oe)}}V.push(ar(Y.id,ae,ne,Y.tags))}return V}function _r(ce,N){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]+N,ce[D+1],ce[D+2]);return V}function Ta(ce,N){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(Pa(ne[oe],ne[oe+1],N,V,D,Y));else for(let oe=0;oe<ne.length;oe++){const we=[];for(let ye=0;ye<ne[oe].length;ye+=2)we.push(Pa(ne[oe][ye],ne[oe][ye+1],N,V,D,Y));ae.geometry.push(we)}}return ce.transformed=!0,ce}function Pa(ce,N,V,D,Y,ae){return[Math.round(V*(ce*D-Y)),Math.round(V*(N*D-ae))]}function ys(ce,N,V,D,Y){const ae=N===Y.maxZoom?0:Y.tolerance/((1<<N)*Y.extent),ne={features:[],numPoints:0,numSimplified:0,numFeatures:ce.length,source:null,x:V,y:D,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const he of ce)Wn(ne,he,ae,Y);return ne}function Wn(ce,N,V,D){const Y=N.geometry,ae=N.type,ne=[];if(ce.minX=Math.min(ce.minX,N.minX),ce.minY=Math.min(ce.minY,N.minY),ce.maxX=Math.max(ce.maxX,N.maxX),ce.maxY=Math.max(ce.maxY,N.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")xn(ne,Y,ce,V,!1,!1);else if(ae==="MultiLineString"||ae==="Polygon")for(let he=0;he<Y.length;he++)xn(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 we=0;we<oe.length;we++)xn(ne,oe[we],ce,V,!0,we===0)}if(ne.length){let he=N.tags||null;if(ae==="LineString"&&D.lineMetrics){he={};for(const we in N.tags)he[we]=N.tags[we];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};N.id!==null&&(oe.id=N.id),ce.features.push(oe)}}function xn(ce,N,V,D,Y,ae){const ne=D*D;if(D>0&&N.size<(Y?ne:D))return void(V.numPoints+=N.length/3);const he=[];for(let oe=0;oe<N.length;oe+=3)(D===0||N[oe+2]>ne)&&(V.numSimplified++,he.push(N[oe],N[oe+1])),V.numPoints++;Y&&function(oe,we){let ye=0;for(let ue=0,Ie=oe.length,je=Ie-2;ue<Ie;je=ue,ue+=2)ye+=(oe[ue]-oe[je])*(oe[ue+1]+oe[je+1]);if(ye>0===we)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 Sa={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class qr{constructor(N,V){const D=(V=this.options=function(ae,ne){for(const he in ne)ae[he]=ne[he];return ae}(Object.create(Sa),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++)Vn(he,ae.features[oe],ne,oe);else Vn(he,ae.type==="Feature"?ae:{geometry:ae},ne);return he}(N,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 we=ui(ae,1,-1-he,he,0,-1,2,ne),ye=ui(ae,1,1-he,2+he,0,-1,2,ne);return(we||ye)&&(oe=ui(ae,1,-he,1+he,0,-1,2,ne)||[],we&&(oe=gr(we,1).concat(oe)),ye&&(oe=oe.concat(gr(ye,-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(N,V,D,Y,ae,ne,he){const oe=[N,V,D,Y],we=this.options,ye=we.debug;for(;oe.length;){Y=oe.pop(),D=oe.pop(),V=oe.pop(),N=oe.pop();const ue=1<<V,Ie=zr(V,D,Y);let je=this.tiles[Ie];if(!je&&(ye>1&&console.time("creation"),je=this.tiles[Ie]=ys(N,V,D,Y,we),this.tileCoords.push({z:V,x:D,y:Y}),ye)){ye>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 qt=`z${V}`;this.stats[qt]=(this.stats[qt]||0)+1,this.total++}if(je.source=N,ae==null){if(V===we.indexMaxZoom||je.numPoints<=we.indexMaxPoints)continue}else{if(V===we.maxZoom||V===ae)continue;if(ae!=null){const qt=ae-V;if(D!==ne>>qt||Y!==he>>qt)continue}}if(je.source=null,N.length===0)continue;ye>1&&console.time("clipping");const Ne=.5*we.buffer/we.extent,xe=.5-Ne,nt=.5+Ne,Je=1+Ne;let rt=null,yt=null,ke=null,qe=null,Oe=ui(N,ue,D-Ne,D+nt,0,je.minX,je.maxX,we),st=ui(N,ue,D+xe,D+Je,0,je.minX,je.maxX,we);N=null,Oe&&(rt=ui(Oe,ue,Y-Ne,Y+nt,1,je.minY,je.maxY,we),yt=ui(Oe,ue,Y+xe,Y+Je,1,je.minY,je.maxY,we),Oe=null),st&&(ke=ui(st,ue,Y-Ne,Y+nt,1,je.minY,je.maxY,we),qe=ui(st,ue,Y+xe,Y+Je,1,je.minY,je.maxY,we),st=null),ye>1&&console.timeEnd("clipping"),oe.push(rt||[],V+1,2*D,2*Y),oe.push(yt||[],V+1,2*D,2*Y+1),oe.push(ke||[],V+1,2*D+1,2*Y),oe.push(qe||[],V+1,2*D+1,2*Y+1)}}getTile(N,V,D){N=+N,V=+V,D=+D;const Y=this.options,{extent:ae,debug:ne}=Y;if(N<0||N>24)return null;const he=1<<N,oe=zr(N,V=V+he&he-1,D);if(this.tiles[oe])return Ta(this.tiles[oe],ae);ne>1&&console.log("drilling down to z%d-%d-%d",N,V,D);let we,ye=N,ue=V,Ie=D;for(;!we&&ye>0;)ye--,ue>>=1,Ie>>=1,we=this.tiles[zr(ye,ue,Ie)];return we&&we.source?(ne>1&&(console.log("found parent tile z%d-%d-%d",ye,ue,Ie),console.time("drilling down")),this.splitTile(we.source,ye,ue,Ie,N,V,D),ne>1&&console.timeEnd("drilling down"),this.tiles[oe]?Ta(this.tiles[oe],ae):null):null}}function zr(ce,N,V){return 32*((1<<ce)*V+N)+ce}function Wr(ce,N){return N?ce.properties[N]:ce.id}function Ma(ce,N){if(ce==null)return!0;if(ce.type==="Feature")return Wr(ce,N)!=null;if(ce.type==="FeatureCollection"){const V=new Set;for(const D of ce.features){const Y=Wr(D,N);if(Y==null||V.has(Y))return!1;V.add(Y)}return!0}return!1}function xs(ce,N){const V=new Map;if(ce!=null)if(ce.type==="Feature")V.set(Wr(ce,N),ce);else for(const D of ce.features)V.set(Wr(D,N),D);return V}class co extends Ze{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,V){return S._(this,void 0,void 0,function*(){const D=N.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=jn(ae);return ne.byteOffset===0&&ne.byteLength===ne.buffer.byteLength||(ne=new Uint8Array(ne)),{vectorTile:ae,rawData:ne.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const D=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cA(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new Mt(function({superclusterOptions:ne,clusterProperties:he}){if(!he||!ne)return ne;const oe={},we={},ye={accumulated:null,zoom:0},ue={properties:null},Ie=Object.keys(he);for(const je of Ie){const[Ne,xe]=he[je],nt=S.cH(xe),Je=S.cH(typeof Ne=="string"?[Ne,["accumulated"],["get",je]]:Ne);oe[je]=nt.value,we[je]=Je.value}return ne.map=je=>{ue.properties=je;const Ne={};for(const xe of Ie)Ne[xe]=oe[xe].evaluate(ye,ue);return Ne},ne.reduce=(je,Ne)=>{ue.properties=Ne;for(const xe of Ie)ye.accumulated=je[xe],je[xe]=we[xe].evaluate(ye,ue)},ne}(N)).load((yield this._pendingData).features):(Y=yield this._pendingData,new qr(Y,N.geojsonVtOptions)),this.loaded={};const ae={};if(D){const ne=D.finish();ne&&(ae.resourceTiming={},ae.resourceTiming[N.source]=JSON.parse(JSON.stringify(ne)))}return ae}catch(ae){if(delete this._pendingRequest,S.cl(ae))return{abandoned:!0};throw ae}var Y})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const V=this.loaded;return V&&V[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,V){return S._(this,void 0,void 0,function*(){let D=yield this.loadGeoJSON(N,V);if(delete this._pendingRequest,typeof D!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(Gt(D,!0),N.filter){const Y=S.cH(N.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(N,V){return S._(this,void 0,void 0,function*(){const{promoteId:D}=N;if(N.request){const Y=yield S.j(N.request,V);return this._dataUpdateable=Ma(Y.data,D)?xs(Y.data,D):void 0,Y.data}if(typeof N.data=="string")try{const Y=JSON.parse(N.data);return this._dataUpdateable=Ma(Y,D)?xs(Y,D):void 0,Y}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(Y,ae,ne){var he,oe,we,ye;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=Wr(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(((we=ue.removeProperties)===null||we===void 0?void 0:we.length)>0)for(const Ne of ue.removeProperties)Object.prototype.hasOwnProperty.call(Ie.properties,Ne)&&delete Ie.properties[Ne];if(((ye=ue.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0)for(const{key:Ne,value:xe}of ue.addOrUpdateProperties)Ie.properties[Ne]=xe}}(this._dataUpdateable,N.dataDiff,D),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class Hr{constructor(N){this.self=N,this.actor=new S.H(N),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=S.cn,this.self.removeProtocol=S.co,this.self.registerRTLTextPlugin=V=>{S.cI.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,D)=>this._getDEMWorkerSource(V,D.source).loadTile(D)),this.actor.registerMessageHandler("RDT",(V,D)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,D.source).removeTile(D)})),this.actor.registerMessageHandler("GCEZ",(V,D)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(V,D.type,D.source).getClusterExpansionZoom(D)})),this.actor.registerMessageHandler("GCC",(V,D)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(V,D.type,D.source).getClusterChildren(D)})),this.actor.registerMessageHandler("GCL",(V,D)=>S._(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)=>S._(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=>S._(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)=>S._(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)=>S._(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)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(V).update(D.layers,D.removedIds)})),this.actor.registerMessageHandler("SL",(V,D)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace(D)}))}_setImages(N,V){return S._(this,void 0,void 0,function*(){this.availableImages[N]=V;for(const D in this.workerSources[N]){const Y=this.workerSources[N][D];for(const ae in Y)Y[ae].availableImages=V}})}_syncRTLPluginState(N,V){return S._(this,void 0,void 0,function*(){return yield S.cI.syncState(V,this.self.importScripts)})}_getAvailableImages(N){let V=this.availableImages[N];return V||(V=[]),V}_getLayerIndex(N){let V=this.layerIndexes[N];return V||(V=this.layerIndexes[N]=new c),V}_getWorkerSource(N,V,D){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][V]||(this.workerSources[N][V]={}),!this.workerSources[N][V][D]){const Y={sendAsync:(ae,ne)=>(ae.targetMapId=N,this.actor.sendAsync(ae,ne))};switch(V){case"vector":this.workerSources[N][V][D]=new Ze(Y,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][V][D]=new co(Y,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][V][D]=new this.externalWorkerSourceTypes[V](Y,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][V][D]}_getDEMWorkerSource(N,V){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][V]||(this.demWorkerSources[N][V]=new Ae),this.demWorkerSources[N][V]}}return S.i(self)&&(self.worker=new Hr(self)),Hr}),F("index",["exports","./shared"],function(S,c){var _e="5.3.0";function me(){var u=new c.A(4);return c.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let ze,Ze;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=>(ze||(ze=document.createElement("a")),ze.href=u,ze.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ze==null&&(Ze=matchMedia("(prefers-reduced-motion: reduce)")),Ze.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 Ve={supported:!1,testSupport:function(u){!_i&&Gt&&(si?ri(u):Nt=u)}};let Nt,Gt,_i=!1,si=!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,Gt),u.isContextLost())return;Ve.supported=!0}catch{}u.deleteTexture(e),_i=!0}var At;typeof document<"u"&&(Gt=document.createElement("img"),Gt.onload=()=>{Nt&&ri(Nt),Nt=null,si=!0},Gt.onerror=()=>{_i=!0,Nt=null},Gt.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,E)=>{Ve.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:B=>{E(B)},onSuccess:B=>{z(B)}}),f()});const h=x=>c._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:w,supportImageRefresh:I,onError:z,onSuccess:E,abortController:B}=x,Z=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=Z?_(w,B):c.m(w,B);try{const W=yield q;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||c.b(W.data)?E(W):W.data&&E({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 E=new Image,B=x.url,Z=x.credentials;Z&&Z==="include"?E.crossOrigin="use-credentials":(Z&&Z==="same-origin"||!c.d(B))&&(E.crossOrigin="anonymous"),w.signal.addEventListener("abort",()=>{E.src="",z(c.c())}),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,I({data:E})},E.onerror=()=>{E.onerror=E.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."))},E.src=B})}(At||(At={})),At.resetRequestQueue();class Xi{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function ht(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 bt(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 Ct{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 jn(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class Jt 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 Ct(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`),jn(s)&&this.updateImage(i,s)}}}const pr=1e20;function $r(u,e,i,s,o,h,f,_,x){for(let w=e;w<e+s;w++)nr(u,i*h+w,h,o,f,_,x);for(let w=i;w<i+o;w++)nr(u,w*h+e,1,s,f,_,x)}function nr(u,e,i,s,o,h,f){h[0]=0,f[0]=-1e20,f[1]=pr,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]=pr}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 Ei{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 _=Ei.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 Ei.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}}}}Ei.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})},Ei.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),E=new Uint8ClampedArray(z),B={data:E,width:w,height:I,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return B;const{ctx:Z,buffer:q,gridInner:G,gridOuter:W}=this;Z.clearRect(q,q,_,x),Z.fillText(u,q,q+f);const K=Z.getImageData(q,q,_,x);W.fill(pr,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]=pr;else{const ie=.5-te;W[se]=ie>0?ie*ie:0,G[se]=ie<0?ie*ie:0}}$r(W,0,0,w,I,w,this.f,this.v,this.z),$r(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]);E[Q]=Math.round(255-255*(ee/this.radius+this.cutoff))}return B}};class gs{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 Mt;class ba extends c.E{constructor(e){super(),Mt=Mt||new c.r({anchor:new c.D(c.v.light.anchor),position:new gs,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(Mt),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 gn=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 Nn extends c.E{constructor(e){super(),this._transitionable=new c.T(gn),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 Zn{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),E=Math.min(I,z);let B;const Z=h/s*(o+1);if(x.isDash){const q=o-Math.abs(Z);B=Math.sqrt(E*E+q*q)}else B=o-Math.sqrt(E*E+Z*Z);this.data[f+w]=Math.max(0,Math.min(255,B+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 wa="maplibre_preloaded_worker_pool";class Er{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Er.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[wa]}numActive(){return Object.keys(this.active).length}}const fr=Math.floor(Ae.hardwareConcurrency/2);let ar,Ti;function Vn(){return ar||(ar=new Er),ar}Er.workerCount=c.G(globalThis)?Math.max(Math.min(fr,3),1):1;class Un{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 $n(){return Ti||(Ti=new Un(Vn(),c.J),Ti.registerMessageHandler("GR",(u,e,i)=>c.m(e,i))),Ti}function Yi(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 _s(u,e,i,s,o,h,f){var _;const x=function(E,B,Z){if(E)for(const q of E){const G=B[q];if(G&&G.source===Z&&G.type==="fill-extrusion")return!0}else for(const q in B){const G=B[q];if(G.source===Z&&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(zi);const z=[];for(const E of I)z.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(e,i,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,o,h,w,Yi(u.transform,E.tileID),f?(B,Z)=>f(E.tileID,B,Z):void 0)});return function(E,B){for(const Z in E)for(const q of E[Z])ui(q,B);return E}(function(E){const B={},Z={};for(const q of E){const G=q.queryResults,W=q.wrappedTileID,K=Z[W]=Z[W]||{};for(const Q in G){const ee=G[Q],te=K[Q]=K[Q]||{},se=B[Q]=B[Q]||[];for(const ie of ee)te[ie.featureIndex]||(te[ie.featureIndex]=!0,se.push(ie))}}return B}(z),u)}function zi(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 ui(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 Gr(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 Qt{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 Qt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Qt.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 Qt?e:e&&new Qt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,o=s/Math.cos(Math.PI/180*e.lat);return new Qt(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 Qt(e,e.lng>i.lng?new c.Q(i.lng+360,i.lat):i)}}class Gn{constructor(e,i,s){this.bounds=Qt.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 qn 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 Gr(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 Gn(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 mr 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 Gr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(c.e(this,i),i.bounds&&(this.tileBounds=new Gn(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 At.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 Ct(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 _n extends mr{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 At.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 yn 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 Qt,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 gr 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 At.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 E of o)h=Math.min(h,E.x),f=Math.min(f,E.y),_=Math.max(_,E.x),x=Math.max(x,E.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 Ct(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),E=Math.floor(h*x);f[_]={minTileX:w,minTileY:I,maxTileX:z,maxTileY:E}}return f}}class _r extends gr{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 Ct(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 Ta extends gr{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 Ct(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 Pa={},ys=u=>{switch(u){case"geojson":return yn;case"image":return gr;case"raster":return mr;case"raster-dem":return _n;case"vector":return qn;case"video":return _r;case"canvas":return Ta}return Pa[u]},Wn="RTLPluginLoaded";class xn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$n()}_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(Wn))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Sa=null;function qr(){return Sa||(Sa=new xn),Sa}class zr{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,qr().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 Ct(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ct(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 E=0;E<f.length;E++){const B=f.feature(E);if(_.needGeometry){const G=c.a8(B,!0);if(!_.filter(new c.C(this.tileID.overscaledZ),G,this.tileID.canonical))continue}else if(!_.filter(new c.C(this.tileID.overscaledZ),B))continue;const Z=s.getId(B,h),q=new c.a9(B,x,w,I,Z);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 Wr{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 Ma{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 xs(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 co(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 Hr(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=Hr(u,e),w=e.minzoom||0,I=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,z=Math.min(Math.max(0,x),I),E=Math.pow(2,z),B=[E*o.x,E*o.y,0],Z=[E*h.x,E*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},Te=f.getTileAABB(de,te.wrap,u.elevation,e);if(!pe){const Le=xs(i,Te,s);if(Le===0)continue;pe=Le===2}const Se=f.distanceToTile2d(o.x,o.y,de,Te);let be=x;_&&(be=(e.calculateTileZoom||co)(u.zoom+c.ab(u.tileSize/e.tileSize),Se,G,W,u.fov)),be=(e.roundZoom?Math.round:Math.floor)(be),be=Math.max(0,be);const Be=Math.min(be,I);if(te.wrap=f.getWrap(h,de,te.wrap),te.zoom>=Be){if(te.zoom<w)continue;const Le=z-te.zoom,Me=B[0]-.5-(se<<Le),We=B[1]-.5-(ie<<Le),lt=e.reparseOverscaled?Math.max(te.zoom,be):te.zoom;ee.push({tileID:new c.Y(te.zoom===I?lt:te.zoom,te.wrap,te.zoom,se,ie),distanceSq:c.ac([Z[0]-.5-se,Z[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 N 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(ys(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 Wr(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ma,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 E=e[z],B=this._tiles[z];if(!B||B.fadeEndTime!==0&&B.fadeEndTime<=I)continue;const Z=this.findLoadedParent(E,i),q=this.findLoadedSibling(E),G=Z||q||null;G&&(this._addTile(G.tileID),_[G.tileID.key]=G.tileID),x[z]=E}this._retainLoadedChildren(x,o,s,e);for(const z in _)e[z]||(this._coveredTiles[z]=!0,e[z]=_[z]);if(f){const z={},E={};for(const B of h)this._tiles[B.key].hasData()?z[B.key]=B:E[B.key]=B;for(const B in E){const Z=E[B].children(this._source.maxzoom);this._tiles[Z[0].key]&&this._tiles[Z[1].key]&&this._tiles[Z[2].key]&&this._tiles[Z[3].key]&&(z[Z[0].key]=e[Z[0].key]=Z[0],z[Z[1].key]=e[Z[1].key]=Z[1],z[Z[2].key]=e[Z[2].key]=Z[2],z[Z[3].key]=e[Z[3].key]=Z[3],delete E[B])}for(const B in E){const Z=E[B],q=this.findLoadedParent(Z,this._source.minzoom),G=this.findLoadedSibling(Z),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 B in this._tiles)z[B]||(this._coveredTiles[B]=!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=Hr(e,this._source),h=Math.max(o-N.maxOverzooming,this._source.minzoom),f=Math.max(o+N.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const I={};for(const z of s)if(z.canonical.z>this._source.minzoom){const E=z.scaledTo(z.canonical.z-1);I[E.key]=E;const B=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));I[B.key]=B}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-N.maxOverzooming,this._source.minzoom),_=Math.max(i+N.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 E=w.children(this._source.maxzoom)[0],B=this.getTile(E);if(B&&B.hasData()){o[E.key]=E;continue}}else{const E=w.children(this._source.maxzoom);if(o[E[0].key]&&o[E[1].key]&&o[E[2].key]&&o[E[3].key])continue}let z=I.wasRequested();for(let E=w.overscaledZ-1;E>=f;--E){const B=w.scaledTo(E);if(h[B.key])break;if(h[B.key]=!0,I=this.getTile(B),!I&&z&&(I=this._addTile(B)),I){const Z=I.hasData();if((Z||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||z)&&(o[B.key]=B),z=I.wasRequested(),Z)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 zr(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(Z=>h.screenPointToMercatorCoordinate(Z,this.terrain)),x=f.map(Z=>h.screenPointToMercatorCoordinate(Z,this.terrain)),w=this.getIds();let I=1/0,z=1/0,E=-1/0,B=-1/0;for(const Z of x)I=Math.min(I,Z.x),z=Math.min(z,Z.y),E=Math.max(E,Z.x),B=Math.max(B,Z.y);for(let Z=0;Z<w.length;Z++){const q=this._tiles[w[Z]];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.$(E,B))];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"}N.maxOverzooming=10,N.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],E=this.circles[3*w+2];x.push({key:this.circleKeys[w],x1:I-E,y1:z-E,x2:I+E,y2:z+E})}}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}=_,E=this.boxCells[h];if(E!==null){const Z=this.bboxes;for(const q of E)if(!w.box[q]){w.box[q]=!0;const G=4*q,W=this.boxKeys[q];if(e<=Z[G+2]&&i<=Z[G+3]&&s>=Z[G+0]&&o>=Z[G+1]&&(!x||x(W))&&(!I||!ae(z,W.overlapMode))&&(f.push({key:W,x1:Z[G],y1:Z[G+1],x2:Z[G+2],y2:Z[G+3]}),I))return!0}}const B=this.circleCells[h];if(B!==null){const Z=this.circles;for(const q of B)if(!w.circle[q]){w.circle[q]=!0;const G=3*q,W=this.circleKeys[q];if(this._circleAndRectCollide(Z[G],Z[G+1],Z[G+2],e,i,s,o)&&(!x||x(W))&&(!I||!ae(z,W.overlapMode))){const K=Z[G],Q=Z[G+1],ee=Z[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}=_,E=this.boxCells[h];if(E!==null){const Z=this.bboxes;for(const q of E)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,Z[G+0],Z[G+1],Z[G+2],Z[G+3])&&(!x||x(W))&&!ae(z,W.overlapMode))return f.push(!0),!0}}const B=this.circleCells[h];if(B!==null){const Z=this.circles;for(const q of B)if(!I.circle[q]){I.circle[q]=!0;const G=3*q,W=this.circleKeys[q];if(this._circlesCollide(Z[G],Z[G+1],Z[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),E=this._convertToYCellCoord(o);for(let B=w;B<=z;B++)for(let Z=I;Z<=E;Z++)if(h.call(this,e,i,s,o,this.xCellCount*Z+B,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 E=w-x,B=z-I;return E*E+B*B<=s*s}}function he(u,e,i){const s=c.K();if(!u){const{vecSouth:z,vecEast:E}=we(e),B=me();B[0]=E[0],B[1]=E[1],B[2]=z[0],B[3]=z[1],o=B,(I=(f=(h=B)[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]=B[0],s[1]=B[1],s[4]=B[2],s[5]=B[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}=we(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 we(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 ye(u,e,i,s){let o;s?(o=[u,e,s(u,e),1],c.ap(o,o,i)):(o=[u,e,0,1],hi(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,E){const B=i?u.textSizeData:u.iconSizeData,Z=c.ag(B,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:E,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 Te=ue(e.transform.cameraToCenterDistance,de.signedDistanceFromCamera),Se=c.ai(B,Z,se),be=h?Se*e.transform.getPitchedTextCorrection(se.anchorX,se.anchorY,x)/Te:Se*Te,Be=nt({projectionContext:pe,pitchedLabelPlaneMatrixInverse:o,symbol:se,fontSize:be,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:be,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),E=e.getoffsetX(x-1),B=qt(u*z,i,s,o,h.segment,w,I,_,f);if(!B)return null;const Z=qt(u*E,i,s,o,h.segment,w,I,_,f);return Z?_.projectionCache.anyProjectionOccluded?null:{first:B,last:Z}:null}function xe(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,E=s.lineOffsetX*z,B=s.lineOffsetY*z;let Z;if(s.numGlyphs>1){const q=s.glyphStartIndex+s.numGlyphs,G=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=Ne(z,_,E,B,h,s,I,e);if(!K)return{notEnoughRoom:!0};const Q=ke(K.first.point.x,K.first.point.y,e,i),ee=ke(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const te=xe(s.writingMode,Q,ee,w);if(te)return te}Z=[K.first];for(let te=s.glyphStartIndex+1;te<q-1;te++)Z.push(qt(z*_.getoffsetX(te),E,B,h,s.segment,G,W,e,I));Z.push(K.last)}else{if(f&&!h){const G=yt(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=yt(K.x,K.y,e),ee=Q.signedDistanceFromCamera>0?Q.point:Je(e.tileAnchorPoint,K,G,1,e),te=ke(G.x,G.y,e,i),se=ke(ee.x,ee.y,e,i),ie=xe(s.writingMode,te,se,w);if(ie)return ie}const q=qt(z*_.getoffsetX(s.glyphStartIndex),E,B,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,I);if(!q||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};Z=[q]}for(const q of Z)c.ao(x,q.point,q.angle);return{}}function Je(u,e,i,s,o){const h=u.add(u.sub(e)._unit()),f=yt(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=yt(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 yt(u,e,i){const s=u+i.translation[0],o=e+i.translation[1];let h;return i.pitchWithMap?(h=ye(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 ke(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),E=i.add(z),B=I.add(z);return _.projectionCache.offsets[u]=c.aq(h,w,E,B)||w,_.projectionCache.offsets[u]}function qt(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 E,B=I>0?h+o:h+o+1;_.projectionCache.cachedAnchorPoint?E=_.projectionCache.cachedAnchorPoint:(E=yt(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=E);let Z,q,G=E,W=E,K=0,Q=0;const ee=Math.abs(w),te=[];let se;for(;K+Q<=ee;){if(B+=I,B<h||B>=f)return null;K+=Q,W=G,q=Z;const de={absOffsetX:ee,direction:I,distanceFromAnchor:K,previousVertex:W};if(G=rt(B,_,de),i===0)te.push(W),se=G.sub(W);else{let Te;const Se=G.sub(W);Te=Se.mag()===0?Oe(rt(B+I,_,de).sub(G),i,I):Oe(Se,i,I),q||(q=W.add(Te)),Z=st(B,Te,G,h,f,q,i,_,de),te.push(q),se=Z.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 Kr=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(Kr,3*s)}}function hi(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 Lt=100;class uo{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+Lt,this.screenBottomBoundary=e.height+Lt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,o,h,f,_,x,w,I,z,E){const B=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,I,E),Z=s*B.perspectiveRatio;let q;if(f||_)q=this._projectCollisionBox(e,Z,o,h,f,_,x,B,I,z,E);else{const se=B.x+(z?z.x*Z:0),ie=B.y+(z?z.y*Z:0);q={allPointsOccluded:!1,box:[se+e.x1*Z,ie+e.y1*Z,se+e.x2*Z,ie+e.y2*Z]}}const[G,W,K,Q]=q.box,ee=f?q.allPointsOccluded:B.isOccluded;let te=ee;return te||(te=B.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,E,B,Z){const q=[],G=new c.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(G.x,G.y,f,Z),K=(w?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/c.av,Q={getElevation:Z,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:B},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+E,de=new c.P(-100,-100),Te=new c.P(this.screenRightBoundary,this.screenBottomBoundary),Se=new Y,be=ee.first,Be=ee.last;let Le=[];for(let lt=be.path.length-1;lt>=1;lt--)Le.push(be.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(Pt=>Pt.signedDistanceFromCamera<=0)?[]:lt.map(Pt=>Pt.point)}let We=[];if(Le.length>0){const lt=Le[0].clone(),Pt=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),Pt.x=Math.max(Pt.x,Le[ut].x),Pt.y=Math.max(Pt.y,Le[ut].y);We=lt.x>=de.x&&Pt.x<=Te.x&&lt.y>=de.y&&Pt.y<=Te.y?[Le]:Pt.x<de.x||lt.x>Te.x||Pt.y<de.y||lt.y>Te.y?[]:c.ar([Le],de.x,de.y,Te.x,Te.y)}for(const lt of We){Se.reset(lt,.25*pe);let Pt=0;Pt=Se.length<=.5*pe?1:Math.ceil(Se.paddedLength/Me)+1;for(let ut=0;ut<Pt;ut++){const Et=ut/Math.max(Pt-1,1),Dt=Se.lerp(Et),Ot=Dt.x+Lt,It=Dt.y+Lt;q.push(Ot,It,pe,0);const zt=Ot-pe,ni=It-pe,pi=Ot+pe,yi=It+pe;if(ie=ie&&this.isOffscreen(zt,ni,pi,yi),se=se||this.isInsideGrid(zt,ni,pi,yi),e!=="always"&&this.grid.hitTestCircle(Ot,It,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=ye(_.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+Lt,I.y+Lt);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 E=[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,E)&&(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],hi(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+Lt,y:(-f[1]/_+1)/2*this.transform.height+Lt,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+Lt,y:(1-f.point.y)/2*this.transform.height+Lt,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<Lt||e>=this.screenRightBoundary||o<Lt||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 E=1,B=0,Z=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),Pt=Math.cos(We);E=Pt,B=lt,Z=-lt,q=Pt}else if(!f&&h){const Le=we(this.transform);E=Le.vecEast[0],B=Le.vecEast[1],Z=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+=E*I.x*ee+Z*I.y*ee,Q+=B*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,Te=(pe+de)/2,Se=[{offsetX:te,offsetY:pe},{offsetX:ie,offsetY:pe},{offsetX:se,offsetY:pe},{offsetX:se,offsetY:Te},{offsetX:se,offsetY:de},{offsetX:ie,offsetY:de},{offsetX:te,offsetY:de},{offsetX:te,offsetY:Te}];let be=[];for(const{offsetX:Le,offsetY:Me}of Se)be.push(new c.P(K+E*Le+Z*Me,Q+B*Le+q*Me));let Be=!1;if(h){const Le=be.map(Me=>this.projectAndGetPerspectiveRatio(Me.x,Me.y,o,w,z));Be=Le.some(Me=>!Me.isOccluded),be=Le.map(Me=>new c.P(Me.x,Me.y))}else Be=!0;return{box:c.au(be),allPointsOccluded:!Be}}}class Ia{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 vn{constructor(e,i,s,o,h){this.text=new Ia(e?e.text:null,i,s,h),this.icon=new Ia(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 Ut{constructor(e,i,s,o,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=o,this.tileID=h}}class Uh{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 Ca(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 Ml{constructor(e,i,s,o,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new uo(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Uh(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,E=s.tileID.toUnwrapped(),B=x.get("text-rotation-alignment")==="map",Z=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(B,this.transform,Z);this.retainedQueryData[h.bucketInstanceId]=new Ut(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:x,translationText:q,translationIcon:G,unwrappedTileID:E,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,E,B,Z,q,G,W,K,Q,ee){const te=c.ay[e.textAnchor],se=[e.textOffset0,e.textOffset1],ie=Ca(te,s,o,se,h),pe=this.collisionIndex.placeCollisionBox(i,E,x,w,I,_,f,G,z.predicate,Q,ie,ee);if((!K||this.collisionIndex.placeCollisionBox(K,E,x,w,I,_,f,W,z.predicate,Q,ie,ee).placeable)&&pe.placeable){let de;if(this.prevPlacement&&this.prevPlacement.variableOffsets[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID].text&&(de=this.prevPlacement.variableOffsets[B.crossTileID].anchor),B.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[B.crossTileID]={textOffset:se,width:s,height:o,anchor:te,textBoxScale:h,prevAnchor:de},this.markUsedJustification(Z,te,B,q),Z.allowVerticalPlacement&&(this.markUsedOrientation(Z,q,B),this.placedOrientations[B.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:E,partiallyEvaluatedTextSize:B,collisionGroup:Z}=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),Te=ee&&(K||!o.hasTextData()||q);!o.collisionArrays&&E&&o.deserializeCollisionBoxes(E);const Se=this.retainedQueryData[o.bucketInstanceId].tileID,be=this._getTerrainElevationFunc(Se),Be=this.transform.getFastPathSimpleProjectionMatrix(Se),Le=(Me,We,lt)=>{var Pt,ut;if(i[Me.crossTileID])return;if(z)return void(this.placements[Me.crossTileID]=new Ni(!1,!1,!1));let Et=!1,Dt=!1,Ot=!0,It=null,zt={box:null,placeable:!1,offscreen:null,occluded:!1},ni={placeable:!1},pi=null,yi=null,Gi=null,en=0,Br=0,Mn=0;We.textFeatureIndex?en=We.textFeatureIndex:Me.useRuntimeCollisionCircles&&(en=Me.featureIndex),We.verticalTextFeatureIndex&&(Br=We.verticalTextFeatureIndex);const In=We.textBox;if(In){const Qi=Ht=>{let Kt=c.ah.horizontal;if(o.allowVerticalPlacement&&!Ht&&this.prevPlacement){const li=this.prevPlacement.placedOrientations[Me.crossTileID];li&&(this.placedOrientations[Me.crossTileID]=li,Kt=li,this.markUsedOrientation(o,Kt,Me))}return Kt},rn=(Ht,Kt)=>{if(o.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&We.verticalTextBox){for(const li of o.writingModes)if(li===c.ah.vertical?(zt=Kt(),ni=zt):zt=Ht(),zt&&zt.placeable)break}else zt=Ht()},ua=Me.textAnchorOffsetStartIndex,ha=Me.textAnchorOffsetEndIndex;if(ha===ua){const Ht=(Kt,li)=>{const Rt=this.collisionIndex.placeCollisionBox(Kt,W,I,Se,x,se,te,f,Z.predicate,be,void 0,Be);return Rt&&Rt.placeable&&(this.markUsedOrientation(o,li,Me),this.placedOrientations[Me.crossTileID]=li),Rt};rn(()=>Ht(In,c.ah.horizontal),()=>{const Kt=We.verticalTextBox;return o.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&Kt?Ht(Kt,c.ah.vertical):{box:null,offscreen:null}}),Qi(zt&&zt.placeable)}else{let Ht=c.ay[(ut=(Pt=this.prevPlacement)===null||Pt===void 0?void 0:Pt.variableOffsets[Me.crossTileID])===null||ut===void 0?void 0:ut.anchor];const Kt=(Rt,Cn,ah)=>{const da=Rt.x2-Rt.x1,pd=Rt.y2-Rt.y1,sh=Me.textBoxScale,gc=ie&&Q==="never"?Cn:null;let En=null,zn=W==="never"?1:2,kn="never";Ht&&zn++;for(let _c=0;_c<zn;_c++){for(let yc=ua;yc<ha;yc++){const Go=o.textAnchorOffsets.get(yc);if(Ht&&Go.textAnchor!==Ht)continue;const qo=this.attemptAnchorPlacement(Go,Rt,da,pd,sh,te,se,I,Se,x,Z,kn,Me,o,ah,f,_,gc,be);if(qo&&(En=qo.placedGlyphBoxes,En&&En.placeable))return Et=!0,It=qo.shift,En}Ht?Ht=null:kn=W}return s&&!En&&(En={box:this.collisionIndex.placeCollisionBox(In,"always",I,Se,x,se,te,f,Z.predicate,be,void 0,Be).box,offscreen:!1,placeable:!1,occluded:!1}),En};rn(()=>Kt(In,We.iconBox,c.ah.horizontal),()=>{const Rt=We.verticalTextBox;return o.allowVerticalPlacement&&(!zt||!zt.placeable)&&Me.numVerticalGlyphVertices>0&&Rt?Kt(Rt,We.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),zt&&(Et=zt.placeable,Ot=zt.offscreen);const li=Qi(zt&&zt.placeable);if(!Et&&this.prevPlacement){const Rt=this.prevPlacement.variableOffsets[Me.crossTileID];Rt&&(this.variableOffsets[Me.crossTileID]=Rt,this.markUsedJustification(o,Rt.anchor,Me,li))}}}if(pi=zt,Et=pi&&pi.placeable,Ot=pi&&pi.offscreen,Me.useRuntimeCollisionCircles){const Qi=o.text.placedSymbolArray.get(Me.centerJustifiedTextSymbolIndex),rn=c.ai(o.textSizeData,B,Qi),ua=h.get("text-padding");yi=this.collisionIndex.placeCollisionCircles(W,Qi,o.lineVertexArray,o.glyphOffsetArray,rn,x,w,s,se,Z.predicate,Me.collisionCircleDiameter,ua,f,be),yi.circles.length&&yi.collisionDetected&&!s&&c.w("Collisions detected, but collision boxes are not shown"),Et=K||yi.circles.length>0&&!yi.collisionDetected,Ot=Ot&&yi.offscreen}if(We.iconFeatureIndex&&(Mn=We.iconFeatureIndex),We.iconBox){const Qi=rn=>this.collisionIndex.placeCollisionBox(rn,Q,I,Se,x,se,te,_,Z.predicate,be,ie&&It?It:void 0,Be);ni&&ni.placeable&&We.verticalIconBox?(Gi=Qi(We.verticalIconBox),Dt=Gi.placeable):(Gi=Qi(We.iconBox),Dt=Gi.placeable),Ot=Ot&&Gi.offscreen}const ca=q||Me.numHorizontalGlyphVertices===0&&Me.numVerticalGlyphVertices===0,Or=G||Me.numIconVertices===0;ca||Or?Or?ca||(Dt=Dt&&Et):Et=Dt&&Et:Dt=Et=Dt&&Et;const tn=Dt&&Gi.placeable;if(Et&&pi.placeable&&this.collisionIndex.insertCollisionBox(pi.box,W,h.get("text-ignore-placement"),o.bucketInstanceId,ni&&ni.placeable&&Br?Br:en,Z.ID),tn&&this.collisionIndex.insertCollisionBox(Gi.box,Q,h.get("icon-ignore-placement"),o.bucketInstanceId,Mn,Z.ID),yi&&Et&&this.collisionIndex.insertCollisionCircles(yi.circles,W,h.get("text-ignore-placement"),o.bucketInstanceId,en,Z.ID),s&&this.storeCollisionData(o.bucketInstanceId,lt,We,pi,Gi,yi),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((Et||de)&&!(pi!=null&&pi.occluded),(Dt||Te)&&!(Gi!=null&&Gi.occluded),Ot||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]-Lt),_.push(f.circles[x+1]-Lt),_.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 vn(I,o,w.text,w.icon),s=s||w.text!==I.text.placed||w.icon!==I.icon.placed):(this.opacities[x]=new vn(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 vn(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 vn(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",E=f.get("text-pitch-alignment")==="map",B=f.get("icon-text-fit")!=="none",Z=new vn(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!==vs},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=Z,this.opacities[te]=se),s[te]=!0;const ie=K.numIconVertices>0,pe=this.placedOrientations[K.crossTileID],de=pe===c.ah.vertical,Te=pe===c.ah.horizontal||pe===c.ah.horizontalOnly;if(Q>0||ee>0){const be=du(se.text);q(e.text,Q,de?vs:be),q(e.text,ee,Te?vs:be);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||Te?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 be=du(se.icon),Be=!(B&&K.verticalPlacedIconSymbolIndex&&de);K.placedIconSymbolIndex>=0&&(q(e.icon,K.numIconVertices,Be?be:vs),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=se.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(q(e.icon,K.numVerticalIconVertices,Be?vs:be),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 be=e.collisionArrays[W];if(be){let Be=new c.P(0,0);if(be.textBox||be.verticalTextBox){let Le=!0;if(I){const Me=this.variableOffsets[te];Me?(Be=Ca(Me.anchor,Me.width,Me.height,Me.textOffset,Me.textBoxScale),z&&Be._rotate(E?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Le=!1}if(be.textBox||be.verticalTextBox){let Me;be.textBox&&(Me=de),be.verticalTextBox&&(Me=Te),bn(e.textCollisionBox.collisionVertexArray,se.text.placed,!Le||Me,Se.text,Be.x,Be.y)}}if(be.iconBox||be.verticalIconBox){const Le=!!(!Te&&be.verticalIconBox);let Me;be.iconBox&&(Me=Le),be.verticalIconBox&&(Me=!Le),bn(e.iconCollisionBox.collisionVertexArray,se.icon.placed,Me,Se.icon,B?Be.x:0,B?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 bn(u,e,i,s,o,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-Lt,_=s[1]-Lt,x=s[2]-Lt,w=s[3]-Lt;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 Ea=Math.pow(2,25),lu=Math.pow(2,24),cu=Math.pow(2,17),uu=Math.pow(2,16),za=Math.pow(2,9),hu=Math.pow(2,8),$h=Math.pow(2,1);function du(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*Ea+e*lu+i*cu+e*uu+i*za+e*hu+i*$h+e}const vs=0;class pu{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 fu{constructor(e,i,s,o,h,f,_,x){this.placement=new Ml(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 pu(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 Hn=512/c.Z/2;class Il{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*Hn),y:Math.floor(x.anchorY*Hn)})),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=Hn/Math.pow(2,x-h),I=(_*c.Z+e.anchorY)*w,z=o*c.Z*Hn;return{x:Math.floor((f*c.Z+e.anchorX)*w-s*c.Z*Hn),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 mu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Cl{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 Il(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 ho{constructor(){this.layerIndexes={},this.crossTileIDs=new mu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new Cl);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 bs="void main() {fragColor=vec4(1.0);}";const yr={prelude:pt(`#ifdef GL_ES
7
+ precision mediump float;
8
+ #else
9
+ #if !defined(lowp)
10
+ #define lowp
11
+ #endif
12
+ #if !defined(mediump)
13
+ #define mediump
14
+ #endif
15
+ #if !defined(highp)
16
+ #define highp
17
+ #endif
18
+ #endif
19
+ out highp vec4 fragColor;`,`#ifdef GL_ES
20
+ precision highp float;
21
+ #else
22
+ #if !defined(lowp)
23
+ #define lowp
24
+ #endif
25
+ #if !defined(mediump)
26
+ #define mediump
27
+ #endif
28
+ #if !defined(highp)
29
+ #define highp
30
+ #endif
31
+ #endif
32
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
33
+ );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
34
+ );}
35
+ #ifdef TERRAIN3D
36
+ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
37
+ #endif
38
+ const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
39
+ #ifdef TERRAIN3D
40
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
41
+ #else
42
+ return 1.0;
43
+ #endif
44
+ }float calculate_visibility(vec4 pos) {
45
+ #ifdef TERRAIN3D
46
+ vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
47
+ #else
48
+ return 1.0;
49
+ #endif
50
+ }float ele(vec2 pos) {
51
+ #ifdef TERRAIN3D
52
+ vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
53
+ #else
54
+ return 0.0;
55
+ #endif
56
+ }float get_elevation(vec2 pos) {
57
+ #ifdef TERRAIN3D
58
+ #ifdef GLOBE
59
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
60
+ #endif
61
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
62
+ #else
63
+ return 0.0;
64
+ #endif
65
+ }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:pt("","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:pt("",`#define GLOBE_RADIUS 6371008.8
66
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
67
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
68
+ if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
69
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:pt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
70
+ #ifdef OVERDRAW_INSPECTOR
71
+ fragColor=vec4(1.0);
72
+ #endif
73
+ }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:pt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
74
+ #ifdef OVERDRAW_INSPECTOR
75
+ fragColor=vec4(1.0);
76
+ #endif
77
+ }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:pt(`in vec3 v_data;in float v_visibility;
78
+ #pragma mapbox: define highp vec4 color
79
+ #pragma mapbox: define mediump float radius
80
+ #pragma mapbox: define lowp float blur
81
+ #pragma mapbox: define lowp float opacity
82
+ #pragma mapbox: define highp vec4 stroke_color
83
+ #pragma mapbox: define mediump float stroke_width
84
+ #pragma mapbox: define lowp float stroke_opacity
85
+ void main() {
86
+ #pragma mapbox: initialize highp vec4 color
87
+ #pragma mapbox: initialize mediump float radius
88
+ #pragma mapbox: initialize lowp float blur
89
+ #pragma mapbox: initialize lowp float opacity
90
+ #pragma mapbox: initialize highp vec4 stroke_color
91
+ #pragma mapbox: initialize mediump float stroke_width
92
+ #pragma mapbox: initialize lowp float stroke_opacity
93
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
94
+ #ifdef OVERDRAW_INSPECTOR
95
+ fragColor=vec4(1.0);
96
+ #endif
97
+ }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
98
+ #pragma mapbox: define highp vec4 color
99
+ #pragma mapbox: define mediump float radius
100
+ #pragma mapbox: define lowp float blur
101
+ #pragma mapbox: define lowp float opacity
102
+ #pragma mapbox: define highp vec4 stroke_color
103
+ #pragma mapbox: define mediump float stroke_width
104
+ #pragma mapbox: define lowp float stroke_opacity
105
+ void main(void) {
106
+ #pragma mapbox: initialize highp vec4 color
107
+ #pragma mapbox: initialize mediump float radius
108
+ #pragma mapbox: initialize lowp float blur
109
+ #pragma mapbox: initialize lowp float opacity
110
+ #pragma mapbox: initialize highp vec4 stroke_color
111
+ #pragma mapbox: initialize mediump float stroke_width
112
+ #pragma mapbox: initialize lowp float stroke_opacity
113
+ vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
114
+ #ifdef GLOBE
115
+ vec3 center_vector=projectToSphere(circle_center);
116
+ #endif
117
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
118
+ #ifdef GLOBE
119
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
120
+ #else
121
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
122
+ #endif
123
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
124
+ #ifdef GLOBE
125
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
126
+ #else
127
+ gl_Position=projectTileWithElevation(corner_position,ele);
128
+ #endif
129
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:pt(bs,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:pt(`uniform highp float u_intensity;in vec2 v_extrude;
130
+ #pragma mapbox: define highp float weight
131
+ #define GAUSS_COEF 0.3989422804014327
132
+ void main() {
133
+ #pragma mapbox: initialize highp float weight
134
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
135
+ #ifdef OVERDRAW_INSPECTOR
136
+ fragColor=vec4(1.0);
137
+ #endif
138
+ }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
139
+ #pragma mapbox: define highp float weight
140
+ #pragma mapbox: define mediump float radius
141
+ const highp float ZERO=1.0/255.0/16.0;
142
+ #define GAUSS_COEF 0.3989422804014327
143
+ void main(void) {
144
+ #pragma mapbox: initialize highp float weight
145
+ #pragma mapbox: initialize mediump float radius
146
+ vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
147
+ #ifdef GLOBE
148
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
149
+ #else
150
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
151
+ #endif
152
+ }`),heatmapTexture:pt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
153
+ #ifdef OVERDRAW_INSPECTOR
154
+ fragColor=vec4(0.0);
155
+ #endif
156
+ }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:pt("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:pt("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:pt("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:pt(bs,`in vec2 a_pos;void main() {
157
+ #ifdef GLOBE
158
+ gl_Position=projectTileFor3D(a_pos,0.0);
159
+ #else
160
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
161
+ #endif
162
+ }`),fill:pt(`#pragma mapbox: define highp vec4 color
163
+ #pragma mapbox: define lowp float opacity
164
+ void main() {
165
+ #pragma mapbox: initialize highp vec4 color
166
+ #pragma mapbox: initialize lowp float opacity
167
+ fragColor=color*opacity;
168
+ #ifdef OVERDRAW_INSPECTOR
169
+ fragColor=vec4(1.0);
170
+ #endif
171
+ }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
172
+ #pragma mapbox: define highp vec4 color
173
+ #pragma mapbox: define lowp float opacity
174
+ void main() {
175
+ #pragma mapbox: initialize highp vec4 color
176
+ #pragma mapbox: initialize lowp float opacity
177
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:pt(`in vec2 v_pos;
178
+ #ifdef GLOBE
179
+ in float v_depth;
180
+ #endif
181
+ #pragma mapbox: define highp vec4 outline_color
182
+ #pragma mapbox: define lowp float opacity
183
+ void main() {
184
+ #pragma mapbox: initialize highp vec4 outline_color
185
+ #pragma mapbox: initialize lowp float opacity
186
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
187
+ #ifdef GLOBE
188
+ if (v_depth > 1.0) {discard;}
189
+ #endif
190
+ #ifdef OVERDRAW_INSPECTOR
191
+ fragColor=vec4(1.0);
192
+ #endif
193
+ }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
194
+ #ifdef GLOBE
195
+ out float v_depth;
196
+ #endif
197
+ #pragma mapbox: define highp vec4 outline_color
198
+ #pragma mapbox: define lowp float opacity
199
+ void main() {
200
+ #pragma mapbox: initialize highp vec4 outline_color
201
+ #pragma mapbox: initialize lowp float opacity
202
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
203
+ #ifdef GLOBE
204
+ v_depth=gl_Position.z/gl_Position.w;
205
+ #endif
206
+ }`),fillOutlinePattern:pt(`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;
207
+ #ifdef GLOBE
208
+ in float v_depth;
209
+ #endif
210
+ #pragma mapbox: define lowp float opacity
211
+ #pragma mapbox: define lowp vec4 pattern_from
212
+ #pragma mapbox: define lowp vec4 pattern_to
213
+ void main() {
214
+ #pragma mapbox: initialize lowp float opacity
215
+ #pragma mapbox: initialize mediump vec4 pattern_from
216
+ #pragma mapbox: initialize mediump vec4 pattern_to
217
+ 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;
218
+ #ifdef GLOBE
219
+ if (v_depth > 1.0) {discard;}
220
+ #endif
221
+ #ifdef OVERDRAW_INSPECTOR
222
+ fragColor=vec4(1.0);
223
+ #endif
224
+ }`,`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;
225
+ #ifdef GLOBE
226
+ out float v_depth;
227
+ #endif
228
+ #pragma mapbox: define lowp float opacity
229
+ #pragma mapbox: define lowp vec4 pattern_from
230
+ #pragma mapbox: define lowp vec4 pattern_to
231
+ #pragma mapbox: define lowp float pixel_ratio_from
232
+ #pragma mapbox: define lowp float pixel_ratio_to
233
+ void main() {
234
+ #pragma mapbox: initialize lowp float opacity
235
+ #pragma mapbox: initialize mediump vec4 pattern_from
236
+ #pragma mapbox: initialize mediump vec4 pattern_to
237
+ #pragma mapbox: initialize lowp float pixel_ratio_from
238
+ #pragma mapbox: initialize lowp float pixel_ratio_to
239
+ 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;
240
+ #ifdef GLOBE
241
+ v_depth=gl_Position.z/gl_Position.w;
242
+ #endif
243
+ }`),fillPattern:pt(`#ifdef GL_ES
244
+ precision highp float;
245
+ #endif
246
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
247
+ #pragma mapbox: define lowp float opacity
248
+ #pragma mapbox: define lowp vec4 pattern_from
249
+ #pragma mapbox: define lowp vec4 pattern_to
250
+ void main() {
251
+ #pragma mapbox: initialize lowp float opacity
252
+ #pragma mapbox: initialize mediump vec4 pattern_from
253
+ #pragma mapbox: initialize mediump vec4 pattern_to
254
+ 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;
255
+ #ifdef OVERDRAW_INSPECTOR
256
+ fragColor=vec4(1.0);
257
+ #endif
258
+ }`,`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;
259
+ #pragma mapbox: define lowp float opacity
260
+ #pragma mapbox: define lowp vec4 pattern_from
261
+ #pragma mapbox: define lowp vec4 pattern_to
262
+ #pragma mapbox: define lowp float pixel_ratio_from
263
+ #pragma mapbox: define lowp float pixel_ratio_to
264
+ void main() {
265
+ #pragma mapbox: initialize lowp float opacity
266
+ #pragma mapbox: initialize mediump vec4 pattern_from
267
+ #pragma mapbox: initialize mediump vec4 pattern_to
268
+ #pragma mapbox: initialize lowp float pixel_ratio_from
269
+ #pragma mapbox: initialize lowp float pixel_ratio_to
270
+ 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:pt(`in vec4 v_color;void main() {fragColor=v_color;
271
+ #ifdef OVERDRAW_INSPECTOR
272
+ fragColor=vec4(1.0);
273
+ #endif
274
+ }`,`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;
275
+ #ifdef TERRAIN3D
276
+ in vec2 a_centroid;
277
+ #endif
278
+ out vec4 v_color;
279
+ #pragma mapbox: define highp float base
280
+ #pragma mapbox: define highp float height
281
+ #pragma mapbox: define highp vec4 color
282
+ void main() {
283
+ #pragma mapbox: initialize highp float base
284
+ #pragma mapbox: initialize highp float height
285
+ #pragma mapbox: initialize highp vec4 color
286
+ vec3 normal=a_normal_ed.xyz;
287
+ #ifdef TERRAIN3D
288
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
289
+ #else
290
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
291
+ #endif
292
+ 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;
293
+ #ifdef GLOBE
294
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
295
+ #else
296
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
297
+ #endif
298
+ 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);
299
+ #ifdef GLOBE
300
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
301
+ #endif
302
+ 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:pt(`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;
303
+ #pragma mapbox: define lowp float base
304
+ #pragma mapbox: define lowp float height
305
+ #pragma mapbox: define lowp vec4 pattern_from
306
+ #pragma mapbox: define lowp vec4 pattern_to
307
+ #pragma mapbox: define lowp float pixel_ratio_from
308
+ #pragma mapbox: define lowp float pixel_ratio_to
309
+ void main() {
310
+ #pragma mapbox: initialize lowp float base
311
+ #pragma mapbox: initialize lowp float height
312
+ #pragma mapbox: initialize mediump vec4 pattern_from
313
+ #pragma mapbox: initialize mediump vec4 pattern_to
314
+ #pragma mapbox: initialize lowp float pixel_ratio_from
315
+ #pragma mapbox: initialize lowp float pixel_ratio_to
316
+ 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;
317
+ #ifdef OVERDRAW_INSPECTOR
318
+ fragColor=vec4(1.0);
319
+ #endif
320
+ }`,`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;
321
+ #ifdef TERRAIN3D
322
+ in vec2 a_centroid;
323
+ #endif
324
+ #ifdef GLOBE
325
+ out vec3 v_sphere_pos;
326
+ #endif
327
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
328
+ #pragma mapbox: define lowp float base
329
+ #pragma mapbox: define lowp float height
330
+ #pragma mapbox: define lowp vec4 pattern_from
331
+ #pragma mapbox: define lowp vec4 pattern_to
332
+ #pragma mapbox: define lowp float pixel_ratio_from
333
+ #pragma mapbox: define lowp float pixel_ratio_to
334
+ void main() {
335
+ #pragma mapbox: initialize lowp float base
336
+ #pragma mapbox: initialize lowp float height
337
+ #pragma mapbox: initialize mediump vec4 pattern_from
338
+ #pragma mapbox: initialize mediump vec4 pattern_to
339
+ #pragma mapbox: initialize lowp float pixel_ratio_from
340
+ #pragma mapbox: initialize lowp float pixel_ratio_to
341
+ 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;
342
+ #ifdef TERRAIN3D
343
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
344
+ #else
345
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
346
+ #endif
347
+ 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;
348
+ #ifdef GLOBE
349
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
350
+ #else
351
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
352
+ #endif
353
+ vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
354
+ ? a_pos
355
+ : 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:pt(`#ifdef GL_ES
356
+ precision highp float;
357
+ #endif
358
+ 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);
359
+ #ifdef OVERDRAW_INSPECTOR
360
+ fragColor=vec4(1.0);
361
+ #endif
362
+ }`,"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:pt(`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;
363
+ #define PI 3.141592653589793
364
+ 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;
365
+ #ifdef OVERDRAW_INSPECTOR
366
+ fragColor=vec4(1.0);
367
+ #endif
368
+ }`,"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:pt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
369
+ #ifdef GLOBE
370
+ in float v_depth;
371
+ #endif
372
+ #pragma mapbox: define highp vec4 color
373
+ #pragma mapbox: define lowp float blur
374
+ #pragma mapbox: define lowp float opacity
375
+ void main() {
376
+ #pragma mapbox: initialize highp vec4 color
377
+ #pragma mapbox: initialize lowp float blur
378
+ #pragma mapbox: initialize lowp float opacity
379
+ 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);
380
+ #ifdef GLOBE
381
+ if (v_depth > 1.0) {discard;}
382
+ #endif
383
+ #ifdef OVERDRAW_INSPECTOR
384
+ fragColor=vec4(1.0);
385
+ #endif
386
+ }`,`
387
+ #define scale 0.015873016
388
+ 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;
389
+ #ifdef GLOBE
390
+ out float v_depth;
391
+ #endif
392
+ #pragma mapbox: define highp vec4 color
393
+ #pragma mapbox: define lowp float blur
394
+ #pragma mapbox: define lowp float opacity
395
+ #pragma mapbox: define mediump float gapwidth
396
+ #pragma mapbox: define lowp float offset
397
+ #pragma mapbox: define mediump float width
398
+ void main() {
399
+ #pragma mapbox: initialize highp vec4 color
400
+ #pragma mapbox: initialize lowp float blur
401
+ #pragma mapbox: initialize lowp float opacity
402
+ #pragma mapbox: initialize mediump float gapwidth
403
+ #pragma mapbox: initialize lowp float offset
404
+ #pragma mapbox: initialize mediump float width
405
+ 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;
406
+ #ifdef GLOBE
407
+ v_depth=gl_Position.z/gl_Position.w;
408
+ #endif
409
+ #ifdef TERRAIN3D
410
+ v_gamma_scale=1.0;
411
+ #else
412
+ 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;
413
+ #endif
414
+ v_width2=vec2(outset,inset);}`),lineGradient:pt(`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;
415
+ #ifdef GLOBE
416
+ in float v_depth;
417
+ #endif
418
+ #pragma mapbox: define lowp float blur
419
+ #pragma mapbox: define lowp float opacity
420
+ void main() {
421
+ #pragma mapbox: initialize lowp float blur
422
+ #pragma mapbox: initialize lowp float opacity
423
+ 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);
424
+ #ifdef GLOBE
425
+ if (v_depth > 1.0) {discard;}
426
+ #endif
427
+ #ifdef OVERDRAW_INSPECTOR
428
+ fragColor=vec4(1.0);
429
+ #endif
430
+ }`,`
431
+ #define scale 0.015873016
432
+ 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;
433
+ #ifdef GLOBE
434
+ out float v_depth;
435
+ #endif
436
+ #pragma mapbox: define lowp float blur
437
+ #pragma mapbox: define lowp float opacity
438
+ #pragma mapbox: define mediump float gapwidth
439
+ #pragma mapbox: define lowp float offset
440
+ #pragma mapbox: define mediump float width
441
+ void main() {
442
+ #pragma mapbox: initialize lowp float blur
443
+ #pragma mapbox: initialize lowp float opacity
444
+ #pragma mapbox: initialize mediump float gapwidth
445
+ #pragma mapbox: initialize lowp float offset
446
+ #pragma mapbox: initialize mediump float width
447
+ 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;
448
+ #ifdef GLOBE
449
+ v_depth=gl_Position.z/gl_Position.w;
450
+ #endif
451
+ #ifdef TERRAIN3D
452
+ v_gamma_scale=1.0;
453
+ #else
454
+ 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;
455
+ #endif
456
+ v_width2=vec2(outset,inset);}`),linePattern:pt(`#ifdef GL_ES
457
+ precision highp float;
458
+ #endif
459
+ 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;
460
+ #ifdef GLOBE
461
+ in float v_depth;
462
+ #endif
463
+ #pragma mapbox: define lowp vec4 pattern_from
464
+ #pragma mapbox: define lowp vec4 pattern_to
465
+ #pragma mapbox: define lowp float pixel_ratio_from
466
+ #pragma mapbox: define lowp float pixel_ratio_to
467
+ #pragma mapbox: define lowp float blur
468
+ #pragma mapbox: define lowp float opacity
469
+ void main() {
470
+ #pragma mapbox: initialize mediump vec4 pattern_from
471
+ #pragma mapbox: initialize mediump vec4 pattern_to
472
+ #pragma mapbox: initialize lowp float pixel_ratio_from
473
+ #pragma mapbox: initialize lowp float pixel_ratio_to
474
+ #pragma mapbox: initialize lowp float blur
475
+ #pragma mapbox: initialize lowp float opacity
476
+ 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;
477
+ #ifdef GLOBE
478
+ if (v_depth > 1.0) {discard;}
479
+ #endif
480
+ #ifdef OVERDRAW_INSPECTOR
481
+ fragColor=vec4(1.0);
482
+ #endif
483
+ }`,`
484
+ #define scale 0.015873016
485
+ #define LINE_DISTANCE_SCALE 2.0
486
+ 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;
487
+ #ifdef GLOBE
488
+ out float v_depth;
489
+ #endif
490
+ #pragma mapbox: define lowp float blur
491
+ #pragma mapbox: define lowp float opacity
492
+ #pragma mapbox: define lowp float offset
493
+ #pragma mapbox: define mediump float gapwidth
494
+ #pragma mapbox: define mediump float width
495
+ #pragma mapbox: define lowp float floorwidth
496
+ #pragma mapbox: define lowp vec4 pattern_from
497
+ #pragma mapbox: define lowp vec4 pattern_to
498
+ #pragma mapbox: define lowp float pixel_ratio_from
499
+ #pragma mapbox: define lowp float pixel_ratio_to
500
+ void main() {
501
+ #pragma mapbox: initialize lowp float blur
502
+ #pragma mapbox: initialize lowp float opacity
503
+ #pragma mapbox: initialize lowp float offset
504
+ #pragma mapbox: initialize mediump float gapwidth
505
+ #pragma mapbox: initialize mediump float width
506
+ #pragma mapbox: initialize lowp float floorwidth
507
+ #pragma mapbox: initialize mediump vec4 pattern_from
508
+ #pragma mapbox: initialize mediump vec4 pattern_to
509
+ #pragma mapbox: initialize lowp float pixel_ratio_from
510
+ #pragma mapbox: initialize lowp float pixel_ratio_to
511
+ 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;
512
+ #ifdef GLOBE
513
+ v_depth=gl_Position.z/gl_Position.w;
514
+ #endif
515
+ #ifdef TERRAIN3D
516
+ v_gamma_scale=1.0;
517
+ #else
518
+ 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;
519
+ #endif
520
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:pt(`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;
521
+ #ifdef GLOBE
522
+ in float v_depth;
523
+ #endif
524
+ #pragma mapbox: define highp vec4 color
525
+ #pragma mapbox: define lowp float blur
526
+ #pragma mapbox: define lowp float opacity
527
+ #pragma mapbox: define mediump float width
528
+ #pragma mapbox: define lowp float floorwidth
529
+ void main() {
530
+ #pragma mapbox: initialize highp vec4 color
531
+ #pragma mapbox: initialize lowp float blur
532
+ #pragma mapbox: initialize lowp float opacity
533
+ #pragma mapbox: initialize mediump float width
534
+ #pragma mapbox: initialize lowp float floorwidth
535
+ 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);
536
+ #ifdef GLOBE
537
+ if (v_depth > 1.0) {discard;}
538
+ #endif
539
+ #ifdef OVERDRAW_INSPECTOR
540
+ fragColor=vec4(1.0);
541
+ #endif
542
+ }`,`
543
+ #define scale 0.015873016
544
+ #define LINE_DISTANCE_SCALE 2.0
545
+ 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;
546
+ #ifdef GLOBE
547
+ out float v_depth;
548
+ #endif
549
+ #pragma mapbox: define highp vec4 color
550
+ #pragma mapbox: define lowp float blur
551
+ #pragma mapbox: define lowp float opacity
552
+ #pragma mapbox: define mediump float gapwidth
553
+ #pragma mapbox: define lowp float offset
554
+ #pragma mapbox: define mediump float width
555
+ #pragma mapbox: define lowp float floorwidth
556
+ void main() {
557
+ #pragma mapbox: initialize highp vec4 color
558
+ #pragma mapbox: initialize lowp float blur
559
+ #pragma mapbox: initialize lowp float opacity
560
+ #pragma mapbox: initialize mediump float gapwidth
561
+ #pragma mapbox: initialize lowp float offset
562
+ #pragma mapbox: initialize mediump float width
563
+ #pragma mapbox: initialize lowp float floorwidth
564
+ 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;
565
+ #ifdef GLOBE
566
+ v_depth=gl_Position.z/gl_Position.w;
567
+ #endif
568
+ #ifdef TERRAIN3D
569
+ v_gamma_scale=1.0;
570
+ #else
571
+ 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;
572
+ #endif
573
+ 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:pt(`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);
574
+ #ifdef OVERDRAW_INSPECTOR
575
+ fragColor=vec4(1.0);
576
+ #endif
577
+ }`,`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;
578
+ #ifdef GLOBE
579
+ if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
580
+ #endif
581
+ v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:pt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
582
+ #pragma mapbox: define lowp float opacity
583
+ void main() {
584
+ #pragma mapbox: initialize lowp float opacity
585
+ lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
586
+ #ifdef OVERDRAW_INSPECTOR
587
+ fragColor=vec4(1.0);
588
+ #endif
589
+ }`,`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;
590
+ #pragma mapbox: define lowp float opacity
591
+ void main() {
592
+ #pragma mapbox: initialize lowp float opacity
593
+ 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 ?
594
+ camera_to_anchor_distance/u_camera_to_center_distance :
595
+ 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;
596
+ #ifdef GLOBE
597
+ 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);}
598
+ #endif
599
+ 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:pt(`#define SDF_PX 8.0
600
+ 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;
601
+ #pragma mapbox: define highp vec4 fill_color
602
+ #pragma mapbox: define highp vec4 halo_color
603
+ #pragma mapbox: define lowp float opacity
604
+ #pragma mapbox: define lowp float halo_width
605
+ #pragma mapbox: define lowp float halo_blur
606
+ void main() {
607
+ #pragma mapbox: initialize highp vec4 fill_color
608
+ #pragma mapbox: initialize highp vec4 halo_color
609
+ #pragma mapbox: initialize lowp float opacity
610
+ #pragma mapbox: initialize lowp float halo_width
611
+ #pragma mapbox: initialize lowp float halo_blur
612
+ 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);
613
+ #ifdef OVERDRAW_INSPECTOR
614
+ fragColor=vec4(1.0);
615
+ #endif
616
+ }`,`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;
617
+ #pragma mapbox: define highp vec4 fill_color
618
+ #pragma mapbox: define highp vec4 halo_color
619
+ #pragma mapbox: define lowp float opacity
620
+ #pragma mapbox: define lowp float halo_width
621
+ #pragma mapbox: define lowp float halo_blur
622
+ void main() {
623
+ #pragma mapbox: initialize highp vec4 fill_color
624
+ #pragma mapbox: initialize highp vec4 halo_color
625
+ #pragma mapbox: initialize lowp float opacity
626
+ #pragma mapbox: initialize lowp float halo_width
627
+ #pragma mapbox: initialize lowp float halo_blur
628
+ 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 ?
629
+ camera_to_anchor_distance/u_camera_to_center_distance :
630
+ 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;
631
+ #ifdef GLOBE
632
+ 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);}
633
+ #endif
634
+ 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:pt(`#define SDF_PX 8.0
635
+ #define SDF 1.0
636
+ #define ICON 0.0
637
+ 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;
638
+ #pragma mapbox: define highp vec4 fill_color
639
+ #pragma mapbox: define highp vec4 halo_color
640
+ #pragma mapbox: define lowp float opacity
641
+ #pragma mapbox: define lowp float halo_width
642
+ #pragma mapbox: define lowp float halo_blur
643
+ void main() {
644
+ #pragma mapbox: initialize highp vec4 fill_color
645
+ #pragma mapbox: initialize highp vec4 halo_color
646
+ #pragma mapbox: initialize lowp float opacity
647
+ #pragma mapbox: initialize lowp float halo_width
648
+ #pragma mapbox: initialize lowp float halo_blur
649
+ 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;
650
+ #ifdef OVERDRAW_INSPECTOR
651
+ fragColor=vec4(1.0);
652
+ #endif
653
+ 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);
654
+ #ifdef OVERDRAW_INSPECTOR
655
+ fragColor=vec4(1.0);
656
+ #endif
657
+ }`,`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;
658
+ #pragma mapbox: define highp vec4 fill_color
659
+ #pragma mapbox: define highp vec4 halo_color
660
+ #pragma mapbox: define lowp float opacity
661
+ #pragma mapbox: define lowp float halo_width
662
+ #pragma mapbox: define lowp float halo_blur
663
+ void main() {
664
+ #pragma mapbox: initialize highp vec4 fill_color
665
+ #pragma mapbox: initialize highp vec4 halo_color
666
+ #pragma mapbox: initialize lowp float opacity
667
+ #pragma mapbox: initialize lowp float halo_width
668
+ #pragma mapbox: initialize lowp float halo_blur
669
+ 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 ?
670
+ camera_to_anchor_distance/u_camera_to_center_distance :
671
+ 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;
672
+ #ifdef GLOBE
673
+ 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);}
674
+ #endif
675
+ 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:pt("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:pt("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:pt("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:pt("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:pt(`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
676
+ );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:pt("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 pt(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,E)=>(_[E]=!0,w==="define"?`
677
+ #ifndef HAS_UNIFORM_u_${E}
678
+ in ${I} ${z} ${E};
679
+ #else
680
+ uniform ${I} ${z} u_${E};
681
+ #endif
682
+ `:`
683
+ #ifdef HAS_UNIFORM_u_${E}
684
+ ${I} ${z} ${E} = u_${E};
685
+ #endif
686
+ `)),vertexSource:e=e.replace(i,(x,w,I,z,E)=>{const B=z==="float"?"vec2":"vec4",Z=E.match(/color/)?"color":B;return _[E]?w==="define"?`
687
+ #ifndef HAS_UNIFORM_u_${E}
688
+ uniform lowp float u_${E}_t;
689
+ in ${I} ${B} a_${E};
690
+ out ${I} ${z} ${E};
691
+ #else
692
+ uniform ${I} ${z} u_${E};
693
+ #endif
694
+ `:Z==="vec4"?`
695
+ #ifndef HAS_UNIFORM_u_${E}
696
+ ${E} = a_${E};
697
+ #else
698
+ ${I} ${z} ${E} = u_${E};
699
+ #endif
700
+ `:`
701
+ #ifndef HAS_UNIFORM_u_${E}
702
+ ${E} = unpack_mix_${Z}(a_${E}, u_${E}_t);
703
+ #else
704
+ ${I} ${z} ${E} = u_${E};
705
+ #endif
706
+ `:w==="define"?`
707
+ #ifndef HAS_UNIFORM_u_${E}
708
+ uniform lowp float u_${E}_t;
709
+ in ${I} ${B} a_${E};
710
+ #else
711
+ uniform ${I} ${z} u_${E};
712
+ #endif
713
+ `:Z==="vec4"?`
714
+ #ifndef HAS_UNIFORM_u_${E}
715
+ ${I} ${z} ${E} = a_${E};
716
+ #else
717
+ ${I} ${z} ${E} = u_${E};
718
+ #endif
719
+ `:`
720
+ #ifndef HAS_UNIFORM_u_${E}
721
+ ${I} ${z} ${E} = unpack_mix_${Z}(a_${E}, u_${E}_t);
722
+ #else
723
+ ${I} ${z} ${E} = u_${E};
724
+ #endif
725
+ `}),staticAttributes:s,staticUniforms:f}}class Kn{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 wn=c.aD([{name:"a_pos",type:"Int16",components:2}]);const Xr="#define PROJECTION_MERCATOR",ka="mercator";class xt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return ka}get shaderDefine(){return Xr}get shaderPreludeCode(){return yr.projectionMercator}get vertexShaderPreludeCode(){return yr.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,wn.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 Kn(_,I,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}function sr(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 ws(u,e){return new c.$(e.x/u,e.y/u).toLngLat()}function Aa(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(c.ad(90-u.pitch)),Math.tan(c.ad(89.25-u.pitch)))}function Li(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 Pi(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 Zt{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 Zt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function po(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 Fi(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=Fi(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 Zt,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=Fi(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 Zt(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=me(),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 Qt([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 E=this.elevation;const B=i-E;let Z;x*B>=0||Math.abs(x)<.1?(Z=1e4,E=i+Z*x):Z=-B/x;let q,G,W=c.aN(1,_.y),K=0;do{if(K+=1,K>10)break;G=Z/W,q=new c.$(_.x+I*G,_.y+z*G),W=1/q.meterInMercatorCoordinateUnits()}while(Math.abs(Z-G*W)>1e-12);return{center:q.toLngLat(),elevation:E,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=Pi(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 Pi(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 di{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 di(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 gu{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 di([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 Tn{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]]),E=c.aT([],c.aU([],I,z)),B=-c.aV(E,h[w[1]]);return E.concat(B)}),_=[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 Tn(h,f,new di(_,x))}}class Vt{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 gu}clone(){const e=new Vt;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 Tn.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]/_,E=I===z?0:(s-I)/(z-I);return new c.$(c.B.number(o[0]/f,h[0]/_,E)/this.worldSize,c.B.number(x,w,E)/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-Aa(this));return new Qt().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-Aa(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 _=Li(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=Li(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:E,y:B}=this.size;if(this._helper._latRange){const Q=this._helper._latRange;f=c.S(Q[1])*h,_=c.S(Q[0])*h,_-f<B&&(I=B/(_-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<E&&(z=E/(w-x)));const{x:Z,y:q}=sr(h,e);let G,W;const K=Math.max(z||0,I||0);if(K){const Q=new c.P(z?(w+x)/2:Z,I?(_+f)/2:q);return s.center=ws(h,Q).wrap(),s.zoom+=c.ab(K),s}if(this._helper._latRange){const Q=B/2;q-Q<f&&(W=f+Q),q+Q>_&&(W=_-Q)}if(o){const Q=(x+w)/2;let ee=Z;this._helper._renderWorldCopies&&(ee=c.aL(Z,Q-h/2,Q+h/2));const te=E/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??Z,W??q);s.center=ws(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=Aa(this),z=Math.atan(I/this._helper.cameraToCenterDistance),E=c.ad(.75),B=z>E?2*z*(.5+s.y/(2*I)):E,Z=Math.sin(B)*f/Math.sin(c.ae(Math.PI-_-B,.01,Math.PI-.01)),q=Math.min(w,Z);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=sr(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),E=Math.sin(-this.bearingInRadians),B=s-Math.round(s)+z*w+E*I,Z=o-Math.round(o)+z*I+E*w,q=new Float64Array(_);if(c.L(q,q,[B>.5?B-1:B,Z>.5?Z-1:Z,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 Pi(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],hi(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=Li(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 Ra(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Pn(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 Ts(u,e,i,s,o){const h=o.padding,f=sr(o.worldSize,i.getNorthWest()),_=sr(o.worldSize,i.getNorthEast()),x=sr(o.worldSize,i.getSouthEast()),w=sr(o.worldSize,i.getSouthWest()),I=c.ad(-s),z=f.rotate(I),E=_.rotate(I),B=x.rotate(I),Z=w.rotate(I),q=new c.P(Math.max(z.x,E.x,Z.x,B.x),Math.max(z.y,E.y,Z.y,B.y)),G=new c.P(Math.min(z.x,E.x,Z.x,B.x),Math.min(z.y,E.y,Z.y,B.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 Ra();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:ws(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 Ts(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 E=e.screenPointToLocation(z),{center:B,zoom:Z}=e.getConstrained(c.Q.convert(i.center||E),I??s);po(e,B);const q=sr(e.worldSize,E),G=sr(e.worldSize,B).sub(q),W=c.aI(Z-s);return w=Z!==s,{easeFunc:K=>{if(w&&e.setZoom(c.B.number(s,Z,K)),c.b6(h,f)||Pn({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=Z>s?Math.min(2,W):Math.max(.5,W),te=Math.pow(ee,1-K),se=ws(e.worldSize,q.add(G.mult(K*te)).mult(Q));e.setLocationAtPoint(e.renderWorldCopies?se.wrap():se,z)}},isZooming:w,elevationCenter:B}}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;po(e,f);const x=sr(e.worldSize,i.locationAtOffset),w=sr(e.worldSize,f).sub(x),I=w.mag(),z=c.aI(_-o);let E;if(i.minZoom!==void 0){const B=Math.min(+i.minZoom,o,_),Z=e.getConstrained(f,B).zoom;E=c.aI(Z-o)}return{easeFunc:(B,Z,q,G)=>{e.setZoom(B===1?_:o+c.ab(Z));const W=B===1?f:ws(e.worldSize,x.add(w.mult(q)).mult(Z));e.setLocationAtPoint(e.renderWorldCopies?W.wrap():W,G)},scaleOfZoom:z,targetCenter:f,scaleOfMinZoom:E,pixelPathLength:I}}}class Ft{constructor(e,i,s){this.blendFunction=e,this.blendColor=i,this.mask=s}}Ft.Replace=[1,0],Ft.disabled=new Ft(Ft.Replace,c.b7.transparent,[!1,!1,!1,!1]),Ft.unblended=new Ft(Ft.Replace,c.b7.transparent,[!0,!0,!0,!0]),Ft.alphaBlended=new Ft([1,771],c.b7.transparent,[!0,!0,!0,!0]);const kr=2305;class wt{constructor(e,i,s){this.enable=e,this.mode=i,this.frontFace=s}}wt.disabled=new wt(!1,1029,kr),wt.backCCW=new wt(!0,1029,kr),wt.frontCCW=new wt(!0,1028,kr);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 Da=7680;class _t{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}}_t.disabled=new _t({func:519,mask:0},0,0,Da,Da,Da);const La=new WeakMap;function xr(u){var e;if(La.has(u))return La.get(u);{const i=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return La.set(u,i),i}}class Ps{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 Kn(i.createVertexBuffer(o,wn.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),xr(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,_t.disabled,Ft.unblended,wt.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&&xr(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&&xr(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=Ps._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 Ss=c.Z/128;function fo(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,E=s*o*6,B=h*f>65536;if(B&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const Z=B||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+Ss);let se=Q/i*c.Z;Q===-1&&(se=u.extendToNorthPole?c.b9:-64),Q===i+1&&(se=u.extendToSouthPole?c.ba:c.Z+Ss),q[G++]=te,q[G++]=se}const W=Z?new Uint32Array(E):new Uint16Array(E);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:Z}}const Ms=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 Is{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 yr.projectionGlobe}get vertexShaderPreludeCode(){return yr.projectionMercator.vertexSource}get subdivisionGranularity(){return Ms}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Ps(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"?Ms.stencil:Ms.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 _=fo(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 Kn(h.createVertexBuffer(x,wn.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 mo=new c.r({type:new c.D(c.v.projection.type)});class Fa extends c.E{constructor(e){super(),this._transitionable=new c.T(mo),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.C(0)),this._mercatorProjection=new xt,this._verticalPerspectiveProjection=new Is}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 _u(u){const e=go(u.worldSize,u.center.lat);return 2*Math.PI*e}function Xn(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 Si(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 go(u,e){return u/(2*Math.PI)/Math.cos(e*Math.PI/180)}function yu(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 ki(u){return Math.cos(u*Math.PI/180)}function oi(u,e){const i=ki(u),s=ki(e);return c.ab(s/i)}function vr(u,e){const i=u.rotate(e.bearingInRadians),s=e.zoom+oi(e.center.lat,0),o=c.bc(1/ki(e.center.lat),1/ki(Math.min(Math.abs(e.center.lat),60)),c.bf(s,7,3,0,1)),h=360/_u({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 Ba(u){const e=.5*u,i=Math.sin(e),s=Math.cos(e);return Math.log(i+s)-Math.log(s-i)}function El(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,_=Ba(h+s*(f-h)),x=Ba(h),w=Ba(f);return new c.Q(u.lng+e*((_-x)/(w-x)),o)}return new c.Q(u.lng+e*s,o)}class xu{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 Yr(u,e,i){const s=u-e;return s<0?-s:Math.max(0,s-i)}function zl(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,Yr(e,s,o))}class Gh{constructor(){this._aabbCache=new xu(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,zl(e,i,_,x,f)),w=Math.min(w,zl(e,i,_+.5,-x-f,f)),w=Math.min(w,zl(e,i,_+.5,2-x-f,f)),w}getWrap(e,i,s){const o=1<<i.z,h=1/o,f=i.x/o,_=Yr(e.x,f,h),x=Yr(e.x,f-1,h),w=Yr(e.x,f+1,h),I=Math.min(_,x,w);return I===w?1:I===x?-1:0}allowVariableZoom(e,i){return Hr(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 di([-1,-1,-1],[1,1,1]);if(e.z===1)return new di([e.x===0?-1:0,e.y===0?0:-1,-1],[e.x===0?0:1,e.y===0?1:0,1]);{const h=[Xn(0,0,e.x,e.y,e.z),Xn(c.Z,0,e.x,e.y,e.z),Xn(c.Z,c.Z,e.x,e.y,e.z),Xn(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 di(f,_)}}}class _o{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 Gh}clone(){const e=new _o;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(Si(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=Xn(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=go(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=Tn.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=Si(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 E=c.bn(w.lng,z.lng),B=c.bn(w.lat,z.lat);E<f&&(f=E),E>h&&(h=E),B<x&&(x=B),B>_&&(_=B)}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 Qt(I)}getConstrained(e,i){const s=c.ae(e.lat,-85.051129,c.aJ),o=c.ae(+i,this.minZoom+oi(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=Si(this.unprojectScreenPoint(i)),o=Si(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),E=c.bp(o[0],o[2],f[0],I),B=c.bi();c.bl(B,o,h,-z);const Z=c.bp(B[1],B[2],f[1],f[2]),q=c.bi();c.bl(q,o,h,-E);const G=c.bp(q[1],q[2],f[1],f[2]),W=.5*Math.PI,K=Z>=-W&&Z<=W,Q=G>=-W&&G<=W;let ee,te;if(K&&Q){const de=this.center.lng*Math.PI/180,Te=this.center.lat*Math.PI/180;c.bs(z,de)+c.bs(Z,Te)<c.bs(E,de)+c.bs(G,Te)?(ee=z,te=Z):(ee=E,te=G)}else if(K)ee=z,te=Z;else{if(!Q)return;ee=E,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+oi(pe,this.center.lat))}locationToScreenPoint(e,i){const s=Si(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),yu(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,_),yu(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 yo{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 Vt,this._verticalPerspectiveTransform=new _o}clone(){const e=new yo;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 br{get useGlobeControls(){return!0}handlePanInertia(e,i){const s=vr(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,E=-1*c.aV(z,I),B=c.bi();c.aP(B,z,[I[0]*E,I[1]*E,I[2]*E]);const Z=c.bt(B)-1,q=Math.exp(.5*-Math.max(Z-.3,0)),G=go(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),Te=c.bn(se.lng,te.lng),Se=c.bn(se.lat,te.lat);i.setCenter(new c.Q(se.lng+Te*de,se.lat+Se*de).wrap()),i.setZoom(ee+oi(Q,i.center.lat))}handleMapControlsPan(e,i,s){if(!e.panDelta)return;const o=i.center.lat,h=i.zoom;i.setCenter(vr(e.panDelta,i).wrap()),i.setZoom(h+oi(o,i.center.lat))}cameraForBoxAndBearing(e,i,s,o,h){const f=Ts(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,E=z?s.getEast():s.getWest(),B=z?s.getWest():s.getEast(),Z=Math.max(s.getNorth(),s.getSouth()),q=Math.min(s.getNorth(),s.getSouth()),G=E+.5*c.bn(E,B),W=Z+.5*c.bn(Z,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=[Si(s.getNorthWest()),Si(s.getNorthEast()),Si(s.getSouthWest()),Si(s.getSouthEast()),Si(new c.Q(B,W)),Si(new c.Q(E,W)),Si(new c.Q(G,Z)),Si(new c.Q(G,q))],te=Si(f.center);let se=Number.POSITIVE_INFINITY;for(const ie of ee)_<0&&(se=br.getLesserNonNegativeNonNull(se,br.solveVectorScale(ie,te,Q,"x",_))),x>0&&(se=br.getLesserNonNegativeNonNull(se,br.solveVectorScale(ie,te,Q,"x",x))),w>0&&(se=br.getLesserNonNegativeNonNull(se,br.solveVectorScale(ie,te,Q,"y",w))),I<0&&(se=br.getLesserNonNegativeNonNull(se,br.solveVectorScale(ie,te,Q,"y",I)));if(Number.isFinite(se)&&se!==0)return f.zoom=K.zoom+c.ab(se),f;Ra()}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+oi(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,E=e.getConstrained(z,s).center;po(e,E);const B=e.clone();B.setCenter(E),B.setZoom(x?+i.zoom:s+oi(o.lat,z.lat)),B.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));B.setLocationAtPoint(E,Z);const q=(i.offset&&i.offsetAsPoint.mag())>0?B.center:E,G=x?+i.zoom:s+oi(o.lat,q.lat),W=s+oi(o.lat,0),K=G+oi(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,_)||Pn({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=El(o,Q,ee,se*pe);e.setCenter(de.wrap())}if(I){const ie=c.B.number(W,K,se)+oi(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+oi(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 E=I.center;po(e,E);const B=function(ee,te,se){const ie=Si(te),pe=Si(se),de=c.aV(ie,pe),Te=Math.acos(de),Se=_u(ee);return Te/(2*Math.PI)*Se}(e,o,E),Z=h+oi(o.lat,0),q=w+oi(E.lat,0),G=c.aI(q-Z);let W;if(typeof i.minZoom=="number"){const ee=+i.minZoom+oi(E.lat,0),te=Math.min(ee,Z,q)+oi(0,E.lat),se=e.getConstrained(E,te).zoom+oi(E.lat,0);W=c.aI(se-Z)}const K=c.bn(o.lng,E.lng),Q=c.bn(o.lat,E.lat);return{easeFunc:(ee,te,se,ie)=>{const pe=El(o,K,Q,se);_&&e.interpolatePadding(f,i.padding,ee);const de=ee===1?E:pe;e.setCenter(de.wrap());const Te=Z+c.ab(te);e.setZoom(ee===1?w:Te+oi(0,de.lat))},scaleOfZoom:G,targetCenter:E,scaleOfMinZoom:W,pixelPathLength:B}}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 vu{constructor(e){this._globe=e,this._mercatorCameraHelper=new Vi,this._verticalPerspectiveCameraHelper=new br}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 Yn=(u,e)=>c.x(u,e&&e.filter(i=>i.identifier!=="source.canvas")),kl=c.bu();class Oa 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 Un(Vn(),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 Jt,this.imageManager.setEventedParent(this),this.glyphManager=new Ei(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new Zn(256,512),this.crossTileSymbolIndex=new ho,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()),qr().on(Wn,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(kl,{validate:!1})}_load(e,i,s){var o,h;const f=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!Yn(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 ba(this.stylesheet.light),this._setProjectionInternal(((o=this.stylesheet.projection)===null||o===void 0?void 0:o.type)||"mercator"),this.sky=new Nn(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=ht(h),I=_>1?"@2x":"",z={},E={};for(const{id:B,url:Z}of w){const q=f.transformRequest(bt(Z,I,".json"),"SpriteJSON");z[B]=c.j(q,x);const G=f.transformRequest(bt(Z,I,".png"),"SpriteImage");E[B]=At.getImage(G,x)}return yield Promise.all([...Object.values(z),...Object.values(E)]),function(B,Z){return c._(this,void 0,void 0,function*(){const q={};for(const G in B){q[G]={};const W=Ae.getImageCanvasContext((yield Z[G]).data),K=(yield B[G]).data;for(const Q in K){const{width:ee,height:te,x:se,y:ie,sdf:pe,pixelRatio:de,stretchX:Te,stretchY:Se,content:be,textFitWidth:Be,textFitHeight:Le}=K[Q];q[G][Q]={data:null,pixelRatio:de,sdf:pe,stretchX:Te,stretchY:Se,content:be,textFitWidth:Be,textFitHeight:Le,spriteData:{width:ee,height:te,x:se,y:ie,context:W}}}}return q})}(z,E)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const f in h){this._spritesImagesIds[f]=[];const _=this._spritesImagesIds[f]?this._spritesImagesIds[f].filter(x=>!(x in h)):[];for(const x of _)this.imageManager.removeImage(x),this._changedImages[x]=!0;for(const x in h[f]){const 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)&&Yn(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 N(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(Yn(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(_s(this.sourceCaches[w],this._layers,f,e,x,s,this.map.terrain?(I,z,E)=>this.map.terrain.getElevation(I,z,E):void 0));return this.placement&&h.push(function(w,I,z,E,B,Z,q){const G={},W=Z.queryRenderedSymbols(E),K=[];for(const Q of Object.keys(W).map(Number))K.push(q[Q]);K.sort(zi);for(const Q of K){const ee=Q.featureIndex.lookupSymbolFeatures(W[Q.bucketInstanceId],I,Q.bucketIndex,Q.sourceLayerIndex,B.filter,B.layers,B.availableImages,w);for(const te in ee){const se=G[te]=G[te]||[],ie=ee[te];ie.sort((pe,de)=>{const Te=Q.featureSortOrder;if(Te){const Se=Te.indexOf(pe.featureIndex);return Te.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])ui(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 Fa({type:s});return{projection:o,transform:new yo,cameraHelper:new vu(o)}}switch(s){case"mercator":return{projection:new xt,transform:new Vt,cameraHelper:new Vi};case"globe":{const o=new Fa({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:o,transform:new yo,cameraHelper:new vu(o)}}case"vertical-perspective":return{projection:new Is,transform:new _o,cameraHelper:new br};default:return c.w(`Unknown projection name: ${s}. Falling back to mercator projection.`),{projection:new xt,transform:new Vt,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)&&Yn(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),qr().off(Wn,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 E=this.sourceCaches[I.source];x[I.source]=E.getRenderableIds(!0).map(B=>E.getTileByID(B)).sort((B,Z)=>Z.tileID.overscaledZ-B.tileID.overscaledZ||(B.tileID.isLessThan(Z.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 fu(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=[...ht(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=ht(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 ht(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 Al=c.aD([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Rl{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 E of s)E.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 E of s)E.bind(),E.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 Ar=(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}),qh={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 ja(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 Cs{constructor(e,i,s,o,h,f,_,x){const w=e.gl;this.program=w.createProgram();const I=ja(i.staticAttributes),z=s?s.getBinderAttributes():[],E=I.concat(z),B=yr.prelude.staticUniforms?ja(yr.prelude.staticUniforms):[],Z=_.staticUniforms?ja(_.staticUniforms):[],q=i.staticUniforms?ja(i.staticUniforms):[],G=s?s.getBinderUniforms():[],W=B.concat(Z).concat(q).concat(G),K=[];for(const de of W)K.indexOf(de)<0&&K.push(de);const Q=s?s.defines():[];xr(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(yr.prelude.fragmentSource,_.fragmentSource,i.fragmentSource).join(`
726
+ `),te=Q.concat(yr.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
727
+ `);xr(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=E.length;for(let de=0;de<this.numAttributes;de++)E[de]&&(w.bindAttribLocation(this.program,de,E[de]),this.attributes[E[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 Te=K[de];if(Te&&!pe[Te]){const Se=w.getUniformLocation(this.program,Te);Se&&(pe[Te]=Se)}}this.fixedUniforms=o(e,pe),this.terrainUniforms=((de,Te)=>({u_depth:new c.bF(de,Te.u_depth),u_terrain:new c.bF(de,Te.u_terrain),u_terrain_dim:new c.b8(de,Te.u_terrain_dim),u_terrain_matrix:new c.bH(de,Te.u_terrain_matrix),u_terrain_unpack:new c.bI(de,Te.u_terrain_unpack),u_terrain_exaggeration:new c.b8(de,Te.u_terrain_exaggeration)}))(e,pe),this.projectionUniforms=((de,Te)=>({u_projection_matrix:new c.bH(de,Te.u_projection_matrix),u_projection_tile_mercator_coords:new c.bI(de,Te.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.bI(de,Te.u_projection_clipping_plane),u_projection_transition:new c.b8(de,Te.u_projection_transition),u_projection_fallback_matrix:new c.bH(de,Te.u_projection_fallback_matrix)}))(e,pe),this.binderUniforms=s?s.getUniforms(e,pe):[]}draw(e,i,s,o,h,f,_,x,w,I,z,E,B,Z,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[qh[se]].set(w[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);G&&G.setUniforms(e,this.binderUniforms,Z,{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 B.get()){const ie=se.vaos||(se.vaos={});(ie[I]||(ie[I]=new Rl)).bind(e,this,z,G?G.getPaintVertexBuffers():[],E,se.vertexOffset,W,K,Q),ee.drawElements(i,se.primitiveLength*te,ee.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Na(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 bu=(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}},xo=(u,e,i,s,o,h,f)=>c.e(bu(u,e,i,s),Na(h,u,f),{u_height_factor:-Math.pow(2,o.overscaledZ)/f.tileSize/8}),wu=(u,e,i,s)=>c.e(Na(e,u,i),{u_fill_translate:s}),Za=(u,e)=>({u_world:u,u_fill_translate:e}),Wh=(u,e,i,s,o)=>c.e(wu(u,e,i,o),{u_world:s}),Tu=(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}},Hh=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Pu=u=>({u_viewport_size:[u.width,u.height]}),vo=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),Dl=(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}},Ll=(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")}},Su=(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:Jn(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:o,u_accent:h}},Mu=(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 Jn(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 bo=(u,e,i,s)=>{const o=u.transform;return{u_translation:Cu(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]]}},Iu=(u,e,i,s,o)=>c.e(bo(u,e,i,s),{u_image:0,u_image_height:o}),Es=(u,e,i,s,o)=>{const h=u.transform,f=zs(e,h);return{u_translation:Cu(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]]}},Kh=(u,e,i,s,o,h)=>{const f=u.lineAtlas,_=zs(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,E=I.width*h.toScale;return c.e(bo(u,e,i,s),{u_patternscale_a:[_/z,-w.height/2],u_patternscale_b:[_/E,-I.height/2],u_sdfgamma:f.width/(256*Math.min(z,E)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:I.y,u_mix:h.t})};function zs(u,e){return 1/c.aw(u,1,e.tileZoom)}function Cu(u,e,i){return c.ax(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Xh=(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:Eu(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 Eu(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 Fl=(u,e,i,s,o,h,f,_,x,w,I,z,E)=>{const B=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:B.cameraToCenterDistance,u_pitch:B.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:B.width/B.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+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:E}},Bl=(u,e,i,s,o,h,f,_,x,w,I,z,E,B)=>{const Z=f.transform;return c.e(Fl(u,e,i,s,o,h,f,_,x,w,I,z,B),{u_gamma_scale:s?Math.cos(Z.pitch*Math.PI/180)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},Ol=(u,e,i,s,o,h,f,_,x,w,I,z,E)=>c.e(Bl(u,e,i,s,o,h,f,_,x,w,!0,I,0,E),{u_texsize_icon:z,u_texture_icon:1}),zu=(u,e)=>({u_opacity:u,u_color:e}),wo=(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:E}=_.imageManager.getPixelSize(),B=Math.pow(2,x.tileID.overscaledZ),Z=x.tileSize*Math.pow(2,_.transform.tileZoom)/B,q=Z*(x.tileID.canonical.x+x.tileID.wrap*B),G=Z*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,E],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}),Rr=(u,e)=>{},jl={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:Rr,clippingMask:Rr,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 Nl{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 Zl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ku{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[Zl[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Tt{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 Qn extends Tt{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 Vl extends Tt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Yh extends Tt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Jh extends Tt{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 Qh extends Tt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ed extends Tt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Au extends Tt{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 td extends Tt{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 Ru extends Tt{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 To extends Tt{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 Po extends Tt{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 So extends Tt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Ul extends Tt{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 ea extends Tt{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 Va extends Tt{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 or extends Tt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Du extends Tt{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 Lu extends Tt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class $l extends Tt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class ta extends Tt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Mo extends Tt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Io extends Tt{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 ks extends Tt{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 Co extends Tt{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 Fu extends Tt{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 Ua extends Tt{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 $a extends Tt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Bu extends Tt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;xr(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 Gl extends Tt{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 vt extends Tt{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 Eo extends Tt{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 ql extends Tt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Ou extends ql{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 As extends ql{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 id extends ql{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 ju="Framebuffer is not complete";class Nu{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 Ou(e,_),o)this.depthAttachment=h?new id(e,_):new As(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(ju)}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 rd{constructor(e){var i,s;if(this.gl=e,this.clearColor=new Qn(this),this.clearDepth=new Vl(this),this.clearStencil=new Yh(this),this.colorMask=new Jh(this),this.depthMask=new Qh(this),this.stencilMask=new ed(this),this.stencilFunc=new Au(this),this.stencilOp=new td(this),this.stencilTest=new Ru(this),this.depthRange=new To(this),this.depthTest=new Po(this),this.depthFunc=new So(this),this.blend=new Ul(this),this.blendFunc=new ea(this),this.blendColor=new Va(this),this.blendEquation=new or(this),this.cullFace=new Du(this),this.cullFaceSide=new Lu(this),this.frontFace=new $l(this),this.program=new ta(this),this.activeTexture=new Mo(this),this.viewport=new Io(this),this.bindFramebuffer=new ks(this),this.bindRenderbuffer=new Co(this),this.bindTexture=new Fu(this),this.bindVertexBuffer=new Ua(this),this.bindElementBuffer=new $a(this),this.bindVertexArray=new Bu(this),this.pixelStoreUnpack=new Gl(this),this.pixelStoreUnpackPremultiplyAlpha=new vt(this),this.pixelStoreUnpackFlipY=new Eo(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),xr(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 Nl(this,e,i)}createVertexBuffer(e,i,s){return new ku(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 Nu(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,Ft.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 xr(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 xr(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 Ga;function Rs(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,_t.disabled,u.colorModeForRenderPass(),wt.disabled,Hh(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 E=u.useProgram("collisionCircle"),B=new c.bP;B.resize(4*I),B._trim();let Z=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];B.emplace(Z++,ee,te,se,ie,0),B.emplace(Z++,ee,te,se,ie,1),B.emplace(Z++,ee,te,se,ie,2),B.emplace(Z++,ee,te,se,ie,3)}(!Ga||Ga.length<2*I)&&(Ga=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(Ga,!0),G=h.createVertexBuffer(B,c.bQ.members,!0);for(const W of w){const K=Pu(u.transform);E.draw(h,_.TRIANGLES,ct.disabled,_t.disabled,u.colorModeForRenderPass(),wt.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 zo=c.at(new Float32Array(16));function Wl(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 Hl(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 ye(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=yt(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 Zu(u,e,i,s,o,h,f,_,x,w,I,z){const E=u.text.placedSymbolArray,B=u.text.dynamicLayoutVertexArray,Z=u.icon.dynamicLayoutVertexArray,q={};B.clear();for(let G=0;G<E.length;G++){const W=E.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):yt(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:Te,textOffset:Se,textBoxScale:be}=K,Be=Wl(Te,pe,de,Se,be,ie),Le=o.getPitchedTextCorrection(Q.x+w[0],Q.y+w[1],I),Me=Hl(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(B,Me,We);x&&W.associatedIconIndex>=0&&(q[W.associatedIconIndex]={shiftedAnchor:Me,angle:We})}else it(W.numGlyphs,B)}if(x){Z.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,Z);else{const Q=q[W];if(Q)for(let ee=0;ee<K.numGlyphs;ee++)c.ao(Z,Q.shiftedAnchor,Q.angle);else it(K.numGlyphs,Z)}}u.icon.dynamicLayoutVertexBuffer.updateData(Z)}u.text.dynamicLayoutVertexBuffer.updateData(B)}function ko(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Ds(u,e,i,s,o,h,f,_,x,w,I,z,E){const B=u.context,Z=B.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 Te of s){const Se=e.getTile(Te),be=Se.getBucket(i);if(!be)continue;const Be=o?be.text:be.icon;if(!Be||!Be.segments.get().length||!Be.hasVisibleVertices)continue;const Le=Be.programConfigurations.get(i.id),Me=o||be.sdfIcons,We=o?be.textSizeData:be.iconSizeData,lt=W||q.pitch!==0,Pt=u.useProgram(ko(Me,o,be),Le),ut=c.ag(We,q.zoom),Et=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Te);let Dt,Ot,It,zt,ni=[0,0],pi=null;if(o)Ot=Se.glyphAtlasTexture,It=Z.LINEAR,Dt=Se.glyphAtlasTexture.size,be.iconsInText&&(ni=Se.imageAtlasTexture.size,pi=Se.imageAtlasTexture,zt=lt||u.options.rotating||u.options.zooming||We.kind==="composite"||We.kind==="camera"?Z.LINEAR:Z.NEAREST);else{const Ht=i.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;Ot=Se.imageAtlasTexture,It=Me||u.options.rotating||u.options.zooming||Ht||lt?Z.LINEAR:Z.NEAREST,Dt=Se.imageAtlasTexture.size}const yi=c.aw(Se,1,u.transform.zoom),Gi=he(G,u.transform,yi),en=c.K();c.aj(en,Gi);const Br=oe(W,G,u.transform,yi),Mn=c.ax(q,Se,h,f),In=q.getProjectionData({overscaledTileID:Te,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),ca=ie&&be.hasTextData(),Or=i.layout.get("icon-text-fit")!=="none"&&ca&&be.hasIconData();if(K){const Ht=u.style.map.terrain?(li,Rt)=>u.style.map.terrain.getElevation(Te,li,Rt):null,Kt=i.layout.get("text-rotation-alignment")==="map";je(be,u,o,Gi,en,W,w,Kt,Te.toUnwrapped(),q.width,q.height,Mn,Ht)}const tn=o&&ie||Or,Qi=K||tn?zo:W?Gi:u.transform.clipSpaceToPixelsMatrix,rn=Me&&i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ua;ua=Me?be.iconsInText?Ol(We.kind,ut,Q,W,K,tn,u,Qi,Br,Mn,Dt,ni,de):Bl(We.kind,ut,Q,W,K,tn,u,Qi,Br,Mn,o,Dt,0,de):Fl(We.kind,ut,Q,W,K,tn,u,Qi,Br,Mn,o,Dt,de);const ha={program:Pt,buffers:Be,uniformValues:ua,projectionData:In,atlasTexture:Ot,atlasTextureIcon:pi,atlasInterpolation:It,atlasInterpolationIcon:zt,isSDF:Me,hasHalo:rn};if(ee&&be.canOverlap){te=!0;const Ht=Be.segments.get();for(const Kt of Ht)pe.push({segments:new c.aG([Kt]),sortKey:Kt.sortKey,state:ha,terrainData:Et})}else pe.push({segments:Be.segments,sortKey:0,state:ha,terrainData:Et})}te&&pe.sort((Te,Se)=>Te.sortKey-Se.sortKey);for(const Te of pe){const Se=Te.state;if(B.activeTexture.set(Z.TEXTURE0),Se.atlasTexture.bind(Se.atlasInterpolation,Z.CLAMP_TO_EDGE),Se.atlasTextureIcon&&(B.activeTexture.set(Z.TEXTURE1),Se.atlasTextureIcon&&Se.atlasTextureIcon.bind(Se.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),Se.isSDF){const be=Se.uniformValues;Se.hasHalo&&(be.u_is_halo=1,Ao(Se.buffers,Te.segments,i,u,Se.program,se,I,z,be,Se.projectionData,Te.terrainData)),be.u_is_halo=0}Ao(Se.buffers,Te.segments,i,u,Se.program,se,I,z,Se.uniformValues,Se.projectionData,Te.terrainData)}}function Ao(u,e,i,s,o,h,f,_,x,w,I){const z=s.context;o.draw(z,z.gl.TRIANGLES,h,f,_,wt.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 nd(u,e,i,s,o){const h=u.context,f=h.gl,_=_t.disabled,x=new Ft([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=Vu(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 E=w.programConfigurations.get(i.id),B=u.useProgram("heatmap",E,!o),Z=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),q=u.style.map.terrain.getTerrainData(s);B.draw(h,f.TRIANGLES,ct.disabled,_,x,wt.disabled,Dl(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),q,Z,i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,i.paint,u.transform.zoom,E)}function Kl(u,e,i,s,o){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=Xl(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,_t.disabled,u.colorModeForRenderPass(),wt.disabled,Ll(u,e,0,1),null,z,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),I.destroy(),e.heatmapFbos.delete(w)}function Vu(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 Xl(u,e){return e.colorRampTexture||(e.colorRampTexture=new Ct(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ls(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 Ro(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),E=i.getCrossfadeParameters();let B,Z,q,G,W;const K=u.transform,Q=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(Z=z&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",B=x.LINES):(Z=z?"fillPattern":"fill",B=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),Te=u.useProgram(Z,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(E)),Ls(de,w,te,ie,i);const be=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=Z==="fillOutlinePattern"&&z?Wh(u,E,ie,Me,Be):Za(Me,Be)}else G=pe.indexBuffer,W=pe.segments,q=z?wu(u,E,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);Te.draw(u.context,B,o,Le,h,wt.backCCW,q,Se,be,i.id,pe.layoutVertexBuffer,G,W,i.paint,u.transform.zoom,de)}}function Do(u,e,i,s,o,h,f,_){const x=u.context,w=x.gl,I="fill-extrusion-pattern",z=i.paint.get(I),E=z.constantOr(1),B=i.getCrossfadeParameters(),Z=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(E?"fillExtrusionPattern":"fillExtrusion",te);E&&(u.context.activeTexture.set(w.TEXTURE0),K.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),te.updatePaintBuffers(B));const ie=G.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Ls(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"),Te=E?xo(u,de,Z,pe,W,B,K):bu(u,de,Z,pe);se.draw(x,x.gl.TRIANGLES,o,h,f,wt.backCCW,Te,ee,ie,i.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,i.paint,u.transform.zoom,te,u.style.map.terrain&&Q.centroidVertexBuffer)}}function Lo(u,e,i,s,o,h,f,_,x){var w;const I=u.style.projection,z=u.context,E=u.transform,B=z.gl,Z=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(B.TEXTURE0),B.bindTexture(B.TEXTURE_2D,K.colorAttachment.get());const te=E.getProjectionData({overscaledTileID:G,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});Z.draw(z,B.TRIANGLES,h,o[G.overscaledZ],f,wt.backCCW,Su(u,W,i),ee,te,i.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const qa=[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 Wa(u,e,i,s,o,h,f,_,x=!1,w=!1){const I=s[s.length-1].overscaledZ,z=u.context,E=z.gl,B=u.useProgram("raster"),Z=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,E.LESS),ee=e.getTile(K);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const te=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),ie=ad(ee,te||se||null,e,i,u.transform,u.style.map.terrain);let pe,de;const Te=i.paint.get("raster-resampling")==="nearest"?E.NEAREST:E.LINEAR;z.activeTexture.set(E.TEXTURE0),ee.texture.bind(Te,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),z.activeTexture.set(E.TEXTURE1),te?(te.texture.bind(Te,E.CLAMP_TO_EDGE,E.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(Te,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&z.extTextureFilterAnisotropic&&u.transform.pitch>20&&E.texParameterf(E.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax);const Se=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),be=Z.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!w,applyTerrainMatrix:!0}),Be=Xh(de||[0,0],pe||1,ie,i,_),Le=q.getMeshFromTileID(z,K.canonical,h,f,"raster");B.draw(z,E.TRIANGLES,Q,o?o[K.overscaledZ]:_t.disabled,G,x?wt.frontCCW:wt.backCCW,Be,Se,be,i.id,Le.vertexBuffer,Le.indexBuffer,Le.segments)}}function ad(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=Hr(o,{tileSize:I.tileSize,roundZoom:I.roundZoom}),E=!e||Math.abs(e.tileID.overscaledZ-z)>Math.abs(u.tileID.overscaledZ-z),B=E&&u.refreshedUponExpiration?1:c.ae(E?x:1-w,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const Uu=new c.b7(1,0,0,1),ei=new c.b7(0,1,0,1),ia=new c.b7(0,0,1,1),lr=new c.b7(1,0,1,1),Yl=new c.b7(0,1,1,1);function Fo(u,e,i,s){Jr(u,0,e+i/2,u.transform.width,i,s)}function Jl(u,e,i,s){Jr(u,e-i/2,0,i,u.transform.height,s)}function Jr(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 Fs(u,e,i){const s=u.context,o=s.gl,h=u.useProgram("debug"),f=ct.disabled,_=_t.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,E=Math.floor((z&&z.byteLength||0)/1024),B=e.getTile(i).tileSize,Z=512/Math.min(B,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} ${E}kB`);const G=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,o.TRIANGLES,f,_,Ft.alphaBlended,wt.disabled,vo(c.b7.transparent,Z),null,G,w,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,o.LINE_STRIP,f,_,x,wt.disabled,vo(c.b7.red),I,G,w,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Bo(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 E=e.getTerrainMesh(z.tileID),B=u.renderToTexture.getTexture(z),Z=e.getTerrainData(z.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,B.texture);const q=e.getMeshFrameDelta(_.zoom),G=_.calculateFogMatrix(z.tileID.toUnwrapped()),W=Ar(q,G,u.style.sky,_.pitch,o),K=_.getProjectionData({overscaledTileID:z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});I.draw(h,f.TRIANGLES,w,_t.disabled,x,wt.backCCW,W,Z,K,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}}function Ql(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 Kn(u.createVertexBuffer(i,wn.members),u.createIndexBuffer(s),c.aG.simpleSegment(0,0,i.length,s.length))}return e.mesh}class $u{constructor(e,i){this.context=new rd(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.at(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=N.maxUnderzooming+N.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ho}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,wn.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,wn.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,Al.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,wn.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,wn.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 _t({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.tileExtentMesh=new Kn(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,Ft.disabled,wt.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(Ft.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],E=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I),B=_.getMeshFromTileID(this.context,I.canonical,o,!0,"stencil"),Z=x.getProjectionData({overscaledTileID:I,applyGlobeMatrix:!0,applyTerrainMatrix:!0});w.draw(h,f.TRIANGLES,ct.disabled,new _t({func:f.ALWAYS,mask:0},z,255,f.KEEP,f.KEEP,f.REPLACE),Ft.disabled,s?wt.disabled:wt.backCCW,null,E,Z,"$clipping",B.vertexBuffer,B.indexBuffer,B.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,_t.disabled,Ft.disabled,wt.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 _t({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new _t({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 _t({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[o]:_t.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 _t({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+o]=new _t({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 _t({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[o]:new _t({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Ft([e.CONSTANT_COLOR,e.ONE],new c.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ft.unblended:Ft.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 E in f){const B=f[E];B.used&&B.prepare(this.context),_[E]=B.getVisibleCoordinates(!1),x[E]=_[E].slice().reverse(),w[E]=B.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let E=0;E<h.length;E++)if(this.style._layers[h[E]].is3D()){this.opaquePassCutoff=E;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const E of h){const B=this.style._layers[E];if(!B.hasOffscreenPass()||B.isHidden(this.transform.zoom))continue;const Z=x[B.source];(B.type==="custom"||Z.length)&&this.renderLayer(this,f[B.source],B,Z,I)}if((o=this.style.projection)===null||o===void 0||o.updateGPUdependent({context:this.context,useProgram:E=>this.useProgram(E)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?c.b7.black:c.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(E,B){const Z=E.context,q=Z.gl,G=((se,ie,pe)=>{const de=Math.cos(ie.rollInRadians),Te=Math.sin(ie.rollInRadians),Se=Aa(ie),be=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*Te)*pe,(ie.height/2+Se*de)*pe],u_horizon_normal:[-Te,de],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*ie.height/2*pe,u_sky_blend:be}})(B,E.style.map.transform,E.pixelRatio),W=new ct(q.LEQUAL,ct.ReadWrite,[0,1]),K=_t.disabled,Q=E.colorModeForRenderPass(),ee=E.useProgram("sky"),te=Ql(Z,B);ee.draw(Z,q.TRIANGLES,W,K,Q,wt.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 E=this.style._layers[h[this.currentLayer]],B=f[E.source],Z=_[E.source];this._renderTileClippingMasks(E,Z,!1),this.renderLayer(this,B,E,Z,I)}this.renderPass="translucent";let z=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const E=this.style._layers[h[this.currentLayer]],B=f[E.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(E,I))continue;this.opaquePassEnabledForLayer()||z||(z=!0,I.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const Z=(E.type==="symbol"?w:x)[E.source];this._renderTileClippingMasks(E,_[E.source],!1),this.renderLayer(this,B,E,Z,I)}if(I.isRenderingGlobe&&function(E,B,Z){const q=E.context,G=q.gl,W=E.useProgram("atmosphere"),K=new ct(G.LEQUAL,ct.ReadOnly,[0,1]),Q=E.transform,ee=function(be,Be){const Le=be.properties.get("position"),Me=[-Le.x,-Le.y,-Le.z],We=c.at(new Float64Array(16));return be.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}(Z,E.transform),te=Q.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=B.properties.get("atmosphere-blend")*te.projectionTransition;if(se===0)return;const ie=go(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 Te=((be,Be,Le,Me,We)=>({u_sun_pos:be,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=Ql(q,B);W.draw(q,G.TRIANGLES,K,_t.disabled,Ft.alphaBlended,wt.disabled,Te,null,null,"atmosphere",Se.vertexBuffer,Se.indexBuffer,Se.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const E=function(B,Z){let q=null;const G=Object.values(B._layers).flatMap(ee=>ee.source&&!ee.isHidden(Z)?[B.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);E&&function(B,Z,q){for(let G=0;G<q.length;G++)Fs(B,Z,q[G])}(this,E,E.getVisibleCoordinates())}this.options.showPadding&&function(E){const B=E.transform.padding;Fo(E,E.transform.height-(B.top||0),3,Uu),Fo(E,B.bottom||0,3,ei),Jl(E,B.left||0,3,ia),Jl(E,E.transform.width-(B.right||0),3,lr);const Z=E.transform.centerPoint;(function(q,G,W,K){Jr(q,G-1,W-10,2,20,K),Jr(q,G-10,W-1,20,2,K)})(E,Z.x,E.transform.height-Z.y,Yl)}(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=Ft.unblended,z=new ct(x.LEQUAL,ct.ReadWrite,[0,1]),E=f.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.b7.transparent,depth:1});for(const Z of E){const q=f.getTerrainMesh(Z.tileID),G=f.getTerrainData(Z.tileID),W=w.getProjectionData({overscaledTileID:Z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(w.zoom)};B.draw(_,x.TRIANGLES,z,_t.disabled,I,wt.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=Ft.unblended,z=new ct(x.LEQUAL,ct.ReadWrite,[0,1]),E=f.getCoordsTexture(),B=f.sourceCache.getRenderableTiles(),Z=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 B){const G=f.getTerrainMesh(q.tileID),W=f.getTerrainData(q.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,E.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});Z.draw(_,x.TRIANGLES,z,_t.disabled,I,wt.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:E}=z,B=_t.disabled,Z=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,Te=Q==="map",Se=ee==="map";for(const be of q){const Be=K.getTile(be),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(Te,G.transform,We),Pt=W.layout.get("icon-text-fit")!=="none"&&Le.hasIconData();if(Me){const ut=Math.pow(2,pe.zoom-Be.tileID.overscaledZ),Et=de?(Dt,Ot)=>de.getElevation(be,Dt,Ot):null;Zu(Le,Te,Se,ie,pe,lt,ut,Me,Pt,c.ax(pe,Be,te,se),be.toUnwrapped(),Et)}}}(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&&Ds(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"),B,Z,E),x.paint.get("text-opacity").constantOr(1)!==0&&Ds(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"),B,Z,E),_.map.showCollisionBoxes&&(Rs(f,_,x,w,!0),Rs(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,E=x.paint.get("circle-opacity"),B=x.paint.get("circle-stroke-width"),Z=x.paint.get("circle-stroke-opacity"),q=!x.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(B.constantOr(1)===0||Z.constantOr(1)===0))return;const G=f.context,W=G.gl,K=f.transform,Q=f.getDepthModeForSublayer(0,ct.ReadOnly),ee=_t.disabled,te=f.colorModeForRenderPass(),se=[],ie=K.getCircleRadiusCorrection();for(let pe=0;pe<w.length;pe++){const de=w[pe],Te=_.getTile(de),Se=Te.getBucket(x);if(!Se)continue;const be=x.paint.get("circle-translate"),Be=x.paint.get("circle-translate-anchor"),Le=c.ax(K,Te,be,Be),Me=Se.programConfigurations.get(x.id),We=f.useProgram("circle",Me),lt=Se.layoutVertexBuffer,Pt=Se.indexBuffer,ut=f.style.map.terrain&&f.style.map.terrain.getTerrainData(de),Et={programConfiguration:Me,program:We,layoutVertexBuffer:lt,indexBuffer:Pt,uniformValues:Tu(f,Te,x,Le,ie),terrainData:ut,projectionData:K.getProjectionData({overscaledTileID:de,applyGlobeMatrix:!z,applyTerrainMatrix:!0})};if(q){const Dt=Se.segments.get();for(const Ot of Dt)se.push({segments:new c.aG([Ot]),sortKey:Ot.sortKey,state:Et})}else se.push({segments:Se.segments,sortKey:0,state:Et})}q&&se.sort((pe,de)=>pe.sortKey-de.sortKey);for(const pe of se){const{programConfiguration:de,program:Te,layoutVertexBuffer:Se,indexBuffer:be,uniformValues:Be,terrainData:Le,projectionData:Me}=pe.state;Te.draw(G,W.TRIANGLES,Q,ee,te,wt.backCCW,Be,Le,Me,x.id,Se,be,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:E,isRenderingGlobe:B}=I;if(f.style.map.terrain){for(const Z of w){const q=_.getTile(Z);_.hasRenderableParent(Z)||(f.renderPass==="offscreen"?nd(f,q,x,Z,B):f.renderPass==="translucent"&&Kl(f,x,Z,E,B))}z.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(Z,q,G,W){const K=Z.context,Q=K.gl,ee=Z.transform,te=_t.disabled,se=new Ft([Q.ONE,Q.ONE],c.b7.transparent,[!0,!0,!0,!0]);(function(ie,pe,de){const Te=ie.gl;ie.activeTexture.set(Te.TEXTURE1),ie.viewport.set([0,0,pe.width/4,pe.height/4]);let Se=de.heatmapFbos.get(c.bS);Se?(Te.bindTexture(Te.TEXTURE_2D,Se.colorAttachment.get()),ie.bindFramebuffer.set(Se.framebuffer)):(Se=Vu(ie,pe.width/4,pe.height/4),de.heatmapFbos.set(c.bS,Se))})(K,Z,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),Te=de.getBucket(G);if(!Te)continue;const Se=Te.programConfigurations.get(G.id),be=Z.useProgram("heatmap",Se),Be=ee.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Le=ee.getCircleRadiusCorrection();be.draw(K,Q.TRIANGLES,ct.disabled,te,se,wt.backCCW,Dl(de,ee.zoom,G.paint.get("heatmap-intensity"),Le),null,Be,G.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,G.paint,ee.zoom,Se)}K.viewport.set([0,0,Z.width,Z.height])}(f,_,x,w):f.renderPass==="translucent"&&function(Z,q){const G=Z.context,W=G.gl;G.setColorMode(Z.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),Xl(G,q).bind(W.LINEAR,W.CLAMP_TO_EDGE),Z.useProgram("heatmapTexture").draw(G,W.TRIANGLES,ct.disabled,_t.disabled,Z.colorModeForRenderPass(),wt.disabled,Ll(Z,q,0,1),null,null,q.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments,q.paint,Z.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,E=x.paint.get("line-opacity"),B=x.paint.get("line-width");if(E.constantOr(1)===0||B.constantOr(1)===0)return;const Z=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 Te of w){const Se=_.getTile(Te);if(K&&!Se.patternsLoaded())continue;const be=Se.getBucket(x);if(!be)continue;const Be=be.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(Te),Pt=W.constantOr(null);if(Pt&&Se.imageAtlas){const It=Se.imageAtlas,zt=It.patternPositions[Pt.to.toString()],ni=It.patternPositions[Pt.from.toString()];zt&&ni&&Be.setConstantPatternPositions(zt,ni)}const ut=pe.getProjectionData({overscaledTileID:Te,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),Et=pe.getPixelScale(),Dt=K?Es(f,Se,x,Et,ee):G?Kh(f,Se,x,Et,G,ee):Q?Iu(f,Se,x,Et,be.lineClipsArray.length):bo(f,Se,x,Et);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 It=be.gradients[x.id];let zt=It.texture;if(x.gradientVersion!==It.version){let ni=256;if(x.stepInterpolant){const pi=_.getSource().maxzoom,yi=Te.canonical.z===pi?Math.ceil(1<<f.transform.maxZoom-Te.canonical.z):1;ni=c.ae(c.bT(be.maxLineLength/c.Z*1024*yi),256,se.maxTextureSize)}It.gradient=c.bU({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:ni,image:It.gradient||void 0,clips:be.lineClipsArray}),It.texture?It.texture.update(It.gradient):It.texture=new Ct(se,It.gradient,ie.RGBA),It.version=x.gradientVersion,zt=It.texture}se.activeTexture.set(ie.TEXTURE0),zt.bind(x.stepInterpolant?ie.NEAREST:ie.LINEAR,ie.CLAMP_TO_EDGE)}let Ot;if(z){const[It]=f.getStencilConfigForOverlapAndUpdateStencilID(w);Ot=It[Te.overscaledZ]}else Ot=f.stencilModeForClipping(Te);Me.draw(se,ie.TRIANGLES,Z,Ot,q,wt.disabled,Dt,lt,ut,x.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,x.paint,f.transform.zoom,Be,be.layoutVertexBuffer2),de=!1}}(e,i,s,o,h):c.c3(s)?function(f,_,x,w,I){const z=x.paint.get("fill-color"),E=x.paint.get("fill-opacity");if(E.constantOr(1)===0)return;const{isRenderingToTexture:B}=I,Z=f.colorModeForRenderPass(),q=x.paint.get("fill-pattern"),G=f.opaquePassEnabledForLayer()&&!q.constantOr(1)&&z.constantOr(c.b7.transparent).a===1&&E.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===G){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);Ro(f,_,x,w,W,Z,!1,B)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);Ro(f,_,x,w,W,Z,!0,B)}}(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:E}=I;if(f.renderPass==="translucent"){const B=new ct(f.context.gl.LEQUAL,ct.ReadWrite,f.depthRangeFor3D);if(z!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Do(f,_,x,w,B,_t.disabled,Ft.disabled,E),Do(f,_,x,w,B,f.stencilModeFor3D(),f.colorModeForRenderPass(),E);else{const Z=f.colorModeForRenderPass();Do(f,_,x,w,B,_t.disabled,Z,E)}}}(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,E=f.context,B=f.style.projection.useSubdivision,Z=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 Te=W.getTile(de),Se=Te.dem;if(!Se||!Se.data||!Te.needsHillshadePrepare)continue;const be=Se.dim,Be=Se.stride,Le=Se.getPixels();if(ie.activeTexture.set(pe.TEXTURE1),ie.pixelStoreUnpackPremultiplyAlpha.set(!1),Te.demTexture=Te.demTexture||G.getTileTexture(Be),Te.demTexture){const We=Te.demTexture;We.update(Le,{premultiply:!1}),We.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else Te.demTexture=new Ct(ie,Le,pe.RGBA,{premultiply:!1}),Te.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);ie.activeTexture.set(pe.TEXTURE0);let Me=Te.fbo;if(!Me){const We=new Ct(ie,{width:be,height:be,data:null},pe.RGBA);We.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),Me=Te.fbo=ie.createFramebuffer(be,be,!0,!1),Me.colorAttachment.set(We.texture)}ie.bindFramebuffer.set(Me.framebuffer),ie.viewport.set([0,0,be,be]),G.useProgram("hillshadePrepare").draw(ie,pe.TRIANGLES,ee,te,se,wt.disabled,Mu(Te.tileID,Se),null,null,Q.id,G.rasterBoundsBuffer,G.quadTriangleIndexBuffer,G.rasterBoundsSegments),Te.needsHillshadePrepare=!1}})(f,_,w,x,Z,_t.disabled,q),E.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(B){const[G,W,K]=f.stencilConfigForOverlapTwoPass(w);Lo(f,_,x,K,G,Z,q,!1,z),Lo(f,_,x,K,W,Z,q,!0,z)}else{const[G,W]=f.getStencilConfigForOverlapAndUpdateStencilID(w);Lo(f,_,x,W,G,Z,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,E=_.getSource(),B=f.style.projection.useSubdivision;if(E instanceof gr)Wa(f,_,x,w,null,!1,!1,E.tileCoords,E.flippedWindingOrder,z);else if(B){const[Z,q,G]=f.stencilConfigForOverlapTwoPass(w);Wa(f,_,x,G,Z,!1,!0,qa,!1,z),Wa(f,_,x,G,q,!0,!0,qa,!1,z)}else{const[Z,q]=f.getStencilConfigForOverlapAndUpdateStencilID(w);Wa(f,_,x,q,Z,!1,!0,qa,!1,z)}}(e,i,s,o,h):c.c7(s)?function(f,_,x,w,I){const z=x.paint.get("background-color"),E=x.paint.get("background-opacity");if(E===0)return;const{isRenderingToTexture:B}=I,Z=f.context,q=Z.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&&E===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const te=_t.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&&(Z.activeTexture.set(q.TEXTURE0),f.imageManager.bind(f.context));const Te=x.getCrossfadeParameters();for(const Se of de){const be=W.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!B,applyTerrainMatrix:!0}),Be=Q?wo(E,f,Q,{tileID:Se,tileSize:K},Te):zu(E,z),Le=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Se),Me=G.getMeshFromTileID(Z,Se.canonical,!1,!0,"raster");pe.draw(Z,q.TRIANGLES,se,te,ie,wt.backCCW,Be,Le,be,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,E=x.implementation,B=f.style.projection,Z=f.transform,q=Z.getProjectionDataForCustomLayer(I),G={farZ:Z.farZ,nearZ:Z.nearZ,fov:Z.fov*Math.PI/180,modelViewProjectionMatrix:Z.modelViewProjectionMatrix,projectionMatrix:Z.projectionMatrix,shaderData:{variantName:B.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
728
+ uniform mat4 u_projection_matrix;
729
+ ${B.shaderPreludeCode.vertexSource}`,define:B.shaderDefine},defaultProjectionData:q},W=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),z.setColorMode(f.colorModeForRenderPass()),K.call(E,z.gl,G),z.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),z.setColorMode(f.colorModeForRenderPass()),z.setStencilMode(_t.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ct.ReadOnly);z.setDepthMode(K),E.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?ka:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"");return this.cache[f]||(this.cache[f]=new Cs(this.context,yr[e],i,jl[e],this._showOverdrawInspector,o,s?yr.projectionMercator:h.shaderPreludeCode,s?Xr: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 Ct(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 ec(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 tc{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=ec(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 E=!1;const B=window.location.hash.slice(1).split("&").map(Z=>{const q=Z.split("=")[0];return q===z?(E=!0,`${q}=${I}`):Z}).filter(Z=>Z);return E||B.push(`${z}=${I}`),`#${B.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 Ha={linearity:.3,easing:c.c9(0,0,.3,1)},ra=c.e({deceleration:2500,maxSpeed:1400},Ha),Gu=c.e({deceleration:20,maxSpeed:1400},Ha),qu=c.e({deceleration:1e3,maxSpeed:360},Ha),Wu=c.e({deceleration:1e3,maxSpeed:90},Ha),Hu=c.e({deceleration:1e3,maxSpeed:360},Ha);class Ku{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=Xa(i.pan.mag(),s,c.e({},ra,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);o.center=_.easingCenter,o.offset=_.easingOffset,Ka(o,h)}if(i.zoom){const h=Xa(i.zoom,s,Gu);o.zoom=this._map.transform.zoom+h.amount,Ka(o,h)}if(i.bearing){const h=Xa(i.bearing,s,qu);o.bearing=this._map.transform.bearing+c.ae(h.amount,-179,179),Ka(o,h)}if(i.pitch){const h=Xa(i.pitch,s,Wu);o.pitch=this._map.transform.pitch+h.amount,Ka(o,h)}if(i.roll){const h=Xa(i.roll,s,Hu);o.roll=this._map.transform.roll+c.ae(h.amount,-179,179),Ka(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 Ka(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Xa(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 Ai 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 Ya 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 cr extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class Dr{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new cr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ai(e.type,this._map,e))}mouseup(e){this._map.fire(new Ai(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ai(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ai(e.type,this._map,e))}mouseover(e){this._map.fire(new Ai(e.type,this._map,e))}mouseout(e){this._map.fire(new Ai(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ya(e.type,this._map,e))}touchmove(e){this._map.fire(new Ya(e.type,this._map,e))}touchend(e){this._map.fire(new Ya(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ya(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Xu{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ai(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ai("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ai(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 na{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 ic(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 sd{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=ic(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const o=ic(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 rc{constructor(e){this.singleTap=new sd(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 od{constructor(e){this._tr=new Ui(e),this._zoomIn=new rc({numTouches:1,numTaps:2}),this._zoomOut=new rc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const 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 Ja{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 Bs={0:1,2:2};class Ji{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=Bs[s];return i.buttons===void 0||(i.buttons&o)!==o}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class Ue{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 Yu{constructor(e=new Ji({checkCorrectEvent:()=>!0}),i=new Ue){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 Qa=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Ju{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=ic(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 aa{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=Sn(s,i,o),_=Sn(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=Sn(s,i,o),_=Sn(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 Sn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function nc(u,e){return Math.log(u/e)/Math.LN2}class ft extends aa{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(nc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:nc(this._distance,s),pinchAround:i}}}function Oo(u,e){return 180*u.angleWith(e)/Math.PI}class Qu extends aa{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:Oo(this._vector,o),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Oo(e,this._startVector);return Math.abs(s)<i}}function Os(u){return Math.abs(u.y)>Math.abs(u.x)}class eh extends aa{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,Os(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 Os(e)&&Os(i)&&f}}const ld={panStep:100,bearingStep:15,pitchStep:10};class ac{constructor(e){this._tr=new Ui(e);const i=ld;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:sc,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 sc(u){return u*(2-u)}const oc=4.000244140625;class th{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%oc==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)>oc?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 lc{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 cd{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 ud{constructor(){this._tap=new rc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const 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 Qr{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 Bt{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 js{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 jo{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 Ns=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class ih extends c.l{}function No(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class hd{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:E,handler:B,allowed:Z}of this._handlers){if(!B.isEnabled())continue;let q;if(this._blockedByActive(w,Z,E))B.reset();else if(B[h||o.type]){if(c.cc(o,h||o.type)){const G=le.mousePos(this._map.getCanvas(),o);q=B[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=B[h||o.type](o,W,G)}else c.ce(h||o.type)||(q=B[h||o.type](o));this.mergeHandlerResult(_,x,q,E,f),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||B.isActive())&&(w[E]=B)}const I={};for(const E in this._previousActiveHandlers)w[E]||(I[E]=f);this._previousActiveHandlers=w,(Object.keys(I).length||No(_))&&(this._changes.push([_,x,I]),this._triggerRenderFrame()),(Object.keys(w).length||No(_))&&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 Ku(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 Dr(i,e));const o=i.boxZoom=new na(i,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const h=i.cooperativeGestures=new jo(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new od(i),_=new cd(i);i.doubleClickZoom=new lc(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new ud;this._add("tapDragZoom",x);const w=i.touchPitch=new eh(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 Te=new Ji({checkCorrectEvent:Se=>le.mouseButton(Se)===0&&Se.ctrlKey||le.mouseButton(Se)===2&&!Se.ctrlKey});return new Ja({clickTolerance:te,move:(Se,be)=>{const Be=de();if(se&&Math.abs(Be.y-Se.y)>ie)return{bearingDelta:c.ca(new c.P(Se.x,be.y),be,Be)};let Le=(be.x-Se.x)*pe;return se&&be.y<Be.y&&(Le=-Le),{bearingDelta:Le}},moveStateManager:Te,enable:ee,assignEvents:Qa})}(e,I),E=function({enable:ee,clickTolerance:te,pitchDegreesPerPixelMoved:se=-.5}){const ie=new Ji({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new Ja({clickTolerance:te,move:(pe,de)=>({pitchDelta:(de.y-pe.y)*se}),moveStateManager:ie,enable:ee,assignEvents:Qa})}(e),B=function({enable:ee,clickTolerance:te,rollDegreesPerPixelMoved:se=.3},ie){const pe=new Ji({checkCorrectEvent:de=>le.mouseButton(de)===2&&de.ctrlKey});return new Ja({clickTolerance:te,move:(de,Te)=>{const Se=ie();let be=(Te.x-de.x)*se;return Te.y<Se.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:Qa})}(e,I);i.dragRotate=new Bt(e,z,E,B),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",B,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const Z=function({enable:ee,clickTolerance:te}){const se=new Ji({checkCorrectEvent:ie=>le.mouseButton(ie)===0&&!ie.ctrlKey});return new Ja({clickTolerance:te,move:(ie,pe)=>({around:pe,panDelta:pe.sub(ie)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:Qa})}(e),q=new Ju(e,i);i.dragPan=new Qr(s,Z,q),this._add("mousePan",Z),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const G=new Qu,W=new ft;i.touchZoomRotate=new js(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 th(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const Q=i.keyboard=new ac(i);this._add("keyboard",Q),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Xu(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!!Ns(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(!(No(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);o._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:w,pitchDelta:I,rollDelta:z,around:E,pinchAround:B}=e;B!==void 0&&(E=B),E=E||o.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const Z={panDelta:_,zoomDelta:x,rollDelta:z,pitchDelta:I,bearingDelta:w,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const q=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?E.sub(_):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(Z,h,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(Z,h,q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._map.cameraHelper.handleMapControlsPan(Z,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=Ns(this._eventsInProgress),h=Ns(e),f={};for(const z in e){const{originalEvent:E}=e[z];this._eventsInProgress[z]||(f[`${z}start`]=E),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:E}=e[z];this._fireEvent(z,E)}const _={};let x;for(const z in this._eventsInProgress){const{handlerName:E,originalEvent:B}=this._eventsInProgress[z];this._handlersById[E].isActive()||(delete this._eventsInProgress[z],x=i[E]||B,_[`${z}end`]=x)}for(const z in _)this._fireEvent(z,_[z]);const w=Ns(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),E=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!z||!z.essential&&Ae.prefersReducedMotion?(this._map.fire(new c.l("moveend",{originalEvent:x})),E(this._map.getBearing())&&this._map.resetNorth()):(E(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 ih("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Lr 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=Qt.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 Qt(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),E=c.ab(this.transform.cameraToCenterDistance/I/this.transform.tileSize),B=180*Math.atan2(_,-x)/Math.PI;let Z=180*Math.acos(z/I)/Math.PI;return Z=w<0?90-Z:90+Z,{center:f.toLngLat(),elevation:o,zoom:E,pitch:Z,bearing:B}}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 E,B;e.around&&(E=c.Q.convert(e.around),B=s.locationToScreenPoint(E));const Z={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:E,aroundPoint:B,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,Z),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 be=c.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,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,E=c.P.convert(e.offset);let B=s.centerPoint.add(E);const Z=s.screenPointToLocation(B),q=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:w,roll:I,padding:z,locationAtOffset:Z,offsetAsPoint:E,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(be){const Be=(K*K-W*W+(be?-1:1)*ee*ee*Q*Q)/(2*(be?K:W)*ee*Q);return Math.log(Math.sqrt(Be*Be+1)-Be)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function ie(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=te(!1);let de=function(be){return ie(pe)/ie(pe+G*be)},Te=function(be){return W*((ie(pe)*(se(Be=pe+G*be)/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 be=K<W?-1:1;Se=Math.abs(Math.log(K/W))/G,Te=()=>0,de=Be=>Math.exp(be*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(be=>{const Be=be*Se,Le=1/de(Be),Me=Te(Be);this._rotating&&s.setBearing(c.B.number(o,x,be)),this._pitching&&s.setPitch(c.B.number(h,w,be)),this._rolling&&s.setRoll(c.B.number(f,I,be)),this._padding&&(s.interpolatePadding(_,z,be),B=s.centerPoint.add(E)),q.easeFunc(be,Le,Me,B),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const 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 Zs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Xe{constructor(e=Zs){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 Zo{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 cc=c.aD([{name:"a_pos3d",type:"Int16",components:3}]);class uc 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 zr(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),E=e.canonical.y-(h.canonical.y>>x),B=c.Z>>x;c.bO(_,0,B,B,0,0,1),c.L(_,_,[-w*B+z*c.Z,-I*B+E*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,E=(e.canonical.y>>x)-h.canonical.y,B=c.Z<<x;c.bO(_,0,B,B,0,0,1),c.L(_,_,[w*c.Z+z*B,I*c.Z+E*B,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 uc(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]),E=w[0]-I,B=w[1]-z;return _.get(I,z)*(1-E)*(1-B)+_.get(I+1,z)*E*(1-B)+_.get(I,z+1)*(1-E)*B+_.get(I+1,z+1)*E*B}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 Ct(o,h,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ct(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 Ct(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 Ct(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 Ct(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 Ct(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 E=this._coordsTextureSize,B=(1<<z.tileID.canonical.z)*E;return new c.$((z.tileID.canonical.x*E+x)/B+z.tileID.wrap,(z.tileID.canonical.y*E+w)/B,this.getElevation(z.tileID,x,w,E))}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,E=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<E;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 B=x.length,Z=B+(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,Z+ie,Z+ie+1),w.emplaceBack(q+ie,Z+ie+1,q+ie+1),w.emplaceBack(0+ie,B+ie+1,B+ie),w.emplaceBack(0+ie,0+ie+1,B+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 Kn(_.createVertexBuffer(x,cc.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 rh{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 Ct(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 Bi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class dd{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new rh(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 gr?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(Bi[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(Bi[o]&&(this._prevType&&Bi[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(Bi[this._prevType]||Bi[o]&&f){this._prevType=o;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const w of this._renderableTiles){if(this.pool.isFull()&&(Bo(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 E=h.style._layers[x[z]],B=E.source?this._coordsAscending[E.source][w.tileID.key]:[w.tileID];h.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),h._renderTileClippingMasks(E,B,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,B,s),E.source&&(w.rttCoords[E.source]=this._coordsAscendingStr[E.source][w.tileID.key])}}return Bo(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),Bi[o]}return!1}}const Vs={"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"},Wt=_e,ti={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Zs,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},nh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Us{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 Yu;this._rotatePitchHanlder=new Ja({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 Fr;function Vo(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 $s={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 Uo(u,e,i){const s=u.classList;for(const o in $s)s.remove(`maplibregl-${i}-anchor-${o}`);s.add(`maplibregl-${i}-anchor-${e}`)}class sa 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?Vo(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,`${$s[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 E=le.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),z.appendChild(E);const B=le.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const Z=le.createNS("http://www.w3.org/2000/svg","g");Z.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"),Z.appendChild(q),Z.appendChild(G),f.appendChild(_),f.appendChild(w),f.appendChild(z),f.appendChild(B),f.appendChild(Z),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()}),Uo(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 hc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let es=0,oa=!1;const dc={maxWidth:100,unit:"metric"};function $o(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?la(e,w,z/5280,u._getUIString("ScaleControl.Miles")):la(e,w,z,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?la(e,w,I/1852,u._getUIString("ScaleControl.NauticalMiles")):I>=1e3?la(e,w,I/1e3,u._getUIString("ScaleControl.Kilometers")):la(e,w,I,u._getUIString("ScaleControl.Meters"))}function la(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 pc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},fc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Gs(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 Gs(new c.P(0,0))}const mc=_e;S.AJAXError=c.cm,S.Event=c.l,S.Evented=c.E,S.LngLat=c.Q,S.MercatorCoordinate=c.$,S.Point=c.P,S.addProtocol=c.cn,S.config=c.a,S.removeProtocol=c.co,S.AttributionControl=Xe,S.BoxZoomHandler=na,S.CanvasSource=Ta,S.CooperativeGesturesHandler=jo,S.DoubleClickZoomHandler=lc,S.DragPanHandler=Qr,S.DragRotateHandler=Bt,S.EdgeInsets=Zt,S.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()}},S.GeoJSONSource=yn,S.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=Qt.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&&oa)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 sa({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new sa({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({},hc,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(Fr!==void 0&&!e)return Fr;if(window.navigator.permissions===void 0)return Fr=!!window.navigator.geolocation,Fr;try{Fr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Fr=!!window.navigator.geolocation}return Fr})}().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,es=0,oa=!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":es--,oa=!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"),es++,es>1?(u={maximumAge:6e5,timeout:0},oa=!0):(u=this.options.positionOptions,oa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=tc,S.ImageSource=gr,S.KeyboardHandler=ac,S.LngLatBounds=Qt,S.LogoControl=tt,S.Map=class extends Lr{constructor(u){var e,i;c.cj.mark(c.ck.create);const s=Object.assign(Object.assign(Object.assign({},ti),u),{canvasContextAttributes:Object.assign(Object.assign({},ti.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 Vt,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 Zo,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({},Vs),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=At.addThrottleControl(()=>this.isMoving()),this._requestManager=new Xi(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=ec(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 hd(this,s),this._hash=s.hash&&new tc(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(Qt.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 Ai(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 Ai(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ai(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 Oa(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 Oa(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 dd(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:E}=e,B=e;return this.style.addImage(u,{data:new c.R({width:I,height:z},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:w,sdf:o,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:I,height:z,data:E}=Ae.getImageData(e);this.style.addImage(u,{data:new c.R({width:I,height:z},E),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 At.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 $u(i,this.transform),Ve.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,E=Ae.now();this.style.zoomHistory.update(z,E);const B=new c.C(z,{now:E,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Z=B.crossFadingFactor();Z===1&&Z===this._crossFadingFactor||(x=!0,this._crossFadingFactor=Z),this.style.update(B)}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),At.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===ju}(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 Wt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ai,S.MapTouchEvent=Ya,S.MapWheelEvent=cr,S.Marker=sa,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=c.e({},nh,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 Us(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends 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?Vo(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=Gs(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,`${$s[o]} translate(${f.x}px,${f.y}px)`),Uo(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(pc),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(fc);u&&u.focus()}},S.RasterDEMTileSource=_n,S.RasterTileSource=mr,S.ScaleControl=class{constructor(u){this._onMove=()=>{$o(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,$o(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},dc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=th,S.Style=Oa,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=eh,S.TwoFingersTouchRotateHandler=Qu,S.TwoFingersTouchZoomHandler=ft,S.TwoFingersTouchZoomRotateHandler=js,S.VectorTileSource=qn,S.VideoSource=_r,S.addSourceType=(u,e)=>c._(void 0,void 0,void 0,function*(){if(ys(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{Pa[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=ar;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(wa),ar=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},S.createTileMesh=fo,S.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return qr().getRTLTextPluginStatus()},S.getVersion=function(){return mc},S.getWorkerCount=function(){return Er.workerCount},S.getWorkerUrl=function(){return c.a.WORKER_URL},S.importScriptInWorkers=function(u){return $n().broadcast("IS",u)},S.prewarm=function(){Vn().acquire(wa)},S.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return qr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){Er.workerCount=u},S.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var O=T;return O})}(ou)),ou.exports}var wy=by();const Ty=xy(wy);var Py=Dh('<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&amp;display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded">',1),Sy=Dh('<div><div class="map svelte-h12vn1"></div> <div class="zooms svelte-h12vn1"><button class="button shadow-small svelte-h12vn1"><!></button> <button class="button shadow-small svelte-h12vn1"><!></button></div></div>');function lf(b,g){up(g,!0);let T=hs(g,"options",7),C,F,O=Dn(!1);o_(()=>{my.parse(T()),S(),c()});function S(){const Jt=T().position;C=new Ty.Map({style:_i(T().theme),center:{lat:Jt.center.lat,lng:Jt.center.lng},zoom:Jt.zoom,minZoom:le(window.innerWidth),maxZoom:yy,container:F,pitchWithRotate:!1,attributionControl:{compact:!1}})}function c(){C.on("load",_e),C.on("move",me),C.on("idle",ze),C.on("click",Ze),C.dragRotate.disable(),C.keyboard.disable(),C.touchZoomRotate.disableRotation(),C.touchPitch.disable()}function _e(){cn(O,!0)}function me(){}function ze(){}function Ze(Jt){}function Ae(){Ve(le(window.innerWidth))}function le(Jt){const $r=Math.ceil(Math.log2(Jt/gy));return Math.max(_y,$r)}function Ve(Jt){C==null||C.setMinZoom(Jt)}function Nt(){C==null||C.zoomIn()}function Gt(){C==null||C.zoomOut()}Mp(()=>{Nr(O)&&C.setStyle(_i(T().theme))});function _i(Jt){switch(Jt){case"light":return h_;case"dark":return u_}}function si(Jt){T().theme=Jt,C.setStyle(_i(Jt))}var ri=Sy();Xg(Jt=>{var pr=Py();Lh(Jt,pr)}),Hg("resize",Ih,Ae);var At=ol(ri);a_(At,Jt=>F=Jt,()=>F);var Xi=bp(At,2),ht=ol(Xi);ht.__mousedown=Nt;var bt=ol(ht);qp(bt,{name:"add"});var Ct=bp(ht,2);Ct.__mousedown=Gt;var jn=ol(Ct);return qp(jn,{name:"remove"}),Ip(()=>Up(ri,1,`container ${T().theme??""}`,"svelte-h12vn1")),Lh(b,ri),hp({setMapStyle:si})}Kg(["mousedown"]);function My(b){const T=(()=>{if(b.container instanceof HTMLElement)return b.container;if(typeof b.container=="string"){const C=document.getElementById(b.container);if(!C)throw new Error(`Container not found: ${b.container}`);return C}throw new Error("Invalid container")})();Qg(lf,{target:T,props:{options:b}})}ss.Map=lf,ss.mountMap=My,Object.defineProperty(ss,Symbol.toStringTag,{value:"Module"})});