@arenarium/maps 1.0.65 → 1.0.68

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
@@ -2,8 +2,8 @@
2
2
  \r\f \v\uFEFF`];function D_(v,g,b){var I=""+v;if(b){for(var A in b)if(b[A])I=I?I+" "+A:A;else if(I.length)for(var L=A.length,S=0;(S=I.indexOf(A,S))>=0;){var o=S+L;(S===0||wf.includes(I[S-1]))&&(o===I.length||wf.includes(I[o]))?I=(S===0?"":I.substring(0,S))+I.substring(o+1):S=o}}return I===""?null:I}function Tf(v,g=!1){var b=g?" !important;":";",I="";for(var A in v){var L=v[A];L!=null&&L!==""&&(I+=" "+A+": "+L+b)}return I}function dd(v){return v[0]!=="-"||v[1]!=="-"?v.toLowerCase():v}function L_(v,g){if(g){var b="",I,A;if(Array.isArray(g)?(I=g[0],A=g[1]):I=g,v){v=String(v).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var L=!1,S=0,o=!1,he=[];I&&he.push(...Object.keys(I).map(dd)),A&&he.push(...Object.keys(A).map(dd));var pe=0,Ce=-1;const Bt=v.length;for(var Le=0;Le<Bt;Le++){var Ie=v[Le];if(o?Ie==="/"&&v[Le-1]==="*"&&(o=!1):L?L===Ie&&(L=!1):Ie==="/"&&v[Le+1]==="*"?o=!0:Ie==='"'||Ie==="'"?L=Ie:Ie==="("?S++:Ie===")"&&S--,!o&&L===!1&&S===0){if(Ie===":"&&Ce===-1)Ce=Le;else if(Ie===";"||Le===Bt-1){if(Ce!==-1){var oe=dd(v.substring(pe,Ce).trim());if(!he.includes(oe)){Ie!==";"&&Le++;var Ve=v.substring(pe,Le).trim();b+=" "+Ve+";"}}pe=Le+1,Ce=-1}}}}return I&&(b+=Tf(I)),A&&(b+=Tf(A,!0)),b=b.trim(),b===""?null:b}return v==null?null:String(v)}function B_(v,g,b,I,A,L){var S=v.__className;if(S!==b||S===void 0){var o=D_(b,I,L);o==null?v.removeAttribute("class"):v.className=o,v.__className=b}else if(L&&A!==L)for(var he in L){var pe=!!L[he];(A==null||pe!==!!A[he])&&v.classList.toggle(he,pe)}return L}function pd(v,g={},b,I){for(var A in b){var L=b[A];g[A]!==L&&(b[A]==null?v.style.removeProperty(A):v.style.setProperty(A,L,I))}}function fd(v,g,b,I){var A=v.__style;if(A!==g){var L=L_(g,I);L==null?v.removeAttribute("style"):v.style.cssText=L,v.__style=g}else I&&(Array.isArray(I)?(pd(v,b==null?void 0:b[0],I[0]),pd(v,b==null?void 0:b[1],I[1],"important")):pd(v,b,I));return I}const F_=()=>performance.now(),Vn={tick:v=>requestAnimationFrame(v),now:()=>F_(),tasks:new Set};function Mf(){const v=Vn.now();Vn.tasks.forEach(g=>{g.c(v)||(Vn.tasks.delete(g),g.f())}),Vn.tasks.size!==0&&Vn.tick(Mf)}function O_(v){let g;return Vn.tasks.size===0&&Vn.tick(Mf),{promise:new Promise(b=>{Vn.tasks.add(g={c:v,f:b})}),abort(){Vn.tasks.delete(g)}}}const ju=class ju{constructor(g){ka(this,Ou);ka(this,ja,new WeakMap);ka(this,fo);ka(this,Ol);su(this,Ol,g)}observe(g,b){var I=Ti(this,ja).get(g)||new Set;return I.add(b),Ti(this,ja).set(g,I),Dg(this,Ou,Lg).call(this).observe(g,Ti(this,Ol)),()=>{var A=Ti(this,ja).get(g);A.delete(b),A.size===0&&(Ti(this,ja).delete(g),Ti(this,fo).unobserve(g))}}};ja=new WeakMap,fo=new WeakMap,Ol=new WeakMap,Ou=new WeakSet,Lg=function(){return Ti(this,fo)??su(this,fo,new ResizeObserver(g=>{for(var b of g){ju.entries.set(b.target,b);for(var I of Ti(this,ja).get(b.target)||[])I(b)}}))},$t(ju,"entries",new WeakMap);let md=ju;var j_=new md({box:"border-box"});function Cu(v,g,b){var I=j_.observe(v,()=>b(v[g]));yu(()=>(od(()=>b(v[g])),I))}function Sf(v,g){return v===g||(v==null?void 0:v[pu])===g}function ms(v={},g,b,I){return yu(()=>{var A,L;return of(()=>{A=L,L=[],od(()=>{v!==b(...L)&&(g(v,...L),A&&Sf(b(...A),v)&&g(null,...A))})}),()=>{pf(()=>{L&&Sf(b(...L),v)&&g(null,...L)})}}),v}function Pf(v){Dr===null&&e_(),sa(()=>{const g=od(v);if(typeof g=="function")return g})}const N_="5";typeof window<"u"&&((Kf=window.__svelte??(window.__svelte={})).v??(Kf.v=new Set)).add(N_);function Cf(v){return Object.prototype.toString.call(v)==="[object Date]"}function Z_(v){return v}function gd(v){return-.5*(Math.cos(Math.PI*v)-1)}function _d(v,g){if(v===g||v!==v)return()=>v;const b=typeof v;if(b!==typeof g||Array.isArray(v)!==Array.isArray(g))throw new Error("Cannot interpolate values of different type");if(Array.isArray(v)){const I=g.map((A,L)=>_d(v[L],A));return A=>I.map(L=>L(A))}if(b==="object"){if(!v||!g)throw new Error("Object cannot be null");if(Cf(v)&&Cf(g)){const L=v.getTime(),o=g.getTime()-L;return he=>new Date(L+he*o)}const I=Object.keys(g),A={};return I.forEach(L=>{A[L]=_d(v[L],g[L])}),L=>{const S={};return I.forEach(o=>{S[o]=A[o](L)}),S}}if(b==="number"){const I=g-v;return A=>v+A*I}return()=>g}const Cd=class Cd{constructor(g,b={}){ka(this,ua,id(void 0));ka(this,mo,id(void 0));ka(this,jl);ka(this,vs,null);Ti(this,ua).v=Ti(this,mo).v=g,su(this,jl,b)}static of(g,b){const I=new Cd(g(),b);return of(()=>{I.set(g())}),I}set(g,b){var Le;Si(Ti(this,mo),g);let{delay:I=0,duration:A=400,easing:L=Z_,interpolate:S=_d}={...Ti(this,jl),...b};if(A===0)return(Le=Ti(this,vs))==null||Le.abort(),Si(Ti(this,ua),g),Promise.resolve();const o=Vn.now()+I;let he,pe=!1,Ce=Ti(this,vs);return su(this,vs,O_(Ie=>{if(Ie<o)return!0;if(!pe){pe=!0;const Ve=Ti(this,ua).v;he=S(Ve,g),typeof A=="function"&&(A=A(Ve,g)),Ce==null||Ce.abort()}const oe=Ie-o;return oe>A?(Si(Ti(this,ua),g),!1):(Si(Ti(this,ua),he(L(oe/A))),!0)})),Ti(this,vs).promise}get current(){return _t(Ti(this,ua))}get target(){return _t(Ti(this,mo))}set target(g){this.set(g)}};ua=new WeakMap,mo=new WeakMap,jl=new WeakMap,vs=new WeakMap;let vl=Cd;function If(v,g,b){const I=b*(Math.PI/180),A=v/2,L=g/2,S=Math.sqrt(A*A+L*L),o=Math.atan(L/A)*(180/Math.PI),he=o,pe=180-o,Ce=180+o,Le=360-o;switch(!0){case(he<=b&&b<=pe):return{offsetX:S*Math.cos(I)-A,offsetY:0};case(pe<=b&&b<=Ce):return{offsetX:-v,offsetY:S*Math.sin(I)-L};case(Ce<=b&&b<=Le):return{offsetX:S*Math.cos(I)-A,offsetY:-g};default:return{offsetX:0,offsetY:S*Math.sin(I)-L}}}function V_(v,g,b){const I=If(v,g,b),A=I.offsetX,L=I.offsetY,S=g,o=v,he=If(S,o,b),pe=S/2+he.offsetX,Ce=o/2+he.offsetY,Ie=Math.atan2(Ce,pe)/Math.PI*180-45,oe=0,Ve=30,Bt=A+v/2,ri=L+g/2,Ft=Math.sqrt(Bt*Bt+ri*ri),oi=Math.min(v,g)/2,Oi=Math.sqrt(v*v+g*g)/2,ni=(Ft-oi)/(Oi-oi),Zt=oe+ni*(Ve-oe);return{markerOffsetX:A,markerOffsetY:L,pinAngleDeg:Ie,pinSkewDeg:Zt}}const Ef=512,yd=0,bl=18,kf=10,zf=3,U_=.5,xd=270,$_=8;var G_=ld('<div><div class="pin svelte-ouiy4e"></div> <div class="marker svelte-ouiy4e"><div class="body svelte-ouiy4e"></div></div></div>');function q_(v,g){mu(g,!0);let b,I,A,L;const S=()=>L;let o=dr(!0);function he(Qe){Si(o,Qe,!0)}function pe(){return _t(o)}let Ce=0,Le=0,Ie=new vl(0,{easing:gd});sa(()=>{Le=Ie.current});function oe(Qe){const pi=Qe?0:1;Ce!=pi&&(Ce=pi,Ie.set(Ce,{duration:200}),window.requestAnimationFrame(Ot))}function Ve(){return Ce==0}function Bt(){return Ce>0}let ri=xd,Ft=xd,oi=new vl(xd,{easing:gd,interpolate:ni}),Oi=!1;sa(()=>{Ft=oi.current});function ni(Qe,pi){if(Math.abs(pi-Qe)<180)return fi=>Qe+fi*(pi-Qe);{const fi=360-Math.abs(pi-Qe),Cr=Qe<pi?-1:1;return ki=>(360+Qe+ki*fi*Cr)%360}}function Zt(Qe){Qe!=ri&&(ri=Qe,Oi?(oi.set(Qe,{duration:400}),window.requestAnimationFrame(Ot)):(oi.set(Qe,{duration:0}),Ft=Qe,Ot())),Oi=!0}sa(()=>{_t(o)==!1&&(Ie.set(Ce,{duration:0}),Le=Ce,oi.set(ri,{duration:0}),Ft=ri,Wi(Ft,Le))});function Ot(){(ri!=Ft||Ce!=Le)&&(Wi(Ft,Le),window.requestAnimationFrame(Ot))}function Wi(Qe,pi){if(!b||!I||!A)return;const fi=V_(_t(Et),_t(nr),Qe),Cr=Math.round(fi.markerOffsetX),ki=Math.round(fi.markerOffsetY);I.style.transform=`translate(${Cr}px, ${ki}px)`,I.style.scale=`${pi}`;const vn=fi.pinAngleDeg,Zi=fi.pinSkewDeg;A.style.transform=`rotate(${vn}deg) skew(${Zi}deg, ${Zi}deg)`,A.style.scale=`${pi}`;const Vt=-1-2*(Cr/_t(Et)),Ki=-1-2*(ki/_t(nr));b.style.filter=`drop-shadow(0px 0px 4px rgba(0,0,0,0.4)) drop-shadow(${Vt}px ${Ki}px 2px rgba(0,0,0,0.4))`,b.style.opacity=`${pi}`}let Et=dr(0),nr=dr(0);sa(()=>{_t(Et)&&_t(nr)&&(A.style.width=`${Math.min(_t(Et),_t(nr))/4}px`,A.style.height=`${Math.min(_t(Et),_t(nr))/4}px`)}),sa(()=>{_t(Et)&&_t(nr)&&Wi(Ft,Le)});const qn=()=>_t(Et),Lr=()=>_t(nr);var ji=G_();let Xi;var xi=_u(ji);ms(xi,Qe=>A=Qe,()=>A);var Pr=a_(xi,2);fd(Pr,"",{},{padding:$_+"px"});var Ni=_u(Pr);let Br;return ms(Ni,Qe=>L=Qe,()=>L),ms(Pr,Qe=>I=Qe,()=>I),ms(ji,Qe=>b=Qe,()=>b),lf(Qe=>{Xi=B_(ji,1,"anchor svelte-ouiy4e",null,Xi,Qe),Br=fd(Ni,"",Br,{width:`${g.width}px`,height:`${g.height}px`})},[()=>({hidden:!_t(o)})]),Cu(Pr,"clientWidth",Qe=>Si(Et,Qe)),Cu(Pr,"clientHeight",Qe=>Si(nr,Qe)),cd(v,ji),gu({getBody:S,setDisplayed:he,getDisplayed:pe,setCollapsed:oe,getCollapsed:Ve,getExpanded:Bt,setAngle:Zt,getWidth:qn,getHeight:Lr})}var H_=ld('<div class="circle svelte-21dq3m"><div class="pin svelte-21dq3m"></div></div>');function W_(v,g){mu(g,!0);let b,I;const A=()=>I;let L=0,S=0,o=new vl(0,{easing:gd});sa(()=>{S=o.current}),sa(()=>{pe(S)});function he(){L!=S&&(pe(S),window.requestAnimationFrame(he))}function pe(oe){b.style.scale=`${oe}`,b.style.filter=`brightness(${.4+.6*oe})`}function Ce(oe){L!=oe&&(L=oe,o.set(L,{duration:200}),window.requestAnimationFrame(he))}var Le=H_(),Ie=_u(Le);return ms(Ie,oe=>I=oe,()=>I),ms(Le,oe=>b=oe,()=>b),cd(v,Le),gu({getPin:A,setScale:Ce})}function X_(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var Iu={exports:{}};/**
3
3
  * MapLibre GL JS
4
4
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.4.0/LICENSE.txt
5
- */var K_=Iu.exports,Af;function Y_(){return Af||(Af=1,function(v,g){(function(b,I){v.exports=I()})(K_,function(){var b={},I={};function A(S,o,he){if(I[S]=he,S==="index"){var pe="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",Ce={};return I.shared(Ce),I.index(b,Ce),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"}))),b}}A("shared",["exports"],function(S){function o(r,t,n,a){return new(n||(n=Promise))(function(c,d){function p(w){try{y(a.next(w))}catch(M){d(M)}}function m(w){try{y(a.throw(w))}catch(M){d(M)}}function y(w){var M;w.done?c(w.value):(M=w.value,M instanceof n?M:new n(function(C){C(M)})).then(p,m)}y((a=a.apply(r,t||[])).next())})}function he(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var pe,Ce;function Le(){if(Ce)return pe;function r(t,n){this.x=t,this.y=n}return Ce=1,pe=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,n){return this.clone()._rotateAround(t,n)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,a=t.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var n=Math.cos(t),a=Math.sin(t),c=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,n){var a=Math.cos(t),c=Math.sin(t),d=n.y+c*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-c*(this.y-n.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t},pe}typeof SuppressedError=="function"&&SuppressedError;var Ie,oe,Ve=he(Le()),Bt=function(){if(oe)return Ie;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return oe=1,Ie=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(n===void 0&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},Ie}(),ri=he(Bt);let Ft,oi;function Oi(){return Ft==null&&(Ft=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ft}function ni(){if(oi==null&&(oi=!1,Oi())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const n=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&n[a]!==a){oi=!0;break}}}return oi||!1}var Zt=1e-6,Ot=typeof Float32Array<"u"?Float32Array:Array;function Wi(){var r=new Ot(9);return Ot!=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 Et(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 nr(){var r=new Ot(3);return Ot!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function qn(r){return Math.hypot(r[0],r[1],r[2])}function Lr(r,t,n){var a=new Ot(3);return a[0]=r,a[1]=t,a[2]=n,a}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});var ji,Xi=qn;function xi(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3];return r[0]=n[0]*a+n[4]*c+n[8]*d+n[12]*p,r[1]=n[1]*a+n[5]*c+n[9]*d+n[13]*p,r[2]=n[2]*a+n[6]*c+n[10]*d+n[14]*p,r[3]=n[3]*a+n[7]*c+n[11]*d+n[15]*p,r}function Pr(){var r=new Ot(4);return Ot!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ni(){var r=new Ot(2);return Ot!=Float32Array&&(r[0]=0,r[1]=0),r}function Br(r,t){var n=new Ot(2);return n[0]=r,n[1]=t,n}nr(),ji=new Ot(4),Ot!=Float32Array&&(ji[0]=0,ji[1]=0,ji[2]=0,ji[3]=0),nr(),Lr(1,0,0),Lr(0,1,0),Pr(),Pr(),Wi(),Ni();const Qe=8192;function pi(r,t,n){return t*(Qe/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function fi(r,t){return(r%t+t)%t}function Cr(r,t,n){return r*(1-n)+t*n}function ki(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 vn(r,t,n,a){const c=new ri(r,t,n,a);return d=>c.solve(d)}const Zi=vn(.25,.1,.25,1);function Vt(r,t,n){return Math.min(n,Math.max(t,r))}function Ki(r,t,n){const a=n-t,c=((r-t)%a+a)%a+t;return c===t?n:c}function Yi(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let bn=1;function nn(r,t,n){const a={};for(const c in r)a[c]=t.call(this,r[c],c,r);return a}function ha(r,t,n){const a={};for(const c in r)t.call(this,r[c],c,r)&&(a[c]=r[c]);return a}function ar(r){return Array.isArray(r)?r.map(ar):typeof r=="object"&&r?nn(r,ar):r}const sr={};function Vi(r){sr[r]||(typeof console<"u"&&console.warn(r),sr[r]=!0)}function Nt(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function Fr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let an=null;function fr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const wn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Tn(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(w,M,C,z,D){const B=4*Math.max(1,0),j=(Math.max(0,C)-C)*z*4+B,$=4*z,X=Math.max(0,M),ae=Math.max(0,C);return{rect:{x:X,y:ae,width:Math.min(w.width,M+z)-X,height:Math.min(w.height,C+D)-ae},layout:[{offset:j,stride:$}]}}(r,t,n,a,c)),m)for(let w=0;w<y.length;w+=4){const M=y[w];y[w]=y[w+2],y[w+2]=M}return y}finally{d.close()}})}let Ee,Je;function Ue(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function ft(r){return r/Math.PI*180}const Gt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},or={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},mi="AbortError";function mr(){return new Error(mi)}const gr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function da(r){return gr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Mn="global-dispatcher";class Hn extends Error{constructor(t,n,a,c){super(`AJAXError: ${n} (${t}): ${a}`),this.status=t,this.statusText=n,this.url=a,this.body=c}}const sn=()=>Fr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,_r=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=da(r.url);if(a)return a(r,t);if(Fr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Mn},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(sn())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:sn(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Hn(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Hn(p.status,p.statusText,a.url,w)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw mr();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if(Fr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Mn},t)}var n;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const w in a.headers)y.setRequestHeader(w,a.headers[w]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let w=y.response;if(a.type==="json")try{w=JSON.parse(y.response)}catch(M){return void p(M)}d({data:w,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const w=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Hn(y.status,y.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{y.abort(),p(mr())}),y.send(a.body)})}(r,t)};function Sn(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 ce(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function N(r,t,n){if(n&&n[r]){const a=n[r].indexOf(t);a!==-1&&n[r].splice(a,1)}}class Z{constructor(t,n={}){Yi(this,n),this.type=t}}class G extends Z{constructor(t,n={}){super("error",Yi({error:t},n))}}class J{on(t,n){return this._listeners=this._listeners||{},ce(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return N(t,n,this._listeners),N(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},ce(t,n,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,n){typeof t=="string"&&(t=new Z(t,n||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)N(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Yi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof G&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,n){return this._eventedParent=t,this._eventedParentData=n,this}}var V={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const le=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ge(r,t){const n={};for(const a in r)a!=="ref"&&(n[a]=r[a]);return le.forEach(a=>{a in t&&(n[a]=t[a])}),n}function ie(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!ie(r[n],t[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const n in r)if(!ie(r[n],t[n]))return!1;return!0}return r===t}function _e(r,t){r.push(t)}function xe(r,t,n){_e(n,{command:"addSource",args:[r,t[r]]})}function ue(r,t,n){_e(t,{command:"removeSource",args:[r]}),n[r]=!0}function ze(r,t,n,a){ue(r,n,a),xe(r,t,n)}function Ne(r,t,n){let a;for(a in r[n])if(Object.prototype.hasOwnProperty.call(r[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;return!0}function Ze(r,t,n,a,c,d){r=r||{},t=t||{};for(const p in r)Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}))}function nt(r){return r.id}function dt(r,t){return r[t.id]=t,r}class we{constructor(t,n,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function st(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}class St 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,c]of n)this.bindings[a]=c}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 Pt={kind:"null"},Pe={kind:"number"},Ge={kind:"string"},tt={kind:"boolean"},lr={kind:"color"},Ji={kind:"projectionDefinition"},Qt={kind:"object"},ct={kind:"value"},bs={kind:"collator"},pa={kind:"formatted"},go={kind:"padding"},Wn={kind:"resolvedImage"},_o={kind:"variableAnchorOffsetCollection"};function zi(r,t){return{kind:"array",itemType:r,N:t}}function qt(r){if(r.kind==="array"){const t=qt(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const Ai=[Pt,Pe,Ge,tt,lr,Ji,pa,Qt,zi(ct),go,Wn,_o];function ws(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!ws(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 Ai)if(!ws(n,t))return null}}return`Expected ${qt(r)} but found ${qt(t)} instead.`}function yo(r,t){return t.some(n=>n.kind===r.kind)}function Gr(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 fa(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const Nu=.96422,Zu=.82521,Nl=4/29,Na=6/29,Zl=3*Na*Na,Id=Na*Na*Na,Ed=Math.PI/180,kd=180/Math.PI;function Vu(r){return(r%=360)<0&&(r+=360),r}function Uu([r,t,n,a]){let c,d;const p=Ul((.2225045*(r=Vl(r))+.7168786*(t=Vl(t))+.0606169*(n=Vl(n)))/1);r===t&&t===n?c=d=p:(c=Ul((.4360747*r+.3850649*t+.1430804*n)/Nu),d=Ul((.0139322*r+.0971045*t+.7141733*n)/Zu));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function Vl(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Ul(r){return r>Id?Math.pow(r,1/3):r/Zl+Nl}function $l([r,t,n,a]){let c=(r+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(n)?c:c-n/200;return c=1*Gl(c),d=Nu*Gl(d),p=Zu*Gl(p),[ma(3.1338561*d-1.6168667*c-.4906146*p),ma(-.9787684*d+1.9161415*c+.033454*p),ma(.0719453*d-.2289914*c+1.4052427*p),a]}function ma(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Gl(r){return r>Na?r*r*r:Zl*(r-Nl)}function xo(r){return parseInt(r.padEnd(2,r),16)/255}function Za(r,t){return Va(t?r/100:r,0,1)}function Va(r,t,n){return Math.min(Math.max(t,r),n)}function $u(r){return!r.some(Number.isNaN)}const zd={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 Pn(r,t,n){return r+n*(t-r)}function Ua(r,t,n){return r.map((a,c)=>Pn(a,t[c],n))}class gt{constructor(t,n,a,c=1,d=!0){this.r=t,this.g=n,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,n,a,c]))}static parse(t){if(t instanceof gt)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=zd[a];if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[xo(a.slice(m,m+=p)),xo(a.slice(m,m+=p)),xo(a.slice(m,m+=p)),xo(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,w,M,C,z,D,B,j,$,X,ae]=p,Y=[M||" ",D||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const R=[w,z,j].join(""),U=R==="%%%"?100:R===""?255:0;if(U){const Q=[Va(+y/U,0,1),Va(+C/U,0,1),Va(+B/U,0,1),X?Za(+X,ae):1];if($u(Q))return Q}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,w,M,C,z,D,B]=d,j=[y||" ",M||" ",z].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const $=[+m,Va(+w,0,100),Va(+C,0,100),D?Za(+D,B):1];if($u($))return function([X,ae,Y,R]){function U(Q){const fe=(Q+X/30)%12,Ae=ae*Math.min(Y,1-Y);return Y-Ae*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=Vu(X),ae/=100,Y/=100,[U(0),U(8),U(4),R]}($)}}}(t);return n?new gt(...n,!1):void 0}get rgb(){const{r:t,g:n,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,n/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[n,a,c,d]=Uu(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Vu(Math.atan2(c,a)*kd):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Uu(this.rgb))}overwriteGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}toString(){const[t,n,a,c]=this.rgb;return`rgba(${[t,n,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,n,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=Ua(t.rgb,n.rgb,a);return new gt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[w,M,C,z]=n.hcl;let D,B;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?D=NaN:(D=w,m!==1&&m!==0||(B=M)):(D=d,C!==1&&C!==0||(B=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),D=d+a*Y}const[j,$,X,ae]=function([Y,R,U,Q]){return Y=isNaN(Y)?0:Y*Ed,$l([U,Math.cos(Y)*R,Math.sin(Y)*R,Q])}([D,B??Pn(p,M,a),Pn(m,C,a),Pn(y,z,a)]);return new gt(j,$,X,ae,!1)}case"lab":{const[d,p,m,y]=$l(Ua(t.lab,n.lab,a));return new gt(d,p,m,y,!1)}}}}gt.black=new gt(0,0,0,1),gt.white=new gt(1,1,1,1),gt.transparent=new gt(0,0,0,0),gt.red=new gt(1,0,0,1);class Tt{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 $a=["bottom","center","top"];class on{constructor(t,n,a,c,d,p){this.text=t,this.image=n,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class yr{constructor(t){this.sections=t}static fromString(t){return new yr([new on(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 yr?t:yr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Qi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Qi)return t;if(typeof t=="number")return new Qi([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 Qi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new Qi(Ua(t.values,n.values,a))}}class li{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Ts=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ui{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ui)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let n=0;n<t.length;n+=2){const a=t[n],c=t[n+1];if(typeof a!="string"||!Ts.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Ui(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){const c=t.values,d=n.values;if(c.length!==d.length)throw new li(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new li(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,w]=c[m+1],[M,C]=d[m+1];p.push([Pn(y,M,a),Pn(w,C,a)])}return new Ui(p)}}class Ir{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ir({name:t,available:!1}):null}}class cr{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new cr(t,n,a)}static parse(t){return t instanceof cr?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new cr(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new cr(t.from,t.to,t.transition):typeof t=="string"?new cr(t,t,1):void 0}}function Xn(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 Ms(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof cr||r instanceof gt||r instanceof Tt||r instanceof yr||r instanceof Qi||r instanceof Ui||r instanceof Ir)return!0;if(Array.isArray(r)){for(const t of r)if(!Ms(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Ms(r[t]))return!1;return!0}return!1}function ci(r){if(r===null)return Pt;if(typeof r=="string")return Ge;if(typeof r=="boolean")return tt;if(typeof r=="number")return Pe;if(r instanceof gt)return lr;if(r instanceof cr)return Ji;if(r instanceof Tt)return bs;if(r instanceof yr)return pa;if(r instanceof Qi)return go;if(r instanceof Ui)return _o;if(r instanceof Ir)return Wn;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const c=ci(a);if(n){if(n===c)continue;n=ct;break}n=c}return zi(n||ct,t)}return Qt}function ln(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof gt||r instanceof cr||r instanceof yr||r instanceof Qi||r instanceof Ui||r instanceof Ir?r.toString():JSON.stringify(r)}class Kn{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(!Ms(t[1]))return n.error("invalid value");const a=t[1];let c=ci(a);const d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new Kn(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ss={string:Ge,number:Pe,boolean:tt,object:Qt};class Or{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in Ss)||w==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ss[w],c++}else m=ct;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],c++}a=zi(m,y)}else{if(!Ss[d])throw new Error(`Types doesn't contain name = ${d}`);a=Ss[d]}const p=[];for(;c<t.length;c++){const m=n.parse(t[c],c,ct);if(!m)return null;p.push(m)}return new Or(a,p)}evaluate(t){for(let n=0;n<this.args.length;n++){const a=this.args[n].evaluate(t);if(!ws(this.type,ci(a)))return a;if(n===this.args.length-1)throw new li(`Expected value to be of type ${qt(this.type)}, but found ${qt(ci(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Ps={"to-boolean":tt,"to-color":lr,"to-number":Pe,"to-string":Ge};class zt{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(!Ps[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return n.error("Expected one argument.");const c=Ps[a],d=[];for(let p=1;p<t.length;p++){const m=n.parse(t[p],p,ct);if(!m)return null;d.push(m)}return new zt(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let n,a;for(const c of this.args){if(n=c.evaluate(t),a=null,n instanceof gt)return n;if(typeof n=="string"){const d=t.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(a=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:Xn(n[0],n[1],n[2],n[3]),!a))return new gt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new li(a||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const a of this.args){n=a.evaluate(t);const c=Qi.parse(n);if(c)return c}throw new li(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const a of this.args){n=a.evaluate(t);const c=Ui.parse(n);if(c)return c}throw new li(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const a of this.args){if(n=a.evaluate(t),n===null)return 0;const c=Number(n);if(!isNaN(c))return c}throw new li(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return yr.fromString(ln(this.args[0].evaluate(t)));case"resolvedImage":return Ir.fromString(ln(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return ln(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ql=["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"?ql[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let n=this._parseColorCache[t];return n||(n=this._parseColorCache[t]=gt.parse(t)),n}}class pt{constructor(t,n,a=[],c,d=new Rt,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=n}parse(t,n,a,c,d={}){return n?this.concat(n,a,c)._parse(t,d):this._parse(t,d)}_parse(t,n){function a(c,d,p){return p==="assert"?new Or(d,[c]):p==="coerce"?new zt(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value")if(m.kind!=="projectionDefinition"||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 Kn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new Ct;try{p=new Kn(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,n,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new pt(this.registry,this._isConstant,c,n||null,d,this.errors)}error(t,...n){const a=`${this.key}${n.map(c=>`[${c}]`).join("")}`;this.errors.push(new St(a,t))}checkSubtype(t,n){const a=ws(t,n);return a&&this.error(a),a}}class Ga{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 c=n.parse(t[t.length-1],t.length-1,n.expectedType,a);return c?new Ga(a,c):null}outputDefined(){return this.result.outputDefined()}}class Mt{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 Mt(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 Cs{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,Pe),c=n.parse(t[2],2,zi(n.expectedType||ct));return a&&c?new Cs(c.type.itemType,a,c):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new li(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new li(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new li(`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 qr{constructor(t,n){this.type=tt,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,ct),c=n.parse(t[2],2,ct);return a&&c?yo(a.type,[tt,Ge,Pe,Pt,ct])?new qr(a,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!Gr(n,["boolean","string","number","null"]))throw new li(`Expected first argument to be of type boolean, string, number or null, but found ${qt(ci(n))} instead.`);if(!Gr(a,["string","array"]))throw new li(`Expected second argument to be of type array or string, but found ${qt(ci(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class qa{constructor(t,n,a){this.type=Pe,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,ct),c=n.parse(t[2],2,ct);if(!a||!c)return null;if(!yo(a.type,[tt,Ge,Pe,Pt,ct]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Pe);return d?new qa(a,c,d):null}return new qa(a,c)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!Gr(n,["boolean","string","number","null"]))throw new li(`Expected first argument to be of type boolean, string, number or null, but found ${qt(ci(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),Gr(a,["string"])){const d=a.indexOf(n,c);return d===-1?-1:[...a.slice(0,d)].length}if(Gr(a,["array"]))return a.indexOf(n,c);throw new li(`Expected second argument to be of type array or string, but found ${qt(ci(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class vo{constructor(t,n,a,c,d,p){this.inputType=t,this.type=n,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let a,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const C=t[w+1];Array.isArray(M)||(M=[M]);const z=n.concat(w);if(M.length===0)return z.error("Expected at least one branch label.");for(const B of M){if(typeof B!="number"&&typeof B!="string")return z.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return z.error("Numeric branch labels must be integer values.");if(a){if(z.checkSubtype(a,ci(B)))return null}else a=ci(B);if(d[String(B)]!==void 0)return z.error("Branch labels must be unique.");d[String(B)]=p.length}const D=n.parse(C,w,c);if(!D)return null;c=c||D.type,p.push(D)}const m=n.parse(t[1],1,ct);if(!m)return null;const y=n.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&n.concat(1).checkSubtype(a,m.type)?null:new vo(a,c,m,d,p,y):null}evaluate(t){const n=this.input.evaluate(t);return(ci(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 bo{constructor(t,n,a){this.type=t,this.branches=n,this.otherwise=a}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let a;n.expectedType&&n.expectedType.kind!=="value"&&(a=n.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=n.parse(t[p],p,tt);if(!m)return null;const y=n.parse(t[p+1],p+1,a);if(!y)return null;c.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 bo(a,c,d)}evaluate(t){for(const[n,a]of this.branches)if(n.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,a]of this.branches)t(n),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,n])=>n.outputDefined())&&this.otherwise.outputDefined()}}class Ha{constructor(t,n,a,c){this.type=t,this.input=n,this.beginIndex=a,this.endIndex=c}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,ct),c=n.parse(t[2],2,Pe);if(!a||!c)return null;if(!yo(a.type,[zi(ct),Ge,ct]))return n.error(`Expected first argument to be of type array or string, but found ${qt(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Pe);return d?new Ha(a.type,a,c,d):null}return new Ha(a.type,a,c)}evaluate(t){const n=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),Gr(n,["string"]))return[...n].slice(a,c).join("");if(Gr(n,["array"]))return n.slice(a,c);throw new li(`Expected first argument to be of type array or string, but found ${qt(ci(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Is(r,t){const n=r.length-1;let a,c,d=0,p=n,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=r[m],c=r[m+1],a<=t){if(m===n||t<c)return m;d=m+1}else{if(!(a>t))throw new li("Input is not a number.");p=m-1}return 0}class Es{constructor(t,n,a){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const a=n.parse(t[1],1,Pe);if(!a)return null;const c=[];let d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],w=p,M=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.',w);if(c.length&&c[c.length-1][0]>=m)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const C=n.parse(y,M,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new Es(d,a,c)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;return c>=n[d-1]?a[d-1].evaluate(t):a[Is(n,c)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Gu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wo,Wa,er=function(){if(Wa)return wo;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return Wa=1,wo=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(n===void 0&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},wo}(),To=Gu(er);class xr{constructor(t,n,a,c,d){this.type=t,this.operator=n,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,n,a,c){let d=0;if(t.name==="exponential")d=Xa(n,t.base,a,c);else if(t.name==="linear")d=Xa(n,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new To(p[0],p[1],p[2],p[3]).solve(Xa(n,1,a,c))}return d}static parse(t,n){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return n.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,Pe),!d)return null;const m=[];let y=null;a==="interpolate-hcl"||a==="interpolate-lab"?y=lr:n.expectedType&&n.expectedType.kind!=="value"&&(y=n.expectedType);for(let w=0;w<p.length;w+=2){const M=p[w],C=p[w+1],z=w+3,D=w+4;if(typeof M!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',z);if(m.length&&m[m.length-1][0]>=M)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',z);const B=n.parse(C,D,y);if(!B)return null;y=y||B.type,m.push([M,B])}return fa(y,Pe)||fa(y,Ji)||fa(y,lr)||fa(y,go)||fa(y,_o)||fa(y,zi(Pe))?new xr(y,a,c,d,m):n.error(`Type ${qt(y)} is not interpolatable.`)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;if(c>=n[d-1])return a[d-1].evaluate(t);const p=Is(n,c),m=xr.interpolationFactor(this.interpolation,c,n[p],n[p+1]),y=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Pn(y,w,m);case"color":return gt.interpolate(y,w,m);case"padding":return Qi.interpolate(y,w,m);case"variableAnchorOffsetCollection":return Ui.interpolate(y,w,m);case"array":return Ua(y,w,m);case"projectionDefinition":return cr.interpolate(y,w,m)}case"interpolate-hcl":return gt.interpolate(y,w,m,"hcl");case"interpolate-lab":return gt.interpolate(y,w,m,"lab")}}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Xa(r,t,n,a){const c=a-n,d=r-n;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const Ut={color:gt.interpolate,number:Pn,padding:Qi.interpolate,variableAnchorOffsetCollection:Ui.interpolate,array:Ua};class ks{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a=null;const c=n.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const 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=c&&d.some(m=>ws(c,m.type));return new ks(p?ct:a,d)}evaluate(t){let n,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Ir&&!a.available&&(n||(n=a.name),a=null,c===this.args.length&&(a=n)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Mo(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 Hl(r,t,n,a){return a.compare(t,n)===0}function Ka(r,t,n){const a=r!=="=="&&r!=="!=";return class Bg{constructor(d,p,m){this.type=tt,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,ct);if(!y)return null;if(!Mo(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${qt(y.type)}'.`);let w=p.parse(d[2],2,ct);if(!w)return null;if(!Mo(m,w.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${qt(w.type)}'.`);if(y.type.kind!==w.type.kind&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${qt(y.type)}' and '${qt(w.type)}'.`);a&&(y.type.kind==="value"&&w.type.kind!=="value"?y=new Or(w.type,[y]):y.type.kind!=="value"&&w.type.kind==="value"&&(w=new Or(y.type,[w])));let M=null;if(d.length===4){if(y.type.kind!=="string"&&w.type.kind!=="string"&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,bs),!M)return null}return new Bg(y,w,M)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!==w.kind||y.kind!=="string"&&y.kind!=="number")throw new li(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${y.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!=="string"||w.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 So=Ka("==",function(r,t,n){return t===n},Hl),Wl=Ka("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!Hl(0,t,n,a)}),Ad=Ka("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),Po=Ka(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),Co=Ka("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),Hr=Ka(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class zs{constructor(t,n,a){this.type=bs,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(t.length!==2)return n.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return n.error("Collator options argument must be an object.");const c=n.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,tt);if(!c)return null;const d=n.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,tt);if(!d)return null;let p=null;return a.locale&&(p=n.parse(a.locale,1,Ge),!p)?null:new zs(c,d,p)}evaluate(t){return new Tt(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 Ya{constructor(t,n,a,c,d){this.type=Ge,this.number=t,this.locale=n,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,n){if(t.length!==3)return n.error("Expected two arguments.");const a=n.parse(t[1],1,Pe);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,Ge),!d))return null;let p=null;if(c.currency&&(p=n.parse(c.currency,1,Ge),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=n.parse(c["min-fraction-digits"],1,Pe),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=n.parse(c["max-fraction-digits"],1,Pe),!y)?null:new Ya(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Io{constructor(t){this.type=pa,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return n.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const 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,Pe),!y))return null;let w=null;if(m["text-font"]&&(w=n.parse(m["text-font"],1,zi(Ge)),!w))return null;let M=null;if(m["text-color"]&&(M=n.parse(m["text-color"],1,lr),!M))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!$a.includes(m["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=n.parse(m["vertical-align"],1,Ge),!C)return null}const z=c[c.length-1];z.scale=y,z.font=w,z.textColor=M,z.verticalAlign=C}else{const y=n.parse(t[p],1,ct);if(!y)return null;const w=y.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Io(c)}evaluate(t){return new yr(this.sections.map(n=>{const a=n.content.evaluate(t);return ci(a)===Wn?new on("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new on(ln(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 As{constructor(t){this.type=Wn,this.input=t}static parse(t,n){if(t.length!==2)return n.error("Expected two arguments.");const a=n.parse(t[1],1,Ge);return a?new As(a):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),a=Ir.fromString(n);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(n)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Xl{constructor(t){this.type=Pe,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 ${qt(a.type)} instead.`):new Xl(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 li(`Expected value to be of type string or array, but found ${qt(ci(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const cn=8192;function Rd(r,t){const n=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(n*c*cn),Math.round(a*c*cn)]}function Kl(r,t){const n=Math.pow(2,t.z);return[(c=(r[0]/cn+t.x)/n,360*c-180),(a=(r[1]/cn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Yn(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 Rs(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function qu(r,t,n){const a=r[0]-t[0],c=r[1]-t[1],d=r[0]-n[0],p=r[1]-n[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Ds(r,t,n,a){return(c=[a[0]-n[0],a[1]-n[1]])[0]*(d=[t[0]-r[0],t[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!Wu(r,t,n,a)||!Wu(n,a,r,t));var c,d}function Dd(r,t,n){for(const a of n)for(let c=0;c<a.length-1;++c)if(Ds(r,t,a[c],a[c+1]))return!0;return!1}function ga(r,t,n=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(qu(r,m[y],m[y+1]))return n;(d=m[y])[1]>(c=r)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function Ld(r,t){for(const n of t)if(ga(r,n))return!0;return!1}function Hu(r,t){for(const n of r)if(!ga(n,t))return!1;for(let n=0;n<r.length-1;++n)if(Dd(r[n],r[n+1],t))return!1;return!0}function Bd(r,t){for(const n of t)if(Hu(r,n))return!0;return!1}function Wu(r,t,n,a){const c=a[0]-n[0],d=a[1]-n[1],p=(r[0]-n[0])*d-c*(r[1]-n[1]),m=(t[0]-n[0])*d-c*(t[1]-n[1]);return p>0&&m<0||p<0&&m>0}function Yl(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=[];for(let p=0;p<r[c].length;p++){const m=Rd(r[c][p],n);Yn(t,m),d.push(m)}a.push(d)}return a}function Jl(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=Yl(r[c],t,n);a.push(d)}return a}function Ql(r,t,n,a){if(r[0]<n[0]||r[0]>n[2]){const c=.5*a;let d=r[0]-n[0]>c?-a:n[0]-r[0]>c?a:0;d===0&&(d=r[0]-n[2]>c?-a:n[2]-r[0]>c?a:0),r[0]+=d}Yn(t,r)}function ec(r,t,n,a){const c=Math.pow(2,a.z)*cn,d=[a.x*cn,a.y*cn],p=[];for(const m of r)for(const y of m){const w=[y.x+d[0],y.y+d[1]];Ql(w,t,n,c),p.push(w)}return p}function Xu(r,t,n,a){const c=Math.pow(2,a.z)*cn,d=[a.x*cn,a.y*cn],p=[];for(const y of r){const w=[];for(const M of y){const C=[M.x+d[0],M.y+d[1]];Yn(t,C),w.push(C)}p.push(w)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const w of y)Ql(w,t,n,c)}var m;return p}class _a{constructor(t,n){this.type=tt,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(Ms(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new _a(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new _a(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new _a(a,a)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const m=Yl(a.coordinates,d,p),y=ec(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!ga(w,m))return!1}if(a.type==="MultiPolygon"){const m=Jl(a.coordinates,d,p),y=ec(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!Ld(w,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const m=Yl(a.coordinates,d,p),y=Xu(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!Hu(w,m))return!1}if(a.type==="MultiPolygon"){const m=Jl(a.coordinates,d,p),y=Xu(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!Bd(w,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ku=class{constructor(r=[],t=(n,a)=>n<a?-1:n>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:n}=this,a=t[r];for(;r>0;){const c=r-1>>1,d=t[c];if(n(a,d)>=0)break;t[r]=d,r=c}t[r]=a}_down(r){const{data:t,compare:n}=this,a=this.length>>1,c=t[r];for(;r<a;){let d=1+(r<<1);const p=d+1;if(p<this.length&&n(t[p],t[d])<0&&(d=p),n(t[d],c)>=0)break;t[r]=t[d],r=d}t[r]=c}};function Eo(r,t,n=0,a=r.length-1,c=Fd){for(;a>n;){if(a-n>600){const y=a-n+1,w=t-n+1,M=Math.log(y),C=.5*Math.exp(2*M/3),z=.5*Math.sqrt(M*C*(y-C)/y)*(w-y/2<0?-1:1);Eo(r,t,Math.max(n,Math.floor(t-w*C/y+z)),Math.min(a,Math.floor(t+(y-w)*C/y+z)),c)}const d=r[t];let p=n,m=a;for(Ls(r,n,t),c(r[a],d)>0&&Ls(r,n,a);p<m;){for(Ls(r,p,m),p++,m--;c(r[p],d)<0;)p++;for(;c(r[m],d)>0;)m--}c(r[n],d)===0?Ls(r,n,m):(m++,Ls(r,m,a)),m<=t&&(n=m+1),t<=m&&(a=m-1)}}function Ls(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Fd(r,t){return r<t?-1:r>t?1:0}function ko(r,t){if(r.length<=1)return[r];const n=[];let a,c;for(const d of r){const p=Ju(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&n.push(a),a=[d]):a.push(d))}if(a&&n.push(a),t>1)for(let d=0;d<n.length;d++)n[d].length<=t||(Eo(n[d],t,1,n[d].length-1,Yu),n[d]=n[d].slice(0,t));return n}function Yu(r,t){return t.area-r.area}function Ju(r){let t=0;for(let n,a,c=0,d=r.length,p=d-1;c<d;p=c++)n=r[c],a=r[p],t+=(a.x-n.x)*(n.y+a.y);return t}const Qu=1/298.257223563,eh=Qu*(2-Qu),tc=Math.PI/180;class zo{constructor(t){const n=6378.137*tc*1e3,a=Math.cos(t*tc),c=1/(1-eh*(1-a*a)),d=Math.sqrt(c);this.kx=n*d*a,this.ky=n*d*c*(1-eh)}distance(t,n){const a=this.wrap(t[0]-n[0])*this.kx,c=(t[1]-n[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,n){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let w=t[y][0],M=t[y][1],C=this.wrap(t[y+1][0]-w)*this.kx,z=(t[y+1][1]-M)*this.ky,D=0;C===0&&z===0||(D=(this.wrap(n[0]-w)*this.kx*C+(n[1]-M)*this.ky*z)/(C*C+z*z),D>1?(w=t[y+1][0],M=t[y+1][1]):D>0&&(w+=C/this.kx*D,M+=z/this.ky*D)),C=this.wrap(n[0]-w)*this.kx,z=(n[1]-M)*this.ky;const B=C*C+z*z;B<m&&(m=B,a=w,c=M,d=y,p=D)}return{point:[a,c],index:d,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function th(r,t){return t[0]-r[0]}function Ao(r){return r[1]-r[0]+1}function Cn(r,t){return r[1]>=r[0]&&r[1]<t}function Ro(r,t){if(r[0]>r[1])return[null,null];const n=Ao(r);if(t){if(n===2)return[r,null];const c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];const a=Math.floor(n/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function ic(r,t){if(!Cn(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)Yn(n,r[a]);return n}function rc(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Yn(t,a);return t}function ih(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function nc(r,t,n){if(!ih(r)||!ih(t))return NaN;let a=0,c=0;return r[2]<t[0]&&(a=t[0]-r[2]),r[0]>t[2]&&(a=r[0]-t[2]),r[1]>t[3]&&(c=r[1]-t[3]),r[3]<t[1]&&(c=t[1]-r[3]),n.distance([0,0],[a,c])}function wt(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function ac(r,t,n,a,c){const d=Math.min(wt(r,[n,a],c),wt(t,[n,a],c)),p=Math.min(wt(n,[r,t],c),wt(a,[r,t],c));return Math.min(d,p)}function Od(r,t,n,a,c){if(!Cn(t,r.length)||!Cn(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 w=a[0];w<a[1];++w){const M=n[w],C=n[w+1];if(Ds(m,y,M,C))return 0;d=Math.min(d,ac(m,y,M,C,c))}}return d}function jd(r,t,n,a,c){if(!Cn(t,r.length)||!Cn(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,c.distance(r[p],n[m])),d===0)return d;return d}function Nd(r,t,n){if(ga(r,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,wt(r,[p,d],n)),a===0))return a;const m=n.pointOnLine(c,r);if(a=Math.min(a,n.distance(r,m.point)),a===0)return a}return a}function Zd(r,t,n,a){if(!Cn(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(ga(r[d],n,!0))return 0;let c=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 w=0,M=y.length,C=M-1;w<M;C=w++){const z=y[C],D=y[w];if(Ds(p,m,z,D))return 0;c=Math.min(c,ac(p,m,z,D,a))}}return c}function rh(r,t){for(const n of r)for(const a of n)if(ga(a,t,!0))return!0;return!1}function Vd(r,t,n,a=1/0){const c=rc(r),d=rc(t);if(a!==1/0&&nc(c,d,n)>=a)return a;if(Rs(c,d)){if(rh(r,t))return 0}else if(rh(t,r))return 0;let p=1/0;for(const m of r)for(let y=0,w=m.length,M=w-1;y<w;M=y++){const C=m[M],z=m[y];for(const D of t)for(let B=0,j=D.length,$=j-1;B<j;$=B++){const X=D[$],ae=D[B];if(Ds(C,z,X,ae))return 0;p=Math.min(p,ac(C,z,X,ae,n))}}return p}function nh(r,t,n,a,c,d){if(!d)return;const p=nc(ic(a,d),c,n);p<t&&r.push([p,d,[0,0]])}function Do(r,t,n,a,c,d,p){if(!d||!p)return;const m=nc(ic(a,d),ic(c,p),n);m<t&&r.push([m,d,p])}function Lo(r,t,n,a,c=1/0){let d=Math.min(a.distance(r[0],n[0][0]),c);if(d===0)return d;const p=new Ku([[0,[0,r.length-1],[0,0]]],th),m=rc(n);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const w=y[1],M=t?50:100;if(Ao(w)<=M){if(!Cn(w,r.length))return NaN;if(t){const C=Zd(r,w,n,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=w[0];C<=w[1];++C){const z=Nd(r[C],n,a);if(d=Math.min(d,z),d===0)return 0}}else{const C=Ro(w,t);nh(p,d,a,r,m,C[0]),nh(p,d,a,r,m,C[1])}}return d}function Bo(r,t,n,a,c,d=1/0){let p=Math.min(d,c.distance(r[0],n[0]));if(p===0)return p;const m=new Ku([[0,[0,r.length-1],[0,n.length-1]]],th);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const w=y[1],M=y[2],C=t?50:100,z=a?50:100;if(Ao(w)<=C&&Ao(M)<=z){if(!Cn(w,r.length)&&Cn(M,n.length))return NaN;let D;if(t&&a)D=Od(r,w,n,M,c),p=Math.min(p,D);else if(t&&!a){const B=r.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(D=wt(n[j],B,c),p=Math.min(p,D),p===0)return p}else if(!t&&a){const B=n.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(D=wt(r[j],B,c),p=Math.min(p,D),p===0)return p}else D=jd(r,w,n,M,c),p=Math.min(p,D)}else{const D=Ro(w,t),B=Ro(M,a);Do(m,p,c,r,n,D[0],B[0]),Do(m,p,c,r,n,D[0],B[1]),Do(m,p,c,r,n,D[1],B[0]),Do(m,p,c,r,n,D[1],B[1])}}return p}function sc(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 ya{constructor(t,n){this.type=Pe,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(Ms(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new ya(a,a.features.map(c=>sc(c.geometry)).flat());if(a.type==="Feature")return new ya(a,sc(a.geometry));if("type"in a&&"coordinates"in a)return new ya(a,sc(a))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(n,a){const c=n.geometry(),d=c.flat().map(y=>Kl([y.x,y.y],n.canonical));if(c.length===0)return NaN;const p=new zo(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Bo(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Bo(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Lo(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 c=n.geometry(),d=c.flat().map(y=>Kl([y.x,y.y],n.canonical));if(c.length===0)return NaN;const p=new zo(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Bo(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Bo(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Lo(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 c=n.geometry();if(c.length===0||c[0].length===0)return NaN;const d=ko(c,0).map(y=>y.map(w=>w.map(M=>Kl([M.x,M.y],n.canonical)))),p=new zo(d[0][0][0][1]);let m=1/0;for(const y of a)for(const w of d){switch(y.type){case"Point":m=Math.min(m,Lo([y.coordinates],!1,w,p,m));break;case"LineString":m=Math.min(m,Lo(y.coordinates,!0,w,p,m));break;case"Polygon":m=Math.min(m,Vd(w,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Ja={"==":So,"!=":Wl,">":Po,"<":Ad,">=":Hr,"<=":Co,array:Or,at:Cs,boolean:Or,case:bo,coalesce:ks,collator:zs,format:Io,image:As,in:qr,"index-of":qa,interpolate:xr,"interpolate-hcl":xr,"interpolate-lab":xr,length:Xl,let:Ga,literal:Kn,match:vo,number:Or,"number-format":Ya,object:Or,slice:Ha,step:Es,string:Or,"to-boolean":zt,"to-color":zt,"to-number":zt,"to-string":zt,var:Mt,within:_a,distance:ya};class jr{constructor(t,n,a,c){this.name=t,this.type=n,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,n){const a=t[0],c=jr.definitions[a];if(!c)return n.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let y=null;for(const[w,M]of m){y=new pt(n.registry,Fo,n.path,null,n.scope);const C=[];let z=!1;for(let D=1;D<t.length;D++){const B=t[D],j=Array.isArray(w)?w[D-1]:w.type,$=y.parse(B,1+C.length,j);if(!$){z=!0;break}C.push($)}if(!z)if(Array.isArray(w)&&w.length!==C.length)y.error(`Expected ${w.length} arguments, but found ${C.length} instead.`);else{for(let D=0;D<C.length;D++){const B=Array.isArray(w)?w[D]:w.type,j=C[D];y.concat(D+1).checkSubtype(B,j.type)}if(y.errors.length===0)return new jr(a,d,M,C)}}if(m.length===1)n.errors.push(...y.errors);else{const w=(m.length?m:p).map(([C])=>{return z=C,Array.isArray(z)?`(${z.map(qt).join(", ")})`:`(${qt(z.type)}...)`;var z}).join(" | "),M=[];for(let C=1;C<t.length;C++){const z=n.parse(t[C],1+M.length);if(!z)return null;M.push(qt(z.type))}n.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,n){jr.definitions=n;for(const a in n)t[a]=jr}}function ah(r,[t,n,a,c]){t=t.evaluate(r),n=n.evaluate(r),a=a.evaluate(r);const d=c?c.evaluate(r):1,p=Xn(t,n,a,d);if(p)throw new li(p);return new gt(t/255,n/255,a/255,d,!1)}function sh(r,t){return r in t}function oc(r,t){const n=t[r];return n===void 0?null:n}function xa(r){return{type:r}}function Fo(r){if(r instanceof Mt)return Fo(r.boundExpression);if(r instanceof jr&&r.name==="error"||r instanceof zs||r instanceof _a||r instanceof ya)return!1;const t=r instanceof zt||r instanceof Or;let n=!0;return r.eachChild(a=>{n=t?n&&Fo(a):n&&a instanceof Kn}),!!n&&Oo(r)&&jo(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Oo(r){if(r instanceof jr&&(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 _a||r instanceof ya)return!1;let t=!0;return r.eachChild(n=>{t&&!Oo(n)&&(t=!1)}),t}function Bs(r){if(r instanceof jr&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!Bs(n)&&(t=!1)}),t}function jo(r,t){if(r instanceof jr&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!jo(a,t)&&(n=!1)}),n}function oh(r){return{result:"success",value:r}}function Qa(r){return{result:"error",value:r}}function es(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function lh(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function lc(r){return!!r.expression&&r.expression.interpolated}function It(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function No(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ud(r){return r}function Zo(r,t){const n=t.type==="color",a=r.stops&&typeof r.stops[0][0]=="object",c=a||!(a||r.property!==void 0),d=r.type||(lc(t)?"exponential":"interval");if(n||t.type==="padding"){const M=n?gt.parse:Qi.parse;(r=st({},r)).stops&&(r.stops=r.stops.map(C=>[C[0],M(C[1])])),r.default=M(r.default?r.default:t.default)}if(r.colorSpace&&(p=r.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var p;let m,y,w;if(d==="exponential")m=cc;else if(d==="interval")m=Gd;else if(d==="categorical"){m=$d,y=Object.create(null);for(const M of r.stops)y[M[0]]=M[1];w=typeof r.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);m=qd}if(a){const M={},C=[];for(let B=0;B<r.stops.length;B++){const j=r.stops[B],$=j[0].zoom;M[$]===void 0&&(M[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},C.push($)),M[$].stops.push([j[0].value,j[1]])}const z=[];for(const B of C)z.push([M[B].zoom,Zo(M[B],t)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:xr.interpolationFactor.bind(void 0,D),zoomStops:z.map(B=>B[0]),evaluate:({zoom:B},j)=>cc({stops:z,base:r.base},t,B).evaluate(B,j)}}if(c){const M=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:xr.interpolationFactor.bind(void 0,M),zoomStops:r.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(r,t,C,y,w)}}return{kind:"source",evaluate(M,C){const z=C&&C.properties?C.properties[r.property]:void 0;return z===void 0?Fs(r.default,t.default):m(r,t,z,y,w)}}}function Fs(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function $d(r,t,n,a,c){return Fs(typeof n===c?a[n]:void 0,r.default,t.default)}function Gd(r,t,n){if(It(n)!=="number")return Fs(r.default,t.default);const a=r.stops.length;if(a===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[a-1][0])return r.stops[a-1][1];const c=Is(r.stops.map(d=>d[0]),n);return r.stops[c][1]}function cc(r,t,n){const a=r.base!==void 0?r.base:1;if(It(n)!=="number")return Fs(r.default,t.default);const c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];const d=Is(r.stops.map(M=>M[0]),n),p=function(M,C,z,D){const B=D-z,j=M-z;return B===0?0:C===1?j/B:(Math.pow(C,j)-1)/(Math.pow(C,B)-1)}(n,a,r.stops[d][0],r.stops[d+1][0]),m=r.stops[d][1],y=r.stops[d+1][1],w=Ut[t.type]||Ud;return typeof m.evaluate=="function"?{evaluate(...M){const C=m.evaluate.apply(void 0,M),z=y.evaluate.apply(void 0,M);if(C!==void 0&&z!==void 0)return w(C,z,p,r.colorSpace)}}:w(m,y,p,r.colorSpace)}function qd(r,t,n){switch(t.type){case"color":n=gt.parse(n);break;case"formatted":n=yr.fromString(n.toString());break;case"resolvedImage":n=Ir.fromString(n.toString());break;case"padding":n=Qi.parse(n);break;default:It(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return Fs(n,r.default,t.default)}jr.register(Ja,{error:[{kind:"error"},[Ge],(r,[t])=>{throw new li(t.evaluate(r))}],typeof:[Ge,[ct],(r,[t])=>qt(ci(t.evaluate(r)))],"to-rgba":[zi(Pe,4),[lr],(r,[t])=>{const[n,a,c,d]=t.evaluate(r).rgb;return[255*n,255*a,255*c,d]}],rgb:[lr,[Pe,Pe,Pe],ah],rgba:[lr,[Pe,Pe,Pe,Pe],ah],has:{type:tt,overloads:[[[Ge],(r,[t])=>sh(t.evaluate(r),r.properties())],[[Ge,Qt],(r,[t,n])=>sh(t.evaluate(r),n.evaluate(r))]]},get:{type:ct,overloads:[[[Ge],(r,[t])=>oc(t.evaluate(r),r.properties())],[[Ge,Qt],(r,[t,n])=>oc(t.evaluate(r),n.evaluate(r))]]},"feature-state":[ct,[Ge],(r,[t])=>oc(t.evaluate(r),r.featureState||{})],properties:[Qt,[],r=>r.properties()],"geometry-type":[Ge,[],r=>r.geometryType()],id:[ct,[],r=>r.id()],zoom:[Pe,[],r=>r.globals.zoom],"heatmap-density":[Pe,[],r=>r.globals.heatmapDensity||0],"line-progress":[Pe,[],r=>r.globals.lineProgress||0],accumulated:[ct,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Pe,xa(Pe),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[Pe,xa(Pe),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:Pe,overloads:[[[Pe,Pe],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[Pe],(r,[t])=>-t.evaluate(r)]]},"/":[Pe,[Pe,Pe],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[Pe,[Pe,Pe],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[Pe,[],()=>Math.LN2],pi:[Pe,[],()=>Math.PI],e:[Pe,[],()=>Math.E],"^":[Pe,[Pe,Pe],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[Pe,[Pe],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[Pe,[Pe],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[Pe,[Pe],(r,[t])=>Math.log(t.evaluate(r))],log2:[Pe,[Pe],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[Pe,[Pe],(r,[t])=>Math.sin(t.evaluate(r))],cos:[Pe,[Pe],(r,[t])=>Math.cos(t.evaluate(r))],tan:[Pe,[Pe],(r,[t])=>Math.tan(t.evaluate(r))],asin:[Pe,[Pe],(r,[t])=>Math.asin(t.evaluate(r))],acos:[Pe,[Pe],(r,[t])=>Math.acos(t.evaluate(r))],atan:[Pe,[Pe],(r,[t])=>Math.atan(t.evaluate(r))],min:[Pe,xa(Pe),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[Pe,xa(Pe),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[Pe,[Pe],(r,[t])=>Math.abs(t.evaluate(r))],round:[Pe,[Pe],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[Pe,[Pe],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[Pe,[Pe],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[tt,[Ge,ct],(r,[t,n])=>r.properties()[t.value]===n.value],"filter-id-==":[tt,[ct],(r,[t])=>r.id()===t.value],"filter-type-==":[tt,[Ge],(r,[t])=>r.geometryType()===t.value],"filter-<":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<c}],"filter-id-<":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>c}],"filter-id->":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[tt,[ct],(r,[t])=>t.value in r.properties()],"filter-has-id":[tt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[tt,[zi(Ge)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[tt,[zi(ct)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[tt,[Ge,zi(ct)],(r,[t,n])=>n.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[tt,[Ge,zi(ct)],(r,[t,n])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(r.properties()[t.value],n.value,0,n.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(r,[t,n])=>t.evaluate(r)&&n.evaluate(r)],[xa(tt),(r,t)=>{for(const n of t)if(!n.evaluate(r))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(r,[t,n])=>t.evaluate(r)||n.evaluate(r)],[xa(tt),(r,t)=>{for(const n of t)if(n.evaluate(r))return!0;return!1}]]},"!":[tt,[tt],(r,[t])=>!t.evaluate(r)],"is-supported-script":[tt,[Ge],(r,[t])=>{const n=r.globals&&r.globals.isSupportedScript;return!n||n(t.evaluate(r))}],upcase:[Ge,[Ge],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[Ge,[Ge],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[Ge,xa(ct),(r,t)=>t.map(n=>ln(n.evaluate(r))).join("")],"resolved-locale":[Ge,[bs],(r,[t])=>t.evaluate(r).resolvedLocale()]});class uc{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new Ct,this._defaultValue=n?(a=n).type==="color"&&No(a.default)?new gt(0,0,0,0):a.type==="color"?gt.parse(a.default)||null:a.type==="padding"?Qi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Ui.parse(a.default)||null:a.type==="projectionDefinition"?cr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=n,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,n,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=n||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const 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 li(`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 va(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ja}function Os(r,t){const n=new pt(Ja,Fo,[],t?function(c){const d={color:lr,string:Ge,number:Pe,enum:Ge,boolean:tt,formatted:pa,padding:go,projectionDefinition:Ji,resolvedImage:Wn,variableAnchorOffsetCollection:_o};return c.type==="array"?zi(d[c.value]||ct,c.length):d[c.type]}(t):void 0),a=n.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?oh(new uc(a,t)):Qa(n.errors)}class hc{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!Bs(n.expression)}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}}class dc{constructor(t,n,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!Bs(n.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}interpolationFactor(t,n,a){return this.interpolationType?xr.interpolationFactor(this.interpolationType,t,n,a):0}}function ch(r,t){const n=Os(r,t);if(n.result==="error")return n;const a=n.value.expression,c=Oo(a);if(!c&&!es(t))return Qa([new St("","data expressions not supported")]);const d=jo(a,["zoom"]);if(!d&&!lh(t))return Qa([new St("","zoom expressions not supported")]);const p=Uo(a);return p||d?p instanceof St?Qa([p]):p instanceof xr&&!lc(t)?Qa([new St("",'"interpolate" expressions cannot be used with this property')]):oh(p?new dc(c?"camera":"composite",n.value,p.labels,p instanceof xr?p.interpolation:void 0):new hc(c?"constant":"source",n.value)):Qa([new St("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(t,n){this._parameters=t,this._specification=n,st(this,Zo(this._parameters,this._specification))}static deserialize(t){return new Vo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Uo(r){let t=null;if(r instanceof Ga)t=Uo(r.result);else if(r instanceof ks){for(const n of r.args)if(t=Uo(n),t)break}else(r instanceof Es||r instanceof xr)&&r.input instanceof jr&&r.input.name==="zoom"&&(t=r);return t instanceof St||r.eachChild(n=>{const a=Uo(n);a instanceof St?t=a:!t&&a?t=new St("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new St("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function $o(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(!$o(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const uh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pc(r){if(r==null)return{filter:()=>!0,needGeometry:!1};$o(r)||(r=js(r));const t=Os(r,uh);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,c)=>t.value.evaluate(n,a,{},c),needGeometry:fc(r)}}function Hd(r,t){return r<t?-1:r>t?1:0}function fc(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(fc(r[t]))return!0;return!1}function js(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?Go(r[1],r[2],"=="):t==="!="?ts(Go(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Go(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(js))):t==="all"?["all"].concat(r.slice(1).map(js)):t==="none"?["all"].concat(r.slice(1).map(js).map(ts)):t==="in"?mc(r[1],r.slice(2)):t==="!in"?ts(mc(r[1],r.slice(2))):t==="has"?qo(r[1]):t!=="!has"||ts(qo(r[1]));var n}function Go(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 mc(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(Hd)]]:["filter-in-small",r,["literal",t]]}}function qo(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ts(r){return["!",r]}function Ns(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(const d of r)c+=`${Ns(d)},`;return`${c}]`}const n=Object.keys(r).sort();let a="{";for(let c=0;c<n.length;c++)a+=`${JSON.stringify(n[c])}:${Ns(r[n[c]])},`;return`${a}}`}function Ho(r){let t="";for(const n of le)t+=`/${Ns(r[n])}`;return t}function hh(r){const t=r.value;return t?[new we(r.key,t,"constants have been deprecated as of v8")]:[]}function gi(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function ba(r){if(Array.isArray(r))return r.map(ba);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=ba(r[n]);return t}return gi(r)}function Nr(r){const t=r.key,n=r.value,a=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,p=r.styleSpec,m=r.validateSpec;let y=[];const w=It(n);if(w!=="object")return[new we(t,n,`object expected, ${w} found`)];for(const M in n){const C=M.split(".")[0],z=a[C]||a["*"];let D;if(c[C])D=c[C];else if(a[C])D=m;else if(c["*"])D=c["*"];else{if(!a["*"]){y.push(new we(t,n[M],`unknown property "${M}"`));continue}D=m}y=y.concat(D({key:(t&&`${t}.`)+M,value:n[M],valueSpec:z,style:d,styleSpec:p,object:n,objectKey:M,validateSpec:m},n))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&n[M]===void 0&&y.push(new we(t,n,`missing required property "${M}"`));return y}function gc(r){const t=r.value,n=r.valueSpec,a=r.style,c=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(It(t)!=="array")return[new we(d,t,`array expected, ${It(t)} found`)];if(n.length&&t.length!==n.length)return[new we(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new we(d,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let m={type:n.value,values:n.values};c.$version<7&&(m.function=n.function),It(n.value)==="object"&&(m=n.value);let y=[];for(let w=0;w<t.length;w++)y=y.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:m,validateSpec:r.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return y}function _c(r){const t=r.key,n=r.value,a=r.valueSpec;let c=It(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new we(t,n,`number expected, ${c} found`)]:"minimum"in a&&n<a.minimum?[new we(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new we(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function yc(r){const t=r.valueSpec,n=gi(r.value.type);let a,c,d,p={};const m=n!=="categorical"&&r.value.property===void 0,y=!m,w=It(r.value.stops)==="array"&&It(r.value.stops[0])==="array"&&It(r.value.stops[0][0])==="object",M=Nr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(D){if(n==="identity")return[new we(D.key,D.value,'identity function may not have a "stops" property')];let B=[];const j=D.value;return B=B.concat(gc({key:D.key,value:j,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:C})),It(j)==="array"&&j.length===0&&B.push(new we(D.key,j,"array must have at least one stop")),B},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return n==="identity"&&m&&M.push(new we(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||M.push(new we(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!lc(r.valueSpec)&&M.push(new we(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(y&&!es(r.valueSpec)?M.push(new we(r.key,r.value,"property functions not supported")):m&&!lh(r.valueSpec)&&M.push(new we(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!w||r.value.property!==void 0||M.push(new we(r.key,r.value,'"property" property is required')),M;function C(D){let B=[];const j=D.value,$=D.key;if(It(j)!=="array")return[new we($,j,`array expected, ${It(j)} found`)];if(j.length!==2)return[new we($,j,`array length 2 expected, length ${j.length} found`)];if(w){if(It(j[0])!=="object")return[new we($,j,`object expected, ${It(j[0])} found`)];if(j[0].zoom===void 0)return[new we($,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new we($,j,"object stop key must have value")];if(d&&d>gi(j[0].zoom))return[new we($,j[0].zoom,"stop zoom values must appear in ascending order")];gi(j[0].zoom)!==d&&(d=gi(j[0].zoom),c=void 0,p={}),B=B.concat(Nr({key:`${$}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:_c,value:z}}))}else B=B.concat(z({key:`${$}[0]`,value:j[0],validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},j));return va(ba(j[1]))?B.concat([new we(`${$}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(D.validateSpec({key:`${$}[1]`,value:j[1],valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function z(D,B){const j=It(D.value),$=gi(D.value),X=D.value!==null?D.value:B;if(a){if(j!==a)return[new we(D.key,X,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new we(D.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&n!=="categorical"){let ae=`number expected, ${j} found`;return es(t)&&n===void 0&&(ae+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(D.key,X,ae)]}return n!=="categorical"||j!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&j==="number"&&c!==void 0&&$<c?[new we(D.key,X,"stop domain values must appear in ascending order")]:(c=$,n==="categorical"&&$ in p?[new we(D.key,X,"stop domain values must be unique")]:(p[$]=!0,[])):[new we(D.key,X,`integer expected, found ${$}`)]}}function wa(r){const t=(r.expressionContext==="property"?ch:Os)(ba(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new we(`${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 we(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"&&!Bs(n))return[new we(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Bs(n))return[new we(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!jo(n,["zoom","feature-state"]))return[new we(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Oo(n))return[new we(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jn(r){const t=r.key,n=r.value,a=r.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(gi(n))===-1&&c.push(new we(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(gi(n))===-1&&c.push(new we(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function xc(r){return $o(ba(r.value))?wa(st({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):vc(r)}function vc(r){const t=r.value,n=r.key;if(It(t)!=="array")return[new we(n,t,`array expected, ${It(t)} found`)];const a=r.styleSpec;let c,d=[];if(t.length<1)return[new we(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Jn({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),gi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&gi(t[1])==="$type"&&d.push(new we(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new we(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=It(t[1]),c!=="string"&&d.push(new we(`${n}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=It(t[p]),gi(t[1])==="$type"?d=d.concat(Jn({key:`${n}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new we(`${n}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(vc({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=It(t[1]),t.length!==2?d.push(new we(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new we(`${n}[1]`,t[1],`string expected, ${c} found`))}return d}function bc(r,t){const n=r.key,a=r.validateSpec,c=r.style,d=r.styleSpec,p=r.value,m=r.objectKey,y=d[`${t}_${r.layerType}`];if(!y)return[];const w=m.match(/^(.*)-transition$/);if(t==="paint"&&w&&y[w[1]]&&y[w[1]].transition)return a({key:n,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=r.valueSpec||y[m];if(!M)return[new we(n,p,`unknown property "${m}"`)];let C;if(It(p)==="string"&&es(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new we(n,p,`"${m}" does not support interpolation syntax
6
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const z=[];return r.layerType==="symbol"&&(m==="text-field"&&c&&!c.glyphs&&z.push(new we(n,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&No(ba(p))&&gi(p.type)==="identity"&&z.push(new we(n,p,'"text-font" does not support identity functions'))),z.concat(a({key:r.key,value:p,valueSpec:M,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function dh(r){return bc(r,"paint")}function wc(r){return bc(r,"layout")}function Tc(r){let t=[];const n=r.value,a=r.key,c=r.style,d=r.styleSpec;n.type||n.ref||t.push(new we(a,n,'either "type" or "ref" is required'));let p=gi(n.type);const m=gi(n.ref);if(n.id){const y=gi(n.id);for(let w=0;w<r.arrayIndex;w++){const M=c.layers[w];gi(M.id)===y&&t.push(new we(a,n.id,`duplicate layer id "${n.id}", previously used at line ${M.id.__line__}`))}}if("ref"in n){let y;["type","source","source-layer","filter","layout"].forEach(w=>{w in n&&t.push(new we(a,n[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{gi(w.id)===m&&(y=w)}),y?y.ref?t.push(new we(a,n.ref,"ref cannot reference another ref layer")):p=gi(y.type):t.push(new we(a,n.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(n.source){const y=c.sources&&c.sources[n.source],w=y&&gi(y.type);y?w==="vector"&&p==="raster"?t.push(new we(a,n.source,`layer "${n.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new we(a,n.source,`layer "${n.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new we(a,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new we(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!n.paint||!n.paint["line-gradient"]||w==="geojson"&&y.lineMetrics||t.push(new we(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new we(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new we(a,n.source,`source "${n.source}" not found`))}else t.push(new we(a,n,'missing required property "source"'));return t=t.concat(Nr({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:xc,layout:y=>Nr({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>wc(st({layerType:p},w))}}),paint:y=>Nr({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>dh(st({layerType:p},w))}})}})),t}function Wr(r){const t=r.value,n=r.key,a=It(t);return a!=="string"?[new we(n,t,`string expected, ${a} found`)]:[]}const ph={promoteId:function({key:r,value:t}){if(It(t)==="string")return Wr({key:r,value:t});{const n=[];for(const a in t)n.push(...Wr({key:`${r}.${a}`,value:t[a]}));return n}}};function fh(r){const t=r.value,n=r.key,a=r.styleSpec,c=r.style,d=r.validateSpec;if(!t.type)return[new we(n,t,'"type" is required')];const p=gi(t.type);let m;switch(p){case"vector":case"raster":return m=Nr({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:ph,validateSpec:d}),m;case"raster-dem":return m=function(y){var w;const M=(w=y.sourceName)!==null&&w!==void 0?w:"",C=y.value,z=y.styleSpec,D=z.source_raster_dem,B=y.style;let j=[];const $=It(C);if(C===void 0)return j;if($!=="object")return j.push(new we("source_raster_dem",C,`object expected, ${$} found`)),j;const X=gi(C.encoding)==="custom",ae=["redFactor","greenFactor","blueFactor","baseShift"],Y=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const R in C)!X&&ae.includes(R)?j.push(new we(R,C[R],`In "${M}": "${R}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):D[R]?j=j.concat(y.validateSpec({key:R,value:C[R],valueSpec:D[R],validateSpec:y.validateSpec,style:B,styleSpec:z})):j.push(new we(R,C[R],`unknown property "${R}"`));return j}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=Nr({key:n,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:ph}),t.cluster)for(const y in t.clusterProperties){const[w,M]=t.clusterProperties[y],C=typeof w=="string"?[w,["accumulated"],["get",y]]:w;m.push(...wa({key:`${n}.${y}.map`,value:M,expressionContext:"cluster-map"})),m.push(...wa({key:`${n}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return m;case"video":return Nr({key:n,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Nr({key:n,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new we(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jn({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function mh(r){const t=r.value,n=r.styleSpec,a=n.light,c=r.style;let d=[];const p=It(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("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:c,styleSpec:n}):a[m]?r.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new we(m,t[m],`unknown property "${m}"`)])}return d}function gh(r){const t=r.value,n=r.styleSpec,a=n.sky,c=r.style,d=It(t);if(t===void 0)return[];if(d!=="object")return[new we("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:c,styleSpec:n}):[new we(m,t[m],`unknown property "${m}"`)]);return p}function _h(r){const t=r.value,n=r.styleSpec,a=n.terrain,c=r.style;let d=[];const p=It(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("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:c,styleSpec:n}):[new we(m,t[m],`unknown property "${m}"`)]);return d}function yh(r){let t=[];const n=r.value,a=r.key;if(Array.isArray(n)){const c=[],d=[];for(const p in n)n[p].id&&c.includes(n[p].id)&&t.push(new we(a,n,`all the sprites' ids must be unique, but ${n[p].id} is duplicated`)),c.push(n[p].id),n[p].url&&d.includes(n[p].url)&&t.push(new we(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(Nr({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return Wr({key:a,value:n})}const is={"*":()=>[],array:gc,boolean:function(r){const t=r.value,n=r.key,a=It(t);return a!=="boolean"?[new we(n,t,`boolean expected, ${a} found`)]:[]},number:_c,color:function(r){const t=r.key,n=r.value,a=It(n);return a!=="string"?[new we(t,n,`color expected, ${a} found`)]:gt.parse(String(n))?[]:[new we(t,n,`color expected, "${n}" found`)]},constants:hh,enum:Jn,filter:xc,function:yc,layer:Tc,object:Nr,source:fh,light:mh,sky:gh,terrain:_h,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,c=r.style,d=It(t);if(t===void 0)return[];if(d!=="object")return[new we("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:c,styleSpec:n}):[new we(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=It(n);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(n)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(n)?["array","string"].includes(a)?[]:[new we(t,n,`projection expected, invalid type "${a}" found`)]:[new we(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:Wr,formatted:function(r){return Wr(r).length===0?[]:wa(r)},resolvedImage:function(r){return Wr(r).length===0?[]:wa(r)},padding:function(r){const t=r.key,n=r.value;if(It(n)==="array"){if(n.length<1||n.length>4)return[new we(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${t}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:a}));return c}return _c({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=It(n),c=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new we(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(Jn({key:`${t}[${p}]`,value:n[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(gc({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:yh};function Qn(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=Qn,n.expression&&No(gi(t))?yc(r):n.expression&&va(ba(t))?wa(r):n.type&&is[n.type]?is[n.type](r):Nr(st({},r,{valueSpec:n.type?a[n.type]:n}))}function vr(r){const t=r.value,n=r.key,a=Wr(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new we(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new we(n,t,'"glyphs" url must include a "{range}" token'))),a}function ur(r,t=V){let n=[];return n=n.concat(Qn({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:Qn,objectElementValidators:{glyphs:vr,"*":()=>[]}})),r.constants&&(n=n.concat(hh({key:"constants",value:r.constants}))),xh(n)}function Xr(r){return function(t){return r({...t,validateSpec:Qn})}}function xh(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function un(r){return function(...t){return xh(r.apply(this,t))}}ur.source=un(Xr(fh)),ur.sprite=un(Xr(yh)),ur.glyphs=un(Xr(vr)),ur.light=un(Xr(mh)),ur.sky=un(Xr(gh)),ur.terrain=un(Xr(_h)),ur.layer=un(Xr(Tc)),ur.filter=un(Xr(xc)),ur.paintProperty=un(Xr(dh)),ur.layoutProperty=un(Xr(wc));const hn=ur,vh=hn.light,Mc=hn.sky,Wd=hn.paintProperty,Sc=hn.layoutProperty;function bh(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new G(new Error(a.message))),n=!0;return n}class In{constructor(t,n,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(n=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const w=p[3+y],M=p[3+y+1];c.push(w===M?null:p.subarray(w,M))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=n+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=a,this.scale=n/t,this.uid=0;const d=a/n*t;this.min=-d,this.max=t+d}insert(t,n,a,c,d){this._forEachCell(n,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,n,a,c,d,p){this.cells[d].push(p)}query(t,n,a,c,d){const p=this.min,m=this.max;if(t<=p&&n<=p&&m<=a&&m<=c&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,n,a,c,this._queryCell,y,{},d),y}}_queryCell(t,n,a,c,d,p,m,y){const w=this.cells[d];if(w!==null){const M=this.keys,C=this.bboxes;for(let z=0;z<w.length;z++){const D=w[z];if(m[D]===void 0){const B=4*D;(y?y(C[B+0],C[B+1],C[B+2],C[B+3]):t<=C[B+2]&&n<=C[B+3]&&a>=C[B+0]&&c>=C[B+1])?(m[D]=!0,p.push(M[D])):m[D]=!1}}}}_forEachCell(t,n,a,c,d,p,m,y){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(n),C=this._convertToCellCoord(a),z=this._convertToCellCoord(c);for(let D=w;D<=C;D++)for(let B=M;B<=z;B++){const j=this.d*B+D;if((!y||y(this._convertFromCellCoord(D),this._convertFromCellCoord(B),this._convertFromCellCoord(D+1),this._convertFromCellCoord(B+1)))&&d.call(this,t,n,a,c,j,p,m,y))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,n=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(n+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let p=0;p<t.length;p++){const m=t[p];c[3+p]=d,c.set(m,d),d+=m.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,n){const a=t.toArrayBuffer();return n&&n.push(a),{buffer:a}}static deserialize(t){return new In(t.buffer)}}const En={};function $e(r,t,n={}){if(En[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),En[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",In),$e("Color",gt),$e("Error",Error),$e("AJAXError",Hn),$e("ResolvedImage",Ir),$e("StylePropertyFunction",Vo),$e("StyleExpression",uc,{omit:["_evaluator"]}),$e("ZoomDependentExpression",dc),$e("ZoomConstantExpression",hc),$e("CompoundExpression",jr,{omit:["_evaluate"]});for(const r in Ja)Ja[r]._classRegistryKey||$e(`Expression_${r}`,Ja[r]);function wh(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Pc(r){return r.$name||r.constructor._classRegistryKey}function Zs(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=Pc(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||wh(r)||fr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Vs(r,t){if(Zs(r))return(wh(r)||fr(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(Vs(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=Pc(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!En[n])throw new Error(`${n} is not registered.`);const{klass:a}=En[n],c=a.serialize?a.serialize(r,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in r){if(!r.hasOwnProperty(d)||En[n].omit.indexOf(d)>=0)continue;const p=r[d];c[d]=En[n].shallow.indexOf(d)>=0?p:Vs(p,t)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function Ta(r){if(Zs(r))return r;if(Array.isArray(r))return r.map(Ta);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=Pc(r)||"Object";if(!En[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=En[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(r);const a=Object.create(n.prototype);for(const c of Object.keys(r)){if(c==="$name")continue;const d=r[c];a[c]=En[t].shallow.indexOf(c)>=0?d:Ta(d)}return a}class Us{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 xt={"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 Wo(r){for(const t of r)if(Ko(t.charCodeAt(0)))return!0;return!1}function Th(r){for(const t of r)if(!Mh(t.charCodeAt(0)))return!1;return!0}function Xo(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 Cc=Xo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Mh(r){return!Cc.test(String.fromCodePoint(r))}const Sh=Xo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ko(r){return!(r!==746&&r!==747&&(r<4352||!(xt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||xt["CJK Compatibility"](r)||xt["CJK Strokes"](r)||!(!xt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||xt["Enclosed CJK Letters and Months"](r)||xt["Ideographic Description Characters"](r)||xt.Kanbun(r)||xt.Katakana(r)&&r!==12540||!(!xt["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)||!(!xt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||xt["Vertical Forms"](r)||xt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Sh.test(String.fromCodePoint(r)))))}function Ph(r){return!(Ko(r)||function(t){return!!(xt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||xt["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)||xt["Letterlike Symbols"](t)||xt["Number Forms"](t)||xt["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)||xt["Control Pictures"](t)&&t!==9251||xt["Optical Character Recognition"](t)||xt["Enclosed Alphanumerics"](t)||xt["Geometric Shapes"](t)||xt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||xt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||xt["CJK Symbols and Punctuation"](t)||xt.Katakana(t)||xt["Private Use Area"](t)||xt["CJK Compatibility Forms"](t)||xt["Small Form Variants"](t)||xt["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 Ch=Xo(["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 Ic(r){return Ch.test(String.fromCodePoint(r))}function Ih(r,t){return!(!t&&Ic(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||xt.Khmer(r))}function Xd(r){for(const t of r)if(Ic(t.charCodeAt(0)))return!0;return!1}const ea=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(ea.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const n=r.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(n);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)})}};class Ht{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 Us,this.transition={})}isSupportedScript(t){return function(n,a){for(const c of n)if(!Ih(c.charCodeAt(0),a))return!1;return!0}(t,ea.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 $s{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,c){if(No(a))return new Vo(a,c);if(va(a)){const d=ch(a,c);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return c.type==="color"&&typeof a=="string"?d=gt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Ui.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=cr.parse(a)):d=Qi.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 Yo{constructor(t){this.property=t,this.value=new $s(t,void 0)}transitioned(t,n){return new Gs(this.property,this.value,n,Yi({},t.transition,this.transition),t.now)}untransitioned(){return new Gs(this.property,this.value,null,{},0)}}class Ec{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return ar(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Yo(this._values[t].property)),this._values[t].value=new $s(this._values[t].property,n===null?void 0:ar(n))}getTransition(t){return ar(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Yo(this._values[t].property)),this._values[t].transition=ar(n)||void 0}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a);const c=this.getTransition(n);c!==void 0&&(t[`${n}-transition`]=c)}return t}transitioned(t,n){const a=new Eh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,n._values[c]);return a}untransitioned(){const t=new Eh(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class Gs{constructor(t,n,a,c,d){this.property=t,this.value=n,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,n,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,n,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,n,a);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,n,a),d,ki(m))}}return d}}class Eh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const c=new Jo(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class kc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return ar(this._values[t].value)}setValue(t,n){this._values[t]=new $s(this._values[t].property,n===null?void 0:ar(n))}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a)}return t}possiblyEvaluate(t,n,a){const c=new Jo(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}}class dn{constructor(t,n,a){this.property=t,this.value=n,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,n,a,c){return this.property.evaluate(this.value,this.parameters,t,n,a,c)}}class Jo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ye{constructor(t){this.specification=t}possiblyEvaluate(t,n){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(n)}interpolate(t,n,a){const c=Ut[this.specification.type];return c?c(t,n,a):t}}class at{constructor(t,n){this.specification=t,this.overrides=n}possiblyEvaluate(t,n,a,c){return new dn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(n,null,{},a,c)}:t.expression,n)}interpolate(t,n,a){if(t.value.kind!=="constant"||n.value.kind!=="constant")return t;if(t.value.value===void 0||n.value.value===void 0)return new dn(this,{kind:"constant",value:void 0},t.parameters);const c=Ut[this.specification.type];if(c){const d=c(t.value.value,n.value.value,a);return new dn(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,n,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(n,a,c,d,p)}}class qs extends at{possiblyEvaluate(t,n,a,c){if(t.value===void 0)return new dn(this,{kind:"constant",value:void 0},n);if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,n);return new dn(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 dn(this,{kind:"constant",value:d},n)}return new dn(this,t.expression,n)}evaluate(t,n,a,c,d,p){if(t.kind==="source"){const m=t.evaluate(n,a,c,d,p);return this._calculate(m,m,m,n)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(n.zoom)-1},a,c),t.evaluate({zoom:Math.floor(n.zoom)},a,c),t.evaluate({zoom:Math.floor(n.zoom)+1},a,c),n):t.value}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class zc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c);return this._calculate(d,d,d,n)}return this._calculate(t.expression.evaluate(new Ht(Math.floor(n.zoom-1),n)),t.expression.evaluate(new Ht(Math.floor(n.zoom),n)),t.expression.evaluate(new Ht(Math.floor(n.zoom+1),n)),n)}}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class Ac{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){return!!t.expression.evaluate(n,null,{},a,c)}interpolate(){return!1}}class br{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in t){const a=t[n];a.specification.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new $s(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new Yo(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",at),$e("DataConstantProperty",Ye),$e("CrossFadedDataDrivenProperty",qs),$e("CrossFadedProperty",zc),$e("ColorRampProperty",Ac);const kh="-transition";class pn extends J{constructor(t,n){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),n.layout&&(this._unevaluatedLayout=new kc(n.layout)),n.paint)){this._transitionablePaint=new Ec(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 Jo(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(Sc,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(kh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(Wd,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(kh))return this._transitionablePaint.setTransition(t.slice(0,-11),n||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.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),ha(t,(n,a)=>!(n===void 0||a==="layout"&&!Object.keys(n).length||a==="paint"&&!Object.keys(n).length))}_validate(t,n,a,c,d={}){return(!d||d.validate!==!1)&&bh(this,t.call(hn,{key:n,layerType:this.type,objectKey:a,value:c,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const n=this.paint.get(t);if(n instanceof dn&&es(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const rs={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Hs{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 ui{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 vi(r,t=1){let n=0,a=0;return{members:r.map(c=>{const d=rs[c.type].BYTES_PER_ELEMENT,p=n=Rc(n,Math.max(t,d)),m=c.components||1;return a=Math.max(a,d),n+=d*m,{name:c.name,type:c.type,components:m,offset:p}}),size:Rc(n,Math.max(a,t)),alignment:t}}function Rc(r,t){return Math.ceil(r/t)*t}class Ws extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.int16[c+0]=n,this.int16[c+1]=a,t}}Ws.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",Ws);class Qo extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.int16[d+0]=n,this.int16[d+1]=a,this.int16[d+2]=c,t}}Qo.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",Qo);class kn extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.int16[p+0]=n,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}kn.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",kn);class el extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=6*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}el.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",el);class Xs extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=4*t,w=8*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=m,t}}Xs.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",Xs);class ns extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.float32[c+0]=n,this.float32[c+1]=a,t}}ns.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",ns);class Ks extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,n,a,c,d,p,m,y,w,M)}emplace(t,n,a,c,d,p,m,y,w,M,C){const z=10*t;return this.uint16[z+0]=n,this.uint16[z+1]=a,this.uint16[z+2]=c,this.uint16[z+3]=d,this.uint16[z+4]=p,this.uint16[z+5]=m,this.uint16[z+6]=y,this.uint16[z+7]=w,this.uint16[z+8]=M,this.uint16[z+9]=C,t}}Ks.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",Ks);class Dc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M,C,z){const D=this.length;return this.resize(D+1),this.emplace(D,t,n,a,c,d,p,m,y,w,M,C,z)}emplace(t,n,a,c,d,p,m,y,w,M,C,z,D){const B=12*t;return this.int16[B+0]=n,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=m,this.uint16[B+6]=y,this.uint16[B+7]=w,this.int16[B+8]=M,this.int16[B+9]=C,this.int16[B+10]=z,this.int16[B+11]=D,t}}Dc.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",Dc);class as extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.float32[d+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}as.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",as);class Ma extends ui{_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}}Ma.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",Ma);class Lc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,n,a,c,d,p,m,y,w)}emplace(t,n,a,c,d,p,m,y,w,M){const C=10*t,z=5*t;return this.int16[C+0]=n,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[z+3]=y,this.uint16[C+8]=w,this.uint16[C+9]=M,t}}Lc.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",Lc);class tl extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=6*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}tl.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",tl);class Sa extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,n,a,c,d)}emplace(t,n,a,c,d,p){const m=4*t,y=8*t;return this.float32[m+0]=n,this.float32[m+1]=a,this.float32[m+2]=c,this.int16[y+6]=d,this.int16[y+7]=p,t}}Sa.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",Sa);class Bc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=16*t,w=4*t,M=8*t;return this.uint8[y+0]=n,this.uint8[y+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[M+6]=p,this.int16[M+7]=m,t}}Bc.prototype.bytesPerElement=16,$e("StructArrayLayout2ub2f2i16",Bc);class il extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[d+0]=n,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}il.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",il);class rl extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X){const ae=this.length;return this.resize(ae+1),this.emplace(ae,t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X)}emplace(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae){const Y=24*t,R=12*t,U=48*t;return this.int16[Y+0]=n,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[R+2]=p,this.uint32[R+3]=m,this.uint32[R+4]=y,this.uint16[Y+10]=w,this.uint16[Y+11]=M,this.uint16[Y+12]=C,this.float32[R+7]=z,this.float32[R+8]=D,this.uint8[U+36]=B,this.uint8[U+37]=j,this.uint8[U+38]=$,this.uint32[R+10]=X,this.int16[Y+22]=ae,t}}rl.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",rl);class Fc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y,R,U,Q,fe,Ae,ye,ve,De,Re){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y,R,U,Q,fe,Ae,ye,ve,De,Re)}emplace(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y,R,U,Q,fe,Ae,ye,ve,De,Re,Fe){const Me=32*t,qe=16*t;return this.int16[Me+0]=n,this.int16[Me+1]=a,this.int16[Me+2]=c,this.int16[Me+3]=d,this.int16[Me+4]=p,this.int16[Me+5]=m,this.int16[Me+6]=y,this.int16[Me+7]=w,this.uint16[Me+8]=M,this.uint16[Me+9]=C,this.uint16[Me+10]=z,this.uint16[Me+11]=D,this.uint16[Me+12]=B,this.uint16[Me+13]=j,this.uint16[Me+14]=$,this.uint16[Me+15]=X,this.uint16[Me+16]=ae,this.uint16[Me+17]=Y,this.uint16[Me+18]=R,this.uint16[Me+19]=U,this.uint16[Me+20]=Q,this.uint16[Me+21]=fe,this.uint16[Me+22]=Ae,this.uint32[qe+12]=ye,this.float32[qe+13]=ve,this.float32[qe+14]=De,this.uint16[Me+30]=Re,this.uint16[Me+31]=Fe,t}}Fc.prototype.bytesPerElement=64,$e("StructArrayLayout8i15ui1ul2f2ui64",Fc);class u extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.float32[1*t+0]=n,t}}u.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",u);class e extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[6*t+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}e.prototype.bytesPerElement=12,$e("StructArrayLayout1ui2f12",e);class i extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=4*t;return this.uint32[2*t+0]=n,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}i.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",i);class s extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.uint16[c+0]=n,this.uint16[c+1]=a,t}}s.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",s);class l extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint16[1*t+0]=n,t}}l.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",l);class h extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.float32[p+0]=n,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}h.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",h);class f extends Hs{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)}}f.prototype.size=20;class _ extends Lc{get(t){return new f(this,t)}}$e("CollisionBoxArray",_);class x extends Hs{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]}}x.prototype.size=48;class T extends rl{get(t){return new x(this,t)}}$e("PlacedSymbolArray",T);class P extends Hs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}P.prototype.size=64;class E extends Fc{get(t){return new P(this,t)}}$e("SymbolInstanceArray",E);class k extends u{getoffsetX(t){return this.float32[1*t+0]}}$e("GlyphOffsetArray",k);class F extends Qo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}$e("SymbolLineVertexArray",F);class O extends Hs{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}O.prototype.size=12;class H extends e{get(t){return new O(this,t)}}$e("TextAnchorOffsetArray",H);class q extends Hs{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}q.prototype.size=8;class W extends i{get(t){return new q(this,t)}}$e("FeatureIndexArray",W);class K extends Ws{}class ee extends Ws{}class te extends Ws{}class re extends el{}class se extends Xs{}class ne extends ns{}class de extends Ks{}class me extends Dc{}class Te extends as{}class Se extends Ma{}class be extends tl{}class je extends Bc{}class Be extends il{}class ke extends s{}const We=vi([{name:"a_pos",components:2,type:"Int16"}],4),{members:mt}=We;class lt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,n,a,c){const d=this.segments[this.segments.length-1];return t>lt.MAX_VERTEX_ARRAY_LENGTH&&Vi(`Max vertices per segment is ${lt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${lt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>lt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,a,c):d}createNewSegment(t,n,a){const c={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,n,a){return this.prepareSegment(0,t,n,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const n in t.vaos)t.vaos[n].destroy()}static simpleSegment(t,n,a,c){return new lt([{vertexOffset:t,primitiveOffset:n,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function ei(r,t){return 256*(r=Vt(Math.floor(r),0,255))+Vt(Math.floor(t),0,255)}lt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",lt);const Dt=vi([{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 ti,Wt,jt,At={exports:{}},Ri={exports:{}},Pi={exports:{}},$i=function(){if(jt)return At.exports;jt=1;var r=(ti||(ti=1,Ri.exports=function(n,a){var c,d,p,m,y,w,M,C;for(d=n.length-(c=3&n.length),p=a,y=3432918353,w=461845907,C=0;C<d;)M=255&n.charCodeAt(C)|(255&n.charCodeAt(++C))<<8|(255&n.charCodeAt(++C))<<16|(255&n.charCodeAt(++C))<<24,++C,p=27492+(65535&(m=5*(65535&(p=(p^=M=(65535&(M=(M=(65535&M)*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&n.charCodeAt(C+2))<<16;case 2:M^=(255&n.charCodeAt(C+1))<<8;case 1:p^=M=(65535&(M=(M=(65535&(M^=255&n.charCodeAt(C)))*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return p^=n.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),Ri.exports),t=(Wt||(Wt=1,Pi.exports=function(n,a){for(var c,d=n.length,p=a^d,m=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(m)|(255&n.charCodeAt(++m))<<8|(255&n.charCodeAt(++m))<<16|(255&n.charCodeAt(++m))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&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}),Pi.exports);return At.exports=r,At.exports.murmur3=r,At.exports.murmur2=t,At.exports}(),tr=he($i);class fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,c){this.ids.push(ta(t)),this.positions.push(n,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=ta(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=n?c=p:a=p+1}const d=[];for(;this.ids[a]===n;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,n){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return zn(a,c,0,a.length-1),n&&n.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const n=new fn;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function ta(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:tr(String(r))}function zn(r,t,n,a){for(;n<a;){const c=r[n+a>>1];let d=n-1,p=a+1;for(;;){do d++;while(r[d]<c);do p--;while(r[p]>c);if(d>=p)break;An(r,d,p),An(t,3*d,3*p),An(t,3*d+1,3*p+1),An(t,3*d+2,3*p+2)}p-n<a-p?(zn(r,t,n,p),n=p+1):(zn(r,t,p+1,a),a=p)}}function An(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}$e("FeaturePositionMap",fn);class mn{constructor(t,n){this.gl=t.gl,this.location=n}}class Pa extends mn{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ca extends mn{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 Er extends mn{constructor(t,n){super(t,n),this.current=gt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const ia=new Float32Array(16);function Rn(r){return[ei(255*r.r,255*r.g),ei(255*r.b,255*r.a)]}class Dn{constructor(t,n,a){this.value=t,this.uniformNames=n.map(c=>`u_${c}`),this.type=a}setUniform(t,n,a){t.set(a.constantOr(this.value))}getBinding(t,n,a){return this.type==="color"?new Er(t,n):new Pa(t,n)}}class ai{constructor(t,n){this.uniformNames=n.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=t.tlbr}setUniform(t,n,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,n,a){return a.substr(0,9)==="u_pattern"?new Ca(t,n):new Pa(t,n)}}class Xt{constructor(t,n,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=n.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,n,a,c,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Ht(0),n,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,n,d)}_setPaintValue(t,n,a){if(this.type==="color"){const c=Rn(a);for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<n;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class _i{constructor(t,n,a,c,d,p){this.expression=t,this.uniformNames=n.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=c,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,c,d){const p=this.expression.evaluate(new Ht(this.zoom),n,{},c,[],d),m=this.expression.evaluate(new Ht(this.zoom+1),n,{},c,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,n,d,p)}_setPaintValue(t,n,a,c){if(this.type==="color"){const d=Rn(a),p=Rn(c);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,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,n){const a=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=Vt(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,n,a){return new Pa(t,n)}}class ii{constructor(t,n,a,c,d,p){this.expression=t,this.type=n,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,n,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,n.patterns&&n.patterns[this.layerId],a)}updatePaintArray(t,n,a,c,d){this._setPaintValues(t,n,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,n,a,c){if(!c||!a)return;const{min:d,mid:p,max:m}=a,y=c[d],w=c[p],M=c[m];if(y&&w&&M)for(let C=t;C<n;C++)this.zoomInPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],w.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,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 zh{constructor(t,n,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof dn&&es(p.property.specification)))continue;const m=Kd(d,t.type),y=p.value,w=p.property.specification.type,M=p.property.useIntegerZoom,C=p.property.specification["property-type"],z=C==="cross-faded"||C==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=z?new ai(y.value,m):new Dn(y.value,m,w),c.push(`/u_${d}`);else if(y.kind==="source"||z){const D=Ah(d,w,"source");this.binders[d]=z?new ii(y,w,M,n,D,t.id):new Xt(y,m,w,D),c.push(`/a_${d}`)}else{const D=Ah(d,w,"composite");this.binders[d]=new _i(y,m,w,M,n,D),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const n=this.binders[t];return n instanceof Xt||n instanceof _i?n.maxValue:0}populatePaintArrays(t,n,a,c,d){for(const p in this.binders){const m=this.binders[p];(m instanceof Xt||m instanceof _i||m instanceof ii)&&m.populatePaintArray(t,n,a,c,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const c=this.binders[a];c instanceof ai&&c.setConstantPatternPositions(t,n)}}updatePaintArrays(t,n,a,c,d){let p=!1;for(const m in t){const y=n.getPositions(m);for(const w of y){const M=a.feature(w.index);for(const C in this.binders){const z=this.binders[C];if((z instanceof Xt||z instanceof _i||z instanceof ii)&&z.expression.isStateDependent===!0){const D=c.paint.get(C);z.expression=D.value,z.updatePaintArray(w.start,w.end,M,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const n in this.binders){const a=this.binders[n];(a instanceof Dn||a instanceof ai)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Xt||a instanceof _i)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof ii)for(let c=0;c<Dt.members.length;c++)t.push(Dt.members[c].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Dn||a instanceof ai||a instanceof _i)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,n){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof Dn||d instanceof ai||d instanceof _i){for(const p of d.uniformNames)if(n[p]){const m=d.getBinding(t,n[p],p);a.push({name:p,property:c,binding:m})}}}return a}setUniforms(t,n,a,c){for(const{name:d,property:p,binding:m}of n)this.binders[p].setUniform(m,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const n in this.binders){const a=this.binders[n];if(t&&a instanceof ii){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof Xt||a instanceof _i)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof Xt||a instanceof _i||a instanceof ii)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof Xt||n instanceof _i||n instanceof ii)&&n.destroy()}}}class Ia{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new zh(c,n,a);this.needsUpload=!1,this._featureMap=new fn,this._bufferOffset=0}populatePaintArrays(t,n,a,c,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,n,c,d,p);n.id!==void 0&&this._featureMap.add(n.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,n,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,n,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Kd(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 Ah(r,t,n){const a={color:{source:ns,composite:h},number:{source:u,composite:ns}},c=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 c&&c[n]||a[t][n]}$e("ConstantBinder",Dn),$e("CrossFadedConstantBinder",ai),$e("SourceExpressionBinder",Xt),$e("CrossFadedCompositeBinder",ii),$e("CompositeExpressionBinder",_i),$e("ProgramConfiguration",zh,{omit:["_buffers"]}),$e("ProgramConfigurationSet",Ia);const Oc=Math.pow(2,14)-1,Rh=-Oc-1;function kr(r){const t=Qe/r.extent,n=r.loadGeometry();for(let a=0;a<n.length;a++){const c=n[a];for(let d=0;d<c.length;d++){const p=c[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=Vt(m,Rh,Oc),p.y=Vt(y,Rh,Oc),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&Vi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function ra(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?kr(r):[]}}const jc=-32768;function Dh(r,t,n,a,c){r.emplaceBack(jc+8*t+a,jc+8*n+c)}class Ys{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ee,this.indexArray=new Be,this.segments=new lt,this.programConfigurations=new Ia(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){const c=this.layers[0],d=[];let p=null,m=!1,y=c.type==="heatmap";if(c.type==="circle"){const M=c;p=M.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||M.paint.get("circle-pitch-alignment")==="map"}const w=y?n.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:z,sourceLayerIndex:D}of t){const B=this.layers[0]._featureFilter.needGeometry,j=ra(M,B);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),j,a))continue;const $=m?p.evaluate(j,{},a):void 0,X={id:C,properties:M.properties,type:M.type,sourceLayerIndex:D,index:z,geometry:B?j.geometry:kr(M),patterns:{},sortKey:$};d.push(X)}m&&d.sort((M,C)=>M.sortKey-C.sortKey);for(const M of d){const{geometry:C,index:z,sourceLayerIndex:D}=M,B=t[z].feature;this.addFeature(M,C,z,a,w),n.featureIndex.insert(B,C,z,D,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,mt),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,n,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const y of n)for(const w of y){const M=w.x,C=w.y;if(M<0||M>=Qe||C<0||C>=Qe)continue;const z=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),D=z.vertexLength;for(let B=0;B<m;B++)for(let j=0;j<m;j++)Dh(this.layoutVertexArray,M,C,p[j],p[B]);for(let B=0;B<m-1;B++)for(let j=0;j<m-1;j++){const $=D+B*m+j,X=D+(B+1)*m+j;this.indexArray.emplaceBack($,X+1,$+1),this.indexArray.emplaceBack($,X,X+1)}z.vertexLength+=m*m,z.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function Nc(r,t){for(let n=0;n<r.length;n++)if(Js(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Js(r,t[n]))return!0;return!!Yd(r,t)}function Zc(r,t,n){return!!Js(r,t)||!!Jd(t,r,n)}function Yf(r,t){if(r.length===1)return Qf(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let c=0;c<a.length;c++)if(Js(r,a[c]))return!0}for(let n=0;n<r.length;n++)if(Qf(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Yd(r,t[n]))return!0;return!1}function yx(r,t,n){if(r.length>1){if(Yd(r,t))return!0;for(let a=0;a<t.length;a++)if(Jd(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(Jd(r[a],t,n))return!0;return!1}function Yd(r,t){if(r.length===0||t.length===0)return!1;for(let n=0;n<r.length-1;n++){const a=r[n],c=r[n+1];for(let d=0;d<t.length-1;d++)if(xx(a,c,t[d],t[d+1]))return!0}return!1}function xx(r,t,n,a){return Nt(r,n,a)!==Nt(t,n,a)&&Nt(r,t,n)!==Nt(r,t,a)}function Jd(r,t,n){const a=n*n;if(t.length===1)return r.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(Jf(r,t[c-1],t[c])<a)return!0;return!1}function Jf(r,t,n){const a=t.distSqr(n);if(a===0)return r.distSqr(t);const c=((r.x-t.x)*(n.x-t.x)+(r.y-t.y)*(n.y-t.y))/a;return r.distSqr(c<0?t:c>1?n:n.sub(t)._mult(c)._add(t))}function Qf(r,t){for(let n=0;n<r.length;n++)if(Js(r[n],t))return!0;return!1}function Js(r,t){let n=!1;for(let a=0,c=r.length-1;a<r.length;c=a++){const d=r[a],p=r[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(n=!n)}return n}function vx(r,t,n){const a=n[0],c=n[2];if(r.x<a.x&&t.x<a.x||r.x>c.x&&t.x>c.x||r.y<a.y&&t.y<a.y||r.y>c.y&&t.y>c.y)return!1;const d=Nt(r,t,n[0]);return d!==Nt(r,t,n[1])||d!==Nt(r,t,n[2])||d!==Nt(r,t,n[3])}function Vc(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function Lh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Bh(r,t,n,a,c){if(!t[0]&&!t[1])return r;const d=Ve.convert(t)._mult(c);n==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<r.length;m++)p.push(r[m].sub(d));return p}let em,tm;$e("CircleBucket",Ys,{omit:["layers"]});var bx={get paint(){return tm=tm||new br({"circle-radius":new at(V.paint_circle["circle-radius"]),"circle-color":new at(V.paint_circle["circle-color"]),"circle-blur":new at(V.paint_circle["circle-blur"]),"circle-opacity":new at(V.paint_circle["circle-opacity"]),"circle-translate":new Ye(V.paint_circle["circle-translate"]),"circle-translate-anchor":new Ye(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ye(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ye(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new at(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new at(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new at(V.paint_circle["circle-stroke-opacity"])})},get layout(){return em=em||new br({"circle-sort-key":new at(V.layout_circle["circle-sort-key"])})}};class wx extends pn{constructor(t){super(t,bx)}createBucket(t){return new Ys(t)}queryRadius(t){const n=t;return Vc("circle-radius",this,n)+Vc("circle-stroke-width",this,n)+Lh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const w=Bh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),M=this.paint.get("circle-radius").evaluate(n,a)+this.paint.get("circle-stroke-width").evaluate(n,a),C=this.paint.get("circle-pitch-alignment")==="map",z=C?w:function(B,j,$,X){return B.map(ae=>im(ae,j,$,X))}(w,d,m,y),D=C?M*p:M;for(const B of c)for(const j of B){const $=C?j:im(j,d,m,y);let X=D;const ae=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=ae/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/ae),Zc(z,$,X))return!0}return!1}}function im(r,t,n,a){const c=t.projectTileCoordinates(r.x,r.y,n,a).point;return new Ve((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class rm extends Ys{}let nm;$e("HeatmapBucket",rm,{omit:["layers"]});var Tx={get paint(){return nm=nm||new br({"heatmap-radius":new at(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new at(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ye(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ac(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ye(V.paint_heatmap["heatmap-opacity"])})}};function Qd(r,{width:t,height:n},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*n*a}`)}else c=new Uint8Array(t*n*a);return r.width=t,r.height=n,r.data=c,r}function am(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const c=Qd({},{width:t,height:n},a);ep(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,n)},a),r.width=t,r.height=n,r.data=c.data}function ep(r,t,n,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const w=((n.y+y)*r.width+n.x)*d,M=((a.y+y)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)m[M+C]=p[w+C]}return t}class Uc{constructor(t,n){Qd(this,t,1,n)}resize(t){am(this,t,1)}clone(){return new Uc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){ep(t,n,a,c,d,1)}}class Kr{constructor(t,n){Qd(this,t,4,n)}resize(t){am(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Kr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){ep(t,n,a,c,d,4)}}function sm(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,c=r.image||new Kr({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 w=r.expression.evaluate(t);c.data[p+m+0]=Math.floor(255*w.r/w.a),c.data[p+m+1]=Math.floor(255*w.g/w.a),c.data[p+m+2]=Math.floor(255*w.b/w.a),c.data[p+m+3]=Math.floor(255*w.a)};if(r.clips)for(let p=0,m=0;p<a;++p,m+=4*n)for(let y=0,w=0;y<n;y++,w+=4){const M=y/(n-1),{start:C,end:z}=r.clips[p];d(m,w,C*(1-M)+z*M)}else for(let p=0,m=0;p<n;p++,m+=4)d(0,m,p/(n-1));return c}$e("AlphaImage",Uc),$e("RGBAImage",Kr);const tp="big-fb";class Mx extends pn{createBucket(t){return new rm(t)}constructor(t){super(t,Tx),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(tp)&&this.heatmapFbos.delete(tp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let om;var Sx={get paint(){return om=om||new br({"hillshade-illumination-direction":new Ye(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ye(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ye(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ye(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ye(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ye(V.paint_hillshade["hillshade-accent-color"])})}};class Px extends pn{constructor(t){super(t,Sx)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Cx=vi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ix}=Cx;function ip(r,t,n){const a=n.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${r}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,a[m.to]=!0,a[m.from]=!0)}return c}function rp(r,t,n,a,c){const d=c.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,{},c.availableImages),w=m.evaluate({zoom:a},n,{},c.availableImages),M=m.evaluate({zoom:a+1},n,{},c.availableImages);y=y&&y.name?y.name:y,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,d[y]=!0,d[w]=!0,d[M]=!0,n.patterns[p.id]={min:y,mid:w,max:M}}}return n}function lm(r,t,n,a,c){let d;if(c===function(p,m,y,w){let M=0;for(let C=m,z=y-w;C<y;C+=w)M+=(p[z]-p[C])*(p[C+1]+p[z+1]),z=C;return M}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=dm(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=dm(p/a|0,r[p],r[p+1],d);return d&&nl(d,d.next)&&(Hc(d),d=d.next),d}function Qs(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!nl(a,a.next)&&bi(a.prev,a,a.next)!==0)a=a.next;else{if(Hc(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function $c(r,t,n,a,c,d,p){if(!r)return;!p&&d&&function(y,w,M,C){let z=y;do z.z===0&&(z.z=np(z.x,z.y,w,M,C)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==y);z.prevZ.nextZ=null,z.prevZ=null,function(D){let B,j=1;do{let $,X=D;D=null;let ae=null;for(B=0;X;){B++;let Y=X,R=0;for(let Q=0;Q<j&&(R++,Y=Y.nextZ,Y);Q++);let U=j;for(;R>0||U>0&&Y;)R!==0&&(U===0||!Y||X.z<=Y.z)?($=X,X=X.nextZ,R--):($=Y,Y=Y.nextZ,U--),ae?ae.nextZ=$:D=$,$.prevZ=ae,ae=$;X=Y}ae.nextZ=null,j*=2}while(B>1)}(z)}(r,a,c,d);let m=r;for(;r.prev!==r.next;){const y=r.prev,w=r.next;if(d?kx(r,a,c,d):Ex(r))t.push(y.i,r.i,w.i),Hc(r),r=w.next,m=w.next;else if((r=w)===m){p?p===1?$c(r=zx(Qs(r),t),t,n,a,c,d,2):p===2&&Ax(r,t,n,a,c,d):$c(Qs(r),t,n,a,c,d,1);break}}}function Ex(r){const t=r.prev,n=r,a=r.next;if(bi(t,n,a)>=0)return!1;const c=t.x,d=n.x,p=a.x,m=t.y,y=n.y,w=a.y,M=Math.min(c,d,p),C=Math.min(m,y,w),z=Math.max(c,d,p),D=Math.max(m,y,w);let B=a.next;for(;B!==t;){if(B.x>=M&&B.x<=z&&B.y>=C&&B.y<=D&&Gc(c,m,d,y,p,w,B.x,B.y)&&bi(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function kx(r,t,n,a){const c=r.prev,d=r,p=r.next;if(bi(c,d,p)>=0)return!1;const m=c.x,y=d.x,w=p.x,M=c.y,C=d.y,z=p.y,D=Math.min(m,y,w),B=Math.min(M,C,z),j=Math.max(m,y,w),$=Math.max(M,C,z),X=np(D,B,t,n,a),ae=np(j,$,t,n,a);let Y=r.prevZ,R=r.nextZ;for(;Y&&Y.z>=X&&R&&R.z<=ae;){if(Y.x>=D&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Gc(m,M,y,C,w,z,Y.x,Y.y)&&bi(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,R.x>=D&&R.x<=j&&R.y>=B&&R.y<=$&&R!==c&&R!==p&&Gc(m,M,y,C,w,z,R.x,R.y)&&bi(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=D&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Gc(m,M,y,C,w,z,Y.x,Y.y)&&bi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;R&&R.z<=ae;){if(R.x>=D&&R.x<=j&&R.y>=B&&R.y<=$&&R!==c&&R!==p&&Gc(m,M,y,C,w,z,R.x,R.y)&&bi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function zx(r,t){let n=r;do{const a=n.prev,c=n.next.next;!nl(a,c)&&um(a,n,n.next,c)&&qc(a,c)&&qc(c,a)&&(t.push(a.i,n.i,c.i),Hc(n),Hc(n.next),n=r=c),n=n.next}while(n!==r);return Qs(n)}function Ax(r,t,n,a,c,d){let p=r;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Fx(p,m)){let y=hm(p,m);return p=Qs(p,p.next),y=Qs(y,y.next),$c(p,t,n,a,c,d,0),void $c(y,t,n,a,c,d,0)}m=m.next}p=p.next}while(p!==r)}function Rx(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 Dx(r,t){const n=function(c,d){let p=d;const m=c.x,y=c.y;let w,M=-1/0;if(nl(c,p))return p;do{if(nl(c,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>M&&(M=j,w=p.x<p.next.x?p:p.next,j===m))return w}p=p.next}while(p!==d);if(!w)return null;const C=w,z=w.x,D=w.y;let B=1/0;p=w;do{if(m>=p.x&&p.x>=z&&m!==p.x&&cm(y<D?m:M,y,z,D,y<D?M:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);qc(p,c)&&(j<B||j===B&&(p.x>w.x||p.x===w.x&&Lx(w,p)))&&(w=p,B=j)}p=p.next}while(p!==C);return w}(r,t);if(!n)return t;const a=hm(n,r);return Qs(a,a.next),Qs(n,n.next)}function Lx(r,t){return bi(r.prev,r,t.prev)<0&&bi(t.next,r,r.next)<0}function np(r,t,n,a,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Bx(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 cm(r,t,n,a,c,d,p,m){return(c-p)*(t-m)>=(r-p)*(d-m)&&(r-p)*(a-m)>=(n-p)*(t-m)&&(n-p)*(d-m)>=(c-p)*(a-m)}function Gc(r,t,n,a,c,d,p,m){return!(r===p&&t===m)&&cm(r,t,n,a,c,d,p,m)}function Fx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(n,a){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==a.i&&c.next.i!==a.i&&um(c,c.next,n,a))return!0;c=c.next}while(c!==n);return!1}(r,t)&&(qc(r,t)&&qc(t,r)&&function(n,a){let c=n,d=!1;const p=(n.x+a.x)/2,m=(n.y+a.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d}(r,t)&&(bi(r.prev,r,t.prev)||bi(r,t.prev,t))||nl(r,t)&&bi(r.prev,r,r.next)>0&&bi(t.prev,t,t.next)>0)}function bi(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function nl(r,t){return r.x===t.x&&r.y===t.y}function um(r,t,n,a){const c=Oh(bi(r,t,n)),d=Oh(bi(r,t,a)),p=Oh(bi(n,a,r)),m=Oh(bi(n,a,t));return c!==d&&p!==m||!(c!==0||!Fh(r,n,t))||!(d!==0||!Fh(r,a,t))||!(p!==0||!Fh(n,r,a))||!(m!==0||!Fh(n,t,a))}function Fh(r,t,n){return t.x<=Math.max(r.x,n.x)&&t.x>=Math.min(r.x,n.x)&&t.y<=Math.max(r.y,n.y)&&t.y>=Math.min(r.y,n.y)}function Oh(r){return r>0?1:r<0?-1:0}function qc(r,t){return bi(r.prev,r,r.next)<0?bi(r,t,r.next)>=0&&bi(r,r.prev,t)>=0:bi(r,t,r.prev)<0||bi(r,r.next,t)<0}function hm(r,t){const n=ap(r.i,r.x,r.y),a=ap(t.i,t.x,t.y),c=r.next,d=t.prev;return r.next=t,t.prev=r,n.next=c,c.prev=n,a.next=n,n.prev=a,d.next=a,a.prev=d,a}function dm(r,t,n,a){const c=ap(r,t,n);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function Hc(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 ap(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class al{constructor(t,n){if(n>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=n}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class jh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}jh.noSubdivision=new jh({fill:new al(0,0),line:new al(0,0),tile:new al(0,0),stencil:new al(0,0),circle:1}),$e("SubdivisionGranularityExpression",al),$e("SubdivisionGranularitySetting",jh);const sl=-32768,Wc=32767;class Ox{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Qe/t,this._canonical=n}_getKey(t,n){return(t+=32768)<<16|(n+=32768)<<0}_vertexToIndex(t,n){if(t<-32768||n<-32768||t>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(n),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let m=0;m<d.length;m+=3){const y=d[m],w=d[m+1],M=d[m+2],C=c[2*y],z=c[2*y+1];(c[2*w]-C)*(c[2*M+1]-z)-(c[2*w+1]-z)*(c[2*M]-C)>0?(p.push(y),p.push(M),p.push(w)):(p.push(y),p.push(w),p.push(M))}return p}(this._vertexBuffer,t);const n=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let m=1/0,y=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const $=p[2*j],X=p[2*j+1];m=Math.min(m,$),w=Math.max(w,$),y=Math.min(y,X),M=Math.max(M,X)}if(m===w||y===M)continue;const C=Math.floor(m/this._granularityCellSize),z=Math.ceil(w/this._granularityCellSize),D=Math.floor(y/this._granularityCellSize),B=Math.ceil(M/this._granularityCellSize);if(C!==z||D!==B)for(let j=D;j<B;j++){const $=this._scanlineGenerateVertexRingForCellRow(j,p,d);jx(this._vertexBuffer,$,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(t,n,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=n[2*m],w=n[2*m+1],M=n[2*(m+1)%6],C=n[(2*(m+1)+1)%6],z=n[2*(m+2)%6],D=n[(2*(m+2)+1)%6],B=M-y,j=C-w,$=B===0,X=j===0,ae=(c-w)/j,Y=(d-w)/j,R=Math.min(ae,Y),U=Math.max(ae,Y);if(!X&&(R>=1||U<=0)||X&&(w<c||w>d)){C>=c&&C<=d&&p.push(a[(m+1)%3]);continue}!X&&R>0&&p.push(this._vertexToIndex(y+B*R,w+j*R));const Q=y+B*Math.max(R,0),fe=y+B*Math.min(U,1);$||this._generateIntraEdgeVertices(p,y,w,M,C,Q,fe),!X&&U<1&&p.push(this._vertexToIndex(y+B*U,w+j*U)),(X||C>=c&&C<=d)&&p.push(a[(m+1)%3]),!X&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,y,w,M,C,z,D,fe,c,d)}return p}_generateIntraEdgeVertices(t,n,a,c,d,p,m){const y=c-n,w=d-a,M=w===0,C=M?Math.min(n,c):Math.min(p,m),z=M?Math.max(n,c):Math.max(p,m),D=Math.floor(C/this._granularityCellSize)+1,B=Math.ceil(z/this._granularityCellSize)-1;if(M?n<c:p<m)for(let j=D;j<=B;j++){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/y))}else for(let j=B;j>=D;j--){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/y))}}_generateInterEdgeVertices(t,n,a,c,d,p,m,y,w,M){const C=d-a,z=p-c,D=m-d,B=(w-d)/D,j=(M-d)/D,$=Math.min(B,j),X=Math.max(B,j),ae=c+z*$;let Y=Math.floor(Math.min(ae,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ae,y)/this._granularityCellSize)-1,U=y<ae;const Q=D===0;if(Q&&(m===w||m===M))return;if(Q||$>=1||X<=0){const Ae=a-m,ye=p+(n-p)*Math.min((w-m)/Ae,(M-m)/Ae);Y=Math.floor(Math.min(ye,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ye,y)/this._granularityCellSize)-1,U=y<ye}const fe=C>0?M:w;if(U)for(let Ae=Y;Ae<=R;Ae++)t.push(this._vertexToIndex(Ae*this._granularityCellSize,fe));else for(let Ae=R;Ae>=Y;Ae--)t.push(this._vertexToIndex(Ae*this._granularityCellSize,fe))}_generateOutline(t){const n=[];for(const a of t){const c=eo(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);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===sl&&(t[n+1]=-32767),a===Wc&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,c,d,p){c>d!=(p===sl)?(t.push(n),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(n),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,n,a){const c=this._vertexBuffer,d=Qe,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],w=t[m-1],M=t[m],C=c[2*y],z=c[2*y+1],D=c[2*w],B=c[2*w+1],j=c[2*M],$=c[2*M+1];n&&(z===0&&B===0&&this._generatePoleQuad(t,y,w,C,D,sl),B===0&&$===0&&this._generatePoleQuad(t,w,M,D,j,sl),$===0&&z===0&&this._generatePoleQuad(t,M,y,j,C,sl)),a&&(z===d&&B===d&&this._generatePoleQuad(t,y,w,C,D,Wc),B===d&&$===d&&this._generatePoleQuad(t,w,M,D,j,Wc),$===d&&z===d&&this._generatePoleQuad(t,M,y,j,C,Wc))}}_initializeVertices(t){for(let n=0;n<t.length;n+=2)this._vertexToIndex(t[n],t[n+1])}subdividePolygonInternal(t,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(m){const y=[],w=[];for(const M of m)if(M.length!==0){M!==m[0]&&y.push(w.length/2);for(let C=0;C<M.length;C++)w.push(M[C].x),w.push(M[C].y)}return{flattened:w,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(w,M,C=2){const z=M&&M.length,D=z?M[0]*C:w.length;let B=lm(w,0,D,C,!0);const j=[];if(!B||B.next===B.prev)return j;let $,X,ae;if(z&&(B=function(Y,R,U,Q){const fe=[];for(let Ae=0,ye=R.length;Ae<ye;Ae++){const ve=lm(Y,R[Ae]*Q,Ae<ye-1?R[Ae+1]*Q:Y.length,Q,!1);ve===ve.next&&(ve.steiner=!0),fe.push(Bx(ve))}fe.sort(Rx);for(let Ae=0;Ae<fe.length;Ae++)U=Dx(fe[Ae],U);return U}(w,M,B,C)),w.length>80*C){$=1/0,X=1/0;let Y=-1/0,R=-1/0;for(let U=C;U<D;U+=C){const Q=w[U],fe=w[U+1];Q<$&&($=Q),fe<X&&(X=fe),Q>Y&&(Y=Q),fe>R&&(R=fe)}ae=Math.max(Y-$,R-X),ae=ae!==0?32767/ae:0}return $c(B,j,C,$,X,ae,0),j}(a,c),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 c=0;c<n.length;c++)a.push(this._vertexToIndex(t[2*n[c]],t[2*n[c]+1]));return a}_pointArrayToIndices(t){const n=[];for(let a=0;a<t.length;a++){const c=t[a];n.push(this._vertexToIndex(c.x,c.y))}return n}}function pm(r,t,n,a=!0){return new Ox(n,t).subdividePolygonInternal(r,a)}function eo(r,t,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],c=r[r.length-1],d=n&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...r,r[0]]:[...r];const p=Math.floor(Qe/t),m=[];m.push(new Ve(r[0].x,r[0].y));const y=r.length,w=d?y:y-1;for(let M=0;M<w;M++){const C=r[M],z=M<y-1?r[M+1]:r[0],D=C.x,B=C.y,j=z.x,$=z.y,X=D!==j,ae=B!==$;if(!X&&!ae)continue;const Y=j-D,R=$-B,U=Math.abs(Y),Q=Math.abs(R);let fe=D,Ae=B;for(;;){const ve=Y>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,De=R>0?(Math.floor(Ae/p)+1)*p:(Math.ceil(Ae/p)-1)*p,Re=Math.abs(fe-ve),Fe=Math.abs(Ae-De),Me=Math.abs(fe-j),qe=Math.abs(Ae-$),it=X?Re/U:Number.POSITIVE_INFINITY,et=ae?Fe/Q:Number.POSITIVE_INFINITY;if((Me<=Re||!X)&&(qe<=Fe||!ae))break;if(it<et&&X||!ae){fe=ve,Ae+=R*it;const Xe=new Ve(fe,Math.round(Ae));m[m.length-1].x===Xe.x&&m[m.length-1].y===Xe.y||m.push(Xe)}else{fe+=Y*et,Ae=De;const Xe=new Ve(Math.round(fe),Ae);m[m.length-1].x===Xe.x&&m[m.length-1].y===Xe.y||m.push(Xe)}}const ye=new Ve(j,$);m[m.length-1].x===ye.x&&m[m.length-1].y===ye.y||m.push(ye)}return m}function jx(r,t,n){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=r[2*t[0]];for(let y=1;y<t.length;y++){const w=r[2*t[y]];w<c&&(c=w,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,w=(m+1)%d,M=r[2*t[y]],C=r[2*t[w]],z=r[2*t[p]],D=r[2*t[p]+1],B=r[2*t[m]+1];let j=!1;if(M<C)j=!0;else if(M>C)j=!1;else{const $=B-D,X=-(r[2*t[m]]-z),ae=D<B?1:-1;((M-z)*$+(r[2*t[y]+1]-D)*X)*ae>((C-z)*$+(r[2*t[w]+1]-D)*X)*ae&&(j=!0)}if(j){const $=t[y],X=t[p],ae=t[m];$!==X&&$!==ae&&X!==ae&&n.push(ae,X,$),p--,p<0&&(p=d-1)}else{const $=t[w],X=t[p],ae=t[m];$!==X&&$!==ae&&X!==ae&&n.push(ae,X,$),m++,m>=d&&(m=0)}if(y===w)break}}function fm(r,t,n,a,c,d,p,m,y){const w=c.length/2,M=p&&m&&y;if(w<lt.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(w,n,a),z=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(z+d[j],z+d[j+1],z+d[j+2]);let D,B;C.vertexLength+=w,C.primitiveLength+=d.length/3,M&&(B=p.prepareSegment(w,n,m),D=B.vertexLength,B.vertexLength+=w);for(let j=0;j<c.length;j+=2)r(c[j],c[j+1]);if(M)for(let j=0;j<y.length;j++){const $=y[j];for(let X=1;X<$.length;X+=2)m.emplaceBack(D+$[X-1],D+$[X]);B.primitiveLength+=$.length/2}}else(function(C,z,D,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const ae={count:0};let Y=0,R=C.getOrCreateLatestSegment(z,D),U=R.vertexLength;for(let Q=2;Q<j.length;Q+=3){const fe=j[Q-2],Ae=j[Q-1],ye=j[Q];let ve=X[fe]<Y,De=X[Ae]<Y,Re=X[ye]<Y;R.vertexLength+((ve?1:0)+(De?1:0)+(Re?1:0))>lt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(z,D),Y=ae.count,ve=!0,De=!0,Re=!0,U=0);const Fe=Xc(X,B,$,ae,fe,ve,R),Me=Xc(X,B,$,ae,Ae,De,R),qe=Xc(X,B,$,ae,ye,Re,R);D.emplaceBack(U+Fe-Y,U+Me-Y,U+qe-Y),R.primitiveLength++}})(t,n,a,c,d,r),M&&function(C,z,D,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const ae={count:0};let Y=0,R=C.getOrCreateLatestSegment(z,D),U=R.vertexLength;for(let Q=0;Q<j.length;Q++){const fe=j[Q];for(let Ae=1;Ae<j[Q].length;Ae+=2){const ye=fe[Ae-1],ve=fe[Ae];let De=X[ye]<Y,Re=X[ve]<Y;R.vertexLength+((De?1:0)+(Re?1:0))>lt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(z,D),Y=ae.count,De=!0,Re=!0,U=0);const Fe=Xc(X,B,$,ae,ye,De,R),Me=Xc(X,B,$,ae,ve,Re,R);D.emplaceBack(U+Fe-Y,U+Me-Y),R.primitiveLength++}}}(p,n,m,c,y,r),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function Xc(r,t,n,a,c,d,p){if(d){const m=a.count;return n(t[2*c],t[2*c+1]),r[c]=a.count,a.count++,p.vertexLength++,m}return r[c]}class sp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new te,this.indexArray=new Be,this.indexArray2=new ke,this.programConfigurations=new Ia(t.layers,t.zoom),this.segments=new lt,this.segments2=new lt,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=ip("fill",this.layers,n);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,z=ra(m,C);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),z,a))continue;const D=d?c.evaluate(z,{},a,n.availableImages):void 0,B={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?z.geometry:kr(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=rp("fill",this.layers,m,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ix),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,n,a,c,d,p){for(const m of ko(n,500)){const y=pm(m,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;fm((M,C)=>{w.emplaceBack(M,C)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let mm,gm;$e("FillBucket",sp,{omit:["layers","patternFeatures"]});var Nx={get paint(){return gm=gm||new br({"fill-antialias":new Ye(V.paint_fill["fill-antialias"]),"fill-opacity":new at(V.paint_fill["fill-opacity"]),"fill-color":new at(V.paint_fill["fill-color"]),"fill-outline-color":new at(V.paint_fill["fill-outline-color"]),"fill-translate":new Ye(V.paint_fill["fill-translate"]),"fill-translate-anchor":new Ye(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new qs(V.paint_fill["fill-pattern"])})},get layout(){return mm=mm||new br({"fill-sort-key":new at(V.layout_fill["fill-sort-key"])})}};class Zx extends pn{constructor(t){super(t,Nx)}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 sp(t)}queryRadius(){return Lh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:c}){return Yf(Bh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),n)}isTileClipped(){return!0}}const Vx=vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ux=vi([{name:"a_centroid",components:2,type:"Int16"}],4),{members:$x}=Vx;var op,_m,lp,ym,cp,xm,vm,Nh={};function bm(){if(_m)return op;_m=1;var r=Le();function t(c,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=m,this._values=y,c.readFields(n,this,d)}function n(c,d,p){c==1?d.id=p.readVarint():c==2?function(m,y){for(var w=m.readVarint()+m.pos;m.pos<w;){var M=y._keys[m.readVarint()],C=y._values[m.readVarint()];y.properties[M]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,m=0,y=0,w=c.length,M=w-1;y<w;M=y++)m+=((p=c[M]).x-(d=c[y]).x)*(d.y+p.y);return m}return op=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var d,p=c.readVarint()+c.pos,m=1,y=0,w=0,M=0,C=[];c.pos<p;){if(y<=0){var z=c.readVarint();m=7&z,y=z>>3}if(y--,m===1||m===2)w+=c.readSVarint(),M+=c.readSVarint(),m===1&&(d&&C.push(d),d=[]),d.push(new r(w,M));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,m=0,y=0,w=0,M=1/0,C=-1/0,z=1/0,D=-1/0;c.pos<d;){if(m<=0){var B=c.readVarint();p=7&B,m=B>>3}if(m--,p===1||p===2)(y+=c.readSVarint())<M&&(M=y),y>C&&(C=y),(w+=c.readSVarint())<z&&(z=w),w>D&&(D=w);else if(p!==7)throw new Error("unknown command "+p)}return[M,z,C,D]},t.prototype.toGeoJSON=function(c,d,p){var m,y,w=this.extent*Math.pow(2,p),M=this.extent*c,C=this.extent*d,z=this.loadGeometry(),D=t.types[this.type];function B(X){for(var ae=0;ae<X.length;ae++){var Y=X[ae];X[ae]=[360*(Y.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+C)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<z.length;m++)j[m]=z[m][0];B(z=j);break;case 2:for(m=0;m<z.length;m++)B(z[m]);break;case 3:for(z=function(X){var ae=X.length;if(ae<=1)return[X];for(var Y,R,U=[],Q=0;Q<ae;Q++){var fe=a(X[Q]);fe!==0&&(R===void 0&&(R=fe<0),R===fe<0?(Y&&U.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&U.push(Y),U}(z),m=0;m<z.length;m++)for(y=0;y<z[m].length;y++)B(z[m][y])}z.length===1?z=z[0]:D="Multi"+D;var $={type:"Feature",geometry:{type:D,coordinates:z},properties:this.properties};return"id"in this&&($.id=this.id),$},op}function wm(){if(ym)return lp;ym=1;var r=bm();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(n,this,c),this.length=this._features.length}function n(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var m=null,y=p.readVarint()+p.pos;p.pos<y;){var w=p.readVarint()>>3;m=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return m}(d))}return lp=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,c,this.extent,this._keys,this._values)},lp}function Tm(){return vm||(vm=1,Nh.VectorTile=function(){if(xm)return cp;xm=1;var r=wm();function t(n,a,c){if(n===3){var d=new r(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return cp=function(n,a){this.layers=n.readFields(t,{},a)},cp}(),Nh.VectorTileFeature=bm(),Nh.VectorTileLayer=wm()),Nh}var Kc=he(Tm());const Gx=Kc.VectorTileFeature.types,up=Math.pow(2,13);function Yc(r,t,n,a,c,d,p,m){r.emplaceBack(t,n,2*Math.floor(a*up)+p,c*up*2,d*up*2,Math.round(m))}class hp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new re,this.centroidVertexArray=new K,this.indexArray=new Be,this.programConfigurations=new Ia(t.layers,t.zoom),this.segments=new lt,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.features=[],this.hasPattern=ip("fill-extrusion",this.layers,n);for(const{feature:c,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,w=ra(c,y);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),w,a))continue;const M={id:d,sourceLayerIndex:m,index:p,geometry:y?w.geometry:kr(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(rp("fill-extrusion",this.layers,M,this.zoom,n)):this.addFeature(M,M.geometry,p,a,{},n.subdivisionGranularity),n.featureIndex.insert(c,M.geometry,p,m,this.index,!0)}}addFeatures(t,n,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,n,a,t.subdivisionGranularity)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$x),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ux.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,n,a,c,d,p){for(const m of ko(n,500)){const y={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(y,c,t,m,p);const M=this.layoutVertexArray.length-w,C=Math.floor(y.x/y.sampleCount),z=Math.floor(y.y/y.sampleCount);for(let D=0;D<M;D++)this.centroidVertexArray.emplaceBack(C,z)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,n,a,c,d){if(c.length<1||Mm(c[0]))return;for(const C of c)C.length!==0&&qx(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(n.z),y=Gx[a.type]==="Polygon";for(const C of c){if(C.length===0||Mm(C))continue;const z=eo(C,m,y);this._generateSideFaces(z,p)}if(!y)return;const w=pm(c,n,m,!1),M=this.layoutVertexArray;fm((C,z)=>{Yc(M,C,z,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,n){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(Hx(d,p))continue;n.segment.vertexLength+4>lt.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),Yc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Yc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Yc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Yc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const w=n.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function qx(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 Hx(r,t){return r.x===t.x&&(r.x<0||r.x>Qe)||r.y===t.y&&(r.y<0||r.y>Qe)}function Mm(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Qe)||r.every(t=>t.y<0)||r.every(t=>t.y>Qe)}let Sm;$e("FillExtrusionBucket",hp,{omit:["layers","features"]});var Wx={get paint(){return Sm=Sm||new br({"fill-extrusion-opacity":new Ye(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new at(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new qs(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new at(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new at(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ye(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Xx extends pn{constructor(t){super(t,Wx)}createBucket(t){return new hp(t)}queryRadius(){return Lh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=Bh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),w=this.paint.get("fill-extrusion-height").evaluate(n,a),M=this.paint.get("fill-extrusion-base").evaluate(n,a),C=function(D,B,j){const $=[];for(const X of D){const ae=[X.x,X.y,0,1];xi(ae,ae,B),$.push(new Ve(ae[0]/ae[3],ae[1]/ae[3]))}return $}(y,m),z=function(D,B,j,$){const X=[],ae=[],Y=$[8]*B,R=$[9]*B,U=$[10]*B,Q=$[11]*B,fe=$[8]*j,Ae=$[9]*j,ye=$[10]*j,ve=$[11]*j;for(const De of D){const Re=[],Fe=[];for(const Me of De){const qe=Me.x,it=Me.y,et=$[0]*qe+$[4]*it+$[12],Xe=$[1]*qe+$[5]*it+$[13],vt=$[2]*qe+$[6]*it+$[14],hi=$[3]*qe+$[7]*it+$[15],Ii=vt+U,rr=hi+Q,Jr=et+fe,Ar=Xe+Ae,Gi=vt+ye,si=hi+ve,Di=new Ve((et+Y)/rr,(Xe+R)/rr);Di.z=Ii/rr,Re.push(Di);const qi=new Ve(Jr/si,Ar/si);qi.z=Gi/si,Fe.push(qi)}X.push(Re),ae.push(Fe)}return[X,ae]}(c,M,w,m);return function(D,B,j){let $=1/0;Yf(j,B)&&($=Pm(j,B[0]));for(let X=0;X<B.length;X++){const ae=B[X],Y=D[X];for(let R=0;R<ae.length-1;R++){const U=ae[R],Q=[U,ae[R+1],Y[R+1],Y[R],U];Nc(j,Q)&&($=Math.min($,Pm(j,Q)))}}return $!==1/0&&$}(z[0],z[1],C)}}function Jc(r,t){return r.x*t.x+r.y*t.y}function Pm(r,t){if(r.length===1){let n=0;const a=t[n++];let c;for(;!c||a.equals(c);)if(c=t[n++],!c)return 1/0;for(;n<t.length;n++){const d=t[n],p=r[0],m=c.sub(a),y=d.sub(a),w=p.sub(a),M=Jc(m,m),C=Jc(m,y),z=Jc(y,y),D=Jc(w,m),B=Jc(w,y),j=M*z-C*C,$=(z*D-C*B)/j,X=(M*B-C*D)/j,ae=a.z*(1-$-X)+c.z*$+d.z*X;if(isFinite(ae))return ae}return 1/0}{let n=1/0;for(const a of t)n=Math.min(n,a.z);return n}}const Kx=vi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Yx}=Kx,Jx=vi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Qx}=Jx,ev=Kc.VectorTileFeature.types,tv=Math.cos(Math.PI/180*37.5),Cm=Math.pow(2,14)/.5;class dp{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 se,this.layoutVertexArray2=new ne,this.indexArray=new Be,this.programConfigurations=new Ia(t.layers,t.zoom),this.segments=new lt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=ip("line",this.layers,n);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,z=ra(m,C);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),z,a))continue;const D=d?c.evaluate(z,{},a):void 0,B={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?z.geometry:kr(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=rp("line",this.layers,m,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Qx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yx),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,n,a,c,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),w=m.get("line-cap"),M=m.get("line-miter-limit"),C=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const z of n)this.addLine(z,t,y,w,M,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,n,a,c,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=eo(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y<t.length-1;Y++)this.totalDistance+=t[Y].dist(t[Y+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=ev[n.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let C=0;for(;C<M-1&&t[C].equals(t[C+1]);)C++;if(M<(w?3:2))return;a==="bevel"&&(d=1.05);const z=this.overscaling<=16?15*Qe/(512*this.overscaling):0,D=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let B,j,$,X,ae;this.e1=this.e2=-1,w&&(B=t[M-2],ae=t[C].sub(B)._unit()._perp());for(let Y=C;Y<M;Y++){if($=Y===M-1?w?t[C+1]:void 0:t[Y+1],$&&t[Y].equals($))continue;ae&&(X=ae),B&&(j=B),B=t[Y],ae=$?$.sub(B)._unit()._perp():X,X=X||ae;let R=X.add(ae);R.x===0&&R.y===0||R._unit();const U=X.x*ae.x+X.y*ae.y,Q=R.x*ae.x+R.y*ae.y,fe=Q!==0?1/Q:1/0,Ae=2*Math.sqrt(2-2*Q),ye=Q<tv&&j&&$,ve=X.x*ae.y-X.y*ae.x>0;if(ye&&Y>C){const Fe=B.dist(j);if(Fe>2*z){const Me=B.sub(B.sub(j)._mult(z/Fe)._round());this.updateDistance(j,Me),this.addCurrentVertex(Me,X,0,0,D),j=Me}}const De=j&&$;let Re=De?a:w?"butt":c;if(De&&Re==="round"&&(fe<p?Re="miter":fe<=2&&(Re="fakeround")),Re==="miter"&&fe>d&&(Re="bevel"),Re==="bevel"&&(fe>2&&(Re="flipbevel"),fe<d&&(Re="miter")),j&&this.updateDistance(j,B),Re==="miter")R._mult(fe),this.addCurrentVertex(B,R,0,0,D);else if(Re==="flipbevel"){if(fe>100)R=ae.mult(-1);else{const Fe=fe*X.add(ae).mag()/X.sub(ae).mag();R._perp()._mult(Fe*(ve?-1:1))}this.addCurrentVertex(B,R,0,0,D),this.addCurrentVertex(B,R.mult(-1),0,0,D)}else if(Re==="bevel"||Re==="fakeround"){const Fe=-Math.sqrt(fe*fe-1),Me=ve?Fe:0,qe=ve?0:Fe;if(j&&this.addCurrentVertex(B,X,Me,qe,D),Re==="fakeround"){const it=Math.round(180*Ae/Math.PI/20);for(let et=1;et<it;et++){let Xe=et/it;if(Xe!==.5){const hi=Xe-.5;Xe+=Xe*hi*(Xe-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*hi*hi+(.848013+U*(.215638*U-1.06021)))}const vt=ae.sub(X)._mult(Xe)._add(X)._unit()._mult(ve?-1:1);this.addHalfVertex(B,vt.x,vt.y,!1,ve,0,D)}}$&&this.addCurrentVertex(B,ae,-Me,-qe,D)}else if(Re==="butt")this.addCurrentVertex(B,R,0,0,D);else if(Re==="square"){const Fe=j?1:-1;this.addCurrentVertex(B,R,Fe,Fe,D)}else Re==="round"&&(j&&(this.addCurrentVertex(B,X,0,0,D),this.addCurrentVertex(B,X,1,1,D,!0)),$&&(this.addCurrentVertex(B,ae,-1,-1,D,!0),this.addCurrentVertex(B,ae,0,0,D)));if(ye&&Y<M-1){const Fe=B.dist($);if(Fe>2*z){const Me=B.add($.sub(B)._mult(z/Fe)._round());this.updateDistance(B,Me),this.addCurrentVertex(Me,ae,0,0,D),B=Me}}}}addCurrentVertex(t,n,a,c,d,p=!1){const m=n.y*c-n.x,y=-n.y-n.x*c;this.addHalfVertex(t,n.x+n.y*a,n.y-n.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-c,d),this.distance>Cm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,a,c,d,p))}addHalfVertex({x:t,y:n},a,c,d,p,m,y){const w=.5*(this.lineClips?this.scaledDistance*(Cm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(n<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),y.primitiveLength++),p?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}}let Im,Em;$e("LineBucket",dp,{omit:["layers","patternFeatures"]});var km={get paint(){return Em=Em||new br({"line-opacity":new at(V.paint_line["line-opacity"]),"line-color":new at(V.paint_line["line-color"]),"line-translate":new Ye(V.paint_line["line-translate"]),"line-translate-anchor":new Ye(V.paint_line["line-translate-anchor"]),"line-width":new at(V.paint_line["line-width"]),"line-gap-width":new at(V.paint_line["line-gap-width"]),"line-offset":new at(V.paint_line["line-offset"]),"line-blur":new at(V.paint_line["line-blur"]),"line-dasharray":new zc(V.paint_line["line-dasharray"]),"line-pattern":new qs(V.paint_line["line-pattern"]),"line-gradient":new Ac(V.paint_line["line-gradient"])})},get layout(){return Im=Im||new br({"line-cap":new Ye(V.layout_line["line-cap"]),"line-join":new at(V.layout_line["line-join"]),"line-miter-limit":new Ye(V.layout_line["line-miter-limit"]),"line-round-limit":new Ye(V.layout_line["line-round-limit"]),"line-sort-key":new at(V.layout_line["line-sort-key"])})}};class iv extends at{possiblyEvaluate(t,n){return n=new Ht(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(t,n)}evaluate(t,n,a,c){return n=Yi({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,c)}}let Zh;class rv extends pn{constructor(t){super(t,km),this.gradientVersion=0,Zh||(Zh=new iv(km.paint.properties["line-width"].specification),Zh.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 Es,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"]=Zh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new dp(t)}queryRadius(t){const n=t,a=zm(Vc("line-width",this,n),Vc("line-gap-width",this,n)),c=Vc("line-offset",this,n);return a/2+Math.abs(c)+Lh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const m=Bh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*zm(this.paint.get("line-width").evaluate(n,a),this.paint.get("line-gap-width").evaluate(n,a)),w=this.paint.get("line-offset").evaluate(n,a);return w&&(c=function(M,C){const z=[];for(let D=0;D<M.length;D++){const B=M[D],j=[];for(let $=0;$<B.length;$++){const X=B[$-1],ae=B[$],Y=B[$+1],R=$===0?new Ve(0,0):ae.sub(X)._unit()._perp(),U=$===B.length-1?new Ve(0,0):Y.sub(ae)._unit()._perp(),Q=R._add(U)._unit(),fe=Q.x*U.x+Q.y*U.y;fe!==0&&Q._mult(1/fe),j.push(Q._mult(C)._add(ae))}z.push(j)}return z}(c,w*p)),function(M,C,z){for(let D=0;D<C.length;D++){const B=C[D];if(M.length>=3){for(let j=0;j<B.length;j++)if(Js(M,B[j]))return!0}if(yx(M,B,z))return!0}return!1}(m,c,y)}isTileClipped(){return!0}}function zm(r,t){return t>0?t+2*r:r}const nv=vi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),av=vi([{name:"a_projected_pos",components:3,type:"Float32"}],4);vi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const sv=vi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);vi([{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 Am=vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ov=vi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function lv(r,t,n){return r.sections.forEach(a=>{a.text=function(c,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),ea.applyArabicShaping&&(c=ea.applyArabicShaping(c)),c}(a.text,t,n)}),r}vi([{name:"triangle",components:3,type:"Uint16"}]),vi([{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"}]),vi([{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"}]),vi([{type:"Float32",name:"offsetX"}]),vi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),vi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Qc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Rm,pp,Dm,Ci=24,fp={};function cv(){return Rm||(Rm=1,fp.read=function(r,t,n,a,c){var d,p,m=8*c-a-1,y=(1<<m)-1,w=y>>1,M=-7,C=n?c-1:0,z=n?-1:1,D=r[t+C];for(C+=z,d=D&(1<<-M)-1,D>>=-M,M+=m;M>0;d=256*d+r[t+C],C+=z,M-=8);for(p=d&(1<<-M)-1,d>>=-M,M+=a;M>0;p=256*p+r[t+C],C+=z,M-=8);if(d===0)d=1-w;else{if(d===y)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,a),d-=w}return(D?-1:1)*p*Math.pow(2,d-a)},fp.write=function(r,t,n,a,c,d){var p,m,y,w=8*d-c-1,M=(1<<w)-1,C=M>>1,z=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=a?0:d-1,B=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=M):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+C>=1?z/y:z*Math.pow(2,1-C))*y>=2&&(p++,y/=2),p+C>=M?(m=0,p=M):p+C>=1?(m=(t*y-1)*Math.pow(2,c),p+=C):(m=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;r[n+D]=255&m,D+=B,m/=256,c-=8);for(p=p<<c|m,w+=c;w>0;r[n+D]=255&p,D+=B,p/=256,w-=8);r[n+D-B]|=128*j}),fp}function Lm(){if(Dm)return pp;Dm=1,pp=t;var r=cv();function t(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,a=1/n,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(R){return R.type===t.Bytes?R.readVarint()+R.pos:R.pos+1}function p(R,U,Q){return Q?4294967296*U+(R>>>0):4294967296*(U>>>0)+(R>>>0)}function m(R,U,Q){var fe=U<=16383?1:U<=2097151?2:U<=268435455?3:Math.floor(Math.log(U)/(7*Math.LN2));Q.realloc(fe);for(var Ae=Q.pos-1;Ae>=R;Ae--)Q.buf[Ae+fe]=Q.buf[Ae]}function y(R,U){for(var Q=0;Q<R.length;Q++)U.writeVarint(R[Q])}function w(R,U){for(var Q=0;Q<R.length;Q++)U.writeSVarint(R[Q])}function M(R,U){for(var Q=0;Q<R.length;Q++)U.writeFloat(R[Q])}function C(R,U){for(var Q=0;Q<R.length;Q++)U.writeDouble(R[Q])}function z(R,U){for(var Q=0;Q<R.length;Q++)U.writeBoolean(R[Q])}function D(R,U){for(var Q=0;Q<R.length;Q++)U.writeFixed32(R[Q])}function B(R,U){for(var Q=0;Q<R.length;Q++)U.writeSFixed32(R[Q])}function j(R,U){for(var Q=0;Q<R.length;Q++)U.writeFixed64(R[Q])}function $(R,U){for(var Q=0;Q<R.length;Q++)U.writeSFixed64(R[Q])}function X(R,U){return(R[U]|R[U+1]<<8|R[U+2]<<16)+16777216*R[U+3]}function ae(R,U,Q){R[Q]=U,R[Q+1]=U>>>8,R[Q+2]=U>>>16,R[Q+3]=U>>>24}function Y(R,U){return(R[U]|R[U+1]<<8|R[U+2]<<16)+(R[U+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(R,U,Q){for(Q=Q||this.length;this.pos<Q;){var fe=this.readVarint(),Ae=fe>>3,ye=this.pos;this.type=7&fe,R(Ae,U,this),this.pos===ye&&this.skip(fe)}return U},readMessage:function(R,U){return this.readFields(R,U,this.readVarint()+this.pos)},readFixed32:function(){var R=X(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=Y(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=X(this.buf,this.pos)+X(this.buf,this.pos+4)*n;return this.pos+=8,R},readSFixed64:function(){var R=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*n;return this.pos+=8,R},readFloat:function(){var R=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var U,Q,fe=this.buf;return U=127&(Q=fe[this.pos++]),Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<7,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<14,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<21,Q<128?U:function(Ae,ye,ve){var De,Re,Fe=ve.buf;if(De=(112&(Re=Fe[ve.pos++]))>>4,Re<128||(De|=(127&(Re=Fe[ve.pos++]))<<3,Re<128)||(De|=(127&(Re=Fe[ve.pos++]))<<10,Re<128)||(De|=(127&(Re=Fe[ve.pos++]))<<17,Re<128)||(De|=(127&(Re=Fe[ve.pos++]))<<24,Re<128)||(De|=(1&(Re=Fe[ve.pos++]))<<31,Re<128))return p(Ae,De,ye);throw new Error("Expected varint not more than 10 bytes")}(U|=(15&(Q=fe[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,U=this.pos;return this.pos=R,R-U>=12&&c?function(Q,fe,Ae){return c.decode(Q.subarray(fe,Ae))}(this.buf,U,R):function(Q,fe,Ae){for(var ye="",ve=fe;ve<Ae;){var De,Re,Fe,Me=Q[ve],qe=null,it=Me>239?4:Me>223?3:Me>191?2:1;if(ve+it>Ae)break;it===1?Me<128&&(qe=Me):it===2?(192&(De=Q[ve+1]))==128&&(qe=(31&Me)<<6|63&De)<=127&&(qe=null):it===3?(Re=Q[ve+2],(192&(De=Q[ve+1]))==128&&(192&Re)==128&&((qe=(15&Me)<<12|(63&De)<<6|63&Re)<=2047||qe>=55296&&qe<=57343)&&(qe=null)):it===4&&(Re=Q[ve+2],Fe=Q[ve+3],(192&(De=Q[ve+1]))==128&&(192&Re)==128&&(192&Fe)==128&&((qe=(15&Me)<<18|(63&De)<<12|(63&Re)<<6|63&Fe)<=65535||qe>=1114112)&&(qe=null)),qe===null?(qe=65533,it=1):qe>65535&&(qe-=65536,ye+=String.fromCharCode(qe>>>10&1023|55296),qe=56320|1023&qe),ye+=String.fromCharCode(qe),ve+=it}return ye}(this.buf,U,R)},readBytes:function(){var R=this.readVarint()+this.pos,U=this.buf.subarray(this.pos,R);return this.pos=R,U},readPackedVarint:function(R,U){if(this.type!==t.Bytes)return R.push(this.readVarint(U));var Q=d(this);for(R=R||[];this.pos<Q;)R.push(this.readVarint(U));return R},readPackedSVarint:function(R){if(this.type!==t.Bytes)return R.push(this.readSVarint());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==t.Bytes)return R.push(this.readBoolean());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==t.Bytes)return R.push(this.readFloat());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==t.Bytes)return R.push(this.readDouble());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed32());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed32());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed64());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed64());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSFixed64());return R},skip:function(R){var U=7&R;if(U===t.Varint)for(;this.buf[this.pos++]>127;);else if(U===t.Bytes)this.pos=this.readVarint()+this.pos;else if(U===t.Fixed32)this.pos+=4;else{if(U!==t.Fixed64)throw new Error("Unimplemented type: "+U);this.pos+=8}},writeTag:function(R,U){this.writeVarint(R<<3|U)},realloc:function(R){for(var U=this.length||16;U<this.pos+R;)U*=2;if(U!==this.length){var Q=new Uint8Array(U);Q.set(this.buf),this.buf=Q,this.length=U}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),ae(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),ae(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),ae(this.buf,-1&R,this.pos),ae(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),ae(this.buf,-1&R,this.pos),ae(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(U,Q){var fe,Ae;if(U>=0?(fe=U%4294967296|0,Ae=U/4294967296|0):(Ae=~(-U/4294967296),4294967295^(fe=~(-U%4294967296))?fe=fe+1|0:(fe=0,Ae=Ae+1|0)),U>=18446744073709552e3||U<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(ye,ve,De){De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,De.buf[De.pos]=127&(ye>>>=7)}(fe,0,Q),function(ye,ve){var De=(7&ye)<<4;ve.buf[ve.pos++]|=De|((ye>>>=3)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye)))))}(Ae,Q)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var U=this.pos;this.pos=function(fe,Ae,ye){for(var ve,De,Re=0;Re<Ae.length;Re++){if((ve=Ae.charCodeAt(Re))>55295&&ve<57344){if(!De){ve>56319||Re+1===Ae.length?(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189):De=ve;continue}if(ve<56320){fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=ve;continue}ve=De-55296<<10|ve-56320|65536,De=null}else De&&(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=null);ve<128?fe[ye++]=ve:(ve<2048?fe[ye++]=ve>>6|192:(ve<65536?fe[ye++]=ve>>12|224:(fe[ye++]=ve>>18|240,fe[ye++]=ve>>12&63|128),fe[ye++]=ve>>6&63|128),fe[ye++]=63&ve|128)}return ye}(this.buf,R,this.pos);var Q=this.pos-U;Q>=128&&m(U,Q,this),this.pos=U-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(R){this.realloc(4),r.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),r.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var U=R.length;this.writeVarint(U),this.realloc(U);for(var Q=0;Q<U;Q++)this.buf[this.pos++]=R[Q]},writeRawMessage:function(R,U){this.pos++;var Q=this.pos;R(U,this);var fe=this.pos-Q;fe>=128&&m(Q,fe,this),this.pos=Q-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(R,U,Q){this.writeTag(R,t.Bytes),this.writeRawMessage(U,Q)},writePackedVarint:function(R,U){U.length&&this.writeMessage(R,y,U)},writePackedSVarint:function(R,U){U.length&&this.writeMessage(R,w,U)},writePackedBoolean:function(R,U){U.length&&this.writeMessage(R,z,U)},writePackedFloat:function(R,U){U.length&&this.writeMessage(R,M,U)},writePackedDouble:function(R,U){U.length&&this.writeMessage(R,C,U)},writePackedFixed32:function(R,U){U.length&&this.writeMessage(R,D,U)},writePackedSFixed32:function(R,U){U.length&&this.writeMessage(R,B,U)},writePackedFixed64:function(R,U){U.length&&this.writeMessage(R,j,U)},writePackedSFixed64:function(R,U){U.length&&this.writeMessage(R,$,U)},writeBytesField:function(R,U){this.writeTag(R,t.Bytes),this.writeBytes(U)},writeFixed32Field:function(R,U){this.writeTag(R,t.Fixed32),this.writeFixed32(U)},writeSFixed32Field:function(R,U){this.writeTag(R,t.Fixed32),this.writeSFixed32(U)},writeFixed64Field:function(R,U){this.writeTag(R,t.Fixed64),this.writeFixed64(U)},writeSFixed64Field:function(R,U){this.writeTag(R,t.Fixed64),this.writeSFixed64(U)},writeVarintField:function(R,U){this.writeTag(R,t.Varint),this.writeVarint(U)},writeSVarintField:function(R,U){this.writeTag(R,t.Varint),this.writeSVarint(U)},writeStringField:function(R,U){this.writeTag(R,t.Bytes),this.writeString(U)},writeFloatField:function(R,U){this.writeTag(R,t.Fixed32),this.writeFloat(U)},writeDoubleField:function(R,U){this.writeTag(R,t.Fixed64),this.writeDouble(U)},writeBooleanField:function(R,U){this.writeVarintField(R,!!U)}},pp}var mp=he(Lm());const gp=3;function uv(r,t,n){r===1&&n.readMessage(hv,t)}function hv(r,t,n){if(r===3){const{id:a,bitmap:c,width:d,height:p,left:m,top:y,advance:w}=n.readMessage(dv,{});t.push({id:a,bitmap:new Uc({width:d+2*gp,height:p+2*gp},c),metrics:{width:d,height:p,left:m,top:y,advance:w}})}}function dv(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 pv=gp;function Bm(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 c=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),c=Math.max(c,p.x+p.w),p.w===y.w&&p.h===y.h){const w=a.pop();m<a.length&&(a[m]=w)}else p.h===y.h?(y.x+=p.w,y.w-=p.w):p.w===y.w?(y.y+=p.h,y.h-=p.h):(a.push({x:y.x+p.w,y:y.y,w:y.w-p.w,h:p.h}),y.y+=p.h,y.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const zr=1;class _p{constructor(t,{pixelRatio:n,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+zr,this.paddedRect.y+zr]}get br(){return[this.paddedRect.x+this.paddedRect.w-zr,this.paddedRect.y+this.paddedRect.h-zr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*zr)/this.pixelRatio,(this.paddedRect.h-2*zr)/this.pixelRatio]}}class Fm{constructor(t,n){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(n,c,d);const{w:p,h:m}=Bm(d),y=new Kr({width:p||1,height:m||1});for(const w in t){const M=t[w],C=a[w].paddedRect;Kr.copy(M.data,y,{x:0,y:0},{x:C.x+zr,y:C.y+zr},M.data)}for(const w in n){const M=n[w],C=c[w].paddedRect,z=C.x+zr,D=C.y+zr,B=M.data.width,j=M.data.height;Kr.copy(M.data,y,{x:0,y:0},{x:z,y:D},M.data),Kr.copy(M.data,y,{x:0,y:j-1},{x:z,y:D-1},{width:B,height:1}),Kr.copy(M.data,y,{x:0,y:0},{x:z,y:D+j},{width:B,height:1}),Kr.copy(M.data,y,{x:B-1,y:0},{x:z-1,y:D},{width:1,height:j}),Kr.copy(M.data,y,{x:0,y:0},{x:z+B,y:D},{width:1,height:j})}this.image=y,this.iconPositions=a,this.patternPositions=c}addImages(t,n,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*zr,h:d.data.height+2*zr};a.push(p),n[c]=new _p(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,n){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),n),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),n)}patchUpdatedImage(t,n,a){if(!t||!n||t.version===n.version)return;t.version=n.version;const[c,d]=t.tl;a.update(n.data,void 0,{x:c,y:d})}}var ss;$e("ImagePosition",_p),$e("ImageAtlas",Fm),S.al=void 0,(ss=S.al||(S.al={}))[ss.none=0]="none",ss[ss.horizontal=1]="horizontal",ss[ss.vertical=2]="vertical",ss[ss.horizontalOnly=3]="horizontalOnly";const Vh=-17;class eu{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const c=new eu;return c.scale=t||1,c.fontStack=n,c.verticalAlign=a||"bottom",c}static forImage(t,n){const a=new eu;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class ol{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new ol;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,n)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let n="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;n+=c&&Ph(c)&&!Qc[t[a+1]]||d&&Ph(d)&&!Qc[t[a-1]]||!Qc[t[a]]?t[a]:Qc[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&$h[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&$h[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 ol;return a.text=this.text.substring(t,n),a.sectionIndex=this.sectionIndex.slice(t,n),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,n)=>Math.max(t,this.sections[n].scale),0)}getMaxImageSize(t){let n=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const 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(eu.forText(t.scale,t.fontStack||n,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const n=t.image?t.image.name:"";if(n.length===0)return void Vi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(eu.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Vi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Uh(r,t,n,a,c,d,p,m,y,w,M,C,z,D,B){const j=ol.fromFeature(r,c);let $;C===S.al.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:ae}=ea;if(X&&j.sections.length===1){$=[];const U=X(j.toString(),yp(j,w,d,t,a,D));for(const Q of U){const fe=new ol;fe.text=Q,fe.sections=j.sections;for(let Ae=0;Ae<Q.length;Ae++)fe.sectionIndex.push(0);$.push(fe)}}else if(ae){$=[];const U=ae(j.text,j.sectionIndex,yp(j,w,d,t,a,D));for(const Q of U){const fe=new ol;fe.text=Q[0],fe.sectionIndex=Q[1],fe.sections=j.sections,$.push(fe)}}else $=function(U,Q){const fe=[],Ae=U.text;let ye=0;for(const ve of Q)fe.push(U.substring(ye,ve)),ye=ve;return ye<Ae.length&&fe.push(U.substring(ye,Ae.length)),fe}(j,yp(j,w,d,t,a,D));const Y=[],R={positionedLines:Y,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(U,Q,fe,Ae,ye,ve,De,Re,Fe,Me,qe,it){let et=0,Xe=0,vt=0,hi=0;const Ii=Re==="right"?1:Re==="left"?0:.5,rr=Ci/it;let Jr=0;for(const si of ye){si.trim();const Di=si.getMaxScale(),qi={positionedGlyphs:[],lineOffset:0};U.positionedLines[Jr]=qi;const Hi=qi.positionedGlyphs;let wr=0;if(!si.length()){Xe+=ve,++Jr;continue}const Qr=_v(Ae,si,rr);for(let Rr=0;Rr<si.length();Rr++){const Ei=si.getSection(Rr),Bi=si.getSectionIndex(Rr),Fi=si.getCharCode(Rr),wi=yv(Fe,qe,Fi);let Kt;if(Ei.imageName){if(U.iconsInText=!0,Ei.scale=Ei.scale*rr,Kt=vv(Ei,wi,Di,Qr,Ae),!Kt)continue;wr=Math.max(wr,Kt.imageOffset)}else if(Kt=xv(Ei,Fi,wi,Qr,Q,fe),!Kt)continue;const{rect:Ln,metrics:hl,baselineOffset:Bn}=Kt;Hi.push({glyph:Fi,imageName:Ei.imageName,x:et,y:Xe+Bn+Vh,vertical:wi,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Bi,metrics:hl,rect:Ln}),wi?(U.verticalizable=!0,et+=(Ei.imageName?hl.advance:Ci)*Ei.scale+Me):et+=hl.advance*Ei.scale+Me}Hi.length!==0&&(vt=Math.max(et-Me,vt),bv(Hi,0,Hi.length-1,Ii)),et=0,qi.lineOffset=Math.max(wr,(Di-1)*Ci);const Li=ve*Di+wr;Xe+=Li,hi=Math.max(Li,hi),++Jr}const{horizontalAlign:Ar,verticalAlign:Gi}=xp(De);(function(si,Di,qi,Hi,wr,Qr,Li,Rr,Ei){const Bi=(Di-qi)*wr;let Fi=0;Fi=Qr!==Li?-Rr*Hi-Vh:-Hi*Ei*Li+.5*Li;for(const wi of si)for(const Kt of wi.positionedGlyphs)Kt.x+=Bi,Kt.y+=Fi})(U.positionedLines,Ii,Ar,Gi,vt,hi,ve,Xe,ye.length),U.top+=-Gi*Xe,U.bottom=U.top+Xe,U.left+=-Ar*vt,U.right=U.left+vt}(R,t,n,a,$,p,m,y,C,w,z,B),!function(U){for(const Q of U)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&R}const $h={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},fv={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},mv={40:!0};function Om(r,t,n,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*Ci/d+c:0}{const p=n[t.fontStack],m=p&&p[r];return m?m.metrics.advance*t.scale+c:0}}function jm(r,t,n,a){const c=Math.pow(r-t,2);return a?r<t?c/2:2*c:c+Math.abs(n)*n}function gv(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 Nm(r,t,n,a,c,d){let p=null,m=jm(t,n,c,d);for(const y of a){const w=jm(t-y.x,n,c,d)+y.badness;w<=m&&(p=y,m=w)}return{index:r,x:t,priorBreak:p,badness:m}}function Zm(r){return r?Zm(r.priorBreak).concat(r.index):[]}function yp(r,t,n,a,c,d){if(!r)return[];const p=[],m=function(C,z,D,B,j,$){let X=0;for(let ae=0;ae<C.length();ae++){const Y=C.getSection(ae);X+=Om(C.getCharCode(ae),Y,B,j,z,$)}return X/Math.max(1,Math.ceil(X/D))}(r,t,n,a,c,d),y=r.text.indexOf("​")>=0;let w=0;for(let C=0;C<r.length();C++){const z=r.getSection(C),D=r.getCharCode(C);if($h[D]||(w+=Om(D,z,a,c,t,d)),C<r.length()-1){const B=!((M=D)<11904)&&(!!xt["CJK Compatibility Forms"](M)||!!xt["CJK Compatibility"](M)||!!xt["CJK Strokes"](M)||!!xt["CJK Symbols and Punctuation"](M)||!!xt["Enclosed CJK Letters and Months"](M)||!!xt["Halfwidth and Fullwidth Forms"](M)||!!xt["Ideographic Description Characters"](M)||!!xt["Vertical Forms"](M)||Sh.test(String.fromCodePoint(M)));(fv[D]||B||z.imageName||C!==r.length()-2&&mv[r.getCharCode(C+1)])&&p.push(Nm(C+1,w,m,p,gv(D,r.getCharCode(C+1),B&&y),!1))}}var M;return Zm(Nm(r.length(),w,m,p,0,!0))}function xp(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 _v(r,t,n){const a=t.getMaxScale()*Ci,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,c*n),horizontalLineContentHeight:p}}function Vm(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function yv(r,t,n){return!(r===S.al.horizontal||!t&&!Ko(n)||t&&($h[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function xv(r,t,n,a,c,d){const p=d[r.fontStack],m=function(w,M,C,z){if(w&&w.rect)return w;const D=M[C.fontStack],B=D&&D[z];return B?{rect:null,metrics:B.metrics}:null}(p&&p[t],c,r,t);if(m===null)return null;let y;if(n)y=a.verticalLineContentWidth-r.scale*Ci;else{const w=Vm(r.verticalAlign);y=(a.horizontalLineContentHeight-r.scale*Ci)*w}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function vv(r,t,n,a,c){const d=c[r.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:zr,top:-3,advance:t?m[1]:m[0]};let w;if(t)w=a.verticalLineContentWidth-m[1]*r.scale;else{const M=Vm(r.verticalAlign);w=(a.horizontalLineContentHeight-m[1]*r.scale)*M}return{rect:p,metrics:y,baselineOffset:w,imageOffset:(t?m[0]:m[1])*r.scale-Ci*n}}function bv(r,t,n,a){if(a===0)return;const c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=n;p++)r[p].x-=d}function wv(r,t,n){const{horizontalAlign:a,verticalAlign:c}=xp(n),d=t[0]-r.displaySize[0]*a,p=t[1]-r.displaySize[1]*c;return{image:r,top:p,bottom:p+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function Um(r){var t,n;let a=r.left,c=r.top,d=r.right-a,p=r.bottom-c;const m=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",w=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<w||m==="proportional"){const M=Math.ceil(p*w);a*=M/d,d=M}}else if(m==="proportional"&&y==="stretchOnly"&&w!==0&&d/p>w){const M=Math.ceil(d/w);c*=M/p,p=M}return{x1:a,y1:c,x2:a+d,y2:c+p}}function $m(r,t,n,a,c,d){const p=r.image;let m;if(p.content){const $=p.content,X=p.pixelRatio||1;m=[$[0]/X,$[1]/X,p.displaySize[0]-$[2]/X,p.displaySize[1]-$[3]/X]}const y=t.left*d,w=t.right*d;let M,C,z,D;n==="width"||n==="both"?(D=c[0]+y-a[3],C=c[0]+w+a[1]):(D=c[0]+(y+w-p.displaySize[0])/2,C=D+p.displaySize[0]);const B=t.top*d,j=t.bottom*d;return n==="height"||n==="both"?(M=c[1]+B-a[0],z=c[1]+j+a[2]):(M=c[1]+(B+j-p.displaySize[1])/2,z=M+p.displaySize[1]),{image:p,top:M,right:C,bottom:z,left:D,collisionPadding:m}}const tu=255,na=128,os=tu*na;function Gm(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Ht(r+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=n;let d=0;for(;d<a.length&&a[d]<=r;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return n.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:y,minSize:n.evaluate(new Ht(m)),maxSize:n.evaluate(new Ht(y)),interpolationType:c}}}function vp(r,t,n){let a="never";const c=r.get(t);return c?a=c:r.get(n)&&(a="always"),a}const Tv=Kc.VectorTileFeature.types,Mv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gh(r,t,n,a,c,d,p,m,y,w,M,C,z){const D=m?Math.min(os,Math.round(m[0])):0,B=m?Math.min(os,Math.round(m[1])):0;r.emplaceBack(t,n,Math.round(32*a),Math.round(32*c),d,p,(D<<1)+(y?1:0),B,16*w,16*M,256*C,256*z)}function bp(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 Sv(r){for(const t of r.sections)if(Xd(t.text))return!0;return!1}class wp{constructor(t){this.layoutVertexArray=new me,this.indexArray=new Be,this.programConfigurations=t,this.segments=new lt,this.dynamicLayoutVertexArray=new Te,this.opacityVertexArray=new Se,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,n,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,nv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,av.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Mv,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}$e("SymbolBuffers",wp);class Tp{constructor(t,n,a){this.layoutVertexArray=new t,this.layoutAttributes=n,this.indexArray=new a,this.segments=new lt,this.collisionVertexArray=new je}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,sv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Tp);class ll{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=Gm(this.zoom,n["text-size"]),this.iconSizeData=Gm(this.zoom,n["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=vp(a,"text-overlap","text-allow-overlap")!=="never"||vp(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(p=>S.al[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new wp(new Ia(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new wp(new Ia(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new k,this.lineVertexArray=new F,this.symbolInstances=new E,this.textAnchorOffsets=new H}calculateGlyphDependencies(t,n,a,c,d){for(let p=0;p<t.length;p++)if(n[t.charCodeAt(p)]=!0,(a||c)&&d){const m=Qc[t.charAt(p)];m&&(n[m.charCodeAt(0)]=!0)}}populate(t,n,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),w=(m.value.kind!=="constant"||m.value.value instanceof yr&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),M=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const z=n.iconDependencies,D=n.glyphDependencies,B=n.availableImages,j=new Ht(this.zoom);for(const{feature:$,id:X,index:ae,sourceLayerIndex:Y}of t){const R=c._featureFilter.needGeometry,U=ra($,R);if(!c._featureFilter.filter(j,U,a))continue;let Q,fe;if(R||(U.geometry=kr($)),w){const ye=c.getValueAndResolveTokens("text-field",U,a,B),ve=yr.factory(ye),De=this.hasRTLText=this.hasRTLText||Sv(ve);(!De||ea.getRTLTextPluginStatus()==="unavailable"||De&&ea.isParsed())&&(Q=lv(ve,c,U))}if(M){const ye=c.getValueAndResolveTokens("icon-image",U,a,B);fe=ye instanceof Ir?ye:Ir.fromString(ye)}if(!Q&&!fe)continue;const Ae=this.sortFeaturesByKey?C.evaluate(U,{},a):void 0;if(this.features.push({id:X,text:Q,icon:fe,index:ae,sourceLayerIndex:Y,geometry:U.geometry,properties:$.properties,type:Tv[$.type],sortKey:Ae}),fe&&(z[fe.name]=!0),Q){const ye=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.al.vertical)>=0;for(const De of Q.sections)if(De.image)z[De.image.name]=!0;else{const Re=Wo(Q.toString()),Fe=De.fontStack||ye,Me=D[Fe]=D[Fe]||{};this.calculateGlyphDependencies(De.text,Me,ve,this.allowVerticalPlacement,Re)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const X={},ae={},Y=[];let R=0;function U(ye){Y.push($[ye]),R++}function Q(ye,ve,De){const Re=ae[ye];return delete ae[ye],ae[ve]=Re,Y[Re].geometry[0].pop(),Y[Re].geometry[0]=Y[Re].geometry[0].concat(De[0]),Re}function fe(ye,ve,De){const Re=X[ve];return delete X[ve],X[ye]=Re,Y[Re].geometry[0].shift(),Y[Re].geometry[0]=De[0].concat(Y[Re].geometry[0]),Re}function Ae(ye,ve,De){const Re=De?ve[0][ve[0].length-1]:ve[0][0];return`${ye}:${Re.x}:${Re.y}`}for(let ye=0;ye<$.length;ye++){const ve=$[ye],De=ve.geometry,Re=ve.text?ve.text.toString():null;if(!Re){U(ye);continue}const Fe=Ae(Re,De),Me=Ae(Re,De,!0);if(Fe in ae&&Me in X&&ae[Fe]!==X[Me]){const qe=fe(Fe,Me,De),it=Q(Fe,Me,Y[qe].geometry);delete X[Fe],delete ae[Me],ae[Ae(Re,Y[it].geometry,!0)]=it,Y[qe].geometry=null}else Fe in ae?Q(Fe,Me,De):Me in X?fe(Fe,Me,De):(U(ye),X[Fe]=R-1,ae[Me]=R-1)}return Y.filter(ye=>ye.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,X)=>$.sortKey-X.sortKey)}update(t,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,n,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,n,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,n){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(n[t.segment+1]),d=t.dist(n[t.segment]);const p={};for(let m=t.segment+1;m<n.length;m++)p[m]={x:n[m].x,y:n[m].y,tileUnitDistanceFromAnchor:c},m<n.length-1&&(c+=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,c,d,p,m,y,w,M,C,z){const D=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*n.length,B,D,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,X=j.vertexLength,ae=this.allowVerticalPlacement&&m===S.al.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let R=0;R<n.length;R++){const{tl:U,tr:Q,bl:fe,br:Ae,tex:ye,pixelOffsetTL:ve,pixelOffsetBR:De,minFontScaleX:Re,minFontScaleY:Fe,glyphOffset:Me,isSDF:qe,sectionIndex:it}=n[R],et=j.vertexLength,Xe=Me[1];Gh(B,y.x,y.y,U.x,Xe+U.y,ye.x,ye.y,a,qe,ve.x,ve.y,Re,Fe),Gh(B,y.x,y.y,Q.x,Xe+Q.y,ye.x+ye.w,ye.y,a,qe,De.x,ve.y,Re,Fe),Gh(B,y.x,y.y,fe.x,Xe+fe.y,ye.x,ye.y+ye.h,a,qe,ve.x,De.y,Re,Fe),Gh(B,y.x,y.y,Ae.x,Xe+Ae.y,ye.x+ye.w,ye.y+ye.h,a,qe,De.x,De.y,Re,Fe),bp(t.dynamicLayoutVertexArray,y,ae),D.emplaceBack(et,et+2,et+1),D.emplaceBack(et+1,et+2,et+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Me[0]),R!==n.length-1&&it===n[R+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,p,p.index,{},z,Y&&Y[it])}t.placedSymbolArray.emplaceBack(y.x,y.y,$,this.glyphOffsetArray.length-$,X,w,M,y.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(t,n,a,c,d,p){return n.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,n,a,c,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=y.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,z=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(M,C,p,z,D,new Ve(t,n)),this._addCollisionDebugVertex(M,C,p,z,D,new Ve(a,n)),this._addCollisionDebugVertex(M,C,p,z,D,new Ve(a,c)),this._addCollisionDebugVertex(M,C,p,z,D,new Ve(t,c)),y.vertexLength+=4;const B=d.indexArray;B.emplaceBack(w,w+1),B.emplaceBack(w+1,w+2),B.emplaceBack(w+2,w+3),B.emplaceBack(w+3,w),y.primitiveLength+=4}addDebugCollisionBoxes(t,n,a,c){for(let d=t;d<n;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Tp(be,Am.members,ke),this.iconCollisionBox=new Tp(be,Am.members,ke);for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(t,n,a,c,d,p,m,y,w){const M={};for(let C=n;C<a;C++){const z=t.get(C);M.textBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.textFeatureIndex=z.featureIndex;break}for(let C=c;C<d;C++){const z=t.get(C);M.verticalTextBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.verticalTextFeatureIndex=z.featureIndex;break}for(let C=p;C<m;C++){const z=t.get(C);M.iconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.iconFeatureIndex=z.featureIndex;break}for(let C=y;C<w;C++){const z=t.get(C);M.verticalIconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.verticalIconFeatureIndex=z.featureIndex;break}return M}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const a=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,n){const a=t.placedSymbolArray.get(n),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const n=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);c.push(0|Math.round(n*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>c[m]-c[y]||d[y]-d[m]),p}addToSortKeyRanges(t,n){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===n?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const a=this.symbolInstances.get(n);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let qm,Hm;$e("SymbolBucket",ll,{omit:["layers","collisionBoxArray","features","compareText"]}),ll.MAX_GLYPHS=65535,ll.addDynamicAttributes=bp;var Mp={get paint(){return Hm=Hm||new br({"icon-opacity":new at(V.paint_symbol["icon-opacity"]),"icon-color":new at(V.paint_symbol["icon-color"]),"icon-halo-color":new at(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new at(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new at(V.paint_symbol["icon-halo-blur"]),"icon-translate":new Ye(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ye(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new at(V.paint_symbol["text-opacity"]),"text-color":new at(V.paint_symbol["text-color"],{runtimeType:lr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new at(V.paint_symbol["text-halo-color"]),"text-halo-width":new at(V.paint_symbol["text-halo-width"]),"text-halo-blur":new at(V.paint_symbol["text-halo-blur"]),"text-translate":new Ye(V.paint_symbol["text-translate"]),"text-translate-anchor":new Ye(V.paint_symbol["text-translate-anchor"])})},get layout(){return qm=qm||new br({"symbol-placement":new Ye(V.layout_symbol["symbol-placement"]),"symbol-spacing":new Ye(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ye(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new at(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ye(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ye(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ye(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ye(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ye(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ye(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new at(V.layout_symbol["icon-size"]),"icon-text-fit":new Ye(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ye(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new at(V.layout_symbol["icon-image"]),"icon-rotate":new at(V.layout_symbol["icon-rotate"]),"icon-padding":new at(V.layout_symbol["icon-padding"]),"icon-keep-upright":new Ye(V.layout_symbol["icon-keep-upright"]),"icon-offset":new at(V.layout_symbol["icon-offset"]),"icon-anchor":new at(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ye(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ye(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ye(V.layout_symbol["text-rotation-alignment"]),"text-field":new at(V.layout_symbol["text-field"]),"text-font":new at(V.layout_symbol["text-font"]),"text-size":new at(V.layout_symbol["text-size"]),"text-max-width":new at(V.layout_symbol["text-max-width"]),"text-line-height":new Ye(V.layout_symbol["text-line-height"]),"text-letter-spacing":new at(V.layout_symbol["text-letter-spacing"]),"text-justify":new at(V.layout_symbol["text-justify"]),"text-radial-offset":new at(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ye(V.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new at(V.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new at(V.layout_symbol["text-anchor"]),"text-max-angle":new Ye(V.layout_symbol["text-max-angle"]),"text-writing-mode":new Ye(V.layout_symbol["text-writing-mode"]),"text-rotate":new at(V.layout_symbol["text-rotate"]),"text-padding":new Ye(V.layout_symbol["text-padding"]),"text-keep-upright":new Ye(V.layout_symbol["text-keep-upright"]),"text-transform":new at(V.layout_symbol["text-transform"]),"text-offset":new at(V.layout_symbol["text-offset"]),"text-allow-overlap":new Ye(V.layout_symbol["text-allow-overlap"]),"text-overlap":new Ye(V.layout_symbol["text-overlap"]),"text-ignore-placement":new Ye(V.layout_symbol["text-ignore-placement"]),"text-optional":new Ye(V.layout_symbol["text-optional"])})}};class Wm{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:Pt,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}}$e("FormatSectionOverride",Wm,{omit:["defaultValue"]});class qh extends pn{constructor(t){super(t,Mp)}recalculate(t,n){if(super.recalculate(t,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,n,a,c){const d=this.layout.get(t).evaluate(n,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||va(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(w,M)=>m&&M in m?String(m[M]):"")}(n.properties,d)}createBucket(t){return new ll(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Mp.paint.overridableProperties){if(!qh.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new Wm(n),c=new uc(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new hc("source",c):new dc("composite",c,n.value.zoomStops),this.paint._values[t]=new dn(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&qh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),c=Mp.paint.properties[n];let d=!1;const p=m=>{for(const y of m)if(c.overrides&&c.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof yr)p(a.value.value.sections);else if(a.value.kind==="source"){const m=w=>{d||(w instanceof Kn&&ci(w.value)===pa?p(w.value.sections):w instanceof Io?p(w.sections):w.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let Xm;var Pv={get paint(){return Xm=Xm||new br({"background-color":new Ye(V.paint_background["background-color"]),"background-pattern":new zc(V.paint_background["background-pattern"]),"background-opacity":new Ye(V.paint_background["background-opacity"])})}};class Cv extends pn{constructor(t){super(t,Pv)}}let Km;var Iv={get paint(){return Km=Km||new br({"raster-opacity":new Ye(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ye(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ye(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ye(V.paint_raster["raster-brightness-max"]),"raster-saturation":new Ye(V.paint_raster["raster-saturation"]),"raster-contrast":new Ye(V.paint_raster["raster-contrast"]),"raster-resampling":new Ye(V.paint_raster["raster-resampling"]),"raster-fade-duration":new Ye(V.paint_raster["raster-fade-duration"])})}};class Ev extends pn{constructor(t){super(t,Iv)}}class kv extends pn{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 zv{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 Av={once:!0},Sp=63710088e-1;class ls{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 ls(Ki(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const n=Math.PI/180,a=this.lat*n,c=t.lat*n,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*n);return Sp*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof ls)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new ls(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new ls(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 Ym=2*Math.PI*Sp;function Jm(r){return Ym*Math.cos(r*Math.PI/180)}function Qm(r){return(180+r)/360}function eg(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function tg(r,t){return r/Jm(t)}function Pp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function ig(r,t){return r*Jm(Pp(t))}class iu{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=ls.convert(t);return new iu(Qm(a.lng),eg(a.lat),tg(n,a.lat))}toLngLat(){return new ls(360*this.x-180,Pp(this.y))}toAltitude(){return ig(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ym*(t=Pp(this.y),1/Math.cos(t*Math.PI/180));var t}}function rg(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 Cp{constructor(t,n,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,n,a))throw new Error(`x=${n}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=n,this.y=a,this.key=cl(0,t,t,n,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,n,a){const c=(p=this.y,m=this.z,y=rg(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),w=rg(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+w[0]+","+w[1]);var d,p,m,y,w;const M=function(C,z,D){let B,j="";for(let $=C;$>0;$--)B=1<<$-1,j+=(z&B?1:0)+(D&B?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const n=this.z-t.z;return n>0&&t.x===this.x>>n&&t.y===this.y>>n}getTilePoint(t){const n=Math.pow(2,this.z);return new Ve((t.x*n-this.x)*Qe,(t.y*n-this.y)*Qe)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ng{constructor(t,n){this.wrap=t,this.canonical=n,this.key=cl(t,n.z,n.z,n.x,n.y)}}class Yr{constructor(t,n,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=n,this.canonical=new Cp(a,+c,+d),this.key=cl(n,t,a,c,d)}clone(){return new Yr(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 Yr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yr(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?cl(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):cl(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 Yr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new Yr(n,this.wrap,n,a,c),new Yr(n,this.wrap,n,a+1,c),new Yr(n,this.wrap,n,a,c+1),new Yr(n,this.wrap,n,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Yr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Yr(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 ng(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new iu(t.x-this.wrap,t.y))}}function cl(r,t,n,a,c){(r*=2)<0&&(r=-1*r-1);const d=1<<n;return(d*d*r+d*c+a).toString(36)+n.toString(36)+t.toString(36)}$e("CanonicalTileID",Cp),$e("OverscaledTileID",Yr,{omit:["terrainRttPosMatrix32f"]});class ag{constructor(t,n,a,c=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 Vi(`"${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=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<y;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(y,w)]=this.data[this._idx(y-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,y)]=this.data[this._idx(w,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 w=0;w<y;w++)for(let M=0;M<y;M++){const C=this.get(w,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,n){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,n);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,n){if(t<-1||t>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(t+1)}unpack(t,n,a){return t*this.redFactor+n*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new Kr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,n,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-n*this.dim,w=-a*this.dim;for(let M=p;M<m;M++)for(let C=c;C<d;C++)this.data[this._idx(C,M)]=t.data[this._idx(C+y,M+w)]}}$e("DEMData",ag);class sg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let n=0;n<t.length;n++){const a=t[n];this._stringToNumber[a]=n,this._numberToString[n]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class og{constructor(t,n,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=n,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(t[n]=this[n]);return t}}class lg{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new In(Qe,16,0),this.grid3D=new In(Qe,16,0),this.featureIndexArray=new W,this.promoteId=n}insert(t,n,a,c,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const y=p?this.grid3D:this.grid;for(let w=0;w<n.length;w++){const M=n[w],C=[1/0,1/0,-1/0,-1/0];for(let z=0;z<M.length;z++){const D=M[z];C[0]=Math.min(C[0],D.x),C[1]=Math.min(C[1],D.y),C[2]=Math.max(C[2],D.x),C[3]=Math.max(C[3],D.y)}C[0]<Qe&&C[1]<Qe&&C[2]>=0&&C[3]>=0&&y.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Kc.VectorTile(new mp(this.rawTileData)).layers,this.sourceLayerCoder=new sg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,c){this.loadVTLayers();const d=t.params,p=Qe/t.tileSize/t.scale,m=pc(d.filter),y=t.queryGeometry,w=t.queryPadding*p,M=ug(y),C=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),z=ug(t.cameraQueryGeometry),D=this.grid3D.query(z.minX-w,z.minY-w,z.maxX+w,z.maxY+w,($,X,ae,Y)=>function(R,U,Q,fe,Ae){for(const ve of R)if(U<=ve.x&&Q<=ve.y&&fe>=ve.x&&Ae>=ve.y)return!0;const ye=[new Ve(U,Q),new Ve(U,Ae),new Ve(fe,Ae),new Ve(fe,Q)];if(R.length>2){for(const ve of ye)if(Js(R,ve))return!0}for(let ve=0;ve<R.length-1;ve++)if(vx(R[ve],R[ve+1],ye))return!0;return!1}(t.cameraQueryGeometry,$-w,X-w,ae+w,Y+w));for(const $ of D)C.push($);C.sort(Rv);const B={};let j;for(let $=0;$<C.length;$++){const X=C[$];if(X===j)continue;j=X;const ae=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(B,ae.bucketIndex,ae.sourceLayerIndex,ae.featureIndex,m,d.layers,d.availableImages,n,a,c,(R,U,Q)=>(Y||(Y=kr(R)),U.queryIntersectsFeature({queryGeometry:y,feature:R,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,n,a,c,d,p,m,y,w,M,C){const z=this.bucketLayerIDs[n];if(p&&!z.some($=>p.has($)))return;const D=this.sourceLayerCoder.decode(a),B=this.vtLayers[D].feature(c);if(d.needGeometry){const $=ra(B,!0);if(!d.filter(new Ht(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new Ht(this.tileID.overscaledZ),B))return;const j=this.getId(B,D);for(let $=0;$<z.length;$++){const X=z[$];if(p&&!p.has(X))continue;const ae=y[X];if(!ae)continue;let Y={};j&&M&&(Y=M.getState(ae.sourceLayer||"_geojsonTileLayer",j));const R=Yi({},w[X]);R.paint=cg(R.paint,ae.paint,B,Y,m),R.layout=cg(R.layout,ae.layout,B,Y,m);const U=!C||C(B,ae,Y);if(!U)continue;const Q=new og(B,this.z,this.x,this.y,j);Q.layer=R;let fe=t[X];fe===void 0&&(fe=t[X]=[]),fe.push({featureIndex:c,feature:Q,intersectionZ:U})}}lookupSymbolFeatures(t,n,a,c,d,p,m,y){const w={};this.loadVTLayers();const M=pc(d);for(const C of t)this.loadMatchingFeature(w,a,c,C,M,p,m,y,n);return w}hasLayer(t){for(const n of this.bucketLayerIDs)for(const a of n)if(t===a)return!0;return!1}getId(t,n){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function cg(r,t,n,a,c){return nn(r,(d,p)=>{const m=t instanceof Jo?t.get(p):null;return m&&m.evaluate?m.evaluate(n,a,c):m})}function ug(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:n,maxX:a,maxY:c}}function Rv(r,t){return t-r}function hg(r,t,n,a,c){const d=[];for(let p=0;p<r.length;p++){const m=r[p];let y;for(let w=0;w<m.length-1;w++){let M=m[w],C=m[w+1];M.x<t&&C.x<t||(M.x<t?M=new Ve(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<t&&(C=new Ve(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<n&&C.y<n||(M.y<n?M=new Ve(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round():C.y<n&&(C=new Ve(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round()),M.x>=a&&C.x>=a||(M.x>=a?M=new Ve(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=a&&(C=new Ve(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=c&&C.y>=c||(M.y>=c?M=new Ve(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round():C.y>=c&&(C=new Ve(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round()),y&&M.equals(y[y.length-1])||(y=[M],d.push(y)),y.push(C)))))}}return d}$e("FeatureIndex",lg,{omit:["rawTileData","sourceLayerCoder"]});class cs extends Ve{constructor(t,n,a,c){super(t,n),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new cs(this.x,this.y,this.angle,this.segment)}}function dg(r,t,n,a,c){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 w=0;for(;m<n/2;){const M=r[p],C=r[p+1];if(!C)return!1;let z=r[p-1].angleTo(M)-M.angleTo(C);for(z=Math.abs((z+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:z}),w+=z;m-y[0].distance>a;)w-=y.shift().angleDelta;if(w>c)return!1;p++,m+=M.dist(C)}return!0}function pg(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function fg(r,t,n){return r?.6*t*n:0}function mg(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function Dv(r,t,n,a,c,d){const p=fg(n,c,d),m=mg(n,a)*d;let y=0;const w=pg(r)/2;for(let M=0;M<r.length-1;M++){const C=r[M],z=r[M+1],D=C.dist(z);if(y+D>w){const B=(w-y)/D,j=Ut.number(C.x,z.x,B),$=Ut.number(C.y,z.y,B),X=new cs(j,$,z.angleTo(C),M);return X._round(),!p||dg(r,X,m,p,t)?X:void 0}y+=D}}function Lv(r,t,n,a,c,d,p,m,y){const w=fg(a,d,p),M=mg(a,c),C=M*p,z=r[0].x===0||r[0].x===y||r[0].y===0||r[0].y===y;return t-C<t/4&&(t=C+t/4),gg(r,z?t/2*m%t:(M/2+2*d)*p*m%t,t,w,n,C,z,!1,y)}function gg(r,t,n,a,c,d,p,m,y){const w=d/2,M=pg(r);let C=0,z=t-n,D=[];for(let B=0;B<r.length-1;B++){const j=r[B],$=r[B+1],X=j.dist($),ae=$.angleTo(j);for(;z+n<C+X;){z+=n;const Y=(z-C)/X,R=Ut.number(j.x,$.x,Y),U=Ut.number(j.y,$.y,Y);if(R>=0&&R<y&&U>=0&&U<y&&z-w>=0&&z+w<=M){const Q=new cs(R,U,ae,B);Q._round(),a&&!dg(r,Q,d,a,c)||D.push(Q)}}C+=X}return m||D.length||p||(D=gg(r,C/2,n,a,c,d,p,!0,y)),D}$e("Anchor",cs);const ru=zr;function _g(r,t,n,a){const c=[],d=r.image,p=d.pixelRatio,m=d.paddedRect.w-2*ru,y=d.paddedRect.h-2*ru;let w={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const M=d.stretchX||[[0,m]],C=d.stretchY||[[0,y]],z=(Me,qe)=>Me+qe[1]-qe[0],D=M.reduce(z,0),B=C.reduce(z,0),j=m-D,$=y-B;let X=0,ae=D,Y=0,R=B,U=0,Q=j,fe=0,Ae=$;if(d.content&&a){const Me=d.content,qe=Me[2]-Me[0],it=Me[3]-Me[1];(d.textFitWidth||d.textFitHeight)&&(w=Um(r)),X=Hh(M,0,Me[0]),Y=Hh(C,0,Me[1]),ae=Hh(M,Me[0],Me[2]),R=Hh(C,Me[1],Me[3]),U=Me[0]-X,fe=Me[1]-Y,Q=qe-ae,Ae=it-R}const ye=w.x1,ve=w.y1,De=w.x2-ye,Re=w.y2-ve,Fe=(Me,qe,it,et)=>{const Xe=Wh(Me.stretch-X,ae,De,ye),vt=Xh(Me.fixed-U,Q,Me.stretch,D),hi=Wh(qe.stretch-Y,R,Re,ve),Ii=Xh(qe.fixed-fe,Ae,qe.stretch,B),rr=Wh(it.stretch-X,ae,De,ye),Jr=Xh(it.fixed-U,Q,it.stretch,D),Ar=Wh(et.stretch-Y,R,Re,ve),Gi=Xh(et.fixed-fe,Ae,et.stretch,B),si=new Ve(Xe,hi),Di=new Ve(rr,hi),qi=new Ve(rr,Ar),Hi=new Ve(Xe,Ar),wr=new Ve(vt/p,Ii/p),Qr=new Ve(Jr/p,Gi/p),Li=t*Math.PI/180;if(Li){const Bi=Math.sin(Li),Fi=Math.cos(Li),wi=[Fi,-Bi,Bi,Fi];si._matMult(wi),Di._matMult(wi),Hi._matMult(wi),qi._matMult(wi)}const Rr=Me.stretch+Me.fixed,Ei=qe.stretch+qe.fixed;return{tl:si,tr:Di,bl:Hi,br:qi,tex:{x:d.paddedRect.x+ru+Rr,y:d.paddedRect.y+ru+Ei,w:it.stretch+it.fixed-Rr,h:et.stretch+et.fixed-Ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wr,pixelOffsetBR:Qr,minFontScaleX:Q/p/De,minFontScaleY:Ae/p/Re,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Me=yg(M,j,D),qe=yg(C,$,B);for(let it=0;it<Me.length-1;it++){const et=Me[it],Xe=Me[it+1];for(let vt=0;vt<qe.length-1;vt++)c.push(Fe(et,qe[vt],Xe,qe[vt+1]))}}else c.push(Fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return c}function Hh(r,t,n){let a=0;for(const c of r)a+=Math.max(t,Math.min(n,c[1]))-Math.max(t,Math.min(n,c[0]));return a}function yg(r,t,n){const a=[{fixed:-1,stretch:0}];for(const[c,d]of r){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+ru,stretch:n}),a}function Wh(r,t,n,a){return r/t*n+a}function Xh(r,t,n,a){return r-t*n/a}class Kh{constructor(t,n,a,c,d,p,m,y,w,M){var C;if(this.boxStartIndex=t.length,w){let z=p.top,D=p.bottom;const B=p.collisionPadding;B&&(z-=B[1],D+=B[3]);let j=D-z;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const z=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?Um(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};z.y1=z.y1*m-y[0],z.y2=z.y2*m+y[2],z.x1=z.x1*m-y[3],z.x2=z.x2*m+y[1];const D=p.collisionPadding;if(D&&(z.x1-=D[0]*m,z.y1-=D[1]*m,z.x2+=D[2]*m,z.y2+=D[3]*m),M){const B=new Ve(z.x1,z.y1),j=new Ve(z.x2,z.y1),$=new Ve(z.x1,z.y2),X=new Ve(z.x2,z.y2),ae=M*Math.PI/180;B._rotate(ae),j._rotate(ae),$._rotate(ae),X._rotate(ae),z.x1=Math.min(B.x,j.x,$.x,X.x),z.x2=Math.max(B.x,j.x,$.x,X.x),z.y1=Math.min(B.y,j.y,$.y,X.y),z.y2=Math.max(B.y,j.y,$.y,X.y)}t.emplaceBack(n.x,n.y,z.x1,z.y1,z.x2,z.y2,a,c,d)}this.boxEndIndex=t.length}}class Bv{constructor(t=[],n=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:a}=this,c=n[t];for(;t>0;){const d=t-1>>1,p=n[d];if(a(c,p)>=0)break;n[t]=p,t=d}n[t]=c}_down(t){const{data:n,compare:a}=this,c=this.length>>1,d=n[t];for(;t<c;){let p=1+(t<<1);const 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 Fv(r,t=1,n=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const m=r[0];for(let D=0;D<m.length;D++){const B=m[D];(!D||B.x<a)&&(a=B.x),(!D||B.y<c)&&(c=B.y),(!D||B.x>d)&&(d=B.x),(!D||B.y>p)&&(p=B.y)}const y=Math.min(d-a,p-c);let w=y/2;const M=new Bv([],Ov);if(y===0)return new Ve(a,c);for(let D=a;D<d;D+=y)for(let B=c;B<p;B+=y)M.push(new ul(D+w,B+w,w,r));let C=function(D){let B=0,j=0,$=0;const X=D[0];for(let ae=0,Y=X.length,R=Y-1;ae<Y;R=ae++){const U=X[ae],Q=X[R],fe=U.x*Q.y-Q.x*U.y;j+=(U.x+Q.x)*fe,$+=(U.y+Q.y)*fe,B+=3*fe}return new ul(j/B,$/B,0,D)}(r),z=M.length;for(;M.length;){const D=M.pop();(D.d>C.d||!C.d)&&(C=D,n&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,z)),D.max-C.d<=t||(w=D.h/2,M.push(new ul(D.p.x-w,D.p.y-w,w,r)),M.push(new ul(D.p.x+w,D.p.y-w,w,r)),M.push(new ul(D.p.x-w,D.p.y+w,w,r)),M.push(new ul(D.p.x+w,D.p.y+w,w,r)),z+=4)}return n&&(console.log(`num probes: ${z}`),console.log(`best distance: ${C.d}`)),C.p}function Ov(r,t){return t.max-r.max}function ul(r,t,n,a){this.p=new Ve(r,t),this.h=n,this.d=function(c,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const w=d[y];for(let M=0,C=w.length,z=C-1;M<C;z=M++){const D=w[M],B=w[z];D.y>c.y!=B.y>c.y&&c.x<(B.x-D.x)*(c.y-D.y)/(B.y-D.y)+D.x&&(p=!p),m=Math.min(m,Jf(c,D,B))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var ir;S.aB=void 0,(ir=S.aB||(S.aB={}))[ir.center=1]="center",ir[ir.left=2]="left",ir[ir.right=3]="right",ir[ir.top=4]="top",ir[ir.bottom=5]="bottom",ir[ir["top-left"]=6]="top-left",ir[ir["top-right"]=7]="top-right",ir[ir["bottom-left"]=8]="bottom-left",ir[ir["bottom-right"]=9]="bottom-right";const us=7,Ip=Number.POSITIVE_INFINITY;function xg(r,t){return t[1]!==Ip?function(n,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),n){case"top-right":case"top-left":case"top":p=c-us;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+us}switch(n){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(r,t[0],t[1]):function(n,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(n){case"top-right":case"top-left":d=p-us;break;case"bottom-right":case"bottom-left":d=-p+us;break;case"bottom":d=-a+us;break;case"top":d=a-us}switch(n){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(r,t[0])}function vg(r,t,n){var a;const c=r.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},n);if(d){const m=d.values,y=[];for(let w=0;w<m.length;w+=2){const M=y[w]=m[w],C=m[w+1].map(z=>z*Ci);M.startsWith("top")?C[1]-=us:M.startsWith("bottom")&&(C[1]+=us),y[w+1]=C}return new Ui(y)}const p=c.get("text-variable-anchor");if(p){let m;m=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},n)*Ci,Ip]:c.get("text-offset").evaluate(t,{},n).map(w=>w*Ci);const y=[];for(const w of p)y.push(w,xg(w,m));return new Ui(y)}return null}function Ep(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 jv(r,t,n,a,c,d,p,m,y,w,M,C){let z=d.textMaxSize.evaluate(t,{});z===void 0&&(z=p);const D=r.layers[0].layout,B=D.get("icon-offset").evaluate(t,{},M),j=wg(n.horizontal),$=p/24,X=r.tilePixelRatio*$,ae=r.tilePixelRatio*z/24,Y=r.tilePixelRatio*m,R=r.tilePixelRatio*D.get("symbol-spacing"),U=D.get("text-padding")*r.tilePixelRatio,Q=function(it,et,Xe,vt=1){const hi=it.get("icon-padding").evaluate(et,{},Xe),Ii=hi&&hi.values;return[Ii[0]*vt,Ii[1]*vt,Ii[2]*vt,Ii[3]*vt]}(D,t,M,r.tilePixelRatio),fe=D.get("text-max-angle")/180*Math.PI,Ae=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",ye=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",ve=D.get("symbol-placement"),De=R/2,Re=D.get("icon-text-fit");let Fe;a&&Re!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(Fe=$m(a,n.vertical,Re,D.get("icon-text-fit-padding"),B,$)),j&&(a=$m(a,j,Re,D.get("icon-text-fit-padding"),B,$)));const Me=M?C.line.getGranularityForZoomLevel(M.z):1,qe=(it,et)=>{et.x<0||et.x>=Qe||et.y<0||et.y>=Qe||function(Xe,vt,hi,Ii,rr,Jr,Ar,Gi,si,Di,qi,Hi,wr,Qr,Li,Rr,Ei,Bi,Fi,wi,Kt,Ln,hl,Bn,Vv){const dl=Xe.addToLineVertexArray(vt,hi);let to,pl,fl,ml,Pg=0,Cg=0,Ig=0,Eg=0,Fp=-1,Op=-1;const Ea={};let kg=tr("");if(Xe.allowVerticalPlacement&&Ii.vertical){const hr=Gi.layout.get("text-rotate").evaluate(Kt,{},Bn)+90;fl=new Kh(si,vt,Di,qi,Hi,Ii.vertical,wr,Qr,Li,hr),Ar&&(ml=new Kh(si,vt,Di,qi,Hi,Ar,Ei,Bi,Li,hr))}if(rr){const hr=Gi.layout.get("icon-rotate").evaluate(Kt,{}),en=Gi.layout.get("icon-text-fit")!=="none",io=_g(rr,hr,hl,en),On=Ar?_g(Ar,hr,hl,en):void 0;pl=new Kh(si,vt,Di,qi,Hi,rr,Ei,Bi,!1,hr),Pg=4*io.length;const ro=Xe.iconSizeData;let aa=null;ro.kind==="source"?(aa=[na*Gi.layout.get("icon-size").evaluate(Kt,{})],aa[0]>os&&Vi(`${Xe.layerIds[0]}: Value for "icon-size" is >= ${tu}. Reduce your "icon-size".`)):ro.kind==="composite"&&(aa=[na*Ln.compositeIconSizes[0].evaluate(Kt,{},Bn),na*Ln.compositeIconSizes[1].evaluate(Kt,{},Bn)],(aa[0]>os||aa[1]>os)&&Vi(`${Xe.layerIds[0]}: Value for "icon-size" is >= ${tu}. Reduce your "icon-size".`)),Xe.addSymbols(Xe.icon,io,aa,wi,Fi,Kt,S.al.none,vt,dl.lineStartIndex,dl.lineLength,-1,Bn),Fp=Xe.icon.placedSymbolArray.length-1,On&&(Cg=4*On.length,Xe.addSymbols(Xe.icon,On,aa,wi,Fi,Kt,S.al.vertical,vt,dl.lineStartIndex,dl.lineLength,-1,Bn),Op=Xe.icon.placedSymbolArray.length-1)}const zg=Object.keys(Ii.horizontal);for(const hr of zg){const en=Ii.horizontal[hr];if(!to){kg=tr(en.text);const On=Gi.layout.get("text-rotate").evaluate(Kt,{},Bn);to=new Kh(si,vt,Di,qi,Hi,en,wr,Qr,Li,On)}const io=en.positionedLines.length===1;if(Ig+=bg(Xe,vt,en,Jr,Gi,Li,Kt,Rr,dl,Ii.vertical?S.al.horizontal:S.al.horizontalOnly,io?zg:[hr],Ea,Fp,Ln,Bn),io)break}Ii.vertical&&(Eg+=bg(Xe,vt,Ii.vertical,Jr,Gi,Li,Kt,Rr,dl,S.al.vertical,["vertical"],Ea,Op,Ln,Bn));const Uv=to?to.boxStartIndex:Xe.collisionBoxArray.length,$v=to?to.boxEndIndex:Xe.collisionBoxArray.length,Gv=fl?fl.boxStartIndex:Xe.collisionBoxArray.length,qv=fl?fl.boxEndIndex:Xe.collisionBoxArray.length,Hv=pl?pl.boxStartIndex:Xe.collisionBoxArray.length,Wv=pl?pl.boxEndIndex:Xe.collisionBoxArray.length,Xv=ml?ml.boxStartIndex:Xe.collisionBoxArray.length,Kv=ml?ml.boxEndIndex:Xe.collisionBoxArray.length;let Fn=-1;const Jh=(hr,en)=>hr&&hr.circleDiameter?Math.max(hr.circleDiameter,en):en;Fn=Jh(to,Fn),Fn=Jh(fl,Fn),Fn=Jh(pl,Fn),Fn=Jh(ml,Fn);const Ag=Fn>-1?1:0;Ag&&(Fn*=Vv/Ci),Xe.glyphOffsetArray.length>=ll.MAX_GLYPHS&&Vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Kt.sortKey!==void 0&&Xe.addToSortKeyRanges(Xe.symbolInstances.length,Kt.sortKey);const Yv=vg(Gi,Kt,Bn),[Jv,Qv]=function(hr,en){const io=hr.length,On=en==null?void 0:en.values;if((On==null?void 0:On.length)>0)for(let ro=0;ro<On.length;ro+=2){const aa=On[ro+1];hr.emplaceBack(S.aB[On[ro]],aa[0],aa[1])}return[io,hr.length]}(Xe.textAnchorOffsets,Yv);Xe.symbolInstances.emplaceBack(vt.x,vt.y,Ea.right>=0?Ea.right:-1,Ea.center>=0?Ea.center:-1,Ea.left>=0?Ea.left:-1,Ea.vertical||-1,Fp,Op,kg,Uv,$v,Gv,qv,Hv,Wv,Xv,Kv,Di,Ig,Eg,Pg,Cg,Ag,0,wr,Fn,Jv,Qv)}(r,et,it,n,a,c,Fe,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,X,[U,U,U,U],Ae,y,Y,Q,ye,B,t,d,w,M,p)};if(ve==="line")for(const it of hg(t.geometry,0,0,Qe,Qe)){const et=eo(it,Me),Xe=Lv(et,R,fe,n.vertical||j,a,24,ae,r.overscaling,Qe);for(const vt of Xe)j&&Nv(r,j.text,De,vt)||qe(et,vt)}else if(ve==="line-center"){for(const it of t.geometry)if(it.length>1){const et=eo(it,Me),Xe=Dv(et,fe,n.vertical||j,a,24,ae);Xe&&qe(et,Xe)}}else if(t.type==="Polygon")for(const it of ko(t.geometry,0)){const et=Fv(it,16);qe(eo(it[0],Me,!0),new cs(et.x,et.y,0))}else if(t.type==="LineString")for(const it of t.geometry){const et=eo(it,Me);qe(et,new cs(et[0].x,et[0].y,0))}else if(t.type==="Point")for(const it of t.geometry)for(const et of it)qe([et],new cs(et.x,et.y,0))}function bg(r,t,n,a,c,d,p,m,y,w,M,C,z,D,B){const j=function(ae,Y,R,U,Q,fe,Ae,ye){const ve=U.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,De=[];for(const Re of Y.positionedLines)for(const Fe of Re.positionedGlyphs){if(!Fe.rect)continue;const Me=Fe.rect||{};let qe=pv+1,it=!0,et=1,Xe=0;const vt=(Q||ye)&&Fe.vertical,hi=Fe.metrics.advance*Fe.scale/2;if(ye&&Y.verticalizable&&(Xe=Re.lineOffset/2-(Fe.imageName?-(Ci-Fe.metrics.width*Fe.scale)/2:(Fe.scale-1)*Ci)),Fe.imageName){const Bi=Ae[Fe.imageName];it=Bi.sdf,et=Bi.pixelRatio,qe=zr/et}const Ii=Q?[Fe.x+hi,Fe.y]:[0,0];let rr=Q?[0,0]:[Fe.x+hi+R[0],Fe.y+R[1]-Xe],Jr=[0,0];vt&&(Jr=rr,rr=[0,0]);const Ar=Fe.metrics.isDoubleResolution?2:1,Gi=(Fe.metrics.left-qe)*Fe.scale-hi+rr[0],si=(-Fe.metrics.top-qe)*Fe.scale+rr[1],Di=Gi+Me.w/Ar*Fe.scale/et,qi=si+Me.h/Ar*Fe.scale/et,Hi=new Ve(Gi,si),wr=new Ve(Di,si),Qr=new Ve(Gi,qi),Li=new Ve(Di,qi);if(vt){const Bi=new Ve(-hi,hi-Vh),Fi=-Math.PI/2,wi=Ci/2-hi,Kt=new Ve(5-Vh-wi,-(Fe.imageName?wi:0)),Ln=new Ve(...Jr);Hi._rotateAround(Fi,Bi)._add(Kt)._add(Ln),wr._rotateAround(Fi,Bi)._add(Kt)._add(Ln),Qr._rotateAround(Fi,Bi)._add(Kt)._add(Ln),Li._rotateAround(Fi,Bi)._add(Kt)._add(Ln)}if(ve){const Bi=Math.sin(ve),Fi=Math.cos(ve),wi=[Fi,-Bi,Bi,Fi];Hi._matMult(wi),wr._matMult(wi),Qr._matMult(wi),Li._matMult(wi)}const Rr=new Ve(0,0),Ei=new Ve(0,0);De.push({tl:Hi,tr:wr,bl:Qr,br:Li,tex:Me,writingMode:Y.writingMode,glyphOffset:Ii,sectionIndex:Fe.sectionIndex,isSDF:it,pixelOffsetTL:Rr,pixelOffsetBR:Ei,minFontScaleX:0,minFontScaleY:0})}return De}(0,n,m,c,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let X=null;$.kind==="source"?(X=[na*c.layout.get("text-size").evaluate(p,{})],X[0]>os&&Vi(`${r.layerIds[0]}: Value for "text-size" is >= ${tu}. Reduce your "text-size".`)):$.kind==="composite"&&(X=[na*D.compositeTextSizes[0].evaluate(p,{},B),na*D.compositeTextSizes[1].evaluate(p,{},B)],(X[0]>os||X[1]>os)&&Vi(`${r.layerIds[0]}: Value for "text-size" is >= ${tu}. Reduce your "text-size".`)),r.addSymbols(r.text,j,X,m,d,p,w,t,y.lineStartIndex,y.lineLength,z,B);for(const ae of M)C[ae]=r.text.placedSymbolArray.length-1;return 4*j.length}function wg(r){for(const t in r)return r[t];return null}function Nv(r,t,n,a){const c=r.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<n)return!0}else c[t]=[];return c[t].push(a),!1}const Tg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class kp{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,a]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=Tg[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 kp(m,p,d,t)}constructor(t,n=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=Tg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=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 zp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,y=[0,d.length-1,0],w=[];for(;y.length;){const M=y.pop()||0,C=y.pop()||0,z=y.pop()||0;if(C-z<=m){for(let $=z;$<=C;$++){const X=p[2*$],ae=p[2*$+1];X>=t&&X<=a&&ae>=n&&ae<=c&&w.push(d[$])}continue}const D=z+C>>1,B=p[2*D],j=p[2*D+1];B>=t&&B<=a&&j>=n&&j<=c&&w.push(d[D]),(M===0?t<=B:n<=j)&&(y.push(z),y.push(D-1),y.push(1-M)),(M===0?a>=B:c>=j)&&(y.push(D+1),y.push(C),y.push(1-M))}return w}within(t,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,m=[0,c.length-1,0],y=[],w=a*a;for(;m.length;){const M=m.pop()||0,C=m.pop()||0,z=m.pop()||0;if(C-z<=p){for(let $=z;$<=C;$++)Sg(d[2*$],d[2*$+1],t,n)<=w&&y.push(c[$]);continue}const D=z+C>>1,B=d[2*D],j=d[2*D+1];Sg(B,j,t,n)<=w&&y.push(c[D]),(M===0?t-a<=B:n-a<=j)&&(m.push(z),m.push(D-1),m.push(1-M)),(M===0?t+a>=B:n+a>=j)&&(m.push(D+1),m.push(C),m.push(1-M))}return y}}function zp(r,t,n,a,c,d){if(c-a<=n)return;const p=a+c>>1;Mg(r,t,p,a,c,d),zp(r,t,n,a,p-1,1-d),zp(r,t,n,p+1,c,1-d)}function Mg(r,t,n,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,M=n-a+1,C=Math.log(w),z=.5*Math.exp(2*C/3),D=.5*Math.sqrt(C*z*(w-z)/w)*(M-w/2<0?-1:1);Mg(r,t,n,Math.max(a,Math.floor(n-M*z/w+D)),Math.min(c,Math.floor(n+(w-M)*z/w+D)),d)}const p=t[2*n+d];let m=a,y=c;for(nu(r,t,a,n),t[2*c+d]>p&&nu(r,t,a,c);m<y;){for(nu(r,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?nu(r,t,a,y):(y++,nu(r,t,y,c)),y<=n&&(a=y+1),n<=y&&(c=y-1)}}function nu(r,t,n,a){Ap(r,n,a),Ap(t,2*n,2*a),Ap(t,2*n+1,2*a+1)}function Ap(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Sg(r,t,n,a){const c=r-n,d=t-a;return c*c+d*d}var Rp;S.cm=void 0,(Rp=S.cm||(S.cm={})).create="create",Rp.load="load",Rp.fullLoad="fullLoad";let Yh=null,au=[];const Dp=1e3/60,Lp="loadTime",Bp="fullLoadTime",Zv={mark(r){performance.mark(r)},frame(r){const t=r;Yh!=null&&au.push(t-Yh),Yh=t},clearMetrics(){Yh=null,au=[],performance.clearMeasures(Lp),performance.clearMeasures(Bp);for(const r in S.cm)performance.clearMarks(S.cm[r])},getPerformanceMetrics(){performance.measure(Lp,S.cm.create,S.cm.load),performance.measure(Bp,S.cm.create,S.cm.fullLoad);const r=performance.getEntriesByName(Lp)[0].duration,t=performance.getEntriesByName(Bp)[0].duration,n=au.length,a=1/(au.reduce((d,p)=>d+p,0)/n/1e3),c=au.filter(d=>d>Dp).reduce((d,p)=>d+(p-Dp)/Dp,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:c/(n+c)*100,totalFrames:n}}};S.$=iu,S.A=Ot,S.B=Ut,S.C=Ht,S.D=Ye,S.E=J,S.F=Mc,S.G=function(r){if(an==null){const t=r.navigator?r.navigator.userAgent:null;an=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return an},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 zv(()=>this.process()),this.subscription=Ue(this.target,"message",n=>this.receive(n),!1),this.globalScope=Fr(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((n,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Ue(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},Av):null;this.resolveRejects[c]={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:c,sourceMapId:this.mapId,origin:location.origin,data:Vs(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(Fr(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(t.error?c.reject(Ta(t.error)):c.resolve(Ta(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=Ta(t.data),a=new AbortController;this.abortControllers[r]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,n,a);this.completeTask(r,null,c)}catch(c){this.completeTask(r,c)}})}completeTask(r,t,n){const a=[];delete this.abortControllers[r];const c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Vs(t):null,data:Vs(n,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=_p,S.J=Mn,S.K=function(){var r=new Ot(16);return Ot!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},S.L=function(r,t,n){var a,c,d,p,m,y,w,M,C,z,D,B,j=n[0],$=n[1],X=n[2];return t===r?(r[12]=t[0]*j+t[4]*$+t[8]*X+t[12],r[13]=t[1]*j+t[5]*$+t[9]*X+t[13],r[14]=t[2]*j+t[6]*$+t[10]*X+t[14],r[15]=t[3]*j+t[7]*$+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],z=t[9],D=t[10],B=t[11],r[0]=a=t[0],r[1]=c,r[2]=d,r[3]=p,r[4]=m,r[5]=y,r[6]=w,r[7]=M,r[8]=C,r[9]=z,r[10]=D,r[11]=B,r[12]=a*j+m*$+C*X+t[12],r[13]=c*j+y*$+z*X+t[13],r[14]=d*j+w*$+D*X+t[14],r[15]=p*j+M*$+B*X+t[15]),r},S.M=function(r,t,n){var a=n[0],c=n[1],d=n[2];return r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r[3]=t[3]*a,r[4]=t[4]*c,r[5]=t[5]*c,r[6]=t[6]*c,r[7]=t[7]*c,r[8]=t[8]*d,r[9]=t[9]*d,r[10]=t[10]*d,r[11]=t[11]*d,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.N=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],z=t[9],D=t[10],B=t[11],j=t[12],$=t[13],X=t[14],ae=t[15],Y=n[0],R=n[1],U=n[2],Q=n[3];return r[0]=Y*a+R*m+U*C+Q*j,r[1]=Y*c+R*y+U*z+Q*$,r[2]=Y*d+R*w+U*D+Q*X,r[3]=Y*p+R*M+U*B+Q*ae,r[4]=(Y=n[4])*a+(R=n[5])*m+(U=n[6])*C+(Q=n[7])*j,r[5]=Y*c+R*y+U*z+Q*$,r[6]=Y*d+R*w+U*D+Q*X,r[7]=Y*p+R*M+U*B+Q*ae,r[8]=(Y=n[8])*a+(R=n[9])*m+(U=n[10])*C+(Q=n[11])*j,r[9]=Y*c+R*y+U*z+Q*$,r[10]=Y*d+R*w+U*D+Q*X,r[11]=Y*p+R*M+U*B+Q*ae,r[12]=(Y=n[12])*a+(R=n[13])*m+(U=n[14])*C+(Q=n[15])*j,r[13]=Y*c+R*y+U*z+Q*$,r[14]=Y*d+R*w+U*D+Q*X,r[15]=Y*p+R*M+U*B+Q*ae,r},S.O=function(r,t){const n={};for(let a=0;a<t.length;a++){const c=t[a];c in r&&(n[c]=r[c])}return n},S.P=Ve,S.Q=ls,S.R=Kr,S.S=eg,S.T=Ec,S.U=Qm,S.V=Oi,S.W=ni,S.X=Tn,S.Y=Yr,S.Z=Qe,S._=o,S.a=gr,S.a$=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[4],p=t[5],m=t[6],y=t[7],w=t[8],M=t[9],C=t[10],z=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=d*c+w*a,r[5]=p*c+M*a,r[6]=m*c+C*a,r[7]=y*c+z*a,r[8]=w*c-d*a,r[9]=M*c-p*a,r[10]=C*c-m*a,r[11]=z*c-y*a,r},S.a0=25,S.a1=Cp,S.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const c=window.document.createElement("source");Sn(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},S.a3=we,S.a4=function(){return bn++},S.a5=_,S.a6=ll,S.a7=pc,S.a8=ra,S.a9=og,S.aA=function(r,t,n,a,c=!1){if(!n[0]&&!n[1])return[0,0];const d=c?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);n=[n[0]*m-n[1]*p,n[0]*p+n[1]*m]}return[c?n[0]:pi(t,n[0],r.zoom),c?n[1]:pi(t,n[1],r.zoom)]},S.aC=vp,S.aD=Ep,S.aE=xp,S.aF=kp,S.aG=vi,S.aH=jh,S.aI=K,S.aJ=lt,S.aK=Be,S.aL=Ki,S.aM=ft,S.aN=ig,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 Ot(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},S.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},S.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},S.aT=function(r,t){var n=t[0],a=t[1],c=t[2],d=n*n+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=t[0]*d,r[1]=t[1]*d,r[2]=t[2]*d,r},S.aU=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[0],m=n[1],y=n[2];return r[0]=c*y-d*m,r[1]=d*p-a*y,r[2]=a*m-c*p,r},S.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},S.aW=ng,S.aX=cl,S.aY=function(r,t,n,a,c){var d,p=1/Math.tan(t/2);return r[0]=p/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0?(r[10]=(c+a)*(d=1/(a-c)),r[14]=2*c*a*d):(r[10]=-1,r[14]=-2*a),r},S.aZ=function(r){var t=new Ot(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},S.a_=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],w=t[4],M=t[5],C=t[6],z=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c+w*a,r[1]=p*c+M*a,r[2]=m*c+C*a,r[3]=y*c+z*a,r[4]=w*c-d*a,r[5]=M*c-p*a,r[6]=C*c-m*a,r[7]=z*c-y*a,r},S.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t},S.ab=function(r){return r*Math.PI/180},S.ac=function(r){return Math.pow(2,r)},S.ad=Et,S.ae=Vt,S.af=85.051129,S.ag=tg,S.ah=function(r){return Math.log(r)/Math.LN2},S.ai=function(r){var t=r[0],n=r[1];return t*t+n*n},S.aj=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},S.ak=function(r,t){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=r,m=c?Vt(xr.interpolationFactor(c,t,d,p),0,1):0;r.kind==="camera"?a=Ut.number(r.minSize,r.maxSize,m):n=m}return{uSizeT:n,uSize:a}},S.am=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:c}){return r.kind==="source"?a/na:r.kind==="composite"?Ut.number(a/na,c/na,n):t},S.an=function(r,t){var n=t[0],a=t[1],c=t[2],d=t[3],p=t[4],m=t[5],y=t[6],w=t[7],M=t[8],C=t[9],z=t[10],D=t[11],B=t[12],j=t[13],$=t[14],X=t[15],ae=n*m-a*p,Y=n*y-c*p,R=n*w-d*p,U=a*y-c*m,Q=a*w-d*m,fe=c*w-d*y,Ae=M*j-C*B,ye=M*$-z*B,ve=M*X-D*B,De=C*$-z*j,Re=C*X-D*j,Fe=z*X-D*$,Me=ae*Fe-Y*Re+R*De+U*ve-Q*ye+fe*Ae;return Me?(r[0]=(m*Fe-y*Re+w*De)*(Me=1/Me),r[1]=(c*Re-a*Fe-d*De)*Me,r[2]=(j*fe-$*Q+X*U)*Me,r[3]=(z*Q-C*fe-D*U)*Me,r[4]=(y*ve-p*Fe-w*ye)*Me,r[5]=(n*Fe-c*ve+d*ye)*Me,r[6]=($*R-B*fe-X*Y)*Me,r[7]=(M*fe-z*R+D*Y)*Me,r[8]=(p*Re-m*ve+w*Ae)*Me,r[9]=(a*ve-n*Re-d*Ae)*Me,r[10]=(B*Q-j*R+X*ae)*Me,r[11]=(C*R-M*Q-D*ae)*Me,r[12]=(m*ye-p*De-y*Ae)*Me,r[13]=(n*De-a*ye+c*Ae)*Me,r[14]=(j*Y-B*U-$*ae)*Me,r[15]=(M*U-C*Y+z*ae)*Me,r):null},S.ao=Ni,S.ap=function(r){return Math.hypot(r[0],r[1])},S.aq=function(r){return r[0]=0,r[1]=0,r},S.ar=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},S.as=bp,S.at=xi,S.au=function(r,t,n,a){const c=t.y-r.y,d=t.x-r.x,p=a.y-n.y,m=a.x-n.x,y=p*d-m*c;if(y===0)return null;const w=(m*(r.y-n.y)-p*(r.x-n.x))/y;return new Ve(r.x+w*d,r.y+w*c)},S.av=hg,S.aw=Nc,S.ax=function(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,n,a,c]},S.ay=Ci,S.az=pi,S.b=fr,S.b$=function(r,t){var n=r[0],a=r[1],c=r[2],d=r[3],p=r[4],m=r[5],y=r[6],w=r[7],M=r[8],C=r[9],z=r[10],D=r[11],B=r[12],j=r[13],$=r[14],X=r[15],ae=t[0],Y=t[1],R=t[2],U=t[3],Q=t[4],fe=t[5],Ae=t[6],ye=t[7],ve=t[8],De=t[9],Re=t[10],Fe=t[11],Me=t[12],qe=t[13],it=t[14],et=t[15];return Math.abs(n-ae)<=Zt*Math.max(1,Math.abs(n),Math.abs(ae))&&Math.abs(a-Y)<=Zt*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-R)<=Zt*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-U)<=Zt*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-Q)<=Zt*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(m-fe)<=Zt*Math.max(1,Math.abs(m),Math.abs(fe))&&Math.abs(y-Ae)<=Zt*Math.max(1,Math.abs(y),Math.abs(Ae))&&Math.abs(w-ye)<=Zt*Math.max(1,Math.abs(w),Math.abs(ye))&&Math.abs(M-ve)<=Zt*Math.max(1,Math.abs(M),Math.abs(ve))&&Math.abs(C-De)<=Zt*Math.max(1,Math.abs(C),Math.abs(De))&&Math.abs(z-Re)<=Zt*Math.max(1,Math.abs(z),Math.abs(Re))&&Math.abs(D-Fe)<=Zt*Math.max(1,Math.abs(D),Math.abs(Fe))&&Math.abs(B-Me)<=Zt*Math.max(1,Math.abs(B),Math.abs(Me))&&Math.abs(j-qe)<=Zt*Math.max(1,Math.abs(j),Math.abs(qe))&&Math.abs($-it)<=Zt*Math.max(1,Math.abs($),Math.abs(it))&&Math.abs(X-et)<=Zt*Math.max(1,Math.abs(X),Math.abs(et))},S.b0=function(){const r=new Float32Array(16);return Et(r),r},S.b1=function(){const r=new Float64Array(16);return Et(r),r},S.b2=function(){return new Float64Array(16)},S.b3=function(r,t,n){const a=new Float64Array(4);return function(c,d,p,m){var y=.5*Math.PI/180;d*=y,p*=y,m*=y;var w=Math.sin(d),M=Math.cos(d),C=Math.sin(p),z=Math.cos(p),D=Math.sin(m),B=Math.cos(m);c[0]=w*z*B-M*C*D,c[1]=M*C*B+w*z*D,c[2]=M*z*D-w*C*B,c[3]=M*z*B+w*C*D}(a,r,t-90,n),a},S.b4=function(r,t,n,a){var c,d,p,m,y,w=t[0],M=t[1],C=t[2],z=t[3],D=n[0],B=n[1],j=n[2],$=n[3];return(d=w*D+M*B+C*j+z*$)<0&&(d=-d,D=-D,B=-B,j=-j,$=-$),1-d>Zt?(c=Math.acos(d),p=Math.sin(c),m=Math.sin((1-a)*c)/p,y=Math.sin(a*c)/p):(m=1-a,y=a),r[0]=m*w+y*D,r[1]=m*M+y*B,r[2]=m*C+y*j,r[3]=m*z+y*$,r},S.b5=function(r){const t=new Float64Array(9);var n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y;C=(c=(a=r)[0])*(y=c+c),z=(d=a[1])*y,B=(p=a[2])*y,j=p*(w=d+d),X=(m=a[3])*y,ae=m*w,Y=m*(M=p+p),(n=t)[0]=1-(D=d*w)-($=p*M),n[3]=z-Y,n[6]=B+ae,n[1]=z+Y,n[4]=1-C-$,n[7]=j-X,n[2]=B-ae,n[5]=j+X,n[8]=1-C-D;const R=ft(-Math.asin(Vt(t[2],-1,1)));let U,Q;return Math.hypot(t[5],t[8])<.001?(U=0,Q=-ft(Math.atan2(t[3],t[4]))):(U=ft(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=ft(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:R+90,bearing:Q}},S.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},S.b7=gt,S.b8=Pa,S.b9=sl,S.bA=function(r){if(r.type==="custom")return new kv(r);switch(r.type){case"background":return new Cv(r);case"circle":return new wx(r);case"fill":return new Zx(r);case"fill-extrusion":return new Xx(r);case"heatmap":return new Mx(r);case"hillshade":return new Px(r);case"line":return new rv(r);case"raster":return new Ev(r);case"symbol":return new qh(r)}},S.bB=ar,S.bC=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let n=[];try{if(!ie(r.version,t.version))return[{command:"setStyle",args:[t]}];ie(r.center,t.center)||n.push({command:"setCenter",args:[t.center]}),ie(r.centerAltitude,t.centerAltitude)||n.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ie(r.zoom,t.zoom)||n.push({command:"setZoom",args:[t.zoom]}),ie(r.bearing,t.bearing)||n.push({command:"setBearing",args:[t.bearing]}),ie(r.pitch,t.pitch)||n.push({command:"setPitch",args:[t.pitch]}),ie(r.roll,t.roll)||n.push({command:"setRoll",args:[t.roll]}),ie(r.sprite,t.sprite)||n.push({command:"setSprite",args:[t.sprite]}),ie(r.glyphs,t.glyphs)||n.push({command:"setGlyphs",args:[t.glyphs]}),ie(r.transition,t.transition)||n.push({command:"setTransition",args:[t.transition]}),ie(r.light,t.light)||n.push({command:"setLight",args:[t.light]}),ie(r.terrain,t.terrain)||n.push({command:"setTerrain",args:[t.terrain]}),ie(r.sky,t.sky)||n.push({command:"setSky",args:[t.sky]}),ie(r.projection,t.projection)||n.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,m,y,w){let M;for(M in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,M)&&(Object.prototype.hasOwnProperty.call(m,M)||ue(M,y,w));for(M in m)Object.prototype.hasOwnProperty.call(m,M)&&(Object.prototype.hasOwnProperty.call(p,M)?ie(p[M],m[M])||(p[M].type==="geojson"&&m[M].type==="geojson"&&Ne(p,m,M)?_e(y,{command:"setGeoJSONSourceData",args:[M,m[M].data]}):ze(M,m,y,w)):xe(M,m,y))})(r.sources,t.sources,c,a);const d=[];r.layers&&r.layers.forEach(p=>{"source"in p&&a[p.source]?n.push({command:"removeLayer",args:[p.id]}):d.push(p)}),n=n.concat(c),function(p,m,y){m=m||[];const w=(p=p||[]).map(nt),M=m.map(nt),C=p.reduce(dt,{}),z=m.reduce(dt,{}),D=w.slice(),B=Object.create(null);let j,$,X,ae,Y;for(let R=0,U=0;R<w.length;R++)j=w[R],Object.prototype.hasOwnProperty.call(z,j)?U++:(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.indexOf(j,U),1));for(let R=0,U=0;R<M.length;R++)j=M[M.length-1-R],D[D.length-1-R]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.lastIndexOf(j,D.length-U),1)):U++,ae=D[D.length-R],_e(y,{command:"addLayer",args:[z[j],ae]}),D.splice(D.length-R,0,j),B[j]=!0);for(let R=0;R<M.length;R++)if(j=M[R],$=C[j],X=z[j],!B[j]&&!ie($,X))if(ie($.source,X.source)&&ie($["source-layer"],X["source-layer"])&&ie($.type,X.type)){for(Y in Ze($.layout,X.layout,y,j,null,"setLayoutProperty"),Ze($.paint,X.paint,y,j,null,"setPaintProperty"),ie($.filter,X.filter)||_e(y,{command:"setFilter",args:[j,X.filter]}),ie($.minzoom,X.minzoom)&&ie($.maxzoom,X.maxzoom)||_e(y,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ze($[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ze($[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else _e(y,{command:"removeLayer",args:[j]}),ae=D[D.lastIndexOf(j)+1],_e(y,{command:"addLayer",args:[X,ae]})}(d,t.layers,n)}catch(a){console.warn("Unable to compute style diff:",a),n=[{command:"setStyle",args:[t]}]}return n},S.bD=function(r){const t=[],n=r.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},S.bE=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!r(t[a],n[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&n!==null){if(typeof n!="object"||Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(!r(t[a],n[a]))return!1;return!0}return t===n},S.bF=nn,S.bG=ha,S.bH=class extends mn{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},S.bI=Er,S.bJ=class extends mn{constructor(r,t){super(r,t),this.current=ia}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},S.bK=Ca,S.bL=class extends mn{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},S.bM=class extends mn{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},S.bN=Wi,S.bO=function(r,t){var n=Math.sin(t),a=Math.cos(t);return r[0]=a,r[1]=n,r[2]=0,r[3]=-n,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},S.bP=function(r,t,n){var a=t[0],c=t[1],d=t[2];return r[0]=a*n[0]+c*n[3]+d*n[6],r[1]=a*n[1]+c*n[4]+d*n[7],r[2]=a*n[2]+c*n[5]+d*n[8],r},S.bQ=function(r,t,n,a,c,d,p){var m=1/(t-n),y=1/(a-c),w=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*w,r[11]=0,r[12]=(t+n)*m,r[13]=(c+a)*y,r[14]=(p+d)*w,r[15]=1,r},S.bR=class extends Sa{},S.bS=ov,S.bT=class extends il{},S.bU=tp,S.bV=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},S.bW=sm,S.bX=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[3]*a+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*a+n[4]*c+n[8]*d+n[12])/(p=p||1),r[1]=(n[1]*a+n[5]*c+n[9]*d+n[13])/p,r[2]=(n[2]*a+n[6]*c+n[10]*d+n[14])/p,r},S.bY=class extends kn{},S.bZ=class extends l{},S.b_=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},S.ba=Wc,S.bb=al,S.bc=Cr,S.bd=ki,S.be=cr,S.bf=function(r,t,n,a,c){return Cr(a,c,Vt((r-t)/(n-t),0,1))},S.bg=fi,S.bh=function(){return new Float64Array(3)},S.bi=function(r,t,n,a){return r[0]=t[0]+n[0]*a,r[1]=t[1]+n[1]*a,r[2]=t[2]+n[2]*a,r},S.bj=Xi,S.bk=function(){return new Float64Array(4)},S.bl=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bm=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bn=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bo=qn,S.bp=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],w=t[8],M=t[9],C=t[10],z=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c-w*a,r[1]=p*c-M*a,r[2]=m*c-C*a,r[3]=y*c-z*a,r[8]=d*a+w*c,r[9]=p*a+M*c,r[10]=m*a+C*c,r[11]=y*a+z*c,r},S.bq=function(r,t){const n=fi(r,360),a=fi(t,360),c=a-n,d=a>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},S.br=function(r){return r[0]=0,r[1]=0,r[2]=0,r},S.bs=function(r,t,n,a){const c=Math.sqrt(r*r+t*t),d=Math.sqrt(n*n+a*a);r/=c,t/=c,n/=d,a/=d;const p=Math.acos(r*n+t*a);return-t*n+r*a>0?p:-p},S.bt=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},S.bu=Sp,S.bv=function(r,t){const n=fi(r,2*Math.PI),a=fi(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},S.bw=function(){const r={},t=V.$version;for(const n in V.$root){const a=V.$root[n];if(a.required){let c=null;c=n==="version"?t:a.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},S.bx=Us,S.by=sn,S.bz=function(r){r=r.slice();const t=Object.create(null);for(let n=0;n<r.length;n++)t[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ge(r[n],t[r[n].ref]));return r},S.c=mr,S.c0=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.c1=r=>r.type==="symbol",S.c2=r=>r.type==="circle",S.c3=r=>r.type==="heatmap",S.c4=r=>r.type==="line",S.c5=r=>r.type==="fill",S.c6=r=>r.type==="fill-extrusion",S.c7=r=>r.type==="hillshade",S.c8=r=>r.type==="raster",S.c9=r=>r.type==="background",S.cA=Kc,S.cB=mp,S.cC=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},S.cD=function(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(ni())try{return yield Tn(r,t,n,a,c)}catch{}return function(d,p,m,y,w){const M=d.width,C=d.height;Ee&&Je||(Ee=new OffscreenCanvas(M,C),Je=Ee.getContext("2d",{willReadFrequently:!0})),Ee.width=M,Ee.height=C,Je.drawImage(d,0,0,M,C);const z=Je.getImageData(p,m,y,w);return Je.clearRect(0,0,M,C),z.data}(r,t,n,a,c)})},S.cE=ag,S.cF=he,S.cG=Le,S.cH=Tm,S.cI=Lm,S.cJ=Os,S.cK=ea,S.ca=r=>r.type==="custom",S.cb=vn,S.cc=function(r,t,n){const a=Br(t.x-n.x,t.y-n.y),c=Br(r.x-n.x,r.y-n.y);var d,p;return ft(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},S.cd=Zi,S.ce=function(r,t){return or[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},S.cf=function(r,t){return Gt[t]&&"touches"in r},S.cg=function(r){return Gt[r]||or[r]},S.ch=function(r,t,n){var a=t[0],c=t[1];return r[0]=n[0]*a+n[4]*c+n[12],r[1]=n[1]*a+n[5]*c+n[13],r},S.ci=function(r,t){const{x:n,y:a}=iu.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},S.cj=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},S.ck=class extends Qo{},S.cl=Zv,S.cn=function(r){return r.message===mi},S.co=Hn,S.cp=function(r,t){gr.REGISTERED_PROTOCOLS[r]=t},S.cq=function(r){delete gr.REGISTERED_PROTOCOLS[r]},S.cr=function(r,t){const n={};for(let c=0;c<r.length;c++){const d=t&&t[r[c].id]||Ho(r[c]);t&&(t[r[c].id]=d);let p=n[d];p||(p=n[d]=[]),p.push(r[c])}const a=[];for(const c in n)a.push(n[c]);return a},S.cs=$e,S.ct=sg,S.cu=lg,S.cv=Fm,S.cw=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Qe/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],n=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new Ht(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Ht(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Ht(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Ht(w),r.canonical),a["text-size"].possiblyEvaluate(new Ht(M),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Ht(w),r.canonical),a["icon-size"].possiblyEvaluate(new Ht(M),r.canonical)]}const d=n.get("text-line-height")*Ci,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 w of r.bucket.features){const M=n.get("text-font").evaluate(w,{},r.canonical).join(","),C=y.evaluate(w,{},r.canonical),z=c.layoutTextSize.evaluate(w,{},r.canonical),D=c.layoutIconSize.evaluate(w,{},r.canonical),B={horizontal:{},vertical:void 0},j=w.text;let $,X=[0,0];if(j){const R=j.toString(),U=n.get("text-letter-spacing").evaluate(w,{},r.canonical)*Ci,Q=Th(R)?U:0,fe=n.get("text-anchor").evaluate(w,{},r.canonical),Ae=vg(t,w,r.canonical);if(!Ae){const Re=n.get("text-radial-offset").evaluate(w,{},r.canonical);X=Re?xg(fe,[Re*Ci,Ip]):n.get("text-offset").evaluate(w,{},r.canonical).map(Fe=>Fe*Ci)}let ye=p?"center":n.get("text-justify").evaluate(w,{},r.canonical);const ve=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(w,{},r.canonical)*Ci:1/0,De=()=>{r.bucket.allowVerticalPlacement&&Wo(R)&&(B.vertical=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,fe,"left",Q,X,S.al.vertical,!0,z,C))};if(!p&&Ae){const Re=new Set;if(ye==="auto")for(let Me=0;Me<Ae.values.length;Me+=2)Re.add(Ep(Ae.values[Me]));else Re.add(ye);let Fe=!1;for(const Me of Re)if(!B.horizontal[Me])if(Fe)B.horizontal[Me]=B.horizontal[0];else{const qe=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,"center",Me,Q,X,S.al.horizontal,!1,z,C);qe&&(B.horizontal[Me]=qe,Fe=qe.positionedLines.length===1)}De()}else{ye==="auto"&&(ye=Ep(fe));const Re=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,fe,ye,Q,X,S.al.horizontal,!1,z,C);Re&&(B.horizontal[ye]=Re),De(),Wo(R)&&p&&m&&(B.vertical=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,fe,ye,Q,X,S.al.vertical,!1,z,C))}}let ae=!1;if(w.icon&&w.icon.name){const R=r.imageMap[w.icon.name];R&&($=wv(r.imagePositions[w.icon.name],n.get("icon-offset").evaluate(w,{},r.canonical),n.get("icon-anchor").evaluate(w,{},r.canonical)),ae=!!R.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=ae:r.bucket.sdfIcons!==ae&&Vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==r.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const Y=wg(B.horizontal)||B.vertical;r.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&jv(r.bucket,w,B,$,r.imageMap,c,z,D,X,ae,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},S.cx=dp,S.cy=sp,S.cz=hp,S.d=Sn,S.e=Yi,S.f=r=>o(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.g=da,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=wn})},a.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const c=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(c):wn}),S.i=Fr,S.j=(r,t)=>_r(Yi(r,{type:"json"}),t),S.k=G,S.l=Z,S.m=_r,S.n=(r,t)=>_r(Yi(r,{type:"arrayBuffer"}),t),S.o=function(r){return new mp(r).readFields(uv,[])},S.p=Bm,S.q=Uc,S.r=br,S.s=Ue,S.t=vh,S.u=xt,S.v=V,S.w=Vi,S.x=bh,S.y=hn,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)}}}),A("worker",["./shared"],function(S){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,Z){for(const J of N){this._layerConfigs[J.id]=J;const V=this._layers[J.id]=S.bA(J);V._featureFilter=S.a7(V.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of Z)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const G=S.cr(Object.values(this._layerConfigs),this.keyCache);for(const J of G){const V=J.map(ue=>this._layers[ue.id]),le=V[0];if(le.visibility==="none")continue;const ge=le.source||"";let ie=this.familiesBySource[ge];ie||(ie=this.familiesBySource[ge]={});const _e=le.sourceLayer||"_geojsonTileLayer";let xe=ie[_e];xe||(xe=ie[_e]=[]),xe.push(V)}}}class he{constructor(N){const Z={},G=[];for(const ge in N){const ie=N[ge],_e=Z[ge]={};for(const xe in ie){const ue=ie[+xe];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const ze={x:0,y:0,w:ue.bitmap.width+2,h:ue.bitmap.height+2};G.push(ze),_e[xe]={rect:ze,metrics:ue.metrics}}}const{w:J,h:V}=S.p(G),le=new S.q({width:J||1,height:V||1});for(const ge in N){const ie=N[ge];for(const _e in ie){const xe=ie[+_e];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;const ue=Z[ge][_e].rect;S.q.copy(xe.bitmap,le,{x:0,y:0},{x:ue.x+1,y:ue.y+1},xe.bitmap)}}this.image=le,this.positions=Z}}S.cs("GlyphAtlas",he);class pe{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,Z,G,J,V){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const le=new S.ct(Object.keys(N.layers).sort()),ge=new S.cu(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const ie={},_e={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:V},xe=Z.familiesBySource[this.source];for(const Pe in xe){const Ge=N.layers[Pe];if(!Ge)continue;Ge.version===1&&S.w(`Vector tile source "${this.source}" layer "${Pe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const tt=le.encode(Pe),lr=[];for(let Ji=0;Ji<Ge.length;Ji++){const Qt=Ge.feature(Ji),ct=ge.getId(Qt,Pe);lr.push({feature:Qt,id:ct,index:Ji,sourceLayerIndex:tt})}for(const Ji of xe[Pe]){const Qt=Ji[0];Qt.source!==this.source&&S.w(`layer.source = ${Qt.source} does not equal this.source = ${this.source}`),Qt.minzoom&&this.zoom<Math.floor(Qt.minzoom)||Qt.maxzoom&&this.zoom>=Qt.maxzoom||Qt.visibility!=="none"&&(Ce(Ji,this.zoom,G),(ie[Qt.id]=Qt.createBucket({index:ge.bucketLayerIDs.length,layers:Ji,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:tt,sourceID:this.source})).populate(lr,_e,this.tileID.canonical),ge.bucketLayerIDs.push(Ji.map(ct=>ct.id)))}}const ue=S.bF(_e.glyphDependencies,Pe=>Object.keys(Pe).map(Number));this.inFlightDependencies.forEach(Pe=>Pe==null?void 0:Pe.abort()),this.inFlightDependencies=[];let ze=Promise.resolve({});if(Object.keys(ue).length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),ze=J.sendAsync({type:"GG",data:{stacks:ue,source:this.source,tileID:this.tileID,type:"glyphs"}},Pe)}const Ne=Object.keys(_e.iconDependencies);let Ze=Promise.resolve({});if(Ne.length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),Ze=J.sendAsync({type:"GI",data:{icons:Ne,source:this.source,tileID:this.tileID,type:"icons"}},Pe)}const nt=Object.keys(_e.patternDependencies);let dt=Promise.resolve({});if(nt.length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),dt=J.sendAsync({type:"GI",data:{icons:nt,source:this.source,tileID:this.tileID,type:"patterns"}},Pe)}const[we,st,St]=yield Promise.all([ze,Ze,dt]),Rt=new he(we),Pt=new S.cv(st,St);for(const Pe in ie){const Ge=ie[Pe];Ge instanceof S.a6?(Ce(Ge.layers,this.zoom,G),S.cw({bucket:Ge,glyphMap:we,glyphPositions:Rt.positions,imageMap:st,imagePositions:Pt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:_e.subdivisionGranularity})):Ge.hasPattern&&(Ge instanceof S.cx||Ge instanceof S.cy||Ge instanceof S.cz)&&(Ce(Ge.layers,this.zoom,G),Ge.addFeatures(_e,this.tileID.canonical,Pt.patternPositions))}return this.status="done",{buckets:Object.values(ie).filter(Pe=>!Pe.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Rt.image,imageAtlas:Pt,glyphMap:this.returnDependencies?we:null,iconMap:this.returnDependencies?st:null,glyphPositions:this.returnDependencies?Rt.positions:null}})}}function Ce(ce,N,Z){const G=new S.C(N);for(const J of ce)J.recalculate(G,Z)}class Le{constructor(N,Z,G){this.actor=N,this.layerIndex=Z,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=yield S.n(N.request,Z);try{return{vectorTile:new S.cA.VectorTile(new S.cB(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(J){const V=new Uint8Array(G.data);let le=`Unable to parse the tile at ${N.request.url}, `;throw le+=V[0]===31&&V[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(le)}})}loadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request),J=new pe(N);this.loading[Z]=J;const V=new AbortController;J.abort=V;try{const le=yield this.loadVectorTile(N,V);if(delete this.loading[Z],!le)return null;const ge=le.rawData,ie={};le.expires&&(ie.expires=le.expires),le.cacheControl&&(ie.cacheControl=le.cacheControl);const _e={};if(G){const ue=G.finish();ue&&(_e.resourceTiming=JSON.parse(JSON.stringify(ue)))}J.vectorTile=le.vectorTile;const xe=J.parse(le.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[Z]=J,this.fetching[Z]={rawTileData:ge,cacheControl:ie,resourceTiming:_e};try{const ue=yield xe;return S.e({rawTileData:ge.slice(0)},ue,ie,_e)}finally{delete this.fetching[Z]}}catch(le){throw delete this.loading[Z],J.status="done",this.loaded[Z]=J,le}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[Z];if(G.showCollisionBoxes=N.showCollisionBoxes,G.status==="parsing"){const J=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let V;if(this.fetching[Z]){const{rawTileData:le,cacheControl:ge,resourceTiming:ie}=this.fetching[Z];delete this.fetching[Z],V=S.e({rawTileData:le.slice(0)},J,ge,ie)}else V=J;return V}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const Z=this.loading,G=N.uid;Z&&Z[G]&&Z[G].abort&&(Z[G].abort.abort(),delete Z[G])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ie{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:Z,encoding:G,rawImageData:J,redFactor:V,greenFactor:le,blueFactor:ge,baseShift:ie}=N,_e=J.width+2,xe=J.height+2,ue=S.b(J)?new S.R({width:_e,height:xe},yield S.cD(J,-1,-1,_e,xe)):J,ze=new S.cE(Z,ue,G,V,le,ge,ie);return this.loaded=this.loaded||{},this.loaded[Z]=ze,ze})}removeTile(N){const Z=this.loaded,G=N.uid;Z&&Z[G]&&delete Z[G]}}var oe,Ve,Bt=function(){if(Ve)return oe;function ce(Z,G){if(Z.length!==0){N(Z[0],G);for(var J=1;J<Z.length;J++)N(Z[J],!G)}}function N(Z,G){for(var J=0,V=0,le=0,ge=Z.length,ie=ge-1;le<ge;ie=le++){var _e=(Z[le][0]-Z[ie][0])*(Z[ie][1]+Z[le][1]),xe=J+_e;V+=Math.abs(J)>=Math.abs(_e)?J-xe+_e:_e-xe+J,J=xe}J+V>=0!=!!G&&Z.reverse()}return Ve=1,oe=function Z(G,J){var V,le=G&&G.type;if(le==="FeatureCollection")for(V=0;V<G.features.length;V++)Z(G.features[V],J);else if(le==="GeometryCollection")for(V=0;V<G.geometries.length;V++)Z(G.geometries[V],J);else if(le==="Feature")Z(G.geometry,J);else if(le==="Polygon")ce(G.coordinates,J);else if(le==="MultiPolygon")for(V=0;V<G.coordinates.length;V++)ce(G.coordinates[V],J);return G}}(),ri=S.cF(Bt);const Ft=S.cA.VectorTileFeature.prototype.toGeoJSON;class oi{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const Z of this._feature.geometry)N.push([new S.P(Z[0],Z[1])]);return N}{const N=[];for(const Z of this._feature.geometry){const G=[];for(const J of Z)G.push(new S.P(J[0],J[1]));N.push(G)}return N}}toGeoJSON(N,Z,G){return Ft.call(this,N,Z,G)}}class Oi{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new oi(this._features[N])}}var ni,Zt,Ot,Wi={exports:{}},Et=function(){if(Ot)return Wi.exports;Ot=1;var ce=S.cI(),N=function(){if(Zt)return ni;Zt=1;var xe=S.cG(),ue=S.cH().VectorTileFeature;function ze(Ze,nt){this.options=nt||{},this.features=Ze,this.length=Ze.length}function Ne(Ze,nt){this.id=typeof Ze.id=="number"?Ze.id:void 0,this.type=Ze.type,this.rawGeometry=Ze.type===1?[Ze.geometry]:Ze.geometry,this.properties=Ze.tags,this.extent=nt||4096}return ni=ze,ze.prototype.feature=function(Ze){return new Ne(this.features[Ze],this.options.extent)},Ne.prototype.loadGeometry=function(){var Ze=this.rawGeometry;this.geometry=[];for(var nt=0;nt<Ze.length;nt++){for(var dt=Ze[nt],we=[],st=0;st<dt.length;st++)we.push(new xe(dt[st][0],dt[st][1]));this.geometry.push(we)}return this.geometry},Ne.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ze=this.geometry,nt=1/0,dt=-1/0,we=1/0,st=-1/0,St=0;St<Ze.length;St++)for(var Rt=Ze[St],Pt=0;Pt<Rt.length;Pt++){var Pe=Rt[Pt];nt=Math.min(nt,Pe.x),dt=Math.max(dt,Pe.x),we=Math.min(we,Pe.y),st=Math.max(st,Pe.y)}return[nt,we,dt,st]},Ne.prototype.toGeoJSON=ue.prototype.toGeoJSON,ni}();function Z(xe){var ue=new ce;return function(ze,Ne){for(var Ze in ze.layers)Ne.writeMessage(3,G,ze.layers[Ze])}(xe,ue),ue.finish()}function G(xe,ue){var ze;ue.writeVarintField(15,xe.version||1),ue.writeStringField(1,xe.name||""),ue.writeVarintField(5,xe.extent||4096);var Ne={keys:[],values:[],keycache:{},valuecache:{}};for(ze=0;ze<xe.length;ze++)Ne.feature=xe.feature(ze),ue.writeMessage(2,J,Ne);var Ze=Ne.keys;for(ze=0;ze<Ze.length;ze++)ue.writeStringField(3,Ze[ze]);var nt=Ne.values;for(ze=0;ze<nt.length;ze++)ue.writeMessage(4,_e,nt[ze])}function J(xe,ue){var ze=xe.feature;ze.id!==void 0&&ue.writeVarintField(1,ze.id),ue.writeMessage(2,V,xe),ue.writeVarintField(3,ze.type),ue.writeMessage(4,ie,ze)}function V(xe,ue){var ze=xe.feature,Ne=xe.keys,Ze=xe.values,nt=xe.keycache,dt=xe.valuecache;for(var we in ze.properties){var st=ze.properties[we],St=nt[we];if(st!==null){St===void 0&&(Ne.push(we),nt[we]=St=Ne.length-1),ue.writeVarint(St);var Rt=typeof st;Rt!=="string"&&Rt!=="boolean"&&Rt!=="number"&&(st=JSON.stringify(st));var Pt=Rt+":"+st,Pe=dt[Pt];Pe===void 0&&(Ze.push(st),dt[Pt]=Pe=Ze.length-1),ue.writeVarint(Pe)}}}function le(xe,ue){return(ue<<3)+(7&xe)}function ge(xe){return xe<<1^xe>>31}function ie(xe,ue){for(var ze=xe.loadGeometry(),Ne=xe.type,Ze=0,nt=0,dt=ze.length,we=0;we<dt;we++){var st=ze[we],St=1;Ne===1&&(St=st.length),ue.writeVarint(le(1,St));for(var Rt=Ne===3?st.length-1:st.length,Pt=0;Pt<Rt;Pt++){Pt===1&&Ne!==1&&ue.writeVarint(le(2,Rt-1));var Pe=st[Pt].x-Ze,Ge=st[Pt].y-nt;ue.writeVarint(ge(Pe)),ue.writeVarint(ge(Ge)),Ze+=Pe,nt+=Ge}Ne===3&&ue.writeVarint(le(7,1))}}function _e(xe,ue){var ze=typeof xe;ze==="string"?ue.writeStringField(1,xe):ze==="boolean"?ue.writeBooleanField(7,xe):ze==="number"&&(xe%1!=0?ue.writeDoubleField(3,xe):xe<0?ue.writeSVarintField(6,xe):ue.writeVarintField(5,xe))}return Wi.exports=Z,Wi.exports.fromVectorTileJs=Z,Wi.exports.fromGeojsonVt=function(xe,ue){ue=ue||{};var ze={};for(var Ne in xe)ze[Ne]=new N(xe[Ne].features,ue),ze[Ne].name=Ne,ze[Ne].version=ue.version,ze[Ne].extent=ue.extent;return Z({layers:ze})},Wi.exports.GeoJSONWrapper=N,Wi.exports}(),nr=S.cF(Et);const qn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ce=>ce},Lr=Math.fround||(ji=new Float32Array(1),ce=>(ji[0]=+ce,ji[0]));var ji;const Xi=3,xi=5,Pr=6;class Ni{constructor(N){this.options=Object.assign(Object.create(qn),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:Z,minZoom:G,maxZoom:J}=this.options;Z&&console.time("total time");const V=`prepare ${N.length} points`;Z&&console.time(V),this.points=N;const le=[];for(let ie=0;ie<N.length;ie++){const _e=N[ie];if(!_e.geometry)continue;const[xe,ue]=_e.geometry.coordinates,ze=Lr(pi(xe)),Ne=Lr(fi(ue));le.push(ze,Ne,1/0,ie,-1,1),this.options.reduce&&le.push(0)}let ge=this.trees[J+1]=this._createTree(le);Z&&console.timeEnd(V);for(let ie=J;ie>=G;ie--){const _e=+Date.now();ge=this.trees[ie]=this._createTree(this._cluster(ge,ie)),Z&&console.log("z%d: %d clusters in %dms",ie,ge.numItems,+Date.now()-_e)}return Z&&console.timeEnd("total time"),this}getClusters(N,Z){let G=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let V=N[2]===180?180:((N[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,V=180;else if(G>V){const ue=this.getClusters([G,J,180,le],Z),ze=this.getClusters([-180,J,V,le],Z);return ue.concat(ze)}const ge=this.trees[this._limitZoom(Z)],ie=ge.range(pi(G),fi(le),pi(V),fi(J)),_e=ge.data,xe=[];for(const ue of ie){const ze=this.stride*ue;xe.push(_e[ze+xi]>1?Br(_e,ze,this.clusterProps):this.points[_e[ze+Xi]])}return xe}getChildren(N){const Z=this._getOriginId(N),G=this._getOriginZoom(N),J="No cluster with the specified id.",V=this.trees[G];if(!V)throw new Error(J);const le=V.data;if(Z*this.stride>=le.length)throw new Error(J);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),ie=V.within(le[Z*this.stride],le[Z*this.stride+1],ge),_e=[];for(const xe of ie){const ue=xe*this.stride;le[ue+4]===N&&_e.push(le[ue+xi]>1?Br(le,ue,this.clusterProps):this.points[le[ue+Xi]])}if(_e.length===0)throw new Error(J);return _e}getLeaves(N,Z,G){const J=[];return this._appendLeaves(J,N,Z=Z||10,G=G||0,0),J}getTile(N,Z,G){const J=this.trees[this._limitZoom(N)],V=Math.pow(2,N),{extent:le,radius:ge}=this.options,ie=ge/le,_e=(G-ie)/V,xe=(G+1+ie)/V,ue={features:[]};return this._addTileFeatures(J.range((Z-ie)/V,_e,(Z+1+ie)/V,xe),J.data,Z,G,V,ue),Z===0&&this._addTileFeatures(J.range(1-ie/V,_e,1,xe),J.data,V,G,V,ue),Z===V-1&&this._addTileFeatures(J.range(0,_e,ie/V,xe),J.data,-1,G,V,ue),ue.features.length?ue:null}getClusterExpansionZoom(N){let Z=this._getOriginZoom(N)-1;for(;Z<=this.options.maxZoom;){const G=this.getChildren(N);if(Z++,G.length!==1)break;N=G[0].properties.cluster_id}return Z}_appendLeaves(N,Z,G,J,V){const le=this.getChildren(Z);for(const ge of le){const ie=ge.properties;if(ie&&ie.cluster?V+ie.point_count<=J?V+=ie.point_count:V=this._appendLeaves(N,ie.cluster_id,G,J,V):V<J?V++:N.push(ge),N.length===G)break}return V}_createTree(N){const Z=new S.aF(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)Z.add(N[G],N[G+1]);return Z.finish(),Z.data=N,Z}_addTileFeatures(N,Z,G,J,V,le){for(const ge of N){const ie=ge*this.stride,_e=Z[ie+xi]>1;let xe,ue,ze;if(_e)xe=Qe(Z,ie,this.clusterProps),ue=Z[ie],ze=Z[ie+1];else{const nt=this.points[Z[ie+Xi]];xe=nt.properties;const[dt,we]=nt.geometry.coordinates;ue=pi(dt),ze=fi(we)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(ue*V-G)),Math.round(this.options.extent*(ze*V-J))]],tags:xe};let Ze;Ze=_e||this.options.generateId?Z[ie+Xi]:this.points[Z[ie+Xi]].id,Ze!==void 0&&(Ne.id=Ze),le.features.push(Ne)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,Z){const{radius:G,extent:J,reduce:V,minPoints:le}=this.options,ge=G/(J*Math.pow(2,Z)),ie=N.data,_e=[],xe=this.stride;for(let ue=0;ue<ie.length;ue+=xe){if(ie[ue+2]<=Z)continue;ie[ue+2]=Z;const ze=ie[ue],Ne=ie[ue+1],Ze=N.within(ie[ue],ie[ue+1],ge),nt=ie[ue+xi];let dt=nt;for(const we of Ze){const st=we*xe;ie[st+2]>Z&&(dt+=ie[st+xi])}if(dt>nt&&dt>=le){let we,st=ze*nt,St=Ne*nt,Rt=-1;const Pt=((ue/xe|0)<<5)+(Z+1)+this.points.length;for(const Pe of Ze){const Ge=Pe*xe;if(ie[Ge+2]<=Z)continue;ie[Ge+2]=Z;const tt=ie[Ge+xi];st+=ie[Ge]*tt,St+=ie[Ge+1]*tt,ie[Ge+4]=Pt,V&&(we||(we=this._map(ie,ue,!0),Rt=this.clusterProps.length,this.clusterProps.push(we)),V(we,this._map(ie,Ge)))}ie[ue+4]=Pt,_e.push(st/dt,St/dt,1/0,Pt,-1,dt),V&&_e.push(Rt)}else{for(let we=0;we<xe;we++)_e.push(ie[ue+we]);if(dt>1)for(const we of Ze){const st=we*xe;if(!(ie[st+2]<=Z)){ie[st+2]=Z;for(let St=0;St<xe;St++)_e.push(ie[st+St])}}}}return _e}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,Z,G){if(N[Z+xi]>1){const le=this.clusterProps[N[Z+Pr]];return G?Object.assign({},le):le}const J=this.points[N[Z+Xi]].properties,V=this.options.map(J);return G&&V===J?Object.assign({},V):V}}function Br(ce,N,Z){return{type:"Feature",id:ce[N+Xi],properties:Qe(ce,N,Z),geometry:{type:"Point",coordinates:[(G=ce[N],360*(G-.5)),Cr(ce[N+1])]}};var G}function Qe(ce,N,Z){const G=ce[N+xi],J=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,V=ce[N+Pr],le=V===-1?{}:Object.assign({},Z[V]);return Object.assign(le,{cluster:!0,cluster_id:ce[N+Xi],point_count:G,point_count_abbreviated:J})}function pi(ce){return ce/360+.5}function fi(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function Cr(ce){const N=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function ki(ce,N,Z,G){let J=G;const V=N+(Z-N>>1);let le,ge=Z-N;const ie=ce[N],_e=ce[N+1],xe=ce[Z],ue=ce[Z+1];for(let ze=N+3;ze<Z;ze+=3){const Ne=vn(ce[ze],ce[ze+1],ie,_e,xe,ue);if(Ne>J)le=ze,J=Ne;else if(Ne===J){const Ze=Math.abs(ze-V);Ze<ge&&(le=ze,ge=Ze)}}J>G&&(le-N>3&&ki(ce,N,le,G),ce[le+2]=J,Z-le>3&&ki(ce,le,Z,G))}function vn(ce,N,Z,G,J,V){let le=J-Z,ge=V-G;if(le!==0||ge!==0){const ie=((ce-Z)*le+(N-G)*ge)/(le*le+ge*ge);ie>1?(Z=J,G=V):ie>0&&(Z+=le*ie,G+=ge*ie)}return le=ce-Z,ge=N-G,le*le+ge*ge}function Zi(ce,N,Z,G){const J={id:ce??null,type:N,geometry:Z,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Vt(J,Z);else if(N==="Polygon")Vt(J,Z[0]);else if(N==="MultiLineString")for(const V of Z)Vt(J,V);else if(N==="MultiPolygon")for(const V of Z)Vt(J,V[0]);return J}function Vt(ce,N){for(let Z=0;Z<N.length;Z+=3)ce.minX=Math.min(ce.minX,N[Z]),ce.minY=Math.min(ce.minY,N[Z+1]),ce.maxX=Math.max(ce.maxX,N[Z]),ce.maxY=Math.max(ce.maxY,N[Z+1])}function Ki(ce,N,Z,G){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const V=N.geometry.type,le=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let ge=[],ie=N.id;if(Z.promoteId?ie=N.properties[Z.promoteId]:Z.generateId&&(ie=G||0),V==="Point")Yi(J,ge);else if(V==="MultiPoint")for(const _e of J)Yi(_e,ge);else if(V==="LineString")bn(J,ge,le,!1);else if(V==="MultiLineString"){if(Z.lineMetrics){for(const _e of J)ge=[],bn(_e,ge,le,!1),ce.push(Zi(ie,"LineString",ge,N.properties));return}nn(J,ge,le,!1)}else if(V==="Polygon")nn(J,ge,le,!0);else{if(V!=="MultiPolygon"){if(V==="GeometryCollection"){for(const _e of N.geometry.geometries)Ki(ce,{id:ie,geometry:_e,properties:N.properties},Z,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const _e of J){const xe=[];nn(_e,xe,le,!0),ge.push(xe)}}ce.push(Zi(ie,V,ge,N.properties))}function Yi(ce,N){N.push(ha(ce[0]),ar(ce[1]),0)}function bn(ce,N,Z,G){let J,V,le=0;for(let ie=0;ie<ce.length;ie++){const _e=ha(ce[ie][0]),xe=ar(ce[ie][1]);N.push(_e,xe,0),ie>0&&(le+=G?(J*xe-_e*V)/2:Math.sqrt(Math.pow(_e-J,2)+Math.pow(xe-V,2))),J=_e,V=xe}const ge=N.length-3;N[2]=1,ki(N,0,ge,Z),N[ge+2]=1,N.size=Math.abs(le),N.start=0,N.end=N.size}function nn(ce,N,Z,G){for(let J=0;J<ce.length;J++){const V=[];bn(ce[J],V,Z,G),N.push(V)}}function ha(ce){return ce/360+.5}function ar(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function sr(ce,N,Z,G,J,V,le,ge){if(G/=N,V>=(Z/=N)&&le<G)return ce;if(le<Z||V>=G)return null;const ie=[];for(const _e of ce){const xe=_e.geometry;let ue=_e.type;const ze=J===0?_e.minX:_e.minY,Ne=J===0?_e.maxX:_e.maxY;if(ze>=Z&&Ne<G){ie.push(_e);continue}if(Ne<Z||ze>=G)continue;let Ze=[];if(ue==="Point"||ue==="MultiPoint")Vi(xe,Ze,Z,G,J);else if(ue==="LineString")Nt(xe,Ze,Z,G,J,!1,ge.lineMetrics);else if(ue==="MultiLineString")an(xe,Ze,Z,G,J,!1);else if(ue==="Polygon")an(xe,Ze,Z,G,J,!0);else if(ue==="MultiPolygon")for(const nt of xe){const dt=[];an(nt,dt,Z,G,J,!0),dt.length&&Ze.push(dt)}if(Ze.length){if(ge.lineMetrics&&ue==="LineString"){for(const nt of Ze)ie.push(Zi(_e.id,ue,nt,_e.tags));continue}ue!=="LineString"&&ue!=="MultiLineString"||(Ze.length===1?(ue="LineString",Ze=Ze[0]):ue="MultiLineString"),ue!=="Point"&&ue!=="MultiPoint"||(ue=Ze.length===3?"Point":"MultiPoint"),ie.push(Zi(_e.id,ue,Ze,_e.tags))}}return ie.length?ie:null}function Vi(ce,N,Z,G,J){for(let V=0;V<ce.length;V+=3){const le=ce[V+J];le>=Z&&le<=G&&fr(N,ce[V],ce[V+1],ce[V+2])}}function Nt(ce,N,Z,G,J,V,le){let ge=Fr(ce);const ie=J===0?wn:Tn;let _e,xe,ue=ce.start;for(let dt=0;dt<ce.length-3;dt+=3){const we=ce[dt],st=ce[dt+1],St=ce[dt+2],Rt=ce[dt+3],Pt=ce[dt+4],Pe=J===0?we:st,Ge=J===0?Rt:Pt;let tt=!1;le&&(_e=Math.sqrt(Math.pow(we-Rt,2)+Math.pow(st-Pt,2))),Pe<Z?Ge>Z&&(xe=ie(ge,we,st,Rt,Pt,Z),le&&(ge.start=ue+_e*xe)):Pe>G?Ge<G&&(xe=ie(ge,we,st,Rt,Pt,G),le&&(ge.start=ue+_e*xe)):fr(ge,we,st,St),Ge<Z&&Pe>=Z&&(xe=ie(ge,we,st,Rt,Pt,Z),tt=!0),Ge>G&&Pe<=G&&(xe=ie(ge,we,st,Rt,Pt,G),tt=!0),!V&&tt&&(le&&(ge.end=ue+_e*xe),N.push(ge),ge=Fr(ce)),le&&(ue+=_e)}let ze=ce.length-3;const Ne=ce[ze],Ze=ce[ze+1],nt=J===0?Ne:Ze;nt>=Z&&nt<=G&&fr(ge,Ne,Ze,ce[ze+2]),ze=ge.length-3,V&&ze>=3&&(ge[ze]!==ge[0]||ge[ze+1]!==ge[1])&&fr(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function Fr(ce){const N=[];return N.size=ce.size,N.start=ce.start,N.end=ce.end,N}function an(ce,N,Z,G,J,V){for(const le of ce)Nt(le,N,Z,G,J,V,!1)}function fr(ce,N,Z,G){ce.push(N,Z,G)}function wn(ce,N,Z,G,J,V){const le=(V-N)/(G-N);return fr(ce,V,Z+(J-Z)*le,1),le}function Tn(ce,N,Z,G,J,V){const le=(V-Z)/(J-Z);return fr(ce,N+(G-N)*le,V,1),le}function Ee(ce,N){const Z=[];for(let G=0;G<ce.length;G++){const J=ce[G],V=J.type;let le;if(V==="Point"||V==="MultiPoint"||V==="LineString")le=Je(J.geometry,N);else if(V==="MultiLineString"||V==="Polygon"){le=[];for(const ge of J.geometry)le.push(Je(ge,N))}else if(V==="MultiPolygon"){le=[];for(const ge of J.geometry){const ie=[];for(const _e of ge)ie.push(Je(_e,N));le.push(ie)}}Z.push(Zi(J.id,V,le,J.tags))}return Z}function Je(ce,N){const Z=[];Z.size=ce.size,ce.start!==void 0&&(Z.start=ce.start,Z.end=ce.end);for(let G=0;G<ce.length;G+=3)Z.push(ce[G]+N,ce[G+1],ce[G+2]);return Z}function Ue(ce,N){if(ce.transformed)return ce;const Z=1<<ce.z,G=ce.x,J=ce.y;for(const V of ce.features){const le=V.geometry,ge=V.type;if(V.geometry=[],ge===1)for(let ie=0;ie<le.length;ie+=2)V.geometry.push(ft(le[ie],le[ie+1],N,Z,G,J));else for(let ie=0;ie<le.length;ie++){const _e=[];for(let xe=0;xe<le[ie].length;xe+=2)_e.push(ft(le[ie][xe],le[ie][xe+1],N,Z,G,J));V.geometry.push(_e)}}return ce.transformed=!0,ce}function ft(ce,N,Z,G,J,V){return[Math.round(Z*(ce*G-J)),Math.round(Z*(N*G-V))]}function Gt(ce,N,Z,G,J){const V=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:ce.length,source:null,x:Z,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ce)or(le,ge,V,J);return le}function or(ce,N,Z,G){const J=N.geometry,V=N.type,le=[];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),V==="Point"||V==="MultiPoint")for(let ge=0;ge<J.length;ge+=3)le.push(J[ge],J[ge+1]),ce.numPoints++,ce.numSimplified++;else if(V==="LineString")mi(le,J,ce,Z,!1,!1);else if(V==="MultiLineString"||V==="Polygon")for(let ge=0;ge<J.length;ge++)mi(le,J[ge],ce,Z,V==="Polygon",ge===0);else if(V==="MultiPolygon")for(let ge=0;ge<J.length;ge++){const ie=J[ge];for(let _e=0;_e<ie.length;_e++)mi(le,ie[_e],ce,Z,!0,_e===0)}if(le.length){let ge=N.tags||null;if(V==="LineString"&&G.lineMetrics){ge={};for(const _e in N.tags)ge[_e]=N.tags[_e];ge.mapbox_clip_start=J.start/J.size,ge.mapbox_clip_end=J.end/J.size}const ie={geometry:le,type:V==="Polygon"||V==="MultiPolygon"?3:V==="LineString"||V==="MultiLineString"?2:1,tags:ge};N.id!==null&&(ie.id=N.id),ce.features.push(ie)}}function mi(ce,N,Z,G,J,V){const le=G*G;if(G>0&&N.size<(J?le:G))return void(Z.numPoints+=N.length/3);const ge=[];for(let ie=0;ie<N.length;ie+=3)(G===0||N[ie+2]>le)&&(Z.numSimplified++,ge.push(N[ie],N[ie+1])),Z.numPoints++;J&&function(ie,_e){let xe=0;for(let ue=0,ze=ie.length,Ne=ze-2;ue<ze;Ne=ue,ue+=2)xe+=(ie[ue]-ie[Ne])*(ie[ue+1]+ie[Ne+1]);if(xe>0===_e)for(let ue=0,ze=ie.length;ue<ze/2;ue+=2){const Ne=ie[ue],Ze=ie[ue+1];ie[ue]=ie[ze-2-ue],ie[ue+1]=ie[ze-1-ue],ie[ze-2-ue]=Ne,ie[ze-1-ue]=Ze}}(ge,V),ce.push(ge)}const mr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class gr{constructor(N,Z){const G=(Z=this.options=function(V,le){for(const ge in le)V[ge]=le[ge];return V}(Object.create(mr),Z)).debug;if(G&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(V,le){const ge=[];if(V.type==="FeatureCollection")for(let ie=0;ie<V.features.length;ie++)Ki(ge,V.features[ie],le,ie);else Ki(ge,V.type==="Feature"?V:{geometry:V},le);return ge}(N,Z);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(V,le){const ge=le.buffer/le.extent;let ie=V;const _e=sr(V,1,-1-ge,ge,0,-1,2,le),xe=sr(V,1,1-ge,2+ge,0,-1,2,le);return(_e||xe)&&(ie=sr(V,1,-ge,1+ge,0,-1,2,le)||[],_e&&(ie=Ee(_e,1).concat(ie)),xe&&(ie=ie.concat(Ee(xe,-1)))),ie}(J,Z),J.length&&this.splitTile(J,0,0,0),G&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(N,Z,G,J,V,le,ge){const ie=[N,Z,G,J],_e=this.options,xe=_e.debug;for(;ie.length;){J=ie.pop(),G=ie.pop(),Z=ie.pop(),N=ie.pop();const ue=1<<Z,ze=da(Z,G,J);let Ne=this.tiles[ze];if(!Ne&&(xe>1&&console.time("creation"),Ne=this.tiles[ze]=Gt(N,Z,G,J,_e),this.tileCoords.push({z:Z,x:G,y:J}),xe)){xe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,G,J,Ne.numFeatures,Ne.numPoints,Ne.numSimplified),console.timeEnd("creation"));const tt=`z${Z}`;this.stats[tt]=(this.stats[tt]||0)+1,this.total++}if(Ne.source=N,V==null){if(Z===_e.indexMaxZoom||Ne.numPoints<=_e.indexMaxPoints)continue}else{if(Z===_e.maxZoom||Z===V)continue;if(V!=null){const tt=V-Z;if(G!==le>>tt||J!==ge>>tt)continue}}if(Ne.source=null,N.length===0)continue;xe>1&&console.time("clipping");const Ze=.5*_e.buffer/_e.extent,nt=.5-Ze,dt=.5+Ze,we=1+Ze;let st=null,St=null,Rt=null,Pt=null,Pe=sr(N,ue,G-Ze,G+dt,0,Ne.minX,Ne.maxX,_e),Ge=sr(N,ue,G+nt,G+we,0,Ne.minX,Ne.maxX,_e);N=null,Pe&&(st=sr(Pe,ue,J-Ze,J+dt,1,Ne.minY,Ne.maxY,_e),St=sr(Pe,ue,J+nt,J+we,1,Ne.minY,Ne.maxY,_e),Pe=null),Ge&&(Rt=sr(Ge,ue,J-Ze,J+dt,1,Ne.minY,Ne.maxY,_e),Pt=sr(Ge,ue,J+nt,J+we,1,Ne.minY,Ne.maxY,_e),Ge=null),xe>1&&console.timeEnd("clipping"),ie.push(st||[],Z+1,2*G,2*J),ie.push(St||[],Z+1,2*G,2*J+1),ie.push(Rt||[],Z+1,2*G+1,2*J),ie.push(Pt||[],Z+1,2*G+1,2*J+1)}}getTile(N,Z,G){N=+N,Z=+Z,G=+G;const J=this.options,{extent:V,debug:le}=J;if(N<0||N>24)return null;const ge=1<<N,ie=da(N,Z=Z+ge&ge-1,G);if(this.tiles[ie])return Ue(this.tiles[ie],V);le>1&&console.log("drilling down to z%d-%d-%d",N,Z,G);let _e,xe=N,ue=Z,ze=G;for(;!_e&&xe>0;)xe--,ue>>=1,ze>>=1,_e=this.tiles[da(xe,ue,ze)];return _e&&_e.source?(le>1&&(console.log("found parent tile z%d-%d-%d",xe,ue,ze),console.time("drilling down")),this.splitTile(_e.source,xe,ue,ze,N,Z,G),le>1&&console.timeEnd("drilling down"),this.tiles[ie]?Ue(this.tiles[ie],V):null):null}}function da(ce,N,Z){return 32*((1<<ce)*Z+N)+ce}function Mn(ce,N){return N?ce.properties[N]:ce.id}function Hn(ce,N){if(ce==null)return!0;if(ce.type==="Feature")return Mn(ce,N)!=null;if(ce.type==="FeatureCollection"){const Z=new Set;for(const G of ce.features){const J=Mn(G,N);if(J==null||Z.has(J))return!1;Z.add(J)}return!0}return!1}function sn(ce,N){const Z=new Map;if(ce!=null)if(ce.type==="Feature")Z.set(Mn(ce,N),ce);else for(const G of ce.features)Z.set(Mn(G,N),G);return Z}class _r extends Le{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!J)return null;const V=new Oi(J.features);let le=nr(V);return le.byteOffset===0&&le.byteLength===le.buffer.byteLength||(le=new Uint8Array(le)),{vectorTile:V,rawData:le.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new Ni(function({superclusterOptions:le,clusterProperties:ge}){if(!ge||!le)return le;const ie={},_e={},xe={accumulated:null,zoom:0},ue={properties:null},ze=Object.keys(ge);for(const Ne of ze){const[Ze,nt]=ge[Ne],dt=S.cJ(nt),we=S.cJ(typeof Ze=="string"?[Ze,["accumulated"],["get",Ne]]:Ze);ie[Ne]=dt.value,_e[Ne]=we.value}return le.map=Ne=>{ue.properties=Ne;const Ze={};for(const nt of ze)Ze[nt]=ie[nt].evaluate(xe,ue);return Ze},le.reduce=(Ne,Ze)=>{ue.properties=Ze;for(const nt of ze)xe.accumulated=Ne[nt],Ne[nt]=_e[nt].evaluate(xe,ue)},le}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new gr(J,N.geojsonVtOptions)),this.loaded={};const V={};if(G){const le=G.finish();le&&(V.resourceTiming={},V.resourceTiming[N.source]=JSON.parse(JSON.stringify(le)))}return V}catch(V){if(delete this._pendingRequest,S.cn(V))return{abandoned:!0};throw V}var J})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const Z=this.loaded;return Z&&Z[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,Z);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(ri(G,!0),N.filter){const J=S.cJ(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(le=>`${le.key}: ${le.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(le=>J.value.evaluate({zoom:0},le))}}return G})}loadGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const J=yield S.j(N.request,Z);return this._dataUpdateable=Hn(J.data,G)?sn(J.data,G):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=Hn(J,G)?sn(J,G):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,V,le){var ge,ie,_e,xe;if(V.removeAll&&J.clear(),V.remove)for(const ue of V.remove)J.delete(ue);if(V.add)for(const ue of V.add){const ze=Mn(ue,le);ze!=null&&J.set(ze,ue)}if(V.update)for(const ue of V.update){let ze=J.get(ue.id);if(ze==null)continue;const Ne=!ue.removeAllProperties&&(((ge=ue.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((ie=ue.addOrUpdateProperties)===null||ie===void 0?void 0:ie.length)>0);if((ue.newGeometry||ue.removeAllProperties||Ne)&&(ze=Object.assign({},ze),J.set(ue.id,ze),Ne&&(ze.properties=Object.assign({},ze.properties))),ue.newGeometry&&(ze.geometry=ue.newGeometry),ue.removeAllProperties)ze.properties={};else if(((_e=ue.removeProperties)===null||_e===void 0?void 0:_e.length)>0)for(const Ze of ue.removeProperties)Object.prototype.hasOwnProperty.call(ze.properties,Ze)&&delete ze.properties[Ze];if(((xe=ue.addOrUpdateProperties)===null||xe===void 0?void 0:xe.length)>0)for(const{key:Ze,value:nt}of ue.addOrUpdateProperties)ze.properties[Ze]=nt}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class Sn{constructor(N){this.self=N,this.actor=new S.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,G)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=G},this.self.addProtocol=S.cp,this.self.removeProtocol=S.cq,this.self.registerRTLTextPlugin=Z=>{S.cK.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,G)=>this._getDEMWorkerSource(Z,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(Z,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(Z,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][G.type]||!this.workerSources[Z][G.type][G.source])return;const J=this.workerSources[Z][G.type][G.source];delete this.workerSources[Z][G.type][G.source],J.removeSource!==void 0&&J.removeSource(G)})),this.actor.registerMessageHandler("RM",Z=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(Z,G)=>this._syncRTLPluginState(Z,G)),this.actor.registerMessageHandler("IS",(Z,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(Z,G)=>this._setImages(Z,G)),this.actor.registerMessageHandler("UL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(G)}))}_setImages(N,Z){return S._(this,void 0,void 0,function*(){this.availableImages[N]=Z;for(const G in this.workerSources[N]){const J=this.workerSources[N][G];for(const V in J)J[V].availableImages=Z}})}_syncRTLPluginState(N,Z){return S._(this,void 0,void 0,function*(){return yield S.cK.syncState(Z,this.self.importScripts)})}_getAvailableImages(N){let Z=this.availableImages[N];return Z||(Z=[]),Z}_getLayerIndex(N){let Z=this.layerIndexes[N];return Z||(Z=this.layerIndexes[N]=new o),Z}_getWorkerSource(N,Z,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][Z]||(this.workerSources[N][Z]={}),!this.workerSources[N][Z][G]){const J={sendAsync:(V,le)=>(V.targetMapId=N,this.actor.sendAsync(V,le))};switch(Z){case"vector":this.workerSources[N][Z][G]=new Le(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][Z][G]=new _r(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][Z][G]=new this.externalWorkerSourceTypes[Z](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][Z][G]}_getDEMWorkerSource(N,Z){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][Z]||(this.demWorkerSources[N][Z]=new Ie),this.demWorkerSources[N][Z]}}return S.i(self)&&(self.worker=new Sn(self)),Sn}),A("index",["exports","./shared"],function(S,o){var he="5.4.0";function pe(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let Ce,Le;const Ie={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const s=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(s),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(Ce||(Ce=document.createElement("a")),Ce.href=u,Ce.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Le==null&&(Le=matchMedia("(prefers-reduced-motion: reduce)")),Le.matches)}};class oe{static testProp(e){if(!oe.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in oe.docStyle)return e[i];return e[0]}static create(e,i,s){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),s&&s.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){oe.docStyle&&oe.selectProp&&(oe.userSelect=oe.docStyle[oe.selectProp],oe.docStyle[oe.selectProp]="none")}static enableDrag(){oe.docStyle&&oe.selectProp&&(oe.docStyle[oe.selectProp]=oe.userSelect)}static setTransform(e,i){e.style[oe.transformProp]=i}static addEventListener(e,i,s,l={}){e.addEventListener(i,s,"passive"in l?l:l.capture)}static removeEventListener(e,i,s,l={}){e.removeEventListener(i,s,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",oe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",oe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",oe.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,s){const l=i.boundingClientRect;return new o.P((s.clientX-l.left)/i.x-e.clientLeft,(s.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const s=oe.getScale(e);return oe.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=oe.getScale(e);for(let h=0;h<i.length;h++)s.push(oe.getPoint(e,l,i[h]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),s=i.querySelectorAll("script");for(const l of s)l.remove();return oe.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)oe.removeAttributes(s),oe.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)oe.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}oe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,oe.selectProp=oe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),oe.transformProp=oe.testProp(["transform","WebkitTransform"]);const Ve={supported:!1,testSupport:function(u){!Ft&&ri&&(oi?Oi(u):Bt=u)}};let Bt,ri,Ft=!1,oi=!1;function Oi(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,ri),u.isContextLost())return;Ve.supported=!0}catch{}u.deleteTexture(e),Ft=!0}var ni;typeof document<"u"&&(ri=document.createElement("img"),ri.onload=()=>{Bt&&Oi(Bt),Bt=null,oi=!0},ri.onerror=()=>{Ft=!0,Bt=null},ri.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=x=>{const T=s++;return l[T]=x,T},u.removeThrottleControl=x=>{delete l[x],f()},u.getImage=(x,T,P=!0)=>new Promise((E,k)=>{Ve.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),o.e(x,{type:"image"}),e.push({abortController:T,requestParameters:x,supportImageRefresh:P,state:"queued",onError:F=>{k(F)},onSuccess:F=>{E(F)}}),f()});const h=x=>o._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:T,supportImageRefresh:P,onError:E,onSuccess:k,abortController:F}=x,O=P===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const H=O?_(T,F):o.m(T,F);try{const W=yield H;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?k(W):W.data&&k({data:yield(q=W.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,E(W)}finally{i--,f()}var q}),f=()=>{const x=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<x&&e.length>0;T++){const P=e.shift();P.abortController.signal.aborted?T--:h(P)}},_=(x,T)=>new Promise((P,E)=>{const k=new Image,F=x.url,O=x.credentials;O&&O==="include"?k.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(F))&&(k.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{k.src="",E(o.c())}),k.fetchPriority="high",k.onload=()=>{k.onerror=k.onload=null,P({data:k})},k.onerror=()=>{k.onerror=k.onload=null,T.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},k.src=F})}(ni||(ni={})),ni.resetRequestQueue();class Zt{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Ot(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:s,url:l}of u){const h=`${s}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:l}))}}return e}function Wi(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 Et{constructor(e,i,s,l){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,l)}update(e,i,s){const{width:l,height:h}=e,f=!(this.size&&this.size[0]===l&&this.size[1]===h||s),{context:_}=this,{gl: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=[l,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,e):x.texImage2D(x.TEXTURE_2D,0,this.format,l,h,0,this.format,x.UNSIGNED_BYTE,e.data);else{const{x:T,y:P}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texSubImage2D(x.TEXTURE_2D,0,T,P,x.RGBA,x.UNSIGNED_BYTE,e):x.texSubImage2D(x.TEXTURE_2D,0,T,P,l,h,x.RGBA,x.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&x.generateMipmap(x.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function nr(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class qn extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:s}of this.requestors)s(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const s=i.spriteData;i.data=new o.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let s=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const l of e){if(l[0]<s||l[1]<l[0]||i<l[1])return!1;s=l[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,l=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const l=this.getImage(e);if(s&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,s)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let l=this.getImage(s);l||(this.fire(new o.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?i[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new o.I(l,s);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Et(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,x=f.y+1,T=this.getImage(h).data,P=T.width,E=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:x},{width:P,height:E}),o.R.copy(T,l,{x:0,y:E-1},{x:_,y:x-1},{width:P,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:x+E},{width:P,height:1}),o.R.copy(T,l,{x:P-1,y:0},{x:_-1,y:x},{width:1,height:E}),o.R.copy(T,l,{x:0,y:0},{x:_+P,y:x},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const s=this.getImage(i);s||o.w(`Image with ID: "${i}" was not found`),nr(s)&&this.updateImage(i,s)}}}const Lr=1e20;function ji(u,e,i,s,l,h,f,_,x){for(let T=e;T<e+s;T++)Xi(u,i*h+T,h,l,f,_,x);for(let T=i;T<i+l;T++)Xi(u,T*h+e,1,s,f,_,x)}function Xi(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Lr,l[0]=u[e];for(let _=1,x=0,T=0;_<s;_++){l[_]=u[e+_*i];const P=_*_;do{const E=h[x];T=(l[_]-l[E]+P-E*E)/(_-E)/2}while(T<=f[x]&&--x>-1);x++,h[x]=_,f[x]=T,f[x+1]=Lr}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const T=h[x],P=_-T;u[e+_*i]=l[T]+P*P}}class xi{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=xi.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new xi.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}xi.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const x={};for(const T of o.o(_.data))x[T.id]=T;return x})},xi.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,x=this._createCanvas(_),T=this.ctx=x.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,P=x+2*this.buffer,E=Math.max(T*P,0),k=new Uint8ClampedArray(E),F={data:k,width:T,height:P,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return F;const{ctx:O,buffer:H,gridInner:q,gridOuter:W}=this;O.clearRect(H,H,_,x),O.fillText(u,H,H+f);const K=O.getImageData(H,H,_,x);W.fill(Lr,0,E),q.fill(0,0,E);for(let ee=0;ee<x;ee++)for(let te=0;te<_;te++){const re=K.data[4*(ee*_+te)+3]/255;if(re===0)continue;const se=(ee+H)*T+te+H;if(re===1)W[se]=0,q[se]=Lr;else{const ne=.5-re;W[se]=ne>0?ne*ne:0,q[se]=ne<0?ne*ne:0}}ji(W,0,0,T,P,T,this.f,this.v,this.z),ji(q,H,H,_,x,T,this.f,this.v,this.z);for(let ee=0;ee<E;ee++){const te=Math.sqrt(W[ee])-Math.sqrt(q[ee]);k[ee]=Math.round(255-255*(te/this.radius+this.cutoff))}return F}};class Pr{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.B.number(e.x,i.x,s),y:o.B.number(e.y,i.y,s),z:o.B.number(e.z,i.z,s)}}}let Ni;class Br extends o.E{constructor(e){super(),Ni=Ni||new o.r({anchor:new o.D(o.v.light.anchor),position:new Pr,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(Ni),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.t,e,i))for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s){return(!s||s.validate!==!1)&&o.x(this,e.call(o.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Qe=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":new o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class pi extends o.E{constructor(e){super(),this._transitionable=new o.T(Qe),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0))}setSky(e,i={}){if(!this._validate(o.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s={}){return(s==null?void 0:s.validate)!==!1&&o.x(this,e.call(o.y,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class fi{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let T=1;T<e.length;T++){_=!_;const P=e[T];h=x*s,x+=P,f=x*s,l.push({left:h,right:f,isDash:_,zeroLength:P===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,x=e[_];for(let T=0;T<this.width;T++){T/x.right>1&&(x=e[++_]);const P=Math.abs(T-x.left),E=Math.abs(T-x.right),k=Math.min(P,E);let F;const O=h/s*(l+1);if(x.isDash){const H=l-Math.abs(O);F=Math.sqrt(k*k+H*H)}else F=l-Math.sqrt(k*k+O*O);this.data[f+T]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],T=e[_+1];x.zeroLength?e.splice(_,1):T&&T.isDash===x.isDash&&(T.left=x.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const x=Math.abs(_-f.left),T=Math.abs(_-f.right),P=Math.min(x,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?P:-P)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,x=this.getDashRanges(e,this.width,_);i?this.addRoundDash(x,_,s):this.addRegularDash(x)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const Cr="maplibre_preloaded_worker_pool";class ki{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<ki.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Cr]}numActive(){return Object.keys(this.active).length}}const vn=Math.floor(Ie.hardwareConcurrency/2);let Zi,Vt;function Ki(){return Zi||(Zi=new ki),Zi}ki.workerCount=o.G(globalThis)?Math.max(Math.min(vn,3),1):1;class Yi{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let l=0;l<s.length;l++){const h=new o.H(s[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:e,data:i}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const s of this.actors)s.registerMessageHandler(e,i)}}function bn(){return Vt||(Vt=new Yi(Ki(),o.J),Vt.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Vt}function nn(u,e){const i=o.K();return o.L(i,i,[1,1,0]),o.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ha(u,e,i,s,l,h,f){var _;const x=function(k,F,O){if(k)for(const H of k){const q=F[H];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const H in F){const q=F[H];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),P=u.tilesIn(s,T,x);P.sort(ar);const E=[];for(const k of P)E.push({wrappedTileID:k.tileID.wrapped().key,queryResults:k.tile.queryRenderedFeatures(e,i,u._state,k.queryGeometry,k.cameraQueryGeometry,k.scale,l,h,T,nn(u.transform,k.tileID),f?(F,O)=>f(k.tileID,F,O):void 0)});return function(k,F){for(const O in k)for(const H of k[O])sr(H,F);return k}(function(k){const F={},O={};for(const H of k){const q=H.queryResults,W=H.wrappedTileID,K=O[W]=O[W]||{};for(const ee in q){const te=q[ee],re=K[ee]=K[ee]||{},se=F[ee]=F[ee]||[];for(const ne of te)re[ne.featureIndex]||(re[ne.featureIndex]=!0,se.push(ne))}}return F}(E),u)}function ar(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 sr(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 Vi(u,e,i){return o._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield Ie.frameAsync(i),!s)return null;const l=o.O(o.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(l.vectorLayerIds=s.vector_layers.map(h=>h.id)),l})}class Nt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.Q)l=e,h=e;else{if(!(e instanceof Nt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Nt.convert(e)):this.extend(o.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.Q.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new o.Q(l.lng,l.lat),this._ne=new o.Q(h.lng,h.lat)),this}getCenter(){return new o.Q((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o.Q(this.getWest(),this.getNorth())}getSouthEast(){return new o.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=o.Q.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof Nt?e:e&&new Nt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Nt(new o.Q(e.lng-l,e.lat-s),new o.Q(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.Q(this._sw.lng,this._sw.lat),i=new o.Q(this._ne.lng,this._ne.lat);return new Nt(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class Fr{constructor(e,i,s){this.bounds=Nt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(o.U(this.bounds.getWest())*i),l=Math.floor(o.S(this.bounds.getNorth())*i),h=Math.ceil(o.U(this.bounds.getEast())*i),f=Math.ceil(o.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class an extends o.E{constructor(e,i,s,l){if(super(),this.id=e,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.e(this,o.O(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Vi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new Fr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,f)=>{e.reloadPromise={resolve:h,reject:f}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class fr extends o.E{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.O(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Vi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new Fr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const s=yield ni.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,h=l.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new Et(l,f,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class wn extends fr{constructor(e,i,s,l){super(e,i,s,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield ni.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&l.cacheControl&&l.expires&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const f=o.b(h)&&o.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.W()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.X(e,-1,-1,i,s))}catch{}}return Ie.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,x={};return x[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Tn extends o.E{constructor(e,i,s,l){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.Z/this.tileSize)}load(){return o._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new Nt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":s=this.getCoordinatesFromGeometry(i.geometry);break;default:s=this.getCoordinatesFromGeometry(i)}if(s.length==0)return e;for(let l=0;l<s.length-1;l+=2)e.extend([s[l],s[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(Ie.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;s.resourceTiming&&s.resourceTiming[this.id]&&(l=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Ee extends o.E{constructor(e,i,s,l){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield ni.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(o.$.fromLngLat);var s;return this.tileID=function(l){let h=1/0,f=1/0,_=-1/0,x=-1/0;for(const k of l)h=Math.min(h,k.x),f=Math.min(f,k.y),_=Math.max(_,k.x),x=Math.max(x,k.y);const T=Math.max(_-h,x-f),P=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),E=Math.pow(2,P);return new o.a1(P,Math.floor((h+_)/2*E),Math.floor((f+x)/2*E))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new Et(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,l=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=o.a0;_++){const x=Math.pow(2,_),T=Math.floor(i*x),P=Math.floor(s*x),E=Math.floor(l*x),k=Math.floor(h*x);f[_]={minTileX:T,minTileY:P,maxTileX:E,maxTileY:k}}return f}}class Je extends Ee{constructor(e,i,s,l){super(e,i,s,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new Et(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ue extends Ee{constructor(e,i,s,l){super(e,i,s,l),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(f=>typeof f!="number"))||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,s=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Et(i,this.canvas,s.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,l=!0)}l&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ft={},Gt=u=>{switch(u){case"geojson":return Tn;case"image":return Ee;case"raster":return fr;case"raster-dem":return wn;case"vector":return an;case"video":return Je;case"canvas":return Ue}return ft[u]},or="RTLPluginLoaded";class mi extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=bn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ie.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(or))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let mr=null;function gr(){return mr||(mr=new mi),mr}class da{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const x=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>x.filter(P=>P.id===T)[0]));for(const T of x)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6&&h.hasRTLText){this.hasRTLText=!0,gr().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Et(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Et(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,x,T,P,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:P,transform:x,params:_,queryPadding:this.queryPadding*T,getElevation:E},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a7(i&&i.filter),{z:x,x:T,y:P}=this.tileID.canonical,E={z:x,x:T,y:P};for(let k=0;k<f.length;k++){const F=f.feature(k);if(_.needGeometry){const q=o.a8(F,!0);if(!_.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.C(this.tileID.overscaledZ),F))continue;const O=s.getId(F,h),H=new o.a9(F,x,T,P,O);H.tile=E,e.push(H)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const s=o.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],x=e[f];if(!_||!x||Object.keys(x).length===0)continue;h.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ie.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ie.now()+e}setDependencies(e,i){const s={};for(const l of i)s[l]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const l=this.dependencies[s];if(l){for(const h of i)if(l[h])return!0}}return!1}}class Mn{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,s){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[l].push(h),this.order.push(l),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const s=e.wrapped().key,l=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][l];return this.data[s].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const s in this.data)for(const l of this.data[s])e(l.value)||i.push(l);for(const s of i)this.remove(s.value.tileID,s)}}class Hn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const sn=89.25;function _r(u,e){const i=o.ae(e.lat,-85.051129,o.af);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function Sn(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function ce(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ab(90-u.pitch)),Math.tan(o.ab(sn-u.pitch)))}function N(u,e){const i=u.canonical,s=e/o.ac(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.ad(new Float64Array(16));return o.L(h,h,[l*s,i.y*s,0]),o.M(h,h,[s/o.Z,s/o.Z,1]),h}function Z(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.ag(1,u.lat),_=f*Math.cos(o.ab(i)),x=Math.sqrt(f*f-_*_),T=x*Math.sin(o.ab(-s)),P=x*Math.cos(o.ab(-s));return new o.$(h.x+T,h.y+P,h.z+_)}function G(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const l=e.intersectsPlane(i);return s===0||l===0?0:s===2&&l===2?2:1}function J(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function V(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.ah(Math.cos(o.ab(sn-f))/Math.cos(o.ab(sn)))-1),x=Math.acos(l/h),T=2*J(_-1,0,o.ab(f/2)),P=Math.min(o.ab(sn),x+o.ab(f/2)),E=J(_-1,Math.min(P,x-o.ab(f/2)),P),k=Math.atan(s/l),F=Math.hypot(s,l);let O=i;return O+=o.ah(h/F/Math.max(.5,Math.cos(o.ab(f/2)))),O+=_*o.ah(Math.cos(k))/2,O-=o.ah(Math.max(1,E/T/e))/2,O}}const le=V(9.314,3);function ge(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ah(u.tileSize/e.tileSize));return Math.max(0,i)}function ie(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.$.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),x=ge(u,e),T=e.minzoom||0,P=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,E=Math.min(Math.max(0,x),P),k=Math.pow(2,E),F=[k*l.x,k*l.y,0],O=[k*h.x,k*h.y,0],H=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),W=Math.hypot(H,q),K=re=>({zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),ee=[],te=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let re=1;re<=3;re++)ee.push(K(-re)),ee.push(K(re));for(ee.push(K(0));ee.length>0;){const re=ee.pop(),se=re.x,ne=re.y;let de=re.fullyVisible;const me={x:se,y:ne,z:re.zoom},Te=f.getTileAABB(me,re.wrap,u.elevation,e);if(!de){const Be=G(i,Te,s);if(Be===0)continue;de=Be===2}const Se=f.distanceToTile2d(l.x,l.y,me,Te);let be=x;_&&(be=(e.calculateTileZoom||le)(u.zoom+o.ah(u.tileSize/e.tileSize),Se,q,W,u.fov)),be=(e.roundZoom?Math.round:Math.floor)(be),be=Math.max(0,be);const je=Math.min(be,P);if(re.wrap=f.getWrap(h,me,re.wrap),re.zoom>=je){if(re.zoom<T)continue;const Be=E-re.zoom,ke=F[0]-.5-(se<<Be),We=F[1]-.5-(ne<<Be),mt=e.reparseOverscaled?Math.max(re.zoom,be):re.zoom;te.push({tileID:new o.Y(re.zoom===P?mt:re.zoom,re.wrap,re.zoom,se,ne),distanceSq:o.ai([O[0]-.5-se,O[1]-.5-ne]),tileDistanceToCamera:Math.sqrt(ke*ke+We*We)})}else for(let Be=0;Be<4;Be++)ee.push({zoom:re.zoom+1,x:(se<<1)+Be%2,y:(ne<<1)+(Be>>1),wrap:re.wrap,fullyVisible:de})}return te.sort((re,se)=>re.distanceSq-se.distanceSq).map(re=>re.tileID)}class _e extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const x=new(Gt(h.type))(l,h,f,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new Mn(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Hn,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,s){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new o.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const s=this._tiles[i];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(xe).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),x=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||x.y-_.y||x.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(xe).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=i),yield this._loadTile(s,e,i))})}_tileLoaded(e,i,s){e.timeAdded=Ie.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,x=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+x)===1?f+=x:Math.abs(f-x)===1&&(f-=x)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},x={},T=Object.keys(e),P=Ie.now();for(const E of T){const k=e[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=P)continue;const O=this.findLoadedParent(k,i),H=this.findLoadedSibling(k),q=O||H||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),x[E]=k}this._retainLoadedChildren(x,l,s,e);for(const E in _)e[E]||(this._coveredTiles[E]=!0,e[E]=_[E]);if(f){const E={},k={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:k[F.key]=F;for(const F in k){const O=k[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(E[O[0].key]=e[O[0].key]=O[0],E[O[1].key]=e[O[1].key]=O[1],E[O[2].key]=e[O[2].key]=O[2],E[O[3].key]=e[O[3].key]=O[3],delete k[F])}for(const F in k){const O=k[F],H=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),W=H||q||null;if(W){E[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in E)E[K].isChildOf(W.tileID)&&delete E[K]}}for(const F in this._tiles)E[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.Y(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(s=ie(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter(P=>this._source.hasTile(P)))):s=[];const l=ge(e,this._source),h=Math.max(l-_e.maxOverzooming,this._source.minzoom),f=Math.max(l+_e.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const E of s)if(E.canonical.z>this._source.minzoom){const k=E.scaledTo(E.canonical.z-1);P[k.key]=k;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));P[F.key]=F}s=s.concat(Object.values(P))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,l);ue(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,l,s,i);for(const P in x)this._tiles[P].clearFadeHold();const T=o.aj(this._tiles,x);for(const P of T){const E=this._tiles[P];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const l={},h={},f=Math.max(i-_e.maxOverzooming,this._source.minzoom),_=Math.max(i+_e.maxUnderzooming,this._source.minzoom),x={};for(const T of e){const P=this._addTile(T);l[T.key]=T,P.hasData()||i<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,i,_,l);for(const T of e){let P=this._tiles[T.key];if(P.hasData())continue;if(i+1>this._source.maxzoom){const k=T.children(this._source.maxzoom)[0],F=this.getTile(k);if(F&&F.hasData()){l[k.key]=k;continue}}else{const k=T.children(this._source.maxzoom);if(l[k[0].key]&&l[k[1].key]&&l[k[2].key]&&l[k[3].key])continue}let E=P.wasRequested();for(let k=T.overscaledZ-1;k>=f;--k){const F=T.scaledTo(k);if(h[F.key])break;if(h[F.key]=!0,P=this.getTile(F),!P&&E&&(P=this._addTile(F)),P){const O=P.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||E)&&(l[F.key]=F),E=P.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new da(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),x=f.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),T=this.getIds();let P=1/0,E=1/0,k=-1/0,F=-1/0;for(const O of x)P=Math.min(P,O.x),E=Math.min(E,O.y),k=Math.max(k,O.x),F=Math.max(F,O.y);for(let O=0;O<T.length;O++){const H=this._tiles[T[O]];if(H.holdingForFade())continue;const q=h.getCoveringTilesDetailsProvider().allowWorldCopies()?H.tileID:H.tileID.unwrapTo(0),W=Math.pow(2,h.zoom-H.tileID.overscaledZ),K=i*H.queryPadding*o.Z/H.tileSize/W,ee=[q.getTilePoint(new o.$(P,E)),q.getTilePoint(new o.$(k,F))];if(ee[0].x-K<o.Z&&ee[0].y-K<o.Z&&ee[1].x+K>=0&&ee[1].y+K>=0){const te=_.map(se=>q.getTilePoint(se)),re=x.map(se=>q.getTilePoint(se));l.push({tile:H,tileID:q,queryGeometry:te,cameraQueryGeometry:re,scale:W})}}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(ue(this._source.type)){const e=Ie.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,s){this._state.updateState(e=e||"_geojsonTileLayer",i,s)}removeFeatureState(e,i,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,s)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,s){const l=this._tiles[e];l&&l.setDependencies(i,s)}reloadTilesForDependencies(e,i){for(const s in this._tiles)this._tiles[s].hasDependency(e,i)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,i))}}function xe(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 ue(u){return u==="raster"||u==="image"||u==="video"}_e.maxOverzooming=10,_e.maxUnderzooming=3;class ze{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ae(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,x=_>0?(l-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function Ne(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ze{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const x=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)x.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const P=this.circles[3*T],E=this.circles[3*T+1],k=this.circles[3*T+2];x.push({key:this.circleKeys[T],x1:P-k,y1:E-k,x2:P+k,y2:E+k})}}else this._forEachCell(e,i,s,l,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,x=i-s,T=i+s;if(_<0||f>this.width||T<0||x>this.height)return!1;const P=[];return this._forEachCell(f,x,_,T,this._queryCellCircle,P,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(e,i,s,l,h,f,_,x){const{seenUids:T,hitTest:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!T.box[H]){T.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(e<=O[q+2]&&i<=O[q+3]&&s>=O[q+0]&&l>=O[q+1]&&(!x||x(W))&&(!P||!Ne(E,W.overlapMode))&&(f.push({key:W,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),P))return!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!T.circle[H]){T.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,s,l)&&(!x||x(W))&&(!P||!Ne(E,W.overlapMode))){const K=O[q],ee=O[q+1],te=O[q+2];if(f.push({key:W,x1:K-te,y1:ee-te,x2:K+te,y2:ee+te}),P)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,x){const{circle:T,seenUids:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!P.box[H]){P.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!x||x(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!P.circle[H]){P.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circlesCollide(O[q],O[q+1],O[q+2],T.x,T.y,T.radius)&&(!x||x(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,x){const T=this._convertToXCellCoord(e),P=this._convertToYCellCoord(i),E=this._convertToXCellCoord(s),k=this._convertToYCellCoord(l);for(let F=T;F<=E;F++)for(let O=P;O<=k;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+F,f,_,x))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,x=h-i,T=s+f;return T*T>_*_+x*x}_circleAndRectCollide(e,i,s,l,h,f,_){const x=(f-l)/2,T=Math.abs(e-(l+x));if(T>x+s)return!1;const P=(_-h)/2,E=Math.abs(i-(h+P));if(E>P+s)return!1;if(T<=x||E<=P)return!0;const k=T-x,F=E-P;return k*k+F*F<=s*s}}function nt(u,e,i){const s=o.K();if(!u){const{vecSouth:E,vecEast:k}=we(e),F=pe();F[0]=k[0],F[1]=k[1],F[2]=E[0],F[3]=E[1],l=F,(P=(f=(h=F)[0])*(T=h[3])-(x=h[2])*(_=h[1]))&&(l[0]=T*(P=1/P),l[1]=-_*P,l[2]=-x*P,l[3]=f*P),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var l,h,f,_,x,T,P;return o.M(s,s,[1/i,1/i,1]),s}function dt(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=we(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.M(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function we(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=o.ao();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ap(f);_<1e-9?o.aq(f):o.ar(f,f,1/_);const x=o.ao();x[0]=l*s*e-h*i,x[1]=h*s*e+l*i;const T=o.ap(x);return T<1e-9?o.aq(x):o.ar(x,x,1/T),{vecEast:x,vecSouth:f}}function st(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.at(l,l,i)):(l=[u,e,0,1],qt(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function St(u,e){return .5+u/e*.5}function Rt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function Pt(u,e,i,s,l,h,f,_,x,T,P,E,k){const F=i?u.textSizeData:u.iconSizeData,O=o.ak(F,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let te=!1;for(let re=0;re<K.length;re++){const se=K.get(re);if(se.hidden||se.writingMode===o.al.vertical&&!te){zi(se.numGlyphs,q);continue}te=!1;const ne=new o.P(se.anchorX,se.anchorY),de={getElevation:k,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:ne,unwrappedTileID:x,width:T,height:P,translation:E},me=bs(se.anchorX,se.anchorY,de);if(!Rt(me.point,H)){zi(se.numGlyphs,q);continue}const Te=St(e.transform.cameraToCenterDistance,me.signedDistanceFromCamera),Se=o.am(F,O,se),be=h?Se*e.transform.getPitchedTextCorrection(se.anchorX,se.anchorY,x)/Te:Se*Te,je=tt({projectionContext:de,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_});te=je.useVertical,(je.notEnoughRoom||te||je.needsFlipping&&tt({projectionContext:de,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&zi(se.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function Pe(u,e,i,s,l,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,E=e.getoffsetX(h.glyphStartIndex),k=e.getoffsetX(x-1),F=Wn(u*E,i,s,l,h.segment,T,P,_,f);if(!F)return null;const O=Wn(u*k,i,s,l,h.segment,T,P,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:F,last:O}:null}function Ge(u,e,i,s){return u===o.al.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.al.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function tt(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:T,rotateToLine:P}=u,E=l/24,k=s.lineOffsetX*E,F=s.lineOffsetY*E;let O;if(s.numGlyphs>1){const H=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=Pe(E,_,k,F,h,s,P,e);if(!K)return{notEnoughRoom:!0};const ee=ct(K.first.point.x,K.first.point.y,e,i),te=ct(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const re=Ge(s.writingMode,ee,te,T);if(re)return re}O=[K.first];for(let re=s.glyphStartIndex+1;re<H-1;re++)O.push(Wn(E*_.getoffsetX(re),k,F,h,s.segment,q,W,e,P));O.push(K.last)}else{if(f&&!h){const q=Qt(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),ee=Qt(K.x,K.y,e),te=ee.signedDistanceFromCamera>0?ee.point:lr(e.tileAnchorPoint,K,q,1,e),re=ct(q.x,q.y,e,i),se=ct(te.x,te.y,e,i),ne=Ge(s.writingMode,re,se,T);if(ne)return ne}const H=Wn(E*_.getoffsetX(s.glyphStartIndex),k,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,P);if(!H||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[H]}for(const H of O)o.as(x,H.point,H.angle);return{}}function lr(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=Qt(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function Ji(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=Qt(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return s.projections[u]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const f=u-i.direction;return lr(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function Qt(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=st(s,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function ct(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.at(l,l,s),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function bs(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function pa(u,e,i){return u._unit()._perp()._mult(e*i)}function go(u,e,i,s,l,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+x.direction<s||u+x.direction>=l)return _.projectionCache.offsets[u]=T,T;const P=Ji(u+x.direction,_,x),E=pa(P.sub(i),f,x.direction),k=i.add(E),F=P.add(E);return _.projectionCache.offsets[u]=o.au(h,T,k,F)||T,_.projectionCache.offsets[u]}function Wn(u,e,i,s,l,h,f,_,x){const T=s?u-e:u+e;let P=T>0?1:-1,E=0;s&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let k,F=P>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?k=_.projectionCache.cachedAnchorPoint:(k=Qt(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=k);let O,H,q=k,W=k,K=0,ee=0;const te=Math.abs(T),re=[];let se;for(;K+ee<=te;){if(F+=P,F<h||F>=f)return null;K+=ee,W=q,H=O;const me={absOffsetX:te,direction:P,distanceFromAnchor:K,previousVertex:W};if(q=Ji(F,_,me),i===0)re.push(W),se=q.sub(W);else{let Te;const Se=q.sub(W);Te=Se.mag()===0?pa(Ji(F+P,_,me).sub(q),i,P):pa(Se,i,P),H||(H=W.add(Te)),O=go(F,Te,q,h,f,H,i,_,me),re.push(H),se=O.sub(H)}ee=se.mag()}const ne=se._mult((te-K)/ee)._add(H||W),de=E+Math.atan2(q.y-W.y,q.x-W.x);return re.push(ne),{point:ne,angle:x?de:0,path:re}}const _o=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function zi(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(_o,3*s)}}function qt(u,e,i){const s=e[0],l=e[1];return u[0]=i[0]*s+i[4]*l+i[12],u[1]=i[1]*s+i[5]*l+i[13],u[3]=i[3]*s+i[7]*l+i[15],u}const Ai=100;class ws{constructor(e,i=new Ze(e.width+200,e.height+200,25),s=new Ze(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+Ai,this.screenBottomBoundary=e.height+Ai,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,x,T,P,E,k){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,P,k),O=s*F.perspectiveRatio;let H;if(f||_)H=this._projectCollisionBox(e,O,l,h,f,_,x,F,P,E,k);else{const se=F.x+(E?E.x*O:0),ne=F.y+(E?E.y*O:0);H={allPointsOccluded:!1,box:[se+e.x1*O,ne+e.y1*O,se+e.x2*O,ne+e.y2*O]}}const[q,W,K,ee]=H.box,te=f?H.allPointsOccluded:F.isOccluded;let re=te;return re||(re=F.perspectiveRatio<this.perspectiveRatioCutoff),re||(re=!this.isInsideGrid(q,W,K,ee)),re||i!=="always"&&this.grid.hitTest(q,W,K,ee,i,T)?{box:[q,W,K,ee],placeable:!1,offscreen:!1,occluded:te}:{box:[q,W,K,ee],placeable:!0,offscreen:this.isOffscreen(q,W,K,ee),occluded:te}}placeCollisionCircles(e,i,s,l,h,f,_,x,T,P,E,k,F,O){const H=[],q=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(q.x,q.y,f,O),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.ay,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},te=Pe(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,ee);let re=!1,se=!1,ne=!0;if(te){const de=.5*E*W+k,me=new o.P(-100,-100),Te=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Se=new ze,be=te.first,je=te.last;let Be=[];for(let mt=be.path.length-1;mt>=1;mt--)Be.push(be.path[mt]);for(let mt=1;mt<je.path.length;mt++)Be.push(je.path[mt]);const ke=2.5*de;if(T){const mt=this.projectPathToScreenSpace(Be,ee);Be=mt.some(lt=>lt.signedDistanceFromCamera<=0)?[]:mt.map(lt=>lt.point)}let We=[];if(Be.length>0){const mt=Be[0].clone(),lt=Be[0].clone();for(let ei=1;ei<Be.length;ei++)mt.x=Math.min(mt.x,Be[ei].x),mt.y=Math.min(mt.y,Be[ei].y),lt.x=Math.max(lt.x,Be[ei].x),lt.y=Math.max(lt.y,Be[ei].y);We=mt.x>=me.x&&lt.x<=Te.x&&mt.y>=me.y&&lt.y<=Te.y?[Be]:lt.x<me.x||mt.x>Te.x||lt.y<me.y||mt.y>Te.y?[]:o.av([Be],me.x,me.y,Te.x,Te.y)}for(const mt of We){Se.reset(mt,.25*de);let lt=0;lt=Se.length<=.5*de?1:Math.ceil(Se.paddedLength/ke)+1;for(let ei=0;ei<lt;ei++){const Dt=ei/Math.max(lt-1,1),ti=Se.lerp(Dt),Wt=ti.x+Ai,jt=ti.y+Ai;H.push(Wt,jt,de,0);const At=Wt-de,Ri=jt-de,Pi=Wt+de,$i=jt+de;if(ne=ne&&this.isOffscreen(At,Ri,Pi,$i),se=se||this.isInsideGrid(At,Ri,Pi,$i),e!=="always"&&this.grid.hitTestCircle(Wt,jt,de,e,P)&&(re=!0,!x))return{circles:[],offscreen:!1,collisionDetected:re}}}}return{circles:!x&&re||!se||W<this.perspectiveRatioCutoff?[]:H,offscreen:ne,collisionDetected:re}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.an(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const x=st(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(x.point.x,x.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,x=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,x=0):(x++,x>f&&(f=x,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,l=1/0,h=-1/0,f=-1/0;for(const P of e){const E=new o.P(P.x+Ai,P.y+Ai);s=Math.min(s,E.x),l=Math.min(l,E.y),h=Math.max(h,E.x),f=Math.max(f,E.y),i.push(E)}const _=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),x={},T={};for(const P of _){const E=P.key;if(x[E.bucketInstanceId]===void 0&&(x[E.bucketInstanceId]={}),x[E.bucketInstanceId][E.featureIndex])continue;const k=[new o.P(P.x1,P.y1),new o.P(P.x2,P.y1),new o.P(P.x2,P.y2),new o.P(P.x1,P.y2)];o.aw(i,k)&&(x[E.bucketInstanceId][E.featureIndex]=!0,T[E.bucketInstanceId]===void 0&&(T[E.bucketInstanceId]=[]),T[E.bucketInstanceId].push(E.featureIndex))}return T}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(x,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.at(f,f,h)):(f=[e,i,0,1],qt(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+Ai,y:(-f[1]/_+1)/2*this.transform.height+Ai,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+Ai,y:(1-f.point.y)/2*this.transform.height+Ai,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,l){const h=this.transform.projectTileCoordinates(e,i,s,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,l){return s<Ai||e>=this.screenRightBoundary||l<Ai||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.ad([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,x,T,P,E){let k=1,F=0,O=0,H=1;const q=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Be=this.projectAndGetPerspectiveRatio(q+1,W,l,T,E),ke=Be.x-x.x,We=Math.atan((Be.y-x.y)/ke)+(ke<0?Math.PI:0),mt=Math.sin(We),lt=Math.cos(We);k=lt,F=mt,O=-mt,H=lt}else if(!f&&h){const Be=we(this.transform);k=Be.vecEast[0],F=Be.vecEast[1],O=Be.vecSouth[0],H=Be.vecSouth[1]}let K=x.x,ee=x.y,te=i;h&&(K=q,ee=W,te=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),te*=this.transform.getPitchedTextCorrection(q,W,l),P||(te*=o.ae(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(K+=k*P.x*te+O*P.y*te,ee+=F*P.x*te+H*P.y*te);const re=e.x1*te,se=e.x2*te,ne=(re+se)/2,de=e.y1*te,me=e.y2*te,Te=(de+me)/2,Se=[{offsetX:re,offsetY:de},{offsetX:ne,offsetY:de},{offsetX:se,offsetY:de},{offsetX:se,offsetY:Te},{offsetX:se,offsetY:me},{offsetX:ne,offsetY:me},{offsetX:re,offsetY:me},{offsetX:re,offsetY:Te}];let be=[];for(const{offsetX:Be,offsetY:ke}of Se)be.push(new o.P(K+k*Be+O*ke,ee+F*Be+H*ke));let je=!1;if(h){const Be=be.map(ke=>this.projectAndGetPerspectiveRatio(ke.x,ke.y,l,T,E));je=Be.some(ke=>!ke.isOccluded),be=Be.map(ke=>new o.P(ke.x,ke.y))}else je=!0;return{box:o.ax(be),allPointsOccluded:!je}}}class yo{constructor(e,i,s,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Gr{constructor(e,i,s,l,h){this.text=new yo(e?e.text:null,i,s,h),this.icon=new yo(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class fa{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Nu{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class Zu{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 Nl(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aE(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Na{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new ws(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Zu(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,x=h.layers[0].layout,T=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/o.Z,k=s.tileID.toUnwrapped(),F=x.get("text-rotation-alignment")==="map",O=o.az(s,1,this.transform.zoom),H=o.aA(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.aA(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=nt(F,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Nu(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:x,translationText:H,translationIcon:q,unwrappedTileID:k,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.ak(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:se}=ee;e.push({sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:se,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,_,x,T,P,E,k,F,O,H,q,W,K,ee,te){const re=o.aB[e.textAnchor],se=[e.textOffset0,e.textOffset1],ne=Nl(re,s,l,se,h),de=this.collisionIndex.placeCollisionBox(i,k,x,T,P,_,f,q,E.predicate,ee,ne,te);if((!K||this.collisionIndex.placeCollisionBox(K,k,x,T,P,_,f,W,E.predicate,ee,ne,te).placeable)&&de.placeable){let me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:s,height:l,anchor:re,textBoxScale:h,prevAnchor:me},this.markUsedJustification(O,re,F,H),O.allowVerticalPlacement&&(this.markUsedOrientation(O,H,F),this.placedOrientations[F.crossTileID]=H),{shift:ne,placedGlyphBoxes:de}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:T,textPixelRatio:P,holdingForFade:E,collisionBoxArray:k,partiallyEvaluatedTextSize:F,collisionGroup:O}=e.parameters,H=h.get("text-optional"),q=h.get("icon-optional"),W=o.aC(h,"text-overlap","text-allow-overlap"),K=W==="always",ee=o.aC(h,"icon-overlap","icon-allow-overlap"),te=ee==="always",re=h.get("text-rotation-alignment")==="map",se=h.get("text-pitch-alignment")==="map",ne=h.get("icon-text-fit")!=="none",de=h.get("symbol-z-order")==="viewport-y",me=K&&(te||!l.hasIconData()||q),Te=te&&(K||!l.hasTextData()||H);!l.collisionArrays&&k&&l.deserializeCollisionBoxes(k);const Se=this.retainedQueryData[l.bucketInstanceId].tileID,be=this._getTerrainElevationFunc(Se),je=this.transform.getFastPathSimpleProjectionMatrix(Se),Be=(ke,We,mt)=>{var lt,ei;if(i[ke.crossTileID])return;if(E)return void(this.placements[ke.crossTileID]=new fa(!1,!1,!1));let Dt=!1,ti=!1,Wt=!0,jt=null,At={box:null,placeable:!1,offscreen:null,occluded:!1},Ri={placeable:!1},Pi=null,$i=null,tr=null,fn=0,ta=0,zn=0;We.textFeatureIndex?fn=We.textFeatureIndex:ke.useRuntimeCollisionCircles&&(fn=ke.featureIndex),We.verticalTextFeatureIndex&&(ta=We.verticalTextFeatureIndex);const An=We.textBox;if(An){const Er=ai=>{let Xt=o.al.horizontal;if(l.allowVerticalPlacement&&!ai&&this.prevPlacement){const _i=this.prevPlacement.placedOrientations[ke.crossTileID];_i&&(this.placedOrientations[ke.crossTileID]=_i,Xt=_i,this.markUsedOrientation(l,Xt,ke))}return Xt},ia=(ai,Xt)=>{if(l.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&We.verticalTextBox){for(const _i of l.writingModes)if(_i===o.al.vertical?(At=Xt(),Ri=At):At=ai(),At&&At.placeable)break}else At=ai()},Rn=ke.textAnchorOffsetStartIndex,Dn=ke.textAnchorOffsetEndIndex;if(Dn===Rn){const ai=(Xt,_i)=>{const ii=this.collisionIndex.placeCollisionBox(Xt,W,P,Se,x,se,re,f,O.predicate,be,void 0,je);return ii&&ii.placeable&&(this.markUsedOrientation(l,_i,ke),this.placedOrientations[ke.crossTileID]=_i),ii};ia(()=>ai(An,o.al.horizontal),()=>{const Xt=We.verticalTextBox;return l.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Xt?ai(Xt,o.al.vertical):{box:null,offscreen:null}}),Er(At&&At.placeable)}else{let ai=o.aB[(ei=(lt=this.prevPlacement)===null||lt===void 0?void 0:lt.variableOffsets[ke.crossTileID])===null||ei===void 0?void 0:ei.anchor];const Xt=(ii,zh,Ia)=>{const Kd=ii.x2-ii.x1,Ah=ii.y2-ii.y1,Oc=ke.textBoxScale,Rh=ne&&ee==="never"?zh:null;let kr=null,ra=W==="never"?1:2,jc="never";ai&&ra++;for(let Dh=0;Dh<ra;Dh++){for(let Ys=Rn;Ys<Dn;Ys++){const Nc=l.textAnchorOffsets.get(Ys);if(ai&&Nc.textAnchor!==ai)continue;const Zc=this.attemptAnchorPlacement(Nc,ii,Kd,Ah,Oc,re,se,P,Se,x,O,jc,ke,l,Ia,f,_,Rh,be);if(Zc&&(kr=Zc.placedGlyphBoxes,kr&&kr.placeable))return Dt=!0,jt=Zc.shift,kr}ai?ai=null:jc=W}return s&&!kr&&(kr={box:this.collisionIndex.placeCollisionBox(An,"always",P,Se,x,se,re,f,O.predicate,be,void 0,je).box,offscreen:!1,placeable:!1,occluded:!1}),kr};ia(()=>Xt(An,We.iconBox,o.al.horizontal),()=>{const ii=We.verticalTextBox;return l.allowVerticalPlacement&&(!At||!At.placeable)&&ke.numVerticalGlyphVertices>0&&ii?Xt(ii,We.verticalIconBox,o.al.vertical):{box:null,occluded:!0,offscreen:null}}),At&&(Dt=At.placeable,Wt=At.offscreen);const _i=Er(At&&At.placeable);if(!Dt&&this.prevPlacement){const ii=this.prevPlacement.variableOffsets[ke.crossTileID];ii&&(this.variableOffsets[ke.crossTileID]=ii,this.markUsedJustification(l,ii.anchor,ke,_i))}}}if(Pi=At,Dt=Pi&&Pi.placeable,Wt=Pi&&Pi.offscreen,ke.useRuntimeCollisionCircles){const Er=l.text.placedSymbolArray.get(ke.centerJustifiedTextSymbolIndex),ia=o.am(l.textSizeData,F,Er),Rn=h.get("text-padding");$i=this.collisionIndex.placeCollisionCircles(W,Er,l.lineVertexArray,l.glyphOffsetArray,ia,x,T,s,se,O.predicate,ke.collisionCircleDiameter,Rn,f,be),$i.circles.length&&$i.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Dt=K||$i.circles.length>0&&!$i.collisionDetected,Wt=Wt&&$i.offscreen}if(We.iconFeatureIndex&&(zn=We.iconFeatureIndex),We.iconBox){const Er=ia=>this.collisionIndex.placeCollisionBox(ia,ee,P,Se,x,se,re,_,O.predicate,be,ne&&jt?jt:void 0,je);Ri&&Ri.placeable&&We.verticalIconBox?(tr=Er(We.verticalIconBox),ti=tr.placeable):(tr=Er(We.iconBox),ti=tr.placeable),Wt=Wt&&tr.offscreen}const mn=H||ke.numHorizontalGlyphVertices===0&&ke.numVerticalGlyphVertices===0,Pa=q||ke.numIconVertices===0;mn||Pa?Pa?mn||(ti=ti&&Dt):Dt=ti&&Dt:ti=Dt=ti&&Dt;const Ca=ti&&tr.placeable;if(Dt&&Pi.placeable&&this.collisionIndex.insertCollisionBox(Pi.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Ri&&Ri.placeable&&ta?ta:fn,O.ID),Ca&&this.collisionIndex.insertCollisionBox(tr.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,zn,O.ID),$i&&Dt&&this.collisionIndex.insertCollisionCircles($i.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,fn,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,mt,We,Pi,tr,$i),ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ke.crossTileID]=new fa((Dt||me)&&!(Pi!=null&&Pi.occluded),(ti||Te)&&!(tr!=null&&tr.occluded),Wt||l.justReloaded),i[ke.crossTileID]=!0};if(de){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ke=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let We=ke.length-1;We>=0;--We){const mt=ke[We];Be(l.symbolInstances.get(mt),l.collisionArrays[mt],mt)}}else for(let ke=e.symbolInstanceStart;ke<e.symbolInstanceEnd;ke++)Be(l.symbolInstances.get(ke),l.collisionArrays[ke],ke);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?x=_.get(i):(x={text:null,icon:null},_.set(i,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<f.circles.length;x+=4)_.push(f.circles[x+0]-Ai),_.push(f.circles[x+1]-Ai),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.al.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aD(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.al.horizontal||i===o.al.horizontalOnly?i:0,h=i===o.al.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],P=h[x];P?(this.opacities[x]=new Gr(P,l,T.text,T.icon),s=s||T.text!==P.text.placed||T.icon!==P.icon.placed):(this.opacities[x]=new Gr(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const x in h){const T=h[x];if(!this.opacities[x]){const P=new Gr(T,l,!1,!1);P.isHidden()||(this.opacities[x]=P,s=s||T.text.placed||T.icon.placed)}}for(const x in f)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=f[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new Gr(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=f.get("text-rotation-alignment")==="map",k=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",O=new Gr(null,0,x&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const H=(W,K,ee)=>{for(let te=0;te<K/4;te++)W.opacityVertexArray.emplaceBack(ee);W.hasVisibleVertices=W.hasVisibleVertices||ee!==ma},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:te,crossTileID:re}=K;let se=this.opacities[re];s[re]?se=_:se||(se=O,this.opacities[re]=se),s[re]=!0;const ne=K.numIconVertices>0,de=this.placedOrientations[K.crossTileID],me=de===o.al.vertical,Te=de===o.al.horizontal||de===o.al.horizontalOnly;if(ee>0||te>0){const be=$l(se.text);H(e.text,ee,me?ma:be),H(e.text,te,Te?ma:be);const je=se.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(We=>{We>=0&&(e.text.placedSymbolArray.get(We).hidden=je||me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=je||Te?1:0);const Be=this.variableOffsets[K.crossTileID];Be&&this.markUsedJustification(e,Be.anchor,K,de);const ke=this.placedOrientations[K.crossTileID];ke&&(this.markUsedJustification(e,"left",K,ke),this.markUsedOrientation(e,ke,K))}if(ne){const be=$l(se.icon),je=!(F&&K.verticalPlacedIconSymbolIndex&&me);K.placedIconSymbolIndex>=0&&(H(e.icon,K.numIconVertices,je?be:ma),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=se.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(H(e.icon,K.numVerticalIconVertices,je?ma:be),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=se.icon.isHidden())}const Se=q&&q.has(W)?q.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const be=e.collisionArrays[W];if(be){let je=new o.P(0,0);if(be.textBox||be.verticalTextBox){let Be=!0;if(P){const ke=this.variableOffsets[re];ke?(je=Nl(ke.anchor,ke.width,ke.height,ke.textOffset,ke.textBoxScale),E&&je._rotate(k?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Be=!1}if(be.textBox||be.verticalTextBox){let ke;be.textBox&&(ke=me),be.verticalTextBox&&(ke=Te),Zl(e.textCollisionBox.collisionVertexArray,se.text.placed,!Be||ke,Se.text,je.x,je.y)}}if(be.iconBox||be.verticalIconBox){const Be=!!(!Te&&be.verticalIconBox);let ke;be.iconBox&&(ke=Be),be.verticalIconBox&&(ke=!Be),Zl(e.iconCollisionBox.collisionVertexArray,se.icon.placed,ke,Se.icon,F?je.x:0,F?je.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const s=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function Zl(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-Ai,_=s[1]-Ai,x=s[2]-Ai,T=s[3]-Ai;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Id=Math.pow(2,25),Ed=Math.pow(2,24),kd=Math.pow(2,17),Vu=Math.pow(2,16),Uu=Math.pow(2,9),Vl=Math.pow(2,8),Ul=Math.pow(2,1);function $l(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*Id+e*Ed+i*kd+e*Vu+i*Uu+e*Vl+i*Ul+e}const ma=0;class Gl{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class xo{constructor(e,i,s,l,h,f,_,x){this.placement=new Na(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=Ie.now(),h=()=>!this._forceFullPlacement&&Ie.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Gl(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 Za=512/o.Z/2;class Va{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,x=l.get(_);x?x.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*Za),y:Math.floor(x.anchorY*Za)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new o.aF(_.positions.length,16,Uint16Array);for(const{x:T,y:P}of _.positions)x.add(T,P);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,T=Za/Math.pow(2,x-h),P=(_*o.Z+e.anchorY)*T,E=l*o.Z*Za;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*Za),y:Math.floor(P-E)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const x=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const P of T){const E=_.crossTileIDs[P];if(!s[E]){s[E]=!0,f.crossTileID=E;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const P=_.positions[T],E=_.crossTileIDs[T];if(Math.abs(P.x-x.x)<=l&&Math.abs(P.y-x.y)<=l&&!s[E]){s[E]=!0,f.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class $u{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class zd{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const x=f[_];x.tileID.isChildOf(e)&&x.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Va(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const l=this.indexes[s];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[h]),delete l[h],i=!0)}return i}}class Pn{constructor(){this.layerIndexes={},this.crossTileIDs=new $u,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new zd);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var Ua="void main() {fragColor=vec4(1.0);}";const gt={prelude:Tt(`#ifdef GL_ES
5
+ */var K_=Iu.exports,Af;function Y_(){return Af||(Af=1,function(v,g){(function(b,I){v.exports=I()})(K_,function(){var b={},I={};function A(S,o,he){if(I[S]=he,S==="index"){var pe="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",Ce={};return I.shared(Ce),I.index(b,Ce),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"}))),b}}A("shared",["exports"],function(S){function o(r,t,n,a){return new(n||(n=Promise))(function(c,d){function p(w){try{y(a.next(w))}catch(M){d(M)}}function m(w){try{y(a.throw(w))}catch(M){d(M)}}function y(w){var M;w.done?c(w.value):(M=w.value,M instanceof n?M:new n(function(C){C(M)})).then(p,m)}y((a=a.apply(r,t||[])).next())})}function he(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var pe,Ce;function Le(){if(Ce)return pe;function r(t,n){this.x=t,this.y=n}return Ce=1,pe=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,n){return this.clone()._rotateAround(t,n)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,a=t.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var n=Math.cos(t),a=Math.sin(t),c=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,n){var a=Math.cos(t),c=Math.sin(t),d=n.y+c*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-c*(this.y-n.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t},pe}typeof SuppressedError=="function"&&SuppressedError;var Ie,oe,Ve=he(Le()),Bt=function(){if(oe)return Ie;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return oe=1,Ie=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(n===void 0&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},Ie}(),ri=he(Bt);let Ft,oi;function Oi(){return Ft==null&&(Ft=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ft}function ni(){if(oi==null&&(oi=!1,Oi())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const n=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&n[a]!==a){oi=!0;break}}}return oi||!1}var Zt=1e-6,Ot=typeof Float32Array<"u"?Float32Array:Array;function Wi(){var r=new Ot(9);return Ot!=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 Et(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 nr(){var r=new Ot(3);return Ot!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function qn(r){return Math.hypot(r[0],r[1],r[2])}function Lr(r,t,n){var a=new Ot(3);return a[0]=r,a[1]=t,a[2]=n,a}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});var ji,Xi=qn;function xi(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3];return r[0]=n[0]*a+n[4]*c+n[8]*d+n[12]*p,r[1]=n[1]*a+n[5]*c+n[9]*d+n[13]*p,r[2]=n[2]*a+n[6]*c+n[10]*d+n[14]*p,r[3]=n[3]*a+n[7]*c+n[11]*d+n[15]*p,r}function Pr(){var r=new Ot(4);return Ot!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ni(){var r=new Ot(2);return Ot!=Float32Array&&(r[0]=0,r[1]=0),r}function Br(r,t){var n=new Ot(2);return n[0]=r,n[1]=t,n}nr(),ji=new Ot(4),Ot!=Float32Array&&(ji[0]=0,ji[1]=0,ji[2]=0,ji[3]=0),nr(),Lr(1,0,0),Lr(0,1,0),Pr(),Pr(),Wi(),Ni();const Qe=8192;function pi(r,t,n){return t*(Qe/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function fi(r,t){return(r%t+t)%t}function Cr(r,t,n){return r*(1-n)+t*n}function ki(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 vn(r,t,n,a){const c=new ri(r,t,n,a);return d=>c.solve(d)}const Zi=vn(.25,.1,.25,1);function Vt(r,t,n){return Math.min(n,Math.max(t,r))}function Ki(r,t,n){const a=n-t,c=((r-t)%a+a)%a+t;return c===t?n:c}function Yi(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let bn=1;function nn(r,t,n){const a={};for(const c in r)a[c]=t.call(this,r[c],c,r);return a}function ha(r,t,n){const a={};for(const c in r)t.call(this,r[c],c,r)&&(a[c]=r[c]);return a}function ar(r){return Array.isArray(r)?r.map(ar):typeof r=="object"&&r?nn(r,ar):r}const sr={};function Vi(r){sr[r]||(typeof console<"u"&&console.warn(r),sr[r]=!0)}function Nt(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function Fr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let an=null;function fr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const wn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Tn(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(w,M,C,z,D){const B=4*Math.max(1,0),j=(Math.max(0,C)-C)*z*4+B,$=4*z,X=Math.max(0,M),ae=Math.max(0,C);return{rect:{x:X,y:ae,width:Math.min(w.width,M+z)-X,height:Math.min(w.height,C+D)-ae},layout:[{offset:j,stride:$}]}}(r,t,n,a,c)),m)for(let w=0;w<y.length;w+=4){const M=y[w];y[w]=y[w+2],y[w+2]=M}return y}finally{d.close()}})}let Ee,Je;function $e(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function ft(r){return r/Math.PI*180}const Gt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},or={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},mi="AbortError";function mr(){return new Error(mi)}const gr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function da(r){return gr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Mn="global-dispatcher";class Hn extends Error{constructor(t,n,a,c){super(`AJAXError: ${n} (${t}): ${a}`),this.status=t,this.statusText=n,this.url=a,this.body=c}}const sn=()=>Fr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,_r=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=da(r.url);if(a)return a(r,t);if(Fr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Mn},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(sn())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:sn(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Hn(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Hn(p.status,p.statusText,a.url,w)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw mr();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if(Fr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Mn},t)}var n;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const w in a.headers)y.setRequestHeader(w,a.headers[w]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let w=y.response;if(a.type==="json")try{w=JSON.parse(y.response)}catch(M){return void p(M)}d({data:w,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const w=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Hn(y.status,y.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{y.abort(),p(mr())}),y.send(a.body)})}(r,t)};function Sn(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 ce(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function N(r,t,n){if(n&&n[r]){const a=n[r].indexOf(t);a!==-1&&n[r].splice(a,1)}}class Z{constructor(t,n={}){Yi(this,n),this.type=t}}class G extends Z{constructor(t,n={}){super("error",Yi({error:t},n))}}class J{on(t,n){return this._listeners=this._listeners||{},ce(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return N(t,n,this._listeners),N(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},ce(t,n,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,n){typeof t=="string"&&(t=new Z(t,n||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)N(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Yi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof G&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,n){return this._eventedParent=t,this._eventedParentData=n,this}}var V={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const le=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ge(r,t){const n={};for(const a in r)a!=="ref"&&(n[a]=r[a]);return le.forEach(a=>{a in t&&(n[a]=t[a])}),n}function ie(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!ie(r[n],t[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const n in r)if(!ie(r[n],t[n]))return!1;return!0}return r===t}function _e(r,t){r.push(t)}function xe(r,t,n){_e(n,{command:"addSource",args:[r,t[r]]})}function ue(r,t,n){_e(t,{command:"removeSource",args:[r]}),n[r]=!0}function ze(r,t,n,a){ue(r,n,a),xe(r,t,n)}function Ne(r,t,n){let a;for(a in r[n])if(Object.prototype.hasOwnProperty.call(r[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;return!0}function Ze(r,t,n,a,c,d){r=r||{},t=t||{};for(const p in r)Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}))}function nt(r){return r.id}function dt(r,t){return r[t.id]=t,r}class we{constructor(t,n,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function st(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}class St 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,c]of n)this.bindings[a]=c}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 Pt={kind:"null"},Pe={kind:"number"},Ge={kind:"string"},tt={kind:"boolean"},lr={kind:"color"},Ji={kind:"projectionDefinition"},Qt={kind:"object"},ct={kind:"value"},bs={kind:"collator"},pa={kind:"formatted"},go={kind:"padding"},Wn={kind:"resolvedImage"},_o={kind:"variableAnchorOffsetCollection"};function zi(r,t){return{kind:"array",itemType:r,N:t}}function qt(r){if(r.kind==="array"){const t=qt(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const Ai=[Pt,Pe,Ge,tt,lr,Ji,pa,Qt,zi(ct),go,Wn,_o];function ws(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!ws(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 Ai)if(!ws(n,t))return null}}return`Expected ${qt(r)} but found ${qt(t)} instead.`}function yo(r,t){return t.some(n=>n.kind===r.kind)}function Gr(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 fa(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const Nu=.96422,Zu=.82521,Nl=4/29,Na=6/29,Zl=3*Na*Na,Id=Na*Na*Na,Ed=Math.PI/180,kd=180/Math.PI;function Vu(r){return(r%=360)<0&&(r+=360),r}function Uu([r,t,n,a]){let c,d;const p=Ul((.2225045*(r=Vl(r))+.7168786*(t=Vl(t))+.0606169*(n=Vl(n)))/1);r===t&&t===n?c=d=p:(c=Ul((.4360747*r+.3850649*t+.1430804*n)/Nu),d=Ul((.0139322*r+.0971045*t+.7141733*n)/Zu));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function Vl(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Ul(r){return r>Id?Math.pow(r,1/3):r/Zl+Nl}function $l([r,t,n,a]){let c=(r+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(n)?c:c-n/200;return c=1*Gl(c),d=Nu*Gl(d),p=Zu*Gl(p),[ma(3.1338561*d-1.6168667*c-.4906146*p),ma(-.9787684*d+1.9161415*c+.033454*p),ma(.0719453*d-.2289914*c+1.4052427*p),a]}function ma(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Gl(r){return r>Na?r*r*r:Zl*(r-Nl)}function xo(r){return parseInt(r.padEnd(2,r),16)/255}function Za(r,t){return Va(t?r/100:r,0,1)}function Va(r,t,n){return Math.min(Math.max(t,r),n)}function $u(r){return!r.some(Number.isNaN)}const zd={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 Pn(r,t,n){return r+n*(t-r)}function Ua(r,t,n){return r.map((a,c)=>Pn(a,t[c],n))}class gt{constructor(t,n,a,c=1,d=!0){this.r=t,this.g=n,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,n,a,c]))}static parse(t){if(t instanceof gt)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=zd[a];if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[xo(a.slice(m,m+=p)),xo(a.slice(m,m+=p)),xo(a.slice(m,m+=p)),xo(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,w,M,C,z,D,B,j,$,X,ae]=p,Y=[M||" ",D||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const R=[w,z,j].join(""),U=R==="%%%"?100:R===""?255:0;if(U){const Q=[Va(+y/U,0,1),Va(+C/U,0,1),Va(+B/U,0,1),X?Za(+X,ae):1];if($u(Q))return Q}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,w,M,C,z,D,B]=d,j=[y||" ",M||" ",z].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const $=[+m,Va(+w,0,100),Va(+C,0,100),D?Za(+D,B):1];if($u($))return function([X,ae,Y,R]){function U(Q){const fe=(Q+X/30)%12,Ae=ae*Math.min(Y,1-Y);return Y-Ae*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=Vu(X),ae/=100,Y/=100,[U(0),U(8),U(4),R]}($)}}}(t);return n?new gt(...n,!1):void 0}get rgb(){const{r:t,g:n,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,n/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[n,a,c,d]=Uu(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Vu(Math.atan2(c,a)*kd):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Uu(this.rgb))}overwriteGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}toString(){const[t,n,a,c]=this.rgb;return`rgba(${[t,n,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,n,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=Ua(t.rgb,n.rgb,a);return new gt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[w,M,C,z]=n.hcl;let D,B;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?D=NaN:(D=w,m!==1&&m!==0||(B=M)):(D=d,C!==1&&C!==0||(B=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),D=d+a*Y}const[j,$,X,ae]=function([Y,R,U,Q]){return Y=isNaN(Y)?0:Y*Ed,$l([U,Math.cos(Y)*R,Math.sin(Y)*R,Q])}([D,B??Pn(p,M,a),Pn(m,C,a),Pn(y,z,a)]);return new gt(j,$,X,ae,!1)}case"lab":{const[d,p,m,y]=$l(Ua(t.lab,n.lab,a));return new gt(d,p,m,y,!1)}}}}gt.black=new gt(0,0,0,1),gt.white=new gt(1,1,1,1),gt.transparent=new gt(0,0,0,0),gt.red=new gt(1,0,0,1);class Tt{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 $a=["bottom","center","top"];class on{constructor(t,n,a,c,d,p){this.text=t,this.image=n,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class yr{constructor(t){this.sections=t}static fromString(t){return new yr([new on(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 yr?t:yr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Qi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Qi)return t;if(typeof t=="number")return new Qi([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 Qi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new Qi(Ua(t.values,n.values,a))}}class li{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Ts=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ui{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ui)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let n=0;n<t.length;n+=2){const a=t[n],c=t[n+1];if(typeof a!="string"||!Ts.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Ui(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){const c=t.values,d=n.values;if(c.length!==d.length)throw new li(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new li(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,w]=c[m+1],[M,C]=d[m+1];p.push([Pn(y,M,a),Pn(w,C,a)])}return new Ui(p)}}class Ir{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ir({name:t,available:!1}):null}}class cr{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new cr(t,n,a)}static parse(t){return t instanceof cr?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new cr(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new cr(t.from,t.to,t.transition):typeof t=="string"?new cr(t,t,1):void 0}}function Xn(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 Ms(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof cr||r instanceof gt||r instanceof Tt||r instanceof yr||r instanceof Qi||r instanceof Ui||r instanceof Ir)return!0;if(Array.isArray(r)){for(const t of r)if(!Ms(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Ms(r[t]))return!1;return!0}return!1}function ci(r){if(r===null)return Pt;if(typeof r=="string")return Ge;if(typeof r=="boolean")return tt;if(typeof r=="number")return Pe;if(r instanceof gt)return lr;if(r instanceof cr)return Ji;if(r instanceof Tt)return bs;if(r instanceof yr)return pa;if(r instanceof Qi)return go;if(r instanceof Ui)return _o;if(r instanceof Ir)return Wn;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const c=ci(a);if(n){if(n===c)continue;n=ct;break}n=c}return zi(n||ct,t)}return Qt}function ln(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof gt||r instanceof cr||r instanceof yr||r instanceof Qi||r instanceof Ui||r instanceof Ir?r.toString():JSON.stringify(r)}class Kn{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(!Ms(t[1]))return n.error("invalid value");const a=t[1];let c=ci(a);const d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new Kn(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ss={string:Ge,number:Pe,boolean:tt,object:Qt};class Or{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in Ss)||w==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ss[w],c++}else m=ct;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],c++}a=zi(m,y)}else{if(!Ss[d])throw new Error(`Types doesn't contain name = ${d}`);a=Ss[d]}const p=[];for(;c<t.length;c++){const m=n.parse(t[c],c,ct);if(!m)return null;p.push(m)}return new Or(a,p)}evaluate(t){for(let n=0;n<this.args.length;n++){const a=this.args[n].evaluate(t);if(!ws(this.type,ci(a)))return a;if(n===this.args.length-1)throw new li(`Expected value to be of type ${qt(this.type)}, but found ${qt(ci(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Ps={"to-boolean":tt,"to-color":lr,"to-number":Pe,"to-string":Ge};class zt{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(!Ps[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return n.error("Expected one argument.");const c=Ps[a],d=[];for(let p=1;p<t.length;p++){const m=n.parse(t[p],p,ct);if(!m)return null;d.push(m)}return new zt(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let n,a;for(const c of this.args){if(n=c.evaluate(t),a=null,n instanceof gt)return n;if(typeof n=="string"){const d=t.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(a=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:Xn(n[0],n[1],n[2],n[3]),!a))return new gt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new li(a||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const a of this.args){n=a.evaluate(t);const c=Qi.parse(n);if(c)return c}throw new li(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const a of this.args){n=a.evaluate(t);const c=Ui.parse(n);if(c)return c}throw new li(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const a of this.args){if(n=a.evaluate(t),n===null)return 0;const c=Number(n);if(!isNaN(c))return c}throw new li(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return yr.fromString(ln(this.args[0].evaluate(t)));case"resolvedImage":return Ir.fromString(ln(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return ln(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ql=["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"?ql[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let n=this._parseColorCache[t];return n||(n=this._parseColorCache[t]=gt.parse(t)),n}}class pt{constructor(t,n,a=[],c,d=new Rt,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=n}parse(t,n,a,c,d={}){return n?this.concat(n,a,c)._parse(t,d):this._parse(t,d)}_parse(t,n){function a(c,d,p){return p==="assert"?new Or(d,[c]):p==="coerce"?new zt(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value")if(m.kind!=="projectionDefinition"||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 Kn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new Ct;try{p=new Kn(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,n,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new pt(this.registry,this._isConstant,c,n||null,d,this.errors)}error(t,...n){const a=`${this.key}${n.map(c=>`[${c}]`).join("")}`;this.errors.push(new St(a,t))}checkSubtype(t,n){const a=ws(t,n);return a&&this.error(a),a}}class Ga{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 c=n.parse(t[t.length-1],t.length-1,n.expectedType,a);return c?new Ga(a,c):null}outputDefined(){return this.result.outputDefined()}}class Mt{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 Mt(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 Cs{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,Pe),c=n.parse(t[2],2,zi(n.expectedType||ct));return a&&c?new Cs(c.type.itemType,a,c):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new li(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new li(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new li(`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 qr{constructor(t,n){this.type=tt,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,ct),c=n.parse(t[2],2,ct);return a&&c?yo(a.type,[tt,Ge,Pe,Pt,ct])?new qr(a,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!Gr(n,["boolean","string","number","null"]))throw new li(`Expected first argument to be of type boolean, string, number or null, but found ${qt(ci(n))} instead.`);if(!Gr(a,["string","array"]))throw new li(`Expected second argument to be of type array or string, but found ${qt(ci(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class qa{constructor(t,n,a){this.type=Pe,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,ct),c=n.parse(t[2],2,ct);if(!a||!c)return null;if(!yo(a.type,[tt,Ge,Pe,Pt,ct]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Pe);return d?new qa(a,c,d):null}return new qa(a,c)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!Gr(n,["boolean","string","number","null"]))throw new li(`Expected first argument to be of type boolean, string, number or null, but found ${qt(ci(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),Gr(a,["string"])){const d=a.indexOf(n,c);return d===-1?-1:[...a.slice(0,d)].length}if(Gr(a,["array"]))return a.indexOf(n,c);throw new li(`Expected second argument to be of type array or string, but found ${qt(ci(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class vo{constructor(t,n,a,c,d,p){this.inputType=t,this.type=n,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let a,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const C=t[w+1];Array.isArray(M)||(M=[M]);const z=n.concat(w);if(M.length===0)return z.error("Expected at least one branch label.");for(const B of M){if(typeof B!="number"&&typeof B!="string")return z.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return z.error("Numeric branch labels must be integer values.");if(a){if(z.checkSubtype(a,ci(B)))return null}else a=ci(B);if(d[String(B)]!==void 0)return z.error("Branch labels must be unique.");d[String(B)]=p.length}const D=n.parse(C,w,c);if(!D)return null;c=c||D.type,p.push(D)}const m=n.parse(t[1],1,ct);if(!m)return null;const y=n.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&n.concat(1).checkSubtype(a,m.type)?null:new vo(a,c,m,d,p,y):null}evaluate(t){const n=this.input.evaluate(t);return(ci(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 bo{constructor(t,n,a){this.type=t,this.branches=n,this.otherwise=a}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let a;n.expectedType&&n.expectedType.kind!=="value"&&(a=n.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=n.parse(t[p],p,tt);if(!m)return null;const y=n.parse(t[p+1],p+1,a);if(!y)return null;c.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 bo(a,c,d)}evaluate(t){for(const[n,a]of this.branches)if(n.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,a]of this.branches)t(n),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,n])=>n.outputDefined())&&this.otherwise.outputDefined()}}class Ha{constructor(t,n,a,c){this.type=t,this.input=n,this.beginIndex=a,this.endIndex=c}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,ct),c=n.parse(t[2],2,Pe);if(!a||!c)return null;if(!yo(a.type,[zi(ct),Ge,ct]))return n.error(`Expected first argument to be of type array or string, but found ${qt(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Pe);return d?new Ha(a.type,a,c,d):null}return new Ha(a.type,a,c)}evaluate(t){const n=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),Gr(n,["string"]))return[...n].slice(a,c).join("");if(Gr(n,["array"]))return n.slice(a,c);throw new li(`Expected first argument to be of type array or string, but found ${qt(ci(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Is(r,t){const n=r.length-1;let a,c,d=0,p=n,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=r[m],c=r[m+1],a<=t){if(m===n||t<c)return m;d=m+1}else{if(!(a>t))throw new li("Input is not a number.");p=m-1}return 0}class Es{constructor(t,n,a){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const a=n.parse(t[1],1,Pe);if(!a)return null;const c=[];let d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],w=p,M=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.',w);if(c.length&&c[c.length-1][0]>=m)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const C=n.parse(y,M,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new Es(d,a,c)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;return c>=n[d-1]?a[d-1].evaluate(t):a[Is(n,c)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Gu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wo,Wa,er=function(){if(Wa)return wo;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return Wa=1,wo=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(n===void 0&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},wo}(),To=Gu(er);class xr{constructor(t,n,a,c,d){this.type=t,this.operator=n,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,n,a,c){let d=0;if(t.name==="exponential")d=Xa(n,t.base,a,c);else if(t.name==="linear")d=Xa(n,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new To(p[0],p[1],p[2],p[3]).solve(Xa(n,1,a,c))}return d}static parse(t,n){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return n.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,Pe),!d)return null;const m=[];let y=null;a==="interpolate-hcl"||a==="interpolate-lab"?y=lr:n.expectedType&&n.expectedType.kind!=="value"&&(y=n.expectedType);for(let w=0;w<p.length;w+=2){const M=p[w],C=p[w+1],z=w+3,D=w+4;if(typeof M!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',z);if(m.length&&m[m.length-1][0]>=M)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',z);const B=n.parse(C,D,y);if(!B)return null;y=y||B.type,m.push([M,B])}return fa(y,Pe)||fa(y,Ji)||fa(y,lr)||fa(y,go)||fa(y,_o)||fa(y,zi(Pe))?new xr(y,a,c,d,m):n.error(`Type ${qt(y)} is not interpolatable.`)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;if(c>=n[d-1])return a[d-1].evaluate(t);const p=Is(n,c),m=xr.interpolationFactor(this.interpolation,c,n[p],n[p+1]),y=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Pn(y,w,m);case"color":return gt.interpolate(y,w,m);case"padding":return Qi.interpolate(y,w,m);case"variableAnchorOffsetCollection":return Ui.interpolate(y,w,m);case"array":return Ua(y,w,m);case"projectionDefinition":return cr.interpolate(y,w,m)}case"interpolate-hcl":return gt.interpolate(y,w,m,"hcl");case"interpolate-lab":return gt.interpolate(y,w,m,"lab")}}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Xa(r,t,n,a){const c=a-n,d=r-n;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const Ut={color:gt.interpolate,number:Pn,padding:Qi.interpolate,variableAnchorOffsetCollection:Ui.interpolate,array:Ua};class ks{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a=null;const c=n.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const 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=c&&d.some(m=>ws(c,m.type));return new ks(p?ct:a,d)}evaluate(t){let n,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Ir&&!a.available&&(n||(n=a.name),a=null,c===this.args.length&&(a=n)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Mo(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 Hl(r,t,n,a){return a.compare(t,n)===0}function Ka(r,t,n){const a=r!=="=="&&r!=="!=";return class Bg{constructor(d,p,m){this.type=tt,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,ct);if(!y)return null;if(!Mo(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${qt(y.type)}'.`);let w=p.parse(d[2],2,ct);if(!w)return null;if(!Mo(m,w.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${qt(w.type)}'.`);if(y.type.kind!==w.type.kind&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${qt(y.type)}' and '${qt(w.type)}'.`);a&&(y.type.kind==="value"&&w.type.kind!=="value"?y=new Or(w.type,[y]):y.type.kind!=="value"&&w.type.kind==="value"&&(w=new Or(y.type,[w])));let M=null;if(d.length===4){if(y.type.kind!=="string"&&w.type.kind!=="string"&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,bs),!M)return null}return new Bg(y,w,M)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!==w.kind||y.kind!=="string"&&y.kind!=="number")throw new li(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${y.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!=="string"||w.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 So=Ka("==",function(r,t,n){return t===n},Hl),Wl=Ka("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!Hl(0,t,n,a)}),Ad=Ka("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),Po=Ka(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),Co=Ka("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),Hr=Ka(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class zs{constructor(t,n,a){this.type=bs,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(t.length!==2)return n.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return n.error("Collator options argument must be an object.");const c=n.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,tt);if(!c)return null;const d=n.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,tt);if(!d)return null;let p=null;return a.locale&&(p=n.parse(a.locale,1,Ge),!p)?null:new zs(c,d,p)}evaluate(t){return new Tt(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 Ya{constructor(t,n,a,c,d){this.type=Ge,this.number=t,this.locale=n,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,n){if(t.length!==3)return n.error("Expected two arguments.");const a=n.parse(t[1],1,Pe);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,Ge),!d))return null;let p=null;if(c.currency&&(p=n.parse(c.currency,1,Ge),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=n.parse(c["min-fraction-digits"],1,Pe),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=n.parse(c["max-fraction-digits"],1,Pe),!y)?null:new Ya(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Io{constructor(t){this.type=pa,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return n.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const 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,Pe),!y))return null;let w=null;if(m["text-font"]&&(w=n.parse(m["text-font"],1,zi(Ge)),!w))return null;let M=null;if(m["text-color"]&&(M=n.parse(m["text-color"],1,lr),!M))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!$a.includes(m["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=n.parse(m["vertical-align"],1,Ge),!C)return null}const z=c[c.length-1];z.scale=y,z.font=w,z.textColor=M,z.verticalAlign=C}else{const y=n.parse(t[p],1,ct);if(!y)return null;const w=y.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Io(c)}evaluate(t){return new yr(this.sections.map(n=>{const a=n.content.evaluate(t);return ci(a)===Wn?new on("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new on(ln(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 As{constructor(t){this.type=Wn,this.input=t}static parse(t,n){if(t.length!==2)return n.error("Expected two arguments.");const a=n.parse(t[1],1,Ge);return a?new As(a):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),a=Ir.fromString(n);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(n)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Xl{constructor(t){this.type=Pe,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 ${qt(a.type)} instead.`):new Xl(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 li(`Expected value to be of type string or array, but found ${qt(ci(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const cn=8192;function Rd(r,t){const n=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(n*c*cn),Math.round(a*c*cn)]}function Kl(r,t){const n=Math.pow(2,t.z);return[(c=(r[0]/cn+t.x)/n,360*c-180),(a=(r[1]/cn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Yn(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 Rs(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function qu(r,t,n){const a=r[0]-t[0],c=r[1]-t[1],d=r[0]-n[0],p=r[1]-n[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Ds(r,t,n,a){return(c=[a[0]-n[0],a[1]-n[1]])[0]*(d=[t[0]-r[0],t[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!Wu(r,t,n,a)||!Wu(n,a,r,t));var c,d}function Dd(r,t,n){for(const a of n)for(let c=0;c<a.length-1;++c)if(Ds(r,t,a[c],a[c+1]))return!0;return!1}function ga(r,t,n=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(qu(r,m[y],m[y+1]))return n;(d=m[y])[1]>(c=r)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function Ld(r,t){for(const n of t)if(ga(r,n))return!0;return!1}function Hu(r,t){for(const n of r)if(!ga(n,t))return!1;for(let n=0;n<r.length-1;++n)if(Dd(r[n],r[n+1],t))return!1;return!0}function Bd(r,t){for(const n of t)if(Hu(r,n))return!0;return!1}function Wu(r,t,n,a){const c=a[0]-n[0],d=a[1]-n[1],p=(r[0]-n[0])*d-c*(r[1]-n[1]),m=(t[0]-n[0])*d-c*(t[1]-n[1]);return p>0&&m<0||p<0&&m>0}function Yl(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=[];for(let p=0;p<r[c].length;p++){const m=Rd(r[c][p],n);Yn(t,m),d.push(m)}a.push(d)}return a}function Jl(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=Yl(r[c],t,n);a.push(d)}return a}function Ql(r,t,n,a){if(r[0]<n[0]||r[0]>n[2]){const c=.5*a;let d=r[0]-n[0]>c?-a:n[0]-r[0]>c?a:0;d===0&&(d=r[0]-n[2]>c?-a:n[2]-r[0]>c?a:0),r[0]+=d}Yn(t,r)}function ec(r,t,n,a){const c=Math.pow(2,a.z)*cn,d=[a.x*cn,a.y*cn],p=[];for(const m of r)for(const y of m){const w=[y.x+d[0],y.y+d[1]];Ql(w,t,n,c),p.push(w)}return p}function Xu(r,t,n,a){const c=Math.pow(2,a.z)*cn,d=[a.x*cn,a.y*cn],p=[];for(const y of r){const w=[];for(const M of y){const C=[M.x+d[0],M.y+d[1]];Yn(t,C),w.push(C)}p.push(w)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const w of y)Ql(w,t,n,c)}var m;return p}class _a{constructor(t,n){this.type=tt,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(Ms(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new _a(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new _a(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new _a(a,a)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const m=Yl(a.coordinates,d,p),y=ec(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!ga(w,m))return!1}if(a.type==="MultiPolygon"){const m=Jl(a.coordinates,d,p),y=ec(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!Ld(w,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const m=Yl(a.coordinates,d,p),y=Xu(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!Hu(w,m))return!1}if(a.type==="MultiPolygon"){const m=Jl(a.coordinates,d,p),y=Xu(n.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const w of y)if(!Bd(w,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ku=class{constructor(r=[],t=(n,a)=>n<a?-1:n>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:n}=this,a=t[r];for(;r>0;){const c=r-1>>1,d=t[c];if(n(a,d)>=0)break;t[r]=d,r=c}t[r]=a}_down(r){const{data:t,compare:n}=this,a=this.length>>1,c=t[r];for(;r<a;){let d=1+(r<<1);const p=d+1;if(p<this.length&&n(t[p],t[d])<0&&(d=p),n(t[d],c)>=0)break;t[r]=t[d],r=d}t[r]=c}};function Eo(r,t,n=0,a=r.length-1,c=Fd){for(;a>n;){if(a-n>600){const y=a-n+1,w=t-n+1,M=Math.log(y),C=.5*Math.exp(2*M/3),z=.5*Math.sqrt(M*C*(y-C)/y)*(w-y/2<0?-1:1);Eo(r,t,Math.max(n,Math.floor(t-w*C/y+z)),Math.min(a,Math.floor(t+(y-w)*C/y+z)),c)}const d=r[t];let p=n,m=a;for(Ls(r,n,t),c(r[a],d)>0&&Ls(r,n,a);p<m;){for(Ls(r,p,m),p++,m--;c(r[p],d)<0;)p++;for(;c(r[m],d)>0;)m--}c(r[n],d)===0?Ls(r,n,m):(m++,Ls(r,m,a)),m<=t&&(n=m+1),t<=m&&(a=m-1)}}function Ls(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Fd(r,t){return r<t?-1:r>t?1:0}function ko(r,t){if(r.length<=1)return[r];const n=[];let a,c;for(const d of r){const p=Ju(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&n.push(a),a=[d]):a.push(d))}if(a&&n.push(a),t>1)for(let d=0;d<n.length;d++)n[d].length<=t||(Eo(n[d],t,1,n[d].length-1,Yu),n[d]=n[d].slice(0,t));return n}function Yu(r,t){return t.area-r.area}function Ju(r){let t=0;for(let n,a,c=0,d=r.length,p=d-1;c<d;p=c++)n=r[c],a=r[p],t+=(a.x-n.x)*(n.y+a.y);return t}const Qu=1/298.257223563,eh=Qu*(2-Qu),tc=Math.PI/180;class zo{constructor(t){const n=6378.137*tc*1e3,a=Math.cos(t*tc),c=1/(1-eh*(1-a*a)),d=Math.sqrt(c);this.kx=n*d*a,this.ky=n*d*c*(1-eh)}distance(t,n){const a=this.wrap(t[0]-n[0])*this.kx,c=(t[1]-n[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,n){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let w=t[y][0],M=t[y][1],C=this.wrap(t[y+1][0]-w)*this.kx,z=(t[y+1][1]-M)*this.ky,D=0;C===0&&z===0||(D=(this.wrap(n[0]-w)*this.kx*C+(n[1]-M)*this.ky*z)/(C*C+z*z),D>1?(w=t[y+1][0],M=t[y+1][1]):D>0&&(w+=C/this.kx*D,M+=z/this.ky*D)),C=this.wrap(n[0]-w)*this.kx,z=(n[1]-M)*this.ky;const B=C*C+z*z;B<m&&(m=B,a=w,c=M,d=y,p=D)}return{point:[a,c],index:d,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function th(r,t){return t[0]-r[0]}function Ao(r){return r[1]-r[0]+1}function Cn(r,t){return r[1]>=r[0]&&r[1]<t}function Ro(r,t){if(r[0]>r[1])return[null,null];const n=Ao(r);if(t){if(n===2)return[r,null];const c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];const a=Math.floor(n/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function ic(r,t){if(!Cn(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)Yn(n,r[a]);return n}function rc(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Yn(t,a);return t}function ih(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function nc(r,t,n){if(!ih(r)||!ih(t))return NaN;let a=0,c=0;return r[2]<t[0]&&(a=t[0]-r[2]),r[0]>t[2]&&(a=r[0]-t[2]),r[1]>t[3]&&(c=r[1]-t[3]),r[3]<t[1]&&(c=t[1]-r[3]),n.distance([0,0],[a,c])}function wt(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function ac(r,t,n,a,c){const d=Math.min(wt(r,[n,a],c),wt(t,[n,a],c)),p=Math.min(wt(n,[r,t],c),wt(a,[r,t],c));return Math.min(d,p)}function Od(r,t,n,a,c){if(!Cn(t,r.length)||!Cn(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 w=a[0];w<a[1];++w){const M=n[w],C=n[w+1];if(Ds(m,y,M,C))return 0;d=Math.min(d,ac(m,y,M,C,c))}}return d}function jd(r,t,n,a,c){if(!Cn(t,r.length)||!Cn(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,c.distance(r[p],n[m])),d===0)return d;return d}function Nd(r,t,n){if(ga(r,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,wt(r,[p,d],n)),a===0))return a;const m=n.pointOnLine(c,r);if(a=Math.min(a,n.distance(r,m.point)),a===0)return a}return a}function Zd(r,t,n,a){if(!Cn(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(ga(r[d],n,!0))return 0;let c=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 w=0,M=y.length,C=M-1;w<M;C=w++){const z=y[C],D=y[w];if(Ds(p,m,z,D))return 0;c=Math.min(c,ac(p,m,z,D,a))}}return c}function rh(r,t){for(const n of r)for(const a of n)if(ga(a,t,!0))return!0;return!1}function Vd(r,t,n,a=1/0){const c=rc(r),d=rc(t);if(a!==1/0&&nc(c,d,n)>=a)return a;if(Rs(c,d)){if(rh(r,t))return 0}else if(rh(t,r))return 0;let p=1/0;for(const m of r)for(let y=0,w=m.length,M=w-1;y<w;M=y++){const C=m[M],z=m[y];for(const D of t)for(let B=0,j=D.length,$=j-1;B<j;$=B++){const X=D[$],ae=D[B];if(Ds(C,z,X,ae))return 0;p=Math.min(p,ac(C,z,X,ae,n))}}return p}function nh(r,t,n,a,c,d){if(!d)return;const p=nc(ic(a,d),c,n);p<t&&r.push([p,d,[0,0]])}function Do(r,t,n,a,c,d,p){if(!d||!p)return;const m=nc(ic(a,d),ic(c,p),n);m<t&&r.push([m,d,p])}function Lo(r,t,n,a,c=1/0){let d=Math.min(a.distance(r[0],n[0][0]),c);if(d===0)return d;const p=new Ku([[0,[0,r.length-1],[0,0]]],th),m=rc(n);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const w=y[1],M=t?50:100;if(Ao(w)<=M){if(!Cn(w,r.length))return NaN;if(t){const C=Zd(r,w,n,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=w[0];C<=w[1];++C){const z=Nd(r[C],n,a);if(d=Math.min(d,z),d===0)return 0}}else{const C=Ro(w,t);nh(p,d,a,r,m,C[0]),nh(p,d,a,r,m,C[1])}}return d}function Bo(r,t,n,a,c,d=1/0){let p=Math.min(d,c.distance(r[0],n[0]));if(p===0)return p;const m=new Ku([[0,[0,r.length-1],[0,n.length-1]]],th);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const w=y[1],M=y[2],C=t?50:100,z=a?50:100;if(Ao(w)<=C&&Ao(M)<=z){if(!Cn(w,r.length)&&Cn(M,n.length))return NaN;let D;if(t&&a)D=Od(r,w,n,M,c),p=Math.min(p,D);else if(t&&!a){const B=r.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(D=wt(n[j],B,c),p=Math.min(p,D),p===0)return p}else if(!t&&a){const B=n.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(D=wt(r[j],B,c),p=Math.min(p,D),p===0)return p}else D=jd(r,w,n,M,c),p=Math.min(p,D)}else{const D=Ro(w,t),B=Ro(M,a);Do(m,p,c,r,n,D[0],B[0]),Do(m,p,c,r,n,D[0],B[1]),Do(m,p,c,r,n,D[1],B[0]),Do(m,p,c,r,n,D[1],B[1])}}return p}function sc(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 ya{constructor(t,n){this.type=Pe,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(Ms(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new ya(a,a.features.map(c=>sc(c.geometry)).flat());if(a.type==="Feature")return new ya(a,sc(a.geometry));if("type"in a&&"coordinates"in a)return new ya(a,sc(a))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(n,a){const c=n.geometry(),d=c.flat().map(y=>Kl([y.x,y.y],n.canonical));if(c.length===0)return NaN;const p=new zo(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Bo(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Bo(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Lo(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 c=n.geometry(),d=c.flat().map(y=>Kl([y.x,y.y],n.canonical));if(c.length===0)return NaN;const p=new zo(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Bo(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Bo(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Lo(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 c=n.geometry();if(c.length===0||c[0].length===0)return NaN;const d=ko(c,0).map(y=>y.map(w=>w.map(M=>Kl([M.x,M.y],n.canonical)))),p=new zo(d[0][0][0][1]);let m=1/0;for(const y of a)for(const w of d){switch(y.type){case"Point":m=Math.min(m,Lo([y.coordinates],!1,w,p,m));break;case"LineString":m=Math.min(m,Lo(y.coordinates,!0,w,p,m));break;case"Polygon":m=Math.min(m,Vd(w,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Ja={"==":So,"!=":Wl,">":Po,"<":Ad,">=":Hr,"<=":Co,array:Or,at:Cs,boolean:Or,case:bo,coalesce:ks,collator:zs,format:Io,image:As,in:qr,"index-of":qa,interpolate:xr,"interpolate-hcl":xr,"interpolate-lab":xr,length:Xl,let:Ga,literal:Kn,match:vo,number:Or,"number-format":Ya,object:Or,slice:Ha,step:Es,string:Or,"to-boolean":zt,"to-color":zt,"to-number":zt,"to-string":zt,var:Mt,within:_a,distance:ya};class jr{constructor(t,n,a,c){this.name=t,this.type=n,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,n){const a=t[0],c=jr.definitions[a];if(!c)return n.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let y=null;for(const[w,M]of m){y=new pt(n.registry,Fo,n.path,null,n.scope);const C=[];let z=!1;for(let D=1;D<t.length;D++){const B=t[D],j=Array.isArray(w)?w[D-1]:w.type,$=y.parse(B,1+C.length,j);if(!$){z=!0;break}C.push($)}if(!z)if(Array.isArray(w)&&w.length!==C.length)y.error(`Expected ${w.length} arguments, but found ${C.length} instead.`);else{for(let D=0;D<C.length;D++){const B=Array.isArray(w)?w[D]:w.type,j=C[D];y.concat(D+1).checkSubtype(B,j.type)}if(y.errors.length===0)return new jr(a,d,M,C)}}if(m.length===1)n.errors.push(...y.errors);else{const w=(m.length?m:p).map(([C])=>{return z=C,Array.isArray(z)?`(${z.map(qt).join(", ")})`:`(${qt(z.type)}...)`;var z}).join(" | "),M=[];for(let C=1;C<t.length;C++){const z=n.parse(t[C],1+M.length);if(!z)return null;M.push(qt(z.type))}n.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,n){jr.definitions=n;for(const a in n)t[a]=jr}}function ah(r,[t,n,a,c]){t=t.evaluate(r),n=n.evaluate(r),a=a.evaluate(r);const d=c?c.evaluate(r):1,p=Xn(t,n,a,d);if(p)throw new li(p);return new gt(t/255,n/255,a/255,d,!1)}function sh(r,t){return r in t}function oc(r,t){const n=t[r];return n===void 0?null:n}function xa(r){return{type:r}}function Fo(r){if(r instanceof Mt)return Fo(r.boundExpression);if(r instanceof jr&&r.name==="error"||r instanceof zs||r instanceof _a||r instanceof ya)return!1;const t=r instanceof zt||r instanceof Or;let n=!0;return r.eachChild(a=>{n=t?n&&Fo(a):n&&a instanceof Kn}),!!n&&Oo(r)&&jo(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Oo(r){if(r instanceof jr&&(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 _a||r instanceof ya)return!1;let t=!0;return r.eachChild(n=>{t&&!Oo(n)&&(t=!1)}),t}function Bs(r){if(r instanceof jr&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!Bs(n)&&(t=!1)}),t}function jo(r,t){if(r instanceof jr&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!jo(a,t)&&(n=!1)}),n}function oh(r){return{result:"success",value:r}}function Qa(r){return{result:"error",value:r}}function es(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function lh(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function lc(r){return!!r.expression&&r.expression.interpolated}function It(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function No(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ud(r){return r}function Zo(r,t){const n=t.type==="color",a=r.stops&&typeof r.stops[0][0]=="object",c=a||!(a||r.property!==void 0),d=r.type||(lc(t)?"exponential":"interval");if(n||t.type==="padding"){const M=n?gt.parse:Qi.parse;(r=st({},r)).stops&&(r.stops=r.stops.map(C=>[C[0],M(C[1])])),r.default=M(r.default?r.default:t.default)}if(r.colorSpace&&(p=r.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var p;let m,y,w;if(d==="exponential")m=cc;else if(d==="interval")m=Gd;else if(d==="categorical"){m=$d,y=Object.create(null);for(const M of r.stops)y[M[0]]=M[1];w=typeof r.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);m=qd}if(a){const M={},C=[];for(let B=0;B<r.stops.length;B++){const j=r.stops[B],$=j[0].zoom;M[$]===void 0&&(M[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},C.push($)),M[$].stops.push([j[0].value,j[1]])}const z=[];for(const B of C)z.push([M[B].zoom,Zo(M[B],t)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:xr.interpolationFactor.bind(void 0,D),zoomStops:z.map(B=>B[0]),evaluate:({zoom:B},j)=>cc({stops:z,base:r.base},t,B).evaluate(B,j)}}if(c){const M=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:xr.interpolationFactor.bind(void 0,M),zoomStops:r.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(r,t,C,y,w)}}return{kind:"source",evaluate(M,C){const z=C&&C.properties?C.properties[r.property]:void 0;return z===void 0?Fs(r.default,t.default):m(r,t,z,y,w)}}}function Fs(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function $d(r,t,n,a,c){return Fs(typeof n===c?a[n]:void 0,r.default,t.default)}function Gd(r,t,n){if(It(n)!=="number")return Fs(r.default,t.default);const a=r.stops.length;if(a===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[a-1][0])return r.stops[a-1][1];const c=Is(r.stops.map(d=>d[0]),n);return r.stops[c][1]}function cc(r,t,n){const a=r.base!==void 0?r.base:1;if(It(n)!=="number")return Fs(r.default,t.default);const c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];const d=Is(r.stops.map(M=>M[0]),n),p=function(M,C,z,D){const B=D-z,j=M-z;return B===0?0:C===1?j/B:(Math.pow(C,j)-1)/(Math.pow(C,B)-1)}(n,a,r.stops[d][0],r.stops[d+1][0]),m=r.stops[d][1],y=r.stops[d+1][1],w=Ut[t.type]||Ud;return typeof m.evaluate=="function"?{evaluate(...M){const C=m.evaluate.apply(void 0,M),z=y.evaluate.apply(void 0,M);if(C!==void 0&&z!==void 0)return w(C,z,p,r.colorSpace)}}:w(m,y,p,r.colorSpace)}function qd(r,t,n){switch(t.type){case"color":n=gt.parse(n);break;case"formatted":n=yr.fromString(n.toString());break;case"resolvedImage":n=Ir.fromString(n.toString());break;case"padding":n=Qi.parse(n);break;default:It(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return Fs(n,r.default,t.default)}jr.register(Ja,{error:[{kind:"error"},[Ge],(r,[t])=>{throw new li(t.evaluate(r))}],typeof:[Ge,[ct],(r,[t])=>qt(ci(t.evaluate(r)))],"to-rgba":[zi(Pe,4),[lr],(r,[t])=>{const[n,a,c,d]=t.evaluate(r).rgb;return[255*n,255*a,255*c,d]}],rgb:[lr,[Pe,Pe,Pe],ah],rgba:[lr,[Pe,Pe,Pe,Pe],ah],has:{type:tt,overloads:[[[Ge],(r,[t])=>sh(t.evaluate(r),r.properties())],[[Ge,Qt],(r,[t,n])=>sh(t.evaluate(r),n.evaluate(r))]]},get:{type:ct,overloads:[[[Ge],(r,[t])=>oc(t.evaluate(r),r.properties())],[[Ge,Qt],(r,[t,n])=>oc(t.evaluate(r),n.evaluate(r))]]},"feature-state":[ct,[Ge],(r,[t])=>oc(t.evaluate(r),r.featureState||{})],properties:[Qt,[],r=>r.properties()],"geometry-type":[Ge,[],r=>r.geometryType()],id:[ct,[],r=>r.id()],zoom:[Pe,[],r=>r.globals.zoom],"heatmap-density":[Pe,[],r=>r.globals.heatmapDensity||0],"line-progress":[Pe,[],r=>r.globals.lineProgress||0],accumulated:[ct,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Pe,xa(Pe),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[Pe,xa(Pe),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:Pe,overloads:[[[Pe,Pe],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[Pe],(r,[t])=>-t.evaluate(r)]]},"/":[Pe,[Pe,Pe],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[Pe,[Pe,Pe],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[Pe,[],()=>Math.LN2],pi:[Pe,[],()=>Math.PI],e:[Pe,[],()=>Math.E],"^":[Pe,[Pe,Pe],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[Pe,[Pe],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[Pe,[Pe],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[Pe,[Pe],(r,[t])=>Math.log(t.evaluate(r))],log2:[Pe,[Pe],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[Pe,[Pe],(r,[t])=>Math.sin(t.evaluate(r))],cos:[Pe,[Pe],(r,[t])=>Math.cos(t.evaluate(r))],tan:[Pe,[Pe],(r,[t])=>Math.tan(t.evaluate(r))],asin:[Pe,[Pe],(r,[t])=>Math.asin(t.evaluate(r))],acos:[Pe,[Pe],(r,[t])=>Math.acos(t.evaluate(r))],atan:[Pe,[Pe],(r,[t])=>Math.atan(t.evaluate(r))],min:[Pe,xa(Pe),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[Pe,xa(Pe),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[Pe,[Pe],(r,[t])=>Math.abs(t.evaluate(r))],round:[Pe,[Pe],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[Pe,[Pe],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[Pe,[Pe],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[tt,[Ge,ct],(r,[t,n])=>r.properties()[t.value]===n.value],"filter-id-==":[tt,[ct],(r,[t])=>r.id()===t.value],"filter-type-==":[tt,[Ge],(r,[t])=>r.geometryType()===t.value],"filter-<":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<c}],"filter-id-<":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>c}],"filter-id->":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[tt,[Ge,ct],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[tt,[ct],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[tt,[ct],(r,[t])=>t.value in r.properties()],"filter-has-id":[tt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[tt,[zi(Ge)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[tt,[zi(ct)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[tt,[Ge,zi(ct)],(r,[t,n])=>n.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[tt,[Ge,zi(ct)],(r,[t,n])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(r.properties()[t.value],n.value,0,n.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(r,[t,n])=>t.evaluate(r)&&n.evaluate(r)],[xa(tt),(r,t)=>{for(const n of t)if(!n.evaluate(r))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(r,[t,n])=>t.evaluate(r)||n.evaluate(r)],[xa(tt),(r,t)=>{for(const n of t)if(n.evaluate(r))return!0;return!1}]]},"!":[tt,[tt],(r,[t])=>!t.evaluate(r)],"is-supported-script":[tt,[Ge],(r,[t])=>{const n=r.globals&&r.globals.isSupportedScript;return!n||n(t.evaluate(r))}],upcase:[Ge,[Ge],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[Ge,[Ge],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[Ge,xa(ct),(r,t)=>t.map(n=>ln(n.evaluate(r))).join("")],"resolved-locale":[Ge,[bs],(r,[t])=>t.evaluate(r).resolvedLocale()]});class uc{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new Ct,this._defaultValue=n?(a=n).type==="color"&&No(a.default)?new gt(0,0,0,0):a.type==="color"?gt.parse(a.default)||null:a.type==="padding"?Qi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Ui.parse(a.default)||null:a.type==="projectionDefinition"?cr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=n,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,n,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=n||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const 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 li(`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 va(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ja}function Os(r,t){const n=new pt(Ja,Fo,[],t?function(c){const d={color:lr,string:Ge,number:Pe,enum:Ge,boolean:tt,formatted:pa,padding:go,projectionDefinition:Ji,resolvedImage:Wn,variableAnchorOffsetCollection:_o};return c.type==="array"?zi(d[c.value]||ct,c.length):d[c.type]}(t):void 0),a=n.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?oh(new uc(a,t)):Qa(n.errors)}class hc{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!Bs(n.expression)}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}}class dc{constructor(t,n,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!Bs(n.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}interpolationFactor(t,n,a){return this.interpolationType?xr.interpolationFactor(this.interpolationType,t,n,a):0}}function ch(r,t){const n=Os(r,t);if(n.result==="error")return n;const a=n.value.expression,c=Oo(a);if(!c&&!es(t))return Qa([new St("","data expressions not supported")]);const d=jo(a,["zoom"]);if(!d&&!lh(t))return Qa([new St("","zoom expressions not supported")]);const p=Uo(a);return p||d?p instanceof St?Qa([p]):p instanceof xr&&!lc(t)?Qa([new St("",'"interpolate" expressions cannot be used with this property')]):oh(p?new dc(c?"camera":"composite",n.value,p.labels,p instanceof xr?p.interpolation:void 0):new hc(c?"constant":"source",n.value)):Qa([new St("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(t,n){this._parameters=t,this._specification=n,st(this,Zo(this._parameters,this._specification))}static deserialize(t){return new Vo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Uo(r){let t=null;if(r instanceof Ga)t=Uo(r.result);else if(r instanceof ks){for(const n of r.args)if(t=Uo(n),t)break}else(r instanceof Es||r instanceof xr)&&r.input instanceof jr&&r.input.name==="zoom"&&(t=r);return t instanceof St||r.eachChild(n=>{const a=Uo(n);a instanceof St?t=a:!t&&a?t=new St("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new St("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function $o(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(!$o(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const uh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pc(r){if(r==null)return{filter:()=>!0,needGeometry:!1};$o(r)||(r=js(r));const t=Os(r,uh);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,c)=>t.value.evaluate(n,a,{},c),needGeometry:fc(r)}}function Hd(r,t){return r<t?-1:r>t?1:0}function fc(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(fc(r[t]))return!0;return!1}function js(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?Go(r[1],r[2],"=="):t==="!="?ts(Go(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Go(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(js))):t==="all"?["all"].concat(r.slice(1).map(js)):t==="none"?["all"].concat(r.slice(1).map(js).map(ts)):t==="in"?mc(r[1],r.slice(2)):t==="!in"?ts(mc(r[1],r.slice(2))):t==="has"?qo(r[1]):t!=="!has"||ts(qo(r[1]));var n}function Go(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 mc(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(Hd)]]:["filter-in-small",r,["literal",t]]}}function qo(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ts(r){return["!",r]}function Ns(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(const d of r)c+=`${Ns(d)},`;return`${c}]`}const n=Object.keys(r).sort();let a="{";for(let c=0;c<n.length;c++)a+=`${JSON.stringify(n[c])}:${Ns(r[n[c]])},`;return`${a}}`}function Ho(r){let t="";for(const n of le)t+=`/${Ns(r[n])}`;return t}function hh(r){const t=r.value;return t?[new we(r.key,t,"constants have been deprecated as of v8")]:[]}function gi(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function ba(r){if(Array.isArray(r))return r.map(ba);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=ba(r[n]);return t}return gi(r)}function Nr(r){const t=r.key,n=r.value,a=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,p=r.styleSpec,m=r.validateSpec;let y=[];const w=It(n);if(w!=="object")return[new we(t,n,`object expected, ${w} found`)];for(const M in n){const C=M.split(".")[0],z=a[C]||a["*"];let D;if(c[C])D=c[C];else if(a[C])D=m;else if(c["*"])D=c["*"];else{if(!a["*"]){y.push(new we(t,n[M],`unknown property "${M}"`));continue}D=m}y=y.concat(D({key:(t&&`${t}.`)+M,value:n[M],valueSpec:z,style:d,styleSpec:p,object:n,objectKey:M,validateSpec:m},n))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&n[M]===void 0&&y.push(new we(t,n,`missing required property "${M}"`));return y}function gc(r){const t=r.value,n=r.valueSpec,a=r.style,c=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(It(t)!=="array")return[new we(d,t,`array expected, ${It(t)} found`)];if(n.length&&t.length!==n.length)return[new we(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new we(d,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let m={type:n.value,values:n.values};c.$version<7&&(m.function=n.function),It(n.value)==="object"&&(m=n.value);let y=[];for(let w=0;w<t.length;w++)y=y.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:m,validateSpec:r.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return y}function _c(r){const t=r.key,n=r.value,a=r.valueSpec;let c=It(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new we(t,n,`number expected, ${c} found`)]:"minimum"in a&&n<a.minimum?[new we(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new we(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function yc(r){const t=r.valueSpec,n=gi(r.value.type);let a,c,d,p={};const m=n!=="categorical"&&r.value.property===void 0,y=!m,w=It(r.value.stops)==="array"&&It(r.value.stops[0])==="array"&&It(r.value.stops[0][0])==="object",M=Nr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(D){if(n==="identity")return[new we(D.key,D.value,'identity function may not have a "stops" property')];let B=[];const j=D.value;return B=B.concat(gc({key:D.key,value:j,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:C})),It(j)==="array"&&j.length===0&&B.push(new we(D.key,j,"array must have at least one stop")),B},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return n==="identity"&&m&&M.push(new we(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||M.push(new we(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!lc(r.valueSpec)&&M.push(new we(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(y&&!es(r.valueSpec)?M.push(new we(r.key,r.value,"property functions not supported")):m&&!lh(r.valueSpec)&&M.push(new we(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!w||r.value.property!==void 0||M.push(new we(r.key,r.value,'"property" property is required')),M;function C(D){let B=[];const j=D.value,$=D.key;if(It(j)!=="array")return[new we($,j,`array expected, ${It(j)} found`)];if(j.length!==2)return[new we($,j,`array length 2 expected, length ${j.length} found`)];if(w){if(It(j[0])!=="object")return[new we($,j,`object expected, ${It(j[0])} found`)];if(j[0].zoom===void 0)return[new we($,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new we($,j,"object stop key must have value")];if(d&&d>gi(j[0].zoom))return[new we($,j[0].zoom,"stop zoom values must appear in ascending order")];gi(j[0].zoom)!==d&&(d=gi(j[0].zoom),c=void 0,p={}),B=B.concat(Nr({key:`${$}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:_c,value:z}}))}else B=B.concat(z({key:`${$}[0]`,value:j[0],validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},j));return va(ba(j[1]))?B.concat([new we(`${$}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(D.validateSpec({key:`${$}[1]`,value:j[1],valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function z(D,B){const j=It(D.value),$=gi(D.value),X=D.value!==null?D.value:B;if(a){if(j!==a)return[new we(D.key,X,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new we(D.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&n!=="categorical"){let ae=`number expected, ${j} found`;return es(t)&&n===void 0&&(ae+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(D.key,X,ae)]}return n!=="categorical"||j!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&j==="number"&&c!==void 0&&$<c?[new we(D.key,X,"stop domain values must appear in ascending order")]:(c=$,n==="categorical"&&$ in p?[new we(D.key,X,"stop domain values must be unique")]:(p[$]=!0,[])):[new we(D.key,X,`integer expected, found ${$}`)]}}function wa(r){const t=(r.expressionContext==="property"?ch:Os)(ba(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new we(`${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 we(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"&&!Bs(n))return[new we(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Bs(n))return[new we(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!jo(n,["zoom","feature-state"]))return[new we(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Oo(n))return[new we(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jn(r){const t=r.key,n=r.value,a=r.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(gi(n))===-1&&c.push(new we(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(gi(n))===-1&&c.push(new we(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function xc(r){return $o(ba(r.value))?wa(st({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):vc(r)}function vc(r){const t=r.value,n=r.key;if(It(t)!=="array")return[new we(n,t,`array expected, ${It(t)} found`)];const a=r.styleSpec;let c,d=[];if(t.length<1)return[new we(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Jn({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),gi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&gi(t[1])==="$type"&&d.push(new we(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new we(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=It(t[1]),c!=="string"&&d.push(new we(`${n}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=It(t[p]),gi(t[1])==="$type"?d=d.concat(Jn({key:`${n}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new we(`${n}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(vc({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=It(t[1]),t.length!==2?d.push(new we(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new we(`${n}[1]`,t[1],`string expected, ${c} found`))}return d}function bc(r,t){const n=r.key,a=r.validateSpec,c=r.style,d=r.styleSpec,p=r.value,m=r.objectKey,y=d[`${t}_${r.layerType}`];if(!y)return[];const w=m.match(/^(.*)-transition$/);if(t==="paint"&&w&&y[w[1]]&&y[w[1]].transition)return a({key:n,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=r.valueSpec||y[m];if(!M)return[new we(n,p,`unknown property "${m}"`)];let C;if(It(p)==="string"&&es(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new we(n,p,`"${m}" does not support interpolation syntax
6
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const z=[];return r.layerType==="symbol"&&(m==="text-field"&&c&&!c.glyphs&&z.push(new we(n,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&No(ba(p))&&gi(p.type)==="identity"&&z.push(new we(n,p,'"text-font" does not support identity functions'))),z.concat(a({key:r.key,value:p,valueSpec:M,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function dh(r){return bc(r,"paint")}function wc(r){return bc(r,"layout")}function Tc(r){let t=[];const n=r.value,a=r.key,c=r.style,d=r.styleSpec;n.type||n.ref||t.push(new we(a,n,'either "type" or "ref" is required'));let p=gi(n.type);const m=gi(n.ref);if(n.id){const y=gi(n.id);for(let w=0;w<r.arrayIndex;w++){const M=c.layers[w];gi(M.id)===y&&t.push(new we(a,n.id,`duplicate layer id "${n.id}", previously used at line ${M.id.__line__}`))}}if("ref"in n){let y;["type","source","source-layer","filter","layout"].forEach(w=>{w in n&&t.push(new we(a,n[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{gi(w.id)===m&&(y=w)}),y?y.ref?t.push(new we(a,n.ref,"ref cannot reference another ref layer")):p=gi(y.type):t.push(new we(a,n.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(n.source){const y=c.sources&&c.sources[n.source],w=y&&gi(y.type);y?w==="vector"&&p==="raster"?t.push(new we(a,n.source,`layer "${n.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new we(a,n.source,`layer "${n.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new we(a,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new we(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!n.paint||!n.paint["line-gradient"]||w==="geojson"&&y.lineMetrics||t.push(new we(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new we(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new we(a,n.source,`source "${n.source}" not found`))}else t.push(new we(a,n,'missing required property "source"'));return t=t.concat(Nr({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:xc,layout:y=>Nr({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>wc(st({layerType:p},w))}}),paint:y=>Nr({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>dh(st({layerType:p},w))}})}})),t}function Wr(r){const t=r.value,n=r.key,a=It(t);return a!=="string"?[new we(n,t,`string expected, ${a} found`)]:[]}const ph={promoteId:function({key:r,value:t}){if(It(t)==="string")return Wr({key:r,value:t});{const n=[];for(const a in t)n.push(...Wr({key:`${r}.${a}`,value:t[a]}));return n}}};function fh(r){const t=r.value,n=r.key,a=r.styleSpec,c=r.style,d=r.validateSpec;if(!t.type)return[new we(n,t,'"type" is required')];const p=gi(t.type);let m;switch(p){case"vector":case"raster":return m=Nr({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:ph,validateSpec:d}),m;case"raster-dem":return m=function(y){var w;const M=(w=y.sourceName)!==null&&w!==void 0?w:"",C=y.value,z=y.styleSpec,D=z.source_raster_dem,B=y.style;let j=[];const $=It(C);if(C===void 0)return j;if($!=="object")return j.push(new we("source_raster_dem",C,`object expected, ${$} found`)),j;const X=gi(C.encoding)==="custom",ae=["redFactor","greenFactor","blueFactor","baseShift"],Y=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const R in C)!X&&ae.includes(R)?j.push(new we(R,C[R],`In "${M}": "${R}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):D[R]?j=j.concat(y.validateSpec({key:R,value:C[R],valueSpec:D[R],validateSpec:y.validateSpec,style:B,styleSpec:z})):j.push(new we(R,C[R],`unknown property "${R}"`));return j}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=Nr({key:n,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:ph}),t.cluster)for(const y in t.clusterProperties){const[w,M]=t.clusterProperties[y],C=typeof w=="string"?[w,["accumulated"],["get",y]]:w;m.push(...wa({key:`${n}.${y}.map`,value:M,expressionContext:"cluster-map"})),m.push(...wa({key:`${n}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return m;case"video":return Nr({key:n,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Nr({key:n,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new we(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jn({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function mh(r){const t=r.value,n=r.styleSpec,a=n.light,c=r.style;let d=[];const p=It(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("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:c,styleSpec:n}):a[m]?r.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new we(m,t[m],`unknown property "${m}"`)])}return d}function gh(r){const t=r.value,n=r.styleSpec,a=n.sky,c=r.style,d=It(t);if(t===void 0)return[];if(d!=="object")return[new we("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:c,styleSpec:n}):[new we(m,t[m],`unknown property "${m}"`)]);return p}function _h(r){const t=r.value,n=r.styleSpec,a=n.terrain,c=r.style;let d=[];const p=It(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("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:c,styleSpec:n}):[new we(m,t[m],`unknown property "${m}"`)]);return d}function yh(r){let t=[];const n=r.value,a=r.key;if(Array.isArray(n)){const c=[],d=[];for(const p in n)n[p].id&&c.includes(n[p].id)&&t.push(new we(a,n,`all the sprites' ids must be unique, but ${n[p].id} is duplicated`)),c.push(n[p].id),n[p].url&&d.includes(n[p].url)&&t.push(new we(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(Nr({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return Wr({key:a,value:n})}const is={"*":()=>[],array:gc,boolean:function(r){const t=r.value,n=r.key,a=It(t);return a!=="boolean"?[new we(n,t,`boolean expected, ${a} found`)]:[]},number:_c,color:function(r){const t=r.key,n=r.value,a=It(n);return a!=="string"?[new we(t,n,`color expected, ${a} found`)]:gt.parse(String(n))?[]:[new we(t,n,`color expected, "${n}" found`)]},constants:hh,enum:Jn,filter:xc,function:yc,layer:Tc,object:Nr,source:fh,light:mh,sky:gh,terrain:_h,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,c=r.style,d=It(t);if(t===void 0)return[];if(d!=="object")return[new we("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:c,styleSpec:n}):[new we(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=It(n);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(n)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(n)?["array","string"].includes(a)?[]:[new we(t,n,`projection expected, invalid type "${a}" found`)]:[new we(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:Wr,formatted:function(r){return Wr(r).length===0?[]:wa(r)},resolvedImage:function(r){return Wr(r).length===0?[]:wa(r)},padding:function(r){const t=r.key,n=r.value;if(It(n)==="array"){if(n.length<1||n.length>4)return[new we(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${t}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:a}));return c}return _c({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=It(n),c=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new we(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(Jn({key:`${t}[${p}]`,value:n[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(gc({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:yh};function Qn(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=Qn,n.expression&&No(gi(t))?yc(r):n.expression&&va(ba(t))?wa(r):n.type&&is[n.type]?is[n.type](r):Nr(st({},r,{valueSpec:n.type?a[n.type]:n}))}function vr(r){const t=r.value,n=r.key,a=Wr(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new we(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new we(n,t,'"glyphs" url must include a "{range}" token'))),a}function ur(r,t=V){let n=[];return n=n.concat(Qn({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:Qn,objectElementValidators:{glyphs:vr,"*":()=>[]}})),r.constants&&(n=n.concat(hh({key:"constants",value:r.constants}))),xh(n)}function Xr(r){return function(t){return r({...t,validateSpec:Qn})}}function xh(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function un(r){return function(...t){return xh(r.apply(this,t))}}ur.source=un(Xr(fh)),ur.sprite=un(Xr(yh)),ur.glyphs=un(Xr(vr)),ur.light=un(Xr(mh)),ur.sky=un(Xr(gh)),ur.terrain=un(Xr(_h)),ur.layer=un(Xr(Tc)),ur.filter=un(Xr(xc)),ur.paintProperty=un(Xr(dh)),ur.layoutProperty=un(Xr(wc));const hn=ur,vh=hn.light,Mc=hn.sky,Wd=hn.paintProperty,Sc=hn.layoutProperty;function bh(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new G(new Error(a.message))),n=!0;return n}class In{constructor(t,n,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(n=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const w=p[3+y],M=p[3+y+1];c.push(w===M?null:p.subarray(w,M))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=n+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=a,this.scale=n/t,this.uid=0;const d=a/n*t;this.min=-d,this.max=t+d}insert(t,n,a,c,d){this._forEachCell(n,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,n,a,c,d,p){this.cells[d].push(p)}query(t,n,a,c,d){const p=this.min,m=this.max;if(t<=p&&n<=p&&m<=a&&m<=c&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,n,a,c,this._queryCell,y,{},d),y}}_queryCell(t,n,a,c,d,p,m,y){const w=this.cells[d];if(w!==null){const M=this.keys,C=this.bboxes;for(let z=0;z<w.length;z++){const D=w[z];if(m[D]===void 0){const B=4*D;(y?y(C[B+0],C[B+1],C[B+2],C[B+3]):t<=C[B+2]&&n<=C[B+3]&&a>=C[B+0]&&c>=C[B+1])?(m[D]=!0,p.push(M[D])):m[D]=!1}}}}_forEachCell(t,n,a,c,d,p,m,y){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(n),C=this._convertToCellCoord(a),z=this._convertToCellCoord(c);for(let D=w;D<=C;D++)for(let B=M;B<=z;B++){const j=this.d*B+D;if((!y||y(this._convertFromCellCoord(D),this._convertFromCellCoord(B),this._convertFromCellCoord(D+1),this._convertFromCellCoord(B+1)))&&d.call(this,t,n,a,c,j,p,m,y))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,n=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(n+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let p=0;p<t.length;p++){const m=t[p];c[3+p]=d,c.set(m,d),d+=m.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,n){const a=t.toArrayBuffer();return n&&n.push(a),{buffer:a}}static deserialize(t){return new In(t.buffer)}}const En={};function Ue(r,t,n={}){if(En[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),En[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}Ue("Object",Object),Ue("TransferableGridIndex",In),Ue("Color",gt),Ue("Error",Error),Ue("AJAXError",Hn),Ue("ResolvedImage",Ir),Ue("StylePropertyFunction",Vo),Ue("StyleExpression",uc,{omit:["_evaluator"]}),Ue("ZoomDependentExpression",dc),Ue("ZoomConstantExpression",hc),Ue("CompoundExpression",jr,{omit:["_evaluate"]});for(const r in Ja)Ja[r]._classRegistryKey||Ue(`Expression_${r}`,Ja[r]);function wh(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Pc(r){return r.$name||r.constructor._classRegistryKey}function Zs(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=Pc(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||wh(r)||fr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Vs(r,t){if(Zs(r))return(wh(r)||fr(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(Vs(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=Pc(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!En[n])throw new Error(`${n} is not registered.`);const{klass:a}=En[n],c=a.serialize?a.serialize(r,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in r){if(!r.hasOwnProperty(d)||En[n].omit.indexOf(d)>=0)continue;const p=r[d];c[d]=En[n].shallow.indexOf(d)>=0?p:Vs(p,t)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function Ta(r){if(Zs(r))return r;if(Array.isArray(r))return r.map(Ta);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=Pc(r)||"Object";if(!En[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=En[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(r);const a=Object.create(n.prototype);for(const c of Object.keys(r)){if(c==="$name")continue;const d=r[c];a[c]=En[t].shallow.indexOf(c)>=0?d:Ta(d)}return a}class Us{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 xt={"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 Wo(r){for(const t of r)if(Ko(t.charCodeAt(0)))return!0;return!1}function Th(r){for(const t of r)if(!Mh(t.charCodeAt(0)))return!1;return!0}function Xo(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 Cc=Xo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Mh(r){return!Cc.test(String.fromCodePoint(r))}const Sh=Xo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ko(r){return!(r!==746&&r!==747&&(r<4352||!(xt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||xt["CJK Compatibility"](r)||xt["CJK Strokes"](r)||!(!xt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||xt["Enclosed CJK Letters and Months"](r)||xt["Ideographic Description Characters"](r)||xt.Kanbun(r)||xt.Katakana(r)&&r!==12540||!(!xt["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)||!(!xt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||xt["Vertical Forms"](r)||xt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Sh.test(String.fromCodePoint(r)))))}function Ph(r){return!(Ko(r)||function(t){return!!(xt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||xt["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)||xt["Letterlike Symbols"](t)||xt["Number Forms"](t)||xt["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)||xt["Control Pictures"](t)&&t!==9251||xt["Optical Character Recognition"](t)||xt["Enclosed Alphanumerics"](t)||xt["Geometric Shapes"](t)||xt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||xt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||xt["CJK Symbols and Punctuation"](t)||xt.Katakana(t)||xt["Private Use Area"](t)||xt["CJK Compatibility Forms"](t)||xt["Small Form Variants"](t)||xt["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 Ch=Xo(["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 Ic(r){return Ch.test(String.fromCodePoint(r))}function Ih(r,t){return!(!t&&Ic(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||xt.Khmer(r))}function Xd(r){for(const t of r)if(Ic(t.charCodeAt(0)))return!0;return!1}const ea=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(ea.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const n=r.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(n);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)})}};class Ht{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 Us,this.transition={})}isSupportedScript(t){return function(n,a){for(const c of n)if(!Ih(c.charCodeAt(0),a))return!1;return!0}(t,ea.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 $s{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,c){if(No(a))return new Vo(a,c);if(va(a)){const d=ch(a,c);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return c.type==="color"&&typeof a=="string"?d=gt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Ui.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=cr.parse(a)):d=Qi.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 Yo{constructor(t){this.property=t,this.value=new $s(t,void 0)}transitioned(t,n){return new Gs(this.property,this.value,n,Yi({},t.transition,this.transition),t.now)}untransitioned(){return new Gs(this.property,this.value,null,{},0)}}class Ec{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return ar(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Yo(this._values[t].property)),this._values[t].value=new $s(this._values[t].property,n===null?void 0:ar(n))}getTransition(t){return ar(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Yo(this._values[t].property)),this._values[t].transition=ar(n)||void 0}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a);const c=this.getTransition(n);c!==void 0&&(t[`${n}-transition`]=c)}return t}transitioned(t,n){const a=new Eh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,n._values[c]);return a}untransitioned(){const t=new Eh(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class Gs{constructor(t,n,a,c,d){this.property=t,this.value=n,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,n,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,n,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,n,a);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,n,a),d,ki(m))}}return d}}class Eh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const c=new Jo(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class kc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return ar(this._values[t].value)}setValue(t,n){this._values[t]=new $s(this._values[t].property,n===null?void 0:ar(n))}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a)}return t}possiblyEvaluate(t,n,a){const c=new Jo(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}}class dn{constructor(t,n,a){this.property=t,this.value=n,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,n,a,c){return this.property.evaluate(this.value,this.parameters,t,n,a,c)}}class Jo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ye{constructor(t){this.specification=t}possiblyEvaluate(t,n){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(n)}interpolate(t,n,a){const c=Ut[this.specification.type];return c?c(t,n,a):t}}class at{constructor(t,n){this.specification=t,this.overrides=n}possiblyEvaluate(t,n,a,c){return new dn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(n,null,{},a,c)}:t.expression,n)}interpolate(t,n,a){if(t.value.kind!=="constant"||n.value.kind!=="constant")return t;if(t.value.value===void 0||n.value.value===void 0)return new dn(this,{kind:"constant",value:void 0},t.parameters);const c=Ut[this.specification.type];if(c){const d=c(t.value.value,n.value.value,a);return new dn(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,n,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(n,a,c,d,p)}}class qs extends at{possiblyEvaluate(t,n,a,c){if(t.value===void 0)return new dn(this,{kind:"constant",value:void 0},n);if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,n);return new dn(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 dn(this,{kind:"constant",value:d},n)}return new dn(this,t.expression,n)}evaluate(t,n,a,c,d,p){if(t.kind==="source"){const m=t.evaluate(n,a,c,d,p);return this._calculate(m,m,m,n)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(n.zoom)-1},a,c),t.evaluate({zoom:Math.floor(n.zoom)},a,c),t.evaluate({zoom:Math.floor(n.zoom)+1},a,c),n):t.value}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class zc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c);return this._calculate(d,d,d,n)}return this._calculate(t.expression.evaluate(new Ht(Math.floor(n.zoom-1),n)),t.expression.evaluate(new Ht(Math.floor(n.zoom),n)),t.expression.evaluate(new Ht(Math.floor(n.zoom+1),n)),n)}}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class Ac{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){return!!t.expression.evaluate(n,null,{},a,c)}interpolate(){return!1}}class br{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in t){const a=t[n];a.specification.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new $s(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new Yo(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}Ue("DataDrivenProperty",at),Ue("DataConstantProperty",Ye),Ue("CrossFadedDataDrivenProperty",qs),Ue("CrossFadedProperty",zc),Ue("ColorRampProperty",Ac);const kh="-transition";class pn extends J{constructor(t,n){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),n.layout&&(this._unevaluatedLayout=new kc(n.layout)),n.paint)){this._transitionablePaint=new Ec(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 Jo(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(Sc,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(kh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(Wd,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(kh))return this._transitionablePaint.setTransition(t.slice(0,-11),n||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.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),ha(t,(n,a)=>!(n===void 0||a==="layout"&&!Object.keys(n).length||a==="paint"&&!Object.keys(n).length))}_validate(t,n,a,c,d={}){return(!d||d.validate!==!1)&&bh(this,t.call(hn,{key:n,layerType:this.type,objectKey:a,value:c,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const n=this.paint.get(t);if(n instanceof dn&&es(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const rs={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Hs{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 ui{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 vi(r,t=1){let n=0,a=0;return{members:r.map(c=>{const d=rs[c.type].BYTES_PER_ELEMENT,p=n=Rc(n,Math.max(t,d)),m=c.components||1;return a=Math.max(a,d),n+=d*m,{name:c.name,type:c.type,components:m,offset:p}}),size:Rc(n,Math.max(a,t)),alignment:t}}function Rc(r,t){return Math.ceil(r/t)*t}class Ws extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.int16[c+0]=n,this.int16[c+1]=a,t}}Ws.prototype.bytesPerElement=4,Ue("StructArrayLayout2i4",Ws);class Qo extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.int16[d+0]=n,this.int16[d+1]=a,this.int16[d+2]=c,t}}Qo.prototype.bytesPerElement=6,Ue("StructArrayLayout3i6",Qo);class kn extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.int16[p+0]=n,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}kn.prototype.bytesPerElement=8,Ue("StructArrayLayout4i8",kn);class el extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=6*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}el.prototype.bytesPerElement=12,Ue("StructArrayLayout2i4i12",el);class Xs extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=4*t,w=8*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=m,t}}Xs.prototype.bytesPerElement=8,Ue("StructArrayLayout2i4ub8",Xs);class ns extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.float32[c+0]=n,this.float32[c+1]=a,t}}ns.prototype.bytesPerElement=8,Ue("StructArrayLayout2f8",ns);class Ks extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,n,a,c,d,p,m,y,w,M)}emplace(t,n,a,c,d,p,m,y,w,M,C){const z=10*t;return this.uint16[z+0]=n,this.uint16[z+1]=a,this.uint16[z+2]=c,this.uint16[z+3]=d,this.uint16[z+4]=p,this.uint16[z+5]=m,this.uint16[z+6]=y,this.uint16[z+7]=w,this.uint16[z+8]=M,this.uint16[z+9]=C,t}}Ks.prototype.bytesPerElement=20,Ue("StructArrayLayout10ui20",Ks);class Dc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M,C,z){const D=this.length;return this.resize(D+1),this.emplace(D,t,n,a,c,d,p,m,y,w,M,C,z)}emplace(t,n,a,c,d,p,m,y,w,M,C,z,D){const B=12*t;return this.int16[B+0]=n,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=m,this.uint16[B+6]=y,this.uint16[B+7]=w,this.int16[B+8]=M,this.int16[B+9]=C,this.int16[B+10]=z,this.int16[B+11]=D,t}}Dc.prototype.bytesPerElement=24,Ue("StructArrayLayout4i4ui4i24",Dc);class as extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.float32[d+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}as.prototype.bytesPerElement=12,Ue("StructArrayLayout3f12",as);class Ma extends ui{_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}}Ma.prototype.bytesPerElement=4,Ue("StructArrayLayout1ul4",Ma);class Lc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,n,a,c,d,p,m,y,w)}emplace(t,n,a,c,d,p,m,y,w,M){const C=10*t,z=5*t;return this.int16[C+0]=n,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[z+3]=y,this.uint16[C+8]=w,this.uint16[C+9]=M,t}}Lc.prototype.bytesPerElement=20,Ue("StructArrayLayout6i1ul2ui20",Lc);class tl extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=6*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}tl.prototype.bytesPerElement=12,Ue("StructArrayLayout2i2i2i12",tl);class Sa extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,n,a,c,d)}emplace(t,n,a,c,d,p){const m=4*t,y=8*t;return this.float32[m+0]=n,this.float32[m+1]=a,this.float32[m+2]=c,this.int16[y+6]=d,this.int16[y+7]=p,t}}Sa.prototype.bytesPerElement=16,Ue("StructArrayLayout2f1f2i16",Sa);class Bc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,m){const y=16*t,w=4*t,M=8*t;return this.uint8[y+0]=n,this.uint8[y+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[M+6]=p,this.int16[M+7]=m,t}}Bc.prototype.bytesPerElement=16,Ue("StructArrayLayout2ub2f2i16",Bc);class il extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[d+0]=n,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}il.prototype.bytesPerElement=6,Ue("StructArrayLayout3ui6",il);class rl extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X){const ae=this.length;return this.resize(ae+1),this.emplace(ae,t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X)}emplace(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae){const Y=24*t,R=12*t,U=48*t;return this.int16[Y+0]=n,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[R+2]=p,this.uint32[R+3]=m,this.uint32[R+4]=y,this.uint16[Y+10]=w,this.uint16[Y+11]=M,this.uint16[Y+12]=C,this.float32[R+7]=z,this.float32[R+8]=D,this.uint8[U+36]=B,this.uint8[U+37]=j,this.uint8[U+38]=$,this.uint32[R+10]=X,this.int16[Y+22]=ae,t}}rl.prototype.bytesPerElement=48,Ue("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",rl);class Fc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y,R,U,Q,fe,Ae,ye,ve,De,Re){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y,R,U,Q,fe,Ae,ye,ve,De,Re)}emplace(t,n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y,R,U,Q,fe,Ae,ye,ve,De,Re,Fe){const Me=32*t,qe=16*t;return this.int16[Me+0]=n,this.int16[Me+1]=a,this.int16[Me+2]=c,this.int16[Me+3]=d,this.int16[Me+4]=p,this.int16[Me+5]=m,this.int16[Me+6]=y,this.int16[Me+7]=w,this.uint16[Me+8]=M,this.uint16[Me+9]=C,this.uint16[Me+10]=z,this.uint16[Me+11]=D,this.uint16[Me+12]=B,this.uint16[Me+13]=j,this.uint16[Me+14]=$,this.uint16[Me+15]=X,this.uint16[Me+16]=ae,this.uint16[Me+17]=Y,this.uint16[Me+18]=R,this.uint16[Me+19]=U,this.uint16[Me+20]=Q,this.uint16[Me+21]=fe,this.uint16[Me+22]=Ae,this.uint32[qe+12]=ye,this.float32[qe+13]=ve,this.float32[qe+14]=De,this.uint16[Me+30]=Re,this.uint16[Me+31]=Fe,t}}Fc.prototype.bytesPerElement=64,Ue("StructArrayLayout8i15ui1ul2f2ui64",Fc);class u extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.float32[1*t+0]=n,t}}u.prototype.bytesPerElement=4,Ue("StructArrayLayout1f4",u);class e extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[6*t+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}e.prototype.bytesPerElement=12,Ue("StructArrayLayout1ui2f12",e);class i extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=4*t;return this.uint32[2*t+0]=n,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}i.prototype.bytesPerElement=8,Ue("StructArrayLayout1ul2ui8",i);class s extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.uint16[c+0]=n,this.uint16[c+1]=a,t}}s.prototype.bytesPerElement=4,Ue("StructArrayLayout2ui4",s);class l extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint16[1*t+0]=n,t}}l.prototype.bytesPerElement=2,Ue("StructArrayLayout1ui2",l);class h extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.float32[p+0]=n,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}h.prototype.bytesPerElement=16,Ue("StructArrayLayout4f16",h);class f extends Hs{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)}}f.prototype.size=20;class _ extends Lc{get(t){return new f(this,t)}}Ue("CollisionBoxArray",_);class x extends Hs{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]}}x.prototype.size=48;class T extends rl{get(t){return new x(this,t)}}Ue("PlacedSymbolArray",T);class P extends Hs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}P.prototype.size=64;class E extends Fc{get(t){return new P(this,t)}}Ue("SymbolInstanceArray",E);class k extends u{getoffsetX(t){return this.float32[1*t+0]}}Ue("GlyphOffsetArray",k);class F extends Qo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ue("SymbolLineVertexArray",F);class O extends Hs{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}O.prototype.size=12;class H extends e{get(t){return new O(this,t)}}Ue("TextAnchorOffsetArray",H);class q extends Hs{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}q.prototype.size=8;class W extends i{get(t){return new q(this,t)}}Ue("FeatureIndexArray",W);class K extends Ws{}class ee extends Ws{}class te extends Ws{}class re extends el{}class se extends Xs{}class ne extends ns{}class de extends Ks{}class me extends Dc{}class Te extends as{}class Se extends Ma{}class be extends tl{}class je extends Bc{}class Be extends il{}class ke extends s{}const We=vi([{name:"a_pos",components:2,type:"Int16"}],4),{members:mt}=We;class lt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,n,a,c){const d=this.segments[this.segments.length-1];return t>lt.MAX_VERTEX_ARRAY_LENGTH&&Vi(`Max vertices per segment is ${lt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${lt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>lt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,a,c):d}createNewSegment(t,n,a){const c={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,n,a){return this.prepareSegment(0,t,n,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const n in t.vaos)t.vaos[n].destroy()}static simpleSegment(t,n,a,c){return new lt([{vertexOffset:t,primitiveOffset:n,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function ei(r,t){return 256*(r=Vt(Math.floor(r),0,255))+Vt(Math.floor(t),0,255)}lt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ue("SegmentVector",lt);const Dt=vi([{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 ti,Wt,jt,At={exports:{}},Ri={exports:{}},Pi={exports:{}},$i=function(){if(jt)return At.exports;jt=1;var r=(ti||(ti=1,Ri.exports=function(n,a){var c,d,p,m,y,w,M,C;for(d=n.length-(c=3&n.length),p=a,y=3432918353,w=461845907,C=0;C<d;)M=255&n.charCodeAt(C)|(255&n.charCodeAt(++C))<<8|(255&n.charCodeAt(++C))<<16|(255&n.charCodeAt(++C))<<24,++C,p=27492+(65535&(m=5*(65535&(p=(p^=M=(65535&(M=(M=(65535&M)*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&n.charCodeAt(C+2))<<16;case 2:M^=(255&n.charCodeAt(C+1))<<8;case 1:p^=M=(65535&(M=(M=(65535&(M^=255&n.charCodeAt(C)))*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return p^=n.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),Ri.exports),t=(Wt||(Wt=1,Pi.exports=function(n,a){for(var c,d=n.length,p=a^d,m=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(m)|(255&n.charCodeAt(++m))<<8|(255&n.charCodeAt(++m))<<16|(255&n.charCodeAt(++m))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&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}),Pi.exports);return At.exports=r,At.exports.murmur3=r,At.exports.murmur2=t,At.exports}(),tr=he($i);class fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,c){this.ids.push(ta(t)),this.positions.push(n,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=ta(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=n?c=p:a=p+1}const d=[];for(;this.ids[a]===n;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,n){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return zn(a,c,0,a.length-1),n&&n.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const n=new fn;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function ta(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:tr(String(r))}function zn(r,t,n,a){for(;n<a;){const c=r[n+a>>1];let d=n-1,p=a+1;for(;;){do d++;while(r[d]<c);do p--;while(r[p]>c);if(d>=p)break;An(r,d,p),An(t,3*d,3*p),An(t,3*d+1,3*p+1),An(t,3*d+2,3*p+2)}p-n<a-p?(zn(r,t,n,p),n=p+1):(zn(r,t,p+1,a),a=p)}}function An(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}Ue("FeaturePositionMap",fn);class mn{constructor(t,n){this.gl=t.gl,this.location=n}}class Pa extends mn{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ca extends mn{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 Er extends mn{constructor(t,n){super(t,n),this.current=gt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const ia=new Float32Array(16);function Rn(r){return[ei(255*r.r,255*r.g),ei(255*r.b,255*r.a)]}class Dn{constructor(t,n,a){this.value=t,this.uniformNames=n.map(c=>`u_${c}`),this.type=a}setUniform(t,n,a){t.set(a.constantOr(this.value))}getBinding(t,n,a){return this.type==="color"?new Er(t,n):new Pa(t,n)}}class ai{constructor(t,n){this.uniformNames=n.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=t.tlbr}setUniform(t,n,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,n,a){return a.substr(0,9)==="u_pattern"?new Ca(t,n):new Pa(t,n)}}class Xt{constructor(t,n,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=n.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,n,a,c,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Ht(0),n,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,n,d)}_setPaintValue(t,n,a){if(this.type==="color"){const c=Rn(a);for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<n;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class _i{constructor(t,n,a,c,d,p){this.expression=t,this.uniformNames=n.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=c,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,c,d){const p=this.expression.evaluate(new Ht(this.zoom),n,{},c,[],d),m=this.expression.evaluate(new Ht(this.zoom+1),n,{},c,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,n,d,p)}_setPaintValue(t,n,a,c){if(this.type==="color"){const d=Rn(a),p=Rn(c);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,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,n){const a=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=Vt(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,n,a){return new Pa(t,n)}}class ii{constructor(t,n,a,c,d,p){this.expression=t,this.type=n,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,n,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,n.patterns&&n.patterns[this.layerId],a)}updatePaintArray(t,n,a,c,d){this._setPaintValues(t,n,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,n,a,c){if(!c||!a)return;const{min:d,mid:p,max:m}=a,y=c[d],w=c[p],M=c[m];if(y&&w&&M)for(let C=t;C<n;C++)this.zoomInPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],w.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,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 zh{constructor(t,n,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof dn&&es(p.property.specification)))continue;const m=Kd(d,t.type),y=p.value,w=p.property.specification.type,M=p.property.useIntegerZoom,C=p.property.specification["property-type"],z=C==="cross-faded"||C==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=z?new ai(y.value,m):new Dn(y.value,m,w),c.push(`/u_${d}`);else if(y.kind==="source"||z){const D=Ah(d,w,"source");this.binders[d]=z?new ii(y,w,M,n,D,t.id):new Xt(y,m,w,D),c.push(`/a_${d}`)}else{const D=Ah(d,w,"composite");this.binders[d]=new _i(y,m,w,M,n,D),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const n=this.binders[t];return n instanceof Xt||n instanceof _i?n.maxValue:0}populatePaintArrays(t,n,a,c,d){for(const p in this.binders){const m=this.binders[p];(m instanceof Xt||m instanceof _i||m instanceof ii)&&m.populatePaintArray(t,n,a,c,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const c=this.binders[a];c instanceof ai&&c.setConstantPatternPositions(t,n)}}updatePaintArrays(t,n,a,c,d){let p=!1;for(const m in t){const y=n.getPositions(m);for(const w of y){const M=a.feature(w.index);for(const C in this.binders){const z=this.binders[C];if((z instanceof Xt||z instanceof _i||z instanceof ii)&&z.expression.isStateDependent===!0){const D=c.paint.get(C);z.expression=D.value,z.updatePaintArray(w.start,w.end,M,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const n in this.binders){const a=this.binders[n];(a instanceof Dn||a instanceof ai)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Xt||a instanceof _i)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof ii)for(let c=0;c<Dt.members.length;c++)t.push(Dt.members[c].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Dn||a instanceof ai||a instanceof _i)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,n){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof Dn||d instanceof ai||d instanceof _i){for(const p of d.uniformNames)if(n[p]){const m=d.getBinding(t,n[p],p);a.push({name:p,property:c,binding:m})}}}return a}setUniforms(t,n,a,c){for(const{name:d,property:p,binding:m}of n)this.binders[p].setUniform(m,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const n in this.binders){const a=this.binders[n];if(t&&a instanceof ii){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof Xt||a instanceof _i)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof Xt||a instanceof _i||a instanceof ii)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof Xt||n instanceof _i||n instanceof ii)&&n.destroy()}}}class Ia{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new zh(c,n,a);this.needsUpload=!1,this._featureMap=new fn,this._bufferOffset=0}populatePaintArrays(t,n,a,c,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,n,c,d,p);n.id!==void 0&&this._featureMap.add(n.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,n,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,n,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Kd(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 Ah(r,t,n){const a={color:{source:ns,composite:h},number:{source:u,composite:ns}},c=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 c&&c[n]||a[t][n]}Ue("ConstantBinder",Dn),Ue("CrossFadedConstantBinder",ai),Ue("SourceExpressionBinder",Xt),Ue("CrossFadedCompositeBinder",ii),Ue("CompositeExpressionBinder",_i),Ue("ProgramConfiguration",zh,{omit:["_buffers"]}),Ue("ProgramConfigurationSet",Ia);const Oc=Math.pow(2,14)-1,Rh=-Oc-1;function kr(r){const t=Qe/r.extent,n=r.loadGeometry();for(let a=0;a<n.length;a++){const c=n[a];for(let d=0;d<c.length;d++){const p=c[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=Vt(m,Rh,Oc),p.y=Vt(y,Rh,Oc),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&Vi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function ra(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?kr(r):[]}}const jc=-32768;function Dh(r,t,n,a,c){r.emplaceBack(jc+8*t+a,jc+8*n+c)}class Ys{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ee,this.indexArray=new Be,this.segments=new lt,this.programConfigurations=new Ia(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){const c=this.layers[0],d=[];let p=null,m=!1,y=c.type==="heatmap";if(c.type==="circle"){const M=c;p=M.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||M.paint.get("circle-pitch-alignment")==="map"}const w=y?n.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:z,sourceLayerIndex:D}of t){const B=this.layers[0]._featureFilter.needGeometry,j=ra(M,B);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),j,a))continue;const $=m?p.evaluate(j,{},a):void 0,X={id:C,properties:M.properties,type:M.type,sourceLayerIndex:D,index:z,geometry:B?j.geometry:kr(M),patterns:{},sortKey:$};d.push(X)}m&&d.sort((M,C)=>M.sortKey-C.sortKey);for(const M of d){const{geometry:C,index:z,sourceLayerIndex:D}=M,B=t[z].feature;this.addFeature(M,C,z,a,w),n.featureIndex.insert(B,C,z,D,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,mt),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,n,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const y of n)for(const w of y){const M=w.x,C=w.y;if(M<0||M>=Qe||C<0||C>=Qe)continue;const z=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),D=z.vertexLength;for(let B=0;B<m;B++)for(let j=0;j<m;j++)Dh(this.layoutVertexArray,M,C,p[j],p[B]);for(let B=0;B<m-1;B++)for(let j=0;j<m-1;j++){const $=D+B*m+j,X=D+(B+1)*m+j;this.indexArray.emplaceBack($,X+1,$+1),this.indexArray.emplaceBack($,X,X+1)}z.vertexLength+=m*m,z.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function Nc(r,t){for(let n=0;n<r.length;n++)if(Js(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Js(r,t[n]))return!0;return!!Yd(r,t)}function Zc(r,t,n){return!!Js(r,t)||!!Jd(t,r,n)}function Yf(r,t){if(r.length===1)return Qf(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let c=0;c<a.length;c++)if(Js(r,a[c]))return!0}for(let n=0;n<r.length;n++)if(Qf(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Yd(r,t[n]))return!0;return!1}function yx(r,t,n){if(r.length>1){if(Yd(r,t))return!0;for(let a=0;a<t.length;a++)if(Jd(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(Jd(r[a],t,n))return!0;return!1}function Yd(r,t){if(r.length===0||t.length===0)return!1;for(let n=0;n<r.length-1;n++){const a=r[n],c=r[n+1];for(let d=0;d<t.length-1;d++)if(xx(a,c,t[d],t[d+1]))return!0}return!1}function xx(r,t,n,a){return Nt(r,n,a)!==Nt(t,n,a)&&Nt(r,t,n)!==Nt(r,t,a)}function Jd(r,t,n){const a=n*n;if(t.length===1)return r.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(Jf(r,t[c-1],t[c])<a)return!0;return!1}function Jf(r,t,n){const a=t.distSqr(n);if(a===0)return r.distSqr(t);const c=((r.x-t.x)*(n.x-t.x)+(r.y-t.y)*(n.y-t.y))/a;return r.distSqr(c<0?t:c>1?n:n.sub(t)._mult(c)._add(t))}function Qf(r,t){for(let n=0;n<r.length;n++)if(Js(r[n],t))return!0;return!1}function Js(r,t){let n=!1;for(let a=0,c=r.length-1;a<r.length;c=a++){const d=r[a],p=r[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(n=!n)}return n}function vx(r,t,n){const a=n[0],c=n[2];if(r.x<a.x&&t.x<a.x||r.x>c.x&&t.x>c.x||r.y<a.y&&t.y<a.y||r.y>c.y&&t.y>c.y)return!1;const d=Nt(r,t,n[0]);return d!==Nt(r,t,n[1])||d!==Nt(r,t,n[2])||d!==Nt(r,t,n[3])}function Vc(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function Lh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Bh(r,t,n,a,c){if(!t[0]&&!t[1])return r;const d=Ve.convert(t)._mult(c);n==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<r.length;m++)p.push(r[m].sub(d));return p}let em,tm;Ue("CircleBucket",Ys,{omit:["layers"]});var bx={get paint(){return tm=tm||new br({"circle-radius":new at(V.paint_circle["circle-radius"]),"circle-color":new at(V.paint_circle["circle-color"]),"circle-blur":new at(V.paint_circle["circle-blur"]),"circle-opacity":new at(V.paint_circle["circle-opacity"]),"circle-translate":new Ye(V.paint_circle["circle-translate"]),"circle-translate-anchor":new Ye(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ye(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ye(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new at(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new at(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new at(V.paint_circle["circle-stroke-opacity"])})},get layout(){return em=em||new br({"circle-sort-key":new at(V.layout_circle["circle-sort-key"])})}};class wx extends pn{constructor(t){super(t,bx)}createBucket(t){return new Ys(t)}queryRadius(t){const n=t;return Vc("circle-radius",this,n)+Vc("circle-stroke-width",this,n)+Lh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const w=Bh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),M=this.paint.get("circle-radius").evaluate(n,a)+this.paint.get("circle-stroke-width").evaluate(n,a),C=this.paint.get("circle-pitch-alignment")==="map",z=C?w:function(B,j,$,X){return B.map(ae=>im(ae,j,$,X))}(w,d,m,y),D=C?M*p:M;for(const B of c)for(const j of B){const $=C?j:im(j,d,m,y);let X=D;const ae=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=ae/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/ae),Zc(z,$,X))return!0}return!1}}function im(r,t,n,a){const c=t.projectTileCoordinates(r.x,r.y,n,a).point;return new Ve((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class rm extends Ys{}let nm;Ue("HeatmapBucket",rm,{omit:["layers"]});var Tx={get paint(){return nm=nm||new br({"heatmap-radius":new at(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new at(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ye(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ac(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ye(V.paint_heatmap["heatmap-opacity"])})}};function Qd(r,{width:t,height:n},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*n*a}`)}else c=new Uint8Array(t*n*a);return r.width=t,r.height=n,r.data=c,r}function am(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const c=Qd({},{width:t,height:n},a);ep(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,n)},a),r.width=t,r.height=n,r.data=c.data}function ep(r,t,n,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const w=((n.y+y)*r.width+n.x)*d,M=((a.y+y)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)m[M+C]=p[w+C]}return t}class Uc{constructor(t,n){Qd(this,t,1,n)}resize(t){am(this,t,1)}clone(){return new Uc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){ep(t,n,a,c,d,1)}}class Kr{constructor(t,n){Qd(this,t,4,n)}resize(t){am(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Kr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){ep(t,n,a,c,d,4)}}function sm(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,c=r.image||new Kr({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 w=r.expression.evaluate(t);c.data[p+m+0]=Math.floor(255*w.r/w.a),c.data[p+m+1]=Math.floor(255*w.g/w.a),c.data[p+m+2]=Math.floor(255*w.b/w.a),c.data[p+m+3]=Math.floor(255*w.a)};if(r.clips)for(let p=0,m=0;p<a;++p,m+=4*n)for(let y=0,w=0;y<n;y++,w+=4){const M=y/(n-1),{start:C,end:z}=r.clips[p];d(m,w,C*(1-M)+z*M)}else for(let p=0,m=0;p<n;p++,m+=4)d(0,m,p/(n-1));return c}Ue("AlphaImage",Uc),Ue("RGBAImage",Kr);const tp="big-fb";class Mx extends pn{createBucket(t){return new rm(t)}constructor(t){super(t,Tx),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(tp)&&this.heatmapFbos.delete(tp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let om;var Sx={get paint(){return om=om||new br({"hillshade-illumination-direction":new Ye(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ye(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ye(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ye(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ye(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ye(V.paint_hillshade["hillshade-accent-color"])})}};class Px extends pn{constructor(t){super(t,Sx)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Cx=vi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ix}=Cx;function ip(r,t,n){const a=n.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${r}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,a[m.to]=!0,a[m.from]=!0)}return c}function rp(r,t,n,a,c){const d=c.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,{},c.availableImages),w=m.evaluate({zoom:a},n,{},c.availableImages),M=m.evaluate({zoom:a+1},n,{},c.availableImages);y=y&&y.name?y.name:y,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,d[y]=!0,d[w]=!0,d[M]=!0,n.patterns[p.id]={min:y,mid:w,max:M}}}return n}function lm(r,t,n,a,c){let d;if(c===function(p,m,y,w){let M=0;for(let C=m,z=y-w;C<y;C+=w)M+=(p[z]-p[C])*(p[C+1]+p[z+1]),z=C;return M}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=dm(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=dm(p/a|0,r[p],r[p+1],d);return d&&nl(d,d.next)&&(Hc(d),d=d.next),d}function Qs(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!nl(a,a.next)&&bi(a.prev,a,a.next)!==0)a=a.next;else{if(Hc(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function $c(r,t,n,a,c,d,p){if(!r)return;!p&&d&&function(y,w,M,C){let z=y;do z.z===0&&(z.z=np(z.x,z.y,w,M,C)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==y);z.prevZ.nextZ=null,z.prevZ=null,function(D){let B,j=1;do{let $,X=D;D=null;let ae=null;for(B=0;X;){B++;let Y=X,R=0;for(let Q=0;Q<j&&(R++,Y=Y.nextZ,Y);Q++);let U=j;for(;R>0||U>0&&Y;)R!==0&&(U===0||!Y||X.z<=Y.z)?($=X,X=X.nextZ,R--):($=Y,Y=Y.nextZ,U--),ae?ae.nextZ=$:D=$,$.prevZ=ae,ae=$;X=Y}ae.nextZ=null,j*=2}while(B>1)}(z)}(r,a,c,d);let m=r;for(;r.prev!==r.next;){const y=r.prev,w=r.next;if(d?kx(r,a,c,d):Ex(r))t.push(y.i,r.i,w.i),Hc(r),r=w.next,m=w.next;else if((r=w)===m){p?p===1?$c(r=zx(Qs(r),t),t,n,a,c,d,2):p===2&&Ax(r,t,n,a,c,d):$c(Qs(r),t,n,a,c,d,1);break}}}function Ex(r){const t=r.prev,n=r,a=r.next;if(bi(t,n,a)>=0)return!1;const c=t.x,d=n.x,p=a.x,m=t.y,y=n.y,w=a.y,M=Math.min(c,d,p),C=Math.min(m,y,w),z=Math.max(c,d,p),D=Math.max(m,y,w);let B=a.next;for(;B!==t;){if(B.x>=M&&B.x<=z&&B.y>=C&&B.y<=D&&Gc(c,m,d,y,p,w,B.x,B.y)&&bi(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function kx(r,t,n,a){const c=r.prev,d=r,p=r.next;if(bi(c,d,p)>=0)return!1;const m=c.x,y=d.x,w=p.x,M=c.y,C=d.y,z=p.y,D=Math.min(m,y,w),B=Math.min(M,C,z),j=Math.max(m,y,w),$=Math.max(M,C,z),X=np(D,B,t,n,a),ae=np(j,$,t,n,a);let Y=r.prevZ,R=r.nextZ;for(;Y&&Y.z>=X&&R&&R.z<=ae;){if(Y.x>=D&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Gc(m,M,y,C,w,z,Y.x,Y.y)&&bi(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,R.x>=D&&R.x<=j&&R.y>=B&&R.y<=$&&R!==c&&R!==p&&Gc(m,M,y,C,w,z,R.x,R.y)&&bi(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=D&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Gc(m,M,y,C,w,z,Y.x,Y.y)&&bi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;R&&R.z<=ae;){if(R.x>=D&&R.x<=j&&R.y>=B&&R.y<=$&&R!==c&&R!==p&&Gc(m,M,y,C,w,z,R.x,R.y)&&bi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function zx(r,t){let n=r;do{const a=n.prev,c=n.next.next;!nl(a,c)&&um(a,n,n.next,c)&&qc(a,c)&&qc(c,a)&&(t.push(a.i,n.i,c.i),Hc(n),Hc(n.next),n=r=c),n=n.next}while(n!==r);return Qs(n)}function Ax(r,t,n,a,c,d){let p=r;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Fx(p,m)){let y=hm(p,m);return p=Qs(p,p.next),y=Qs(y,y.next),$c(p,t,n,a,c,d,0),void $c(y,t,n,a,c,d,0)}m=m.next}p=p.next}while(p!==r)}function Rx(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 Dx(r,t){const n=function(c,d){let p=d;const m=c.x,y=c.y;let w,M=-1/0;if(nl(c,p))return p;do{if(nl(c,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>M&&(M=j,w=p.x<p.next.x?p:p.next,j===m))return w}p=p.next}while(p!==d);if(!w)return null;const C=w,z=w.x,D=w.y;let B=1/0;p=w;do{if(m>=p.x&&p.x>=z&&m!==p.x&&cm(y<D?m:M,y,z,D,y<D?M:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);qc(p,c)&&(j<B||j===B&&(p.x>w.x||p.x===w.x&&Lx(w,p)))&&(w=p,B=j)}p=p.next}while(p!==C);return w}(r,t);if(!n)return t;const a=hm(n,r);return Qs(a,a.next),Qs(n,n.next)}function Lx(r,t){return bi(r.prev,r,t.prev)<0&&bi(t.next,r,r.next)<0}function np(r,t,n,a,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Bx(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 cm(r,t,n,a,c,d,p,m){return(c-p)*(t-m)>=(r-p)*(d-m)&&(r-p)*(a-m)>=(n-p)*(t-m)&&(n-p)*(d-m)>=(c-p)*(a-m)}function Gc(r,t,n,a,c,d,p,m){return!(r===p&&t===m)&&cm(r,t,n,a,c,d,p,m)}function Fx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(n,a){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==a.i&&c.next.i!==a.i&&um(c,c.next,n,a))return!0;c=c.next}while(c!==n);return!1}(r,t)&&(qc(r,t)&&qc(t,r)&&function(n,a){let c=n,d=!1;const p=(n.x+a.x)/2,m=(n.y+a.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d}(r,t)&&(bi(r.prev,r,t.prev)||bi(r,t.prev,t))||nl(r,t)&&bi(r.prev,r,r.next)>0&&bi(t.prev,t,t.next)>0)}function bi(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function nl(r,t){return r.x===t.x&&r.y===t.y}function um(r,t,n,a){const c=Oh(bi(r,t,n)),d=Oh(bi(r,t,a)),p=Oh(bi(n,a,r)),m=Oh(bi(n,a,t));return c!==d&&p!==m||!(c!==0||!Fh(r,n,t))||!(d!==0||!Fh(r,a,t))||!(p!==0||!Fh(n,r,a))||!(m!==0||!Fh(n,t,a))}function Fh(r,t,n){return t.x<=Math.max(r.x,n.x)&&t.x>=Math.min(r.x,n.x)&&t.y<=Math.max(r.y,n.y)&&t.y>=Math.min(r.y,n.y)}function Oh(r){return r>0?1:r<0?-1:0}function qc(r,t){return bi(r.prev,r,r.next)<0?bi(r,t,r.next)>=0&&bi(r,r.prev,t)>=0:bi(r,t,r.prev)<0||bi(r,r.next,t)<0}function hm(r,t){const n=ap(r.i,r.x,r.y),a=ap(t.i,t.x,t.y),c=r.next,d=t.prev;return r.next=t,t.prev=r,n.next=c,c.prev=n,a.next=n,n.prev=a,d.next=a,a.prev=d,a}function dm(r,t,n,a){const c=ap(r,t,n);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function Hc(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 ap(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class al{constructor(t,n){if(n>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=n}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class jh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}jh.noSubdivision=new jh({fill:new al(0,0),line:new al(0,0),tile:new al(0,0),stencil:new al(0,0),circle:1}),Ue("SubdivisionGranularityExpression",al),Ue("SubdivisionGranularitySetting",jh);const sl=-32768,Wc=32767;class Ox{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Qe/t,this._canonical=n}_getKey(t,n){return(t+=32768)<<16|(n+=32768)<<0}_vertexToIndex(t,n){if(t<-32768||n<-32768||t>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(n),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let m=0;m<d.length;m+=3){const y=d[m],w=d[m+1],M=d[m+2],C=c[2*y],z=c[2*y+1];(c[2*w]-C)*(c[2*M+1]-z)-(c[2*w+1]-z)*(c[2*M]-C)>0?(p.push(y),p.push(M),p.push(w)):(p.push(y),p.push(w),p.push(M))}return p}(this._vertexBuffer,t);const n=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let m=1/0,y=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const $=p[2*j],X=p[2*j+1];m=Math.min(m,$),w=Math.max(w,$),y=Math.min(y,X),M=Math.max(M,X)}if(m===w||y===M)continue;const C=Math.floor(m/this._granularityCellSize),z=Math.ceil(w/this._granularityCellSize),D=Math.floor(y/this._granularityCellSize),B=Math.ceil(M/this._granularityCellSize);if(C!==z||D!==B)for(let j=D;j<B;j++){const $=this._scanlineGenerateVertexRingForCellRow(j,p,d);jx(this._vertexBuffer,$,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(t,n,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=n[2*m],w=n[2*m+1],M=n[2*(m+1)%6],C=n[(2*(m+1)+1)%6],z=n[2*(m+2)%6],D=n[(2*(m+2)+1)%6],B=M-y,j=C-w,$=B===0,X=j===0,ae=(c-w)/j,Y=(d-w)/j,R=Math.min(ae,Y),U=Math.max(ae,Y);if(!X&&(R>=1||U<=0)||X&&(w<c||w>d)){C>=c&&C<=d&&p.push(a[(m+1)%3]);continue}!X&&R>0&&p.push(this._vertexToIndex(y+B*R,w+j*R));const Q=y+B*Math.max(R,0),fe=y+B*Math.min(U,1);$||this._generateIntraEdgeVertices(p,y,w,M,C,Q,fe),!X&&U<1&&p.push(this._vertexToIndex(y+B*U,w+j*U)),(X||C>=c&&C<=d)&&p.push(a[(m+1)%3]),!X&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,y,w,M,C,z,D,fe,c,d)}return p}_generateIntraEdgeVertices(t,n,a,c,d,p,m){const y=c-n,w=d-a,M=w===0,C=M?Math.min(n,c):Math.min(p,m),z=M?Math.max(n,c):Math.max(p,m),D=Math.floor(C/this._granularityCellSize)+1,B=Math.ceil(z/this._granularityCellSize)-1;if(M?n<c:p<m)for(let j=D;j<=B;j++){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/y))}else for(let j=B;j>=D;j--){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/y))}}_generateInterEdgeVertices(t,n,a,c,d,p,m,y,w,M){const C=d-a,z=p-c,D=m-d,B=(w-d)/D,j=(M-d)/D,$=Math.min(B,j),X=Math.max(B,j),ae=c+z*$;let Y=Math.floor(Math.min(ae,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ae,y)/this._granularityCellSize)-1,U=y<ae;const Q=D===0;if(Q&&(m===w||m===M))return;if(Q||$>=1||X<=0){const Ae=a-m,ye=p+(n-p)*Math.min((w-m)/Ae,(M-m)/Ae);Y=Math.floor(Math.min(ye,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ye,y)/this._granularityCellSize)-1,U=y<ye}const fe=C>0?M:w;if(U)for(let Ae=Y;Ae<=R;Ae++)t.push(this._vertexToIndex(Ae*this._granularityCellSize,fe));else for(let Ae=R;Ae>=Y;Ae--)t.push(this._vertexToIndex(Ae*this._granularityCellSize,fe))}_generateOutline(t){const n=[];for(const a of t){const c=eo(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);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===sl&&(t[n+1]=-32767),a===Wc&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,c,d,p){c>d!=(p===sl)?(t.push(n),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(n),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,n,a){const c=this._vertexBuffer,d=Qe,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],w=t[m-1],M=t[m],C=c[2*y],z=c[2*y+1],D=c[2*w],B=c[2*w+1],j=c[2*M],$=c[2*M+1];n&&(z===0&&B===0&&this._generatePoleQuad(t,y,w,C,D,sl),B===0&&$===0&&this._generatePoleQuad(t,w,M,D,j,sl),$===0&&z===0&&this._generatePoleQuad(t,M,y,j,C,sl)),a&&(z===d&&B===d&&this._generatePoleQuad(t,y,w,C,D,Wc),B===d&&$===d&&this._generatePoleQuad(t,w,M,D,j,Wc),$===d&&z===d&&this._generatePoleQuad(t,M,y,j,C,Wc))}}_initializeVertices(t){for(let n=0;n<t.length;n+=2)this._vertexToIndex(t[n],t[n+1])}subdividePolygonInternal(t,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(m){const y=[],w=[];for(const M of m)if(M.length!==0){M!==m[0]&&y.push(w.length/2);for(let C=0;C<M.length;C++)w.push(M[C].x),w.push(M[C].y)}return{flattened:w,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(w,M,C=2){const z=M&&M.length,D=z?M[0]*C:w.length;let B=lm(w,0,D,C,!0);const j=[];if(!B||B.next===B.prev)return j;let $,X,ae;if(z&&(B=function(Y,R,U,Q){const fe=[];for(let Ae=0,ye=R.length;Ae<ye;Ae++){const ve=lm(Y,R[Ae]*Q,Ae<ye-1?R[Ae+1]*Q:Y.length,Q,!1);ve===ve.next&&(ve.steiner=!0),fe.push(Bx(ve))}fe.sort(Rx);for(let Ae=0;Ae<fe.length;Ae++)U=Dx(fe[Ae],U);return U}(w,M,B,C)),w.length>80*C){$=1/0,X=1/0;let Y=-1/0,R=-1/0;for(let U=C;U<D;U+=C){const Q=w[U],fe=w[U+1];Q<$&&($=Q),fe<X&&(X=fe),Q>Y&&(Y=Q),fe>R&&(R=fe)}ae=Math.max(Y-$,R-X),ae=ae!==0?32767/ae:0}return $c(B,j,C,$,X,ae,0),j}(a,c),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 c=0;c<n.length;c++)a.push(this._vertexToIndex(t[2*n[c]],t[2*n[c]+1]));return a}_pointArrayToIndices(t){const n=[];for(let a=0;a<t.length;a++){const c=t[a];n.push(this._vertexToIndex(c.x,c.y))}return n}}function pm(r,t,n,a=!0){return new Ox(n,t).subdividePolygonInternal(r,a)}function eo(r,t,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],c=r[r.length-1],d=n&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...r,r[0]]:[...r];const p=Math.floor(Qe/t),m=[];m.push(new Ve(r[0].x,r[0].y));const y=r.length,w=d?y:y-1;for(let M=0;M<w;M++){const C=r[M],z=M<y-1?r[M+1]:r[0],D=C.x,B=C.y,j=z.x,$=z.y,X=D!==j,ae=B!==$;if(!X&&!ae)continue;const Y=j-D,R=$-B,U=Math.abs(Y),Q=Math.abs(R);let fe=D,Ae=B;for(;;){const ve=Y>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,De=R>0?(Math.floor(Ae/p)+1)*p:(Math.ceil(Ae/p)-1)*p,Re=Math.abs(fe-ve),Fe=Math.abs(Ae-De),Me=Math.abs(fe-j),qe=Math.abs(Ae-$),it=X?Re/U:Number.POSITIVE_INFINITY,et=ae?Fe/Q:Number.POSITIVE_INFINITY;if((Me<=Re||!X)&&(qe<=Fe||!ae))break;if(it<et&&X||!ae){fe=ve,Ae+=R*it;const Xe=new Ve(fe,Math.round(Ae));m[m.length-1].x===Xe.x&&m[m.length-1].y===Xe.y||m.push(Xe)}else{fe+=Y*et,Ae=De;const Xe=new Ve(Math.round(fe),Ae);m[m.length-1].x===Xe.x&&m[m.length-1].y===Xe.y||m.push(Xe)}}const ye=new Ve(j,$);m[m.length-1].x===ye.x&&m[m.length-1].y===ye.y||m.push(ye)}return m}function jx(r,t,n){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=r[2*t[0]];for(let y=1;y<t.length;y++){const w=r[2*t[y]];w<c&&(c=w,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,w=(m+1)%d,M=r[2*t[y]],C=r[2*t[w]],z=r[2*t[p]],D=r[2*t[p]+1],B=r[2*t[m]+1];let j=!1;if(M<C)j=!0;else if(M>C)j=!1;else{const $=B-D,X=-(r[2*t[m]]-z),ae=D<B?1:-1;((M-z)*$+(r[2*t[y]+1]-D)*X)*ae>((C-z)*$+(r[2*t[w]+1]-D)*X)*ae&&(j=!0)}if(j){const $=t[y],X=t[p],ae=t[m];$!==X&&$!==ae&&X!==ae&&n.push(ae,X,$),p--,p<0&&(p=d-1)}else{const $=t[w],X=t[p],ae=t[m];$!==X&&$!==ae&&X!==ae&&n.push(ae,X,$),m++,m>=d&&(m=0)}if(y===w)break}}function fm(r,t,n,a,c,d,p,m,y){const w=c.length/2,M=p&&m&&y;if(w<lt.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(w,n,a),z=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(z+d[j],z+d[j+1],z+d[j+2]);let D,B;C.vertexLength+=w,C.primitiveLength+=d.length/3,M&&(B=p.prepareSegment(w,n,m),D=B.vertexLength,B.vertexLength+=w);for(let j=0;j<c.length;j+=2)r(c[j],c[j+1]);if(M)for(let j=0;j<y.length;j++){const $=y[j];for(let X=1;X<$.length;X+=2)m.emplaceBack(D+$[X-1],D+$[X]);B.primitiveLength+=$.length/2}}else(function(C,z,D,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const ae={count:0};let Y=0,R=C.getOrCreateLatestSegment(z,D),U=R.vertexLength;for(let Q=2;Q<j.length;Q+=3){const fe=j[Q-2],Ae=j[Q-1],ye=j[Q];let ve=X[fe]<Y,De=X[Ae]<Y,Re=X[ye]<Y;R.vertexLength+((ve?1:0)+(De?1:0)+(Re?1:0))>lt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(z,D),Y=ae.count,ve=!0,De=!0,Re=!0,U=0);const Fe=Xc(X,B,$,ae,fe,ve,R),Me=Xc(X,B,$,ae,Ae,De,R),qe=Xc(X,B,$,ae,ye,Re,R);D.emplaceBack(U+Fe-Y,U+Me-Y,U+qe-Y),R.primitiveLength++}})(t,n,a,c,d,r),M&&function(C,z,D,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const ae={count:0};let Y=0,R=C.getOrCreateLatestSegment(z,D),U=R.vertexLength;for(let Q=0;Q<j.length;Q++){const fe=j[Q];for(let Ae=1;Ae<j[Q].length;Ae+=2){const ye=fe[Ae-1],ve=fe[Ae];let De=X[ye]<Y,Re=X[ve]<Y;R.vertexLength+((De?1:0)+(Re?1:0))>lt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(z,D),Y=ae.count,De=!0,Re=!0,U=0);const Fe=Xc(X,B,$,ae,ye,De,R),Me=Xc(X,B,$,ae,ve,Re,R);D.emplaceBack(U+Fe-Y,U+Me-Y),R.primitiveLength++}}}(p,n,m,c,y,r),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function Xc(r,t,n,a,c,d,p){if(d){const m=a.count;return n(t[2*c],t[2*c+1]),r[c]=a.count,a.count++,p.vertexLength++,m}return r[c]}class sp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new te,this.indexArray=new Be,this.indexArray2=new ke,this.programConfigurations=new Ia(t.layers,t.zoom),this.segments=new lt,this.segments2=new lt,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=ip("fill",this.layers,n);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,z=ra(m,C);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),z,a))continue;const D=d?c.evaluate(z,{},a,n.availableImages):void 0,B={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?z.geometry:kr(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=rp("fill",this.layers,m,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ix),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,n,a,c,d,p){for(const m of ko(n,500)){const y=pm(m,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;fm((M,C)=>{w.emplaceBack(M,C)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let mm,gm;Ue("FillBucket",sp,{omit:["layers","patternFeatures"]});var Nx={get paint(){return gm=gm||new br({"fill-antialias":new Ye(V.paint_fill["fill-antialias"]),"fill-opacity":new at(V.paint_fill["fill-opacity"]),"fill-color":new at(V.paint_fill["fill-color"]),"fill-outline-color":new at(V.paint_fill["fill-outline-color"]),"fill-translate":new Ye(V.paint_fill["fill-translate"]),"fill-translate-anchor":new Ye(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new qs(V.paint_fill["fill-pattern"])})},get layout(){return mm=mm||new br({"fill-sort-key":new at(V.layout_fill["fill-sort-key"])})}};class Zx extends pn{constructor(t){super(t,Nx)}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 sp(t)}queryRadius(){return Lh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:c}){return Yf(Bh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),n)}isTileClipped(){return!0}}const Vx=vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ux=vi([{name:"a_centroid",components:2,type:"Int16"}],4),{members:$x}=Vx;var op,_m,lp,ym,cp,xm,vm,Nh={};function bm(){if(_m)return op;_m=1;var r=Le();function t(c,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=m,this._values=y,c.readFields(n,this,d)}function n(c,d,p){c==1?d.id=p.readVarint():c==2?function(m,y){for(var w=m.readVarint()+m.pos;m.pos<w;){var M=y._keys[m.readVarint()],C=y._values[m.readVarint()];y.properties[M]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,m=0,y=0,w=c.length,M=w-1;y<w;M=y++)m+=((p=c[M]).x-(d=c[y]).x)*(d.y+p.y);return m}return op=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var d,p=c.readVarint()+c.pos,m=1,y=0,w=0,M=0,C=[];c.pos<p;){if(y<=0){var z=c.readVarint();m=7&z,y=z>>3}if(y--,m===1||m===2)w+=c.readSVarint(),M+=c.readSVarint(),m===1&&(d&&C.push(d),d=[]),d.push(new r(w,M));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,m=0,y=0,w=0,M=1/0,C=-1/0,z=1/0,D=-1/0;c.pos<d;){if(m<=0){var B=c.readVarint();p=7&B,m=B>>3}if(m--,p===1||p===2)(y+=c.readSVarint())<M&&(M=y),y>C&&(C=y),(w+=c.readSVarint())<z&&(z=w),w>D&&(D=w);else if(p!==7)throw new Error("unknown command "+p)}return[M,z,C,D]},t.prototype.toGeoJSON=function(c,d,p){var m,y,w=this.extent*Math.pow(2,p),M=this.extent*c,C=this.extent*d,z=this.loadGeometry(),D=t.types[this.type];function B(X){for(var ae=0;ae<X.length;ae++){var Y=X[ae];X[ae]=[360*(Y.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+C)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<z.length;m++)j[m]=z[m][0];B(z=j);break;case 2:for(m=0;m<z.length;m++)B(z[m]);break;case 3:for(z=function(X){var ae=X.length;if(ae<=1)return[X];for(var Y,R,U=[],Q=0;Q<ae;Q++){var fe=a(X[Q]);fe!==0&&(R===void 0&&(R=fe<0),R===fe<0?(Y&&U.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&U.push(Y),U}(z),m=0;m<z.length;m++)for(y=0;y<z[m].length;y++)B(z[m][y])}z.length===1?z=z[0]:D="Multi"+D;var $={type:"Feature",geometry:{type:D,coordinates:z},properties:this.properties};return"id"in this&&($.id=this.id),$},op}function wm(){if(ym)return lp;ym=1;var r=bm();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(n,this,c),this.length=this._features.length}function n(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var m=null,y=p.readVarint()+p.pos;p.pos<y;){var w=p.readVarint()>>3;m=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return m}(d))}return lp=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,c,this.extent,this._keys,this._values)},lp}function Tm(){return vm||(vm=1,Nh.VectorTile=function(){if(xm)return cp;xm=1;var r=wm();function t(n,a,c){if(n===3){var d=new r(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return cp=function(n,a){this.layers=n.readFields(t,{},a)},cp}(),Nh.VectorTileFeature=bm(),Nh.VectorTileLayer=wm()),Nh}var Kc=he(Tm());const Gx=Kc.VectorTileFeature.types,up=Math.pow(2,13);function Yc(r,t,n,a,c,d,p,m){r.emplaceBack(t,n,2*Math.floor(a*up)+p,c*up*2,d*up*2,Math.round(m))}class hp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new re,this.centroidVertexArray=new K,this.indexArray=new Be,this.programConfigurations=new Ia(t.layers,t.zoom),this.segments=new lt,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.features=[],this.hasPattern=ip("fill-extrusion",this.layers,n);for(const{feature:c,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,w=ra(c,y);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),w,a))continue;const M={id:d,sourceLayerIndex:m,index:p,geometry:y?w.geometry:kr(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(rp("fill-extrusion",this.layers,M,this.zoom,n)):this.addFeature(M,M.geometry,p,a,{},n.subdivisionGranularity),n.featureIndex.insert(c,M.geometry,p,m,this.index,!0)}}addFeatures(t,n,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,n,a,t.subdivisionGranularity)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$x),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ux.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,n,a,c,d,p){for(const m of ko(n,500)){const y={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(y,c,t,m,p);const M=this.layoutVertexArray.length-w,C=Math.floor(y.x/y.sampleCount),z=Math.floor(y.y/y.sampleCount);for(let D=0;D<M;D++)this.centroidVertexArray.emplaceBack(C,z)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,n,a,c,d){if(c.length<1||Mm(c[0]))return;for(const C of c)C.length!==0&&qx(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(n.z),y=Gx[a.type]==="Polygon";for(const C of c){if(C.length===0||Mm(C))continue;const z=eo(C,m,y);this._generateSideFaces(z,p)}if(!y)return;const w=pm(c,n,m,!1),M=this.layoutVertexArray;fm((C,z)=>{Yc(M,C,z,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,n){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(Hx(d,p))continue;n.segment.vertexLength+4>lt.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),Yc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Yc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Yc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Yc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const w=n.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function qx(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 Hx(r,t){return r.x===t.x&&(r.x<0||r.x>Qe)||r.y===t.y&&(r.y<0||r.y>Qe)}function Mm(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Qe)||r.every(t=>t.y<0)||r.every(t=>t.y>Qe)}let Sm;Ue("FillExtrusionBucket",hp,{omit:["layers","features"]});var Wx={get paint(){return Sm=Sm||new br({"fill-extrusion-opacity":new Ye(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new at(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new qs(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new at(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new at(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ye(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Xx extends pn{constructor(t){super(t,Wx)}createBucket(t){return new hp(t)}queryRadius(){return Lh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=Bh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),w=this.paint.get("fill-extrusion-height").evaluate(n,a),M=this.paint.get("fill-extrusion-base").evaluate(n,a),C=function(D,B,j){const $=[];for(const X of D){const ae=[X.x,X.y,0,1];xi(ae,ae,B),$.push(new Ve(ae[0]/ae[3],ae[1]/ae[3]))}return $}(y,m),z=function(D,B,j,$){const X=[],ae=[],Y=$[8]*B,R=$[9]*B,U=$[10]*B,Q=$[11]*B,fe=$[8]*j,Ae=$[9]*j,ye=$[10]*j,ve=$[11]*j;for(const De of D){const Re=[],Fe=[];for(const Me of De){const qe=Me.x,it=Me.y,et=$[0]*qe+$[4]*it+$[12],Xe=$[1]*qe+$[5]*it+$[13],vt=$[2]*qe+$[6]*it+$[14],hi=$[3]*qe+$[7]*it+$[15],Ii=vt+U,rr=hi+Q,Jr=et+fe,Ar=Xe+Ae,Gi=vt+ye,si=hi+ve,Di=new Ve((et+Y)/rr,(Xe+R)/rr);Di.z=Ii/rr,Re.push(Di);const qi=new Ve(Jr/si,Ar/si);qi.z=Gi/si,Fe.push(qi)}X.push(Re),ae.push(Fe)}return[X,ae]}(c,M,w,m);return function(D,B,j){let $=1/0;Yf(j,B)&&($=Pm(j,B[0]));for(let X=0;X<B.length;X++){const ae=B[X],Y=D[X];for(let R=0;R<ae.length-1;R++){const U=ae[R],Q=[U,ae[R+1],Y[R+1],Y[R],U];Nc(j,Q)&&($=Math.min($,Pm(j,Q)))}}return $!==1/0&&$}(z[0],z[1],C)}}function Jc(r,t){return r.x*t.x+r.y*t.y}function Pm(r,t){if(r.length===1){let n=0;const a=t[n++];let c;for(;!c||a.equals(c);)if(c=t[n++],!c)return 1/0;for(;n<t.length;n++){const d=t[n],p=r[0],m=c.sub(a),y=d.sub(a),w=p.sub(a),M=Jc(m,m),C=Jc(m,y),z=Jc(y,y),D=Jc(w,m),B=Jc(w,y),j=M*z-C*C,$=(z*D-C*B)/j,X=(M*B-C*D)/j,ae=a.z*(1-$-X)+c.z*$+d.z*X;if(isFinite(ae))return ae}return 1/0}{let n=1/0;for(const a of t)n=Math.min(n,a.z);return n}}const Kx=vi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Yx}=Kx,Jx=vi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Qx}=Jx,ev=Kc.VectorTileFeature.types,tv=Math.cos(Math.PI/180*37.5),Cm=Math.pow(2,14)/.5;class dp{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 se,this.layoutVertexArray2=new ne,this.indexArray=new Be,this.programConfigurations=new Ia(t.layers,t.zoom),this.segments=new lt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=ip("line",this.layers,n);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,z=ra(m,C);if(!this.layers[0]._featureFilter.filter(new Ht(this.zoom),z,a))continue;const D=d?c.evaluate(z,{},a):void 0,B={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?z.geometry:kr(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=rp("line",this.layers,m,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Qx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yx),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,n,a,c,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),w=m.get("line-cap"),M=m.get("line-miter-limit"),C=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const z of n)this.addLine(z,t,y,w,M,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,n,a,c,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=eo(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y<t.length-1;Y++)this.totalDistance+=t[Y].dist(t[Y+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=ev[n.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let C=0;for(;C<M-1&&t[C].equals(t[C+1]);)C++;if(M<(w?3:2))return;a==="bevel"&&(d=1.05);const z=this.overscaling<=16?15*Qe/(512*this.overscaling):0,D=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let B,j,$,X,ae;this.e1=this.e2=-1,w&&(B=t[M-2],ae=t[C].sub(B)._unit()._perp());for(let Y=C;Y<M;Y++){if($=Y===M-1?w?t[C+1]:void 0:t[Y+1],$&&t[Y].equals($))continue;ae&&(X=ae),B&&(j=B),B=t[Y],ae=$?$.sub(B)._unit()._perp():X,X=X||ae;let R=X.add(ae);R.x===0&&R.y===0||R._unit();const U=X.x*ae.x+X.y*ae.y,Q=R.x*ae.x+R.y*ae.y,fe=Q!==0?1/Q:1/0,Ae=2*Math.sqrt(2-2*Q),ye=Q<tv&&j&&$,ve=X.x*ae.y-X.y*ae.x>0;if(ye&&Y>C){const Fe=B.dist(j);if(Fe>2*z){const Me=B.sub(B.sub(j)._mult(z/Fe)._round());this.updateDistance(j,Me),this.addCurrentVertex(Me,X,0,0,D),j=Me}}const De=j&&$;let Re=De?a:w?"butt":c;if(De&&Re==="round"&&(fe<p?Re="miter":fe<=2&&(Re="fakeround")),Re==="miter"&&fe>d&&(Re="bevel"),Re==="bevel"&&(fe>2&&(Re="flipbevel"),fe<d&&(Re="miter")),j&&this.updateDistance(j,B),Re==="miter")R._mult(fe),this.addCurrentVertex(B,R,0,0,D);else if(Re==="flipbevel"){if(fe>100)R=ae.mult(-1);else{const Fe=fe*X.add(ae).mag()/X.sub(ae).mag();R._perp()._mult(Fe*(ve?-1:1))}this.addCurrentVertex(B,R,0,0,D),this.addCurrentVertex(B,R.mult(-1),0,0,D)}else if(Re==="bevel"||Re==="fakeround"){const Fe=-Math.sqrt(fe*fe-1),Me=ve?Fe:0,qe=ve?0:Fe;if(j&&this.addCurrentVertex(B,X,Me,qe,D),Re==="fakeround"){const it=Math.round(180*Ae/Math.PI/20);for(let et=1;et<it;et++){let Xe=et/it;if(Xe!==.5){const hi=Xe-.5;Xe+=Xe*hi*(Xe-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*hi*hi+(.848013+U*(.215638*U-1.06021)))}const vt=ae.sub(X)._mult(Xe)._add(X)._unit()._mult(ve?-1:1);this.addHalfVertex(B,vt.x,vt.y,!1,ve,0,D)}}$&&this.addCurrentVertex(B,ae,-Me,-qe,D)}else if(Re==="butt")this.addCurrentVertex(B,R,0,0,D);else if(Re==="square"){const Fe=j?1:-1;this.addCurrentVertex(B,R,Fe,Fe,D)}else Re==="round"&&(j&&(this.addCurrentVertex(B,X,0,0,D),this.addCurrentVertex(B,X,1,1,D,!0)),$&&(this.addCurrentVertex(B,ae,-1,-1,D,!0),this.addCurrentVertex(B,ae,0,0,D)));if(ye&&Y<M-1){const Fe=B.dist($);if(Fe>2*z){const Me=B.add($.sub(B)._mult(z/Fe)._round());this.updateDistance(B,Me),this.addCurrentVertex(Me,ae,0,0,D),B=Me}}}}addCurrentVertex(t,n,a,c,d,p=!1){const m=n.y*c-n.x,y=-n.y-n.x*c;this.addHalfVertex(t,n.x+n.y*a,n.y-n.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-c,d),this.distance>Cm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,a,c,d,p))}addHalfVertex({x:t,y:n},a,c,d,p,m,y){const w=.5*(this.lineClips?this.scaledDistance*(Cm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(n<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),y.primitiveLength++),p?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}}let Im,Em;Ue("LineBucket",dp,{omit:["layers","patternFeatures"]});var km={get paint(){return Em=Em||new br({"line-opacity":new at(V.paint_line["line-opacity"]),"line-color":new at(V.paint_line["line-color"]),"line-translate":new Ye(V.paint_line["line-translate"]),"line-translate-anchor":new Ye(V.paint_line["line-translate-anchor"]),"line-width":new at(V.paint_line["line-width"]),"line-gap-width":new at(V.paint_line["line-gap-width"]),"line-offset":new at(V.paint_line["line-offset"]),"line-blur":new at(V.paint_line["line-blur"]),"line-dasharray":new zc(V.paint_line["line-dasharray"]),"line-pattern":new qs(V.paint_line["line-pattern"]),"line-gradient":new Ac(V.paint_line["line-gradient"])})},get layout(){return Im=Im||new br({"line-cap":new Ye(V.layout_line["line-cap"]),"line-join":new at(V.layout_line["line-join"]),"line-miter-limit":new Ye(V.layout_line["line-miter-limit"]),"line-round-limit":new Ye(V.layout_line["line-round-limit"]),"line-sort-key":new at(V.layout_line["line-sort-key"])})}};class iv extends at{possiblyEvaluate(t,n){return n=new Ht(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(t,n)}evaluate(t,n,a,c){return n=Yi({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,c)}}let Zh;class rv extends pn{constructor(t){super(t,km),this.gradientVersion=0,Zh||(Zh=new iv(km.paint.properties["line-width"].specification),Zh.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 Es,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"]=Zh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new dp(t)}queryRadius(t){const n=t,a=zm(Vc("line-width",this,n),Vc("line-gap-width",this,n)),c=Vc("line-offset",this,n);return a/2+Math.abs(c)+Lh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const m=Bh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*zm(this.paint.get("line-width").evaluate(n,a),this.paint.get("line-gap-width").evaluate(n,a)),w=this.paint.get("line-offset").evaluate(n,a);return w&&(c=function(M,C){const z=[];for(let D=0;D<M.length;D++){const B=M[D],j=[];for(let $=0;$<B.length;$++){const X=B[$-1],ae=B[$],Y=B[$+1],R=$===0?new Ve(0,0):ae.sub(X)._unit()._perp(),U=$===B.length-1?new Ve(0,0):Y.sub(ae)._unit()._perp(),Q=R._add(U)._unit(),fe=Q.x*U.x+Q.y*U.y;fe!==0&&Q._mult(1/fe),j.push(Q._mult(C)._add(ae))}z.push(j)}return z}(c,w*p)),function(M,C,z){for(let D=0;D<C.length;D++){const B=C[D];if(M.length>=3){for(let j=0;j<B.length;j++)if(Js(M,B[j]))return!0}if(yx(M,B,z))return!0}return!1}(m,c,y)}isTileClipped(){return!0}}function zm(r,t){return t>0?t+2*r:r}const nv=vi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),av=vi([{name:"a_projected_pos",components:3,type:"Float32"}],4);vi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const sv=vi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);vi([{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 Am=vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ov=vi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function lv(r,t,n){return r.sections.forEach(a=>{a.text=function(c,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),ea.applyArabicShaping&&(c=ea.applyArabicShaping(c)),c}(a.text,t,n)}),r}vi([{name:"triangle",components:3,type:"Uint16"}]),vi([{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"}]),vi([{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"}]),vi([{type:"Float32",name:"offsetX"}]),vi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),vi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Qc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Rm,pp,Dm,Ci=24,fp={};function cv(){return Rm||(Rm=1,fp.read=function(r,t,n,a,c){var d,p,m=8*c-a-1,y=(1<<m)-1,w=y>>1,M=-7,C=n?c-1:0,z=n?-1:1,D=r[t+C];for(C+=z,d=D&(1<<-M)-1,D>>=-M,M+=m;M>0;d=256*d+r[t+C],C+=z,M-=8);for(p=d&(1<<-M)-1,d>>=-M,M+=a;M>0;p=256*p+r[t+C],C+=z,M-=8);if(d===0)d=1-w;else{if(d===y)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,a),d-=w}return(D?-1:1)*p*Math.pow(2,d-a)},fp.write=function(r,t,n,a,c,d){var p,m,y,w=8*d-c-1,M=(1<<w)-1,C=M>>1,z=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=a?0:d-1,B=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=M):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+C>=1?z/y:z*Math.pow(2,1-C))*y>=2&&(p++,y/=2),p+C>=M?(m=0,p=M):p+C>=1?(m=(t*y-1)*Math.pow(2,c),p+=C):(m=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;r[n+D]=255&m,D+=B,m/=256,c-=8);for(p=p<<c|m,w+=c;w>0;r[n+D]=255&p,D+=B,p/=256,w-=8);r[n+D-B]|=128*j}),fp}function Lm(){if(Dm)return pp;Dm=1,pp=t;var r=cv();function t(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,a=1/n,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(R){return R.type===t.Bytes?R.readVarint()+R.pos:R.pos+1}function p(R,U,Q){return Q?4294967296*U+(R>>>0):4294967296*(U>>>0)+(R>>>0)}function m(R,U,Q){var fe=U<=16383?1:U<=2097151?2:U<=268435455?3:Math.floor(Math.log(U)/(7*Math.LN2));Q.realloc(fe);for(var Ae=Q.pos-1;Ae>=R;Ae--)Q.buf[Ae+fe]=Q.buf[Ae]}function y(R,U){for(var Q=0;Q<R.length;Q++)U.writeVarint(R[Q])}function w(R,U){for(var Q=0;Q<R.length;Q++)U.writeSVarint(R[Q])}function M(R,U){for(var Q=0;Q<R.length;Q++)U.writeFloat(R[Q])}function C(R,U){for(var Q=0;Q<R.length;Q++)U.writeDouble(R[Q])}function z(R,U){for(var Q=0;Q<R.length;Q++)U.writeBoolean(R[Q])}function D(R,U){for(var Q=0;Q<R.length;Q++)U.writeFixed32(R[Q])}function B(R,U){for(var Q=0;Q<R.length;Q++)U.writeSFixed32(R[Q])}function j(R,U){for(var Q=0;Q<R.length;Q++)U.writeFixed64(R[Q])}function $(R,U){for(var Q=0;Q<R.length;Q++)U.writeSFixed64(R[Q])}function X(R,U){return(R[U]|R[U+1]<<8|R[U+2]<<16)+16777216*R[U+3]}function ae(R,U,Q){R[Q]=U,R[Q+1]=U>>>8,R[Q+2]=U>>>16,R[Q+3]=U>>>24}function Y(R,U){return(R[U]|R[U+1]<<8|R[U+2]<<16)+(R[U+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(R,U,Q){for(Q=Q||this.length;this.pos<Q;){var fe=this.readVarint(),Ae=fe>>3,ye=this.pos;this.type=7&fe,R(Ae,U,this),this.pos===ye&&this.skip(fe)}return U},readMessage:function(R,U){return this.readFields(R,U,this.readVarint()+this.pos)},readFixed32:function(){var R=X(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=Y(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=X(this.buf,this.pos)+X(this.buf,this.pos+4)*n;return this.pos+=8,R},readSFixed64:function(){var R=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*n;return this.pos+=8,R},readFloat:function(){var R=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var U,Q,fe=this.buf;return U=127&(Q=fe[this.pos++]),Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<7,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<14,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<21,Q<128?U:function(Ae,ye,ve){var De,Re,Fe=ve.buf;if(De=(112&(Re=Fe[ve.pos++]))>>4,Re<128||(De|=(127&(Re=Fe[ve.pos++]))<<3,Re<128)||(De|=(127&(Re=Fe[ve.pos++]))<<10,Re<128)||(De|=(127&(Re=Fe[ve.pos++]))<<17,Re<128)||(De|=(127&(Re=Fe[ve.pos++]))<<24,Re<128)||(De|=(1&(Re=Fe[ve.pos++]))<<31,Re<128))return p(Ae,De,ye);throw new Error("Expected varint not more than 10 bytes")}(U|=(15&(Q=fe[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,U=this.pos;return this.pos=R,R-U>=12&&c?function(Q,fe,Ae){return c.decode(Q.subarray(fe,Ae))}(this.buf,U,R):function(Q,fe,Ae){for(var ye="",ve=fe;ve<Ae;){var De,Re,Fe,Me=Q[ve],qe=null,it=Me>239?4:Me>223?3:Me>191?2:1;if(ve+it>Ae)break;it===1?Me<128&&(qe=Me):it===2?(192&(De=Q[ve+1]))==128&&(qe=(31&Me)<<6|63&De)<=127&&(qe=null):it===3?(Re=Q[ve+2],(192&(De=Q[ve+1]))==128&&(192&Re)==128&&((qe=(15&Me)<<12|(63&De)<<6|63&Re)<=2047||qe>=55296&&qe<=57343)&&(qe=null)):it===4&&(Re=Q[ve+2],Fe=Q[ve+3],(192&(De=Q[ve+1]))==128&&(192&Re)==128&&(192&Fe)==128&&((qe=(15&Me)<<18|(63&De)<<12|(63&Re)<<6|63&Fe)<=65535||qe>=1114112)&&(qe=null)),qe===null?(qe=65533,it=1):qe>65535&&(qe-=65536,ye+=String.fromCharCode(qe>>>10&1023|55296),qe=56320|1023&qe),ye+=String.fromCharCode(qe),ve+=it}return ye}(this.buf,U,R)},readBytes:function(){var R=this.readVarint()+this.pos,U=this.buf.subarray(this.pos,R);return this.pos=R,U},readPackedVarint:function(R,U){if(this.type!==t.Bytes)return R.push(this.readVarint(U));var Q=d(this);for(R=R||[];this.pos<Q;)R.push(this.readVarint(U));return R},readPackedSVarint:function(R){if(this.type!==t.Bytes)return R.push(this.readSVarint());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==t.Bytes)return R.push(this.readBoolean());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==t.Bytes)return R.push(this.readFloat());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==t.Bytes)return R.push(this.readDouble());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed32());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed32());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed64());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed64());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSFixed64());return R},skip:function(R){var U=7&R;if(U===t.Varint)for(;this.buf[this.pos++]>127;);else if(U===t.Bytes)this.pos=this.readVarint()+this.pos;else if(U===t.Fixed32)this.pos+=4;else{if(U!==t.Fixed64)throw new Error("Unimplemented type: "+U);this.pos+=8}},writeTag:function(R,U){this.writeVarint(R<<3|U)},realloc:function(R){for(var U=this.length||16;U<this.pos+R;)U*=2;if(U!==this.length){var Q=new Uint8Array(U);Q.set(this.buf),this.buf=Q,this.length=U}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),ae(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),ae(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),ae(this.buf,-1&R,this.pos),ae(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),ae(this.buf,-1&R,this.pos),ae(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(U,Q){var fe,Ae;if(U>=0?(fe=U%4294967296|0,Ae=U/4294967296|0):(Ae=~(-U/4294967296),4294967295^(fe=~(-U%4294967296))?fe=fe+1|0:(fe=0,Ae=Ae+1|0)),U>=18446744073709552e3||U<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(ye,ve,De){De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,De.buf[De.pos]=127&(ye>>>=7)}(fe,0,Q),function(ye,ve){var De=(7&ye)<<4;ve.buf[ve.pos++]|=De|((ye>>>=3)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(ve.buf[ve.pos++]=127&ye)))))}(Ae,Q)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var U=this.pos;this.pos=function(fe,Ae,ye){for(var ve,De,Re=0;Re<Ae.length;Re++){if((ve=Ae.charCodeAt(Re))>55295&&ve<57344){if(!De){ve>56319||Re+1===Ae.length?(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189):De=ve;continue}if(ve<56320){fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=ve;continue}ve=De-55296<<10|ve-56320|65536,De=null}else De&&(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=null);ve<128?fe[ye++]=ve:(ve<2048?fe[ye++]=ve>>6|192:(ve<65536?fe[ye++]=ve>>12|224:(fe[ye++]=ve>>18|240,fe[ye++]=ve>>12&63|128),fe[ye++]=ve>>6&63|128),fe[ye++]=63&ve|128)}return ye}(this.buf,R,this.pos);var Q=this.pos-U;Q>=128&&m(U,Q,this),this.pos=U-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(R){this.realloc(4),r.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),r.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var U=R.length;this.writeVarint(U),this.realloc(U);for(var Q=0;Q<U;Q++)this.buf[this.pos++]=R[Q]},writeRawMessage:function(R,U){this.pos++;var Q=this.pos;R(U,this);var fe=this.pos-Q;fe>=128&&m(Q,fe,this),this.pos=Q-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(R,U,Q){this.writeTag(R,t.Bytes),this.writeRawMessage(U,Q)},writePackedVarint:function(R,U){U.length&&this.writeMessage(R,y,U)},writePackedSVarint:function(R,U){U.length&&this.writeMessage(R,w,U)},writePackedBoolean:function(R,U){U.length&&this.writeMessage(R,z,U)},writePackedFloat:function(R,U){U.length&&this.writeMessage(R,M,U)},writePackedDouble:function(R,U){U.length&&this.writeMessage(R,C,U)},writePackedFixed32:function(R,U){U.length&&this.writeMessage(R,D,U)},writePackedSFixed32:function(R,U){U.length&&this.writeMessage(R,B,U)},writePackedFixed64:function(R,U){U.length&&this.writeMessage(R,j,U)},writePackedSFixed64:function(R,U){U.length&&this.writeMessage(R,$,U)},writeBytesField:function(R,U){this.writeTag(R,t.Bytes),this.writeBytes(U)},writeFixed32Field:function(R,U){this.writeTag(R,t.Fixed32),this.writeFixed32(U)},writeSFixed32Field:function(R,U){this.writeTag(R,t.Fixed32),this.writeSFixed32(U)},writeFixed64Field:function(R,U){this.writeTag(R,t.Fixed64),this.writeFixed64(U)},writeSFixed64Field:function(R,U){this.writeTag(R,t.Fixed64),this.writeSFixed64(U)},writeVarintField:function(R,U){this.writeTag(R,t.Varint),this.writeVarint(U)},writeSVarintField:function(R,U){this.writeTag(R,t.Varint),this.writeSVarint(U)},writeStringField:function(R,U){this.writeTag(R,t.Bytes),this.writeString(U)},writeFloatField:function(R,U){this.writeTag(R,t.Fixed32),this.writeFloat(U)},writeDoubleField:function(R,U){this.writeTag(R,t.Fixed64),this.writeDouble(U)},writeBooleanField:function(R,U){this.writeVarintField(R,!!U)}},pp}var mp=he(Lm());const gp=3;function uv(r,t,n){r===1&&n.readMessage(hv,t)}function hv(r,t,n){if(r===3){const{id:a,bitmap:c,width:d,height:p,left:m,top:y,advance:w}=n.readMessage(dv,{});t.push({id:a,bitmap:new Uc({width:d+2*gp,height:p+2*gp},c),metrics:{width:d,height:p,left:m,top:y,advance:w}})}}function dv(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 pv=gp;function Bm(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 c=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),c=Math.max(c,p.x+p.w),p.w===y.w&&p.h===y.h){const w=a.pop();m<a.length&&(a[m]=w)}else p.h===y.h?(y.x+=p.w,y.w-=p.w):p.w===y.w?(y.y+=p.h,y.h-=p.h):(a.push({x:y.x+p.w,y:y.y,w:y.w-p.w,h:p.h}),y.y+=p.h,y.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const zr=1;class _p{constructor(t,{pixelRatio:n,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+zr,this.paddedRect.y+zr]}get br(){return[this.paddedRect.x+this.paddedRect.w-zr,this.paddedRect.y+this.paddedRect.h-zr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*zr)/this.pixelRatio,(this.paddedRect.h-2*zr)/this.pixelRatio]}}class Fm{constructor(t,n){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(n,c,d);const{w:p,h:m}=Bm(d),y=new Kr({width:p||1,height:m||1});for(const w in t){const M=t[w],C=a[w].paddedRect;Kr.copy(M.data,y,{x:0,y:0},{x:C.x+zr,y:C.y+zr},M.data)}for(const w in n){const M=n[w],C=c[w].paddedRect,z=C.x+zr,D=C.y+zr,B=M.data.width,j=M.data.height;Kr.copy(M.data,y,{x:0,y:0},{x:z,y:D},M.data),Kr.copy(M.data,y,{x:0,y:j-1},{x:z,y:D-1},{width:B,height:1}),Kr.copy(M.data,y,{x:0,y:0},{x:z,y:D+j},{width:B,height:1}),Kr.copy(M.data,y,{x:B-1,y:0},{x:z-1,y:D},{width:1,height:j}),Kr.copy(M.data,y,{x:0,y:0},{x:z+B,y:D},{width:1,height:j})}this.image=y,this.iconPositions=a,this.patternPositions=c}addImages(t,n,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*zr,h:d.data.height+2*zr};a.push(p),n[c]=new _p(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,n){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),n),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),n)}patchUpdatedImage(t,n,a){if(!t||!n||t.version===n.version)return;t.version=n.version;const[c,d]=t.tl;a.update(n.data,void 0,{x:c,y:d})}}var ss;Ue("ImagePosition",_p),Ue("ImageAtlas",Fm),S.al=void 0,(ss=S.al||(S.al={}))[ss.none=0]="none",ss[ss.horizontal=1]="horizontal",ss[ss.vertical=2]="vertical",ss[ss.horizontalOnly=3]="horizontalOnly";const Vh=-17;class eu{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const c=new eu;return c.scale=t||1,c.fontStack=n,c.verticalAlign=a||"bottom",c}static forImage(t,n){const a=new eu;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class ol{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new ol;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,n)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let n="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;n+=c&&Ph(c)&&!Qc[t[a+1]]||d&&Ph(d)&&!Qc[t[a-1]]||!Qc[t[a]]?t[a]:Qc[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&$h[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&$h[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 ol;return a.text=this.text.substring(t,n),a.sectionIndex=this.sectionIndex.slice(t,n),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,n)=>Math.max(t,this.sections[n].scale),0)}getMaxImageSize(t){let n=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const 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(eu.forText(t.scale,t.fontStack||n,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const n=t.image?t.image.name:"";if(n.length===0)return void Vi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(eu.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Vi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Uh(r,t,n,a,c,d,p,m,y,w,M,C,z,D,B){const j=ol.fromFeature(r,c);let $;C===S.al.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:ae}=ea;if(X&&j.sections.length===1){$=[];const U=X(j.toString(),yp(j,w,d,t,a,D));for(const Q of U){const fe=new ol;fe.text=Q,fe.sections=j.sections;for(let Ae=0;Ae<Q.length;Ae++)fe.sectionIndex.push(0);$.push(fe)}}else if(ae){$=[];const U=ae(j.text,j.sectionIndex,yp(j,w,d,t,a,D));for(const Q of U){const fe=new ol;fe.text=Q[0],fe.sectionIndex=Q[1],fe.sections=j.sections,$.push(fe)}}else $=function(U,Q){const fe=[],Ae=U.text;let ye=0;for(const ve of Q)fe.push(U.substring(ye,ve)),ye=ve;return ye<Ae.length&&fe.push(U.substring(ye,Ae.length)),fe}(j,yp(j,w,d,t,a,D));const Y=[],R={positionedLines:Y,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(U,Q,fe,Ae,ye,ve,De,Re,Fe,Me,qe,it){let et=0,Xe=0,vt=0,hi=0;const Ii=Re==="right"?1:Re==="left"?0:.5,rr=Ci/it;let Jr=0;for(const si of ye){si.trim();const Di=si.getMaxScale(),qi={positionedGlyphs:[],lineOffset:0};U.positionedLines[Jr]=qi;const Hi=qi.positionedGlyphs;let wr=0;if(!si.length()){Xe+=ve,++Jr;continue}const Qr=_v(Ae,si,rr);for(let Rr=0;Rr<si.length();Rr++){const Ei=si.getSection(Rr),Bi=si.getSectionIndex(Rr),Fi=si.getCharCode(Rr),wi=yv(Fe,qe,Fi);let Kt;if(Ei.imageName){if(U.iconsInText=!0,Ei.scale=Ei.scale*rr,Kt=vv(Ei,wi,Di,Qr,Ae),!Kt)continue;wr=Math.max(wr,Kt.imageOffset)}else if(Kt=xv(Ei,Fi,wi,Qr,Q,fe),!Kt)continue;const{rect:Ln,metrics:hl,baselineOffset:Bn}=Kt;Hi.push({glyph:Fi,imageName:Ei.imageName,x:et,y:Xe+Bn+Vh,vertical:wi,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Bi,metrics:hl,rect:Ln}),wi?(U.verticalizable=!0,et+=(Ei.imageName?hl.advance:Ci)*Ei.scale+Me):et+=hl.advance*Ei.scale+Me}Hi.length!==0&&(vt=Math.max(et-Me,vt),bv(Hi,0,Hi.length-1,Ii)),et=0,qi.lineOffset=Math.max(wr,(Di-1)*Ci);const Li=ve*Di+wr;Xe+=Li,hi=Math.max(Li,hi),++Jr}const{horizontalAlign:Ar,verticalAlign:Gi}=xp(De);(function(si,Di,qi,Hi,wr,Qr,Li,Rr,Ei){const Bi=(Di-qi)*wr;let Fi=0;Fi=Qr!==Li?-Rr*Hi-Vh:-Hi*Ei*Li+.5*Li;for(const wi of si)for(const Kt of wi.positionedGlyphs)Kt.x+=Bi,Kt.y+=Fi})(U.positionedLines,Ii,Ar,Gi,vt,hi,ve,Xe,ye.length),U.top+=-Gi*Xe,U.bottom=U.top+Xe,U.left+=-Ar*vt,U.right=U.left+vt}(R,t,n,a,$,p,m,y,C,w,z,B),!function(U){for(const Q of U)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&R}const $h={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},fv={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},mv={40:!0};function Om(r,t,n,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*Ci/d+c:0}{const p=n[t.fontStack],m=p&&p[r];return m?m.metrics.advance*t.scale+c:0}}function jm(r,t,n,a){const c=Math.pow(r-t,2);return a?r<t?c/2:2*c:c+Math.abs(n)*n}function gv(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 Nm(r,t,n,a,c,d){let p=null,m=jm(t,n,c,d);for(const y of a){const w=jm(t-y.x,n,c,d)+y.badness;w<=m&&(p=y,m=w)}return{index:r,x:t,priorBreak:p,badness:m}}function Zm(r){return r?Zm(r.priorBreak).concat(r.index):[]}function yp(r,t,n,a,c,d){if(!r)return[];const p=[],m=function(C,z,D,B,j,$){let X=0;for(let ae=0;ae<C.length();ae++){const Y=C.getSection(ae);X+=Om(C.getCharCode(ae),Y,B,j,z,$)}return X/Math.max(1,Math.ceil(X/D))}(r,t,n,a,c,d),y=r.text.indexOf("​")>=0;let w=0;for(let C=0;C<r.length();C++){const z=r.getSection(C),D=r.getCharCode(C);if($h[D]||(w+=Om(D,z,a,c,t,d)),C<r.length()-1){const B=!((M=D)<11904)&&(!!xt["CJK Compatibility Forms"](M)||!!xt["CJK Compatibility"](M)||!!xt["CJK Strokes"](M)||!!xt["CJK Symbols and Punctuation"](M)||!!xt["Enclosed CJK Letters and Months"](M)||!!xt["Halfwidth and Fullwidth Forms"](M)||!!xt["Ideographic Description Characters"](M)||!!xt["Vertical Forms"](M)||Sh.test(String.fromCodePoint(M)));(fv[D]||B||z.imageName||C!==r.length()-2&&mv[r.getCharCode(C+1)])&&p.push(Nm(C+1,w,m,p,gv(D,r.getCharCode(C+1),B&&y),!1))}}var M;return Zm(Nm(r.length(),w,m,p,0,!0))}function xp(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 _v(r,t,n){const a=t.getMaxScale()*Ci,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,c*n),horizontalLineContentHeight:p}}function Vm(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function yv(r,t,n){return!(r===S.al.horizontal||!t&&!Ko(n)||t&&($h[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function xv(r,t,n,a,c,d){const p=d[r.fontStack],m=function(w,M,C,z){if(w&&w.rect)return w;const D=M[C.fontStack],B=D&&D[z];return B?{rect:null,metrics:B.metrics}:null}(p&&p[t],c,r,t);if(m===null)return null;let y;if(n)y=a.verticalLineContentWidth-r.scale*Ci;else{const w=Vm(r.verticalAlign);y=(a.horizontalLineContentHeight-r.scale*Ci)*w}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function vv(r,t,n,a,c){const d=c[r.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:zr,top:-3,advance:t?m[1]:m[0]};let w;if(t)w=a.verticalLineContentWidth-m[1]*r.scale;else{const M=Vm(r.verticalAlign);w=(a.horizontalLineContentHeight-m[1]*r.scale)*M}return{rect:p,metrics:y,baselineOffset:w,imageOffset:(t?m[0]:m[1])*r.scale-Ci*n}}function bv(r,t,n,a){if(a===0)return;const c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=n;p++)r[p].x-=d}function wv(r,t,n){const{horizontalAlign:a,verticalAlign:c}=xp(n),d=t[0]-r.displaySize[0]*a,p=t[1]-r.displaySize[1]*c;return{image:r,top:p,bottom:p+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function Um(r){var t,n;let a=r.left,c=r.top,d=r.right-a,p=r.bottom-c;const m=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",w=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<w||m==="proportional"){const M=Math.ceil(p*w);a*=M/d,d=M}}else if(m==="proportional"&&y==="stretchOnly"&&w!==0&&d/p>w){const M=Math.ceil(d/w);c*=M/p,p=M}return{x1:a,y1:c,x2:a+d,y2:c+p}}function $m(r,t,n,a,c,d){const p=r.image;let m;if(p.content){const $=p.content,X=p.pixelRatio||1;m=[$[0]/X,$[1]/X,p.displaySize[0]-$[2]/X,p.displaySize[1]-$[3]/X]}const y=t.left*d,w=t.right*d;let M,C,z,D;n==="width"||n==="both"?(D=c[0]+y-a[3],C=c[0]+w+a[1]):(D=c[0]+(y+w-p.displaySize[0])/2,C=D+p.displaySize[0]);const B=t.top*d,j=t.bottom*d;return n==="height"||n==="both"?(M=c[1]+B-a[0],z=c[1]+j+a[2]):(M=c[1]+(B+j-p.displaySize[1])/2,z=M+p.displaySize[1]),{image:p,top:M,right:C,bottom:z,left:D,collisionPadding:m}}const tu=255,na=128,os=tu*na;function Gm(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Ht(r+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=n;let d=0;for(;d<a.length&&a[d]<=r;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return n.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:y,minSize:n.evaluate(new Ht(m)),maxSize:n.evaluate(new Ht(y)),interpolationType:c}}}function vp(r,t,n){let a="never";const c=r.get(t);return c?a=c:r.get(n)&&(a="always"),a}const Tv=Kc.VectorTileFeature.types,Mv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gh(r,t,n,a,c,d,p,m,y,w,M,C,z){const D=m?Math.min(os,Math.round(m[0])):0,B=m?Math.min(os,Math.round(m[1])):0;r.emplaceBack(t,n,Math.round(32*a),Math.round(32*c),d,p,(D<<1)+(y?1:0),B,16*w,16*M,256*C,256*z)}function bp(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 Sv(r){for(const t of r.sections)if(Xd(t.text))return!0;return!1}class wp{constructor(t){this.layoutVertexArray=new me,this.indexArray=new Be,this.programConfigurations=t,this.segments=new lt,this.dynamicLayoutVertexArray=new Te,this.opacityVertexArray=new Se,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,n,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,nv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,av.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Mv,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ue("SymbolBuffers",wp);class Tp{constructor(t,n,a){this.layoutVertexArray=new t,this.layoutAttributes=n,this.indexArray=new a,this.segments=new lt,this.collisionVertexArray=new je}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,sv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ue("CollisionBuffers",Tp);class ll{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=Gm(this.zoom,n["text-size"]),this.iconSizeData=Gm(this.zoom,n["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=vp(a,"text-overlap","text-allow-overlap")!=="never"||vp(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(p=>S.al[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new wp(new Ia(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new wp(new Ia(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new k,this.lineVertexArray=new F,this.symbolInstances=new E,this.textAnchorOffsets=new H}calculateGlyphDependencies(t,n,a,c,d){for(let p=0;p<t.length;p++)if(n[t.charCodeAt(p)]=!0,(a||c)&&d){const m=Qc[t.charAt(p)];m&&(n[m.charCodeAt(0)]=!0)}}populate(t,n,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),w=(m.value.kind!=="constant"||m.value.value instanceof yr&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),M=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const z=n.iconDependencies,D=n.glyphDependencies,B=n.availableImages,j=new Ht(this.zoom);for(const{feature:$,id:X,index:ae,sourceLayerIndex:Y}of t){const R=c._featureFilter.needGeometry,U=ra($,R);if(!c._featureFilter.filter(j,U,a))continue;let Q,fe;if(R||(U.geometry=kr($)),w){const ye=c.getValueAndResolveTokens("text-field",U,a,B),ve=yr.factory(ye),De=this.hasRTLText=this.hasRTLText||Sv(ve);(!De||ea.getRTLTextPluginStatus()==="unavailable"||De&&ea.isParsed())&&(Q=lv(ve,c,U))}if(M){const ye=c.getValueAndResolveTokens("icon-image",U,a,B);fe=ye instanceof Ir?ye:Ir.fromString(ye)}if(!Q&&!fe)continue;const Ae=this.sortFeaturesByKey?C.evaluate(U,{},a):void 0;if(this.features.push({id:X,text:Q,icon:fe,index:ae,sourceLayerIndex:Y,geometry:U.geometry,properties:$.properties,type:Tv[$.type],sortKey:Ae}),fe&&(z[fe.name]=!0),Q){const ye=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.al.vertical)>=0;for(const De of Q.sections)if(De.image)z[De.image.name]=!0;else{const Re=Wo(Q.toString()),Fe=De.fontStack||ye,Me=D[Fe]=D[Fe]||{};this.calculateGlyphDependencies(De.text,Me,ve,this.allowVerticalPlacement,Re)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const X={},ae={},Y=[];let R=0;function U(ye){Y.push($[ye]),R++}function Q(ye,ve,De){const Re=ae[ye];return delete ae[ye],ae[ve]=Re,Y[Re].geometry[0].pop(),Y[Re].geometry[0]=Y[Re].geometry[0].concat(De[0]),Re}function fe(ye,ve,De){const Re=X[ve];return delete X[ve],X[ye]=Re,Y[Re].geometry[0].shift(),Y[Re].geometry[0]=De[0].concat(Y[Re].geometry[0]),Re}function Ae(ye,ve,De){const Re=De?ve[0][ve[0].length-1]:ve[0][0];return`${ye}:${Re.x}:${Re.y}`}for(let ye=0;ye<$.length;ye++){const ve=$[ye],De=ve.geometry,Re=ve.text?ve.text.toString():null;if(!Re){U(ye);continue}const Fe=Ae(Re,De),Me=Ae(Re,De,!0);if(Fe in ae&&Me in X&&ae[Fe]!==X[Me]){const qe=fe(Fe,Me,De),it=Q(Fe,Me,Y[qe].geometry);delete X[Fe],delete ae[Me],ae[Ae(Re,Y[it].geometry,!0)]=it,Y[qe].geometry=null}else Fe in ae?Q(Fe,Me,De):Me in X?fe(Fe,Me,De):(U(ye),X[Fe]=R-1,ae[Me]=R-1)}return Y.filter(ye=>ye.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,X)=>$.sortKey-X.sortKey)}update(t,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,n,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,n,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,n){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(n[t.segment+1]),d=t.dist(n[t.segment]);const p={};for(let m=t.segment+1;m<n.length;m++)p[m]={x:n[m].x,y:n[m].y,tileUnitDistanceFromAnchor:c},m<n.length-1&&(c+=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,c,d,p,m,y,w,M,C,z){const D=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*n.length,B,D,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,X=j.vertexLength,ae=this.allowVerticalPlacement&&m===S.al.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let R=0;R<n.length;R++){const{tl:U,tr:Q,bl:fe,br:Ae,tex:ye,pixelOffsetTL:ve,pixelOffsetBR:De,minFontScaleX:Re,minFontScaleY:Fe,glyphOffset:Me,isSDF:qe,sectionIndex:it}=n[R],et=j.vertexLength,Xe=Me[1];Gh(B,y.x,y.y,U.x,Xe+U.y,ye.x,ye.y,a,qe,ve.x,ve.y,Re,Fe),Gh(B,y.x,y.y,Q.x,Xe+Q.y,ye.x+ye.w,ye.y,a,qe,De.x,ve.y,Re,Fe),Gh(B,y.x,y.y,fe.x,Xe+fe.y,ye.x,ye.y+ye.h,a,qe,ve.x,De.y,Re,Fe),Gh(B,y.x,y.y,Ae.x,Xe+Ae.y,ye.x+ye.w,ye.y+ye.h,a,qe,De.x,De.y,Re,Fe),bp(t.dynamicLayoutVertexArray,y,ae),D.emplaceBack(et,et+2,et+1),D.emplaceBack(et+1,et+2,et+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Me[0]),R!==n.length-1&&it===n[R+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,p,p.index,{},z,Y&&Y[it])}t.placedSymbolArray.emplaceBack(y.x,y.y,$,this.glyphOffsetArray.length-$,X,w,M,y.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(t,n,a,c,d,p){return n.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,n,a,c,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=y.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,z=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(M,C,p,z,D,new Ve(t,n)),this._addCollisionDebugVertex(M,C,p,z,D,new Ve(a,n)),this._addCollisionDebugVertex(M,C,p,z,D,new Ve(a,c)),this._addCollisionDebugVertex(M,C,p,z,D,new Ve(t,c)),y.vertexLength+=4;const B=d.indexArray;B.emplaceBack(w,w+1),B.emplaceBack(w+1,w+2),B.emplaceBack(w+2,w+3),B.emplaceBack(w+3,w),y.primitiveLength+=4}addDebugCollisionBoxes(t,n,a,c){for(let d=t;d<n;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Tp(be,Am.members,ke),this.iconCollisionBox=new Tp(be,Am.members,ke);for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(t,n,a,c,d,p,m,y,w){const M={};for(let C=n;C<a;C++){const z=t.get(C);M.textBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.textFeatureIndex=z.featureIndex;break}for(let C=c;C<d;C++){const z=t.get(C);M.verticalTextBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.verticalTextFeatureIndex=z.featureIndex;break}for(let C=p;C<m;C++){const z=t.get(C);M.iconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.iconFeatureIndex=z.featureIndex;break}for(let C=y;C<w;C++){const z=t.get(C);M.verticalIconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},M.verticalIconFeatureIndex=z.featureIndex;break}return M}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const a=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,n){const a=t.placedSymbolArray.get(n),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const n=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);c.push(0|Math.round(n*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>c[m]-c[y]||d[y]-d[m]),p}addToSortKeyRanges(t,n){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===n?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const a=this.symbolInstances.get(n);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let qm,Hm;Ue("SymbolBucket",ll,{omit:["layers","collisionBoxArray","features","compareText"]}),ll.MAX_GLYPHS=65535,ll.addDynamicAttributes=bp;var Mp={get paint(){return Hm=Hm||new br({"icon-opacity":new at(V.paint_symbol["icon-opacity"]),"icon-color":new at(V.paint_symbol["icon-color"]),"icon-halo-color":new at(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new at(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new at(V.paint_symbol["icon-halo-blur"]),"icon-translate":new Ye(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ye(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new at(V.paint_symbol["text-opacity"]),"text-color":new at(V.paint_symbol["text-color"],{runtimeType:lr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new at(V.paint_symbol["text-halo-color"]),"text-halo-width":new at(V.paint_symbol["text-halo-width"]),"text-halo-blur":new at(V.paint_symbol["text-halo-blur"]),"text-translate":new Ye(V.paint_symbol["text-translate"]),"text-translate-anchor":new Ye(V.paint_symbol["text-translate-anchor"])})},get layout(){return qm=qm||new br({"symbol-placement":new Ye(V.layout_symbol["symbol-placement"]),"symbol-spacing":new Ye(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ye(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new at(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ye(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ye(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ye(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ye(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ye(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ye(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new at(V.layout_symbol["icon-size"]),"icon-text-fit":new Ye(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ye(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new at(V.layout_symbol["icon-image"]),"icon-rotate":new at(V.layout_symbol["icon-rotate"]),"icon-padding":new at(V.layout_symbol["icon-padding"]),"icon-keep-upright":new Ye(V.layout_symbol["icon-keep-upright"]),"icon-offset":new at(V.layout_symbol["icon-offset"]),"icon-anchor":new at(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ye(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ye(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ye(V.layout_symbol["text-rotation-alignment"]),"text-field":new at(V.layout_symbol["text-field"]),"text-font":new at(V.layout_symbol["text-font"]),"text-size":new at(V.layout_symbol["text-size"]),"text-max-width":new at(V.layout_symbol["text-max-width"]),"text-line-height":new Ye(V.layout_symbol["text-line-height"]),"text-letter-spacing":new at(V.layout_symbol["text-letter-spacing"]),"text-justify":new at(V.layout_symbol["text-justify"]),"text-radial-offset":new at(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ye(V.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new at(V.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new at(V.layout_symbol["text-anchor"]),"text-max-angle":new Ye(V.layout_symbol["text-max-angle"]),"text-writing-mode":new Ye(V.layout_symbol["text-writing-mode"]),"text-rotate":new at(V.layout_symbol["text-rotate"]),"text-padding":new Ye(V.layout_symbol["text-padding"]),"text-keep-upright":new Ye(V.layout_symbol["text-keep-upright"]),"text-transform":new at(V.layout_symbol["text-transform"]),"text-offset":new at(V.layout_symbol["text-offset"]),"text-allow-overlap":new Ye(V.layout_symbol["text-allow-overlap"]),"text-overlap":new Ye(V.layout_symbol["text-overlap"]),"text-ignore-placement":new Ye(V.layout_symbol["text-ignore-placement"]),"text-optional":new Ye(V.layout_symbol["text-optional"])})}};class Wm{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:Pt,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",Wm,{omit:["defaultValue"]});class qh extends pn{constructor(t){super(t,Mp)}recalculate(t,n){if(super.recalculate(t,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,n,a,c){const d=this.layout.get(t).evaluate(n,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||va(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(w,M)=>m&&M in m?String(m[M]):"")}(n.properties,d)}createBucket(t){return new ll(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Mp.paint.overridableProperties){if(!qh.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new Wm(n),c=new uc(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new hc("source",c):new dc("composite",c,n.value.zoomStops),this.paint._values[t]=new dn(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&qh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),c=Mp.paint.properties[n];let d=!1;const p=m=>{for(const y of m)if(c.overrides&&c.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof yr)p(a.value.value.sections);else if(a.value.kind==="source"){const m=w=>{d||(w instanceof Kn&&ci(w.value)===pa?p(w.value.sections):w instanceof Io?p(w.sections):w.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let Xm;var Pv={get paint(){return Xm=Xm||new br({"background-color":new Ye(V.paint_background["background-color"]),"background-pattern":new zc(V.paint_background["background-pattern"]),"background-opacity":new Ye(V.paint_background["background-opacity"])})}};class Cv extends pn{constructor(t){super(t,Pv)}}let Km;var Iv={get paint(){return Km=Km||new br({"raster-opacity":new Ye(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ye(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ye(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ye(V.paint_raster["raster-brightness-max"]),"raster-saturation":new Ye(V.paint_raster["raster-saturation"]),"raster-contrast":new Ye(V.paint_raster["raster-contrast"]),"raster-resampling":new Ye(V.paint_raster["raster-resampling"]),"raster-fade-duration":new Ye(V.paint_raster["raster-fade-duration"])})}};class Ev extends pn{constructor(t){super(t,Iv)}}class kv extends pn{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 zv{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 Av={once:!0},Sp=63710088e-1;class ls{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 ls(Ki(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const n=Math.PI/180,a=this.lat*n,c=t.lat*n,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*n);return Sp*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof ls)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new ls(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new ls(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 Ym=2*Math.PI*Sp;function Jm(r){return Ym*Math.cos(r*Math.PI/180)}function Qm(r){return(180+r)/360}function eg(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function tg(r,t){return r/Jm(t)}function Pp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function ig(r,t){return r*Jm(Pp(t))}class iu{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=ls.convert(t);return new iu(Qm(a.lng),eg(a.lat),tg(n,a.lat))}toLngLat(){return new ls(360*this.x-180,Pp(this.y))}toAltitude(){return ig(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ym*(t=Pp(this.y),1/Math.cos(t*Math.PI/180));var t}}function rg(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 Cp{constructor(t,n,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,n,a))throw new Error(`x=${n}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=n,this.y=a,this.key=cl(0,t,t,n,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,n,a){const c=(p=this.y,m=this.z,y=rg(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),w=rg(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+w[0]+","+w[1]);var d,p,m,y,w;const M=function(C,z,D){let B,j="";for(let $=C;$>0;$--)B=1<<$-1,j+=(z&B?1:0)+(D&B?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const n=this.z-t.z;return n>0&&t.x===this.x>>n&&t.y===this.y>>n}getTilePoint(t){const n=Math.pow(2,this.z);return new Ve((t.x*n-this.x)*Qe,(t.y*n-this.y)*Qe)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ng{constructor(t,n){this.wrap=t,this.canonical=n,this.key=cl(t,n.z,n.z,n.x,n.y)}}class Yr{constructor(t,n,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=n,this.canonical=new Cp(a,+c,+d),this.key=cl(n,t,a,c,d)}clone(){return new Yr(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 Yr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yr(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?cl(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):cl(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 Yr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new Yr(n,this.wrap,n,a,c),new Yr(n,this.wrap,n,a+1,c),new Yr(n,this.wrap,n,a,c+1),new Yr(n,this.wrap,n,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Yr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Yr(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 ng(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new iu(t.x-this.wrap,t.y))}}function cl(r,t,n,a,c){(r*=2)<0&&(r=-1*r-1);const d=1<<n;return(d*d*r+d*c+a).toString(36)+n.toString(36)+t.toString(36)}Ue("CanonicalTileID",Cp),Ue("OverscaledTileID",Yr,{omit:["terrainRttPosMatrix32f"]});class ag{constructor(t,n,a,c=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 Vi(`"${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=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<y;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(y,w)]=this.data[this._idx(y-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,y)]=this.data[this._idx(w,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 w=0;w<y;w++)for(let M=0;M<y;M++){const C=this.get(w,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,n){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,n);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,n){if(t<-1||t>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(t+1)}unpack(t,n,a){return t*this.redFactor+n*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new Kr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,n,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-n*this.dim,w=-a*this.dim;for(let M=p;M<m;M++)for(let C=c;C<d;C++)this.data[this._idx(C,M)]=t.data[this._idx(C+y,M+w)]}}Ue("DEMData",ag);class sg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let n=0;n<t.length;n++){const a=t[n];this._stringToNumber[a]=n,this._numberToString[n]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class og{constructor(t,n,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=n,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(t[n]=this[n]);return t}}class lg{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new In(Qe,16,0),this.grid3D=new In(Qe,16,0),this.featureIndexArray=new W,this.promoteId=n}insert(t,n,a,c,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const y=p?this.grid3D:this.grid;for(let w=0;w<n.length;w++){const M=n[w],C=[1/0,1/0,-1/0,-1/0];for(let z=0;z<M.length;z++){const D=M[z];C[0]=Math.min(C[0],D.x),C[1]=Math.min(C[1],D.y),C[2]=Math.max(C[2],D.x),C[3]=Math.max(C[3],D.y)}C[0]<Qe&&C[1]<Qe&&C[2]>=0&&C[3]>=0&&y.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Kc.VectorTile(new mp(this.rawTileData)).layers,this.sourceLayerCoder=new sg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,c){this.loadVTLayers();const d=t.params,p=Qe/t.tileSize/t.scale,m=pc(d.filter),y=t.queryGeometry,w=t.queryPadding*p,M=ug(y),C=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),z=ug(t.cameraQueryGeometry),D=this.grid3D.query(z.minX-w,z.minY-w,z.maxX+w,z.maxY+w,($,X,ae,Y)=>function(R,U,Q,fe,Ae){for(const ve of R)if(U<=ve.x&&Q<=ve.y&&fe>=ve.x&&Ae>=ve.y)return!0;const ye=[new Ve(U,Q),new Ve(U,Ae),new Ve(fe,Ae),new Ve(fe,Q)];if(R.length>2){for(const ve of ye)if(Js(R,ve))return!0}for(let ve=0;ve<R.length-1;ve++)if(vx(R[ve],R[ve+1],ye))return!0;return!1}(t.cameraQueryGeometry,$-w,X-w,ae+w,Y+w));for(const $ of D)C.push($);C.sort(Rv);const B={};let j;for(let $=0;$<C.length;$++){const X=C[$];if(X===j)continue;j=X;const ae=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(B,ae.bucketIndex,ae.sourceLayerIndex,ae.featureIndex,m,d.layers,d.availableImages,n,a,c,(R,U,Q)=>(Y||(Y=kr(R)),U.queryIntersectsFeature({queryGeometry:y,feature:R,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,n,a,c,d,p,m,y,w,M,C){const z=this.bucketLayerIDs[n];if(p&&!z.some($=>p.has($)))return;const D=this.sourceLayerCoder.decode(a),B=this.vtLayers[D].feature(c);if(d.needGeometry){const $=ra(B,!0);if(!d.filter(new Ht(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new Ht(this.tileID.overscaledZ),B))return;const j=this.getId(B,D);for(let $=0;$<z.length;$++){const X=z[$];if(p&&!p.has(X))continue;const ae=y[X];if(!ae)continue;let Y={};j&&M&&(Y=M.getState(ae.sourceLayer||"_geojsonTileLayer",j));const R=Yi({},w[X]);R.paint=cg(R.paint,ae.paint,B,Y,m),R.layout=cg(R.layout,ae.layout,B,Y,m);const U=!C||C(B,ae,Y);if(!U)continue;const Q=new og(B,this.z,this.x,this.y,j);Q.layer=R;let fe=t[X];fe===void 0&&(fe=t[X]=[]),fe.push({featureIndex:c,feature:Q,intersectionZ:U})}}lookupSymbolFeatures(t,n,a,c,d,p,m,y){const w={};this.loadVTLayers();const M=pc(d);for(const C of t)this.loadMatchingFeature(w,a,c,C,M,p,m,y,n);return w}hasLayer(t){for(const n of this.bucketLayerIDs)for(const a of n)if(t===a)return!0;return!1}getId(t,n){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function cg(r,t,n,a,c){return nn(r,(d,p)=>{const m=t instanceof Jo?t.get(p):null;return m&&m.evaluate?m.evaluate(n,a,c):m})}function ug(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:n,maxX:a,maxY:c}}function Rv(r,t){return t-r}function hg(r,t,n,a,c){const d=[];for(let p=0;p<r.length;p++){const m=r[p];let y;for(let w=0;w<m.length-1;w++){let M=m[w],C=m[w+1];M.x<t&&C.x<t||(M.x<t?M=new Ve(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<t&&(C=new Ve(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<n&&C.y<n||(M.y<n?M=new Ve(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round():C.y<n&&(C=new Ve(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round()),M.x>=a&&C.x>=a||(M.x>=a?M=new Ve(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=a&&(C=new Ve(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=c&&C.y>=c||(M.y>=c?M=new Ve(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round():C.y>=c&&(C=new Ve(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round()),y&&M.equals(y[y.length-1])||(y=[M],d.push(y)),y.push(C)))))}}return d}Ue("FeatureIndex",lg,{omit:["rawTileData","sourceLayerCoder"]});class cs extends Ve{constructor(t,n,a,c){super(t,n),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new cs(this.x,this.y,this.angle,this.segment)}}function dg(r,t,n,a,c){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 w=0;for(;m<n/2;){const M=r[p],C=r[p+1];if(!C)return!1;let z=r[p-1].angleTo(M)-M.angleTo(C);for(z=Math.abs((z+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:z}),w+=z;m-y[0].distance>a;)w-=y.shift().angleDelta;if(w>c)return!1;p++,m+=M.dist(C)}return!0}function pg(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function fg(r,t,n){return r?.6*t*n:0}function mg(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function Dv(r,t,n,a,c,d){const p=fg(n,c,d),m=mg(n,a)*d;let y=0;const w=pg(r)/2;for(let M=0;M<r.length-1;M++){const C=r[M],z=r[M+1],D=C.dist(z);if(y+D>w){const B=(w-y)/D,j=Ut.number(C.x,z.x,B),$=Ut.number(C.y,z.y,B),X=new cs(j,$,z.angleTo(C),M);return X._round(),!p||dg(r,X,m,p,t)?X:void 0}y+=D}}function Lv(r,t,n,a,c,d,p,m,y){const w=fg(a,d,p),M=mg(a,c),C=M*p,z=r[0].x===0||r[0].x===y||r[0].y===0||r[0].y===y;return t-C<t/4&&(t=C+t/4),gg(r,z?t/2*m%t:(M/2+2*d)*p*m%t,t,w,n,C,z,!1,y)}function gg(r,t,n,a,c,d,p,m,y){const w=d/2,M=pg(r);let C=0,z=t-n,D=[];for(let B=0;B<r.length-1;B++){const j=r[B],$=r[B+1],X=j.dist($),ae=$.angleTo(j);for(;z+n<C+X;){z+=n;const Y=(z-C)/X,R=Ut.number(j.x,$.x,Y),U=Ut.number(j.y,$.y,Y);if(R>=0&&R<y&&U>=0&&U<y&&z-w>=0&&z+w<=M){const Q=new cs(R,U,ae,B);Q._round(),a&&!dg(r,Q,d,a,c)||D.push(Q)}}C+=X}return m||D.length||p||(D=gg(r,C/2,n,a,c,d,p,!0,y)),D}Ue("Anchor",cs);const ru=zr;function _g(r,t,n,a){const c=[],d=r.image,p=d.pixelRatio,m=d.paddedRect.w-2*ru,y=d.paddedRect.h-2*ru;let w={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const M=d.stretchX||[[0,m]],C=d.stretchY||[[0,y]],z=(Me,qe)=>Me+qe[1]-qe[0],D=M.reduce(z,0),B=C.reduce(z,0),j=m-D,$=y-B;let X=0,ae=D,Y=0,R=B,U=0,Q=j,fe=0,Ae=$;if(d.content&&a){const Me=d.content,qe=Me[2]-Me[0],it=Me[3]-Me[1];(d.textFitWidth||d.textFitHeight)&&(w=Um(r)),X=Hh(M,0,Me[0]),Y=Hh(C,0,Me[1]),ae=Hh(M,Me[0],Me[2]),R=Hh(C,Me[1],Me[3]),U=Me[0]-X,fe=Me[1]-Y,Q=qe-ae,Ae=it-R}const ye=w.x1,ve=w.y1,De=w.x2-ye,Re=w.y2-ve,Fe=(Me,qe,it,et)=>{const Xe=Wh(Me.stretch-X,ae,De,ye),vt=Xh(Me.fixed-U,Q,Me.stretch,D),hi=Wh(qe.stretch-Y,R,Re,ve),Ii=Xh(qe.fixed-fe,Ae,qe.stretch,B),rr=Wh(it.stretch-X,ae,De,ye),Jr=Xh(it.fixed-U,Q,it.stretch,D),Ar=Wh(et.stretch-Y,R,Re,ve),Gi=Xh(et.fixed-fe,Ae,et.stretch,B),si=new Ve(Xe,hi),Di=new Ve(rr,hi),qi=new Ve(rr,Ar),Hi=new Ve(Xe,Ar),wr=new Ve(vt/p,Ii/p),Qr=new Ve(Jr/p,Gi/p),Li=t*Math.PI/180;if(Li){const Bi=Math.sin(Li),Fi=Math.cos(Li),wi=[Fi,-Bi,Bi,Fi];si._matMult(wi),Di._matMult(wi),Hi._matMult(wi),qi._matMult(wi)}const Rr=Me.stretch+Me.fixed,Ei=qe.stretch+qe.fixed;return{tl:si,tr:Di,bl:Hi,br:qi,tex:{x:d.paddedRect.x+ru+Rr,y:d.paddedRect.y+ru+Ei,w:it.stretch+it.fixed-Rr,h:et.stretch+et.fixed-Ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wr,pixelOffsetBR:Qr,minFontScaleX:Q/p/De,minFontScaleY:Ae/p/Re,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Me=yg(M,j,D),qe=yg(C,$,B);for(let it=0;it<Me.length-1;it++){const et=Me[it],Xe=Me[it+1];for(let vt=0;vt<qe.length-1;vt++)c.push(Fe(et,qe[vt],Xe,qe[vt+1]))}}else c.push(Fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return c}function Hh(r,t,n){let a=0;for(const c of r)a+=Math.max(t,Math.min(n,c[1]))-Math.max(t,Math.min(n,c[0]));return a}function yg(r,t,n){const a=[{fixed:-1,stretch:0}];for(const[c,d]of r){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+ru,stretch:n}),a}function Wh(r,t,n,a){return r/t*n+a}function Xh(r,t,n,a){return r-t*n/a}class Kh{constructor(t,n,a,c,d,p,m,y,w,M){var C;if(this.boxStartIndex=t.length,w){let z=p.top,D=p.bottom;const B=p.collisionPadding;B&&(z-=B[1],D+=B[3]);let j=D-z;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const z=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?Um(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};z.y1=z.y1*m-y[0],z.y2=z.y2*m+y[2],z.x1=z.x1*m-y[3],z.x2=z.x2*m+y[1];const D=p.collisionPadding;if(D&&(z.x1-=D[0]*m,z.y1-=D[1]*m,z.x2+=D[2]*m,z.y2+=D[3]*m),M){const B=new Ve(z.x1,z.y1),j=new Ve(z.x2,z.y1),$=new Ve(z.x1,z.y2),X=new Ve(z.x2,z.y2),ae=M*Math.PI/180;B._rotate(ae),j._rotate(ae),$._rotate(ae),X._rotate(ae),z.x1=Math.min(B.x,j.x,$.x,X.x),z.x2=Math.max(B.x,j.x,$.x,X.x),z.y1=Math.min(B.y,j.y,$.y,X.y),z.y2=Math.max(B.y,j.y,$.y,X.y)}t.emplaceBack(n.x,n.y,z.x1,z.y1,z.x2,z.y2,a,c,d)}this.boxEndIndex=t.length}}class Bv{constructor(t=[],n=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:a}=this,c=n[t];for(;t>0;){const d=t-1>>1,p=n[d];if(a(c,p)>=0)break;n[t]=p,t=d}n[t]=c}_down(t){const{data:n,compare:a}=this,c=this.length>>1,d=n[t];for(;t<c;){let p=1+(t<<1);const 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 Fv(r,t=1,n=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const m=r[0];for(let D=0;D<m.length;D++){const B=m[D];(!D||B.x<a)&&(a=B.x),(!D||B.y<c)&&(c=B.y),(!D||B.x>d)&&(d=B.x),(!D||B.y>p)&&(p=B.y)}const y=Math.min(d-a,p-c);let w=y/2;const M=new Bv([],Ov);if(y===0)return new Ve(a,c);for(let D=a;D<d;D+=y)for(let B=c;B<p;B+=y)M.push(new ul(D+w,B+w,w,r));let C=function(D){let B=0,j=0,$=0;const X=D[0];for(let ae=0,Y=X.length,R=Y-1;ae<Y;R=ae++){const U=X[ae],Q=X[R],fe=U.x*Q.y-Q.x*U.y;j+=(U.x+Q.x)*fe,$+=(U.y+Q.y)*fe,B+=3*fe}return new ul(j/B,$/B,0,D)}(r),z=M.length;for(;M.length;){const D=M.pop();(D.d>C.d||!C.d)&&(C=D,n&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,z)),D.max-C.d<=t||(w=D.h/2,M.push(new ul(D.p.x-w,D.p.y-w,w,r)),M.push(new ul(D.p.x+w,D.p.y-w,w,r)),M.push(new ul(D.p.x-w,D.p.y+w,w,r)),M.push(new ul(D.p.x+w,D.p.y+w,w,r)),z+=4)}return n&&(console.log(`num probes: ${z}`),console.log(`best distance: ${C.d}`)),C.p}function Ov(r,t){return t.max-r.max}function ul(r,t,n,a){this.p=new Ve(r,t),this.h=n,this.d=function(c,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const w=d[y];for(let M=0,C=w.length,z=C-1;M<C;z=M++){const D=w[M],B=w[z];D.y>c.y!=B.y>c.y&&c.x<(B.x-D.x)*(c.y-D.y)/(B.y-D.y)+D.x&&(p=!p),m=Math.min(m,Jf(c,D,B))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var ir;S.aB=void 0,(ir=S.aB||(S.aB={}))[ir.center=1]="center",ir[ir.left=2]="left",ir[ir.right=3]="right",ir[ir.top=4]="top",ir[ir.bottom=5]="bottom",ir[ir["top-left"]=6]="top-left",ir[ir["top-right"]=7]="top-right",ir[ir["bottom-left"]=8]="bottom-left",ir[ir["bottom-right"]=9]="bottom-right";const us=7,Ip=Number.POSITIVE_INFINITY;function xg(r,t){return t[1]!==Ip?function(n,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),n){case"top-right":case"top-left":case"top":p=c-us;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+us}switch(n){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(r,t[0],t[1]):function(n,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(n){case"top-right":case"top-left":d=p-us;break;case"bottom-right":case"bottom-left":d=-p+us;break;case"bottom":d=-a+us;break;case"top":d=a-us}switch(n){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(r,t[0])}function vg(r,t,n){var a;const c=r.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},n);if(d){const m=d.values,y=[];for(let w=0;w<m.length;w+=2){const M=y[w]=m[w],C=m[w+1].map(z=>z*Ci);M.startsWith("top")?C[1]-=us:M.startsWith("bottom")&&(C[1]+=us),y[w+1]=C}return new Ui(y)}const p=c.get("text-variable-anchor");if(p){let m;m=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},n)*Ci,Ip]:c.get("text-offset").evaluate(t,{},n).map(w=>w*Ci);const y=[];for(const w of p)y.push(w,xg(w,m));return new Ui(y)}return null}function Ep(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 jv(r,t,n,a,c,d,p,m,y,w,M,C){let z=d.textMaxSize.evaluate(t,{});z===void 0&&(z=p);const D=r.layers[0].layout,B=D.get("icon-offset").evaluate(t,{},M),j=wg(n.horizontal),$=p/24,X=r.tilePixelRatio*$,ae=r.tilePixelRatio*z/24,Y=r.tilePixelRatio*m,R=r.tilePixelRatio*D.get("symbol-spacing"),U=D.get("text-padding")*r.tilePixelRatio,Q=function(it,et,Xe,vt=1){const hi=it.get("icon-padding").evaluate(et,{},Xe),Ii=hi&&hi.values;return[Ii[0]*vt,Ii[1]*vt,Ii[2]*vt,Ii[3]*vt]}(D,t,M,r.tilePixelRatio),fe=D.get("text-max-angle")/180*Math.PI,Ae=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",ye=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",ve=D.get("symbol-placement"),De=R/2,Re=D.get("icon-text-fit");let Fe;a&&Re!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(Fe=$m(a,n.vertical,Re,D.get("icon-text-fit-padding"),B,$)),j&&(a=$m(a,j,Re,D.get("icon-text-fit-padding"),B,$)));const Me=M?C.line.getGranularityForZoomLevel(M.z):1,qe=(it,et)=>{et.x<0||et.x>=Qe||et.y<0||et.y>=Qe||function(Xe,vt,hi,Ii,rr,Jr,Ar,Gi,si,Di,qi,Hi,wr,Qr,Li,Rr,Ei,Bi,Fi,wi,Kt,Ln,hl,Bn,Vv){const dl=Xe.addToLineVertexArray(vt,hi);let to,pl,fl,ml,Pg=0,Cg=0,Ig=0,Eg=0,Fp=-1,Op=-1;const Ea={};let kg=tr("");if(Xe.allowVerticalPlacement&&Ii.vertical){const hr=Gi.layout.get("text-rotate").evaluate(Kt,{},Bn)+90;fl=new Kh(si,vt,Di,qi,Hi,Ii.vertical,wr,Qr,Li,hr),Ar&&(ml=new Kh(si,vt,Di,qi,Hi,Ar,Ei,Bi,Li,hr))}if(rr){const hr=Gi.layout.get("icon-rotate").evaluate(Kt,{}),en=Gi.layout.get("icon-text-fit")!=="none",io=_g(rr,hr,hl,en),On=Ar?_g(Ar,hr,hl,en):void 0;pl=new Kh(si,vt,Di,qi,Hi,rr,Ei,Bi,!1,hr),Pg=4*io.length;const ro=Xe.iconSizeData;let aa=null;ro.kind==="source"?(aa=[na*Gi.layout.get("icon-size").evaluate(Kt,{})],aa[0]>os&&Vi(`${Xe.layerIds[0]}: Value for "icon-size" is >= ${tu}. Reduce your "icon-size".`)):ro.kind==="composite"&&(aa=[na*Ln.compositeIconSizes[0].evaluate(Kt,{},Bn),na*Ln.compositeIconSizes[1].evaluate(Kt,{},Bn)],(aa[0]>os||aa[1]>os)&&Vi(`${Xe.layerIds[0]}: Value for "icon-size" is >= ${tu}. Reduce your "icon-size".`)),Xe.addSymbols(Xe.icon,io,aa,wi,Fi,Kt,S.al.none,vt,dl.lineStartIndex,dl.lineLength,-1,Bn),Fp=Xe.icon.placedSymbolArray.length-1,On&&(Cg=4*On.length,Xe.addSymbols(Xe.icon,On,aa,wi,Fi,Kt,S.al.vertical,vt,dl.lineStartIndex,dl.lineLength,-1,Bn),Op=Xe.icon.placedSymbolArray.length-1)}const zg=Object.keys(Ii.horizontal);for(const hr of zg){const en=Ii.horizontal[hr];if(!to){kg=tr(en.text);const On=Gi.layout.get("text-rotate").evaluate(Kt,{},Bn);to=new Kh(si,vt,Di,qi,Hi,en,wr,Qr,Li,On)}const io=en.positionedLines.length===1;if(Ig+=bg(Xe,vt,en,Jr,Gi,Li,Kt,Rr,dl,Ii.vertical?S.al.horizontal:S.al.horizontalOnly,io?zg:[hr],Ea,Fp,Ln,Bn),io)break}Ii.vertical&&(Eg+=bg(Xe,vt,Ii.vertical,Jr,Gi,Li,Kt,Rr,dl,S.al.vertical,["vertical"],Ea,Op,Ln,Bn));const Uv=to?to.boxStartIndex:Xe.collisionBoxArray.length,$v=to?to.boxEndIndex:Xe.collisionBoxArray.length,Gv=fl?fl.boxStartIndex:Xe.collisionBoxArray.length,qv=fl?fl.boxEndIndex:Xe.collisionBoxArray.length,Hv=pl?pl.boxStartIndex:Xe.collisionBoxArray.length,Wv=pl?pl.boxEndIndex:Xe.collisionBoxArray.length,Xv=ml?ml.boxStartIndex:Xe.collisionBoxArray.length,Kv=ml?ml.boxEndIndex:Xe.collisionBoxArray.length;let Fn=-1;const Jh=(hr,en)=>hr&&hr.circleDiameter?Math.max(hr.circleDiameter,en):en;Fn=Jh(to,Fn),Fn=Jh(fl,Fn),Fn=Jh(pl,Fn),Fn=Jh(ml,Fn);const Ag=Fn>-1?1:0;Ag&&(Fn*=Vv/Ci),Xe.glyphOffsetArray.length>=ll.MAX_GLYPHS&&Vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Kt.sortKey!==void 0&&Xe.addToSortKeyRanges(Xe.symbolInstances.length,Kt.sortKey);const Yv=vg(Gi,Kt,Bn),[Jv,Qv]=function(hr,en){const io=hr.length,On=en==null?void 0:en.values;if((On==null?void 0:On.length)>0)for(let ro=0;ro<On.length;ro+=2){const aa=On[ro+1];hr.emplaceBack(S.aB[On[ro]],aa[0],aa[1])}return[io,hr.length]}(Xe.textAnchorOffsets,Yv);Xe.symbolInstances.emplaceBack(vt.x,vt.y,Ea.right>=0?Ea.right:-1,Ea.center>=0?Ea.center:-1,Ea.left>=0?Ea.left:-1,Ea.vertical||-1,Fp,Op,kg,Uv,$v,Gv,qv,Hv,Wv,Xv,Kv,Di,Ig,Eg,Pg,Cg,Ag,0,wr,Fn,Jv,Qv)}(r,et,it,n,a,c,Fe,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,X,[U,U,U,U],Ae,y,Y,Q,ye,B,t,d,w,M,p)};if(ve==="line")for(const it of hg(t.geometry,0,0,Qe,Qe)){const et=eo(it,Me),Xe=Lv(et,R,fe,n.vertical||j,a,24,ae,r.overscaling,Qe);for(const vt of Xe)j&&Nv(r,j.text,De,vt)||qe(et,vt)}else if(ve==="line-center"){for(const it of t.geometry)if(it.length>1){const et=eo(it,Me),Xe=Dv(et,fe,n.vertical||j,a,24,ae);Xe&&qe(et,Xe)}}else if(t.type==="Polygon")for(const it of ko(t.geometry,0)){const et=Fv(it,16);qe(eo(it[0],Me,!0),new cs(et.x,et.y,0))}else if(t.type==="LineString")for(const it of t.geometry){const et=eo(it,Me);qe(et,new cs(et[0].x,et[0].y,0))}else if(t.type==="Point")for(const it of t.geometry)for(const et of it)qe([et],new cs(et.x,et.y,0))}function bg(r,t,n,a,c,d,p,m,y,w,M,C,z,D,B){const j=function(ae,Y,R,U,Q,fe,Ae,ye){const ve=U.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,De=[];for(const Re of Y.positionedLines)for(const Fe of Re.positionedGlyphs){if(!Fe.rect)continue;const Me=Fe.rect||{};let qe=pv+1,it=!0,et=1,Xe=0;const vt=(Q||ye)&&Fe.vertical,hi=Fe.metrics.advance*Fe.scale/2;if(ye&&Y.verticalizable&&(Xe=Re.lineOffset/2-(Fe.imageName?-(Ci-Fe.metrics.width*Fe.scale)/2:(Fe.scale-1)*Ci)),Fe.imageName){const Bi=Ae[Fe.imageName];it=Bi.sdf,et=Bi.pixelRatio,qe=zr/et}const Ii=Q?[Fe.x+hi,Fe.y]:[0,0];let rr=Q?[0,0]:[Fe.x+hi+R[0],Fe.y+R[1]-Xe],Jr=[0,0];vt&&(Jr=rr,rr=[0,0]);const Ar=Fe.metrics.isDoubleResolution?2:1,Gi=(Fe.metrics.left-qe)*Fe.scale-hi+rr[0],si=(-Fe.metrics.top-qe)*Fe.scale+rr[1],Di=Gi+Me.w/Ar*Fe.scale/et,qi=si+Me.h/Ar*Fe.scale/et,Hi=new Ve(Gi,si),wr=new Ve(Di,si),Qr=new Ve(Gi,qi),Li=new Ve(Di,qi);if(vt){const Bi=new Ve(-hi,hi-Vh),Fi=-Math.PI/2,wi=Ci/2-hi,Kt=new Ve(5-Vh-wi,-(Fe.imageName?wi:0)),Ln=new Ve(...Jr);Hi._rotateAround(Fi,Bi)._add(Kt)._add(Ln),wr._rotateAround(Fi,Bi)._add(Kt)._add(Ln),Qr._rotateAround(Fi,Bi)._add(Kt)._add(Ln),Li._rotateAround(Fi,Bi)._add(Kt)._add(Ln)}if(ve){const Bi=Math.sin(ve),Fi=Math.cos(ve),wi=[Fi,-Bi,Bi,Fi];Hi._matMult(wi),wr._matMult(wi),Qr._matMult(wi),Li._matMult(wi)}const Rr=new Ve(0,0),Ei=new Ve(0,0);De.push({tl:Hi,tr:wr,bl:Qr,br:Li,tex:Me,writingMode:Y.writingMode,glyphOffset:Ii,sectionIndex:Fe.sectionIndex,isSDF:it,pixelOffsetTL:Rr,pixelOffsetBR:Ei,minFontScaleX:0,minFontScaleY:0})}return De}(0,n,m,c,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let X=null;$.kind==="source"?(X=[na*c.layout.get("text-size").evaluate(p,{})],X[0]>os&&Vi(`${r.layerIds[0]}: Value for "text-size" is >= ${tu}. Reduce your "text-size".`)):$.kind==="composite"&&(X=[na*D.compositeTextSizes[0].evaluate(p,{},B),na*D.compositeTextSizes[1].evaluate(p,{},B)],(X[0]>os||X[1]>os)&&Vi(`${r.layerIds[0]}: Value for "text-size" is >= ${tu}. Reduce your "text-size".`)),r.addSymbols(r.text,j,X,m,d,p,w,t,y.lineStartIndex,y.lineLength,z,B);for(const ae of M)C[ae]=r.text.placedSymbolArray.length-1;return 4*j.length}function wg(r){for(const t in r)return r[t];return null}function Nv(r,t,n,a){const c=r.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<n)return!0}else c[t]=[];return c[t].push(a),!1}const Tg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class kp{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,a]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=Tg[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 kp(m,p,d,t)}constructor(t,n=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=Tg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=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 zp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,y=[0,d.length-1,0],w=[];for(;y.length;){const M=y.pop()||0,C=y.pop()||0,z=y.pop()||0;if(C-z<=m){for(let $=z;$<=C;$++){const X=p[2*$],ae=p[2*$+1];X>=t&&X<=a&&ae>=n&&ae<=c&&w.push(d[$])}continue}const D=z+C>>1,B=p[2*D],j=p[2*D+1];B>=t&&B<=a&&j>=n&&j<=c&&w.push(d[D]),(M===0?t<=B:n<=j)&&(y.push(z),y.push(D-1),y.push(1-M)),(M===0?a>=B:c>=j)&&(y.push(D+1),y.push(C),y.push(1-M))}return w}within(t,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,m=[0,c.length-1,0],y=[],w=a*a;for(;m.length;){const M=m.pop()||0,C=m.pop()||0,z=m.pop()||0;if(C-z<=p){for(let $=z;$<=C;$++)Sg(d[2*$],d[2*$+1],t,n)<=w&&y.push(c[$]);continue}const D=z+C>>1,B=d[2*D],j=d[2*D+1];Sg(B,j,t,n)<=w&&y.push(c[D]),(M===0?t-a<=B:n-a<=j)&&(m.push(z),m.push(D-1),m.push(1-M)),(M===0?t+a>=B:n+a>=j)&&(m.push(D+1),m.push(C),m.push(1-M))}return y}}function zp(r,t,n,a,c,d){if(c-a<=n)return;const p=a+c>>1;Mg(r,t,p,a,c,d),zp(r,t,n,a,p-1,1-d),zp(r,t,n,p+1,c,1-d)}function Mg(r,t,n,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,M=n-a+1,C=Math.log(w),z=.5*Math.exp(2*C/3),D=.5*Math.sqrt(C*z*(w-z)/w)*(M-w/2<0?-1:1);Mg(r,t,n,Math.max(a,Math.floor(n-M*z/w+D)),Math.min(c,Math.floor(n+(w-M)*z/w+D)),d)}const p=t[2*n+d];let m=a,y=c;for(nu(r,t,a,n),t[2*c+d]>p&&nu(r,t,a,c);m<y;){for(nu(r,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?nu(r,t,a,y):(y++,nu(r,t,y,c)),y<=n&&(a=y+1),n<=y&&(c=y-1)}}function nu(r,t,n,a){Ap(r,n,a),Ap(t,2*n,2*a),Ap(t,2*n+1,2*a+1)}function Ap(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Sg(r,t,n,a){const c=r-n,d=t-a;return c*c+d*d}var Rp;S.cm=void 0,(Rp=S.cm||(S.cm={})).create="create",Rp.load="load",Rp.fullLoad="fullLoad";let Yh=null,au=[];const Dp=1e3/60,Lp="loadTime",Bp="fullLoadTime",Zv={mark(r){performance.mark(r)},frame(r){const t=r;Yh!=null&&au.push(t-Yh),Yh=t},clearMetrics(){Yh=null,au=[],performance.clearMeasures(Lp),performance.clearMeasures(Bp);for(const r in S.cm)performance.clearMarks(S.cm[r])},getPerformanceMetrics(){performance.measure(Lp,S.cm.create,S.cm.load),performance.measure(Bp,S.cm.create,S.cm.fullLoad);const r=performance.getEntriesByName(Lp)[0].duration,t=performance.getEntriesByName(Bp)[0].duration,n=au.length,a=1/(au.reduce((d,p)=>d+p,0)/n/1e3),c=au.filter(d=>d>Dp).reduce((d,p)=>d+(p-Dp)/Dp,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:c/(n+c)*100,totalFrames:n}}};S.$=iu,S.A=Ot,S.B=Ut,S.C=Ht,S.D=Ye,S.E=J,S.F=Mc,S.G=function(r){if(an==null){const t=r.navigator?r.navigator.userAgent:null;an=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return an},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 zv(()=>this.process()),this.subscription=$e(this.target,"message",n=>this.receive(n),!1),this.globalScope=Fr(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((n,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?$e(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},Av):null;this.resolveRejects[c]={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:c,sourceMapId:this.mapId,origin:location.origin,data:Vs(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(Fr(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(t.error?c.reject(Ta(t.error)):c.resolve(Ta(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=Ta(t.data),a=new AbortController;this.abortControllers[r]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,n,a);this.completeTask(r,null,c)}catch(c){this.completeTask(r,c)}})}completeTask(r,t,n){const a=[];delete this.abortControllers[r];const c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Vs(t):null,data:Vs(n,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=_p,S.J=Mn,S.K=function(){var r=new Ot(16);return Ot!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},S.L=function(r,t,n){var a,c,d,p,m,y,w,M,C,z,D,B,j=n[0],$=n[1],X=n[2];return t===r?(r[12]=t[0]*j+t[4]*$+t[8]*X+t[12],r[13]=t[1]*j+t[5]*$+t[9]*X+t[13],r[14]=t[2]*j+t[6]*$+t[10]*X+t[14],r[15]=t[3]*j+t[7]*$+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],z=t[9],D=t[10],B=t[11],r[0]=a=t[0],r[1]=c,r[2]=d,r[3]=p,r[4]=m,r[5]=y,r[6]=w,r[7]=M,r[8]=C,r[9]=z,r[10]=D,r[11]=B,r[12]=a*j+m*$+C*X+t[12],r[13]=c*j+y*$+z*X+t[13],r[14]=d*j+w*$+D*X+t[14],r[15]=p*j+M*$+B*X+t[15]),r},S.M=function(r,t,n){var a=n[0],c=n[1],d=n[2];return r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r[3]=t[3]*a,r[4]=t[4]*c,r[5]=t[5]*c,r[6]=t[6]*c,r[7]=t[7]*c,r[8]=t[8]*d,r[9]=t[9]*d,r[10]=t[10]*d,r[11]=t[11]*d,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.N=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],z=t[9],D=t[10],B=t[11],j=t[12],$=t[13],X=t[14],ae=t[15],Y=n[0],R=n[1],U=n[2],Q=n[3];return r[0]=Y*a+R*m+U*C+Q*j,r[1]=Y*c+R*y+U*z+Q*$,r[2]=Y*d+R*w+U*D+Q*X,r[3]=Y*p+R*M+U*B+Q*ae,r[4]=(Y=n[4])*a+(R=n[5])*m+(U=n[6])*C+(Q=n[7])*j,r[5]=Y*c+R*y+U*z+Q*$,r[6]=Y*d+R*w+U*D+Q*X,r[7]=Y*p+R*M+U*B+Q*ae,r[8]=(Y=n[8])*a+(R=n[9])*m+(U=n[10])*C+(Q=n[11])*j,r[9]=Y*c+R*y+U*z+Q*$,r[10]=Y*d+R*w+U*D+Q*X,r[11]=Y*p+R*M+U*B+Q*ae,r[12]=(Y=n[12])*a+(R=n[13])*m+(U=n[14])*C+(Q=n[15])*j,r[13]=Y*c+R*y+U*z+Q*$,r[14]=Y*d+R*w+U*D+Q*X,r[15]=Y*p+R*M+U*B+Q*ae,r},S.O=function(r,t){const n={};for(let a=0;a<t.length;a++){const c=t[a];c in r&&(n[c]=r[c])}return n},S.P=Ve,S.Q=ls,S.R=Kr,S.S=eg,S.T=Ec,S.U=Qm,S.V=Oi,S.W=ni,S.X=Tn,S.Y=Yr,S.Z=Qe,S._=o,S.a=gr,S.a$=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[4],p=t[5],m=t[6],y=t[7],w=t[8],M=t[9],C=t[10],z=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=d*c+w*a,r[5]=p*c+M*a,r[6]=m*c+C*a,r[7]=y*c+z*a,r[8]=w*c-d*a,r[9]=M*c-p*a,r[10]=C*c-m*a,r[11]=z*c-y*a,r},S.a0=25,S.a1=Cp,S.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const c=window.document.createElement("source");Sn(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},S.a3=we,S.a4=function(){return bn++},S.a5=_,S.a6=ll,S.a7=pc,S.a8=ra,S.a9=og,S.aA=function(r,t,n,a,c=!1){if(!n[0]&&!n[1])return[0,0];const d=c?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);n=[n[0]*m-n[1]*p,n[0]*p+n[1]*m]}return[c?n[0]:pi(t,n[0],r.zoom),c?n[1]:pi(t,n[1],r.zoom)]},S.aC=vp,S.aD=Ep,S.aE=xp,S.aF=kp,S.aG=vi,S.aH=jh,S.aI=K,S.aJ=lt,S.aK=Be,S.aL=Ki,S.aM=ft,S.aN=ig,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 Ot(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},S.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},S.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},S.aT=function(r,t){var n=t[0],a=t[1],c=t[2],d=n*n+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=t[0]*d,r[1]=t[1]*d,r[2]=t[2]*d,r},S.aU=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[0],m=n[1],y=n[2];return r[0]=c*y-d*m,r[1]=d*p-a*y,r[2]=a*m-c*p,r},S.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},S.aW=ng,S.aX=cl,S.aY=function(r,t,n,a,c){var d,p=1/Math.tan(t/2);return r[0]=p/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0?(r[10]=(c+a)*(d=1/(a-c)),r[14]=2*c*a*d):(r[10]=-1,r[14]=-2*a),r},S.aZ=function(r){var t=new Ot(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},S.a_=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],w=t[4],M=t[5],C=t[6],z=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c+w*a,r[1]=p*c+M*a,r[2]=m*c+C*a,r[3]=y*c+z*a,r[4]=w*c-d*a,r[5]=M*c-p*a,r[6]=C*c-m*a,r[7]=z*c-y*a,r},S.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t},S.ab=function(r){return r*Math.PI/180},S.ac=function(r){return Math.pow(2,r)},S.ad=Et,S.ae=Vt,S.af=85.051129,S.ag=tg,S.ah=function(r){return Math.log(r)/Math.LN2},S.ai=function(r){var t=r[0],n=r[1];return t*t+n*n},S.aj=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},S.ak=function(r,t){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=r,m=c?Vt(xr.interpolationFactor(c,t,d,p),0,1):0;r.kind==="camera"?a=Ut.number(r.minSize,r.maxSize,m):n=m}return{uSizeT:n,uSize:a}},S.am=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:c}){return r.kind==="source"?a/na:r.kind==="composite"?Ut.number(a/na,c/na,n):t},S.an=function(r,t){var n=t[0],a=t[1],c=t[2],d=t[3],p=t[4],m=t[5],y=t[6],w=t[7],M=t[8],C=t[9],z=t[10],D=t[11],B=t[12],j=t[13],$=t[14],X=t[15],ae=n*m-a*p,Y=n*y-c*p,R=n*w-d*p,U=a*y-c*m,Q=a*w-d*m,fe=c*w-d*y,Ae=M*j-C*B,ye=M*$-z*B,ve=M*X-D*B,De=C*$-z*j,Re=C*X-D*j,Fe=z*X-D*$,Me=ae*Fe-Y*Re+R*De+U*ve-Q*ye+fe*Ae;return Me?(r[0]=(m*Fe-y*Re+w*De)*(Me=1/Me),r[1]=(c*Re-a*Fe-d*De)*Me,r[2]=(j*fe-$*Q+X*U)*Me,r[3]=(z*Q-C*fe-D*U)*Me,r[4]=(y*ve-p*Fe-w*ye)*Me,r[5]=(n*Fe-c*ve+d*ye)*Me,r[6]=($*R-B*fe-X*Y)*Me,r[7]=(M*fe-z*R+D*Y)*Me,r[8]=(p*Re-m*ve+w*Ae)*Me,r[9]=(a*ve-n*Re-d*Ae)*Me,r[10]=(B*Q-j*R+X*ae)*Me,r[11]=(C*R-M*Q-D*ae)*Me,r[12]=(m*ye-p*De-y*Ae)*Me,r[13]=(n*De-a*ye+c*Ae)*Me,r[14]=(j*Y-B*U-$*ae)*Me,r[15]=(M*U-C*Y+z*ae)*Me,r):null},S.ao=Ni,S.ap=function(r){return Math.hypot(r[0],r[1])},S.aq=function(r){return r[0]=0,r[1]=0,r},S.ar=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},S.as=bp,S.at=xi,S.au=function(r,t,n,a){const c=t.y-r.y,d=t.x-r.x,p=a.y-n.y,m=a.x-n.x,y=p*d-m*c;if(y===0)return null;const w=(m*(r.y-n.y)-p*(r.x-n.x))/y;return new Ve(r.x+w*d,r.y+w*c)},S.av=hg,S.aw=Nc,S.ax=function(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,n,a,c]},S.ay=Ci,S.az=pi,S.b=fr,S.b$=function(r,t){var n=r[0],a=r[1],c=r[2],d=r[3],p=r[4],m=r[5],y=r[6],w=r[7],M=r[8],C=r[9],z=r[10],D=r[11],B=r[12],j=r[13],$=r[14],X=r[15],ae=t[0],Y=t[1],R=t[2],U=t[3],Q=t[4],fe=t[5],Ae=t[6],ye=t[7],ve=t[8],De=t[9],Re=t[10],Fe=t[11],Me=t[12],qe=t[13],it=t[14],et=t[15];return Math.abs(n-ae)<=Zt*Math.max(1,Math.abs(n),Math.abs(ae))&&Math.abs(a-Y)<=Zt*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-R)<=Zt*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-U)<=Zt*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-Q)<=Zt*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(m-fe)<=Zt*Math.max(1,Math.abs(m),Math.abs(fe))&&Math.abs(y-Ae)<=Zt*Math.max(1,Math.abs(y),Math.abs(Ae))&&Math.abs(w-ye)<=Zt*Math.max(1,Math.abs(w),Math.abs(ye))&&Math.abs(M-ve)<=Zt*Math.max(1,Math.abs(M),Math.abs(ve))&&Math.abs(C-De)<=Zt*Math.max(1,Math.abs(C),Math.abs(De))&&Math.abs(z-Re)<=Zt*Math.max(1,Math.abs(z),Math.abs(Re))&&Math.abs(D-Fe)<=Zt*Math.max(1,Math.abs(D),Math.abs(Fe))&&Math.abs(B-Me)<=Zt*Math.max(1,Math.abs(B),Math.abs(Me))&&Math.abs(j-qe)<=Zt*Math.max(1,Math.abs(j),Math.abs(qe))&&Math.abs($-it)<=Zt*Math.max(1,Math.abs($),Math.abs(it))&&Math.abs(X-et)<=Zt*Math.max(1,Math.abs(X),Math.abs(et))},S.b0=function(){const r=new Float32Array(16);return Et(r),r},S.b1=function(){const r=new Float64Array(16);return Et(r),r},S.b2=function(){return new Float64Array(16)},S.b3=function(r,t,n){const a=new Float64Array(4);return function(c,d,p,m){var y=.5*Math.PI/180;d*=y,p*=y,m*=y;var w=Math.sin(d),M=Math.cos(d),C=Math.sin(p),z=Math.cos(p),D=Math.sin(m),B=Math.cos(m);c[0]=w*z*B-M*C*D,c[1]=M*C*B+w*z*D,c[2]=M*z*D-w*C*B,c[3]=M*z*B+w*C*D}(a,r,t-90,n),a},S.b4=function(r,t,n,a){var c,d,p,m,y,w=t[0],M=t[1],C=t[2],z=t[3],D=n[0],B=n[1],j=n[2],$=n[3];return(d=w*D+M*B+C*j+z*$)<0&&(d=-d,D=-D,B=-B,j=-j,$=-$),1-d>Zt?(c=Math.acos(d),p=Math.sin(c),m=Math.sin((1-a)*c)/p,y=Math.sin(a*c)/p):(m=1-a,y=a),r[0]=m*w+y*D,r[1]=m*M+y*B,r[2]=m*C+y*j,r[3]=m*z+y*$,r},S.b5=function(r){const t=new Float64Array(9);var n,a,c,d,p,m,y,w,M,C,z,D,B,j,$,X,ae,Y;C=(c=(a=r)[0])*(y=c+c),z=(d=a[1])*y,B=(p=a[2])*y,j=p*(w=d+d),X=(m=a[3])*y,ae=m*w,Y=m*(M=p+p),(n=t)[0]=1-(D=d*w)-($=p*M),n[3]=z-Y,n[6]=B+ae,n[1]=z+Y,n[4]=1-C-$,n[7]=j-X,n[2]=B-ae,n[5]=j+X,n[8]=1-C-D;const R=ft(-Math.asin(Vt(t[2],-1,1)));let U,Q;return Math.hypot(t[5],t[8])<.001?(U=0,Q=-ft(Math.atan2(t[3],t[4]))):(U=ft(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=ft(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:R+90,bearing:Q}},S.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},S.b7=gt,S.b8=Pa,S.b9=sl,S.bA=function(r){if(r.type==="custom")return new kv(r);switch(r.type){case"background":return new Cv(r);case"circle":return new wx(r);case"fill":return new Zx(r);case"fill-extrusion":return new Xx(r);case"heatmap":return new Mx(r);case"hillshade":return new Px(r);case"line":return new rv(r);case"raster":return new Ev(r);case"symbol":return new qh(r)}},S.bB=ar,S.bC=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let n=[];try{if(!ie(r.version,t.version))return[{command:"setStyle",args:[t]}];ie(r.center,t.center)||n.push({command:"setCenter",args:[t.center]}),ie(r.centerAltitude,t.centerAltitude)||n.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ie(r.zoom,t.zoom)||n.push({command:"setZoom",args:[t.zoom]}),ie(r.bearing,t.bearing)||n.push({command:"setBearing",args:[t.bearing]}),ie(r.pitch,t.pitch)||n.push({command:"setPitch",args:[t.pitch]}),ie(r.roll,t.roll)||n.push({command:"setRoll",args:[t.roll]}),ie(r.sprite,t.sprite)||n.push({command:"setSprite",args:[t.sprite]}),ie(r.glyphs,t.glyphs)||n.push({command:"setGlyphs",args:[t.glyphs]}),ie(r.transition,t.transition)||n.push({command:"setTransition",args:[t.transition]}),ie(r.light,t.light)||n.push({command:"setLight",args:[t.light]}),ie(r.terrain,t.terrain)||n.push({command:"setTerrain",args:[t.terrain]}),ie(r.sky,t.sky)||n.push({command:"setSky",args:[t.sky]}),ie(r.projection,t.projection)||n.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,m,y,w){let M;for(M in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,M)&&(Object.prototype.hasOwnProperty.call(m,M)||ue(M,y,w));for(M in m)Object.prototype.hasOwnProperty.call(m,M)&&(Object.prototype.hasOwnProperty.call(p,M)?ie(p[M],m[M])||(p[M].type==="geojson"&&m[M].type==="geojson"&&Ne(p,m,M)?_e(y,{command:"setGeoJSONSourceData",args:[M,m[M].data]}):ze(M,m,y,w)):xe(M,m,y))})(r.sources,t.sources,c,a);const d=[];r.layers&&r.layers.forEach(p=>{"source"in p&&a[p.source]?n.push({command:"removeLayer",args:[p.id]}):d.push(p)}),n=n.concat(c),function(p,m,y){m=m||[];const w=(p=p||[]).map(nt),M=m.map(nt),C=p.reduce(dt,{}),z=m.reduce(dt,{}),D=w.slice(),B=Object.create(null);let j,$,X,ae,Y;for(let R=0,U=0;R<w.length;R++)j=w[R],Object.prototype.hasOwnProperty.call(z,j)?U++:(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.indexOf(j,U),1));for(let R=0,U=0;R<M.length;R++)j=M[M.length-1-R],D[D.length-1-R]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.lastIndexOf(j,D.length-U),1)):U++,ae=D[D.length-R],_e(y,{command:"addLayer",args:[z[j],ae]}),D.splice(D.length-R,0,j),B[j]=!0);for(let R=0;R<M.length;R++)if(j=M[R],$=C[j],X=z[j],!B[j]&&!ie($,X))if(ie($.source,X.source)&&ie($["source-layer"],X["source-layer"])&&ie($.type,X.type)){for(Y in Ze($.layout,X.layout,y,j,null,"setLayoutProperty"),Ze($.paint,X.paint,y,j,null,"setPaintProperty"),ie($.filter,X.filter)||_e(y,{command:"setFilter",args:[j,X.filter]}),ie($.minzoom,X.minzoom)&&ie($.maxzoom,X.maxzoom)||_e(y,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ze($[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ze($[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else _e(y,{command:"removeLayer",args:[j]}),ae=D[D.lastIndexOf(j)+1],_e(y,{command:"addLayer",args:[X,ae]})}(d,t.layers,n)}catch(a){console.warn("Unable to compute style diff:",a),n=[{command:"setStyle",args:[t]}]}return n},S.bD=function(r){const t=[],n=r.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},S.bE=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!r(t[a],n[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&n!==null){if(typeof n!="object"||Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(!r(t[a],n[a]))return!1;return!0}return t===n},S.bF=nn,S.bG=ha,S.bH=class extends mn{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},S.bI=Er,S.bJ=class extends mn{constructor(r,t){super(r,t),this.current=ia}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},S.bK=Ca,S.bL=class extends mn{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},S.bM=class extends mn{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},S.bN=Wi,S.bO=function(r,t){var n=Math.sin(t),a=Math.cos(t);return r[0]=a,r[1]=n,r[2]=0,r[3]=-n,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},S.bP=function(r,t,n){var a=t[0],c=t[1],d=t[2];return r[0]=a*n[0]+c*n[3]+d*n[6],r[1]=a*n[1]+c*n[4]+d*n[7],r[2]=a*n[2]+c*n[5]+d*n[8],r},S.bQ=function(r,t,n,a,c,d,p){var m=1/(t-n),y=1/(a-c),w=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*w,r[11]=0,r[12]=(t+n)*m,r[13]=(c+a)*y,r[14]=(p+d)*w,r[15]=1,r},S.bR=class extends Sa{},S.bS=ov,S.bT=class extends il{},S.bU=tp,S.bV=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},S.bW=sm,S.bX=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[3]*a+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*a+n[4]*c+n[8]*d+n[12])/(p=p||1),r[1]=(n[1]*a+n[5]*c+n[9]*d+n[13])/p,r[2]=(n[2]*a+n[6]*c+n[10]*d+n[14])/p,r},S.bY=class extends kn{},S.bZ=class extends l{},S.b_=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},S.ba=Wc,S.bb=al,S.bc=Cr,S.bd=ki,S.be=cr,S.bf=function(r,t,n,a,c){return Cr(a,c,Vt((r-t)/(n-t),0,1))},S.bg=fi,S.bh=function(){return new Float64Array(3)},S.bi=function(r,t,n,a){return r[0]=t[0]+n[0]*a,r[1]=t[1]+n[1]*a,r[2]=t[2]+n[2]*a,r},S.bj=Xi,S.bk=function(){return new Float64Array(4)},S.bl=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bm=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bn=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bo=qn,S.bp=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],w=t[8],M=t[9],C=t[10],z=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c-w*a,r[1]=p*c-M*a,r[2]=m*c-C*a,r[3]=y*c-z*a,r[8]=d*a+w*c,r[9]=p*a+M*c,r[10]=m*a+C*c,r[11]=y*a+z*c,r},S.bq=function(r,t){const n=fi(r,360),a=fi(t,360),c=a-n,d=a>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},S.br=function(r){return r[0]=0,r[1]=0,r[2]=0,r},S.bs=function(r,t,n,a){const c=Math.sqrt(r*r+t*t),d=Math.sqrt(n*n+a*a);r/=c,t/=c,n/=d,a/=d;const p=Math.acos(r*n+t*a);return-t*n+r*a>0?p:-p},S.bt=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},S.bu=Sp,S.bv=function(r,t){const n=fi(r,2*Math.PI),a=fi(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},S.bw=function(){const r={},t=V.$version;for(const n in V.$root){const a=V.$root[n];if(a.required){let c=null;c=n==="version"?t:a.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},S.bx=Us,S.by=sn,S.bz=function(r){r=r.slice();const t=Object.create(null);for(let n=0;n<r.length;n++)t[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ge(r[n],t[r[n].ref]));return r},S.c=mr,S.c0=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.c1=r=>r.type==="symbol",S.c2=r=>r.type==="circle",S.c3=r=>r.type==="heatmap",S.c4=r=>r.type==="line",S.c5=r=>r.type==="fill",S.c6=r=>r.type==="fill-extrusion",S.c7=r=>r.type==="hillshade",S.c8=r=>r.type==="raster",S.c9=r=>r.type==="background",S.cA=Kc,S.cB=mp,S.cC=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},S.cD=function(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(ni())try{return yield Tn(r,t,n,a,c)}catch{}return function(d,p,m,y,w){const M=d.width,C=d.height;Ee&&Je||(Ee=new OffscreenCanvas(M,C),Je=Ee.getContext("2d",{willReadFrequently:!0})),Ee.width=M,Ee.height=C,Je.drawImage(d,0,0,M,C);const z=Je.getImageData(p,m,y,w);return Je.clearRect(0,0,M,C),z.data}(r,t,n,a,c)})},S.cE=ag,S.cF=he,S.cG=Le,S.cH=Tm,S.cI=Lm,S.cJ=Os,S.cK=ea,S.ca=r=>r.type==="custom",S.cb=vn,S.cc=function(r,t,n){const a=Br(t.x-n.x,t.y-n.y),c=Br(r.x-n.x,r.y-n.y);var d,p;return ft(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},S.cd=Zi,S.ce=function(r,t){return or[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},S.cf=function(r,t){return Gt[t]&&"touches"in r},S.cg=function(r){return Gt[r]||or[r]},S.ch=function(r,t,n){var a=t[0],c=t[1];return r[0]=n[0]*a+n[4]*c+n[12],r[1]=n[1]*a+n[5]*c+n[13],r},S.ci=function(r,t){const{x:n,y:a}=iu.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},S.cj=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},S.ck=class extends Qo{},S.cl=Zv,S.cn=function(r){return r.message===mi},S.co=Hn,S.cp=function(r,t){gr.REGISTERED_PROTOCOLS[r]=t},S.cq=function(r){delete gr.REGISTERED_PROTOCOLS[r]},S.cr=function(r,t){const n={};for(let c=0;c<r.length;c++){const d=t&&t[r[c].id]||Ho(r[c]);t&&(t[r[c].id]=d);let p=n[d];p||(p=n[d]=[]),p.push(r[c])}const a=[];for(const c in n)a.push(n[c]);return a},S.cs=Ue,S.ct=sg,S.cu=lg,S.cv=Fm,S.cw=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Qe/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],n=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new Ht(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Ht(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Ht(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Ht(w),r.canonical),a["text-size"].possiblyEvaluate(new Ht(M),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Ht(w),r.canonical),a["icon-size"].possiblyEvaluate(new Ht(M),r.canonical)]}const d=n.get("text-line-height")*Ci,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 w of r.bucket.features){const M=n.get("text-font").evaluate(w,{},r.canonical).join(","),C=y.evaluate(w,{},r.canonical),z=c.layoutTextSize.evaluate(w,{},r.canonical),D=c.layoutIconSize.evaluate(w,{},r.canonical),B={horizontal:{},vertical:void 0},j=w.text;let $,X=[0,0];if(j){const R=j.toString(),U=n.get("text-letter-spacing").evaluate(w,{},r.canonical)*Ci,Q=Th(R)?U:0,fe=n.get("text-anchor").evaluate(w,{},r.canonical),Ae=vg(t,w,r.canonical);if(!Ae){const Re=n.get("text-radial-offset").evaluate(w,{},r.canonical);X=Re?xg(fe,[Re*Ci,Ip]):n.get("text-offset").evaluate(w,{},r.canonical).map(Fe=>Fe*Ci)}let ye=p?"center":n.get("text-justify").evaluate(w,{},r.canonical);const ve=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(w,{},r.canonical)*Ci:1/0,De=()=>{r.bucket.allowVerticalPlacement&&Wo(R)&&(B.vertical=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,fe,"left",Q,X,S.al.vertical,!0,z,C))};if(!p&&Ae){const Re=new Set;if(ye==="auto")for(let Me=0;Me<Ae.values.length;Me+=2)Re.add(Ep(Ae.values[Me]));else Re.add(ye);let Fe=!1;for(const Me of Re)if(!B.horizontal[Me])if(Fe)B.horizontal[Me]=B.horizontal[0];else{const qe=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,"center",Me,Q,X,S.al.horizontal,!1,z,C);qe&&(B.horizontal[Me]=qe,Fe=qe.positionedLines.length===1)}De()}else{ye==="auto"&&(ye=Ep(fe));const Re=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,fe,ye,Q,X,S.al.horizontal,!1,z,C);Re&&(B.horizontal[ye]=Re),De(),Wo(R)&&p&&m&&(B.vertical=Uh(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,ve,d,fe,ye,Q,X,S.al.vertical,!1,z,C))}}let ae=!1;if(w.icon&&w.icon.name){const R=r.imageMap[w.icon.name];R&&($=wv(r.imagePositions[w.icon.name],n.get("icon-offset").evaluate(w,{},r.canonical),n.get("icon-anchor").evaluate(w,{},r.canonical)),ae=!!R.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=ae:r.bucket.sdfIcons!==ae&&Vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==r.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const Y=wg(B.horizontal)||B.vertical;r.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&jv(r.bucket,w,B,$,r.imageMap,c,z,D,X,ae,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},S.cx=dp,S.cy=sp,S.cz=hp,S.d=Sn,S.e=Yi,S.f=r=>o(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.g=da,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=wn})},a.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const c=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(c):wn}),S.i=Fr,S.j=(r,t)=>_r(Yi(r,{type:"json"}),t),S.k=G,S.l=Z,S.m=_r,S.n=(r,t)=>_r(Yi(r,{type:"arrayBuffer"}),t),S.o=function(r){return new mp(r).readFields(uv,[])},S.p=Bm,S.q=Uc,S.r=br,S.s=$e,S.t=vh,S.u=xt,S.v=V,S.w=Vi,S.x=bh,S.y=hn,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)}}}),A("worker",["./shared"],function(S){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,Z){for(const J of N){this._layerConfigs[J.id]=J;const V=this._layers[J.id]=S.bA(J);V._featureFilter=S.a7(V.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of Z)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const G=S.cr(Object.values(this._layerConfigs),this.keyCache);for(const J of G){const V=J.map(ue=>this._layers[ue.id]),le=V[0];if(le.visibility==="none")continue;const ge=le.source||"";let ie=this.familiesBySource[ge];ie||(ie=this.familiesBySource[ge]={});const _e=le.sourceLayer||"_geojsonTileLayer";let xe=ie[_e];xe||(xe=ie[_e]=[]),xe.push(V)}}}class he{constructor(N){const Z={},G=[];for(const ge in N){const ie=N[ge],_e=Z[ge]={};for(const xe in ie){const ue=ie[+xe];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const ze={x:0,y:0,w:ue.bitmap.width+2,h:ue.bitmap.height+2};G.push(ze),_e[xe]={rect:ze,metrics:ue.metrics}}}const{w:J,h:V}=S.p(G),le=new S.q({width:J||1,height:V||1});for(const ge in N){const ie=N[ge];for(const _e in ie){const xe=ie[+_e];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;const ue=Z[ge][_e].rect;S.q.copy(xe.bitmap,le,{x:0,y:0},{x:ue.x+1,y:ue.y+1},xe.bitmap)}}this.image=le,this.positions=Z}}S.cs("GlyphAtlas",he);class pe{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,Z,G,J,V){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const le=new S.ct(Object.keys(N.layers).sort()),ge=new S.cu(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const ie={},_e={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:V},xe=Z.familiesBySource[this.source];for(const Pe in xe){const Ge=N.layers[Pe];if(!Ge)continue;Ge.version===1&&S.w(`Vector tile source "${this.source}" layer "${Pe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const tt=le.encode(Pe),lr=[];for(let Ji=0;Ji<Ge.length;Ji++){const Qt=Ge.feature(Ji),ct=ge.getId(Qt,Pe);lr.push({feature:Qt,id:ct,index:Ji,sourceLayerIndex:tt})}for(const Ji of xe[Pe]){const Qt=Ji[0];Qt.source!==this.source&&S.w(`layer.source = ${Qt.source} does not equal this.source = ${this.source}`),Qt.minzoom&&this.zoom<Math.floor(Qt.minzoom)||Qt.maxzoom&&this.zoom>=Qt.maxzoom||Qt.visibility!=="none"&&(Ce(Ji,this.zoom,G),(ie[Qt.id]=Qt.createBucket({index:ge.bucketLayerIDs.length,layers:Ji,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:tt,sourceID:this.source})).populate(lr,_e,this.tileID.canonical),ge.bucketLayerIDs.push(Ji.map(ct=>ct.id)))}}const ue=S.bF(_e.glyphDependencies,Pe=>Object.keys(Pe).map(Number));this.inFlightDependencies.forEach(Pe=>Pe==null?void 0:Pe.abort()),this.inFlightDependencies=[];let ze=Promise.resolve({});if(Object.keys(ue).length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),ze=J.sendAsync({type:"GG",data:{stacks:ue,source:this.source,tileID:this.tileID,type:"glyphs"}},Pe)}const Ne=Object.keys(_e.iconDependencies);let Ze=Promise.resolve({});if(Ne.length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),Ze=J.sendAsync({type:"GI",data:{icons:Ne,source:this.source,tileID:this.tileID,type:"icons"}},Pe)}const nt=Object.keys(_e.patternDependencies);let dt=Promise.resolve({});if(nt.length){const Pe=new AbortController;this.inFlightDependencies.push(Pe),dt=J.sendAsync({type:"GI",data:{icons:nt,source:this.source,tileID:this.tileID,type:"patterns"}},Pe)}const[we,st,St]=yield Promise.all([ze,Ze,dt]),Rt=new he(we),Pt=new S.cv(st,St);for(const Pe in ie){const Ge=ie[Pe];Ge instanceof S.a6?(Ce(Ge.layers,this.zoom,G),S.cw({bucket:Ge,glyphMap:we,glyphPositions:Rt.positions,imageMap:st,imagePositions:Pt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:_e.subdivisionGranularity})):Ge.hasPattern&&(Ge instanceof S.cx||Ge instanceof S.cy||Ge instanceof S.cz)&&(Ce(Ge.layers,this.zoom,G),Ge.addFeatures(_e,this.tileID.canonical,Pt.patternPositions))}return this.status="done",{buckets:Object.values(ie).filter(Pe=>!Pe.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Rt.image,imageAtlas:Pt,glyphMap:this.returnDependencies?we:null,iconMap:this.returnDependencies?st:null,glyphPositions:this.returnDependencies?Rt.positions:null}})}}function Ce(ce,N,Z){const G=new S.C(N);for(const J of ce)J.recalculate(G,Z)}class Le{constructor(N,Z,G){this.actor=N,this.layerIndex=Z,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=yield S.n(N.request,Z);try{return{vectorTile:new S.cA.VectorTile(new S.cB(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(J){const V=new Uint8Array(G.data);let le=`Unable to parse the tile at ${N.request.url}, `;throw le+=V[0]===31&&V[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(le)}})}loadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request),J=new pe(N);this.loading[Z]=J;const V=new AbortController;J.abort=V;try{const le=yield this.loadVectorTile(N,V);if(delete this.loading[Z],!le)return null;const ge=le.rawData,ie={};le.expires&&(ie.expires=le.expires),le.cacheControl&&(ie.cacheControl=le.cacheControl);const _e={};if(G){const ue=G.finish();ue&&(_e.resourceTiming=JSON.parse(JSON.stringify(ue)))}J.vectorTile=le.vectorTile;const xe=J.parse(le.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[Z]=J,this.fetching[Z]={rawTileData:ge,cacheControl:ie,resourceTiming:_e};try{const ue=yield xe;return S.e({rawTileData:ge.slice(0)},ue,ie,_e)}finally{delete this.fetching[Z]}}catch(le){throw delete this.loading[Z],J.status="done",this.loaded[Z]=J,le}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[Z];if(G.showCollisionBoxes=N.showCollisionBoxes,G.status==="parsing"){const J=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let V;if(this.fetching[Z]){const{rawTileData:le,cacheControl:ge,resourceTiming:ie}=this.fetching[Z];delete this.fetching[Z],V=S.e({rawTileData:le.slice(0)},J,ge,ie)}else V=J;return V}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const Z=this.loading,G=N.uid;Z&&Z[G]&&Z[G].abort&&(Z[G].abort.abort(),delete Z[G])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ie{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:Z,encoding:G,rawImageData:J,redFactor:V,greenFactor:le,blueFactor:ge,baseShift:ie}=N,_e=J.width+2,xe=J.height+2,ue=S.b(J)?new S.R({width:_e,height:xe},yield S.cD(J,-1,-1,_e,xe)):J,ze=new S.cE(Z,ue,G,V,le,ge,ie);return this.loaded=this.loaded||{},this.loaded[Z]=ze,ze})}removeTile(N){const Z=this.loaded,G=N.uid;Z&&Z[G]&&delete Z[G]}}var oe,Ve,Bt=function(){if(Ve)return oe;function ce(Z,G){if(Z.length!==0){N(Z[0],G);for(var J=1;J<Z.length;J++)N(Z[J],!G)}}function N(Z,G){for(var J=0,V=0,le=0,ge=Z.length,ie=ge-1;le<ge;ie=le++){var _e=(Z[le][0]-Z[ie][0])*(Z[ie][1]+Z[le][1]),xe=J+_e;V+=Math.abs(J)>=Math.abs(_e)?J-xe+_e:_e-xe+J,J=xe}J+V>=0!=!!G&&Z.reverse()}return Ve=1,oe=function Z(G,J){var V,le=G&&G.type;if(le==="FeatureCollection")for(V=0;V<G.features.length;V++)Z(G.features[V],J);else if(le==="GeometryCollection")for(V=0;V<G.geometries.length;V++)Z(G.geometries[V],J);else if(le==="Feature")Z(G.geometry,J);else if(le==="Polygon")ce(G.coordinates,J);else if(le==="MultiPolygon")for(V=0;V<G.coordinates.length;V++)ce(G.coordinates[V],J);return G}}(),ri=S.cF(Bt);const Ft=S.cA.VectorTileFeature.prototype.toGeoJSON;class oi{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const Z of this._feature.geometry)N.push([new S.P(Z[0],Z[1])]);return N}{const N=[];for(const Z of this._feature.geometry){const G=[];for(const J of Z)G.push(new S.P(J[0],J[1]));N.push(G)}return N}}toGeoJSON(N,Z,G){return Ft.call(this,N,Z,G)}}class Oi{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new oi(this._features[N])}}var ni,Zt,Ot,Wi={exports:{}},Et=function(){if(Ot)return Wi.exports;Ot=1;var ce=S.cI(),N=function(){if(Zt)return ni;Zt=1;var xe=S.cG(),ue=S.cH().VectorTileFeature;function ze(Ze,nt){this.options=nt||{},this.features=Ze,this.length=Ze.length}function Ne(Ze,nt){this.id=typeof Ze.id=="number"?Ze.id:void 0,this.type=Ze.type,this.rawGeometry=Ze.type===1?[Ze.geometry]:Ze.geometry,this.properties=Ze.tags,this.extent=nt||4096}return ni=ze,ze.prototype.feature=function(Ze){return new Ne(this.features[Ze],this.options.extent)},Ne.prototype.loadGeometry=function(){var Ze=this.rawGeometry;this.geometry=[];for(var nt=0;nt<Ze.length;nt++){for(var dt=Ze[nt],we=[],st=0;st<dt.length;st++)we.push(new xe(dt[st][0],dt[st][1]));this.geometry.push(we)}return this.geometry},Ne.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ze=this.geometry,nt=1/0,dt=-1/0,we=1/0,st=-1/0,St=0;St<Ze.length;St++)for(var Rt=Ze[St],Pt=0;Pt<Rt.length;Pt++){var Pe=Rt[Pt];nt=Math.min(nt,Pe.x),dt=Math.max(dt,Pe.x),we=Math.min(we,Pe.y),st=Math.max(st,Pe.y)}return[nt,we,dt,st]},Ne.prototype.toGeoJSON=ue.prototype.toGeoJSON,ni}();function Z(xe){var ue=new ce;return function(ze,Ne){for(var Ze in ze.layers)Ne.writeMessage(3,G,ze.layers[Ze])}(xe,ue),ue.finish()}function G(xe,ue){var ze;ue.writeVarintField(15,xe.version||1),ue.writeStringField(1,xe.name||""),ue.writeVarintField(5,xe.extent||4096);var Ne={keys:[],values:[],keycache:{},valuecache:{}};for(ze=0;ze<xe.length;ze++)Ne.feature=xe.feature(ze),ue.writeMessage(2,J,Ne);var Ze=Ne.keys;for(ze=0;ze<Ze.length;ze++)ue.writeStringField(3,Ze[ze]);var nt=Ne.values;for(ze=0;ze<nt.length;ze++)ue.writeMessage(4,_e,nt[ze])}function J(xe,ue){var ze=xe.feature;ze.id!==void 0&&ue.writeVarintField(1,ze.id),ue.writeMessage(2,V,xe),ue.writeVarintField(3,ze.type),ue.writeMessage(4,ie,ze)}function V(xe,ue){var ze=xe.feature,Ne=xe.keys,Ze=xe.values,nt=xe.keycache,dt=xe.valuecache;for(var we in ze.properties){var st=ze.properties[we],St=nt[we];if(st!==null){St===void 0&&(Ne.push(we),nt[we]=St=Ne.length-1),ue.writeVarint(St);var Rt=typeof st;Rt!=="string"&&Rt!=="boolean"&&Rt!=="number"&&(st=JSON.stringify(st));var Pt=Rt+":"+st,Pe=dt[Pt];Pe===void 0&&(Ze.push(st),dt[Pt]=Pe=Ze.length-1),ue.writeVarint(Pe)}}}function le(xe,ue){return(ue<<3)+(7&xe)}function ge(xe){return xe<<1^xe>>31}function ie(xe,ue){for(var ze=xe.loadGeometry(),Ne=xe.type,Ze=0,nt=0,dt=ze.length,we=0;we<dt;we++){var st=ze[we],St=1;Ne===1&&(St=st.length),ue.writeVarint(le(1,St));for(var Rt=Ne===3?st.length-1:st.length,Pt=0;Pt<Rt;Pt++){Pt===1&&Ne!==1&&ue.writeVarint(le(2,Rt-1));var Pe=st[Pt].x-Ze,Ge=st[Pt].y-nt;ue.writeVarint(ge(Pe)),ue.writeVarint(ge(Ge)),Ze+=Pe,nt+=Ge}Ne===3&&ue.writeVarint(le(7,1))}}function _e(xe,ue){var ze=typeof xe;ze==="string"?ue.writeStringField(1,xe):ze==="boolean"?ue.writeBooleanField(7,xe):ze==="number"&&(xe%1!=0?ue.writeDoubleField(3,xe):xe<0?ue.writeSVarintField(6,xe):ue.writeVarintField(5,xe))}return Wi.exports=Z,Wi.exports.fromVectorTileJs=Z,Wi.exports.fromGeojsonVt=function(xe,ue){ue=ue||{};var ze={};for(var Ne in xe)ze[Ne]=new N(xe[Ne].features,ue),ze[Ne].name=Ne,ze[Ne].version=ue.version,ze[Ne].extent=ue.extent;return Z({layers:ze})},Wi.exports.GeoJSONWrapper=N,Wi.exports}(),nr=S.cF(Et);const qn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ce=>ce},Lr=Math.fround||(ji=new Float32Array(1),ce=>(ji[0]=+ce,ji[0]));var ji;const Xi=3,xi=5,Pr=6;class Ni{constructor(N){this.options=Object.assign(Object.create(qn),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:Z,minZoom:G,maxZoom:J}=this.options;Z&&console.time("total time");const V=`prepare ${N.length} points`;Z&&console.time(V),this.points=N;const le=[];for(let ie=0;ie<N.length;ie++){const _e=N[ie];if(!_e.geometry)continue;const[xe,ue]=_e.geometry.coordinates,ze=Lr(pi(xe)),Ne=Lr(fi(ue));le.push(ze,Ne,1/0,ie,-1,1),this.options.reduce&&le.push(0)}let ge=this.trees[J+1]=this._createTree(le);Z&&console.timeEnd(V);for(let ie=J;ie>=G;ie--){const _e=+Date.now();ge=this.trees[ie]=this._createTree(this._cluster(ge,ie)),Z&&console.log("z%d: %d clusters in %dms",ie,ge.numItems,+Date.now()-_e)}return Z&&console.timeEnd("total time"),this}getClusters(N,Z){let G=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let V=N[2]===180?180:((N[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,V=180;else if(G>V){const ue=this.getClusters([G,J,180,le],Z),ze=this.getClusters([-180,J,V,le],Z);return ue.concat(ze)}const ge=this.trees[this._limitZoom(Z)],ie=ge.range(pi(G),fi(le),pi(V),fi(J)),_e=ge.data,xe=[];for(const ue of ie){const ze=this.stride*ue;xe.push(_e[ze+xi]>1?Br(_e,ze,this.clusterProps):this.points[_e[ze+Xi]])}return xe}getChildren(N){const Z=this._getOriginId(N),G=this._getOriginZoom(N),J="No cluster with the specified id.",V=this.trees[G];if(!V)throw new Error(J);const le=V.data;if(Z*this.stride>=le.length)throw new Error(J);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),ie=V.within(le[Z*this.stride],le[Z*this.stride+1],ge),_e=[];for(const xe of ie){const ue=xe*this.stride;le[ue+4]===N&&_e.push(le[ue+xi]>1?Br(le,ue,this.clusterProps):this.points[le[ue+Xi]])}if(_e.length===0)throw new Error(J);return _e}getLeaves(N,Z,G){const J=[];return this._appendLeaves(J,N,Z=Z||10,G=G||0,0),J}getTile(N,Z,G){const J=this.trees[this._limitZoom(N)],V=Math.pow(2,N),{extent:le,radius:ge}=this.options,ie=ge/le,_e=(G-ie)/V,xe=(G+1+ie)/V,ue={features:[]};return this._addTileFeatures(J.range((Z-ie)/V,_e,(Z+1+ie)/V,xe),J.data,Z,G,V,ue),Z===0&&this._addTileFeatures(J.range(1-ie/V,_e,1,xe),J.data,V,G,V,ue),Z===V-1&&this._addTileFeatures(J.range(0,_e,ie/V,xe),J.data,-1,G,V,ue),ue.features.length?ue:null}getClusterExpansionZoom(N){let Z=this._getOriginZoom(N)-1;for(;Z<=this.options.maxZoom;){const G=this.getChildren(N);if(Z++,G.length!==1)break;N=G[0].properties.cluster_id}return Z}_appendLeaves(N,Z,G,J,V){const le=this.getChildren(Z);for(const ge of le){const ie=ge.properties;if(ie&&ie.cluster?V+ie.point_count<=J?V+=ie.point_count:V=this._appendLeaves(N,ie.cluster_id,G,J,V):V<J?V++:N.push(ge),N.length===G)break}return V}_createTree(N){const Z=new S.aF(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)Z.add(N[G],N[G+1]);return Z.finish(),Z.data=N,Z}_addTileFeatures(N,Z,G,J,V,le){for(const ge of N){const ie=ge*this.stride,_e=Z[ie+xi]>1;let xe,ue,ze;if(_e)xe=Qe(Z,ie,this.clusterProps),ue=Z[ie],ze=Z[ie+1];else{const nt=this.points[Z[ie+Xi]];xe=nt.properties;const[dt,we]=nt.geometry.coordinates;ue=pi(dt),ze=fi(we)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(ue*V-G)),Math.round(this.options.extent*(ze*V-J))]],tags:xe};let Ze;Ze=_e||this.options.generateId?Z[ie+Xi]:this.points[Z[ie+Xi]].id,Ze!==void 0&&(Ne.id=Ze),le.features.push(Ne)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,Z){const{radius:G,extent:J,reduce:V,minPoints:le}=this.options,ge=G/(J*Math.pow(2,Z)),ie=N.data,_e=[],xe=this.stride;for(let ue=0;ue<ie.length;ue+=xe){if(ie[ue+2]<=Z)continue;ie[ue+2]=Z;const ze=ie[ue],Ne=ie[ue+1],Ze=N.within(ie[ue],ie[ue+1],ge),nt=ie[ue+xi];let dt=nt;for(const we of Ze){const st=we*xe;ie[st+2]>Z&&(dt+=ie[st+xi])}if(dt>nt&&dt>=le){let we,st=ze*nt,St=Ne*nt,Rt=-1;const Pt=((ue/xe|0)<<5)+(Z+1)+this.points.length;for(const Pe of Ze){const Ge=Pe*xe;if(ie[Ge+2]<=Z)continue;ie[Ge+2]=Z;const tt=ie[Ge+xi];st+=ie[Ge]*tt,St+=ie[Ge+1]*tt,ie[Ge+4]=Pt,V&&(we||(we=this._map(ie,ue,!0),Rt=this.clusterProps.length,this.clusterProps.push(we)),V(we,this._map(ie,Ge)))}ie[ue+4]=Pt,_e.push(st/dt,St/dt,1/0,Pt,-1,dt),V&&_e.push(Rt)}else{for(let we=0;we<xe;we++)_e.push(ie[ue+we]);if(dt>1)for(const we of Ze){const st=we*xe;if(!(ie[st+2]<=Z)){ie[st+2]=Z;for(let St=0;St<xe;St++)_e.push(ie[st+St])}}}}return _e}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,Z,G){if(N[Z+xi]>1){const le=this.clusterProps[N[Z+Pr]];return G?Object.assign({},le):le}const J=this.points[N[Z+Xi]].properties,V=this.options.map(J);return G&&V===J?Object.assign({},V):V}}function Br(ce,N,Z){return{type:"Feature",id:ce[N+Xi],properties:Qe(ce,N,Z),geometry:{type:"Point",coordinates:[(G=ce[N],360*(G-.5)),Cr(ce[N+1])]}};var G}function Qe(ce,N,Z){const G=ce[N+xi],J=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,V=ce[N+Pr],le=V===-1?{}:Object.assign({},Z[V]);return Object.assign(le,{cluster:!0,cluster_id:ce[N+Xi],point_count:G,point_count_abbreviated:J})}function pi(ce){return ce/360+.5}function fi(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function Cr(ce){const N=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function ki(ce,N,Z,G){let J=G;const V=N+(Z-N>>1);let le,ge=Z-N;const ie=ce[N],_e=ce[N+1],xe=ce[Z],ue=ce[Z+1];for(let ze=N+3;ze<Z;ze+=3){const Ne=vn(ce[ze],ce[ze+1],ie,_e,xe,ue);if(Ne>J)le=ze,J=Ne;else if(Ne===J){const Ze=Math.abs(ze-V);Ze<ge&&(le=ze,ge=Ze)}}J>G&&(le-N>3&&ki(ce,N,le,G),ce[le+2]=J,Z-le>3&&ki(ce,le,Z,G))}function vn(ce,N,Z,G,J,V){let le=J-Z,ge=V-G;if(le!==0||ge!==0){const ie=((ce-Z)*le+(N-G)*ge)/(le*le+ge*ge);ie>1?(Z=J,G=V):ie>0&&(Z+=le*ie,G+=ge*ie)}return le=ce-Z,ge=N-G,le*le+ge*ge}function Zi(ce,N,Z,G){const J={id:ce??null,type:N,geometry:Z,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Vt(J,Z);else if(N==="Polygon")Vt(J,Z[0]);else if(N==="MultiLineString")for(const V of Z)Vt(J,V);else if(N==="MultiPolygon")for(const V of Z)Vt(J,V[0]);return J}function Vt(ce,N){for(let Z=0;Z<N.length;Z+=3)ce.minX=Math.min(ce.minX,N[Z]),ce.minY=Math.min(ce.minY,N[Z+1]),ce.maxX=Math.max(ce.maxX,N[Z]),ce.maxY=Math.max(ce.maxY,N[Z+1])}function Ki(ce,N,Z,G){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const V=N.geometry.type,le=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let ge=[],ie=N.id;if(Z.promoteId?ie=N.properties[Z.promoteId]:Z.generateId&&(ie=G||0),V==="Point")Yi(J,ge);else if(V==="MultiPoint")for(const _e of J)Yi(_e,ge);else if(V==="LineString")bn(J,ge,le,!1);else if(V==="MultiLineString"){if(Z.lineMetrics){for(const _e of J)ge=[],bn(_e,ge,le,!1),ce.push(Zi(ie,"LineString",ge,N.properties));return}nn(J,ge,le,!1)}else if(V==="Polygon")nn(J,ge,le,!0);else{if(V!=="MultiPolygon"){if(V==="GeometryCollection"){for(const _e of N.geometry.geometries)Ki(ce,{id:ie,geometry:_e,properties:N.properties},Z,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const _e of J){const xe=[];nn(_e,xe,le,!0),ge.push(xe)}}ce.push(Zi(ie,V,ge,N.properties))}function Yi(ce,N){N.push(ha(ce[0]),ar(ce[1]),0)}function bn(ce,N,Z,G){let J,V,le=0;for(let ie=0;ie<ce.length;ie++){const _e=ha(ce[ie][0]),xe=ar(ce[ie][1]);N.push(_e,xe,0),ie>0&&(le+=G?(J*xe-_e*V)/2:Math.sqrt(Math.pow(_e-J,2)+Math.pow(xe-V,2))),J=_e,V=xe}const ge=N.length-3;N[2]=1,ki(N,0,ge,Z),N[ge+2]=1,N.size=Math.abs(le),N.start=0,N.end=N.size}function nn(ce,N,Z,G){for(let J=0;J<ce.length;J++){const V=[];bn(ce[J],V,Z,G),N.push(V)}}function ha(ce){return ce/360+.5}function ar(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function sr(ce,N,Z,G,J,V,le,ge){if(G/=N,V>=(Z/=N)&&le<G)return ce;if(le<Z||V>=G)return null;const ie=[];for(const _e of ce){const xe=_e.geometry;let ue=_e.type;const ze=J===0?_e.minX:_e.minY,Ne=J===0?_e.maxX:_e.maxY;if(ze>=Z&&Ne<G){ie.push(_e);continue}if(Ne<Z||ze>=G)continue;let Ze=[];if(ue==="Point"||ue==="MultiPoint")Vi(xe,Ze,Z,G,J);else if(ue==="LineString")Nt(xe,Ze,Z,G,J,!1,ge.lineMetrics);else if(ue==="MultiLineString")an(xe,Ze,Z,G,J,!1);else if(ue==="Polygon")an(xe,Ze,Z,G,J,!0);else if(ue==="MultiPolygon")for(const nt of xe){const dt=[];an(nt,dt,Z,G,J,!0),dt.length&&Ze.push(dt)}if(Ze.length){if(ge.lineMetrics&&ue==="LineString"){for(const nt of Ze)ie.push(Zi(_e.id,ue,nt,_e.tags));continue}ue!=="LineString"&&ue!=="MultiLineString"||(Ze.length===1?(ue="LineString",Ze=Ze[0]):ue="MultiLineString"),ue!=="Point"&&ue!=="MultiPoint"||(ue=Ze.length===3?"Point":"MultiPoint"),ie.push(Zi(_e.id,ue,Ze,_e.tags))}}return ie.length?ie:null}function Vi(ce,N,Z,G,J){for(let V=0;V<ce.length;V+=3){const le=ce[V+J];le>=Z&&le<=G&&fr(N,ce[V],ce[V+1],ce[V+2])}}function Nt(ce,N,Z,G,J,V,le){let ge=Fr(ce);const ie=J===0?wn:Tn;let _e,xe,ue=ce.start;for(let dt=0;dt<ce.length-3;dt+=3){const we=ce[dt],st=ce[dt+1],St=ce[dt+2],Rt=ce[dt+3],Pt=ce[dt+4],Pe=J===0?we:st,Ge=J===0?Rt:Pt;let tt=!1;le&&(_e=Math.sqrt(Math.pow(we-Rt,2)+Math.pow(st-Pt,2))),Pe<Z?Ge>Z&&(xe=ie(ge,we,st,Rt,Pt,Z),le&&(ge.start=ue+_e*xe)):Pe>G?Ge<G&&(xe=ie(ge,we,st,Rt,Pt,G),le&&(ge.start=ue+_e*xe)):fr(ge,we,st,St),Ge<Z&&Pe>=Z&&(xe=ie(ge,we,st,Rt,Pt,Z),tt=!0),Ge>G&&Pe<=G&&(xe=ie(ge,we,st,Rt,Pt,G),tt=!0),!V&&tt&&(le&&(ge.end=ue+_e*xe),N.push(ge),ge=Fr(ce)),le&&(ue+=_e)}let ze=ce.length-3;const Ne=ce[ze],Ze=ce[ze+1],nt=J===0?Ne:Ze;nt>=Z&&nt<=G&&fr(ge,Ne,Ze,ce[ze+2]),ze=ge.length-3,V&&ze>=3&&(ge[ze]!==ge[0]||ge[ze+1]!==ge[1])&&fr(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function Fr(ce){const N=[];return N.size=ce.size,N.start=ce.start,N.end=ce.end,N}function an(ce,N,Z,G,J,V){for(const le of ce)Nt(le,N,Z,G,J,V,!1)}function fr(ce,N,Z,G){ce.push(N,Z,G)}function wn(ce,N,Z,G,J,V){const le=(V-N)/(G-N);return fr(ce,V,Z+(J-Z)*le,1),le}function Tn(ce,N,Z,G,J,V){const le=(V-Z)/(J-Z);return fr(ce,N+(G-N)*le,V,1),le}function Ee(ce,N){const Z=[];for(let G=0;G<ce.length;G++){const J=ce[G],V=J.type;let le;if(V==="Point"||V==="MultiPoint"||V==="LineString")le=Je(J.geometry,N);else if(V==="MultiLineString"||V==="Polygon"){le=[];for(const ge of J.geometry)le.push(Je(ge,N))}else if(V==="MultiPolygon"){le=[];for(const ge of J.geometry){const ie=[];for(const _e of ge)ie.push(Je(_e,N));le.push(ie)}}Z.push(Zi(J.id,V,le,J.tags))}return Z}function Je(ce,N){const Z=[];Z.size=ce.size,ce.start!==void 0&&(Z.start=ce.start,Z.end=ce.end);for(let G=0;G<ce.length;G+=3)Z.push(ce[G]+N,ce[G+1],ce[G+2]);return Z}function $e(ce,N){if(ce.transformed)return ce;const Z=1<<ce.z,G=ce.x,J=ce.y;for(const V of ce.features){const le=V.geometry,ge=V.type;if(V.geometry=[],ge===1)for(let ie=0;ie<le.length;ie+=2)V.geometry.push(ft(le[ie],le[ie+1],N,Z,G,J));else for(let ie=0;ie<le.length;ie++){const _e=[];for(let xe=0;xe<le[ie].length;xe+=2)_e.push(ft(le[ie][xe],le[ie][xe+1],N,Z,G,J));V.geometry.push(_e)}}return ce.transformed=!0,ce}function ft(ce,N,Z,G,J,V){return[Math.round(Z*(ce*G-J)),Math.round(Z*(N*G-V))]}function Gt(ce,N,Z,G,J){const V=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:ce.length,source:null,x:Z,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ce)or(le,ge,V,J);return le}function or(ce,N,Z,G){const J=N.geometry,V=N.type,le=[];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),V==="Point"||V==="MultiPoint")for(let ge=0;ge<J.length;ge+=3)le.push(J[ge],J[ge+1]),ce.numPoints++,ce.numSimplified++;else if(V==="LineString")mi(le,J,ce,Z,!1,!1);else if(V==="MultiLineString"||V==="Polygon")for(let ge=0;ge<J.length;ge++)mi(le,J[ge],ce,Z,V==="Polygon",ge===0);else if(V==="MultiPolygon")for(let ge=0;ge<J.length;ge++){const ie=J[ge];for(let _e=0;_e<ie.length;_e++)mi(le,ie[_e],ce,Z,!0,_e===0)}if(le.length){let ge=N.tags||null;if(V==="LineString"&&G.lineMetrics){ge={};for(const _e in N.tags)ge[_e]=N.tags[_e];ge.mapbox_clip_start=J.start/J.size,ge.mapbox_clip_end=J.end/J.size}const ie={geometry:le,type:V==="Polygon"||V==="MultiPolygon"?3:V==="LineString"||V==="MultiLineString"?2:1,tags:ge};N.id!==null&&(ie.id=N.id),ce.features.push(ie)}}function mi(ce,N,Z,G,J,V){const le=G*G;if(G>0&&N.size<(J?le:G))return void(Z.numPoints+=N.length/3);const ge=[];for(let ie=0;ie<N.length;ie+=3)(G===0||N[ie+2]>le)&&(Z.numSimplified++,ge.push(N[ie],N[ie+1])),Z.numPoints++;J&&function(ie,_e){let xe=0;for(let ue=0,ze=ie.length,Ne=ze-2;ue<ze;Ne=ue,ue+=2)xe+=(ie[ue]-ie[Ne])*(ie[ue+1]+ie[Ne+1]);if(xe>0===_e)for(let ue=0,ze=ie.length;ue<ze/2;ue+=2){const Ne=ie[ue],Ze=ie[ue+1];ie[ue]=ie[ze-2-ue],ie[ue+1]=ie[ze-1-ue],ie[ze-2-ue]=Ne,ie[ze-1-ue]=Ze}}(ge,V),ce.push(ge)}const mr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class gr{constructor(N,Z){const G=(Z=this.options=function(V,le){for(const ge in le)V[ge]=le[ge];return V}(Object.create(mr),Z)).debug;if(G&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(V,le){const ge=[];if(V.type==="FeatureCollection")for(let ie=0;ie<V.features.length;ie++)Ki(ge,V.features[ie],le,ie);else Ki(ge,V.type==="Feature"?V:{geometry:V},le);return ge}(N,Z);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(V,le){const ge=le.buffer/le.extent;let ie=V;const _e=sr(V,1,-1-ge,ge,0,-1,2,le),xe=sr(V,1,1-ge,2+ge,0,-1,2,le);return(_e||xe)&&(ie=sr(V,1,-ge,1+ge,0,-1,2,le)||[],_e&&(ie=Ee(_e,1).concat(ie)),xe&&(ie=ie.concat(Ee(xe,-1)))),ie}(J,Z),J.length&&this.splitTile(J,0,0,0),G&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(N,Z,G,J,V,le,ge){const ie=[N,Z,G,J],_e=this.options,xe=_e.debug;for(;ie.length;){J=ie.pop(),G=ie.pop(),Z=ie.pop(),N=ie.pop();const ue=1<<Z,ze=da(Z,G,J);let Ne=this.tiles[ze];if(!Ne&&(xe>1&&console.time("creation"),Ne=this.tiles[ze]=Gt(N,Z,G,J,_e),this.tileCoords.push({z:Z,x:G,y:J}),xe)){xe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,G,J,Ne.numFeatures,Ne.numPoints,Ne.numSimplified),console.timeEnd("creation"));const tt=`z${Z}`;this.stats[tt]=(this.stats[tt]||0)+1,this.total++}if(Ne.source=N,V==null){if(Z===_e.indexMaxZoom||Ne.numPoints<=_e.indexMaxPoints)continue}else{if(Z===_e.maxZoom||Z===V)continue;if(V!=null){const tt=V-Z;if(G!==le>>tt||J!==ge>>tt)continue}}if(Ne.source=null,N.length===0)continue;xe>1&&console.time("clipping");const Ze=.5*_e.buffer/_e.extent,nt=.5-Ze,dt=.5+Ze,we=1+Ze;let st=null,St=null,Rt=null,Pt=null,Pe=sr(N,ue,G-Ze,G+dt,0,Ne.minX,Ne.maxX,_e),Ge=sr(N,ue,G+nt,G+we,0,Ne.minX,Ne.maxX,_e);N=null,Pe&&(st=sr(Pe,ue,J-Ze,J+dt,1,Ne.minY,Ne.maxY,_e),St=sr(Pe,ue,J+nt,J+we,1,Ne.minY,Ne.maxY,_e),Pe=null),Ge&&(Rt=sr(Ge,ue,J-Ze,J+dt,1,Ne.minY,Ne.maxY,_e),Pt=sr(Ge,ue,J+nt,J+we,1,Ne.minY,Ne.maxY,_e),Ge=null),xe>1&&console.timeEnd("clipping"),ie.push(st||[],Z+1,2*G,2*J),ie.push(St||[],Z+1,2*G,2*J+1),ie.push(Rt||[],Z+1,2*G+1,2*J),ie.push(Pt||[],Z+1,2*G+1,2*J+1)}}getTile(N,Z,G){N=+N,Z=+Z,G=+G;const J=this.options,{extent:V,debug:le}=J;if(N<0||N>24)return null;const ge=1<<N,ie=da(N,Z=Z+ge&ge-1,G);if(this.tiles[ie])return $e(this.tiles[ie],V);le>1&&console.log("drilling down to z%d-%d-%d",N,Z,G);let _e,xe=N,ue=Z,ze=G;for(;!_e&&xe>0;)xe--,ue>>=1,ze>>=1,_e=this.tiles[da(xe,ue,ze)];return _e&&_e.source?(le>1&&(console.log("found parent tile z%d-%d-%d",xe,ue,ze),console.time("drilling down")),this.splitTile(_e.source,xe,ue,ze,N,Z,G),le>1&&console.timeEnd("drilling down"),this.tiles[ie]?$e(this.tiles[ie],V):null):null}}function da(ce,N,Z){return 32*((1<<ce)*Z+N)+ce}function Mn(ce,N){return N?ce.properties[N]:ce.id}function Hn(ce,N){if(ce==null)return!0;if(ce.type==="Feature")return Mn(ce,N)!=null;if(ce.type==="FeatureCollection"){const Z=new Set;for(const G of ce.features){const J=Mn(G,N);if(J==null||Z.has(J))return!1;Z.add(J)}return!0}return!1}function sn(ce,N){const Z=new Map;if(ce!=null)if(ce.type==="Feature")Z.set(Mn(ce,N),ce);else for(const G of ce.features)Z.set(Mn(G,N),G);return Z}class _r extends Le{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!J)return null;const V=new Oi(J.features);let le=nr(V);return le.byteOffset===0&&le.byteLength===le.buffer.byteLength||(le=new Uint8Array(le)),{vectorTile:V,rawData:le.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new Ni(function({superclusterOptions:le,clusterProperties:ge}){if(!ge||!le)return le;const ie={},_e={},xe={accumulated:null,zoom:0},ue={properties:null},ze=Object.keys(ge);for(const Ne of ze){const[Ze,nt]=ge[Ne],dt=S.cJ(nt),we=S.cJ(typeof Ze=="string"?[Ze,["accumulated"],["get",Ne]]:Ze);ie[Ne]=dt.value,_e[Ne]=we.value}return le.map=Ne=>{ue.properties=Ne;const Ze={};for(const nt of ze)Ze[nt]=ie[nt].evaluate(xe,ue);return Ze},le.reduce=(Ne,Ze)=>{ue.properties=Ze;for(const nt of ze)xe.accumulated=Ne[nt],Ne[nt]=_e[nt].evaluate(xe,ue)},le}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new gr(J,N.geojsonVtOptions)),this.loaded={};const V={};if(G){const le=G.finish();le&&(V.resourceTiming={},V.resourceTiming[N.source]=JSON.parse(JSON.stringify(le)))}return V}catch(V){if(delete this._pendingRequest,S.cn(V))return{abandoned:!0};throw V}var J})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const Z=this.loaded;return Z&&Z[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,Z);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(ri(G,!0),N.filter){const J=S.cJ(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(le=>`${le.key}: ${le.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(le=>J.value.evaluate({zoom:0},le))}}return G})}loadGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const J=yield S.j(N.request,Z);return this._dataUpdateable=Hn(J.data,G)?sn(J.data,G):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=Hn(J,G)?sn(J,G):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,V,le){var ge,ie,_e,xe;if(V.removeAll&&J.clear(),V.remove)for(const ue of V.remove)J.delete(ue);if(V.add)for(const ue of V.add){const ze=Mn(ue,le);ze!=null&&J.set(ze,ue)}if(V.update)for(const ue of V.update){let ze=J.get(ue.id);if(ze==null)continue;const Ne=!ue.removeAllProperties&&(((ge=ue.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((ie=ue.addOrUpdateProperties)===null||ie===void 0?void 0:ie.length)>0);if((ue.newGeometry||ue.removeAllProperties||Ne)&&(ze=Object.assign({},ze),J.set(ue.id,ze),Ne&&(ze.properties=Object.assign({},ze.properties))),ue.newGeometry&&(ze.geometry=ue.newGeometry),ue.removeAllProperties)ze.properties={};else if(((_e=ue.removeProperties)===null||_e===void 0?void 0:_e.length)>0)for(const Ze of ue.removeProperties)Object.prototype.hasOwnProperty.call(ze.properties,Ze)&&delete ze.properties[Ze];if(((xe=ue.addOrUpdateProperties)===null||xe===void 0?void 0:xe.length)>0)for(const{key:Ze,value:nt}of ue.addOrUpdateProperties)ze.properties[Ze]=nt}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class Sn{constructor(N){this.self=N,this.actor=new S.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,G)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=G},this.self.addProtocol=S.cp,this.self.removeProtocol=S.cq,this.self.registerRTLTextPlugin=Z=>{S.cK.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,G)=>this._getDEMWorkerSource(Z,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(Z,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(Z,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][G.type]||!this.workerSources[Z][G.type][G.source])return;const J=this.workerSources[Z][G.type][G.source];delete this.workerSources[Z][G.type][G.source],J.removeSource!==void 0&&J.removeSource(G)})),this.actor.registerMessageHandler("RM",Z=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(Z,G)=>this._syncRTLPluginState(Z,G)),this.actor.registerMessageHandler("IS",(Z,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(Z,G)=>this._setImages(Z,G)),this.actor.registerMessageHandler("UL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(G)}))}_setImages(N,Z){return S._(this,void 0,void 0,function*(){this.availableImages[N]=Z;for(const G in this.workerSources[N]){const J=this.workerSources[N][G];for(const V in J)J[V].availableImages=Z}})}_syncRTLPluginState(N,Z){return S._(this,void 0,void 0,function*(){return yield S.cK.syncState(Z,this.self.importScripts)})}_getAvailableImages(N){let Z=this.availableImages[N];return Z||(Z=[]),Z}_getLayerIndex(N){let Z=this.layerIndexes[N];return Z||(Z=this.layerIndexes[N]=new o),Z}_getWorkerSource(N,Z,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][Z]||(this.workerSources[N][Z]={}),!this.workerSources[N][Z][G]){const J={sendAsync:(V,le)=>(V.targetMapId=N,this.actor.sendAsync(V,le))};switch(Z){case"vector":this.workerSources[N][Z][G]=new Le(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][Z][G]=new _r(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][Z][G]=new this.externalWorkerSourceTypes[Z](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][Z][G]}_getDEMWorkerSource(N,Z){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][Z]||(this.demWorkerSources[N][Z]=new Ie),this.demWorkerSources[N][Z]}}return S.i(self)&&(self.worker=new Sn(self)),Sn}),A("index",["exports","./shared"],function(S,o){var he="5.4.0";function pe(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let Ce,Le;const Ie={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const s=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(s),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(Ce||(Ce=document.createElement("a")),Ce.href=u,Ce.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Le==null&&(Le=matchMedia("(prefers-reduced-motion: reduce)")),Le.matches)}};class oe{static testProp(e){if(!oe.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in oe.docStyle)return e[i];return e[0]}static create(e,i,s){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),s&&s.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){oe.docStyle&&oe.selectProp&&(oe.userSelect=oe.docStyle[oe.selectProp],oe.docStyle[oe.selectProp]="none")}static enableDrag(){oe.docStyle&&oe.selectProp&&(oe.docStyle[oe.selectProp]=oe.userSelect)}static setTransform(e,i){e.style[oe.transformProp]=i}static addEventListener(e,i,s,l={}){e.addEventListener(i,s,"passive"in l?l:l.capture)}static removeEventListener(e,i,s,l={}){e.removeEventListener(i,s,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",oe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",oe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",oe.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,s){const l=i.boundingClientRect;return new o.P((s.clientX-l.left)/i.x-e.clientLeft,(s.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const s=oe.getScale(e);return oe.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=oe.getScale(e);for(let h=0;h<i.length;h++)s.push(oe.getPoint(e,l,i[h]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),s=i.querySelectorAll("script");for(const l of s)l.remove();return oe.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)oe.removeAttributes(s),oe.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)oe.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}oe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,oe.selectProp=oe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),oe.transformProp=oe.testProp(["transform","WebkitTransform"]);const Ve={supported:!1,testSupport:function(u){!Ft&&ri&&(oi?Oi(u):Bt=u)}};let Bt,ri,Ft=!1,oi=!1;function Oi(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,ri),u.isContextLost())return;Ve.supported=!0}catch{}u.deleteTexture(e),Ft=!0}var ni;typeof document<"u"&&(ri=document.createElement("img"),ri.onload=()=>{Bt&&Oi(Bt),Bt=null,oi=!0},ri.onerror=()=>{Ft=!0,Bt=null},ri.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=x=>{const T=s++;return l[T]=x,T},u.removeThrottleControl=x=>{delete l[x],f()},u.getImage=(x,T,P=!0)=>new Promise((E,k)=>{Ve.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),o.e(x,{type:"image"}),e.push({abortController:T,requestParameters:x,supportImageRefresh:P,state:"queued",onError:F=>{k(F)},onSuccess:F=>{E(F)}}),f()});const h=x=>o._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:T,supportImageRefresh:P,onError:E,onSuccess:k,abortController:F}=x,O=P===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const H=O?_(T,F):o.m(T,F);try{const W=yield H;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?k(W):W.data&&k({data:yield(q=W.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,E(W)}finally{i--,f()}var q}),f=()=>{const x=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<x&&e.length>0;T++){const P=e.shift();P.abortController.signal.aborted?T--:h(P)}},_=(x,T)=>new Promise((P,E)=>{const k=new Image,F=x.url,O=x.credentials;O&&O==="include"?k.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(F))&&(k.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{k.src="",E(o.c())}),k.fetchPriority="high",k.onload=()=>{k.onerror=k.onload=null,P({data:k})},k.onerror=()=>{k.onerror=k.onload=null,T.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},k.src=F})}(ni||(ni={})),ni.resetRequestQueue();class Zt{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Ot(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:s,url:l}of u){const h=`${s}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:l}))}}return e}function Wi(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 Et{constructor(e,i,s,l){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,l)}update(e,i,s){const{width:l,height:h}=e,f=!(this.size&&this.size[0]===l&&this.size[1]===h||s),{context:_}=this,{gl: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=[l,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,e):x.texImage2D(x.TEXTURE_2D,0,this.format,l,h,0,this.format,x.UNSIGNED_BYTE,e.data);else{const{x:T,y:P}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texSubImage2D(x.TEXTURE_2D,0,T,P,x.RGBA,x.UNSIGNED_BYTE,e):x.texSubImage2D(x.TEXTURE_2D,0,T,P,l,h,x.RGBA,x.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&x.generateMipmap(x.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function nr(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class qn extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:s}of this.requestors)s(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const s=i.spriteData;i.data=new o.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let s=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const l of e){if(l[0]<s||l[1]<l[0]||i<l[1])return!1;s=l[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,l=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const l=this.getImage(e);if(s&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,s)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let l=this.getImage(s);l||(this.fire(new o.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?i[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new o.I(l,s);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Et(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,x=f.y+1,T=this.getImage(h).data,P=T.width,E=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:x},{width:P,height:E}),o.R.copy(T,l,{x:0,y:E-1},{x:_,y:x-1},{width:P,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:x+E},{width:P,height:1}),o.R.copy(T,l,{x:P-1,y:0},{x:_-1,y:x},{width:1,height:E}),o.R.copy(T,l,{x:0,y:0},{x:_+P,y:x},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const s=this.getImage(i);s||o.w(`Image with ID: "${i}" was not found`),nr(s)&&this.updateImage(i,s)}}}const Lr=1e20;function ji(u,e,i,s,l,h,f,_,x){for(let T=e;T<e+s;T++)Xi(u,i*h+T,h,l,f,_,x);for(let T=i;T<i+l;T++)Xi(u,T*h+e,1,s,f,_,x)}function Xi(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Lr,l[0]=u[e];for(let _=1,x=0,T=0;_<s;_++){l[_]=u[e+_*i];const P=_*_;do{const E=h[x];T=(l[_]-l[E]+P-E*E)/(_-E)/2}while(T<=f[x]&&--x>-1);x++,h[x]=_,f[x]=T,f[x+1]=Lr}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const T=h[x],P=_-T;u[e+_*i]=l[T]+P*P}}class xi{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=xi.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new xi.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}xi.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const x={};for(const T of o.o(_.data))x[T.id]=T;return x})},xi.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,x=this._createCanvas(_),T=this.ctx=x.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,P=x+2*this.buffer,E=Math.max(T*P,0),k=new Uint8ClampedArray(E),F={data:k,width:T,height:P,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return F;const{ctx:O,buffer:H,gridInner:q,gridOuter:W}=this;O.clearRect(H,H,_,x),O.fillText(u,H,H+f);const K=O.getImageData(H,H,_,x);W.fill(Lr,0,E),q.fill(0,0,E);for(let ee=0;ee<x;ee++)for(let te=0;te<_;te++){const re=K.data[4*(ee*_+te)+3]/255;if(re===0)continue;const se=(ee+H)*T+te+H;if(re===1)W[se]=0,q[se]=Lr;else{const ne=.5-re;W[se]=ne>0?ne*ne:0,q[se]=ne<0?ne*ne:0}}ji(W,0,0,T,P,T,this.f,this.v,this.z),ji(q,H,H,_,x,T,this.f,this.v,this.z);for(let ee=0;ee<E;ee++){const te=Math.sqrt(W[ee])-Math.sqrt(q[ee]);k[ee]=Math.round(255-255*(te/this.radius+this.cutoff))}return F}};class Pr{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.B.number(e.x,i.x,s),y:o.B.number(e.y,i.y,s),z:o.B.number(e.z,i.z,s)}}}let Ni;class Br extends o.E{constructor(e){super(),Ni=Ni||new o.r({anchor:new o.D(o.v.light.anchor),position:new Pr,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(Ni),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.t,e,i))for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s){return(!s||s.validate!==!1)&&o.x(this,e.call(o.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Qe=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":new o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class pi extends o.E{constructor(e){super(),this._transitionable=new o.T(Qe),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0))}setSky(e,i={}){if(!this._validate(o.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s={}){return(s==null?void 0:s.validate)!==!1&&o.x(this,e.call(o.y,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class fi{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let T=1;T<e.length;T++){_=!_;const P=e[T];h=x*s,x+=P,f=x*s,l.push({left:h,right:f,isDash:_,zeroLength:P===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,x=e[_];for(let T=0;T<this.width;T++){T/x.right>1&&(x=e[++_]);const P=Math.abs(T-x.left),E=Math.abs(T-x.right),k=Math.min(P,E);let F;const O=h/s*(l+1);if(x.isDash){const H=l-Math.abs(O);F=Math.sqrt(k*k+H*H)}else F=l-Math.sqrt(k*k+O*O);this.data[f+T]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],T=e[_+1];x.zeroLength?e.splice(_,1):T&&T.isDash===x.isDash&&(T.left=x.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const x=Math.abs(_-f.left),T=Math.abs(_-f.right),P=Math.min(x,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?P:-P)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,x=this.getDashRanges(e,this.width,_);i?this.addRoundDash(x,_,s):this.addRegularDash(x)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const Cr="maplibre_preloaded_worker_pool";class ki{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<ki.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Cr]}numActive(){return Object.keys(this.active).length}}const vn=Math.floor(Ie.hardwareConcurrency/2);let Zi,Vt;function Ki(){return Zi||(Zi=new ki),Zi}ki.workerCount=o.G(globalThis)?Math.max(Math.min(vn,3),1):1;class Yi{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let l=0;l<s.length;l++){const h=new o.H(s[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:e,data:i}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const s of this.actors)s.registerMessageHandler(e,i)}}function bn(){return Vt||(Vt=new Yi(Ki(),o.J),Vt.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Vt}function nn(u,e){const i=o.K();return o.L(i,i,[1,1,0]),o.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ha(u,e,i,s,l,h,f){var _;const x=function(k,F,O){if(k)for(const H of k){const q=F[H];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const H in F){const q=F[H];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),P=u.tilesIn(s,T,x);P.sort(ar);const E=[];for(const k of P)E.push({wrappedTileID:k.tileID.wrapped().key,queryResults:k.tile.queryRenderedFeatures(e,i,u._state,k.queryGeometry,k.cameraQueryGeometry,k.scale,l,h,T,nn(u.transform,k.tileID),f?(F,O)=>f(k.tileID,F,O):void 0)});return function(k,F){for(const O in k)for(const H of k[O])sr(H,F);return k}(function(k){const F={},O={};for(const H of k){const q=H.queryResults,W=H.wrappedTileID,K=O[W]=O[W]||{};for(const ee in q){const te=q[ee],re=K[ee]=K[ee]||{},se=F[ee]=F[ee]||[];for(const ne of te)re[ne.featureIndex]||(re[ne.featureIndex]=!0,se.push(ne))}}return F}(E),u)}function ar(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 sr(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 Vi(u,e,i){return o._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield Ie.frameAsync(i),!s)return null;const l=o.O(o.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(l.vectorLayerIds=s.vector_layers.map(h=>h.id)),l})}class Nt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.Q)l=e,h=e;else{if(!(e instanceof Nt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Nt.convert(e)):this.extend(o.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.Q.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new o.Q(l.lng,l.lat),this._ne=new o.Q(h.lng,h.lat)),this}getCenter(){return new o.Q((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o.Q(this.getWest(),this.getNorth())}getSouthEast(){return new o.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=o.Q.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof Nt?e:e&&new Nt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Nt(new o.Q(e.lng-l,e.lat-s),new o.Q(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.Q(this._sw.lng,this._sw.lat),i=new o.Q(this._ne.lng,this._ne.lat);return new Nt(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class Fr{constructor(e,i,s){this.bounds=Nt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(o.U(this.bounds.getWest())*i),l=Math.floor(o.S(this.bounds.getNorth())*i),h=Math.ceil(o.U(this.bounds.getEast())*i),f=Math.ceil(o.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class an extends o.E{constructor(e,i,s,l){if(super(),this.id=e,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.e(this,o.O(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Vi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new Fr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,f)=>{e.reloadPromise={resolve:h,reject:f}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class fr extends o.E{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.O(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Vi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new Fr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const s=yield ni.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,h=l.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new Et(l,f,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class wn extends fr{constructor(e,i,s,l){super(e,i,s,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield ni.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&l.cacheControl&&l.expires&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const f=o.b(h)&&o.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.W()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.X(e,-1,-1,i,s))}catch{}}return Ie.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,x={};return x[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Tn extends o.E{constructor(e,i,s,l){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.Z/this.tileSize)}load(){return o._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new Nt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":s=this.getCoordinatesFromGeometry(i.geometry);break;default:s=this.getCoordinatesFromGeometry(i)}if(s.length==0)return e;for(let l=0;l<s.length-1;l+=2)e.extend([s[l],s[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(Ie.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;s.resourceTiming&&s.resourceTiming[this.id]&&(l=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Ee extends o.E{constructor(e,i,s,l){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield ni.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(o.$.fromLngLat);var s;return this.tileID=function(l){let h=1/0,f=1/0,_=-1/0,x=-1/0;for(const k of l)h=Math.min(h,k.x),f=Math.min(f,k.y),_=Math.max(_,k.x),x=Math.max(x,k.y);const T=Math.max(_-h,x-f),P=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),E=Math.pow(2,P);return new o.a1(P,Math.floor((h+_)/2*E),Math.floor((f+x)/2*E))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new Et(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,l=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=o.a0;_++){const x=Math.pow(2,_),T=Math.floor(i*x),P=Math.floor(s*x),E=Math.floor(l*x),k=Math.floor(h*x);f[_]={minTileX:T,minTileY:P,maxTileX:E,maxTileY:k}}return f}}class Je extends Ee{constructor(e,i,s,l){super(e,i,s,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new Et(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class $e extends Ee{constructor(e,i,s,l){super(e,i,s,l),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(f=>typeof f!="number"))||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,s=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Et(i,this.canvas,s.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,l=!0)}l&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ft={},Gt=u=>{switch(u){case"geojson":return Tn;case"image":return Ee;case"raster":return fr;case"raster-dem":return wn;case"vector":return an;case"video":return Je;case"canvas":return $e}return ft[u]},or="RTLPluginLoaded";class mi extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=bn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ie.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(or))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let mr=null;function gr(){return mr||(mr=new mi),mr}class da{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const x=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>x.filter(P=>P.id===T)[0]));for(const T of x)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6&&h.hasRTLText){this.hasRTLText=!0,gr().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Et(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Et(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,x,T,P,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:P,transform:x,params:_,queryPadding:this.queryPadding*T,getElevation:E},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a7(i&&i.filter),{z:x,x:T,y:P}=this.tileID.canonical,E={z:x,x:T,y:P};for(let k=0;k<f.length;k++){const F=f.feature(k);if(_.needGeometry){const q=o.a8(F,!0);if(!_.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.C(this.tileID.overscaledZ),F))continue;const O=s.getId(F,h),H=new o.a9(F,x,T,P,O);H.tile=E,e.push(H)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const s=o.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],x=e[f];if(!_||!x||Object.keys(x).length===0)continue;h.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ie.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ie.now()+e}setDependencies(e,i){const s={};for(const l of i)s[l]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const l=this.dependencies[s];if(l){for(const h of i)if(l[h])return!0}}return!1}}class Mn{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,s){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[l].push(h),this.order.push(l),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const s=e.wrapped().key,l=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][l];return this.data[s].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const s in this.data)for(const l of this.data[s])e(l.value)||i.push(l);for(const s of i)this.remove(s.value.tileID,s)}}class Hn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const sn=89.25;function _r(u,e){const i=o.ae(e.lat,-85.051129,o.af);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function Sn(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function ce(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ab(90-u.pitch)),Math.tan(o.ab(sn-u.pitch)))}function N(u,e){const i=u.canonical,s=e/o.ac(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.ad(new Float64Array(16));return o.L(h,h,[l*s,i.y*s,0]),o.M(h,h,[s/o.Z,s/o.Z,1]),h}function Z(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.ag(1,u.lat),_=f*Math.cos(o.ab(i)),x=Math.sqrt(f*f-_*_),T=x*Math.sin(o.ab(-s)),P=x*Math.cos(o.ab(-s));return new o.$(h.x+T,h.y+P,h.z+_)}function G(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const l=e.intersectsPlane(i);return s===0||l===0?0:s===2&&l===2?2:1}function J(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function V(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.ah(Math.cos(o.ab(sn-f))/Math.cos(o.ab(sn)))-1),x=Math.acos(l/h),T=2*J(_-1,0,o.ab(f/2)),P=Math.min(o.ab(sn),x+o.ab(f/2)),E=J(_-1,Math.min(P,x-o.ab(f/2)),P),k=Math.atan(s/l),F=Math.hypot(s,l);let O=i;return O+=o.ah(h/F/Math.max(.5,Math.cos(o.ab(f/2)))),O+=_*o.ah(Math.cos(k))/2,O-=o.ah(Math.max(1,E/T/e))/2,O}}const le=V(9.314,3);function ge(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ah(u.tileSize/e.tileSize));return Math.max(0,i)}function ie(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.$.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),x=ge(u,e),T=e.minzoom||0,P=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,E=Math.min(Math.max(0,x),P),k=Math.pow(2,E),F=[k*l.x,k*l.y,0],O=[k*h.x,k*h.y,0],H=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),W=Math.hypot(H,q),K=re=>({zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),ee=[],te=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let re=1;re<=3;re++)ee.push(K(-re)),ee.push(K(re));for(ee.push(K(0));ee.length>0;){const re=ee.pop(),se=re.x,ne=re.y;let de=re.fullyVisible;const me={x:se,y:ne,z:re.zoom},Te=f.getTileAABB(me,re.wrap,u.elevation,e);if(!de){const Be=G(i,Te,s);if(Be===0)continue;de=Be===2}const Se=f.distanceToTile2d(l.x,l.y,me,Te);let be=x;_&&(be=(e.calculateTileZoom||le)(u.zoom+o.ah(u.tileSize/e.tileSize),Se,q,W,u.fov)),be=(e.roundZoom?Math.round:Math.floor)(be),be=Math.max(0,be);const je=Math.min(be,P);if(re.wrap=f.getWrap(h,me,re.wrap),re.zoom>=je){if(re.zoom<T)continue;const Be=E-re.zoom,ke=F[0]-.5-(se<<Be),We=F[1]-.5-(ne<<Be),mt=e.reparseOverscaled?Math.max(re.zoom,be):re.zoom;te.push({tileID:new o.Y(re.zoom===P?mt:re.zoom,re.wrap,re.zoom,se,ne),distanceSq:o.ai([O[0]-.5-se,O[1]-.5-ne]),tileDistanceToCamera:Math.sqrt(ke*ke+We*We)})}else for(let Be=0;Be<4;Be++)ee.push({zoom:re.zoom+1,x:(se<<1)+Be%2,y:(ne<<1)+(Be>>1),wrap:re.wrap,fullyVisible:de})}return te.sort((re,se)=>re.distanceSq-se.distanceSq).map(re=>re.tileID)}class _e extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const x=new(Gt(h.type))(l,h,f,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new Mn(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Hn,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,s){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new o.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const s=this._tiles[i];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(xe).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),x=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||x.y-_.y||x.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(xe).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=i),yield this._loadTile(s,e,i))})}_tileLoaded(e,i,s){e.timeAdded=Ie.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,x=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+x)===1?f+=x:Math.abs(f-x)===1&&(f-=x)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},x={},T=Object.keys(e),P=Ie.now();for(const E of T){const k=e[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=P)continue;const O=this.findLoadedParent(k,i),H=this.findLoadedSibling(k),q=O||H||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),x[E]=k}this._retainLoadedChildren(x,l,s,e);for(const E in _)e[E]||(this._coveredTiles[E]=!0,e[E]=_[E]);if(f){const E={},k={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:k[F.key]=F;for(const F in k){const O=k[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(E[O[0].key]=e[O[0].key]=O[0],E[O[1].key]=e[O[1].key]=O[1],E[O[2].key]=e[O[2].key]=O[2],E[O[3].key]=e[O[3].key]=O[3],delete k[F])}for(const F in k){const O=k[F],H=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),W=H||q||null;if(W){E[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in E)E[K].isChildOf(W.tileID)&&delete E[K]}}for(const F in this._tiles)E[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.Y(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(s=ie(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter(P=>this._source.hasTile(P)))):s=[];const l=ge(e,this._source),h=Math.max(l-_e.maxOverzooming,this._source.minzoom),f=Math.max(l+_e.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const E of s)if(E.canonical.z>this._source.minzoom){const k=E.scaledTo(E.canonical.z-1);P[k.key]=k;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));P[F.key]=F}s=s.concat(Object.values(P))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,l);ue(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,l,s,i);for(const P in x)this._tiles[P].clearFadeHold();const T=o.aj(this._tiles,x);for(const P of T){const E=this._tiles[P];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const l={},h={},f=Math.max(i-_e.maxOverzooming,this._source.minzoom),_=Math.max(i+_e.maxUnderzooming,this._source.minzoom),x={};for(const T of e){const P=this._addTile(T);l[T.key]=T,P.hasData()||i<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,i,_,l);for(const T of e){let P=this._tiles[T.key];if(P.hasData())continue;if(i+1>this._source.maxzoom){const k=T.children(this._source.maxzoom)[0],F=this.getTile(k);if(F&&F.hasData()){l[k.key]=k;continue}}else{const k=T.children(this._source.maxzoom);if(l[k[0].key]&&l[k[1].key]&&l[k[2].key]&&l[k[3].key])continue}let E=P.wasRequested();for(let k=T.overscaledZ-1;k>=f;--k){const F=T.scaledTo(k);if(h[F.key])break;if(h[F.key]=!0,P=this.getTile(F),!P&&E&&(P=this._addTile(F)),P){const O=P.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||E)&&(l[F.key]=F),E=P.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new da(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),x=f.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),T=this.getIds();let P=1/0,E=1/0,k=-1/0,F=-1/0;for(const O of x)P=Math.min(P,O.x),E=Math.min(E,O.y),k=Math.max(k,O.x),F=Math.max(F,O.y);for(let O=0;O<T.length;O++){const H=this._tiles[T[O]];if(H.holdingForFade())continue;const q=h.getCoveringTilesDetailsProvider().allowWorldCopies()?H.tileID:H.tileID.unwrapTo(0),W=Math.pow(2,h.zoom-H.tileID.overscaledZ),K=i*H.queryPadding*o.Z/H.tileSize/W,ee=[q.getTilePoint(new o.$(P,E)),q.getTilePoint(new o.$(k,F))];if(ee[0].x-K<o.Z&&ee[0].y-K<o.Z&&ee[1].x+K>=0&&ee[1].y+K>=0){const te=_.map(se=>q.getTilePoint(se)),re=x.map(se=>q.getTilePoint(se));l.push({tile:H,tileID:q,queryGeometry:te,cameraQueryGeometry:re,scale:W})}}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(ue(this._source.type)){const e=Ie.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,s){this._state.updateState(e=e||"_geojsonTileLayer",i,s)}removeFeatureState(e,i,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,s)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,s){const l=this._tiles[e];l&&l.setDependencies(i,s)}reloadTilesForDependencies(e,i){for(const s in this._tiles)this._tiles[s].hasDependency(e,i)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,i))}}function xe(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 ue(u){return u==="raster"||u==="image"||u==="video"}_e.maxOverzooming=10,_e.maxUnderzooming=3;class ze{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ae(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,x=_>0?(l-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function Ne(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ze{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const x=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)x.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const P=this.circles[3*T],E=this.circles[3*T+1],k=this.circles[3*T+2];x.push({key:this.circleKeys[T],x1:P-k,y1:E-k,x2:P+k,y2:E+k})}}else this._forEachCell(e,i,s,l,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,x=i-s,T=i+s;if(_<0||f>this.width||T<0||x>this.height)return!1;const P=[];return this._forEachCell(f,x,_,T,this._queryCellCircle,P,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(e,i,s,l,h,f,_,x){const{seenUids:T,hitTest:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!T.box[H]){T.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(e<=O[q+2]&&i<=O[q+3]&&s>=O[q+0]&&l>=O[q+1]&&(!x||x(W))&&(!P||!Ne(E,W.overlapMode))&&(f.push({key:W,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),P))return!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!T.circle[H]){T.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,s,l)&&(!x||x(W))&&(!P||!Ne(E,W.overlapMode))){const K=O[q],ee=O[q+1],te=O[q+2];if(f.push({key:W,x1:K-te,y1:ee-te,x2:K+te,y2:ee+te}),P)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,x){const{circle:T,seenUids:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!P.box[H]){P.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!x||x(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!P.circle[H]){P.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circlesCollide(O[q],O[q+1],O[q+2],T.x,T.y,T.radius)&&(!x||x(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,x){const T=this._convertToXCellCoord(e),P=this._convertToYCellCoord(i),E=this._convertToXCellCoord(s),k=this._convertToYCellCoord(l);for(let F=T;F<=E;F++)for(let O=P;O<=k;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+F,f,_,x))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,x=h-i,T=s+f;return T*T>_*_+x*x}_circleAndRectCollide(e,i,s,l,h,f,_){const x=(f-l)/2,T=Math.abs(e-(l+x));if(T>x+s)return!1;const P=(_-h)/2,E=Math.abs(i-(h+P));if(E>P+s)return!1;if(T<=x||E<=P)return!0;const k=T-x,F=E-P;return k*k+F*F<=s*s}}function nt(u,e,i){const s=o.K();if(!u){const{vecSouth:E,vecEast:k}=we(e),F=pe();F[0]=k[0],F[1]=k[1],F[2]=E[0],F[3]=E[1],l=F,(P=(f=(h=F)[0])*(T=h[3])-(x=h[2])*(_=h[1]))&&(l[0]=T*(P=1/P),l[1]=-_*P,l[2]=-x*P,l[3]=f*P),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var l,h,f,_,x,T,P;return o.M(s,s,[1/i,1/i,1]),s}function dt(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=we(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.M(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function we(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=o.ao();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ap(f);_<1e-9?o.aq(f):o.ar(f,f,1/_);const x=o.ao();x[0]=l*s*e-h*i,x[1]=h*s*e+l*i;const T=o.ap(x);return T<1e-9?o.aq(x):o.ar(x,x,1/T),{vecEast:x,vecSouth:f}}function st(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.at(l,l,i)):(l=[u,e,0,1],qt(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function St(u,e){return .5+u/e*.5}function Rt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function Pt(u,e,i,s,l,h,f,_,x,T,P,E,k){const F=i?u.textSizeData:u.iconSizeData,O=o.ak(F,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let te=!1;for(let re=0;re<K.length;re++){const se=K.get(re);if(se.hidden||se.writingMode===o.al.vertical&&!te){zi(se.numGlyphs,q);continue}te=!1;const ne=new o.P(se.anchorX,se.anchorY),de={getElevation:k,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:ne,unwrappedTileID:x,width:T,height:P,translation:E},me=bs(se.anchorX,se.anchorY,de);if(!Rt(me.point,H)){zi(se.numGlyphs,q);continue}const Te=St(e.transform.cameraToCenterDistance,me.signedDistanceFromCamera),Se=o.am(F,O,se),be=h?Se*e.transform.getPitchedTextCorrection(se.anchorX,se.anchorY,x)/Te:Se*Te,je=tt({projectionContext:de,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_});te=je.useVertical,(je.notEnoughRoom||te||je.needsFlipping&&tt({projectionContext:de,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&zi(se.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function Pe(u,e,i,s,l,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,E=e.getoffsetX(h.glyphStartIndex),k=e.getoffsetX(x-1),F=Wn(u*E,i,s,l,h.segment,T,P,_,f);if(!F)return null;const O=Wn(u*k,i,s,l,h.segment,T,P,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:F,last:O}:null}function Ge(u,e,i,s){return u===o.al.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.al.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function tt(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:T,rotateToLine:P}=u,E=l/24,k=s.lineOffsetX*E,F=s.lineOffsetY*E;let O;if(s.numGlyphs>1){const H=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=Pe(E,_,k,F,h,s,P,e);if(!K)return{notEnoughRoom:!0};const ee=ct(K.first.point.x,K.first.point.y,e,i),te=ct(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const re=Ge(s.writingMode,ee,te,T);if(re)return re}O=[K.first];for(let re=s.glyphStartIndex+1;re<H-1;re++)O.push(Wn(E*_.getoffsetX(re),k,F,h,s.segment,q,W,e,P));O.push(K.last)}else{if(f&&!h){const q=Qt(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),ee=Qt(K.x,K.y,e),te=ee.signedDistanceFromCamera>0?ee.point:lr(e.tileAnchorPoint,K,q,1,e),re=ct(q.x,q.y,e,i),se=ct(te.x,te.y,e,i),ne=Ge(s.writingMode,re,se,T);if(ne)return ne}const H=Wn(E*_.getoffsetX(s.glyphStartIndex),k,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,P);if(!H||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[H]}for(const H of O)o.as(x,H.point,H.angle);return{}}function lr(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=Qt(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function Ji(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=Qt(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return s.projections[u]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const f=u-i.direction;return lr(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function Qt(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=st(s,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function ct(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.at(l,l,s),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function bs(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function pa(u,e,i){return u._unit()._perp()._mult(e*i)}function go(u,e,i,s,l,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+x.direction<s||u+x.direction>=l)return _.projectionCache.offsets[u]=T,T;const P=Ji(u+x.direction,_,x),E=pa(P.sub(i),f,x.direction),k=i.add(E),F=P.add(E);return _.projectionCache.offsets[u]=o.au(h,T,k,F)||T,_.projectionCache.offsets[u]}function Wn(u,e,i,s,l,h,f,_,x){const T=s?u-e:u+e;let P=T>0?1:-1,E=0;s&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let k,F=P>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?k=_.projectionCache.cachedAnchorPoint:(k=Qt(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=k);let O,H,q=k,W=k,K=0,ee=0;const te=Math.abs(T),re=[];let se;for(;K+ee<=te;){if(F+=P,F<h||F>=f)return null;K+=ee,W=q,H=O;const me={absOffsetX:te,direction:P,distanceFromAnchor:K,previousVertex:W};if(q=Ji(F,_,me),i===0)re.push(W),se=q.sub(W);else{let Te;const Se=q.sub(W);Te=Se.mag()===0?pa(Ji(F+P,_,me).sub(q),i,P):pa(Se,i,P),H||(H=W.add(Te)),O=go(F,Te,q,h,f,H,i,_,me),re.push(H),se=O.sub(H)}ee=se.mag()}const ne=se._mult((te-K)/ee)._add(H||W),de=E+Math.atan2(q.y-W.y,q.x-W.x);return re.push(ne),{point:ne,angle:x?de:0,path:re}}const _o=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function zi(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(_o,3*s)}}function qt(u,e,i){const s=e[0],l=e[1];return u[0]=i[0]*s+i[4]*l+i[12],u[1]=i[1]*s+i[5]*l+i[13],u[3]=i[3]*s+i[7]*l+i[15],u}const Ai=100;class ws{constructor(e,i=new Ze(e.width+200,e.height+200,25),s=new Ze(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+Ai,this.screenBottomBoundary=e.height+Ai,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,x,T,P,E,k){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,P,k),O=s*F.perspectiveRatio;let H;if(f||_)H=this._projectCollisionBox(e,O,l,h,f,_,x,F,P,E,k);else{const se=F.x+(E?E.x*O:0),ne=F.y+(E?E.y*O:0);H={allPointsOccluded:!1,box:[se+e.x1*O,ne+e.y1*O,se+e.x2*O,ne+e.y2*O]}}const[q,W,K,ee]=H.box,te=f?H.allPointsOccluded:F.isOccluded;let re=te;return re||(re=F.perspectiveRatio<this.perspectiveRatioCutoff),re||(re=!this.isInsideGrid(q,W,K,ee)),re||i!=="always"&&this.grid.hitTest(q,W,K,ee,i,T)?{box:[q,W,K,ee],placeable:!1,offscreen:!1,occluded:te}:{box:[q,W,K,ee],placeable:!0,offscreen:this.isOffscreen(q,W,K,ee),occluded:te}}placeCollisionCircles(e,i,s,l,h,f,_,x,T,P,E,k,F,O){const H=[],q=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(q.x,q.y,f,O),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.ay,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},te=Pe(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,ee);let re=!1,se=!1,ne=!0;if(te){const de=.5*E*W+k,me=new o.P(-100,-100),Te=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Se=new ze,be=te.first,je=te.last;let Be=[];for(let mt=be.path.length-1;mt>=1;mt--)Be.push(be.path[mt]);for(let mt=1;mt<je.path.length;mt++)Be.push(je.path[mt]);const ke=2.5*de;if(T){const mt=this.projectPathToScreenSpace(Be,ee);Be=mt.some(lt=>lt.signedDistanceFromCamera<=0)?[]:mt.map(lt=>lt.point)}let We=[];if(Be.length>0){const mt=Be[0].clone(),lt=Be[0].clone();for(let ei=1;ei<Be.length;ei++)mt.x=Math.min(mt.x,Be[ei].x),mt.y=Math.min(mt.y,Be[ei].y),lt.x=Math.max(lt.x,Be[ei].x),lt.y=Math.max(lt.y,Be[ei].y);We=mt.x>=me.x&&lt.x<=Te.x&&mt.y>=me.y&&lt.y<=Te.y?[Be]:lt.x<me.x||mt.x>Te.x||lt.y<me.y||mt.y>Te.y?[]:o.av([Be],me.x,me.y,Te.x,Te.y)}for(const mt of We){Se.reset(mt,.25*de);let lt=0;lt=Se.length<=.5*de?1:Math.ceil(Se.paddedLength/ke)+1;for(let ei=0;ei<lt;ei++){const Dt=ei/Math.max(lt-1,1),ti=Se.lerp(Dt),Wt=ti.x+Ai,jt=ti.y+Ai;H.push(Wt,jt,de,0);const At=Wt-de,Ri=jt-de,Pi=Wt+de,$i=jt+de;if(ne=ne&&this.isOffscreen(At,Ri,Pi,$i),se=se||this.isInsideGrid(At,Ri,Pi,$i),e!=="always"&&this.grid.hitTestCircle(Wt,jt,de,e,P)&&(re=!0,!x))return{circles:[],offscreen:!1,collisionDetected:re}}}}return{circles:!x&&re||!se||W<this.perspectiveRatioCutoff?[]:H,offscreen:ne,collisionDetected:re}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.an(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const x=st(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(x.point.x,x.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,x=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,x=0):(x++,x>f&&(f=x,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,l=1/0,h=-1/0,f=-1/0;for(const P of e){const E=new o.P(P.x+Ai,P.y+Ai);s=Math.min(s,E.x),l=Math.min(l,E.y),h=Math.max(h,E.x),f=Math.max(f,E.y),i.push(E)}const _=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),x={},T={};for(const P of _){const E=P.key;if(x[E.bucketInstanceId]===void 0&&(x[E.bucketInstanceId]={}),x[E.bucketInstanceId][E.featureIndex])continue;const k=[new o.P(P.x1,P.y1),new o.P(P.x2,P.y1),new o.P(P.x2,P.y2),new o.P(P.x1,P.y2)];o.aw(i,k)&&(x[E.bucketInstanceId][E.featureIndex]=!0,T[E.bucketInstanceId]===void 0&&(T[E.bucketInstanceId]=[]),T[E.bucketInstanceId].push(E.featureIndex))}return T}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(x,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.at(f,f,h)):(f=[e,i,0,1],qt(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+Ai,y:(-f[1]/_+1)/2*this.transform.height+Ai,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+Ai,y:(1-f.point.y)/2*this.transform.height+Ai,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,l){const h=this.transform.projectTileCoordinates(e,i,s,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,l){return s<Ai||e>=this.screenRightBoundary||l<Ai||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.ad([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,x,T,P,E){let k=1,F=0,O=0,H=1;const q=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Be=this.projectAndGetPerspectiveRatio(q+1,W,l,T,E),ke=Be.x-x.x,We=Math.atan((Be.y-x.y)/ke)+(ke<0?Math.PI:0),mt=Math.sin(We),lt=Math.cos(We);k=lt,F=mt,O=-mt,H=lt}else if(!f&&h){const Be=we(this.transform);k=Be.vecEast[0],F=Be.vecEast[1],O=Be.vecSouth[0],H=Be.vecSouth[1]}let K=x.x,ee=x.y,te=i;h&&(K=q,ee=W,te=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),te*=this.transform.getPitchedTextCorrection(q,W,l),P||(te*=o.ae(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(K+=k*P.x*te+O*P.y*te,ee+=F*P.x*te+H*P.y*te);const re=e.x1*te,se=e.x2*te,ne=(re+se)/2,de=e.y1*te,me=e.y2*te,Te=(de+me)/2,Se=[{offsetX:re,offsetY:de},{offsetX:ne,offsetY:de},{offsetX:se,offsetY:de},{offsetX:se,offsetY:Te},{offsetX:se,offsetY:me},{offsetX:ne,offsetY:me},{offsetX:re,offsetY:me},{offsetX:re,offsetY:Te}];let be=[];for(const{offsetX:Be,offsetY:ke}of Se)be.push(new o.P(K+k*Be+O*ke,ee+F*Be+H*ke));let je=!1;if(h){const Be=be.map(ke=>this.projectAndGetPerspectiveRatio(ke.x,ke.y,l,T,E));je=Be.some(ke=>!ke.isOccluded),be=Be.map(ke=>new o.P(ke.x,ke.y))}else je=!0;return{box:o.ax(be),allPointsOccluded:!je}}}class yo{constructor(e,i,s,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Gr{constructor(e,i,s,l,h){this.text=new yo(e?e.text:null,i,s,h),this.icon=new yo(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class fa{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Nu{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class Zu{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 Nl(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aE(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Na{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new ws(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Zu(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,x=h.layers[0].layout,T=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/o.Z,k=s.tileID.toUnwrapped(),F=x.get("text-rotation-alignment")==="map",O=o.az(s,1,this.transform.zoom),H=o.aA(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.aA(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=nt(F,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Nu(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:x,translationText:H,translationIcon:q,unwrappedTileID:k,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.ak(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:se}=ee;e.push({sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:se,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,_,x,T,P,E,k,F,O,H,q,W,K,ee,te){const re=o.aB[e.textAnchor],se=[e.textOffset0,e.textOffset1],ne=Nl(re,s,l,se,h),de=this.collisionIndex.placeCollisionBox(i,k,x,T,P,_,f,q,E.predicate,ee,ne,te);if((!K||this.collisionIndex.placeCollisionBox(K,k,x,T,P,_,f,W,E.predicate,ee,ne,te).placeable)&&de.placeable){let me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:s,height:l,anchor:re,textBoxScale:h,prevAnchor:me},this.markUsedJustification(O,re,F,H),O.allowVerticalPlacement&&(this.markUsedOrientation(O,H,F),this.placedOrientations[F.crossTileID]=H),{shift:ne,placedGlyphBoxes:de}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:T,textPixelRatio:P,holdingForFade:E,collisionBoxArray:k,partiallyEvaluatedTextSize:F,collisionGroup:O}=e.parameters,H=h.get("text-optional"),q=h.get("icon-optional"),W=o.aC(h,"text-overlap","text-allow-overlap"),K=W==="always",ee=o.aC(h,"icon-overlap","icon-allow-overlap"),te=ee==="always",re=h.get("text-rotation-alignment")==="map",se=h.get("text-pitch-alignment")==="map",ne=h.get("icon-text-fit")!=="none",de=h.get("symbol-z-order")==="viewport-y",me=K&&(te||!l.hasIconData()||q),Te=te&&(K||!l.hasTextData()||H);!l.collisionArrays&&k&&l.deserializeCollisionBoxes(k);const Se=this.retainedQueryData[l.bucketInstanceId].tileID,be=this._getTerrainElevationFunc(Se),je=this.transform.getFastPathSimpleProjectionMatrix(Se),Be=(ke,We,mt)=>{var lt,ei;if(i[ke.crossTileID])return;if(E)return void(this.placements[ke.crossTileID]=new fa(!1,!1,!1));let Dt=!1,ti=!1,Wt=!0,jt=null,At={box:null,placeable:!1,offscreen:null,occluded:!1},Ri={placeable:!1},Pi=null,$i=null,tr=null,fn=0,ta=0,zn=0;We.textFeatureIndex?fn=We.textFeatureIndex:ke.useRuntimeCollisionCircles&&(fn=ke.featureIndex),We.verticalTextFeatureIndex&&(ta=We.verticalTextFeatureIndex);const An=We.textBox;if(An){const Er=ai=>{let Xt=o.al.horizontal;if(l.allowVerticalPlacement&&!ai&&this.prevPlacement){const _i=this.prevPlacement.placedOrientations[ke.crossTileID];_i&&(this.placedOrientations[ke.crossTileID]=_i,Xt=_i,this.markUsedOrientation(l,Xt,ke))}return Xt},ia=(ai,Xt)=>{if(l.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&We.verticalTextBox){for(const _i of l.writingModes)if(_i===o.al.vertical?(At=Xt(),Ri=At):At=ai(),At&&At.placeable)break}else At=ai()},Rn=ke.textAnchorOffsetStartIndex,Dn=ke.textAnchorOffsetEndIndex;if(Dn===Rn){const ai=(Xt,_i)=>{const ii=this.collisionIndex.placeCollisionBox(Xt,W,P,Se,x,se,re,f,O.predicate,be,void 0,je);return ii&&ii.placeable&&(this.markUsedOrientation(l,_i,ke),this.placedOrientations[ke.crossTileID]=_i),ii};ia(()=>ai(An,o.al.horizontal),()=>{const Xt=We.verticalTextBox;return l.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Xt?ai(Xt,o.al.vertical):{box:null,offscreen:null}}),Er(At&&At.placeable)}else{let ai=o.aB[(ei=(lt=this.prevPlacement)===null||lt===void 0?void 0:lt.variableOffsets[ke.crossTileID])===null||ei===void 0?void 0:ei.anchor];const Xt=(ii,zh,Ia)=>{const Kd=ii.x2-ii.x1,Ah=ii.y2-ii.y1,Oc=ke.textBoxScale,Rh=ne&&ee==="never"?zh:null;let kr=null,ra=W==="never"?1:2,jc="never";ai&&ra++;for(let Dh=0;Dh<ra;Dh++){for(let Ys=Rn;Ys<Dn;Ys++){const Nc=l.textAnchorOffsets.get(Ys);if(ai&&Nc.textAnchor!==ai)continue;const Zc=this.attemptAnchorPlacement(Nc,ii,Kd,Ah,Oc,re,se,P,Se,x,O,jc,ke,l,Ia,f,_,Rh,be);if(Zc&&(kr=Zc.placedGlyphBoxes,kr&&kr.placeable))return Dt=!0,jt=Zc.shift,kr}ai?ai=null:jc=W}return s&&!kr&&(kr={box:this.collisionIndex.placeCollisionBox(An,"always",P,Se,x,se,re,f,O.predicate,be,void 0,je).box,offscreen:!1,placeable:!1,occluded:!1}),kr};ia(()=>Xt(An,We.iconBox,o.al.horizontal),()=>{const ii=We.verticalTextBox;return l.allowVerticalPlacement&&(!At||!At.placeable)&&ke.numVerticalGlyphVertices>0&&ii?Xt(ii,We.verticalIconBox,o.al.vertical):{box:null,occluded:!0,offscreen:null}}),At&&(Dt=At.placeable,Wt=At.offscreen);const _i=Er(At&&At.placeable);if(!Dt&&this.prevPlacement){const ii=this.prevPlacement.variableOffsets[ke.crossTileID];ii&&(this.variableOffsets[ke.crossTileID]=ii,this.markUsedJustification(l,ii.anchor,ke,_i))}}}if(Pi=At,Dt=Pi&&Pi.placeable,Wt=Pi&&Pi.offscreen,ke.useRuntimeCollisionCircles){const Er=l.text.placedSymbolArray.get(ke.centerJustifiedTextSymbolIndex),ia=o.am(l.textSizeData,F,Er),Rn=h.get("text-padding");$i=this.collisionIndex.placeCollisionCircles(W,Er,l.lineVertexArray,l.glyphOffsetArray,ia,x,T,s,se,O.predicate,ke.collisionCircleDiameter,Rn,f,be),$i.circles.length&&$i.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Dt=K||$i.circles.length>0&&!$i.collisionDetected,Wt=Wt&&$i.offscreen}if(We.iconFeatureIndex&&(zn=We.iconFeatureIndex),We.iconBox){const Er=ia=>this.collisionIndex.placeCollisionBox(ia,ee,P,Se,x,se,re,_,O.predicate,be,ne&&jt?jt:void 0,je);Ri&&Ri.placeable&&We.verticalIconBox?(tr=Er(We.verticalIconBox),ti=tr.placeable):(tr=Er(We.iconBox),ti=tr.placeable),Wt=Wt&&tr.offscreen}const mn=H||ke.numHorizontalGlyphVertices===0&&ke.numVerticalGlyphVertices===0,Pa=q||ke.numIconVertices===0;mn||Pa?Pa?mn||(ti=ti&&Dt):Dt=ti&&Dt:ti=Dt=ti&&Dt;const Ca=ti&&tr.placeable;if(Dt&&Pi.placeable&&this.collisionIndex.insertCollisionBox(Pi.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Ri&&Ri.placeable&&ta?ta:fn,O.ID),Ca&&this.collisionIndex.insertCollisionBox(tr.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,zn,O.ID),$i&&Dt&&this.collisionIndex.insertCollisionCircles($i.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,fn,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,mt,We,Pi,tr,$i),ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ke.crossTileID]=new fa((Dt||me)&&!(Pi!=null&&Pi.occluded),(ti||Te)&&!(tr!=null&&tr.occluded),Wt||l.justReloaded),i[ke.crossTileID]=!0};if(de){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ke=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let We=ke.length-1;We>=0;--We){const mt=ke[We];Be(l.symbolInstances.get(mt),l.collisionArrays[mt],mt)}}else for(let ke=e.symbolInstanceStart;ke<e.symbolInstanceEnd;ke++)Be(l.symbolInstances.get(ke),l.collisionArrays[ke],ke);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?x=_.get(i):(x={text:null,icon:null},_.set(i,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<f.circles.length;x+=4)_.push(f.circles[x+0]-Ai),_.push(f.circles[x+1]-Ai),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.al.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aD(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.al.horizontal||i===o.al.horizontalOnly?i:0,h=i===o.al.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],P=h[x];P?(this.opacities[x]=new Gr(P,l,T.text,T.icon),s=s||T.text!==P.text.placed||T.icon!==P.icon.placed):(this.opacities[x]=new Gr(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const x in h){const T=h[x];if(!this.opacities[x]){const P=new Gr(T,l,!1,!1);P.isHidden()||(this.opacities[x]=P,s=s||T.text.placed||T.icon.placed)}}for(const x in f)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=f[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new Gr(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=f.get("text-rotation-alignment")==="map",k=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",O=new Gr(null,0,x&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const H=(W,K,ee)=>{for(let te=0;te<K/4;te++)W.opacityVertexArray.emplaceBack(ee);W.hasVisibleVertices=W.hasVisibleVertices||ee!==ma},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:te,crossTileID:re}=K;let se=this.opacities[re];s[re]?se=_:se||(se=O,this.opacities[re]=se),s[re]=!0;const ne=K.numIconVertices>0,de=this.placedOrientations[K.crossTileID],me=de===o.al.vertical,Te=de===o.al.horizontal||de===o.al.horizontalOnly;if(ee>0||te>0){const be=$l(se.text);H(e.text,ee,me?ma:be),H(e.text,te,Te?ma:be);const je=se.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(We=>{We>=0&&(e.text.placedSymbolArray.get(We).hidden=je||me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=je||Te?1:0);const Be=this.variableOffsets[K.crossTileID];Be&&this.markUsedJustification(e,Be.anchor,K,de);const ke=this.placedOrientations[K.crossTileID];ke&&(this.markUsedJustification(e,"left",K,ke),this.markUsedOrientation(e,ke,K))}if(ne){const be=$l(se.icon),je=!(F&&K.verticalPlacedIconSymbolIndex&&me);K.placedIconSymbolIndex>=0&&(H(e.icon,K.numIconVertices,je?be:ma),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=se.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(H(e.icon,K.numVerticalIconVertices,je?ma:be),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=se.icon.isHidden())}const Se=q&&q.has(W)?q.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const be=e.collisionArrays[W];if(be){let je=new o.P(0,0);if(be.textBox||be.verticalTextBox){let Be=!0;if(P){const ke=this.variableOffsets[re];ke?(je=Nl(ke.anchor,ke.width,ke.height,ke.textOffset,ke.textBoxScale),E&&je._rotate(k?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Be=!1}if(be.textBox||be.verticalTextBox){let ke;be.textBox&&(ke=me),be.verticalTextBox&&(ke=Te),Zl(e.textCollisionBox.collisionVertexArray,se.text.placed,!Be||ke,Se.text,je.x,je.y)}}if(be.iconBox||be.verticalIconBox){const Be=!!(!Te&&be.verticalIconBox);let ke;be.iconBox&&(ke=Be),be.verticalIconBox&&(ke=!Be),Zl(e.iconCollisionBox.collisionVertexArray,se.icon.placed,ke,Se.icon,F?je.x:0,F?je.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const s=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function Zl(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-Ai,_=s[1]-Ai,x=s[2]-Ai,T=s[3]-Ai;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Id=Math.pow(2,25),Ed=Math.pow(2,24),kd=Math.pow(2,17),Vu=Math.pow(2,16),Uu=Math.pow(2,9),Vl=Math.pow(2,8),Ul=Math.pow(2,1);function $l(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*Id+e*Ed+i*kd+e*Vu+i*Uu+e*Vl+i*Ul+e}const ma=0;class Gl{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class xo{constructor(e,i,s,l,h,f,_,x){this.placement=new Na(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=Ie.now(),h=()=>!this._forceFullPlacement&&Ie.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Gl(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 Za=512/o.Z/2;class Va{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,x=l.get(_);x?x.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*Za),y:Math.floor(x.anchorY*Za)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new o.aF(_.positions.length,16,Uint16Array);for(const{x:T,y:P}of _.positions)x.add(T,P);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,T=Za/Math.pow(2,x-h),P=(_*o.Z+e.anchorY)*T,E=l*o.Z*Za;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*Za),y:Math.floor(P-E)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const x=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const P of T){const E=_.crossTileIDs[P];if(!s[E]){s[E]=!0,f.crossTileID=E;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const P=_.positions[T],E=_.crossTileIDs[T];if(Math.abs(P.x-x.x)<=l&&Math.abs(P.y-x.y)<=l&&!s[E]){s[E]=!0,f.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class $u{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class zd{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const x=f[_];x.tileID.isChildOf(e)&&x.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Va(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const l=this.indexes[s];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[h]),delete l[h],i=!0)}return i}}class Pn{constructor(){this.layerIndexes={},this.crossTileIDs=new $u,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new zd);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var Ua="void main() {fragColor=vec4(1.0);}";const gt={prelude:Tt(`#ifdef GL_ES
7
7
  precision mediump float;
8
8
  #else
9
9
  #if !defined(lowp)
@@ -726,4 +726,4 @@ uniform ${P} ${E} u_${k};
726
726
  `),re=ee.concat(gt.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
727
727
  `);qr(T)||(te=function(me){return me.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(te),re=function(me){return me.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(re));const se=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(se,te),T.compileShader(se),!T.getShaderParameter(se,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(se)}`);T.attachShader(this.program,se);const ne=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(ne,re),T.compileShader(ne),!T.getShaderParameter(ne,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(ne)}`);T.attachShader(this.program,ne),this.attributes={};const de={};this.numAttributes=k.length;for(let me=0;me<this.numAttributes;me++)k[me]&&(T.bindAttribLocation(this.program,me,k[me]),this.attributes[k[me]]=me);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(ne),T.deleteShader(se);for(let me=0;me<K.length;me++){const Te=K[me];if(Te&&!de[Te]){const Se=T.getUniformLocation(this.program,Te);Se&&(de[Te]=Se)}}this.fixedUniforms=l(e,de),this.terrainUniforms=((me,Te)=>({u_depth:new o.bH(me,Te.u_depth),u_terrain:new o.bH(me,Te.u_terrain),u_terrain_dim:new o.b8(me,Te.u_terrain_dim),u_terrain_matrix:new o.bJ(me,Te.u_terrain_matrix),u_terrain_unpack:new o.bK(me,Te.u_terrain_unpack),u_terrain_exaggeration:new o.b8(me,Te.u_terrain_exaggeration)}))(e,de),this.projectionUniforms=((me,Te)=>({u_projection_matrix:new o.bJ(me,Te.u_projection_matrix),u_projection_tile_mercator_coords:new o.bK(me,Te.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bK(me,Te.u_projection_clipping_plane),u_projection_transition:new o.b8(me,Te.u_projection_transition),u_projection_fallback_matrix:new o.bJ(me,Te.u_projection_fallback_matrix)}))(e,de),this.binderUniforms=s?s.getUniforms(e,de):[]}draw(e,i,s,l,h,f,_,x,T,P,E,k,F,O,H,q,W,K,ee){const te=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,x.depthTexture),e.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,x.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(x[se])}if(T)for(const se in T)this.projectionUniforms[Kl[se]].set(T[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:H});let re=0;switch(i){case te.LINES:re=2;break;case te.TRIANGLES:re=3;break;case te.LINE_STRIP:re=1}for(const se of F.get()){const ne=se.vaos||(se.vaos={});(ne[P]||(ne[P]=new cn)).bind(e,this,E,q?q.getPaintVertexBuffers():[],k,se.vertexOffset,W,K,ee),te.drawElements(i,se.primitiveLength*re,te.UNSIGNED_SHORT,se.primitiveOffset*re*2)}}}function qu(u,e,i){const s=1/o.az(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,f=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Ds=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bN();l.properties.get("anchor")==="viewport"&&o.bO(_,u.transform.bearingInRadians),o.bP(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},Dd=(u,e,i,s,l,h,f)=>o.e(Ds(u,e,i,s),qu(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),ga=(u,e,i,s)=>o.e(qu(e,u,i),{u_fill_translate:s}),Ld=(u,e)=>({u_world:u,u_fill_translate:e}),Hu=(u,e,i,s,l)=>o.e(ga(u,e,i,l),{u_world:s}),Bd=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.az(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Wu=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Yl=u=>({u_viewport_size:[u.width,u.height]}),Jl=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),Ql=(u,e,i,s)=>{const l=o.az(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.az(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},ec=(u,e,i,s)=>{const l=o.K();o.bQ(l,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:l,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}},Xu=(u,e,i)=>{const s=i.paint.get("hillshade-shadow-color"),l=i.paint.get("hillshade-highlight-color"),h=i.paint.get("hillshade-accent-color");let f=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return i.paint.get("hillshade-illumination-anchor")==="viewport"&&(f+=u.transform.bearingInRadians),{u_image:0,u_latrange:Ku(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:l,u_accent:h}},_a=(u,e)=>{const i=e.stride,s=o.K();return o.bQ(s,0,o.Z,-8192,0,0,1),o.L(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Ku(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.$(0,s/i).toLngLat().lat,new o.$(0,(s+1)/i).toLngLat().lat]}const Eo=(u,e,i,s)=>{const l=u.transform;return{u_translation:Ju(u,e,i),u_ratio:s/o.az(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Ls=(u,e,i,s,l)=>o.e(Eo(u,e,i,s),{u_image:0,u_image_height:l}),Fd=(u,e,i,s,l)=>{const h=u.transform,f=Yu(e,h);return{u_translation:Ju(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.az(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[f,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},ko=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=Yu(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),P=f.getDash(l.to,x),E=T.width*h.fromScale,k=P.width*h.toScale;return o.e(Eo(u,e,i,s),{u_patternscale_a:[_/E,-T.height/2],u_patternscale_b:[_/k,-P.height/2],u_sdfgamma:f.width/(256*Math.min(E,k)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:P.y,u_mix:h.t})};function Yu(u,e){return 1/o.az(u,1,e.tileZoom)}function Ju(u,e,i){return o.aA(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Qu=(u,e,i,s,l)=>{return{u_tl_parent:u,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(f=s.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(h=s.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:eh(s.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var h,f};function eh(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 tc=(u,e,i,s,l,h,f,_,x,T,P,E,k)=>{const F=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:F.width/F.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+P,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:E,u_texture:0,u_translation:T,u_pitched_scale:k}},zo=(u,e,i,s,l,h,f,_,x,T,P,E,k,F)=>{const O=f.transform;return o.e(tc(u,e,i,s,l,h,f,_,x,T,P,E,F),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},th=(u,e,i,s,l,h,f,_,x,T,P,E,k)=>o.e(zo(u,e,i,s,l,h,f,_,x,T,!0,P,0,k),{u_texsize_icon:E,u_texture_icon:1}),Ao=(u,e)=>({u_opacity:u,u_color:e}),Cn=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),P=_.imageManager.getPattern(h.to.toString()),{width:E,height:k}=_.imageManager.getPixelSize(),F=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/F,H=O*(x.tileID.canonical.x+x.tileID.wrap*F),q=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[E,k],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.az(x,1,_.transform.tileZoom),u_pixel_coord_upper:[H>>16,q>>16],u_pixel_coord_lower:[65535&H,65535&q]}}(i,l,e,s),{u_opacity:u}),Ro=(u,e)=>{},ic={fillExtrusion:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_height_factor:new o.b8(u,e.u_height_factor),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bM(u,e.u_world),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bH(u,e.u_scale_with_map),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_extrude_scale:new o.bM(u,e.u_extrude_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale),u_translate:new o.bM(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bM(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bM(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bI(u,e.u_color),u_overlay:new o.bH(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:Ro,clippingMask:Ro,heatmap:(u,e)=>({u_extrude_scale:new o.b8(u,e.u_extrude_scale),u_intensity:new o.b8(u,e.u_intensity),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_color_ramp:new o.bH(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bH(u,e.u_image),u_latrange:new o.bM(u,e.u_latrange),u_light:new o.bM(u,e.u_light),u_shadow:new o.bI(u,e.u_shadow),u_highlight:new o.bI(u,e.u_highlight),u_accent:new o.bI(u,e.u_accent)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_image:new o.bH(u,e.u_image),u_dimension:new o.bM(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bK(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_image:new o.bH(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_texsize:new o.bM(u,e.u_texsize),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_image:new o.bH(u,e.u_image),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_patternscale_a:new o.bM(u,e.u_patternscale_a),u_patternscale_b:new o.bM(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bH(u,e.u_image),u_tex_y_a:new o.b8(u,e.u_tex_y_a),u_tex_y_b:new o.b8(u,e.u_tex_y_b),u_mix:new o.b8(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bM(u,e.u_tl_parent),u_scale_parent:new o.b8(u,e.u_scale_parent),u_buffer_scale:new o.b8(u,e.u_buffer_scale),u_fade_t:new o.b8(u,e.u_fade_t),u_opacity:new o.b8(u,e.u_opacity),u_image0:new o.bH(u,e.u_image0),u_image1:new o.bH(u,e.u_image1),u_brightness_low:new o.b8(u,e.u_brightness_low),u_brightness_high:new o.b8(u,e.u_brightness_high),u_saturation_factor:new o.b8(u,e.u_saturation_factor),u_contrast_factor:new o.b8(u,e.u_contrast_factor),u_spin_weights:new o.bL(u,e.u_spin_weights),u_coords_top:new o.bK(u,e.u_coords_top),u_coords_bottom:new o.bK(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texsize_icon:new o.bM(u,e.u_texsize_icon),u_texture:new o.bH(u,e.u_texture),u_texture_icon:new o.bH(u,e.u_texture_icon),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_color:new o.bI(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bH(u,e.u_image),u_pattern_tl_a:new o.bM(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bM(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bM(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bM(u,e.u_pattern_br_b),u_texsize:new o.bM(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bM(u,e.u_pattern_size_a),u_pattern_size_b:new o.bM(u,e.u_pattern_size_b),u_scale_a:new o.b8(u,e.u_scale_a),u_scale_b:new o.b8(u,e.u_scale_b),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.b8(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bJ(u,e.u_fog_matrix),u_fog_color:new o.bI(u,e.u_fog_color),u_fog_ground_blend:new o.b8(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.b8(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon_fog_blend:new o.b8(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.b8(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.b8(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_terrain_coords_id:new o.b8(u,e.u_terrain_coords_id),u_ele_delta:new o.b8(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.b8(u,e.u_input),u_output_expected:new o.b8(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bL(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bL(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bJ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bI(u,e.u_sky_color),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon:new o.bM(u,e.u_horizon),u_horizon_normal:new o.bM(u,e.u_horizon_normal),u_sky_horizon_blend:new o.b8(u,e.u_sky_horizon_blend),u_sky_blend:new o.b8(u,e.u_sky_blend)})};class rc{constructor(e,i,s){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ih={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class nc{constructor(e,i,s,l){this.length=i.length,this.attributes=s,this.itemSize=i.bytesPerElement,this.dynamicDraw=l,this.context=e;const h=e.gl;this.buffer=h.createBuffer(),e.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let s=0;s<this.attributes.length;s++){const l=i.attributes[this.attributes[s].name];l!==void 0&&e.enableVertexAttribArray(l)}}setVertexAttribPointers(e,i,s){for(let l=0;l<this.attributes.length;l++){const h=this.attributes[l],f=i.attributes[h.name];f!==void 0&&e.vertexAttribPointer(f,h.components,e[ih[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class wt{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 ac extends wt{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Od extends wt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class jd extends wt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Nd extends wt{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 Zd extends wt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class rh extends wt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Vd extends wt{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 nh extends wt{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 Do extends wt{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 Lo extends wt{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 Bo extends wt{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 sc extends wt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class ya extends wt{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 Ja extends wt{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 jr extends wt{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class ah extends wt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class sh extends wt{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 oc extends wt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class xa extends wt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Fo extends wt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Oo extends wt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Bs extends wt{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 jo extends wt{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 oh extends wt{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 Qa extends wt{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 es extends wt{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 lh extends wt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class lc extends wt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;qr(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 It extends wt{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 No extends wt{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 Ud extends wt{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 Zo extends wt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Fs extends Zo{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 $d extends Zo{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 Gd extends Zo{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 cc="Framebuffer is not complete";class qd{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Fs(e,_),l)this.depthAttachment=h?new Gd(e,_):new $d(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(cc)}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 uc{constructor(e){var i,s;if(this.gl=e,this.clearColor=new ac(this),this.clearDepth=new Od(this),this.clearStencil=new jd(this),this.colorMask=new Nd(this),this.depthMask=new Zd(this),this.stencilMask=new rh(this),this.stencilFunc=new Vd(this),this.stencilOp=new nh(this),this.stencilTest=new Do(this),this.depthRange=new Lo(this),this.depthTest=new Bo(this),this.depthFunc=new sc(this),this.blend=new ya(this),this.blendFunc=new Ja(this),this.blendColor=new jr(this),this.blendEquation=new ah(this),this.cullFace=new sh(this),this.cullFaceSide=new oc(this),this.frontFace=new xa(this),this.program=new Fo(this),this.activeTexture=new Oo(this),this.viewport=new Bs(this),this.bindFramebuffer=new jo(this),this.bindRenderbuffer=new oh(this),this.bindTexture=new Qa(this),this.bindVertexBuffer=new es(this),this.bindElementBuffer=new lh(this),this.bindVertexArray=new lc(this),this.pixelStoreUnpack=new It(this),this.pixelStoreUnpackPremultiplyAlpha=new No(this),this.pixelStoreUnpackFlipY=new Ud(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),qr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const l=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:l==null?void 0:l.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const l=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i){return new rc(this,e,i)}createVertexBuffer(e,i,s){return new nc(this,e,i,s)}createRenderbuffer(e,i,s){const l=this.gl,h=l.createRenderbuffer();return this.bindRenderbuffer.set(h),l.renderbufferStorage(l.RENDERBUFFER,e,i,s),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,s,l){return new qd(this,e,i,s,l)}clear({color:e,depth:i,stencil:s}){const l=this.gl;let h=0;e&&(h|=l.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),s!==void 0&&(h|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),l.clear(h)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){o.bE(e.blendFunction,zt.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 qr(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 qr(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 va;function Os(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let P=0,E=0;for(let W=0;W<s.length;W++){const K=s[W],ee=e.getTile(K).getBucket(i);if(!ee)continue;const te=l?ee.textCollisionBox:ee.iconCollisionBox,re=ee.collisionCircleArray;re.length>0&&(T.push({circleArray:re,circleOffset:E,coord:K}),P+=re.length/4,E=P),te&&x.draw(h,_.LINES,pt.disabled,Mt.disabled,u.colorModeForRenderPass(),Ct.disabled,Wu(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}if(!l||!T.length)return;const k=u.useProgram("collisionCircle"),F=new o.bR;F.resize(4*P),F._trim();let O=0;for(const W of T)for(let K=0;K<W.circleArray.length/4;K++){const ee=4*K,te=W.circleArray[ee+0],re=W.circleArray[ee+1],se=W.circleArray[ee+2],ne=W.circleArray[ee+3];F.emplace(O++,te,re,se,ne,0),F.emplace(O++,te,re,se,ne,1),F.emplace(O++,te,re,se,ne,2),F.emplace(O++,te,re,se,ne,3)}(!va||va.length<2*P)&&(va=function(W){const K=2*W,ee=new o.bT;ee.resize(K),ee._trim();for(let te=0;te<K;te++){const re=6*te;ee.uint16[re+0]=4*te+0,ee.uint16[re+1]=4*te+1,ee.uint16[re+2]=4*te+2,ee.uint16[re+3]=4*te+2,ee.uint16[re+4]=4*te+3,ee.uint16[re+5]=4*te+0}return ee}(P));const H=h.createIndexBuffer(va,!0),q=h.createVertexBuffer(F,o.bS.members,!0);for(const W of T){const K=Yl(u.transform);k.draw(h,_.TRIANGLES,pt.disabled,Mt.disabled,u.colorModeForRenderPass(),Ct.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,q,H,o.aJ.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}const hc=o.ad(new Float32Array(16));function dc(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aE(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function ch(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return st(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=Qt(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 Vo(u,e,i,s,l,h,f,_,x,T,P,E){const k=u.text.placedSymbolArray,F=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,H={};F.clear();for(let q=0;q<k.length;q++){const W=k.get(q),K=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(K){const ee=new o.P(W.anchorX,W.anchorY),te={getElevation:E,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:T,unwrappedTileID:P},re=i?bs(ee.x,ee.y,te):Qt(ee.x,ee.y,te),se=St(l.cameraToCenterDistance,re.signedDistanceFromCamera);let ne=o.am(u.textSizeData,_,W)*se/o.ay;i&&(ne*=u.tilePixelRatio/f);const{width:de,height:me,anchor:Te,textOffset:Se,textBoxScale:be}=K,je=dc(Te,de,me,Se,be,ne),Be=l.getPitchedTextCorrection(ee.x+T[0],ee.y+T[1],P),ke=ch(re.point,te,e,je,-l.bearingInRadians,Be),We=u.allowVerticalPlacement&&W.placedOrientation===o.al.vertical?Math.PI/2:0;for(let mt=0;mt<W.numGlyphs;mt++)o.as(F,ke,We);x&&W.associatedIconIndex>=0&&(H[W.associatedIconIndex]={shiftedAnchor:ke,angle:We})}else zi(W.numGlyphs,F)}if(x){O.clear();const q=u.icon.placedSymbolArray;for(let W=0;W<q.length;W++){const K=q.get(W);if(K.hidden)zi(K.numGlyphs,O);else{const ee=H[W];if(ee)for(let te=0;te<K.numGlyphs;te++)o.as(O,ee.shiftedAnchor,ee.angle);else zi(K.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(F)}function Uo(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function $o(u,e,i,s,l,h,f,_,x,T,P,E,k){const F=u.context,O=F.gl,H=u.transform,q=_==="map",W=x==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=q&&!W&&!K,te=!i.layout.get("symbol-sort-key").isConstant();let re=!1;const se=u.getDepthModeForSublayer(0,pt.ReadOnly),ne=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),de=[],me=H.getCircleRadiusCorrection();for(const Te of s){const Se=e.getTile(Te),be=Se.getBucket(i);if(!be)continue;const je=l?be.text:be.icon;if(!je||!je.segments.get().length||!je.hasVisibleVertices)continue;const Be=je.programConfigurations.get(i.id),ke=l||be.sdfIcons,We=l?be.textSizeData:be.iconSizeData,mt=W||H.pitch!==0,lt=u.useProgram(Uo(ke,l,be),Be),ei=o.ak(We,H.zoom),Dt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Te);let ti,Wt,jt,At,Ri=[0,0],Pi=null;if(l)Wt=Se.glyphAtlasTexture,jt=O.LINEAR,ti=Se.glyphAtlasTexture.size,be.iconsInText&&(Ri=Se.imageAtlasTexture.size,Pi=Se.imageAtlasTexture,At=mt||u.options.rotating||u.options.zooming||We.kind==="composite"||We.kind==="camera"?O.LINEAR:O.NEAREST);else{const ai=i.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;Wt=Se.imageAtlasTexture,jt=ke||u.options.rotating||u.options.zooming||ai||mt?O.LINEAR:O.NEAREST,ti=Se.imageAtlasTexture.size}const $i=o.az(Se,1,u.transform.zoom),tr=nt(q,u.transform,$i),fn=o.K();o.an(fn,tr);const ta=dt(W,q,u.transform,$i),zn=o.aA(H,Se,h,f),An=H.getProjectionData({overscaledTileID:Te,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),mn=ne&&be.hasTextData(),Pa=i.layout.get("icon-text-fit")!=="none"&&mn&&be.hasIconData();if(K){const ai=u.style.map.terrain?(_i,ii)=>u.style.map.terrain.getElevation(Te,_i,ii):null,Xt=i.layout.get("text-rotation-alignment")==="map";Pt(be,u,l,tr,fn,W,T,Xt,Te.toUnwrapped(),H.width,H.height,zn,ai)}const Ca=l&&ne||Pa,Er=K||Ca?hc:W?tr:u.transform.clipSpaceToPixelsMatrix,ia=ke&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Rn;Rn=ke?be.iconsInText?th(We.kind,ei,ee,W,K,Ca,u,Er,ta,zn,ti,Ri,me):zo(We.kind,ei,ee,W,K,Ca,u,Er,ta,zn,l,ti,0,me):tc(We.kind,ei,ee,W,K,Ca,u,Er,ta,zn,l,ti,me);const Dn={program:lt,buffers:je,uniformValues:Rn,projectionData:An,atlasTexture:Wt,atlasTextureIcon:Pi,atlasInterpolation:jt,atlasInterpolationIcon:At,isSDF:ke,hasHalo:ia};if(te&&be.canOverlap){re=!0;const ai=je.segments.get();for(const Xt of ai)de.push({segments:new o.aJ([Xt]),sortKey:Xt.sortKey,state:Dn,terrainData:Dt})}else de.push({segments:je.segments,sortKey:0,state:Dn,terrainData:Dt})}re&&de.sort((Te,Se)=>Te.sortKey-Se.sortKey);for(const Te of de){const Se=Te.state;if(F.activeTexture.set(O.TEXTURE0),Se.atlasTexture.bind(Se.atlasInterpolation,O.CLAMP_TO_EDGE),Se.atlasTextureIcon&&(F.activeTexture.set(O.TEXTURE1),Se.atlasTextureIcon&&Se.atlasTextureIcon.bind(Se.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),Se.isSDF){const be=Se.uniformValues;Se.hasHalo&&(be.u_is_halo=1,uh(Se.buffers,Te.segments,i,u,Se.program,se,P,E,be,Se.projectionData,Te.terrainData)),be.u_is_halo=0}uh(Se.buffers,Te.segments,i,u,Se.program,se,P,E,Se.uniformValues,Se.projectionData,Te.terrainData)}}function uh(u,e,i,s,l,h,f,_,x,T,P){const E=s.context;l.draw(E,E.gl.TRIANGLES,h,f,_,Ct.backCCW,x,P,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function pc(u,e,i,s,l){const h=u.context,f=h.gl,_=Mt.disabled,x=new zt([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const P=s.key;let E=i.heatmapFbos.get(P);E||(E=fc(h,e.tileSize,e.tileSize),i.heatmapFbos.set(P,E)),h.bindFramebuffer.set(E.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const k=T.programConfigurations.get(i.id),F=u.useProgram("heatmap",k,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),H=u.style.map.terrain.getTerrainData(s);F.draw(h,f.TRIANGLES,pt.disabled,_,x,Ct.disabled,Ql(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),H,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,k)}function Hd(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=js(h,e),T=i.key,P=e.heatmapFbos.get(T);if(!P)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,P.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const E=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,pt.disabled,Mt.disabled,u.colorModeForRenderPass(),Ct.disabled,ec(u,e,0,1),null,E,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),P.destroy(),e.heatmapFbos.delete(T)}function fc(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function js(u,e){return e.colorRampTexture||(e.colorRampTexture=new Et(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Go(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function mc(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",P=i.paint.get(T),E=P&&P.constantOr(1),k=i.getCrossfadeParameters();let F,O,H,q,W;const K=u.transform,ee=i.paint.get("fill-translate"),te=i.paint.get("fill-translate-anchor");f?(O=E&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=x.LINES):(O=E?"fillPattern":"fill",F=x.TRIANGLES);const re=P.constantOr(null);for(const se of s){const ne=e.getTile(se);if(E&&!ne.patternsLoaded())continue;const de=ne.getBucket(i);if(!de)continue;const me=de.programConfigurations.get(i.id),Te=u.useProgram(O,me),Se=u.style.map.terrain&&u.style.map.terrain.getTerrainData(se);E&&(u.context.activeTexture.set(x.TEXTURE0),ne.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),me.updatePaintBuffers(k)),Go(me,T,re,ne,i);const be=K.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),je=o.aA(K,ne,ee,te);if(f){q=de.indexBuffer2,W=de.segments2;const ke=[x.drawingBufferWidth,x.drawingBufferHeight];H=O==="fillOutlinePattern"&&E?Hu(u,k,ne,ke,je):Ld(ke,je)}else q=de.indexBuffer,W=de.segments,H=E?ga(u,k,ne,je):{u_fill_translate:je};let Be;if(u.renderPass==="translucent"&&_){const[ke]=u.getStencilConfigForOverlapAndUpdateStencilID(s);Be=ke[se.overscaledZ]}else Be=u.stencilModeForClipping(se);Te.draw(u.context,F,l,Be,h,Ct.backCCW,H,Se,be,i.id,de.layoutVertexBuffer,q,W,i.paint,u.transform.zoom,me)}}function qo(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,P="fill-extrusion-pattern",E=i.paint.get(P),k=E.constantOr(1),F=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),H=E.constantOr(null),q=u.transform;for(const W of s){const K=e.getTile(W),ee=K.getBucket(i);if(!ee)continue;const te=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),re=ee.programConfigurations.get(i.id),se=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",re);k&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),re.updatePaintBuffers(F));const ne=q.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Go(re,P,H,K,i);const de=o.aA(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),me=i.paint.get("fill-extrusion-vertical-gradient"),Te=k?Dd(u,me,O,de,W,F,K):Ds(u,me,O,de);se.draw(x,x.gl.TRIANGLES,l,h,f,Ct.backCCW,Te,te,ne,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,re,u.style.map.terrain&&ee.centroidVertexBuffer)}}function ts(u,e,i,s,l,h,f,_,x){var T;const P=u.style.projection,E=u.context,k=u.transform,F=E.gl,O=u.useProgram("hillshade"),H=!u.options.moving;for(const q of s){const W=e.getTile(q),K=W.fbo;if(!K)continue;const ee=P.getMeshFromTileID(E,q.canonical,_,!0,"raster"),te=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(q);E.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,K.colorAttachment.get());const re=k.getProjectionData({overscaledTileID:q,aligned:H,applyGlobeMatrix:!x,applyTerrainMatrix:!0});O.draw(E,F.TRIANGLES,h,l[q.overscaledZ],f,Ct.backCCW,Xu(u,W,i),te,re,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const Ns=[new o.P(0,0),new o.P(o.Z,0),new o.P(o.Z,o.Z),new o.P(0,o.Z)];function Ho(u,e,i,s,l,h,f,_,x=!1,T=!1){const P=s[s.length-1].overscaledZ,E=u.context,k=E.gl,F=u.useProgram("raster"),O=u.transform,H=u.style.projection,q=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const ee=u.getDepthModeForSublayer(K.overscaledZ-P,i.paint.get("raster-opacity")===1?pt.ReadWrite:pt.ReadOnly,k.LESS),te=e.getTile(K);te.registerFadeDuration(i.paint.get("raster-fade-duration"));const re=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),ne=hh(te,re||se||null,e,i,u.transform,u.style.map.terrain);let de,me;const Te=i.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;E.activeTexture.set(k.TEXTURE0),te.texture.bind(Te,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(k.TEXTURE1),re?(re.texture.bind(Te,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),de=Math.pow(2,re.tileID.overscaledZ-te.tileID.overscaledZ),me=[te.tileID.canonical.x*de%1,te.tileID.canonical.y*de%1]):te.texture.bind(Te,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&E.extTextureFilterAnisotropic&&u.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const Se=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),be=O.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),je=Qu(me||[0,0],de||1,ne,i,_),Be=H.getMeshFromTileID(E,K.canonical,h,f,"raster");F.draw(E,k.TRIANGLES,ee,l?l[K.overscaledZ]:Mt.disabled,q,x?Ct.frontCCW:Ct.backCCW,je,Se,be,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function hh(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ie.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,P=i.getSource(),E=ge(l,{tileSize:P.tileSize,roundZoom:P.roundZoom}),k=!e||Math.abs(e.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=k&&u.refreshedUponExpiration?1:o.ae(k?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const gi=new o.b7(1,0,0,1),ba=new o.b7(0,1,0,1),Nr=new o.b7(0,0,1,1),gc=new o.b7(1,0,1,1),_c=new o.b7(0,1,1,1);function yc(u,e,i,s){Jn(u,0,e+i/2,u.transform.width,i,s)}function wa(u,e,i,s){Jn(u,e-i/2,0,i,u.transform.height,s)}function Jn(u,e,i,s,l,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function xc(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=pt.disabled,_=Mt.disabled,x=u.colorModeForRenderPass(),T="$debug",P=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const E=e.getTileByID(i.key).latestRawTileData,k=Math.floor((E&&E.byteLength||0)/1024),F=e.getTile(i).tileSize,O=512/Math.min(F,512)*(i.overscaledZ/u.transform.zoom)*.5;let H=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(H+=` => ${i.overscaledZ}`),function(W,K){W.initDebugOverlayCanvas();const ee=W.debugOverlayCanvas,te=W.context.gl,re=W.debugOverlayCanvas.getContext("2d");re.clearRect(0,0,ee.width,ee.height),re.shadowColor="white",re.shadowBlur=2,re.lineWidth=1.5,re.strokeStyle="white",re.textBaseline="top",re.font="bold 36px Open Sans, sans-serif",re.fillText(K,5,5),re.strokeText(K,5,5),W.debugOverlayTexture.update(ee),W.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${H} ${k}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,zt.alphaBlended,Ct.disabled,Jl(o.b7.transparent,O),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,Ct.disabled,Jl(o.b7.red),P,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function vc(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),P=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const E of i){const k=e.getTerrainMesh(E.tileID),F=u.renderToTexture.getTexture(E),O=e.getTerrainData(E.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,F.texture);const H=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(E.tileID.toUnwrapped()),W=Rd(H,q,u.style.sky,_.pitch,l),K=_.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(h,f.TRIANGLES,T,Mt.disabled,x,Ct.backCCW,W,O,K,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}}function bc(u,e){if(!e.mesh){const i=new o.aI;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aK;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new $a(u.createVertexBuffer(i,on.members),u.createIndexBuffer(s),o.aJ.simpleSegment(0,0,i.length,s.length))}return e.mesh}class dh{constructor(e,i){this.context=new uc(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=_e.maxUnderzooming+_e.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Pn}resize(e,i,s){if(this.width=Math.floor(e*s),this.height=Math.floor(i*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const e=this.context,i=new o.aI;i.emplaceBack(0,0),i.emplaceBack(o.Z,0),i.emplaceBack(0,o.Z),i.emplaceBack(o.Z,o.Z),this.tileExtentBuffer=e.createVertexBuffer(i,on.members),this.tileExtentSegments=o.aJ.simpleSegment(0,0,4,2);const s=new o.aI;s.emplaceBack(0,0),s.emplaceBack(o.Z,0),s.emplaceBack(0,o.Z),s.emplaceBack(o.Z,o.Z),this.debugBuffer=e.createVertexBuffer(s,on.members),this.debugSegments=o.aJ.simpleSegment(0,0,4,5);const l=new o.bY;l.emplaceBack(0,0,0,0),l.emplaceBack(o.Z,0,o.Z,0),l.emplaceBack(0,o.Z,0,o.Z),l.emplaceBack(o.Z,o.Z,o.Z,o.Z),this.rasterBoundsBuffer=e.createVertexBuffer(l,Xl.members),this.rasterBoundsSegments=o.aJ.simpleSegment(0,0,4,2);const h=new o.aI;h.emplaceBack(0,0),h.emplaceBack(o.Z,0),h.emplaceBack(0,o.Z),h.emplaceBack(o.Z,o.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,on.members),this.rasterBoundsSegmentsPosOnly=o.aJ.simpleSegment(0,0,4,5);const f=new o.aI;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,on.members),this.viewportSegments=o.aJ.simpleSegment(0,0,4,2);const _=new o.bZ;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aK;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new Mt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new $a(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.K();o.bQ(s,0,this.width,this.height,0,0,1),o.M(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const l={mainMatrix:s,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,pt.disabled,this.stencilClearMode,zt.disabled,Ct.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const l=this.context;l.setColorMode(zt.disabled),l.setDepthMode(pt.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const P of i){const E=e[P.key],k=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),F=_.getMeshFromTileID(this.context,P.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,pt.disabled,new Mt({func:f.ALWAYS,mask:0},E,255,f.KEEP,f.KEEP,f.REPLACE),zt.disabled,s?Ct.disabled:Ct.backCCW,null,k,O,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=ie(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),P=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),E=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,Mt.disabled,zt.disabled,Ct.backCCW,null,T,E,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new Mt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Mt({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+l]=new Mt({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:Mt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new Mt({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new Mt({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new Mt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new Mt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new zt([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?zt.unblended:zt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return pt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new pt(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new pt(this.context.gl.LEQUAL,pt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var s,l;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Ie.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},P={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const k in f){const F=f[k];F.used&&F.prepare(this.context),_[k]=F.getVisibleCoordinates(!1),x[k]=_[k].slice().reverse(),T[k]=F.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let k=0;k<h.length;k++)if(this.style._layers[h[k]].is3D()){this.opaquePassCutoff=k;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const k of h){const F=this.style._layers[k];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const O=x[F.source];(F.type==="custom"||O.length)&&this.renderLayer(this,f[F.source],F,O,P)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:k=>this.useProgram(k)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.b7.black:o.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(k,F){const O=k.context,H=O.gl,q=((se,ne,de)=>{const me=Math.cos(ne.rollInRadians),Te=Math.sin(ne.rollInRadians),Se=ce(ne),be=ne.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:[(ne.width/2-Se*Te)*de,(ne.height/2+Se*me)*de],u_horizon_normal:[-Te,me],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*ne.height/2*de,u_sky_blend:be}})(F,k.style.map.transform,k.pixelRatio),W=new pt(H.LEQUAL,pt.ReadWrite,[0,1]),K=Mt.disabled,ee=k.colorModeForRenderPass(),te=k.useProgram("sky"),re=bc(O,F);te.draw(O,H.TRIANGLES,W,K,ee,Ct.disabled,q,null,void 0,"sky",re.vertexBuffer,re.indexBuffer,re.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const k=this.style._layers[h[this.currentLayer]],F=f[k.source],O=_[k.source];this._renderTileClippingMasks(k,O,!1),this.renderLayer(this,F,k,O,P)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const k=this.style._layers[h[this.currentLayer]],F=f[k.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(k,P))continue;this.opaquePassEnabledForLayer()||E||(E=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(k.type==="symbol"?T:x)[k.source];this._renderTileClippingMasks(k,_[k.source],!1),this.renderLayer(this,F,k,O,P)}if(P.isRenderingGlobe&&function(k,F,O){const H=k.context,q=H.gl,W=k.useProgram("atmosphere"),K=new pt(q.LEQUAL,pt.ReadOnly,[0,1]),ee=k.transform,te=function(be,je){const Be=be.properties.get("position"),ke=[-Be.x,-Be.y,-Be.z],We=o.ad(new Float64Array(16));return be.properties.get("anchor")==="map"&&(o.a_(We,We,je.rollInRadians),o.a$(We,We,-je.pitchInRadians),o.a_(We,We,je.bearingInRadians),o.a$(We,We,je.center.lat*Math.PI/180),o.bp(We,We,-je.center.lng*Math.PI/180)),o.bX(ke,ke,We),ke}(O,k.transform),re=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=F.properties.get("atmosphere-blend")*re.projectionTransition;if(se===0)return;const ne=To(ee.worldSize,ee.center.lat),de=ee.inverseProjectionMatrix,me=new Float64Array(4);me[3]=1,o.at(me,me,ee.modelViewProjectionMatrix),me[0]/=me[3],me[1]/=me[3],me[2]/=me[3],me[3]=1,o.at(me,me,de),me[0]/=me[3],me[1]/=me[3],me[2]/=me[3],me[3]=1;const Te=((be,je,Be,ke,We)=>({u_sun_pos:be,u_atmosphere_blend:je,u_globe_position:Be,u_globe_radius:ke,u_inv_proj_matrix:We}))(te,se,[me[0],me[1],me[2]],ne,de),Se=bc(H,F);W.draw(H,q.TRIANGLES,K,Mt.disabled,zt.alphaBlended,Ct.disabled,Te,null,null,"atmosphere",Se.vertexBuffer,Se.indexBuffer,Se.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const k=function(F,O){let H=null;const q=Object.values(F._layers).flatMap(te=>te.source&&!te.isHidden(O)?[F.sourceCaches[te.source]]:[]),W=q.filter(te=>te.getSource().type==="vector"),K=q.filter(te=>te.getSource().type!=="vector"),ee=te=>{(!H||H.getSource().maxzoom<te.getSource().maxzoom)&&(H=te)};return W.forEach(te=>ee(te)),H||K.forEach(te=>ee(te)),H}(this.style,this.transform.zoom);k&&function(F,O,H){for(let q=0;q<H.length;q++)xc(F,O,H[q])}(this,k,k.getVisibleCoordinates())}this.options.showPadding&&function(k){const F=k.transform.padding;yc(k,k.transform.height-(F.top||0),3,gi),yc(k,F.bottom||0,3,ba),wa(k,F.left||0,3,Nr),wa(k,k.transform.width-(F.right||0),3,gc);const O=k.transform.centerPoint;(function(H,q,W,K){Jn(H,q-1,W-10,2,20,K),Jn(H,q-10,W-1,20,2,K)})(k,O.x,k.transform.height-O.y,_c)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=e?!o.b_(i,s):!o.b$(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c0(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,P=zt.unblended,E=new pt(x.LEQUAL,pt.ReadWrite,[0,1]),k=f.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1});for(const O of k){const H=f.getTerrainMesh(O.tileID),q=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};F.draw(_,x.TRIANGLES,E,Mt.disabled,P,Ct.backCCW,K,q,W,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,P=zt.unblended,E=new pt(x.LEQUAL,pt.ReadWrite,[0,1]),k=f.getCoordsTexture(),F=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const H of F){const q=f.getTerrainMesh(H.tileID),W=f.getTerrainData(H.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,k.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},ee=T.getProjectionData({overscaledTileID:H.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,E,Mt.disabled,P,Ct.backCCW,K,W,ee,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(H.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,s,l,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,o.c1(s)?function(f,_,x,T,P,E){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:k}=E,F=Mt.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,q,W,K,ee,te,re,se,ne){const de=q.transform,me=q.style.map.terrain,Te=ee==="map",Se=te==="map";for(const be of H){const je=K.getTile(be),Be=je.getBucket(W);if(!Be||!Be.text||!Be.text.segments.get().length)continue;const ke=o.ak(Be.textSizeData,de.zoom),We=o.az(je,1,q.transform.zoom),mt=nt(Te,q.transform,We),lt=W.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(ke){const ei=Math.pow(2,de.zoom-je.tileID.overscaledZ),Dt=me?(ti,Wt)=>me.getElevation(be,ti,Wt):null;Vo(Be,Te,Se,ne,de,mt,ei,ke,lt,o.aA(de,je,re,se),be.toUnwrapped(),Dt)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),P),x.paint.get("icon-opacity").constantOr(1)!==0&&$o(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),F,O,k),x.paint.get("text-opacity").constantOr(1)!==0&&$o(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),F,O,k),_.map.showCollisionBoxes&&(Os(f,_,x,T,!0),Os(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c2(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,k=x.paint.get("circle-opacity"),F=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),H=!x.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(F.constantOr(1)===0||O.constantOr(1)===0))return;const q=f.context,W=q.gl,K=f.transform,ee=f.getDepthModeForSublayer(0,pt.ReadOnly),te=Mt.disabled,re=f.colorModeForRenderPass(),se=[],ne=K.getCircleRadiusCorrection();for(let de=0;de<T.length;de++){const me=T[de],Te=_.getTile(me),Se=Te.getBucket(x);if(!Se)continue;const be=x.paint.get("circle-translate"),je=x.paint.get("circle-translate-anchor"),Be=o.aA(K,Te,be,je),ke=Se.programConfigurations.get(x.id),We=f.useProgram("circle",ke),mt=Se.layoutVertexBuffer,lt=Se.indexBuffer,ei=f.style.map.terrain&&f.style.map.terrain.getTerrainData(me),Dt={programConfiguration:ke,program:We,layoutVertexBuffer:mt,indexBuffer:lt,uniformValues:Bd(f,Te,x,Be,ne),terrainData:ei,projectionData:K.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(H){const ti=Se.segments.get();for(const Wt of ti)se.push({segments:new o.aJ([Wt]),sortKey:Wt.sortKey,state:Dt})}else se.push({segments:Se.segments,sortKey:0,state:Dt})}H&&se.sort((de,me)=>de.sortKey-me.sortKey);for(const de of se){const{programConfiguration:me,program:Te,layoutVertexBuffer:Se,indexBuffer:be,uniformValues:je,terrainData:Be,projectionData:ke}=de.state;Te.draw(q,W.TRIANGLES,ee,te,re,Ct.backCCW,je,Be,ke,x.id,Se,be,de.segments,x.paint,f.transform.zoom,me)}}(e,i,s,l,h):o.c3(s)?function(f,_,x,T,P){if(x.paint.get("heatmap-opacity")===0)return;const E=f.context,{isRenderingToTexture:k,isRenderingGlobe:F}=P;if(f.style.map.terrain){for(const O of T){const H=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?pc(f,H,x,O,F):f.renderPass==="translucent"&&Hd(f,x,O,k,F))}E.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,H,q,W){const K=O.context,ee=K.gl,te=O.transform,re=Mt.disabled,se=new zt([ee.ONE,ee.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(ne,de,me){const Te=ne.gl;ne.activeTexture.set(Te.TEXTURE1),ne.viewport.set([0,0,de.width/4,de.height/4]);let Se=me.heatmapFbos.get(o.bU);Se?(Te.bindTexture(Te.TEXTURE_2D,Se.colorAttachment.get()),ne.bindFramebuffer.set(Se.framebuffer)):(Se=fc(ne,de.width/4,de.height/4),me.heatmapFbos.set(o.bU,Se))})(K,O,q),K.clear({color:o.b7.transparent});for(let ne=0;ne<W.length;ne++){const de=W[ne];if(H.hasRenderableParent(de))continue;const me=H.getTile(de),Te=me.getBucket(q);if(!Te)continue;const Se=Te.programConfigurations.get(q.id),be=O.useProgram("heatmap",Se),je=te.getProjectionData({overscaledTileID:de,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=te.getCircleRadiusCorrection();be.draw(K,ee.TRIANGLES,pt.disabled,re,se,Ct.backCCW,Ql(me,te.zoom,q.paint.get("heatmap-intensity"),Be),null,je,q.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,q.paint,te.zoom,Se)}K.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,H){const q=O.context,W=q.gl;q.setColorMode(O.colorModeForRenderPass());const K=H.heatmapFbos.get(o.bU);K&&(q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(W.TEXTURE1),js(q,H).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,W.TRIANGLES,pt.disabled,Mt.disabled,O.colorModeForRenderPass(),Ct.disabled,ec(O,H,0,1),null,null,H.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,H.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.c4(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,k=x.paint.get("line-opacity"),F=x.paint.get("line-width");if(k.constantOr(1)===0||F.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,pt.ReadOnly),H=f.colorModeForRenderPass(),q=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),K=W.constantOr(1),ee=x.paint.get("line-gradient"),te=x.getCrossfadeParameters(),re=K?"linePattern":q?"lineSDF":ee?"lineGradient":"line",se=f.context,ne=se.gl,de=f.transform;let me=!0;for(const Te of T){const Se=_.getTile(Te);if(K&&!Se.patternsLoaded())continue;const be=Se.getBucket(x);if(!be)continue;const je=be.programConfigurations.get(x.id),Be=f.context.program.get(),ke=f.useProgram(re,je),We=me||ke.program!==Be,mt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Te),lt=W.constantOr(null);if(lt&&Se.imageAtlas){const jt=Se.imageAtlas,At=jt.patternPositions[lt.to.toString()],Ri=jt.patternPositions[lt.from.toString()];At&&Ri&&je.setConstantPatternPositions(At,Ri)}const ei=de.getProjectionData({overscaledTileID:Te,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Dt=de.getPixelScale(),ti=K?Fd(f,Se,x,Dt,te):q?ko(f,Se,x,Dt,q,te):ee?Ls(f,Se,x,Dt,be.lineClipsArray.length):Eo(f,Se,x,Dt);if(K)se.activeTexture.set(ne.TEXTURE0),Se.imageAtlasTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE),je.updatePaintBuffers(te);else if(q&&(We||f.lineAtlas.dirty))se.activeTexture.set(ne.TEXTURE0),f.lineAtlas.bind(se);else if(ee){const jt=be.gradients[x.id];let At=jt.texture;if(x.gradientVersion!==jt.version){let Ri=256;if(x.stepInterpolant){const Pi=_.getSource().maxzoom,$i=Te.canonical.z===Pi?Math.ceil(1<<f.transform.maxZoom-Te.canonical.z):1;Ri=o.ae(o.bV(be.maxLineLength/o.Z*1024*$i),256,se.maxTextureSize)}jt.gradient=o.bW({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:Ri,image:jt.gradient||void 0,clips:be.lineClipsArray}),jt.texture?jt.texture.update(jt.gradient):jt.texture=new Et(se,jt.gradient,ne.RGBA),jt.version=x.gradientVersion,At=jt.texture}se.activeTexture.set(ne.TEXTURE0),At.bind(x.stepInterpolant?ne.NEAREST:ne.LINEAR,ne.CLAMP_TO_EDGE)}let Wt;if(E){const[jt]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Wt=jt[Te.overscaledZ]}else Wt=f.stencilModeForClipping(Te);ke.draw(se,ne.TRIANGLES,O,Wt,H,Ct.disabled,ti,mt,ei,x.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,x.paint,f.transform.zoom,je,be.layoutVertexBuffer2),me=!1}}(e,i,s,l,h):o.c5(s)?function(f,_,x,T,P){const E=x.paint.get("fill-color"),k=x.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const{isRenderingToTexture:F}=P,O=f.colorModeForRenderPass(),H=x.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!H.constantOr(1)&&E.constantOr(o.b7.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?pt.ReadWrite:pt.ReadOnly);mc(f,_,x,T,W,O,!1,F)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,pt.ReadOnly);mc(f,_,x,T,W,O,!0,F)}}(e,i,s,l,h):o.c6(s)?function(f,_,x,T,P){const E=x.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:k}=P;if(f.renderPass==="translucent"){const F=new pt(f.context.gl.LEQUAL,pt.ReadWrite,f.depthRangeFor3D);if(E!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))qo(f,_,x,T,F,Mt.disabled,zt.disabled,k),qo(f,_,x,T,F,f.stencilModeFor3D(),f.colorModeForRenderPass(),k);else{const O=f.colorModeForRenderPass();qo(f,_,x,T,F,Mt.disabled,O,k)}}}(e,i,s,l,h):o.c7(s)?function(f,_,x,T,P){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,k=f.context,F=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,pt.ReadOnly),H=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,W,K,ee,te,re,se){const ne=q.context,de=ne.gl;for(const me of K){const Te=W.getTile(me),Se=Te.dem;if(!Se||!Se.data||!Te.needsHillshadePrepare)continue;const be=Se.dim,je=Se.stride,Be=Se.getPixels();if(ne.activeTexture.set(de.TEXTURE1),ne.pixelStoreUnpackPremultiplyAlpha.set(!1),Te.demTexture=Te.demTexture||q.getTileTexture(je),Te.demTexture){const We=Te.demTexture;We.update(Be,{premultiply:!1}),We.bind(de.NEAREST,de.CLAMP_TO_EDGE)}else Te.demTexture=new Et(ne,Be,de.RGBA,{premultiply:!1}),Te.demTexture.bind(de.NEAREST,de.CLAMP_TO_EDGE);ne.activeTexture.set(de.TEXTURE0);let ke=Te.fbo;if(!ke){const We=new Et(ne,{width:be,height:be,data:null},de.RGBA);We.bind(de.LINEAR,de.CLAMP_TO_EDGE),ke=Te.fbo=ne.createFramebuffer(be,be,!0,!1),ke.colorAttachment.set(We.texture)}ne.bindFramebuffer.set(ke.framebuffer),ne.viewport.set([0,0,be,be]),q.useProgram("hillshadePrepare").draw(ne,de.TRIANGLES,te,re,se,Ct.disabled,_a(Te.tileID,Se),null,null,ee.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),Te.needsHillshadePrepare=!1}})(f,_,T,x,O,Mt.disabled,H),k.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(F){const[q,W,K]=f.stencilConfigForOverlapTwoPass(T);ts(f,_,x,K,q,O,H,!1,E),ts(f,_,x,K,W,O,H,!0,E)}else{const[q,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ts(f,_,x,W,q,O,H,!1,E)}}(e,i,s,l,h):o.c8(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:E}=P,k=_.getSource(),F=f.style.projection.useSubdivision;if(k instanceof Ee)Ho(f,_,x,T,null,!1,!1,k.tileCoords,k.flippedWindingOrder,E);else if(F){const[O,H,q]=f.stencilConfigForOverlapTwoPass(T);Ho(f,_,x,q,O,!1,!0,Ns,!1,E),Ho(f,_,x,q,H,!0,!0,Ns,!1,E)}else{const[O,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Ho(f,_,x,H,O,!1,!0,Ns,!1,E)}}(e,i,s,l,h):o.c9(s)?function(f,_,x,T,P){const E=x.paint.get("background-color"),k=x.paint.get("background-opacity");if(k===0)return;const{isRenderingToTexture:F}=P,O=f.context,H=O.gl,q=f.style.projection,W=f.transform,K=W.tileSize,ee=x.paint.get("background-pattern");if(f.isPatternMissing(ee))return;const te=!ee&&E.a===1&&k===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==te)return;const re=Mt.disabled,se=f.getDepthModeForSublayer(0,te==="opaque"?pt.ReadWrite:pt.ReadOnly),ne=f.colorModeForRenderPass(),de=f.useProgram(ee?"backgroundPattern":"background"),me=T||ie(W,{tileSize:K,terrain:f.style.map.terrain});ee&&(O.activeTexture.set(H.TEXTURE0),f.imageManager.bind(f.context));const Te=x.getCrossfadeParameters();for(const Se of me){const be=W.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),je=ee?Cn(k,f,ee,{tileID:Se,tileSize:K},Te):Ao(k,E),Be=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Se),ke=q.getMeshFromTileID(O,Se.canonical,!1,!0,"raster");de.draw(O,H.TRIANGLES,se,re,ne,Ct.backCCW,je,Be,be,x.id,ke.vertexBuffer,ke.indexBuffer,ke.segments)}}(e,0,s,l,h):o.ca(s)&&function(f,_,x,T){const{isRenderingGlobe:P}=T,E=f.context,k=x.implementation,F=f.style.projection,O=f.transform,H=O.getProjectionDataForCustomLayer(P),q={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
728
728
  uniform mat4 u_projection_matrix;
729
- ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),K.call(k,E.gl,q),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(Mt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,pt.ReadOnly);E.setDepthMode(K),k.render(E.gl,q),E.setDirty(),f.setBaseState(),E.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?Qi:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Rs(this.context,gt[e],i,ic[e],this._showOverdrawInspector,l,s?gt.projectionMercator:h.shaderPreludeCode,s?yr: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 Et(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 wc(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class Tc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=wc(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let k=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===E?(k=!0,`${H}=${P}`):O}).filter(O=>O);return k||F.push(`${E}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const Wr={linearity:.3,easing:o.cb(0,0,.3,1)},ph=o.e({deceleration:2500,maxSpeed:1400},Wr),fh=o.e({deceleration:20,maxSpeed:1400},Wr),mh=o.e({deceleration:1e3,maxSpeed:360},Wr),gh=o.e({deceleration:1e3,maxSpeed:90},Wr),_h=o.e({deceleration:1e3,maxSpeed:360},Wr);class yh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ie.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ie.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Qn(i.pan.mag(),s,o.e({},ph,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,is(l,h)}if(i.zoom){const h=Qn(i.zoom,s,fh);l.zoom=this._map.transform.zoom+h.amount,is(l,h)}if(i.bearing){const h=Qn(i.bearing,s,mh);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),is(l,h)}if(i.pitch){const h=Qn(i.pitch,s,gh);l.pitch=this._map.transform.pitch+h.amount,is(l,h)}if(i.roll){const h=Qn(i.roll,s,_h);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),is(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function is(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Qn(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class vr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=oe.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class ur extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=oe.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,E)=>x.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Xr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class xh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Xr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new vr(e.type,this._map,e))}mouseup(e){this._map.fire(new vr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new vr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new vr(e.type,this._map,e))}mouseover(e){this._map.fire(new vr(e.type,this._map,e))}mouseout(e){this._map.fire(new vr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ur(e.type,this._map,e))}touchmove(e){this._map.fire(new ur(e.type,this._map,e))}touchend(e){this._map.fire(new ur(e.type,this._map,e))}touchcancel(e){this._map.fire(new ur(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class un{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new vr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new vr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hn{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class vh{constructor(e,i){this._map=e,this._tr=new hn(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&&(oe.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=oe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);oe.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),oe.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(oe.remove(this._box),this._box=null),oe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Mc(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 Wd{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=Mc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Mc(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class Sc{constructor(e){this.singleTap=new Wd(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class bh{constructor(e){this._tr=new hn(e),this._zoomIn=new Sc({numTouches:1,numTaps:2}),this._zoomOut=new Sc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class In{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&oe.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 En={0:1,2:2};class $e{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=oe.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=En[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return oe.mouseButton(e)===this._eventButton}}class wh{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 Pc{constructor(e=new $e({checkCorrectEvent:()=>!0}),i=new wh){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 Zs=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Vs{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=Mc(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],E=this._touches[T];E&&(h._add(P),f._add(P.sub(E)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const 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 Ta{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=Us(s,i,l),_=Us(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Us(s,i,l),_=Us(s,i,h);f&&_||(this._active&&oe.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 Us(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function xt(u,e){return Math.log(u/e)/Math.LN2}class Wo extends Ta{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(xt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:xt(this._distance,s),pinchAround:i}}}function Th(u,e){return 180*u.angleWith(e)/Math.PI}class Xo extends Ta{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Th(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Th(e,this._startVector);return Math.abs(s)<i}}function Cc(u){return Math.abs(u.y)>Math.abs(u.x)}class Mh extends Ta{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,Cc(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return Cc(e)&&Cc(i)&&f}}const Sh={panStep:100,bearingStep:15,pitchStep:10};class Ko{constructor(e){this._tr=new hn(e);const i=Sh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ph,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ph(u){return u*(2-u)}const Ch=4.000244140625;class Ic{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new hn(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=Ie.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Ch==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=oe.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ch?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ah(T*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,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ie.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cd;if(this._prevEase){const s=this._prevEase,l=(Ie.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cb(f,_,.25,1)}return this._prevEase={start:Ie.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 Ih{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 Xd{constructor(e){this._tr=new hn(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 ea{constructor(){this._tap=new Sc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ht{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 $s{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Yo{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ec{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=oe.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(oe.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Gs=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Eh extends o.l{}function kc(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class dn{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:k,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,k))F.reset();else if(F[h||l.type]){if(o.ce(l,h||l.type)){const q=oe.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.cf(l,h||l.type)){const q=this._getMapTouches(l.touches),W=oe.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.cg(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,k,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[k]=F)}const P={};for(const k in this._previousActiveHandlers)T[k]||(P[k]=f);this._previousActiveHandlers=T,(Object.keys(P).length||kc(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||kc(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new yh(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)oe.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)oe.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new xh(i,e));const l=i.boxZoom=new vh(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new Ec(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new bh(i),_=new Xd(i);i.doubleClickZoom=new Ih(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new ea;this._add("tapDragZoom",x);const T=i.touchPitch=new Mh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),E=function({enable:te,clickTolerance:re,aroundCenter:se=!0,minPixelCenterThreshold:ne=100,rotateDegreesPerPixelMoved:de=.8},me){const Te=new $e({checkCorrectEvent:Se=>oe.mouseButton(Se)===0&&Se.ctrlKey||oe.mouseButton(Se)===2&&!Se.ctrlKey});return new In({clickTolerance:re,move:(Se,be)=>{const je=me();if(se&&Math.abs(je.y-Se.y)>ne)return{bearingDelta:o.cc(new o.P(Se.x,be.y),be,je)};let Be=(be.x-Se.x)*de;return se&&be.y<je.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Te,enable:te,assignEvents:Zs})}(e,P),k=function({enable:te,clickTolerance:re,pitchDegreesPerPixelMoved:se=-.5}){const ne=new $e({checkCorrectEvent:de=>oe.mouseButton(de)===0&&de.ctrlKey||oe.mouseButton(de)===2});return new In({clickTolerance:re,move:(de,me)=>({pitchDelta:(me.y-de.y)*se}),moveStateManager:ne,enable:te,assignEvents:Zs})}(e),F=function({enable:te,clickTolerance:re,rollDegreesPerPixelMoved:se=.3},ne){const de=new $e({checkCorrectEvent:me=>oe.mouseButton(me)===2&&me.ctrlKey});return new In({clickTolerance:re,move:(me,Te)=>{const Se=ne();let be=(Te.x-me.x)*se;return Te.y<Se.y&&(be=-be),{rollDelta:be}},moveStateManager:de,enable:te,assignEvents:Zs})}(e,P);i.dragRotate=new $s(e,E,k,F),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:te,clickTolerance:re}){const se=new $e({checkCorrectEvent:ne=>oe.mouseButton(ne)===0&&!ne.ctrlKey});return new In({clickTolerance:re,move:(ne,de)=>({around:de,panDelta:de.sub(ne)}),activateOnStart:!0,moveStateManager:se,enable:te,assignEvents:Zs})}(e),H=new Vs(e,i);i.dragPan=new Ht(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new Xo,W=new Wo;i.touchZoomRotate=new Yo(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new Ic(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new Ko(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new un(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!!Gs(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(kc(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:E,around:k,pinchAround:F}=e;F!==void 0&&(k=F),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:E,pitchDelta:P,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const H=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?k.sub(_):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Gs(this._eventsInProgress),h=Gs(e),f={};for(const E in e){const{originalEvent:k}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=k),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:k}=e[E];this._fireEvent(E,k)}const _={};let x;for(const E in this._eventsInProgress){const{handlerName:k,originalEvent:F}=this._eventsInProgress[E];this._handlersById[k].isActive()||(delete this._eventsInProgress[E],x=i[k]||F,_[`${E}end`]=x)}for(const E in _)this._fireEvent(E,_[E]);const T=Gs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&Ie.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),k(this._map.getBearing())&&this._map.resetNorth()):(k(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Eh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Jo extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ie.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Nt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Nt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,x),k=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:k,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cd},e)).animate===!1||!e.essential&&Ie.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let k,F;e.around&&(k=o.Q.convert(e.around),F=s.locationToScreenPoint(k));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:k,aroundPoint:F,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ie.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cd},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let F=s.centerPoint.add(k);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:E,locationAtOffset:O,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,ee=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/ee*2));const te=q*q;function re(be){const je=(K*K-W*W+(be?-1:1)*te*te*ee*ee)/(2*(be?K:W)*te*ee);return Math.log(Math.sqrt(je*je+1)-je)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function ne(be){return(Math.exp(be)+Math.exp(-be))/2}const de=re(!1);let me=function(be){return ne(de)/ne(de+q*be)},Te=function(be){return W*((ne(de)*(se(je=de+q*be)/ne(je))-se(de))/te)/ee;var je},Se=(re(!0)-de)/q;if(Math.abs(ee)<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))/q,Te=()=>0,me=je=>Math.exp(be*q*je)}return e.duration="duration"in e?+e.duration:1e3*Se/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const je=be*Se,Be=1/me(je),ke=Te(je);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,E,be),F=s.centerPoint.add(k)),H.easeFunc(be,Be,ke,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ie.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const Ye={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class at{constructor(e=Ye){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=oe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=oe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=oe.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(){oe.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=oe.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class qs{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=oe.create("div","maplibregl-ctrl");const i=oe.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(){oe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class zc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ac=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class br extends o.E{constructor(e){super(),this._lastTilesetChange=Ie.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of ie(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new da(l,this.tileSize),this._lastTilesetChange=Ie.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),E=e.canonical.x-(h.canonical.x>>x),k=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+E*o.Z,-P*F+k*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),E=(e.canonical.x>>x)-h.canonical.x,k=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+E*F,P*o.Z+k*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class kh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new br(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.ch([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),E=Math.floor(T[1]),k=T[0]-P,F=T[1]-E;return _.get(P,E)*(1-k)*(1-F)+_.get(P+1,E)*k*(1-F)+_.get(P,E+1)*(1-k)*F+_.get(P+1,E+1)*k*F}getElevationForLngLatZoom(e,i){if(!o.ci(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Et(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Et(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new Et(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cj(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Et(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Et(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new Et(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const k=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*k;return new o.$((E.tileID.canonical.x*k+x)/F+E.tileID.wrap,(E.tileID.canonical.y*k+T)/F,this.getElevation(E.tileID,x,T,k))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.ck,T=new o.aK,P=this.meshSize,E=o.Z/P,k=P*P;for(let ne=0;ne<=P;ne++)for(let de=0;de<=P;de++)x.emplaceBack(de*E,ne*E,0);for(let ne=0;ne<k;ne+=P+1)for(let de=0;de<P;de++)T.emplaceBack(de+ne,P+de+ne+1,P+de+ne+2),T.emplaceBack(de+ne,P+de+ne+2,de+ne+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let ne=0;ne<=P;ne++)x.emplaceBack(ne*E,q,W);for(let ne=0;ne<=P;ne++)x.emplaceBack(ne*E,K,ee);for(let ne=0;ne<P;ne++)T.emplaceBack(H+ne,O+ne,O+ne+1),T.emplaceBack(H+ne,O+ne+1,H+ne+1),T.emplaceBack(0+ne,F+ne+1,F+ne),T.emplaceBack(0+ne,0+ne+1,F+ne+1);const te=x.length,re=te+2*(P+1);for(const ne of[0,1])for(let de=0;de<=P;de++)for(const me of[0,1])x.emplaceBack(ne*o.Z,de*E,me);for(let ne=0;ne<2*P;ne+=2)T.emplaceBack(te+ne,te+ne+1,te+ne+3),T.emplaceBack(te+ne,te+ne+3,te+ne+2),T.emplaceBack(re+ne,re+ne+3,re+ne+1),T.emplaceBack(re+ne,re+ne+2,re+ne+3);const se=new $a(_.createVertexBuffer(x,Ac.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class pn{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 Et(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 rs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hs{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new pn(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof Ee?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(rs[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(rs[l]&&(this._prevType&&rs[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(rs[this._prevType]||rs[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(vc(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<x.length;E++){const k=h.style._layers[x[E]],F=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(k,F,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,F,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return vc(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),rs[l]}return!1}}const ui={"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"},vi=he,Rc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ye,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Ws={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Qo{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,oe.mousePos(this.element,h)),oe.addEventListener(window,"mousemove",this.mousemove),oe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,oe.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=oe.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),oe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=oe.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new Pc;this._rotatePitchHanlder=new In({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cc(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,oe.addEventListener(i,"mousedown",this.mousedown),oe.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),oe.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),oe.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;oe.removeEventListener(e,"mousedown",this.mousedown),oe.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend),oe.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){oe.enableDrag(),oe.removeEventListener(window,"mousemove",this.mousemove),oe.removeEventListener(window,"mouseup",this.mouseup),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend)}}let kn;function el(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const Xs={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 ns(u,e,i){const s=u.classList;for(const l in Xs)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ks extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=el(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),oe.setTransform(this._element,`${Xs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ie.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=oe.create("div");const i=oe.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=oe.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=oe.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=oe.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=oe.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=oe.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=oe.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const E=oe.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const k=oe.createNS("http://www.w3.org/2000/svg","path");k.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),E.appendChild(k);const F=oe.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=oe.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=oe.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=oe.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),ns(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),oe.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const E=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==E&&(this._element.style.opacity=E))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/l.transform.pixelsPerMeter,x=Math.sin(l.getPitch()*Math.PI/180)*_,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),P=l.transform.lngLatToCameraDepth(this._lngLat,f+x)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const Dc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let as=0,Ma=!1;const Lc={maxWidth:100,unit:"metric"};function tl(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*P;E>5280?Sa(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Sa(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Sa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Sa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Sa(e,T,P,u._getUIString("ScaleControl.Meters"))}function Sa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Bc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},il=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function rl(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return rl(new o.P(0,0))}const Fc=he;S.AJAXError=o.co,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cp,S.config=o.a,S.removeProtocol=o.cq,S.AttributionControl=at,S.BoxZoomHandler=vh,S.CanvasSource=Ue,S.CooperativeGesturesHandler=Ec,S.DoubleClickZoomHandler=Ih,S.DragPanHandler=Ht,S.DragRotateHandler=$s,S.EdgeInsets=Ts,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){oe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=oe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);oe.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=Tn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Nt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Ma)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=oe.create("button","maplibregl-ctrl-geolocate",this._container),oe.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=oe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ks({element:this._dotElement}),this._circleElement=oe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ks({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},Dc,u)}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(kn!==void 0&&!e)return kn;if(window.navigator.permissions===void 0)return kn=!!window.navigator.geolocation,kn;try{kn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{kn=!!window.navigator.geolocation}return kn})}().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(),oe.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,as=0,Ma=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":as--,Ma=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),as++,as>1?(u={maximumAge:6e5,timeout:0},Ma=!0):(u=this.options.positionOptions,Ma=!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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=oe.create("button","maplibregl-ctrl-globe",this._container),oe.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(){oe.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=Tc,S.ImageSource=Ee,S.KeyboardHandler=Ko,S.LngLatBounds=Nt,S.LogoControl=qs,S.Map=class extends Jo{constructor(u){var e,i;o.cl.mark(o.cm.create);const s=Object.assign(Object.assign(Object.assign({},Rc),u),{canvasContextAttributes:Object.assign(Object.assign({},Rc.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new ln,h=new Ps;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new zc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ui),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=ni.addThrottleControl(()=>this.isMoving()),this._requestManager=new Zt(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=wc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new dn(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,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new at(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new qs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Nt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new vr(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 vr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new vr(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new As(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new As(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new kh(this.painter,e,u),this.painter.renderToTexture=new Hs(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=V(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=V(Math.max(1,u),Math.max(1,e));return this._update(!0),this}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:E,data:k}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:E},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:E,data:k}=Ie.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:E},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ie.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return ni.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=oe.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=oe.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=oe.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=oe.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new dh(i,this.transform),Ve.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,k=Ie.now();this.style.zoomHistory.update(E,k);const F=new o.C(E,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cl.mark(o.cm.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cl.mark(o.cm.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ni.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),oe.remove(this._canvasContainer),oe.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cl.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ie.frame(this._frameRequest,u=>{o.cl.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cn(e)&&!function(i){return i.message===cc}(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 vi}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=vr,S.MapTouchEvent=ur,S.MapWheelEvent=Xr,S.Marker=Ks,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},Ws,u),this._container=oe.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})),oe.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})),oe.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=oe.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 Qo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){oe.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=oe.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&oe.remove(this._content),this._container&&(oe.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=oe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=oe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=el(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=rl(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),oe.setTransform(this._container,`${Xs[s]} translate(${h.x}px,${h.y}px)`),ns(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Bc),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=oe.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=oe.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(il);u&&u.focus()}},S.RasterDEMTileSource=wn,S.RasterTileSource=fr,S.ScaleControl=class{constructor(u){this._onMove=()=>{tl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,tl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Lc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){oe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Ic,S.Style=As,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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe.create("button","maplibregl-ctrl-terrain",this._container),oe.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(){oe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Mh,S.TwoFingersTouchRotateHandler=Xo,S.TwoFingersTouchZoomHandler=Wo,S.TwoFingersTouchZoomRotateHandler=Yo,S.VectorTileSource=an,S.VideoSource=Je,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Gt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{ft[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=Zi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Cr),Zi=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=bo,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return gr().getRTLTextPluginStatus()},S.getVersion=function(){return Fc},S.getWorkerCount=function(){return ki.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return bn().broadcast("IS",u)},S.prewarm=function(){Ki().acquire(Cr)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return gr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){ki.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var L=b;return L})}(Iu)),Iu.exports}var J_=Y_();const vd=X_(J_);class Rf{constructor(g,b,I,A,L){$t(this,"bounds1");$t(this,"bounds2");$t(this,"getBounds",(g,b,I,A)=>new vd.LngLatBounds([g,b],[I,A]));$t(this,"contains",(g,b)=>this.bounds1.contains([b,g])||this.bounds2.contains([b,g]));const S=g.unproject([b,I]),o=g.unproject([A,L]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const Q_={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}}]},ey={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 kt;(function(v){v.assertEqual=A=>A;function g(A){}v.assertIs=g;function b(A){throw new Error}v.assertNever=b,v.arrayToEnum=A=>{const L={};for(const S of A)L[S]=S;return L},v.getValidEnumValues=A=>{const L=v.objectKeys(A).filter(o=>typeof A[A[o]]!="number"),S={};for(const o of L)S[o]=A[o];return v.objectValues(S)},v.objectValues=A=>v.objectKeys(A).map(function(L){return A[L]}),v.objectKeys=typeof Object.keys=="function"?A=>Object.keys(A):A=>{const L=[];for(const S in A)Object.prototype.hasOwnProperty.call(A,S)&&L.push(S);return L},v.find=(A,L)=>{for(const S of A)if(L(S))return S},v.isInteger=typeof Number.isInteger=="function"?A=>Number.isInteger(A):A=>typeof A=="number"&&isFinite(A)&&Math.floor(A)===A;function I(A,L=" | "){return A.map(S=>typeof S=="string"?`'${S}'`:S).join(L)}v.joinValues=I,v.jsonStringifyReplacer=(A,L)=>typeof L=="bigint"?L.toString():L})(kt||(kt={}));var bd;(function(v){v.mergeShapes=(g,b)=>({...g,...b})})(bd||(bd={}));const Ke=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oa=v=>{switch(typeof v){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(v)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(v)?Ke.array:v===null?Ke.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Ke.promise:typeof Map<"u"&&v instanceof Map?Ke.map:typeof Set<"u"&&v instanceof Set?Ke.set:typeof Date<"u"&&v instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Oe=kt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ty=v=>JSON.stringify(v,null,2).replace(/"([^"]+)":/g,"$1:");class $r extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=g}format(g){const b=g||function(L){return L.message},I={_errors:[]},A=L=>{for(const S of L.issues)if(S.code==="invalid_union")S.unionErrors.map(A);else if(S.code==="invalid_return_type")A(S.returnTypeError);else if(S.code==="invalid_arguments")A(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,he=0;for(;he<S.path.length;){const pe=S.path[he];he===S.path.length-1?(o[pe]=o[pe]||{_errors:[]},o[pe]._errors.push(b(S))):o[pe]=o[pe]||{_errors:[]},o=o[pe],he++}}};return A(this),I}static assert(g){if(!(g instanceof $r))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,kt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=b=>b.message){const b={},I=[];for(const A of this.issues)A.path.length>0?(b[A.path[0]]=b[A.path[0]]||[],b[A.path[0]].push(g(A))):I.push(g(A));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}$r.create=v=>new $r(v);const oo=(v,g)=>{let b;switch(v.code){case Oe.invalid_type:v.received===Ke.undefined?b="Required":b=`Expected ${v.expected}, received ${v.received}`;break;case Oe.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(v.expected,kt.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:b=`Unrecognized key(s) in object: ${kt.joinValues(v.keys,", ")}`;break;case Oe.invalid_union:b="Invalid input";break;case Oe.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${kt.joinValues(v.options)}`;break;case Oe.invalid_enum_value:b=`Invalid enum value. Expected ${kt.joinValues(v.options)}, received '${v.received}'`;break;case Oe.invalid_arguments:b="Invalid function arguments";break;case Oe.invalid_return_type:b="Invalid function return type";break;case Oe.invalid_date:b="Invalid date";break;case Oe.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(b=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?b=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?b=`Invalid input: must end with "${v.validation.endsWith}"`:kt.assertNever(v.validation):v.validation!=="regex"?b=`Invalid ${v.validation}`:b="Invalid";break;case Oe.too_small:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:b="Invalid input";break;case Oe.too_big:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?b=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:b="Invalid input";break;case Oe.custom:b="Invalid input";break;case Oe.invalid_intersection_types:b="Intersection results could not be merged";break;case Oe.not_multiple_of:b=`Number must be a multiple of ${v.multipleOf}`;break;case Oe.not_finite:b="Number must be finite";break;default:b=g.defaultError,kt.assertNever(v)}return{message:b}};let Df=oo;function iy(v){Df=v}function Eu(){return Df}const ku=v=>{const{data:g,path:b,errorMaps:I,issueData:A}=v,L=[...b,...A.path||[]],S={...A,path:L};if(A.message!==void 0)return{...A,path:L,message:A.message};let o="";const he=I.filter(pe=>!!pe).slice().reverse();for(const pe of he)o=pe(S,{data:g,defaultError:o}).message;return{...A,path:L,message:o}},ry=[];function He(v,g){const b=Eu(),I=ku({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,b,b===oo?void 0:oo].filter(A=>!!A)});v.common.issues.push(I)}class pr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,b){const I=[];for(const A of b){if(A.status==="aborted")return ht;A.status==="dirty"&&g.dirty(),I.push(A.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,b){const I=[];for(const A of b){const L=await A.key,S=await A.value;I.push({key:L,value:S})}return pr.mergeObjectSync(g,I)}static mergeObjectSync(g,b){const I={};for(const A of b){const{key:L,value:S}=A;if(L.status==="aborted"||S.status==="aborted")return ht;L.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),L.value!=="__proto__"&&(typeof S.value<"u"||A.alwaysSet)&&(I[L.value]=S.value)}return{status:g.value,value:I}}}const ht=Object.freeze({status:"aborted"}),lo=v=>({status:"dirty",value:v}),Sr=v=>({status:"valid",value:v}),wd=v=>v.status==="aborted",Td=v=>v.status==="dirty",gs=v=>v.status==="valid",wl=v=>typeof Promise<"u"&&v instanceof Promise;function zu(v,g,b,I){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(v)}function Lf(v,g,b,I,A){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(v,b),b}typeof SuppressedError=="function"&&SuppressedError;var rt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(rt||(rt={}));var Tl,Ml;class Un{constructor(g,b,I,A){this._cachedPath=[],this.parent=g,this.data=b,this._path=I,this._key=A}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 Bf=(v,g)=>{if(gs(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new $r(v.common.issues);return this._error=b,this._error}}};function yt(v){if(!v)return{};const{errorMap:g,invalid_type_error:b,required_error:I,description:A}=v;if(g&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:A}:{errorMap:(S,o)=>{var he,pe;const{message:Ce}=v;return S.code==="invalid_enum_value"?{message:Ce??o.defaultError}:typeof o.data>"u"?{message:(he=Ce??I)!==null&&he!==void 0?he:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(pe=Ce??b)!==null&&pe!==void 0?pe:o.defaultError}},description:A}}class bt{get description(){return this._def.description}_getType(g){return oa(g.data)}_getOrReturnCtx(g,b){return b||{common:g.parent.common,data:g.data,parsedType:oa(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new pr,ctx:{common:g.parent.common,data:g.data,parsedType:oa(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const b=this._parse(g);if(wl(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(g){const b=this._parse(g);return Promise.resolve(b)}parse(g,b){const I=this.safeParse(g,b);if(I.success)return I.data;throw I.error}safeParse(g,b){var I;const A={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:oa(g)},L=this._parseSync({data:g,path:A.path,parent:A});return Bf(A,L)}"~validate"(g){var b,I;const A={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:oa(g)};if(!this["~standard"].async)try{const L=this._parseSync({data:g,path:[],parent:A});return gs(L)?{value:L.value}:{issues:A.common.issues}}catch(L){!((I=(b=L==null?void 0:L.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),A.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:A}).then(L=>gs(L)?{value:L.value}:{issues:A.common.issues})}async parseAsync(g,b){const I=await this.safeParseAsync(g,b);if(I.success)return I.data;throw I.error}async safeParseAsync(g,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:oa(g)},A=this._parse({data:g,path:I.path,parent:I}),L=await(wl(A)?A:Promise.resolve(A));return Bf(I,L)}refine(g,b){const I=A=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(A):b;return this._refinement((A,L)=>{const S=g(A),o=()=>L.addIssue({code:Oe.custom,...I(A)});return typeof Promise<"u"&&S instanceof Promise?S.then(he=>he?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,b){return this._refinement((I,A)=>g(I)?!0:(A.addIssue(typeof b=="function"?b(I,A):b),!1))}_refinement(g){return new xn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:b=>this["~validate"](b)}}optional(){return Gn.create(this,this._def)}nullable(){return Oa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yn.create(this)}promise(){return po.create(this,this._def)}or(g){return Il.create([this,g],this._def)}and(g){return El.create(this,g,this._def)}transform(g){return new xn({...yt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const b=typeof g=="function"?g:()=>g;return new Dl({...yt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Pd({typeName:ut.ZodBranded,type:this,...yt(this._def)})}catch(g){const b=typeof g=="function"?g:()=>g;return new Ll({...yt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(g){const b=this.constructor;return new b({...this._def,description:g})}pipe(g){return Bl.create(this,g)}readonly(){return Fl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ny=/^c[^\s-]{8,}$/i,ay=/^[0-9a-z]+$/,sy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ly=/^[a-z0-9_-]{21}$/i,cy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uy=/^[-+]?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)?)??$/,hy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Md;const py=/^(?:(?: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])$/,fy=/^(?:(?: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])$/,my=/^(([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]))$/,gy=/^(([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])$/,_y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ff="((\\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])))",xy=new RegExp(`^${Ff}$`);function Of(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const b=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${b}`}function vy(v){return new RegExp(`^${Of(v)}$`)}function jf(v){let g=`${Ff}T${Of(v)}`;const b=[];return b.push(v.local?"Z?":"Z"),v.offset&&b.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${b.join("|")})`,new RegExp(`^${g}$`)}function by(v,g){return!!((g==="v4"||!g)&&py.test(v)||(g==="v6"||!g)&&my.test(v))}function wy(v,g){if(!cy.test(v))return!1;try{const[b]=v.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),A=JSON.parse(atob(I));return!(typeof A!="object"||A===null||!A.typ||!A.alg||g&&A.alg!==g)}catch{return!1}}function Ty(v,g){return!!((g==="v4"||!g)&&fy.test(v)||(g==="v6"||!g)&&gy.test(v))}class _n extends bt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ke.string){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_type,expected:Ke.string,received:L.parsedType}),ht}const I=new pr;let A;for(const L of this._def.checks)if(L.kind==="min")g.data.length<L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_small,minimum:L.value,type:"string",inclusive:!0,exact:!1,message:L.message}),I.dirty());else if(L.kind==="max")g.data.length>L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_big,maximum:L.value,type:"string",inclusive:!0,exact:!1,message:L.message}),I.dirty());else if(L.kind==="length"){const S=g.data.length>L.value,o=g.data.length<L.value;(S||o)&&(A=this._getOrReturnCtx(g,A),S?He(A,{code:Oe.too_big,maximum:L.value,type:"string",inclusive:!0,exact:!0,message:L.message}):o&&He(A,{code:Oe.too_small,minimum:L.value,type:"string",inclusive:!0,exact:!0,message:L.message}),I.dirty())}else if(L.kind==="email")hy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"email",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="emoji")Md||(Md=new RegExp(dy,"u")),Md.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"emoji",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="uuid")oy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"uuid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="nanoid")ly.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"nanoid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="cuid")ny.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"cuid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="cuid2")ay.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"cuid2",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="ulid")sy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"ulid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="url")try{new URL(g.data)}catch{A=this._getOrReturnCtx(g,A),He(A,{validation:"url",code:Oe.invalid_string,message:L.message}),I.dirty()}else L.kind==="regex"?(L.regex.lastIndex=0,L.regex.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"regex",code:Oe.invalid_string,message:L.message}),I.dirty())):L.kind==="trim"?g.data=g.data.trim():L.kind==="includes"?g.data.includes(L.value,L.position)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:{includes:L.value,position:L.position},message:L.message}),I.dirty()):L.kind==="toLowerCase"?g.data=g.data.toLowerCase():L.kind==="toUpperCase"?g.data=g.data.toUpperCase():L.kind==="startsWith"?g.data.startsWith(L.value)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:{startsWith:L.value},message:L.message}),I.dirty()):L.kind==="endsWith"?g.data.endsWith(L.value)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:{endsWith:L.value},message:L.message}),I.dirty()):L.kind==="datetime"?jf(L).test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:"datetime",message:L.message}),I.dirty()):L.kind==="date"?xy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:"date",message:L.message}),I.dirty()):L.kind==="time"?vy(L).test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:"time",message:L.message}),I.dirty()):L.kind==="duration"?uy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"duration",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="ip"?by(g.data,L.version)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"ip",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="jwt"?wy(g.data,L.alg)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"jwt",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="cidr"?Ty(g.data,L.version)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"cidr",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="base64"?_y.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"base64",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="base64url"?yy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"base64url",code:Oe.invalid_string,message:L.message}),I.dirty()):kt.assertNever(L);return{status:I.value,value:g.data}}_regex(g,b,I){return this.refinement(A=>g.test(A),{validation:b,code:Oe.invalid_string,...rt.errToObj(I)})}_addCheck(g){return new _n({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...rt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...rt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...rt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...rt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...rt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...rt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...rt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...rt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...rt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...rt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...rt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...rt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...rt.errToObj(g)})}datetime(g){var b,I;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:(b=g==null?void 0:g.offset)!==null&&b!==void 0?b:!1,local:(I=g==null?void 0:g.local)!==null&&I!==void 0?I:!1,...rt.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,...rt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...rt.errToObj(g)})}regex(g,b){return this._addCheck({kind:"regex",regex:g,...rt.errToObj(b)})}includes(g,b){return this._addCheck({kind:"includes",value:g,position:b==null?void 0:b.position,...rt.errToObj(b==null?void 0:b.message)})}startsWith(g,b){return this._addCheck({kind:"startsWith",value:g,...rt.errToObj(b)})}endsWith(g,b){return this._addCheck({kind:"endsWith",value:g,...rt.errToObj(b)})}min(g,b){return this._addCheck({kind:"min",value:g,...rt.errToObj(b)})}max(g,b){return this._addCheck({kind:"max",value:g,...rt.errToObj(b)})}length(g,b){return this._addCheck({kind:"length",value:g,...rt.errToObj(b)})}nonempty(g){return this.min(1,rt.errToObj(g))}trim(){return new _n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new _n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new _n({...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 b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxLength(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}_n.create=v=>{var g;return new _n({checks:[],typeName:ut.ZodString,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};function My(v,g){const b=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,A=b>I?b:I,L=parseInt(v.toFixed(A).replace(".","")),S=parseInt(g.toFixed(A).replace(".",""));return L%S/Math.pow(10,A)}class La extends bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ke.number){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_type,expected:Ke.number,received:L.parsedType}),ht}let I;const A=new pr;for(const L of this._def.checks)L.kind==="int"?kt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.invalid_type,expected:"integer",received:"float",message:L.message}),A.dirty()):L.kind==="min"?(L.inclusive?g.data<L.value:g.data<=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_small,minimum:L.value,type:"number",inclusive:L.inclusive,exact:!1,message:L.message}),A.dirty()):L.kind==="max"?(L.inclusive?g.data>L.value:g.data>=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_big,maximum:L.value,type:"number",inclusive:L.inclusive,exact:!1,message:L.message}),A.dirty()):L.kind==="multipleOf"?My(g.data,L.value)!==0&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.not_multiple_of,multipleOf:L.value,message:L.message}),A.dirty()):L.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.not_finite,message:L.message}),A.dirty()):kt.assertNever(L);return{status:A.value,value:g.data}}gte(g,b){return this.setLimit("min",g,!0,rt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,rt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,rt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,rt.toString(b))}setLimit(g,b,I,A){return new La({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:rt.toString(A)}]})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:rt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:rt.toString(b)})}finite(g){return this._addCheck({kind:"finite",message:rt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(g)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&kt.isInteger(g.value))}get isFinite(){let g=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(b)&&Number.isFinite(g)}}La.create=v=>new La({checks:[],typeName:ut.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class Ba extends bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ke.bigint)return this._getInvalidInput(g);let I;const A=new pr;for(const L of this._def.checks)L.kind==="min"?(L.inclusive?g.data<L.value:g.data<=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_small,type:"bigint",minimum:L.value,inclusive:L.inclusive,message:L.message}),A.dirty()):L.kind==="max"?(L.inclusive?g.data>L.value:g.data>=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_big,type:"bigint",maximum:L.value,inclusive:L.inclusive,message:L.message}),A.dirty()):L.kind==="multipleOf"?g.data%L.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.not_multiple_of,multipleOf:L.value,message:L.message}),A.dirty()):kt.assertNever(L);return{status:A.value,value:g.data}}_getInvalidInput(g){const b=this._getOrReturnCtx(g);return He(b,{code:Oe.invalid_type,expected:Ke.bigint,received:b.parsedType}),ht}gte(g,b){return this.setLimit("min",g,!0,rt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,rt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,rt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,rt.toString(b))}setLimit(g,b,I,A){return new Ba({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:rt.toString(A)}]})}_addCheck(g){return new Ba({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:rt.toString(b)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}Ba.create=v=>{var g;return new Ba({checks:[],typeName:ut.ZodBigInt,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};class Sl extends bt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ke.boolean){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.boolean,received:I.parsedType}),ht}return Sr(g.data)}}Sl.create=v=>new Sl({typeName:ut.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class _s extends bt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ke.date){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_type,expected:Ke.date,received:L.parsedType}),ht}if(isNaN(g.data.getTime())){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_date}),ht}const I=new pr;let A;for(const L of this._def.checks)L.kind==="min"?g.data.getTime()<L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_small,message:L.message,inclusive:!0,exact:!1,minimum:L.value,type:"date"}),I.dirty()):L.kind==="max"?g.data.getTime()>L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_big,message:L.message,inclusive:!0,exact:!1,maximum:L.value,type:"date"}),I.dirty()):kt.assertNever(L);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new _s({...this._def,checks:[...this._def.checks,g]})}min(g,b){return this._addCheck({kind:"min",value:g.getTime(),message:rt.toString(b)})}max(g,b){return this._addCheck({kind:"max",value:g.getTime(),message:rt.toString(b)})}get minDate(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g!=null?new Date(g):null}}_s.create=v=>new _s({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ut.ZodDate,...yt(v)});class Au extends bt{_parse(g){if(this._getType(g)!==Ke.symbol){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.symbol,received:I.parsedType}),ht}return Sr(g.data)}}Au.create=v=>new Au({typeName:ut.ZodSymbol,...yt(v)});class Pl extends bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.undefined,received:I.parsedType}),ht}return Sr(g.data)}}Pl.create=v=>new Pl({typeName:ut.ZodUndefined,...yt(v)});class Cl extends bt{_parse(g){if(this._getType(g)!==Ke.null){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.null,received:I.parsedType}),ht}return Sr(g.data)}}Cl.create=v=>new Cl({typeName:ut.ZodNull,...yt(v)});class co extends bt{constructor(){super(...arguments),this._any=!0}_parse(g){return Sr(g.data)}}co.create=v=>new co({typeName:ut.ZodAny,...yt(v)});class ys extends bt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Sr(g.data)}}ys.create=v=>new ys({typeName:ut.ZodUnknown,...yt(v)});class la extends bt{_parse(g){const b=this._getOrReturnCtx(g);return He(b,{code:Oe.invalid_type,expected:Ke.never,received:b.parsedType}),ht}}la.create=v=>new la({typeName:ut.ZodNever,...yt(v)});class Ru extends bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.void,received:I.parsedType}),ht}return Sr(g.data)}}Ru.create=v=>new Ru({typeName:ut.ZodVoid,...yt(v)});class yn extends bt{_parse(g){const{ctx:b,status:I}=this._processInputParams(g),A=this._def;if(b.parsedType!==Ke.array)return He(b,{code:Oe.invalid_type,expected:Ke.array,received:b.parsedType}),ht;if(A.exactLength!==null){const S=b.data.length>A.exactLength.value,o=b.data.length<A.exactLength.value;(S||o)&&(He(b,{code:S?Oe.too_big:Oe.too_small,minimum:o?A.exactLength.value:void 0,maximum:S?A.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:A.exactLength.message}),I.dirty())}if(A.minLength!==null&&b.data.length<A.minLength.value&&(He(b,{code:Oe.too_small,minimum:A.minLength.value,type:"array",inclusive:!0,exact:!1,message:A.minLength.message}),I.dirty()),A.maxLength!==null&&b.data.length>A.maxLength.value&&(He(b,{code:Oe.too_big,maximum:A.maxLength.value,type:"array",inclusive:!0,exact:!1,message:A.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>A.type._parseAsync(new Un(b,S,b.path,o)))).then(S=>pr.mergeArray(I,S));const L=[...b.data].map((S,o)=>A.type._parseSync(new Un(b,S,b.path,o)));return pr.mergeArray(I,L)}get element(){return this._def.type}min(g,b){return new yn({...this._def,minLength:{value:g,message:rt.toString(b)}})}max(g,b){return new yn({...this._def,maxLength:{value:g,message:rt.toString(b)}})}length(g,b){return new yn({...this._def,exactLength:{value:g,message:rt.toString(b)}})}nonempty(g){return this.min(1,g)}}yn.create=(v,g)=>new yn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...yt(g)});function uo(v){if(v instanceof yi){const g={};for(const b in v.shape){const I=v.shape[b];g[b]=Gn.create(uo(I))}return new yi({...v._def,shape:()=>g})}else return v instanceof yn?new yn({...v._def,type:uo(v.element)}):v instanceof Gn?Gn.create(uo(v.unwrap())):v instanceof Oa?Oa.create(uo(v.unwrap())):v instanceof $n?$n.create(v.items.map(g=>uo(g))):v}class yi extends bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),b=kt.objectKeys(g);return this._cached={shape:g,keys:b}}_parse(g){if(this._getType(g)!==Ke.object){const pe=this._getOrReturnCtx(g);return He(pe,{code:Oe.invalid_type,expected:Ke.object,received:pe.parsedType}),ht}const{status:I,ctx:A}=this._processInputParams(g),{shape:L,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof la&&this._def.unknownKeys==="strip"))for(const pe in A.data)S.includes(pe)||o.push(pe);const he=[];for(const pe of S){const Ce=L[pe],Le=A.data[pe];he.push({key:{status:"valid",value:pe},value:Ce._parse(new Un(A,Le,A.path,pe)),alwaysSet:pe in A.data})}if(this._def.catchall instanceof la){const pe=this._def.unknownKeys;if(pe==="passthrough")for(const Ce of o)he.push({key:{status:"valid",value:Ce},value:{status:"valid",value:A.data[Ce]}});else if(pe==="strict")o.length>0&&(He(A,{code:Oe.unrecognized_keys,keys:o}),I.dirty());else if(pe!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const pe=this._def.catchall;for(const Ce of o){const Le=A.data[Ce];he.push({key:{status:"valid",value:Ce},value:pe._parse(new Un(A,Le,A.path,Ce)),alwaysSet:Ce in A.data})}}return A.common.async?Promise.resolve().then(async()=>{const pe=[];for(const Ce of he){const Le=await Ce.key,Ie=await Ce.value;pe.push({key:Le,value:Ie,alwaysSet:Ce.alwaysSet})}return pe}).then(pe=>pr.mergeObjectSync(I,pe)):pr.mergeObjectSync(I,he)}get shape(){return this._def.shape()}strict(g){return rt.errToObj,new yi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(b,I)=>{var A,L,S,o;const he=(S=(L=(A=this._def).errorMap)===null||L===void 0?void 0:L.call(A,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=rt.errToObj(g).message)!==null&&o!==void 0?o:he}:{message:he}}}:{}})}strip(){return new yi({...this._def,unknownKeys:"strip"})}passthrough(){return new yi({...this._def,unknownKeys:"passthrough"})}extend(g){return new yi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new yi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,b){return this.augment({[g]:b})}catchall(g){return new yi({...this._def,catchall:g})}pick(g){const b={};return kt.objectKeys(g).forEach(I=>{g[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new yi({...this._def,shape:()=>b})}omit(g){const b={};return kt.objectKeys(this.shape).forEach(I=>{g[I]||(b[I]=this.shape[I])}),new yi({...this._def,shape:()=>b})}deepPartial(){return uo(this)}partial(g){const b={};return kt.objectKeys(this.shape).forEach(I=>{const A=this.shape[I];g&&!g[I]?b[I]=A:b[I]=A.optional()}),new yi({...this._def,shape:()=>b})}required(g){const b={};return kt.objectKeys(this.shape).forEach(I=>{if(g&&!g[I])b[I]=this.shape[I];else{let L=this.shape[I];for(;L instanceof Gn;)L=L._def.innerType;b[I]=L}}),new yi({...this._def,shape:()=>b})}keyof(){return Nf(kt.objectKeys(this.shape))}}yi.create=(v,g)=>new yi({shape:()=>v,unknownKeys:"strip",catchall:la.create(),typeName:ut.ZodObject,...yt(g)}),yi.strictCreate=(v,g)=>new yi({shape:()=>v,unknownKeys:"strict",catchall:la.create(),typeName:ut.ZodObject,...yt(g)}),yi.lazycreate=(v,g)=>new yi({shape:v,unknownKeys:"strip",catchall:la.create(),typeName:ut.ZodObject,...yt(g)});class Il extends bt{_parse(g){const{ctx:b}=this._processInputParams(g),I=this._def.options;function A(L){for(const o of L)if(o.result.status==="valid")return o.result;for(const o of L)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=L.map(o=>new $r(o.ctx.common.issues));return He(b,{code:Oe.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async L=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await L._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(A);{let L;const S=[];for(const he of I){const pe={...b,common:{...b.common,issues:[]},parent:null},Ce=he._parseSync({data:b.data,path:b.path,parent:pe});if(Ce.status==="valid")return Ce;Ce.status==="dirty"&&!L&&(L={result:Ce,ctx:pe}),pe.common.issues.length&&S.push(pe.common.issues)}if(L)return b.common.issues.push(...L.ctx.common.issues),L.result;const o=S.map(he=>new $r(he));return He(b,{code:Oe.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Il.create=(v,g)=>new Il({options:v,typeName:ut.ZodUnion,...yt(g)});const ca=v=>v instanceof zl?ca(v.schema):v instanceof xn?ca(v.innerType()):v instanceof Al?[v.value]:v instanceof Fa?v.options:v instanceof Rl?kt.objectValues(v.enum):v instanceof Dl?ca(v._def.innerType):v instanceof Pl?[void 0]:v instanceof Cl?[null]:v instanceof Gn?[void 0,...ca(v.unwrap())]:v instanceof Oa?[null,...ca(v.unwrap())]:v instanceof Pd||v instanceof Fl?ca(v.unwrap()):v instanceof Ll?ca(v._def.innerType):[];class Du extends bt{_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Ke.object)return He(b,{code:Oe.invalid_type,expected:Ke.object,received:b.parsedType}),ht;const I=this.discriminator,A=b.data[I],L=this.optionsMap.get(A);return L?b.common.async?L._parseAsync({data:b.data,path:b.path,parent:b}):L._parseSync({data:b.data,path:b.path,parent:b}):(He(b,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,b,I){const A=new Map;for(const L of b){const S=ca(L.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const o of S){if(A.has(o))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(o)}`);A.set(o,L)}}return new Du({typeName:ut.ZodDiscriminatedUnion,discriminator:g,options:b,optionsMap:A,...yt(I)})}}function Sd(v,g){const b=oa(v),I=oa(g);if(v===g)return{valid:!0,data:v};if(b===Ke.object&&I===Ke.object){const A=kt.objectKeys(g),L=kt.objectKeys(v).filter(o=>A.indexOf(o)!==-1),S={...v,...g};for(const o of L){const he=Sd(v[o],g[o]);if(!he.valid)return{valid:!1};S[o]=he.data}return{valid:!0,data:S}}else if(b===Ke.array&&I===Ke.array){if(v.length!==g.length)return{valid:!1};const A=[];for(let L=0;L<v.length;L++){const S=v[L],o=g[L],he=Sd(S,o);if(!he.valid)return{valid:!1};A.push(he.data)}return{valid:!0,data:A}}else return b===Ke.date&&I===Ke.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class El extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g),A=(L,S)=>{if(wd(L)||wd(S))return ht;const o=Sd(L.value,S.value);return o.valid?((Td(L)||Td(S))&&b.dirty(),{status:b.value,value:o.data}):(He(I,{code:Oe.invalid_intersection_types}),ht)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([L,S])=>A(L,S)):A(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}El.create=(v,g,b)=>new El({left:v,right:g,typeName:ut.ZodIntersection,...yt(b)});class $n extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.array)return He(I,{code:Oe.invalid_type,expected:Ke.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return He(I,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(He(I,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const L=[...I.data].map((S,o)=>{const he=this._def.items[o]||this._def.rest;return he?he._parse(new Un(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(L).then(S=>pr.mergeArray(b,S)):pr.mergeArray(b,L)}get items(){return this._def.items}rest(g){return new $n({...this._def,rest:g})}}$n.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:v,typeName:ut.ZodTuple,rest:null,...yt(g)})};class kl extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.object)return He(I,{code:Oe.invalid_type,expected:Ke.object,received:I.parsedType}),ht;const A=[],L=this._def.keyType,S=this._def.valueType;for(const o in I.data)A.push({key:L._parse(new Un(I,o,I.path,o)),value:S._parse(new Un(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?pr.mergeObjectAsync(b,A):pr.mergeObjectSync(b,A)}get element(){return this._def.valueType}static create(g,b,I){return b instanceof bt?new kl({keyType:g,valueType:b,typeName:ut.ZodRecord,...yt(I)}):new kl({keyType:_n.create(),valueType:g,typeName:ut.ZodRecord,...yt(b)})}}class Lu extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.map)return He(I,{code:Oe.invalid_type,expected:Ke.map,received:I.parsedType}),ht;const A=this._def.keyType,L=this._def.valueType,S=[...I.data.entries()].map(([o,he],pe)=>({key:A._parse(new Un(I,o,I.path,[pe,"key"])),value:L._parse(new Un(I,he,I.path,[pe,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const he of S){const pe=await he.key,Ce=await he.value;if(pe.status==="aborted"||Ce.status==="aborted")return ht;(pe.status==="dirty"||Ce.status==="dirty")&&b.dirty(),o.set(pe.value,Ce.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const he of S){const pe=he.key,Ce=he.value;if(pe.status==="aborted"||Ce.status==="aborted")return ht;(pe.status==="dirty"||Ce.status==="dirty")&&b.dirty(),o.set(pe.value,Ce.value)}return{status:b.value,value:o}}}}Lu.create=(v,g,b)=>new Lu({valueType:g,keyType:v,typeName:ut.ZodMap,...yt(b)});class xs extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.set)return He(I,{code:Oe.invalid_type,expected:Ke.set,received:I.parsedType}),ht;const A=this._def;A.minSize!==null&&I.data.size<A.minSize.value&&(He(I,{code:Oe.too_small,minimum:A.minSize.value,type:"set",inclusive:!0,exact:!1,message:A.minSize.message}),b.dirty()),A.maxSize!==null&&I.data.size>A.maxSize.value&&(He(I,{code:Oe.too_big,maximum:A.maxSize.value,type:"set",inclusive:!0,exact:!1,message:A.maxSize.message}),b.dirty());const L=this._def.valueType;function S(he){const pe=new Set;for(const Ce of he){if(Ce.status==="aborted")return ht;Ce.status==="dirty"&&b.dirty(),pe.add(Ce.value)}return{status:b.value,value:pe}}const o=[...I.data.values()].map((he,pe)=>L._parse(new Un(I,he,I.path,pe)));return I.common.async?Promise.all(o).then(he=>S(he)):S(o)}min(g,b){return new xs({...this._def,minSize:{value:g,message:rt.toString(b)}})}max(g,b){return new xs({...this._def,maxSize:{value:g,message:rt.toString(b)}})}size(g,b){return this.min(g,b).max(g,b)}nonempty(g){return this.min(1,g)}}xs.create=(v,g)=>new xs({valueType:v,minSize:null,maxSize:null,typeName:ut.ZodSet,...yt(g)});class ho extends bt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Ke.function)return He(b,{code:Oe.invalid_type,expected:Ke.function,received:b.parsedType}),ht;function I(o,he){return ku({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),oo].filter(pe=>!!pe),issueData:{code:Oe.invalid_arguments,argumentsError:he}})}function A(o,he){return ku({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),oo].filter(pe=>!!pe),issueData:{code:Oe.invalid_return_type,returnTypeError:he}})}const L={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof po){const o=this;return Sr(async function(...he){const pe=new $r([]),Ce=await o._def.args.parseAsync(he,L).catch(oe=>{throw pe.addIssue(I(he,oe)),pe}),Le=await Reflect.apply(S,this,Ce);return await o._def.returns._def.type.parseAsync(Le,L).catch(oe=>{throw pe.addIssue(A(Le,oe)),pe})})}else{const o=this;return Sr(function(...he){const pe=o._def.args.safeParse(he,L);if(!pe.success)throw new $r([I(he,pe.error)]);const Ce=Reflect.apply(S,this,pe.data),Le=o._def.returns.safeParse(Ce,L);if(!Le.success)throw new $r([A(Ce,Le.error)]);return Le.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new ho({...this._def,args:$n.create(g).rest(ys.create())})}returns(g){return new ho({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,b,I){return new ho({args:g||$n.create([]).rest(ys.create()),returns:b||ys.create(),typeName:ut.ZodFunction,...yt(I)})}}class zl extends bt{get schema(){return this._def.getter()}_parse(g){const{ctx:b}=this._processInputParams(g);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}zl.create=(v,g)=>new zl({getter:v,typeName:ut.ZodLazy,...yt(g)});class Al extends bt{_parse(g){if(g.data!==this._def.value){const b=this._getOrReturnCtx(g);return He(b,{received:b.data,code:Oe.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:g.data}}get value(){return this._def.value}}Al.create=(v,g)=>new Al({value:v,typeName:ut.ZodLiteral,...yt(g)});function Nf(v,g){return new Fa({values:v,typeName:ut.ZodEnum,...yt(g)})}class Fa extends bt{constructor(){super(...arguments),Tl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const b=this._getOrReturnCtx(g),I=this._def.values;return He(b,{expected:kt.joinValues(I),received:b.parsedType,code:Oe.invalid_type}),ht}if(zu(this,Tl)||Lf(this,Tl,new Set(this._def.values)),!zu(this,Tl).has(g.data)){const b=this._getOrReturnCtx(g),I=this._def.values;return He(b,{received:b.data,code:Oe.invalid_enum_value,options:I}),ht}return Sr(g.data)}get options(){return this._def.values}get enum(){const g={};for(const b of this._def.values)g[b]=b;return g}get Values(){const g={};for(const b of this._def.values)g[b]=b;return g}get Enum(){const g={};for(const b of this._def.values)g[b]=b;return g}extract(g,b=this._def){return Fa.create(g,{...this._def,...b})}exclude(g,b=this._def){return Fa.create(this.options.filter(I=>!g.includes(I)),{...this._def,...b})}}Tl=new WeakMap,Fa.create=Nf;class Rl extends bt{constructor(){super(...arguments),Ml.set(this,void 0)}_parse(g){const b=kt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Ke.string&&I.parsedType!==Ke.number){const A=kt.objectValues(b);return He(I,{expected:kt.joinValues(A),received:I.parsedType,code:Oe.invalid_type}),ht}if(zu(this,Ml)||Lf(this,Ml,new Set(kt.getValidEnumValues(this._def.values))),!zu(this,Ml).has(g.data)){const A=kt.objectValues(b);return He(I,{received:I.data,code:Oe.invalid_enum_value,options:A}),ht}return Sr(g.data)}get enum(){return this._def.values}}Ml=new WeakMap,Rl.create=(v,g)=>new Rl({values:v,typeName:ut.ZodNativeEnum,...yt(g)});class po extends bt{unwrap(){return this._def.type}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Ke.promise&&b.common.async===!1)return He(b,{code:Oe.invalid_type,expected:Ke.promise,received:b.parsedType}),ht;const I=b.parsedType===Ke.promise?b.data:Promise.resolve(b.data);return Sr(I.then(A=>this._def.type.parseAsync(A,{path:b.path,errorMap:b.common.contextualErrorMap})))}}po.create=(v,g)=>new po({type:v,typeName:ut.ZodPromise,...yt(g)});class xn extends bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:b,ctx:I}=this._processInputParams(g),A=this._def.effect||null,L={addIssue:S=>{He(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(L.addIssue=L.addIssue.bind(L),A.type==="preprocess"){const S=A.transform(I.data,L);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const he=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return he.status==="aborted"?ht:he.status==="dirty"||b.value==="dirty"?lo(he.value):he});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?lo(o.value):o}}if(A.type==="refinement"){const S=o=>{const he=A.refinement(o,L);if(I.common.async)return Promise.resolve(he);if(he instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(A.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!gs(S))return S;const o=A.transform(S.value,L);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>gs(S)?Promise.resolve(A.transform(S.value,L)).then(o=>({status:b.value,value:o})):S);kt.assertNever(A)}}xn.create=(v,g,b)=>new xn({schema:v,typeName:ut.ZodEffects,effect:g,...yt(b)}),xn.createWithPreprocess=(v,g,b)=>new xn({schema:g,effect:{type:"preprocess",transform:v},typeName:ut.ZodEffects,...yt(b)});class Gn extends bt{_parse(g){return this._getType(g)===Ke.undefined?Sr(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Gn.create=(v,g)=>new Gn({innerType:v,typeName:ut.ZodOptional,...yt(g)});class Oa extends bt{_parse(g){return this._getType(g)===Ke.null?Sr(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Oa.create=(v,g)=>new Oa({innerType:v,typeName:ut.ZodNullable,...yt(g)});class Dl extends bt{_parse(g){const{ctx:b}=this._processInputParams(g);let I=b.data;return b.parsedType===Ke.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Dl.create=(v,g)=>new Dl({innerType:v,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...yt(g)});class Ll extends bt{_parse(g){const{ctx:b}=this._processInputParams(g),I={...b,common:{...b.common,issues:[]}},A=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return wl(A)?A.then(L=>({status:"valid",value:L.status==="valid"?L.value:this._def.catchValue({get error(){return new $r(I.common.issues)},input:I.data})})):{status:"valid",value:A.status==="valid"?A.value:this._def.catchValue({get error(){return new $r(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ll.create=(v,g)=>new Ll({innerType:v,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...yt(g)});class Bu extends bt{_parse(g){if(this._getType(g)!==Ke.nan){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.nan,received:I.parsedType}),ht}return{status:"valid",value:g.data}}}Bu.create=v=>new Bu({typeName:ut.ZodNaN,...yt(v)});const Sy=Symbol("zod_brand");class Pd extends bt{_parse(g){const{ctx:b}=this._processInputParams(g),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class Bl extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const L=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return L.status==="aborted"?ht:L.status==="dirty"?(b.dirty(),lo(L.value)):this._def.out._parseAsync({data:L.value,path:I.path,parent:I})})();{const A=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return A.status==="aborted"?ht:A.status==="dirty"?(b.dirty(),{status:"dirty",value:A.value}):this._def.out._parseSync({data:A.value,path:I.path,parent:I})}}static create(g,b){return new Bl({in:g,out:b,typeName:ut.ZodPipeline})}}class Fl extends bt{_parse(g){const b=this._def.innerType._parse(g),I=A=>(gs(A)&&(A.value=Object.freeze(A.value)),A);return wl(b)?b.then(A=>I(A)):I(b)}unwrap(){return this._def.innerType}}Fl.create=(v,g)=>new Fl({innerType:v,typeName:ut.ZodReadonly,...yt(g)});function Zf(v,g){const b=typeof v=="function"?v(g):typeof v=="string"?{message:v}:v;return typeof b=="string"?{message:b}:b}function Vf(v,g={},b){return v?co.create().superRefine((I,A)=>{var L,S;const o=v(I);if(o instanceof Promise)return o.then(he=>{var pe,Ce;if(!he){const Le=Zf(g,I),Ie=(Ce=(pe=Le.fatal)!==null&&pe!==void 0?pe:b)!==null&&Ce!==void 0?Ce:!0;A.addIssue({code:"custom",...Le,fatal:Ie})}});if(!o){const he=Zf(g,I),pe=(S=(L=he.fatal)!==null&&L!==void 0?L:b)!==null&&S!==void 0?S:!0;A.addIssue({code:"custom",...he,fatal:pe})}}):co.create()}const Py={object:yi.lazycreate};var ut;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ut||(ut={}));const Cy=(v,g={message:`Input not instance of ${v.name}`})=>Vf(b=>b instanceof v,g),Uf=_n.create,$f=La.create,Iy=Bu.create,Ey=Ba.create,Gf=Sl.create,ky=_s.create,zy=Au.create,Ay=Pl.create,Ry=Cl.create,Dy=co.create,Ly=ys.create,By=la.create,Fy=Ru.create,Oy=yn.create,jy=yi.create,Ny=yi.strictCreate,Zy=Il.create,Vy=Du.create,Uy=El.create,$y=$n.create,Gy=kl.create,qy=Lu.create,Hy=xs.create,Wy=ho.create,Xy=zl.create,Ky=Al.create,Yy=Fa.create,Jy=Rl.create,Qy=po.create,qf=xn.create,ex=Gn.create,tx=Oa.create,ix=xn.createWithPreprocess,rx=Bl.create;var ot=Object.freeze({__proto__:null,defaultErrorMap:oo,setErrorMap:iy,getErrorMap:Eu,makeIssue:ku,EMPTY_PATH:ry,addIssueToContext:He,ParseStatus:pr,INVALID:ht,DIRTY:lo,OK:Sr,isAborted:wd,isDirty:Td,isValid:gs,isAsync:wl,get util(){return kt},get objectUtil(){return bd},ZodParsedType:Ke,getParsedType:oa,ZodType:bt,datetimeRegex:jf,ZodString:_n,ZodNumber:La,ZodBigInt:Ba,ZodBoolean:Sl,ZodDate:_s,ZodSymbol:Au,ZodUndefined:Pl,ZodNull:Cl,ZodAny:co,ZodUnknown:ys,ZodNever:la,ZodVoid:Ru,ZodArray:yn,ZodObject:yi,ZodUnion:Il,ZodDiscriminatedUnion:Du,ZodIntersection:El,ZodTuple:$n,ZodRecord:kl,ZodMap:Lu,ZodSet:xs,ZodFunction:ho,ZodLazy:zl,ZodLiteral:Al,ZodEnum:Fa,ZodNativeEnum:Rl,ZodPromise:po,ZodEffects:xn,ZodTransformer:xn,ZodOptional:Gn,ZodNullable:Oa,ZodDefault:Dl,ZodCatch:Ll,ZodNaN:Bu,BRAND:Sy,ZodBranded:Pd,ZodPipeline:Bl,ZodReadonly:Fl,custom:Vf,Schema:bt,ZodSchema:bt,late:Py,get ZodFirstPartyTypeKind(){return ut},coerce:{string:v=>_n.create({...v,coerce:!0}),number:v=>La.create({...v,coerce:!0}),boolean:v=>Sl.create({...v,coerce:!0}),bigint:v=>Ba.create({...v,coerce:!0}),date:v=>_s.create({...v,coerce:!0})},any:Dy,array:Oy,bigint:Ey,boolean:Gf,date:ky,discriminatedUnion:Vy,effect:qf,enum:Yy,function:Wy,instanceof:Cy,intersection:Uy,lazy:Xy,literal:Ky,map:qy,nan:Iy,nativeEnum:Jy,never:By,null:Ry,nullable:tx,number:$f,object:jy,oboolean:()=>Gf().optional(),onumber:()=>$f().optional(),optional:ex,ostring:()=>Uf().optional(),pipeline:rx,preprocess:ix,promise:Qy,record:Gy,set:Hy,strictObject:Ny,string:Uf,symbol:zy,transformer:qf,tuple:$y,undefined:Ay,union:Zy,unknown:Ly,void:Fy,NEVER:ht,ZodIssueCode:Oe,quotelessJson:ty,ZodError:$r});const Fu=ot.object({lat:ot.number(),lng:ot.number()}),nx=ot.object({center:Fu,zoom:ot.number()}),ax=ot.object({sw:Fu,ne:Fu}),sx=ot.object({name:ot.literal("dark").or(ot.literal("light")),url:ot.string().optional(),colors:ot.object({primary:ot.string().max(64),background:ot.string().max(64),text:ot.string().max(64)})}),ox=ot.object({container:ot.string(),position:ot.object({center:ot.object({lat:ot.number(),lng:ot.number()}),zoom:ot.number()}),restriction:ot.object({minZoom:ot.number().min(yd).max(bl).optional(),maxZoom:ot.number().min(yd).max(bl).optional(),maxBounds:ax.optional()}).optional(),style:sx});ot.enum(["idle","move","click","popup_click"]);const lx=ot.function().returns(ot.void()),cx=ot.function().args(nx).returns(ot.void()),ux=ot.function().args(Fu).returns(ot.void()),hx={idle:lx,move:cx,click:ux},Hf=ot.object({id:ot.string(),rank:ot.number(),lat:ot.number(),lng:ot.number(),width:ot.number(),height:ot.number()}),dx=ot.tuple([ot.number(),ot.array(ot.tuple([ot.number(),ot.number()]))]),Wf=ot.function().args(ot.string()).returns(ot.promise(ot.any())),px=ot.object({data:Hf,state:dx,content:ot.object({bodyCallback:Wf,pinCallback:Wf.optional()})}),fx=ot.array(px);ot.object({apiKey:ot.string(),data:ot.array(Hf),minZoom:ot.number(),maxZoom:ot.number()});var mx=ld('<div class="container svelte-7b10cl"><div class="map svelte-7b10cl"></div> <div class="logo svelte-7b10cl"><a href="https://arenarium.dev" target="_blank" class="svelte-7b10cl">@arenarium/maps</a></div></div>');function Xf(v,g){mu(g,!0);let b,I,A,L,S,o=dr(0),he=dr(0),pe=dr(!1),Ce=dr(void 0);Pf(()=>{ox.parse(g.options),Le(),Ie()});function Le(){var Ee,Je,Ue;A=((Ee=g.options.restriction)==null?void 0:Ee.minZoom)??yd,L=((Je=g.options.restriction)==null?void 0:Je.maxZoom)??bl,S=(Ue=g.options.restriction)==null?void 0:Ue.maxBounds,b=new vd.Map({style:Br(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Zt(A),maxZoom:L,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function Ie(){b.on("load",oe),b.on("move",Ve),b.on("idle",Bt),b.on("click",ri),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function oe(){Si(pe,!0)}function Ve(){const Ee=b.getCenter(),Je=b.getZoom();ni("move",{center:Ee,zoom:Je});const Ue=b.getBounds();Si(Ce,{sw:{lat:Ue.getSouthWest().lat,lng:Ue.getSouthWest().lng},ne:{lat:Ue.getNorthEast().lat,lng:Ue.getNorthEast().lng}},!0)}function Bt(){ni("idle",null);const Ee=b.getBounds();Si(Ce,{sw:{lat:Ee.getSouthWest().lat,lng:Ee.getSouthWest().lng},ne:{lat:Ee.getNorthEast().lat,lng:Ee.getNorthEast().lng}},!0)}function ri(Ee){ni("click",{lat:Ee.lngLat.lat,lng:Ee.lngLat.lng})}const Ft=new Map;function oi(Ee,Je){var Gt;const Ue=hx[Ee];if(!Ue)throw new Error(`No schema defined for event ${Ee}`);if(!Ue.safeParse(Je).success)throw new Error(`Invalid handler for event ${Ee}`);Ft.has(Ee)||Ft.set(Ee,new Set),(Gt=Ft.get(Ee))==null||Gt.add(Je)}function Oi(Ee,Je){const Ue=Ft.get(Ee);Ue&&Ue.delete(Je)&&Ue.size===0&&Ft.delete(Ee)}function ni(Ee,Je){const Ue=Ft.get(Ee);Ue&&Ue.size>0&&[...Ue].forEach(ft=>{try{ft(Je)}catch(Gt){console.error(Gt)}})}function Zt(Ee){const Je=Ef,Ue=Math.ceil(Math.log2(_t(o)/Je));return Math.max(Ee,Ue)}function Ot(){const Ee=b.getCenter();return Ee?{lat:Ee.lat,lng:Ee.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function Wi(){return b.getZoom()??g.options.position.zoom}function Et(){if(!b)throw new Error("Map not loaded!");const Ee=b.getBounds();return{sw:{lat:Ee.getSouthWest().lat,lng:Ee.getSouthWest().lng},ne:{lat:Ee.getNorthEast().lat,lng:Ee.getNorthEast().lng}}}function nr(Ee){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ee)}function qn(Ee){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ee)}function Lr(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function ji(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function Xi(Ee){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");A=Ee,b.setMinZoom(Zt(Ee))}function xi(Ee){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");L=Ee,b.setMaxZoom(Ee)}function Pr(Ee){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ee,b.setMaxBounds([Ee.sw.lng,Ee.sw.lat,Ee.ne.lng,Ee.ne.lat])}let Ni=dr(ds(g.options.style));sa(()=>{_t(pe)&&b.setStyle(Br(_t(Ni)),{diff:!0})});function Br(Ee){if(Ee.url)return Ee.url;switch(Ee.name){case"light":return ey;case"dark":return Q_}}function Qe(){return Qg(_t(Ni))}function pi(Ee){Si(Ni,Ee,!0),b.setStyle(Br(_t(Ni)),{diff:!0})}class fi{constructor(Je){$t(this,"id");$t(this,"lat");$t(this,"lng");$t(this,"zoom");$t(this,"element");$t(this,"component");$t(this,"libreMarker");this.id=Je.data.id,this.lat=Je.data.lat,this.lng=Je.data.lng,this.zoom=Je.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Je=this.element;if(!Je)throw new Error("Failed to create libre marker");const Ue=new vd.Marker({element:Je});Ue.setLngLat([this.lng,this.lat]),this.libreMarker=Ue}isCreated(){return this.element!=null}isInBlock(Je,Ue){return this.zoom<=Je&&Ue.contains(this.lat,this.lng)}}class Cr extends fi{constructor(Ue){super(Ue);$t(this,"pinLoading",!1);$t(this,"pinLoaded",!1);$t(this,"pinContentCallback");this.pinContentCallback=Ue.content.pinCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=ud(W_,{target:this.element}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const ft=Math.round((bl-this.zoom)*kf);Ue.style.zIndex=ft.toString()}updateMap(Ue){if(this.libreMarker==null)throw new Error("Failed to update circle map");this.libreMarker._map!=Ue&&(Ue?this.libreMarker.addTo(Ue):this.libreMarker.remove())}updateState(Ue){const ft=this.component;if(!ft)throw new Error("Failed to update circle state");if(this.zoom<=Ue)ft.setScale(0);else{const or=1-(this.zoom-Ue)/zf*.5;ft.setScale(or)}}updatePin(){var ft;if(this.pinContentCallback==null||this.pinLoaded||this.pinLoading)return;const Ue=(ft=this.component)==null?void 0:ft.getPin();Ue!=null&&(this.pinLoading=!0,this.pinContentCallback(this.id).then(Gt=>{Ue.removeChild(Ue.firstChild),Ue.appendChild(Gt),this.pinLoaded=!0,this.pinLoading=!1}))}isPinLoaded(){return this.pinContentCallback==null||this.pinLoaded}}class ki extends fi{constructor(Ue){super(Ue);$t(this,"width");$t(this,"height");$t(this,"angles");$t(this,"bodyLoading",!1);$t(this,"bodyLoaded",!1);$t(this,"bodyContentCallback");this.id=Ue.data.id,this.angles=Ue.state[1],this.width=Ue.data.width,this.height=Ue.data.height,this.bodyContentCallback=Ue.content.bodyCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=ud(q_,{target:this.element,props:{width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const ft=Math.round((bl-this.zoom)*kf)+Number.MAX_SAFE_INTEGER/2;Ue.style.zIndex=ft.toString()}updateMap(Ue){const ft=this.libreMarker,Gt=this.component;if(ft==null||Gt==null)throw new Error("Failed to update marker map");ft._map!=Ue&&(Ue?(ft.addTo(Ue),Gt.setDisplayed(!0)):(ft.remove(),Gt.setDisplayed(!1)))}updateState(Ue){const ft=this.component;if(!ft)throw new Error("Failed to update marker state");this.zoom<=Ue?(ft.setCollapsed(!1),ft.setAngle(this.getAngle(Ue))):ft.setCollapsed(!0)}updateBody(){var ft;if(this.bodyLoaded||this.bodyLoading)return;const Ue=(ft=this.component)==null?void 0:ft.getBody();Ue!=null&&(this.bodyLoading=!0,this.bodyContentCallback(this.id).then(Gt=>{Ue.appendChild(Gt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ue){let ft=this.angles,Gt=ft[0],or=0;for(;Gt[0]<Ue&&(or++,or!=ft.length);)Gt=ft[or];return Gt[1]}getExpanded(){return this.component?this.component.getExpanded():!1}getCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class vn{constructor(Je){$t(this,"id");$t(this,"rank");$t(this,"lat");$t(this,"lng");$t(this,"zoom");$t(this,"circle");$t(this,"marker");this.id=Je.data.id,this.rank=Je.data.rank,this.lat=Je.data.lat,this.lng=Je.data.lng,this.zoom=Je.state[0],this.circle=new Cr(Je),this.marker=new ki(Je)}}let Zi,Vt=new Array,Ki=new Map,Yi=Ef,bn=Xp(()=>_t(Ce)?new Rf(b,-512,_t(he)+Yi,_t(o)+Yi,-512):void 0),nn=Xp(()=>_t(Ce)?new Rf(b,0,_t(he),_t(o),0):void 0);Pf(()=>{const Ee=()=>{ha(),Zi=window.setTimeout(Ee,25)};return Ee(),()=>clearInterval(Zi)});function ha(){if(_t(pe)==!1||_t(nn)==null||_t(bn)==null||Vt.length==0)return;const Ee=b.getZoom();if(Ee)for(const Je of Vt)ar(Je.circle,Ee,_t(nn)),sr(Je.marker,Ee,_t(bn))}function ar(Ee,Je,Ue){Ee.isInBlock(Je+zf,Ue)?(Ee.isCreated()==!1&&Ee.createElement(),Ee.updateMap(b),Ee.updateState(Je),Ee.isPinLoaded()==!1&&Ee.updatePin()):Ee.isCreated()==!0&&Ee.updateMap(null)}function sr(Ee,Je,Ue){Ee.isInBlock(Je+U_,Ue)?(Ee.isCreated()==!1&&Ee.createElement(),Ee.updateMap(b),Ee.updateState(Je),Ee.getExpanded()&&Ee.isBodyLoaded()==!1&&Ee.updateBody()):Ee.isCreated()==!0&&(Ee.getCollapsed()?Ee.updateMap(null):Ee.updateState(Je))}async function Vi(Ee){var Gt,or;const Je=new Map(Ee.map(mi=>[mi.data.id,new vn(mi)])),Ue=new Array,ft=Array.from(Vt);for(const mi of ft)Je.has(mi.id)==!1&&((Gt=mi.circle.libreMarker)==null||Gt.remove(),(or=mi.marker.libreMarker)==null||or.remove(),Ki.delete(mi.id),Vt.splice(Vt.indexOf(mi),1));for(const mi of Ee){const mr=Ki.get(mi.data.id);if(mr)mr.circle.zoom=mi.state[0],mr.circle.updateZIndex(),mr.marker.zoom=mi.state[0],mr.marker.angles=mi.state[1],mr.marker.updateZIndex();else{const gr=new vn(mi);Ki.set(mi.data.id,gr),Vt.push(gr),Ue.push(gr)}}}function Nt(){var Ee,Je;for(const Ue of Vt)(Ee=Ue.circle.libreMarker)==null||Ee.remove(),(Je=Ue.marker.libreMarker)==null||Je.remove();Vt.length=0,Ki.clear()}async function Fr(Ee){if(!(await fx.safeParseAsync(Ee)).success)throw new Error("Invalid popups");await Vi(Ee)}function an(){Nt()}function fr(Ee){const Je=Ki.get(Ee);Je!=null&&b.flyTo({center:{lat:Je.lat,lng:Je.lng},zoom:Je.zoom})}var wn=mx();E_("resize",rd,()=>b.setMinZoom(Zt(A)));var Tn=_u(wn);return ms(Tn,Ee=>I=Ee,()=>I),lf(()=>fd(wn,`--primary: ${_t(Ni).colors.primary??""}; --background: ${_t(Ni).colors.background??""}; --text: ${_t(Ni).colors.text??""};`)),Cu(Tn,"clientWidth",Ee=>Si(o,Ee)),Cu(Tn,"clientHeight",Ee=>Si(he,Ee)),cd(v,wn),gu({on:oi,off:Oi,emit:ni,getCenter:Ot,getZoom:Wi,getBounds:Et,setCenter:nr,setZoom:qn,zoomIn:Lr,zoomOut:ji,setMinZoom:Xi,setMaxZoom:xi,setMaxBounds:Pr,getStyle:Qe,setStyle:pi,updatePopups:Fr,removePopups:an,revealPopup:fr})}function gx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return ud(Xf,{target:g,props:{options:v}})}function _x(v){R_(v)}Lt.Map=Xf,Lt.mountMap=gx,Lt.unmountMap=_x,Object.defineProperty(Lt,Symbol.toStringTag,{value:"Module"})});
729
+ ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),K.call(k,E.gl,q),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(Mt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,pt.ReadOnly);E.setDepthMode(K),k.render(E.gl,q),E.setDirty(),f.setBaseState(),E.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?Qi:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Rs(this.context,gt[e],i,ic[e],this._showOverdrawInspector,l,s?gt.projectionMercator:h.shaderPreludeCode,s?yr: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 Et(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 wc(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class Tc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=wc(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let k=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===E?(k=!0,`${H}=${P}`):O}).filter(O=>O);return k||F.push(`${E}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const Wr={linearity:.3,easing:o.cb(0,0,.3,1)},ph=o.e({deceleration:2500,maxSpeed:1400},Wr),fh=o.e({deceleration:20,maxSpeed:1400},Wr),mh=o.e({deceleration:1e3,maxSpeed:360},Wr),gh=o.e({deceleration:1e3,maxSpeed:90},Wr),_h=o.e({deceleration:1e3,maxSpeed:360},Wr);class yh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ie.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ie.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Qn(i.pan.mag(),s,o.e({},ph,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,is(l,h)}if(i.zoom){const h=Qn(i.zoom,s,fh);l.zoom=this._map.transform.zoom+h.amount,is(l,h)}if(i.bearing){const h=Qn(i.bearing,s,mh);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),is(l,h)}if(i.pitch){const h=Qn(i.pitch,s,gh);l.pitch=this._map.transform.pitch+h.amount,is(l,h)}if(i.roll){const h=Qn(i.roll,s,_h);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),is(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function is(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Qn(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class vr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=oe.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class ur extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=oe.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,E)=>x.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Xr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class xh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Xr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new vr(e.type,this._map,e))}mouseup(e){this._map.fire(new vr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new vr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new vr(e.type,this._map,e))}mouseover(e){this._map.fire(new vr(e.type,this._map,e))}mouseout(e){this._map.fire(new vr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ur(e.type,this._map,e))}touchmove(e){this._map.fire(new ur(e.type,this._map,e))}touchend(e){this._map.fire(new ur(e.type,this._map,e))}touchcancel(e){this._map.fire(new ur(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class un{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new vr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new vr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hn{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class vh{constructor(e,i){this._map=e,this._tr=new hn(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&&(oe.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=oe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);oe.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),oe.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(oe.remove(this._box),this._box=null),oe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Mc(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 Wd{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=Mc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Mc(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class Sc{constructor(e){this.singleTap=new Wd(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class bh{constructor(e){this._tr=new hn(e),this._zoomIn=new Sc({numTouches:1,numTaps:2}),this._zoomOut=new Sc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class In{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&oe.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 En={0:1,2:2};class Ue{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=oe.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=En[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return oe.mouseButton(e)===this._eventButton}}class wh{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 Pc{constructor(e=new Ue({checkCorrectEvent:()=>!0}),i=new wh){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 Zs=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Vs{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=Mc(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],E=this._touches[T];E&&(h._add(P),f._add(P.sub(E)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const 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 Ta{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=Us(s,i,l),_=Us(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Us(s,i,l),_=Us(s,i,h);f&&_||(this._active&&oe.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 Us(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function xt(u,e){return Math.log(u/e)/Math.LN2}class Wo extends Ta{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(xt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:xt(this._distance,s),pinchAround:i}}}function Th(u,e){return 180*u.angleWith(e)/Math.PI}class Xo extends Ta{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Th(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Th(e,this._startVector);return Math.abs(s)<i}}function Cc(u){return Math.abs(u.y)>Math.abs(u.x)}class Mh extends Ta{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,Cc(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return Cc(e)&&Cc(i)&&f}}const Sh={panStep:100,bearingStep:15,pitchStep:10};class Ko{constructor(e){this._tr=new hn(e);const i=Sh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ph,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ph(u){return u*(2-u)}const Ch=4.000244140625;class Ic{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new hn(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=Ie.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Ch==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=oe.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ch?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ah(T*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,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ie.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cd;if(this._prevEase){const s=this._prevEase,l=(Ie.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cb(f,_,.25,1)}return this._prevEase={start:Ie.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 Ih{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 Xd{constructor(e){this._tr=new hn(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 ea{constructor(){this._tap=new Sc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ht{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 $s{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Yo{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ec{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=oe.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(oe.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Gs=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Eh extends o.l{}function kc(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class dn{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:k,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,k))F.reset();else if(F[h||l.type]){if(o.ce(l,h||l.type)){const q=oe.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.cf(l,h||l.type)){const q=this._getMapTouches(l.touches),W=oe.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.cg(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,k,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[k]=F)}const P={};for(const k in this._previousActiveHandlers)T[k]||(P[k]=f);this._previousActiveHandlers=T,(Object.keys(P).length||kc(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||kc(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new yh(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)oe.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)oe.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new xh(i,e));const l=i.boxZoom=new vh(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new Ec(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new bh(i),_=new Xd(i);i.doubleClickZoom=new Ih(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new ea;this._add("tapDragZoom",x);const T=i.touchPitch=new Mh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),E=function({enable:te,clickTolerance:re,aroundCenter:se=!0,minPixelCenterThreshold:ne=100,rotateDegreesPerPixelMoved:de=.8},me){const Te=new Ue({checkCorrectEvent:Se=>oe.mouseButton(Se)===0&&Se.ctrlKey||oe.mouseButton(Se)===2&&!Se.ctrlKey});return new In({clickTolerance:re,move:(Se,be)=>{const je=me();if(se&&Math.abs(je.y-Se.y)>ne)return{bearingDelta:o.cc(new o.P(Se.x,be.y),be,je)};let Be=(be.x-Se.x)*de;return se&&be.y<je.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Te,enable:te,assignEvents:Zs})}(e,P),k=function({enable:te,clickTolerance:re,pitchDegreesPerPixelMoved:se=-.5}){const ne=new Ue({checkCorrectEvent:de=>oe.mouseButton(de)===0&&de.ctrlKey||oe.mouseButton(de)===2});return new In({clickTolerance:re,move:(de,me)=>({pitchDelta:(me.y-de.y)*se}),moveStateManager:ne,enable:te,assignEvents:Zs})}(e),F=function({enable:te,clickTolerance:re,rollDegreesPerPixelMoved:se=.3},ne){const de=new Ue({checkCorrectEvent:me=>oe.mouseButton(me)===2&&me.ctrlKey});return new In({clickTolerance:re,move:(me,Te)=>{const Se=ne();let be=(Te.x-me.x)*se;return Te.y<Se.y&&(be=-be),{rollDelta:be}},moveStateManager:de,enable:te,assignEvents:Zs})}(e,P);i.dragRotate=new $s(e,E,k,F),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:te,clickTolerance:re}){const se=new Ue({checkCorrectEvent:ne=>oe.mouseButton(ne)===0&&!ne.ctrlKey});return new In({clickTolerance:re,move:(ne,de)=>({around:de,panDelta:de.sub(ne)}),activateOnStart:!0,moveStateManager:se,enable:te,assignEvents:Zs})}(e),H=new Vs(e,i);i.dragPan=new Ht(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new Xo,W=new Wo;i.touchZoomRotate=new Yo(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new Ic(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new Ko(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new un(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!!Gs(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(kc(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:E,around:k,pinchAround:F}=e;F!==void 0&&(k=F),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:E,pitchDelta:P,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const H=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?k.sub(_):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Gs(this._eventsInProgress),h=Gs(e),f={};for(const E in e){const{originalEvent:k}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=k),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:k}=e[E];this._fireEvent(E,k)}const _={};let x;for(const E in this._eventsInProgress){const{handlerName:k,originalEvent:F}=this._eventsInProgress[E];this._handlersById[k].isActive()||(delete this._eventsInProgress[E],x=i[k]||F,_[`${E}end`]=x)}for(const E in _)this._fireEvent(E,_[E]);const T=Gs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&Ie.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),k(this._map.getBearing())&&this._map.resetNorth()):(k(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Eh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Jo extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ie.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Nt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Nt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,x),k=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:k,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cd},e)).animate===!1||!e.essential&&Ie.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let k,F;e.around&&(k=o.Q.convert(e.around),F=s.locationToScreenPoint(k));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:k,aroundPoint:F,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ie.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cd},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let F=s.centerPoint.add(k);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:E,locationAtOffset:O,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,ee=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/ee*2));const te=q*q;function re(be){const je=(K*K-W*W+(be?-1:1)*te*te*ee*ee)/(2*(be?K:W)*te*ee);return Math.log(Math.sqrt(je*je+1)-je)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function ne(be){return(Math.exp(be)+Math.exp(-be))/2}const de=re(!1);let me=function(be){return ne(de)/ne(de+q*be)},Te=function(be){return W*((ne(de)*(se(je=de+q*be)/ne(je))-se(de))/te)/ee;var je},Se=(re(!0)-de)/q;if(Math.abs(ee)<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))/q,Te=()=>0,me=je=>Math.exp(be*q*je)}return e.duration="duration"in e?+e.duration:1e3*Se/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const je=be*Se,Be=1/me(je),ke=Te(je);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,E,be),F=s.centerPoint.add(k)),H.easeFunc(be,Be,ke,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ie.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const Ye={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class at{constructor(e=Ye){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=oe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=oe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=oe.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(){oe.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=oe.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class qs{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=oe.create("div","maplibregl-ctrl");const i=oe.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(){oe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class zc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ac=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class br extends o.E{constructor(e){super(),this._lastTilesetChange=Ie.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of ie(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new da(l,this.tileSize),this._lastTilesetChange=Ie.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),E=e.canonical.x-(h.canonical.x>>x),k=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+E*o.Z,-P*F+k*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),E=(e.canonical.x>>x)-h.canonical.x,k=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+E*F,P*o.Z+k*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class kh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new br(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.ch([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),E=Math.floor(T[1]),k=T[0]-P,F=T[1]-E;return _.get(P,E)*(1-k)*(1-F)+_.get(P+1,E)*k*(1-F)+_.get(P,E+1)*(1-k)*F+_.get(P+1,E+1)*k*F}getElevationForLngLatZoom(e,i){if(!o.ci(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Et(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Et(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new Et(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cj(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Et(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Et(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new Et(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const k=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*k;return new o.$((E.tileID.canonical.x*k+x)/F+E.tileID.wrap,(E.tileID.canonical.y*k+T)/F,this.getElevation(E.tileID,x,T,k))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.ck,T=new o.aK,P=this.meshSize,E=o.Z/P,k=P*P;for(let ne=0;ne<=P;ne++)for(let de=0;de<=P;de++)x.emplaceBack(de*E,ne*E,0);for(let ne=0;ne<k;ne+=P+1)for(let de=0;de<P;de++)T.emplaceBack(de+ne,P+de+ne+1,P+de+ne+2),T.emplaceBack(de+ne,P+de+ne+2,de+ne+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let ne=0;ne<=P;ne++)x.emplaceBack(ne*E,q,W);for(let ne=0;ne<=P;ne++)x.emplaceBack(ne*E,K,ee);for(let ne=0;ne<P;ne++)T.emplaceBack(H+ne,O+ne,O+ne+1),T.emplaceBack(H+ne,O+ne+1,H+ne+1),T.emplaceBack(0+ne,F+ne+1,F+ne),T.emplaceBack(0+ne,0+ne+1,F+ne+1);const te=x.length,re=te+2*(P+1);for(const ne of[0,1])for(let de=0;de<=P;de++)for(const me of[0,1])x.emplaceBack(ne*o.Z,de*E,me);for(let ne=0;ne<2*P;ne+=2)T.emplaceBack(te+ne,te+ne+1,te+ne+3),T.emplaceBack(te+ne,te+ne+3,te+ne+2),T.emplaceBack(re+ne,re+ne+3,re+ne+1),T.emplaceBack(re+ne,re+ne+2,re+ne+3);const se=new $a(_.createVertexBuffer(x,Ac.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class pn{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 Et(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 rs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hs{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new pn(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof Ee?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(rs[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(rs[l]&&(this._prevType&&rs[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(rs[this._prevType]||rs[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(vc(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<x.length;E++){const k=h.style._layers[x[E]],F=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(k,F,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,F,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return vc(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),rs[l]}return!1}}const ui={"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"},vi=he,Rc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ye,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Ws={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Qo{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,oe.mousePos(this.element,h)),oe.addEventListener(window,"mousemove",this.mousemove),oe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,oe.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=oe.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),oe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=oe.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new Pc;this._rotatePitchHanlder=new In({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cc(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,oe.addEventListener(i,"mousedown",this.mousedown),oe.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),oe.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),oe.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;oe.removeEventListener(e,"mousedown",this.mousedown),oe.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend),oe.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){oe.enableDrag(),oe.removeEventListener(window,"mousemove",this.mousemove),oe.removeEventListener(window,"mouseup",this.mouseup),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend)}}let kn;function el(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const Xs={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 ns(u,e,i){const s=u.classList;for(const l in Xs)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ks extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=el(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),oe.setTransform(this._element,`${Xs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ie.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=oe.create("div");const i=oe.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=oe.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=oe.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=oe.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=oe.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=oe.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=oe.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const E=oe.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const k=oe.createNS("http://www.w3.org/2000/svg","path");k.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),E.appendChild(k);const F=oe.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=oe.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=oe.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=oe.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),ns(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),oe.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const E=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==E&&(this._element.style.opacity=E))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/l.transform.pixelsPerMeter,x=Math.sin(l.getPitch()*Math.PI/180)*_,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),P=l.transform.lngLatToCameraDepth(this._lngLat,f+x)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const Dc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let as=0,Ma=!1;const Lc={maxWidth:100,unit:"metric"};function tl(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*P;E>5280?Sa(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Sa(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Sa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Sa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Sa(e,T,P,u._getUIString("ScaleControl.Meters"))}function Sa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Bc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},il=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function rl(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return rl(new o.P(0,0))}const Fc=he;S.AJAXError=o.co,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cp,S.config=o.a,S.removeProtocol=o.cq,S.AttributionControl=at,S.BoxZoomHandler=vh,S.CanvasSource=$e,S.CooperativeGesturesHandler=Ec,S.DoubleClickZoomHandler=Ih,S.DragPanHandler=Ht,S.DragRotateHandler=$s,S.EdgeInsets=Ts,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){oe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=oe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);oe.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=Tn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Nt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Ma)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=oe.create("button","maplibregl-ctrl-geolocate",this._container),oe.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=oe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ks({element:this._dotElement}),this._circleElement=oe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ks({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},Dc,u)}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(kn!==void 0&&!e)return kn;if(window.navigator.permissions===void 0)return kn=!!window.navigator.geolocation,kn;try{kn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{kn=!!window.navigator.geolocation}return kn})}().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(),oe.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,as=0,Ma=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":as--,Ma=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),as++,as>1?(u={maximumAge:6e5,timeout:0},Ma=!0):(u=this.options.positionOptions,Ma=!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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=oe.create("button","maplibregl-ctrl-globe",this._container),oe.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(){oe.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=Tc,S.ImageSource=Ee,S.KeyboardHandler=Ko,S.LngLatBounds=Nt,S.LogoControl=qs,S.Map=class extends Jo{constructor(u){var e,i;o.cl.mark(o.cm.create);const s=Object.assign(Object.assign(Object.assign({},Rc),u),{canvasContextAttributes:Object.assign(Object.assign({},Rc.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new ln,h=new Ps;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new zc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ui),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=ni.addThrottleControl(()=>this.isMoving()),this._requestManager=new Zt(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=wc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new dn(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,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new at(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new qs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Nt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new vr(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 vr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new vr(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new As(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new As(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new kh(this.painter,e,u),this.painter.renderToTexture=new Hs(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=V(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=V(Math.max(1,u),Math.max(1,e));return this._update(!0),this}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:E,data:k}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:E},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:E,data:k}=Ie.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:E},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ie.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return ni.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=oe.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=oe.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=oe.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=oe.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new dh(i,this.transform),Ve.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,k=Ie.now();this.style.zoomHistory.update(E,k);const F=new o.C(E,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cl.mark(o.cm.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cl.mark(o.cm.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ni.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),oe.remove(this._canvasContainer),oe.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cl.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ie.frame(this._frameRequest,u=>{o.cl.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cn(e)&&!function(i){return i.message===cc}(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 vi}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=vr,S.MapTouchEvent=ur,S.MapWheelEvent=Xr,S.Marker=Ks,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},Ws,u),this._container=oe.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})),oe.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})),oe.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=oe.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 Qo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){oe.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=oe.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&oe.remove(this._content),this._container&&(oe.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=oe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=oe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=el(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=rl(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),oe.setTransform(this._container,`${Xs[s]} translate(${h.x}px,${h.y}px)`),ns(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Bc),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=oe.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=oe.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(il);u&&u.focus()}},S.RasterDEMTileSource=wn,S.RasterTileSource=fr,S.ScaleControl=class{constructor(u){this._onMove=()=>{tl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,tl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Lc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){oe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Ic,S.Style=As,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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe.create("button","maplibregl-ctrl-terrain",this._container),oe.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(){oe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Mh,S.TwoFingersTouchRotateHandler=Xo,S.TwoFingersTouchZoomHandler=Wo,S.TwoFingersTouchZoomRotateHandler=Yo,S.VectorTileSource=an,S.VideoSource=Je,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Gt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{ft[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=Zi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Cr),Zi=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=bo,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return gr().getRTLTextPluginStatus()},S.getVersion=function(){return Fc},S.getWorkerCount=function(){return ki.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return bn().broadcast("IS",u)},S.prewarm=function(){Ki().acquire(Cr)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return gr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){ki.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var L=b;return L})}(Iu)),Iu.exports}var J_=Y_();const vd=X_(J_);class Rf{constructor(g,b,I,A,L){$t(this,"bounds1");$t(this,"bounds2");$t(this,"getBounds",(g,b,I,A)=>new vd.LngLatBounds([g,b],[I,A]));$t(this,"contains",(g,b)=>this.bounds1.contains([b,g])||this.bounds2.contains([b,g]));const S=g.unproject([b,I]),o=g.unproject([A,L]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const Q_={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}}]},ey={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 kt;(function(v){v.assertEqual=A=>A;function g(A){}v.assertIs=g;function b(A){throw new Error}v.assertNever=b,v.arrayToEnum=A=>{const L={};for(const S of A)L[S]=S;return L},v.getValidEnumValues=A=>{const L=v.objectKeys(A).filter(o=>typeof A[A[o]]!="number"),S={};for(const o of L)S[o]=A[o];return v.objectValues(S)},v.objectValues=A=>v.objectKeys(A).map(function(L){return A[L]}),v.objectKeys=typeof Object.keys=="function"?A=>Object.keys(A):A=>{const L=[];for(const S in A)Object.prototype.hasOwnProperty.call(A,S)&&L.push(S);return L},v.find=(A,L)=>{for(const S of A)if(L(S))return S},v.isInteger=typeof Number.isInteger=="function"?A=>Number.isInteger(A):A=>typeof A=="number"&&isFinite(A)&&Math.floor(A)===A;function I(A,L=" | "){return A.map(S=>typeof S=="string"?`'${S}'`:S).join(L)}v.joinValues=I,v.jsonStringifyReplacer=(A,L)=>typeof L=="bigint"?L.toString():L})(kt||(kt={}));var bd;(function(v){v.mergeShapes=(g,b)=>({...g,...b})})(bd||(bd={}));const Ke=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oa=v=>{switch(typeof v){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(v)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(v)?Ke.array:v===null?Ke.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Ke.promise:typeof Map<"u"&&v instanceof Map?Ke.map:typeof Set<"u"&&v instanceof Set?Ke.set:typeof Date<"u"&&v instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Oe=kt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ty=v=>JSON.stringify(v,null,2).replace(/"([^"]+)":/g,"$1:");class $r extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=g}format(g){const b=g||function(L){return L.message},I={_errors:[]},A=L=>{for(const S of L.issues)if(S.code==="invalid_union")S.unionErrors.map(A);else if(S.code==="invalid_return_type")A(S.returnTypeError);else if(S.code==="invalid_arguments")A(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,he=0;for(;he<S.path.length;){const pe=S.path[he];he===S.path.length-1?(o[pe]=o[pe]||{_errors:[]},o[pe]._errors.push(b(S))):o[pe]=o[pe]||{_errors:[]},o=o[pe],he++}}};return A(this),I}static assert(g){if(!(g instanceof $r))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,kt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=b=>b.message){const b={},I=[];for(const A of this.issues)A.path.length>0?(b[A.path[0]]=b[A.path[0]]||[],b[A.path[0]].push(g(A))):I.push(g(A));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}$r.create=v=>new $r(v);const oo=(v,g)=>{let b;switch(v.code){case Oe.invalid_type:v.received===Ke.undefined?b="Required":b=`Expected ${v.expected}, received ${v.received}`;break;case Oe.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(v.expected,kt.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:b=`Unrecognized key(s) in object: ${kt.joinValues(v.keys,", ")}`;break;case Oe.invalid_union:b="Invalid input";break;case Oe.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${kt.joinValues(v.options)}`;break;case Oe.invalid_enum_value:b=`Invalid enum value. Expected ${kt.joinValues(v.options)}, received '${v.received}'`;break;case Oe.invalid_arguments:b="Invalid function arguments";break;case Oe.invalid_return_type:b="Invalid function return type";break;case Oe.invalid_date:b="Invalid date";break;case Oe.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(b=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?b=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?b=`Invalid input: must end with "${v.validation.endsWith}"`:kt.assertNever(v.validation):v.validation!=="regex"?b=`Invalid ${v.validation}`:b="Invalid";break;case Oe.too_small:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:b="Invalid input";break;case Oe.too_big:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?b=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:b="Invalid input";break;case Oe.custom:b="Invalid input";break;case Oe.invalid_intersection_types:b="Intersection results could not be merged";break;case Oe.not_multiple_of:b=`Number must be a multiple of ${v.multipleOf}`;break;case Oe.not_finite:b="Number must be finite";break;default:b=g.defaultError,kt.assertNever(v)}return{message:b}};let Df=oo;function iy(v){Df=v}function Eu(){return Df}const ku=v=>{const{data:g,path:b,errorMaps:I,issueData:A}=v,L=[...b,...A.path||[]],S={...A,path:L};if(A.message!==void 0)return{...A,path:L,message:A.message};let o="";const he=I.filter(pe=>!!pe).slice().reverse();for(const pe of he)o=pe(S,{data:g,defaultError:o}).message;return{...A,path:L,message:o}},ry=[];function He(v,g){const b=Eu(),I=ku({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,b,b===oo?void 0:oo].filter(A=>!!A)});v.common.issues.push(I)}class pr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,b){const I=[];for(const A of b){if(A.status==="aborted")return ht;A.status==="dirty"&&g.dirty(),I.push(A.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,b){const I=[];for(const A of b){const L=await A.key,S=await A.value;I.push({key:L,value:S})}return pr.mergeObjectSync(g,I)}static mergeObjectSync(g,b){const I={};for(const A of b){const{key:L,value:S}=A;if(L.status==="aborted"||S.status==="aborted")return ht;L.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),L.value!=="__proto__"&&(typeof S.value<"u"||A.alwaysSet)&&(I[L.value]=S.value)}return{status:g.value,value:I}}}const ht=Object.freeze({status:"aborted"}),lo=v=>({status:"dirty",value:v}),Sr=v=>({status:"valid",value:v}),wd=v=>v.status==="aborted",Td=v=>v.status==="dirty",gs=v=>v.status==="valid",wl=v=>typeof Promise<"u"&&v instanceof Promise;function zu(v,g,b,I){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(v)}function Lf(v,g,b,I,A){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(v,b),b}typeof SuppressedError=="function"&&SuppressedError;var rt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(rt||(rt={}));var Tl,Ml;class Un{constructor(g,b,I,A){this._cachedPath=[],this.parent=g,this.data=b,this._path=I,this._key=A}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 Bf=(v,g)=>{if(gs(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new $r(v.common.issues);return this._error=b,this._error}}};function yt(v){if(!v)return{};const{errorMap:g,invalid_type_error:b,required_error:I,description:A}=v;if(g&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:A}:{errorMap:(S,o)=>{var he,pe;const{message:Ce}=v;return S.code==="invalid_enum_value"?{message:Ce??o.defaultError}:typeof o.data>"u"?{message:(he=Ce??I)!==null&&he!==void 0?he:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(pe=Ce??b)!==null&&pe!==void 0?pe:o.defaultError}},description:A}}class bt{get description(){return this._def.description}_getType(g){return oa(g.data)}_getOrReturnCtx(g,b){return b||{common:g.parent.common,data:g.data,parsedType:oa(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new pr,ctx:{common:g.parent.common,data:g.data,parsedType:oa(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const b=this._parse(g);if(wl(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(g){const b=this._parse(g);return Promise.resolve(b)}parse(g,b){const I=this.safeParse(g,b);if(I.success)return I.data;throw I.error}safeParse(g,b){var I;const A={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:oa(g)},L=this._parseSync({data:g,path:A.path,parent:A});return Bf(A,L)}"~validate"(g){var b,I;const A={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:oa(g)};if(!this["~standard"].async)try{const L=this._parseSync({data:g,path:[],parent:A});return gs(L)?{value:L.value}:{issues:A.common.issues}}catch(L){!((I=(b=L==null?void 0:L.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),A.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:A}).then(L=>gs(L)?{value:L.value}:{issues:A.common.issues})}async parseAsync(g,b){const I=await this.safeParseAsync(g,b);if(I.success)return I.data;throw I.error}async safeParseAsync(g,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:oa(g)},A=this._parse({data:g,path:I.path,parent:I}),L=await(wl(A)?A:Promise.resolve(A));return Bf(I,L)}refine(g,b){const I=A=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(A):b;return this._refinement((A,L)=>{const S=g(A),o=()=>L.addIssue({code:Oe.custom,...I(A)});return typeof Promise<"u"&&S instanceof Promise?S.then(he=>he?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,b){return this._refinement((I,A)=>g(I)?!0:(A.addIssue(typeof b=="function"?b(I,A):b),!1))}_refinement(g){return new xn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:b=>this["~validate"](b)}}optional(){return Gn.create(this,this._def)}nullable(){return Oa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yn.create(this)}promise(){return po.create(this,this._def)}or(g){return Il.create([this,g],this._def)}and(g){return El.create(this,g,this._def)}transform(g){return new xn({...yt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const b=typeof g=="function"?g:()=>g;return new Dl({...yt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Pd({typeName:ut.ZodBranded,type:this,...yt(this._def)})}catch(g){const b=typeof g=="function"?g:()=>g;return new Ll({...yt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(g){const b=this.constructor;return new b({...this._def,description:g})}pipe(g){return Bl.create(this,g)}readonly(){return Fl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ny=/^c[^\s-]{8,}$/i,ay=/^[0-9a-z]+$/,sy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ly=/^[a-z0-9_-]{21}$/i,cy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uy=/^[-+]?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)?)??$/,hy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Md;const py=/^(?:(?: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])$/,fy=/^(?:(?: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])$/,my=/^(([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]))$/,gy=/^(([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])$/,_y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ff="((\\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])))",xy=new RegExp(`^${Ff}$`);function Of(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const b=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${b}`}function vy(v){return new RegExp(`^${Of(v)}$`)}function jf(v){let g=`${Ff}T${Of(v)}`;const b=[];return b.push(v.local?"Z?":"Z"),v.offset&&b.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${b.join("|")})`,new RegExp(`^${g}$`)}function by(v,g){return!!((g==="v4"||!g)&&py.test(v)||(g==="v6"||!g)&&my.test(v))}function wy(v,g){if(!cy.test(v))return!1;try{const[b]=v.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),A=JSON.parse(atob(I));return!(typeof A!="object"||A===null||!A.typ||!A.alg||g&&A.alg!==g)}catch{return!1}}function Ty(v,g){return!!((g==="v4"||!g)&&fy.test(v)||(g==="v6"||!g)&&gy.test(v))}class _n extends bt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ke.string){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_type,expected:Ke.string,received:L.parsedType}),ht}const I=new pr;let A;for(const L of this._def.checks)if(L.kind==="min")g.data.length<L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_small,minimum:L.value,type:"string",inclusive:!0,exact:!1,message:L.message}),I.dirty());else if(L.kind==="max")g.data.length>L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_big,maximum:L.value,type:"string",inclusive:!0,exact:!1,message:L.message}),I.dirty());else if(L.kind==="length"){const S=g.data.length>L.value,o=g.data.length<L.value;(S||o)&&(A=this._getOrReturnCtx(g,A),S?He(A,{code:Oe.too_big,maximum:L.value,type:"string",inclusive:!0,exact:!0,message:L.message}):o&&He(A,{code:Oe.too_small,minimum:L.value,type:"string",inclusive:!0,exact:!0,message:L.message}),I.dirty())}else if(L.kind==="email")hy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"email",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="emoji")Md||(Md=new RegExp(dy,"u")),Md.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"emoji",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="uuid")oy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"uuid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="nanoid")ly.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"nanoid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="cuid")ny.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"cuid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="cuid2")ay.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"cuid2",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="ulid")sy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"ulid",code:Oe.invalid_string,message:L.message}),I.dirty());else if(L.kind==="url")try{new URL(g.data)}catch{A=this._getOrReturnCtx(g,A),He(A,{validation:"url",code:Oe.invalid_string,message:L.message}),I.dirty()}else L.kind==="regex"?(L.regex.lastIndex=0,L.regex.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"regex",code:Oe.invalid_string,message:L.message}),I.dirty())):L.kind==="trim"?g.data=g.data.trim():L.kind==="includes"?g.data.includes(L.value,L.position)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:{includes:L.value,position:L.position},message:L.message}),I.dirty()):L.kind==="toLowerCase"?g.data=g.data.toLowerCase():L.kind==="toUpperCase"?g.data=g.data.toUpperCase():L.kind==="startsWith"?g.data.startsWith(L.value)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:{startsWith:L.value},message:L.message}),I.dirty()):L.kind==="endsWith"?g.data.endsWith(L.value)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:{endsWith:L.value},message:L.message}),I.dirty()):L.kind==="datetime"?jf(L).test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:"datetime",message:L.message}),I.dirty()):L.kind==="date"?xy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:"date",message:L.message}),I.dirty()):L.kind==="time"?vy(L).test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.invalid_string,validation:"time",message:L.message}),I.dirty()):L.kind==="duration"?uy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"duration",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="ip"?by(g.data,L.version)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"ip",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="jwt"?wy(g.data,L.alg)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"jwt",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="cidr"?Ty(g.data,L.version)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"cidr",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="base64"?_y.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"base64",code:Oe.invalid_string,message:L.message}),I.dirty()):L.kind==="base64url"?yy.test(g.data)||(A=this._getOrReturnCtx(g,A),He(A,{validation:"base64url",code:Oe.invalid_string,message:L.message}),I.dirty()):kt.assertNever(L);return{status:I.value,value:g.data}}_regex(g,b,I){return this.refinement(A=>g.test(A),{validation:b,code:Oe.invalid_string,...rt.errToObj(I)})}_addCheck(g){return new _n({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...rt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...rt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...rt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...rt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...rt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...rt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...rt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...rt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...rt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...rt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...rt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...rt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...rt.errToObj(g)})}datetime(g){var b,I;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:(b=g==null?void 0:g.offset)!==null&&b!==void 0?b:!1,local:(I=g==null?void 0:g.local)!==null&&I!==void 0?I:!1,...rt.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,...rt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...rt.errToObj(g)})}regex(g,b){return this._addCheck({kind:"regex",regex:g,...rt.errToObj(b)})}includes(g,b){return this._addCheck({kind:"includes",value:g,position:b==null?void 0:b.position,...rt.errToObj(b==null?void 0:b.message)})}startsWith(g,b){return this._addCheck({kind:"startsWith",value:g,...rt.errToObj(b)})}endsWith(g,b){return this._addCheck({kind:"endsWith",value:g,...rt.errToObj(b)})}min(g,b){return this._addCheck({kind:"min",value:g,...rt.errToObj(b)})}max(g,b){return this._addCheck({kind:"max",value:g,...rt.errToObj(b)})}length(g,b){return this._addCheck({kind:"length",value:g,...rt.errToObj(b)})}nonempty(g){return this.min(1,rt.errToObj(g))}trim(){return new _n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new _n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new _n({...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 b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxLength(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}_n.create=v=>{var g;return new _n({checks:[],typeName:ut.ZodString,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};function My(v,g){const b=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,A=b>I?b:I,L=parseInt(v.toFixed(A).replace(".","")),S=parseInt(g.toFixed(A).replace(".",""));return L%S/Math.pow(10,A)}class La extends bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ke.number){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_type,expected:Ke.number,received:L.parsedType}),ht}let I;const A=new pr;for(const L of this._def.checks)L.kind==="int"?kt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.invalid_type,expected:"integer",received:"float",message:L.message}),A.dirty()):L.kind==="min"?(L.inclusive?g.data<L.value:g.data<=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_small,minimum:L.value,type:"number",inclusive:L.inclusive,exact:!1,message:L.message}),A.dirty()):L.kind==="max"?(L.inclusive?g.data>L.value:g.data>=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_big,maximum:L.value,type:"number",inclusive:L.inclusive,exact:!1,message:L.message}),A.dirty()):L.kind==="multipleOf"?My(g.data,L.value)!==0&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.not_multiple_of,multipleOf:L.value,message:L.message}),A.dirty()):L.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.not_finite,message:L.message}),A.dirty()):kt.assertNever(L);return{status:A.value,value:g.data}}gte(g,b){return this.setLimit("min",g,!0,rt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,rt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,rt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,rt.toString(b))}setLimit(g,b,I,A){return new La({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:rt.toString(A)}]})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:rt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:rt.toString(b)})}finite(g){return this._addCheck({kind:"finite",message:rt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(g)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&kt.isInteger(g.value))}get isFinite(){let g=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(b)&&Number.isFinite(g)}}La.create=v=>new La({checks:[],typeName:ut.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class Ba extends bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ke.bigint)return this._getInvalidInput(g);let I;const A=new pr;for(const L of this._def.checks)L.kind==="min"?(L.inclusive?g.data<L.value:g.data<=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_small,type:"bigint",minimum:L.value,inclusive:L.inclusive,message:L.message}),A.dirty()):L.kind==="max"?(L.inclusive?g.data>L.value:g.data>=L.value)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.too_big,type:"bigint",maximum:L.value,inclusive:L.inclusive,message:L.message}),A.dirty()):L.kind==="multipleOf"?g.data%L.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),He(I,{code:Oe.not_multiple_of,multipleOf:L.value,message:L.message}),A.dirty()):kt.assertNever(L);return{status:A.value,value:g.data}}_getInvalidInput(g){const b=this._getOrReturnCtx(g);return He(b,{code:Oe.invalid_type,expected:Ke.bigint,received:b.parsedType}),ht}gte(g,b){return this.setLimit("min",g,!0,rt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,rt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,rt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,rt.toString(b))}setLimit(g,b,I,A){return new Ba({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:rt.toString(A)}]})}_addCheck(g){return new Ba({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:rt.toString(b)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}Ba.create=v=>{var g;return new Ba({checks:[],typeName:ut.ZodBigInt,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};class Sl extends bt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ke.boolean){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.boolean,received:I.parsedType}),ht}return Sr(g.data)}}Sl.create=v=>new Sl({typeName:ut.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class _s extends bt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ke.date){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_type,expected:Ke.date,received:L.parsedType}),ht}if(isNaN(g.data.getTime())){const L=this._getOrReturnCtx(g);return He(L,{code:Oe.invalid_date}),ht}const I=new pr;let A;for(const L of this._def.checks)L.kind==="min"?g.data.getTime()<L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_small,message:L.message,inclusive:!0,exact:!1,minimum:L.value,type:"date"}),I.dirty()):L.kind==="max"?g.data.getTime()>L.value&&(A=this._getOrReturnCtx(g,A),He(A,{code:Oe.too_big,message:L.message,inclusive:!0,exact:!1,maximum:L.value,type:"date"}),I.dirty()):kt.assertNever(L);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new _s({...this._def,checks:[...this._def.checks,g]})}min(g,b){return this._addCheck({kind:"min",value:g.getTime(),message:rt.toString(b)})}max(g,b){return this._addCheck({kind:"max",value:g.getTime(),message:rt.toString(b)})}get minDate(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g!=null?new Date(g):null}}_s.create=v=>new _s({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ut.ZodDate,...yt(v)});class Au extends bt{_parse(g){if(this._getType(g)!==Ke.symbol){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.symbol,received:I.parsedType}),ht}return Sr(g.data)}}Au.create=v=>new Au({typeName:ut.ZodSymbol,...yt(v)});class Pl extends bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.undefined,received:I.parsedType}),ht}return Sr(g.data)}}Pl.create=v=>new Pl({typeName:ut.ZodUndefined,...yt(v)});class Cl extends bt{_parse(g){if(this._getType(g)!==Ke.null){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.null,received:I.parsedType}),ht}return Sr(g.data)}}Cl.create=v=>new Cl({typeName:ut.ZodNull,...yt(v)});class co extends bt{constructor(){super(...arguments),this._any=!0}_parse(g){return Sr(g.data)}}co.create=v=>new co({typeName:ut.ZodAny,...yt(v)});class ys extends bt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Sr(g.data)}}ys.create=v=>new ys({typeName:ut.ZodUnknown,...yt(v)});class la extends bt{_parse(g){const b=this._getOrReturnCtx(g);return He(b,{code:Oe.invalid_type,expected:Ke.never,received:b.parsedType}),ht}}la.create=v=>new la({typeName:ut.ZodNever,...yt(v)});class Ru extends bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.void,received:I.parsedType}),ht}return Sr(g.data)}}Ru.create=v=>new Ru({typeName:ut.ZodVoid,...yt(v)});class yn extends bt{_parse(g){const{ctx:b,status:I}=this._processInputParams(g),A=this._def;if(b.parsedType!==Ke.array)return He(b,{code:Oe.invalid_type,expected:Ke.array,received:b.parsedType}),ht;if(A.exactLength!==null){const S=b.data.length>A.exactLength.value,o=b.data.length<A.exactLength.value;(S||o)&&(He(b,{code:S?Oe.too_big:Oe.too_small,minimum:o?A.exactLength.value:void 0,maximum:S?A.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:A.exactLength.message}),I.dirty())}if(A.minLength!==null&&b.data.length<A.minLength.value&&(He(b,{code:Oe.too_small,minimum:A.minLength.value,type:"array",inclusive:!0,exact:!1,message:A.minLength.message}),I.dirty()),A.maxLength!==null&&b.data.length>A.maxLength.value&&(He(b,{code:Oe.too_big,maximum:A.maxLength.value,type:"array",inclusive:!0,exact:!1,message:A.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>A.type._parseAsync(new Un(b,S,b.path,o)))).then(S=>pr.mergeArray(I,S));const L=[...b.data].map((S,o)=>A.type._parseSync(new Un(b,S,b.path,o)));return pr.mergeArray(I,L)}get element(){return this._def.type}min(g,b){return new yn({...this._def,minLength:{value:g,message:rt.toString(b)}})}max(g,b){return new yn({...this._def,maxLength:{value:g,message:rt.toString(b)}})}length(g,b){return new yn({...this._def,exactLength:{value:g,message:rt.toString(b)}})}nonempty(g){return this.min(1,g)}}yn.create=(v,g)=>new yn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...yt(g)});function uo(v){if(v instanceof yi){const g={};for(const b in v.shape){const I=v.shape[b];g[b]=Gn.create(uo(I))}return new yi({...v._def,shape:()=>g})}else return v instanceof yn?new yn({...v._def,type:uo(v.element)}):v instanceof Gn?Gn.create(uo(v.unwrap())):v instanceof Oa?Oa.create(uo(v.unwrap())):v instanceof $n?$n.create(v.items.map(g=>uo(g))):v}class yi extends bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),b=kt.objectKeys(g);return this._cached={shape:g,keys:b}}_parse(g){if(this._getType(g)!==Ke.object){const pe=this._getOrReturnCtx(g);return He(pe,{code:Oe.invalid_type,expected:Ke.object,received:pe.parsedType}),ht}const{status:I,ctx:A}=this._processInputParams(g),{shape:L,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof la&&this._def.unknownKeys==="strip"))for(const pe in A.data)S.includes(pe)||o.push(pe);const he=[];for(const pe of S){const Ce=L[pe],Le=A.data[pe];he.push({key:{status:"valid",value:pe},value:Ce._parse(new Un(A,Le,A.path,pe)),alwaysSet:pe in A.data})}if(this._def.catchall instanceof la){const pe=this._def.unknownKeys;if(pe==="passthrough")for(const Ce of o)he.push({key:{status:"valid",value:Ce},value:{status:"valid",value:A.data[Ce]}});else if(pe==="strict")o.length>0&&(He(A,{code:Oe.unrecognized_keys,keys:o}),I.dirty());else if(pe!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const pe=this._def.catchall;for(const Ce of o){const Le=A.data[Ce];he.push({key:{status:"valid",value:Ce},value:pe._parse(new Un(A,Le,A.path,Ce)),alwaysSet:Ce in A.data})}}return A.common.async?Promise.resolve().then(async()=>{const pe=[];for(const Ce of he){const Le=await Ce.key,Ie=await Ce.value;pe.push({key:Le,value:Ie,alwaysSet:Ce.alwaysSet})}return pe}).then(pe=>pr.mergeObjectSync(I,pe)):pr.mergeObjectSync(I,he)}get shape(){return this._def.shape()}strict(g){return rt.errToObj,new yi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(b,I)=>{var A,L,S,o;const he=(S=(L=(A=this._def).errorMap)===null||L===void 0?void 0:L.call(A,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=rt.errToObj(g).message)!==null&&o!==void 0?o:he}:{message:he}}}:{}})}strip(){return new yi({...this._def,unknownKeys:"strip"})}passthrough(){return new yi({...this._def,unknownKeys:"passthrough"})}extend(g){return new yi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new yi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,b){return this.augment({[g]:b})}catchall(g){return new yi({...this._def,catchall:g})}pick(g){const b={};return kt.objectKeys(g).forEach(I=>{g[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new yi({...this._def,shape:()=>b})}omit(g){const b={};return kt.objectKeys(this.shape).forEach(I=>{g[I]||(b[I]=this.shape[I])}),new yi({...this._def,shape:()=>b})}deepPartial(){return uo(this)}partial(g){const b={};return kt.objectKeys(this.shape).forEach(I=>{const A=this.shape[I];g&&!g[I]?b[I]=A:b[I]=A.optional()}),new yi({...this._def,shape:()=>b})}required(g){const b={};return kt.objectKeys(this.shape).forEach(I=>{if(g&&!g[I])b[I]=this.shape[I];else{let L=this.shape[I];for(;L instanceof Gn;)L=L._def.innerType;b[I]=L}}),new yi({...this._def,shape:()=>b})}keyof(){return Nf(kt.objectKeys(this.shape))}}yi.create=(v,g)=>new yi({shape:()=>v,unknownKeys:"strip",catchall:la.create(),typeName:ut.ZodObject,...yt(g)}),yi.strictCreate=(v,g)=>new yi({shape:()=>v,unknownKeys:"strict",catchall:la.create(),typeName:ut.ZodObject,...yt(g)}),yi.lazycreate=(v,g)=>new yi({shape:v,unknownKeys:"strip",catchall:la.create(),typeName:ut.ZodObject,...yt(g)});class Il extends bt{_parse(g){const{ctx:b}=this._processInputParams(g),I=this._def.options;function A(L){for(const o of L)if(o.result.status==="valid")return o.result;for(const o of L)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=L.map(o=>new $r(o.ctx.common.issues));return He(b,{code:Oe.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async L=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await L._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(A);{let L;const S=[];for(const he of I){const pe={...b,common:{...b.common,issues:[]},parent:null},Ce=he._parseSync({data:b.data,path:b.path,parent:pe});if(Ce.status==="valid")return Ce;Ce.status==="dirty"&&!L&&(L={result:Ce,ctx:pe}),pe.common.issues.length&&S.push(pe.common.issues)}if(L)return b.common.issues.push(...L.ctx.common.issues),L.result;const o=S.map(he=>new $r(he));return He(b,{code:Oe.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Il.create=(v,g)=>new Il({options:v,typeName:ut.ZodUnion,...yt(g)});const ca=v=>v instanceof zl?ca(v.schema):v instanceof xn?ca(v.innerType()):v instanceof Al?[v.value]:v instanceof Fa?v.options:v instanceof Rl?kt.objectValues(v.enum):v instanceof Dl?ca(v._def.innerType):v instanceof Pl?[void 0]:v instanceof Cl?[null]:v instanceof Gn?[void 0,...ca(v.unwrap())]:v instanceof Oa?[null,...ca(v.unwrap())]:v instanceof Pd||v instanceof Fl?ca(v.unwrap()):v instanceof Ll?ca(v._def.innerType):[];class Du extends bt{_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Ke.object)return He(b,{code:Oe.invalid_type,expected:Ke.object,received:b.parsedType}),ht;const I=this.discriminator,A=b.data[I],L=this.optionsMap.get(A);return L?b.common.async?L._parseAsync({data:b.data,path:b.path,parent:b}):L._parseSync({data:b.data,path:b.path,parent:b}):(He(b,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,b,I){const A=new Map;for(const L of b){const S=ca(L.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const o of S){if(A.has(o))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(o)}`);A.set(o,L)}}return new Du({typeName:ut.ZodDiscriminatedUnion,discriminator:g,options:b,optionsMap:A,...yt(I)})}}function Sd(v,g){const b=oa(v),I=oa(g);if(v===g)return{valid:!0,data:v};if(b===Ke.object&&I===Ke.object){const A=kt.objectKeys(g),L=kt.objectKeys(v).filter(o=>A.indexOf(o)!==-1),S={...v,...g};for(const o of L){const he=Sd(v[o],g[o]);if(!he.valid)return{valid:!1};S[o]=he.data}return{valid:!0,data:S}}else if(b===Ke.array&&I===Ke.array){if(v.length!==g.length)return{valid:!1};const A=[];for(let L=0;L<v.length;L++){const S=v[L],o=g[L],he=Sd(S,o);if(!he.valid)return{valid:!1};A.push(he.data)}return{valid:!0,data:A}}else return b===Ke.date&&I===Ke.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class El extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g),A=(L,S)=>{if(wd(L)||wd(S))return ht;const o=Sd(L.value,S.value);return o.valid?((Td(L)||Td(S))&&b.dirty(),{status:b.value,value:o.data}):(He(I,{code:Oe.invalid_intersection_types}),ht)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([L,S])=>A(L,S)):A(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}El.create=(v,g,b)=>new El({left:v,right:g,typeName:ut.ZodIntersection,...yt(b)});class $n extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.array)return He(I,{code:Oe.invalid_type,expected:Ke.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return He(I,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(He(I,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const L=[...I.data].map((S,o)=>{const he=this._def.items[o]||this._def.rest;return he?he._parse(new Un(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(L).then(S=>pr.mergeArray(b,S)):pr.mergeArray(b,L)}get items(){return this._def.items}rest(g){return new $n({...this._def,rest:g})}}$n.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:v,typeName:ut.ZodTuple,rest:null,...yt(g)})};class kl extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.object)return He(I,{code:Oe.invalid_type,expected:Ke.object,received:I.parsedType}),ht;const A=[],L=this._def.keyType,S=this._def.valueType;for(const o in I.data)A.push({key:L._parse(new Un(I,o,I.path,o)),value:S._parse(new Un(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?pr.mergeObjectAsync(b,A):pr.mergeObjectSync(b,A)}get element(){return this._def.valueType}static create(g,b,I){return b instanceof bt?new kl({keyType:g,valueType:b,typeName:ut.ZodRecord,...yt(I)}):new kl({keyType:_n.create(),valueType:g,typeName:ut.ZodRecord,...yt(b)})}}class Lu extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.map)return He(I,{code:Oe.invalid_type,expected:Ke.map,received:I.parsedType}),ht;const A=this._def.keyType,L=this._def.valueType,S=[...I.data.entries()].map(([o,he],pe)=>({key:A._parse(new Un(I,o,I.path,[pe,"key"])),value:L._parse(new Un(I,he,I.path,[pe,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const he of S){const pe=await he.key,Ce=await he.value;if(pe.status==="aborted"||Ce.status==="aborted")return ht;(pe.status==="dirty"||Ce.status==="dirty")&&b.dirty(),o.set(pe.value,Ce.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const he of S){const pe=he.key,Ce=he.value;if(pe.status==="aborted"||Ce.status==="aborted")return ht;(pe.status==="dirty"||Ce.status==="dirty")&&b.dirty(),o.set(pe.value,Ce.value)}return{status:b.value,value:o}}}}Lu.create=(v,g,b)=>new Lu({valueType:g,keyType:v,typeName:ut.ZodMap,...yt(b)});class xs extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.set)return He(I,{code:Oe.invalid_type,expected:Ke.set,received:I.parsedType}),ht;const A=this._def;A.minSize!==null&&I.data.size<A.minSize.value&&(He(I,{code:Oe.too_small,minimum:A.minSize.value,type:"set",inclusive:!0,exact:!1,message:A.minSize.message}),b.dirty()),A.maxSize!==null&&I.data.size>A.maxSize.value&&(He(I,{code:Oe.too_big,maximum:A.maxSize.value,type:"set",inclusive:!0,exact:!1,message:A.maxSize.message}),b.dirty());const L=this._def.valueType;function S(he){const pe=new Set;for(const Ce of he){if(Ce.status==="aborted")return ht;Ce.status==="dirty"&&b.dirty(),pe.add(Ce.value)}return{status:b.value,value:pe}}const o=[...I.data.values()].map((he,pe)=>L._parse(new Un(I,he,I.path,pe)));return I.common.async?Promise.all(o).then(he=>S(he)):S(o)}min(g,b){return new xs({...this._def,minSize:{value:g,message:rt.toString(b)}})}max(g,b){return new xs({...this._def,maxSize:{value:g,message:rt.toString(b)}})}size(g,b){return this.min(g,b).max(g,b)}nonempty(g){return this.min(1,g)}}xs.create=(v,g)=>new xs({valueType:v,minSize:null,maxSize:null,typeName:ut.ZodSet,...yt(g)});class ho extends bt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Ke.function)return He(b,{code:Oe.invalid_type,expected:Ke.function,received:b.parsedType}),ht;function I(o,he){return ku({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),oo].filter(pe=>!!pe),issueData:{code:Oe.invalid_arguments,argumentsError:he}})}function A(o,he){return ku({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),oo].filter(pe=>!!pe),issueData:{code:Oe.invalid_return_type,returnTypeError:he}})}const L={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof po){const o=this;return Sr(async function(...he){const pe=new $r([]),Ce=await o._def.args.parseAsync(he,L).catch(oe=>{throw pe.addIssue(I(he,oe)),pe}),Le=await Reflect.apply(S,this,Ce);return await o._def.returns._def.type.parseAsync(Le,L).catch(oe=>{throw pe.addIssue(A(Le,oe)),pe})})}else{const o=this;return Sr(function(...he){const pe=o._def.args.safeParse(he,L);if(!pe.success)throw new $r([I(he,pe.error)]);const Ce=Reflect.apply(S,this,pe.data),Le=o._def.returns.safeParse(Ce,L);if(!Le.success)throw new $r([A(Ce,Le.error)]);return Le.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new ho({...this._def,args:$n.create(g).rest(ys.create())})}returns(g){return new ho({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,b,I){return new ho({args:g||$n.create([]).rest(ys.create()),returns:b||ys.create(),typeName:ut.ZodFunction,...yt(I)})}}class zl extends bt{get schema(){return this._def.getter()}_parse(g){const{ctx:b}=this._processInputParams(g);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}zl.create=(v,g)=>new zl({getter:v,typeName:ut.ZodLazy,...yt(g)});class Al extends bt{_parse(g){if(g.data!==this._def.value){const b=this._getOrReturnCtx(g);return He(b,{received:b.data,code:Oe.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:g.data}}get value(){return this._def.value}}Al.create=(v,g)=>new Al({value:v,typeName:ut.ZodLiteral,...yt(g)});function Nf(v,g){return new Fa({values:v,typeName:ut.ZodEnum,...yt(g)})}class Fa extends bt{constructor(){super(...arguments),Tl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const b=this._getOrReturnCtx(g),I=this._def.values;return He(b,{expected:kt.joinValues(I),received:b.parsedType,code:Oe.invalid_type}),ht}if(zu(this,Tl)||Lf(this,Tl,new Set(this._def.values)),!zu(this,Tl).has(g.data)){const b=this._getOrReturnCtx(g),I=this._def.values;return He(b,{received:b.data,code:Oe.invalid_enum_value,options:I}),ht}return Sr(g.data)}get options(){return this._def.values}get enum(){const g={};for(const b of this._def.values)g[b]=b;return g}get Values(){const g={};for(const b of this._def.values)g[b]=b;return g}get Enum(){const g={};for(const b of this._def.values)g[b]=b;return g}extract(g,b=this._def){return Fa.create(g,{...this._def,...b})}exclude(g,b=this._def){return Fa.create(this.options.filter(I=>!g.includes(I)),{...this._def,...b})}}Tl=new WeakMap,Fa.create=Nf;class Rl extends bt{constructor(){super(...arguments),Ml.set(this,void 0)}_parse(g){const b=kt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Ke.string&&I.parsedType!==Ke.number){const A=kt.objectValues(b);return He(I,{expected:kt.joinValues(A),received:I.parsedType,code:Oe.invalid_type}),ht}if(zu(this,Ml)||Lf(this,Ml,new Set(kt.getValidEnumValues(this._def.values))),!zu(this,Ml).has(g.data)){const A=kt.objectValues(b);return He(I,{received:I.data,code:Oe.invalid_enum_value,options:A}),ht}return Sr(g.data)}get enum(){return this._def.values}}Ml=new WeakMap,Rl.create=(v,g)=>new Rl({values:v,typeName:ut.ZodNativeEnum,...yt(g)});class po extends bt{unwrap(){return this._def.type}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Ke.promise&&b.common.async===!1)return He(b,{code:Oe.invalid_type,expected:Ke.promise,received:b.parsedType}),ht;const I=b.parsedType===Ke.promise?b.data:Promise.resolve(b.data);return Sr(I.then(A=>this._def.type.parseAsync(A,{path:b.path,errorMap:b.common.contextualErrorMap})))}}po.create=(v,g)=>new po({type:v,typeName:ut.ZodPromise,...yt(g)});class xn extends bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:b,ctx:I}=this._processInputParams(g),A=this._def.effect||null,L={addIssue:S=>{He(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(L.addIssue=L.addIssue.bind(L),A.type==="preprocess"){const S=A.transform(I.data,L);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const he=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return he.status==="aborted"?ht:he.status==="dirty"||b.value==="dirty"?lo(he.value):he});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?lo(o.value):o}}if(A.type==="refinement"){const S=o=>{const he=A.refinement(o,L);if(I.common.async)return Promise.resolve(he);if(he instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(A.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!gs(S))return S;const o=A.transform(S.value,L);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>gs(S)?Promise.resolve(A.transform(S.value,L)).then(o=>({status:b.value,value:o})):S);kt.assertNever(A)}}xn.create=(v,g,b)=>new xn({schema:v,typeName:ut.ZodEffects,effect:g,...yt(b)}),xn.createWithPreprocess=(v,g,b)=>new xn({schema:g,effect:{type:"preprocess",transform:v},typeName:ut.ZodEffects,...yt(b)});class Gn extends bt{_parse(g){return this._getType(g)===Ke.undefined?Sr(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Gn.create=(v,g)=>new Gn({innerType:v,typeName:ut.ZodOptional,...yt(g)});class Oa extends bt{_parse(g){return this._getType(g)===Ke.null?Sr(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Oa.create=(v,g)=>new Oa({innerType:v,typeName:ut.ZodNullable,...yt(g)});class Dl extends bt{_parse(g){const{ctx:b}=this._processInputParams(g);let I=b.data;return b.parsedType===Ke.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Dl.create=(v,g)=>new Dl({innerType:v,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...yt(g)});class Ll extends bt{_parse(g){const{ctx:b}=this._processInputParams(g),I={...b,common:{...b.common,issues:[]}},A=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return wl(A)?A.then(L=>({status:"valid",value:L.status==="valid"?L.value:this._def.catchValue({get error(){return new $r(I.common.issues)},input:I.data})})):{status:"valid",value:A.status==="valid"?A.value:this._def.catchValue({get error(){return new $r(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ll.create=(v,g)=>new Ll({innerType:v,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...yt(g)});class Bu extends bt{_parse(g){if(this._getType(g)!==Ke.nan){const I=this._getOrReturnCtx(g);return He(I,{code:Oe.invalid_type,expected:Ke.nan,received:I.parsedType}),ht}return{status:"valid",value:g.data}}}Bu.create=v=>new Bu({typeName:ut.ZodNaN,...yt(v)});const Sy=Symbol("zod_brand");class Pd extends bt{_parse(g){const{ctx:b}=this._processInputParams(g),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class Bl extends bt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const L=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return L.status==="aborted"?ht:L.status==="dirty"?(b.dirty(),lo(L.value)):this._def.out._parseAsync({data:L.value,path:I.path,parent:I})})();{const A=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return A.status==="aborted"?ht:A.status==="dirty"?(b.dirty(),{status:"dirty",value:A.value}):this._def.out._parseSync({data:A.value,path:I.path,parent:I})}}static create(g,b){return new Bl({in:g,out:b,typeName:ut.ZodPipeline})}}class Fl extends bt{_parse(g){const b=this._def.innerType._parse(g),I=A=>(gs(A)&&(A.value=Object.freeze(A.value)),A);return wl(b)?b.then(A=>I(A)):I(b)}unwrap(){return this._def.innerType}}Fl.create=(v,g)=>new Fl({innerType:v,typeName:ut.ZodReadonly,...yt(g)});function Zf(v,g){const b=typeof v=="function"?v(g):typeof v=="string"?{message:v}:v;return typeof b=="string"?{message:b}:b}function Vf(v,g={},b){return v?co.create().superRefine((I,A)=>{var L,S;const o=v(I);if(o instanceof Promise)return o.then(he=>{var pe,Ce;if(!he){const Le=Zf(g,I),Ie=(Ce=(pe=Le.fatal)!==null&&pe!==void 0?pe:b)!==null&&Ce!==void 0?Ce:!0;A.addIssue({code:"custom",...Le,fatal:Ie})}});if(!o){const he=Zf(g,I),pe=(S=(L=he.fatal)!==null&&L!==void 0?L:b)!==null&&S!==void 0?S:!0;A.addIssue({code:"custom",...he,fatal:pe})}}):co.create()}const Py={object:yi.lazycreate};var ut;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ut||(ut={}));const Cy=(v,g={message:`Input not instance of ${v.name}`})=>Vf(b=>b instanceof v,g),Uf=_n.create,$f=La.create,Iy=Bu.create,Ey=Ba.create,Gf=Sl.create,ky=_s.create,zy=Au.create,Ay=Pl.create,Ry=Cl.create,Dy=co.create,Ly=ys.create,By=la.create,Fy=Ru.create,Oy=yn.create,jy=yi.create,Ny=yi.strictCreate,Zy=Il.create,Vy=Du.create,Uy=El.create,$y=$n.create,Gy=kl.create,qy=Lu.create,Hy=xs.create,Wy=ho.create,Xy=zl.create,Ky=Al.create,Yy=Fa.create,Jy=Rl.create,Qy=po.create,qf=xn.create,ex=Gn.create,tx=Oa.create,ix=xn.createWithPreprocess,rx=Bl.create;var ot=Object.freeze({__proto__:null,defaultErrorMap:oo,setErrorMap:iy,getErrorMap:Eu,makeIssue:ku,EMPTY_PATH:ry,addIssueToContext:He,ParseStatus:pr,INVALID:ht,DIRTY:lo,OK:Sr,isAborted:wd,isDirty:Td,isValid:gs,isAsync:wl,get util(){return kt},get objectUtil(){return bd},ZodParsedType:Ke,getParsedType:oa,ZodType:bt,datetimeRegex:jf,ZodString:_n,ZodNumber:La,ZodBigInt:Ba,ZodBoolean:Sl,ZodDate:_s,ZodSymbol:Au,ZodUndefined:Pl,ZodNull:Cl,ZodAny:co,ZodUnknown:ys,ZodNever:la,ZodVoid:Ru,ZodArray:yn,ZodObject:yi,ZodUnion:Il,ZodDiscriminatedUnion:Du,ZodIntersection:El,ZodTuple:$n,ZodRecord:kl,ZodMap:Lu,ZodSet:xs,ZodFunction:ho,ZodLazy:zl,ZodLiteral:Al,ZodEnum:Fa,ZodNativeEnum:Rl,ZodPromise:po,ZodEffects:xn,ZodTransformer:xn,ZodOptional:Gn,ZodNullable:Oa,ZodDefault:Dl,ZodCatch:Ll,ZodNaN:Bu,BRAND:Sy,ZodBranded:Pd,ZodPipeline:Bl,ZodReadonly:Fl,custom:Vf,Schema:bt,ZodSchema:bt,late:Py,get ZodFirstPartyTypeKind(){return ut},coerce:{string:v=>_n.create({...v,coerce:!0}),number:v=>La.create({...v,coerce:!0}),boolean:v=>Sl.create({...v,coerce:!0}),bigint:v=>Ba.create({...v,coerce:!0}),date:v=>_s.create({...v,coerce:!0})},any:Dy,array:Oy,bigint:Ey,boolean:Gf,date:ky,discriminatedUnion:Vy,effect:qf,enum:Yy,function:Wy,instanceof:Cy,intersection:Uy,lazy:Xy,literal:Ky,map:qy,nan:Iy,nativeEnum:Jy,never:By,null:Ry,nullable:tx,number:$f,object:jy,oboolean:()=>Gf().optional(),onumber:()=>$f().optional(),optional:ex,ostring:()=>Uf().optional(),pipeline:rx,preprocess:ix,promise:Qy,record:Gy,set:Hy,strictObject:Ny,string:Uf,symbol:zy,transformer:qf,tuple:$y,undefined:Ay,union:Zy,unknown:Ly,void:Fy,NEVER:ht,ZodIssueCode:Oe,quotelessJson:ty,ZodError:$r});const Fu=ot.object({lat:ot.number(),lng:ot.number()}),nx=ot.object({center:Fu,zoom:ot.number()}),ax=ot.object({sw:Fu,ne:Fu}),sx=ot.object({name:ot.literal("dark").or(ot.literal("light")),url:ot.string().optional(),colors:ot.object({primary:ot.string().max(64),background:ot.string().max(64),text:ot.string().max(64)})}),ox=ot.object({container:ot.string(),position:ot.object({center:ot.object({lat:ot.number(),lng:ot.number()}),zoom:ot.number()}),restriction:ot.object({minZoom:ot.number().min(yd).max(bl).optional(),maxZoom:ot.number().min(yd).max(bl).optional(),maxBounds:ax.optional()}).optional(),style:sx});ot.enum(["idle","move","click","popup_click"]);const lx=ot.function().returns(ot.void()),cx=ot.function().args(nx).returns(ot.void()),ux=ot.function().args(Fu).returns(ot.void()),hx={idle:lx,move:cx,click:ux},Hf=ot.object({id:ot.string(),rank:ot.number(),lat:ot.number(),lng:ot.number(),width:ot.number(),height:ot.number()}),dx=ot.tuple([ot.number(),ot.array(ot.tuple([ot.number(),ot.number()]))]),Wf=ot.function().args(ot.string()).returns(ot.promise(ot.any())),px=ot.object({data:Hf,state:dx,content:ot.object({bodyCallback:Wf,pinCallback:Wf.optional()})}),fx=ot.array(px);ot.object({apiKey:ot.string(),data:ot.array(Hf),minZoom:ot.number().optional(),maxZoom:ot.number().optional()});var mx=ld('<div class="container svelte-7b10cl"><div class="map svelte-7b10cl"></div> <div class="logo svelte-7b10cl"><a href="https://arenarium.dev" target="_blank" class="svelte-7b10cl">@arenarium/maps</a></div></div>');function Xf(v,g){mu(g,!0);let b,I,A,L,S,o=dr(0),he=dr(0),pe=dr(!1),Ce=dr(void 0);Pf(()=>{ox.parse(g.options),Le(),Ie()});function Le(){var Ee,Je,$e;A=((Ee=g.options.restriction)==null?void 0:Ee.minZoom)??yd,L=((Je=g.options.restriction)==null?void 0:Je.maxZoom)??bl,S=($e=g.options.restriction)==null?void 0:$e.maxBounds,b=new vd.Map({style:Br(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Zt(A),maxZoom:L,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function Ie(){b.on("load",oe),b.on("move",Ve),b.on("idle",Bt),b.on("click",ri),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function oe(){Si(pe,!0)}function Ve(){const Ee=b.getCenter(),Je=b.getZoom();ni("move",{center:Ee,zoom:Je});const $e=b.getBounds();Si(Ce,{sw:{lat:$e.getSouthWest().lat,lng:$e.getSouthWest().lng},ne:{lat:$e.getNorthEast().lat,lng:$e.getNorthEast().lng}},!0)}function Bt(){ni("idle",null);const Ee=b.getBounds();Si(Ce,{sw:{lat:Ee.getSouthWest().lat,lng:Ee.getSouthWest().lng},ne:{lat:Ee.getNorthEast().lat,lng:Ee.getNorthEast().lng}},!0)}function ri(Ee){ni("click",{lat:Ee.lngLat.lat,lng:Ee.lngLat.lng})}const Ft=new Map;function oi(Ee,Je){var Gt;const $e=hx[Ee];if(!$e)throw new Error(`No schema defined for event ${Ee}`);if(!$e.safeParse(Je).success)throw new Error(`Invalid handler for event ${Ee}`);Ft.has(Ee)||Ft.set(Ee,new Set),(Gt=Ft.get(Ee))==null||Gt.add(Je)}function Oi(Ee,Je){const $e=Ft.get(Ee);$e&&$e.delete(Je)&&$e.size===0&&Ft.delete(Ee)}function ni(Ee,Je){const $e=Ft.get(Ee);$e&&$e.size>0&&[...$e].forEach(ft=>{try{ft(Je)}catch(Gt){console.error(Gt)}})}function Zt(Ee){const Je=Ef,$e=Math.ceil(Math.log2(_t(o)/Je));return Math.max(Ee,$e)}function Ot(){const Ee=b.getCenter();return Ee?{lat:Ee.lat,lng:Ee.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function Wi(){return b.getZoom()??g.options.position.zoom}function Et(){if(!b)throw new Error("Map not loaded!");const Ee=b.getBounds();return{sw:{lat:Ee.getSouthWest().lat,lng:Ee.getSouthWest().lng},ne:{lat:Ee.getNorthEast().lat,lng:Ee.getNorthEast().lng}}}function nr(Ee){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ee)}function qn(Ee){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ee)}function Lr(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function ji(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function Xi(Ee){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");A=Ee,b.setMinZoom(Zt(Ee))}function xi(Ee){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");L=Ee,b.setMaxZoom(Ee)}function Pr(Ee){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ee,b.setMaxBounds([Ee.sw.lng,Ee.sw.lat,Ee.ne.lng,Ee.ne.lat])}let Ni=dr(ds(g.options.style));sa(()=>{_t(pe)&&b.setStyle(Br(_t(Ni)),{diff:!0})});function Br(Ee){if(Ee.url)return Ee.url;switch(Ee.name){case"light":return ey;case"dark":return Q_}}function Qe(){return Qg(_t(Ni))}function pi(Ee){Si(Ni,Ee,!0),b.setStyle(Br(_t(Ni)),{diff:!0})}class fi{constructor(Je){$t(this,"id");$t(this,"lat");$t(this,"lng");$t(this,"zoom");$t(this,"element");$t(this,"component");$t(this,"libreMarker");this.id=Je.data.id,this.lat=Je.data.lat,this.lng=Je.data.lng,this.zoom=Je.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Je=this.element;if(!Je)throw new Error("Failed to create libre marker");const $e=new vd.Marker({element:Je});$e.setLngLat([this.lng,this.lat]),this.libreMarker=$e}isCreated(){return this.element!=null}isInBlock(Je,$e){return this.zoom<=Je&&$e.contains(this.lat,this.lng)}}class Cr extends fi{constructor($e){super($e);$t(this,"pinLoading",!1);$t(this,"pinLoaded",!1);$t(this,"pinContentCallback");this.pinContentCallback=$e.content.pinCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=ud(W_,{target:this.element}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const $e=this.element;if(!$e)return;const ft=Math.round((bl-this.zoom)*kf);$e.style.zIndex=ft.toString()}updateMap($e){if(this.libreMarker==null)throw new Error("Failed to update circle map");this.libreMarker._map!=$e&&($e?this.libreMarker.addTo($e):this.libreMarker.remove())}updateState($e){const ft=this.component;if(!ft)throw new Error("Failed to update circle state");if(this.zoom<=$e)ft.setScale(0);else{const or=1-(this.zoom-$e)/zf*.5;ft.setScale(or)}}updatePin(){var ft;if(this.pinContentCallback==null||this.pinLoaded||this.pinLoading)return;const $e=(ft=this.component)==null?void 0:ft.getPin();$e!=null&&(this.pinLoading=!0,this.pinContentCallback(this.id).then(Gt=>{$e.appendChild(Gt),this.pinLoaded=!0,this.pinLoading=!1}))}isPinLoaded(){return this.pinContentCallback==null||this.pinLoaded}}class ki extends fi{constructor($e){super($e);$t(this,"width");$t(this,"height");$t(this,"angles");$t(this,"bodyLoading",!1);$t(this,"bodyLoaded",!1);$t(this,"bodyContentCallback");this.id=$e.data.id,this.angles=$e.state[1],this.width=$e.data.width,this.height=$e.data.height,this.bodyContentCallback=$e.content.bodyCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=ud(q_,{target:this.element,props:{width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const $e=this.element;if(!$e)return;const ft=Math.round((bl-this.zoom)*kf)+Number.MAX_SAFE_INTEGER/2;$e.style.zIndex=ft.toString()}updateMap($e){const ft=this.libreMarker,Gt=this.component;if(ft==null||Gt==null)throw new Error("Failed to update marker map");ft._map!=$e&&($e?(ft.addTo($e),Gt.setDisplayed(!0)):(ft.remove(),Gt.setDisplayed(!1)))}updateState($e){const ft=this.component;if(!ft)throw new Error("Failed to update marker state");this.zoom<=$e?(ft.setCollapsed(!1),ft.setAngle(this.getAngle($e))):ft.setCollapsed(!0)}updateBody(){var ft;if(this.bodyLoaded||this.bodyLoading)return;const $e=(ft=this.component)==null?void 0:ft.getBody();$e!=null&&(this.bodyLoading=!0,this.bodyContentCallback(this.id).then(Gt=>{$e.appendChild(Gt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle($e){let ft=this.angles,Gt=ft[0],or=0;for(;Gt[0]<$e&&(or++,or!=ft.length);)Gt=ft[or];return Gt[1]}getExpanded(){return this.component?this.component.getExpanded():!1}getCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class vn{constructor(Je){$t(this,"id");$t(this,"rank");$t(this,"lat");$t(this,"lng");$t(this,"zoom");$t(this,"circle");$t(this,"marker");this.id=Je.data.id,this.rank=Je.data.rank,this.lat=Je.data.lat,this.lng=Je.data.lng,this.zoom=Je.state[0],this.circle=new Cr(Je),this.marker=new ki(Je)}}let Zi,Vt=new Array,Ki=new Map,Yi=Ef,bn=Xp(()=>_t(Ce)?new Rf(b,-512,_t(he)+Yi,_t(o)+Yi,-512):void 0),nn=Xp(()=>_t(Ce)?new Rf(b,0,_t(he),_t(o),0):void 0);Pf(()=>{const Ee=()=>{ha(),Zi=window.setTimeout(Ee,25)};return Ee(),()=>clearInterval(Zi)});function ha(){if(_t(pe)==!1||_t(nn)==null||_t(bn)==null||Vt.length==0)return;const Ee=b.getZoom();if(Ee)for(const Je of Vt)ar(Je.circle,Ee,_t(nn)),sr(Je.marker,Ee,_t(bn))}function ar(Ee,Je,$e){Ee.isInBlock(Je+zf,$e)?(Ee.isCreated()==!1&&Ee.createElement(),Ee.updateMap(b),Ee.updateState(Je),Ee.isPinLoaded()==!1&&Ee.updatePin()):Ee.isCreated()==!0&&Ee.updateMap(null)}function sr(Ee,Je,$e){Ee.isInBlock(Je+U_,$e)?(Ee.isCreated()==!1&&Ee.createElement(),Ee.updateMap(b),Ee.updateState(Je),Ee.getExpanded()&&Ee.isBodyLoaded()==!1&&Ee.updateBody()):Ee.isCreated()==!0&&(Ee.getCollapsed()?Ee.updateMap(null):Ee.updateState(Je))}async function Vi(Ee){var Gt,or;const Je=new Map(Ee.map(mi=>[mi.data.id,new vn(mi)])),$e=new Array,ft=Array.from(Vt);for(const mi of ft)Je.has(mi.id)==!1&&((Gt=mi.circle.libreMarker)==null||Gt.remove(),(or=mi.marker.libreMarker)==null||or.remove(),Ki.delete(mi.id),Vt.splice(Vt.indexOf(mi),1));for(const mi of Ee){const mr=Ki.get(mi.data.id);if(mr)mr.circle.zoom=mi.state[0],mr.circle.updateZIndex(),mr.marker.zoom=mi.state[0],mr.marker.angles=mi.state[1],mr.marker.updateZIndex();else{const gr=new vn(mi);Ki.set(mi.data.id,gr),Vt.push(gr),$e.push(gr)}}}function Nt(){var Ee,Je;for(const $e of Vt)(Ee=$e.circle.libreMarker)==null||Ee.remove(),(Je=$e.marker.libreMarker)==null||Je.remove();Vt.length=0,Ki.clear()}async function Fr(Ee){if(!(await fx.safeParseAsync(Ee)).success)throw new Error("Invalid popups");await Vi(Ee)}function an(){Nt()}function fr(Ee){const Je=Ki.get(Ee);Je!=null&&b.flyTo({center:{lat:Je.lat,lng:Je.lng},zoom:Je.zoom})}var wn=mx();E_("resize",rd,()=>b.setMinZoom(Zt(A)));var Tn=_u(wn);return ms(Tn,Ee=>I=Ee,()=>I),lf(()=>fd(wn,`--primary: ${_t(Ni).colors.primary??""}; --background: ${_t(Ni).colors.background??""}; --text: ${_t(Ni).colors.text??""};`)),Cu(Tn,"clientWidth",Ee=>Si(o,Ee)),Cu(Tn,"clientHeight",Ee=>Si(he,Ee)),cd(v,wn),gu({on:oi,off:Oi,emit:ni,getCenter:Ot,getZoom:Wi,getBounds:Et,setCenter:nr,setZoom:qn,zoomIn:Lr,zoomOut:ji,setMinZoom:Xi,setMaxZoom:xi,setMaxBounds:Pr,getStyle:Qe,setStyle:pi,updatePopups:Fr,removePopups:an,revealPopup:fr})}function gx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return ud(Xf,{target:g,props:{options:v}})}function _x(v){R_(v)}Lt.Map=Xf,Lt.mountMap=gx,Lt.unmountMap=_x,Object.defineProperty(Lt,Symbol.toStringTag,{value:"Module"})});