diff --git a/assets/MainLayers-fe4bfc4b.js b/assets/MainLayers-86931c4d.js similarity index 99% rename from assets/MainLayers-fe4bfc4b.js rename to assets/MainLayers-86931c4d.js index 9fe64b60..f28c7f1e 100644 --- a/assets/MainLayers-fe4bfc4b.js +++ b/assets/MainLayers-86931c4d.js @@ -1,5 +1,5 @@ var Rf=Object.defineProperty;var Ff=(E,b,M)=>b in E?Rf(E,b,{enumerable:!0,configurable:!0,writable:!0,value:M}):E[b]=M;var Iu=(E,b,M)=>(Ff(E,typeof b!="symbol"?b+"":b,M),M);(function(){const b=document.createElement("link").relList;if(b&&b.supports&&b.supports("modulepreload"))return;for(const U of document.querySelectorAll('link[rel="modulepreload"]'))k(U);new MutationObserver(U=>{for(const J of U)if(J.type==="childList")for(const le of J.addedNodes)le.tagName==="LINK"&&le.rel==="modulepreload"&&k(le)}).observe(document,{childList:!0,subtree:!0});function M(U){const J={};return U.integrity&&(J.integrity=U.integrity),U.referrerPolicy&&(J.referrerPolicy=U.referrerPolicy),U.crossOrigin==="use-credentials"?J.credentials="include":U.crossOrigin==="anonymous"?J.credentials="omit":J.credentials="same-origin",J}function k(U){if(U.ep)return;U.ep=!0;const J=M(U);fetch(U.href,J)}})();function pr(){}function Bf(E,b){for(const M in b)E[M]=b[M];return E}function Fd(E){return E()}function Id(){return Object.create(null)}function ns(E){E.forEach(Fd)}function Bd(E){return typeof E=="function"}function dn(E,b){return E!=E?b==b:E!==b||E&&typeof E=="object"||typeof E=="function"}function Of(E){return Object.keys(E).length===0}function Od(E,...b){if(E==null){for(const k of b)k(void 0);return pr}const M=E.subscribe(...b);return M.unsubscribe?()=>M.unsubscribe():M}function Uf(E){let b;return Od(E,M=>b=M)(),b}function Un(E,b,M){E.$$.on_destroy.push(Od(b,M))}function Pu(E,b,M,k){if(E){const U=Ud(E,b,M,k);return E[0](U)}}function Ud(E,b,M,k){return E[1]&&k?Bf(M.ctx.slice(),E[1](k(b))):M.ctx}function ku(E,b,M,k){if(E[2]&&k){const U=E[2](k(M));if(b.dirty===void 0)return U;if(typeof U=="object"){const J=[],le=Math.max(b.dirty.length,U.length);for(let c=0;c32){const b=[],M=E.ctx.length/32;for(let k=0;kE.removeEventListener(b,M,k)}function or(E,b,M){M==null?E.removeAttribute(b):E.getAttribute(b)!==M&&E.setAttribute(b,M)}function jf(E){let b;return{p(...M){b=M,b.forEach(k=>E.push(k))},r(){b.forEach(M=>E.splice(E.indexOf(M),1))}}}function $f(E){return Array.from(E.childNodes)}function kc(E,b){b=""+b,E.data!==b&&(E.data=b)}function va(E,b){E.value=b??""}function rg(E,b,M,k){M==null?E.style.removeProperty(b):E.style.setProperty(b,M,k?"important":"")}function Pc(E,b,M){for(let k=0;k{const U=E.$$.callbacks[b];if(U){const J=Gf(b,M,{cancelable:k});return U.slice().forEach(le=>{le.call(E,J)}),!J.defaultPrevented}return!0}}const tl=[],Jr=[];let rl=[];const Du=[],qf=Promise.resolve();let Ru=!1;function Zf(){Ru||(Ru=!0,qf.then(jd))}function Wl(E){rl.push(E)}function io(E){Du.push(E)}const Cu=new Set;let Ya=0;function jd(){if(Ya!==0)return;const E=Xl;do{try{for(;YaE.indexOf(k)===-1?b.push(k):M.push(k)),M.forEach(k=>k()),rl=b}const Cc=new Set;let ya;function Hf(){ya={r:0,c:[],p:ya}}function Kf(){ya.r||ns(ya.c),ya=ya.p}function Di(E,b){E&&E.i&&(Cc.delete(E),E.i(b))}function Yi(E,b,M,k){if(E&&E.o){if(Cc.has(E))return;Cc.add(E),ya.c.push(()=>{Cc.delete(E),k&&(M&&E.d(1),k())}),E.o(b)}else k&&k()}function Cd(E){return(E==null?void 0:E.length)!==void 0?E:Array.from(E)}function ng(E,b){E.d(1),b.delete(E.key)}function og(E,b,M,k,U,J,le,c,ae,O,Me,me){let Be=E.length,dt=J.length,be=Be;const Ie={};for(;be--;)Ie[E[be].key]=be;const nt=[],et=new Map,yt=new Map,at=[];for(be=dt;be--;){const Rt=me(U,J,be),Qt=M(Rt);let Ei=le.get(Qt);Ei?k&&at.push(()=>Ei.p(Rt,b)):(Ei=O(Qt,Rt),Ei.c()),et.set(Qt,nt[be]=Ei),Qt in Ie&&yt.set(Qt,Math.abs(be-Ie[Qt]))}const Pe=new Set,St=new Set;function oi(Rt){Di(Rt,1),Rt.m(c,Me),le.set(Rt.key,Rt),Me=Rt.first,dt--}for(;Be&&dt;){const Rt=nt[dt-1],Qt=E[Be-1],Ei=Rt.key,di=Qt.key;Rt===Qt?(Me=Rt.first,Be--,dt--):et.has(di)?!le.has(Ei)||Pe.has(Ei)?oi(Rt):St.has(di)?Be--:yt.get(Ei)>yt.get(di)?(St.add(Ei),oi(Rt)):(Pe.add(di),Be--):(ae(Qt,le),Be--)}for(;Be--;){const Rt=E[Be];et.has(Rt.key)||ae(Rt,le)}for(;dt;)oi(nt[dt-1]);return ns(at),nt}function ro(E,b,M){const k=E.$$.props[b];k!==void 0&&(E.$$.bound[k]=M,M(E.$$.ctx[k]))}function Vr(E){E&&E.c()}function Cr(E,b,M){const{fragment:k,after_update:U}=E.$$;k&&k.m(b,M),Wl(()=>{const J=E.$$.on_mount.map(Fd).filter(Bd);E.$$.on_destroy?E.$$.on_destroy.push(...J):ns(J),E.$$.on_mount=[]}),U.forEach(Wl)}function Ar(E,b){const M=E.$$;M.fragment!==null&&(Wf(M.after_update),ns(M.on_destroy),M.fragment&&M.fragment.d(b),M.on_destroy=M.fragment=null,M.ctx=[])}function Jf(E,b){E.$$.dirty[0]===-1&&(tl.push(E),Zf(),E.$$.dirty.fill(0)),E.$$.dirty[b/31|0]|=1<{const be=dt.length?dt[0]:Be;return O.ctx&&U(O.ctx[me],O.ctx[me]=be)&&(!O.skip_bound&&O.bound[me]&&O.bound[me](be),Me&&Jf(E,me)),Be}):[],O.update(),Me=!0,ns(O.before_update),O.fragment=k?k(O.ctx):!1,b.target){if(b.hydrate){const me=$f(b.target);O.fragment&&O.fragment.l(me),me.forEach(Ti)}else O.fragment&&O.fragment.c();b.intro&&Di(E.$$.fragment),Cr(E,b.target,b.anchor),jd()}ql(ae)}class Mn{constructor(){Iu(this,"$$");Iu(this,"$$set")}$destroy(){Ar(this,1),this.$destroy=pr}$on(b,M){if(!Bd(M))return pr;const k=this.$$.callbacks[b]||(this.$$.callbacks[b]=[]);return k.push(M),()=>{const U=k.indexOf(M);U!==-1&&k.splice(U,1)}}$set(b){this.$$set&&!Of(b)&&(this.$$.skip_bound=!0,this.$$set(b),this.$$.skip_bound=!1)}}const Yf="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Yf);let Ne;const $d=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});$d.decode();let Vl=null;function Ac(){return(Vl===null||Vl.byteLength===0)&&(Vl=new Uint8Array(Ne.memory.buffer)),Vl}function Tr(E,b){return $d.decode(Ac().subarray(E,E+b))}const Is=new Array(128).fill(void 0);Is.push(void 0,null,!0,!1);let Zl=Is.length;function Ir(E){Zl===Is.length&&Is.push(Is.length+1);const b=Zl;return Zl=Is[b],Is[b]=E,b}function ci(E){return Is[E]}function Qf(E){E<132||(Is[E]=Zl,Zl=E)}function zc(E){const b=ci(E);return Qf(E),b}function Au(E){return E==null}let jl=null;function em(){return(jl===null||jl.byteLength===0)&&(jl=new Float64Array(Ne.memory.buffer)),jl}let $l=null;function Nt(){return($l===null||$l.byteLength===0)&&($l=new Int32Array(Ne.memory.buffer)),$l}let Ws=0;const Mc=new TextEncoder("utf-8"),tm=typeof Mc.encodeInto=="function"?function(E,b){return Mc.encodeInto(E,b)}:function(E,b){const M=Mc.encode(E);return b.set(M),{read:E.length,written:M.length}};function nl(E,b,M){if(M===void 0){const c=Mc.encode(E),ae=b(c.length);return Ac().subarray(ae,ae+c.length).set(c),Ws=c.length,ae}let k=E.length,U=b(k);const J=Ac();let le=0;for(;le127)break;J[U+le]=c}if(le!==k){le!==0&&(E=E.slice(le)),U=M(U,k,k=le+E.length*3);const c=Ac().subarray(U+le,U+k),ae=tm(E,c);le+=ae.written}return Ws=le,U}function Fu(E){const b=typeof E;if(b=="number"||b=="boolean"||E==null)return`${E}`;if(b=="string")return`"${E}"`;if(b=="symbol"){const U=E.description;return U==null?"Symbol":`Symbol(${U})`}if(b=="function"){const U=E.name;return typeof U=="string"&&U.length>0?`Function(${U})`:"Function"}if(Array.isArray(E)){const U=E.length;let J="[";U>0&&(J+=Fu(E[0]));for(let le=1;le1)k=M[1];else return toString.call(E);if(k=="Object")try{return"Object("+JSON.stringify(E)+")"}catch{return"Object"}return E instanceof Error?`${E.name}: ${E.message} -${E.stack}`:k}let Gl=null;function im(){return(Gl===null||Gl.byteLength===0)&&(Gl=new Uint32Array(Ne.memory.buffer)),Gl}function rm(E,b){const k=im().subarray(E/4,E/4+b),U=[];for(let J=0;J>>0)},E.wbg.__wbg_length_27a2afe8ab42b09f=function(b){return ci(b).length},E.wbg.__wbg_instanceof_Uint8Array_01cebe79ca606cca=function(b){let M;try{M=ci(b)instanceof Uint8Array}catch{M=!1}return M},E.wbg.__wbindgen_debug_string=function(b,M){const k=Fu(ci(M)),U=nl(k,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),J=Ws;Nt()[b/4+1]=J,Nt()[b/4+0]=U},E.wbg.__wbindgen_throw=function(b,M){throw new Error(Tr(b,M))},E.wbg.__wbindgen_memory=function(){const b=Ne.memory;return Ir(b)},E}function sm(E,b){return Ne=E.exports,am.__wbindgen_wasm_module=b,jl=null,$l=null,Gl=null,Vl=null,Ne}async function am(E){typeof E>"u"&&(E="/osm2streets/assets/osm2streets_js_bg.wasm");const b=om();(typeof E=="string"||typeof Request=="function"&&E instanceof Request||typeof URL=="function"&&E instanceof URL)&&(E=fetch(E));const{instance:M,module:k}=await nm(await E,b);return sm(M,k)}function lm(E){let b,M,k,U,J,le,c;return{c(){b=Wt("div"),M=Cn(`App: +${E.stack}`:k}let Gl=null;function im(){return(Gl===null||Gl.byteLength===0)&&(Gl=new Uint32Array(Ne.memory.buffer)),Gl}function rm(E,b){const k=im().subarray(E/4,E/4+b),U=[];for(let J=0;J>>0)},E.wbg.__wbg_length_27a2afe8ab42b09f=function(b){return ci(b).length},E.wbg.__wbg_instanceof_Uint8Array_01cebe79ca606cca=function(b){let M;try{M=ci(b)instanceof Uint8Array}catch{M=!1}return M},E.wbg.__wbindgen_debug_string=function(b,M){const k=Fu(ci(M)),U=nl(k,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),J=Ws;Nt()[b/4+1]=J,Nt()[b/4+0]=U},E.wbg.__wbindgen_throw=function(b,M){throw new Error(Tr(b,M))},E.wbg.__wbindgen_memory=function(){const b=Ne.memory;return Ir(b)},E}function sm(E,b){return Ne=E.exports,am.__wbindgen_wasm_module=b,jl=null,$l=null,Gl=null,Vl=null,Ne}async function am(E){typeof E>"u"&&(E="/osm2streets/assets/osm2streets_js_bg.wasm");const b=om();(typeof E=="string"||typeof Request=="function"&&E instanceof Request||typeof URL=="function"&&E instanceof URL)&&(E=fetch(E));const{instance:M,module:k}=await nm(await E,b);return sm(M,k)}function lm(E){let b,M,k,U,J,le,c;return{c(){b=Wt("div"),M=Cn(`App: `),k=Wt("select"),U=Wt("option"),U.textContent="Street Explorer",J=Wt("option"),J.textContent="Lane editor",U.__value="index.html",va(U,U.__value),J.__value="lane_editor.html",va(J,J.__value),E[0]===void 0&&Wl(()=>E[2].call(k))},m(ae,O){ki(ae,b,O),Ft(b,M),Ft(b,k),Ft(k,U),Ft(k,J),Pc(k,E[0],!0),le||(c=[hn(k,"change",E[2]),hn(k,"change",E[1])],le=!0)},p(ae,[O]){O&1&&Pc(k,ae[0])},i:pr,o:pr,d(ae){ae&&Ti(b),le=!1,ns(c)}}}function cm(E,b,M){let k=window.location.pathname.split("/").pop()||"index.html",U=k;function J(){U!=k&&(window.location.href=U)}function le(){U=Nd(this),M(0,U)}return[U,J,le]}class sg extends Mn{constructor(b){super(),An(this,b,cm,lm,dn,{})}}const el=[];function Cs(E,b=pr){let M;const k=new Set;function U(c){if(dn(E,c)&&(E=c,M)){const ae=!el.length;for(const O of k)O[1](),el.push(O,E);if(ae){for(let O=0;O{k.delete(O),k.size===0&&M&&(M(),M=null)}}return{set:U,update:J,subscribe:le}}const Kl=Cs(null),xa=Cs(null),Bu=Cs(null),Ou=Cs(null),Uu=Cs(null),Nu=Cs(null),Vu=Cs(null),ju=Cs(null),$u=Cs(null);xa.subscribe(E=>{Ou.set(null),Uu.set(null),Nu.set(null),Vu.set(null),ju.set(null),$u.set(null)});function Gd(E,b,M){if(E!==null)for(var k,U,J,le,c,ae,O,Me=0,me=0,Be,dt=E.type,be=dt==="FeatureCollection",Ie=dt==="Feature",nt=be?E.features.length:1,et=0;etM[0]&&(b[0]=M[0]),b[1]>M[1]&&(b[1]=M[1]),b[2]=0;U--){let J=Md[U];if(J==E){k=!0;break}b.getLayer(J)&&(M=J)}if(!k)throw new Error(`Layer ID ${E} not defined in layerZorder`);return M}const Md=["boundary-layer","lane-polygons-layer","intersection-polygons-layer","lane-markings-layer","intersection-markings-layer","movements-layer","connected-roads-layer","current-way-layer","road_label"];function hm(E,b,M){let k;Un(E,Kl,Pe=>M(8,k=Pe));let{source:U}=b,{show:J=!0}=b,{gj:le}=b,{layerStyle:c}=b,{interactive:ae=!1}=b,{hoveredFeature:O=null}=b,{clickedFeature:Me=null}=b,{clickedFeaturePosition:me=null}=b,Be,dt,be=`${U}-layer`;Zu(()=>{Ie(),k.addSource(U,{type:"geojson",data:le??Ad()}),k.addLayer({id:be,source:U,...c},um(be)),J||k.setLayoutProperty(be,"visibility","none"),ae&&(k.on("mousemove",be,nt),k.on("mouseleave",be,et),k.on("click",yt))}),Xu(()=>{ae&&(k.off("mousemove",nt),k.off("mouseleave",et),k.off("click",yt),at()),k.getLayer(be)&&k.removeLayer(be),k.removeSource(U)});function Ie(){if(le&&"features"in le)for(let[Pe,St]of le.features.entries())St.id=Pe+1}function nt(Pe){let St=Pe.features??[];St.length>0&&Be!=St[0].id&&(at(),Be=St[0].id,k.setFeatureState({source:U,id:Be},{hover:!0}),le&&"features"in le&&M(0,O=le.features.find(oi=>oi.id==Be)))}function et(){at(),M(0,O=null),Be=void 0}function yt(Pe){Me!==null&&k.setFeatureState({source:U,id:dt},{clicked:!1});let St=k.queryRenderedFeatures(Pe.point,{layers:[be]});St.length==1?(dt=St[0].id,k.setFeatureState({source:U,id:dt},{clicked:!0}),le&&"features"in le&&(M(1,Me=le.features.find(oi=>oi.id==dt)),M(2,me=Pe.lngLat))):(M(1,Me=null),M(2,me=null),dt=void 0)}function at(){Be!==void 0&&k.setFeatureState({source:U,id:Be},{hover:!1})}return E.$$set=Pe=>{"source"in Pe&&M(3,U=Pe.source),"show"in Pe&&M(4,J=Pe.show),"gj"in Pe&&M(5,le=Pe.gj),"layerStyle"in Pe&&M(6,c=Pe.layerStyle),"interactive"in Pe&&M(7,ae=Pe.interactive),"hoveredFeature"in Pe&&M(0,O=Pe.hoveredFeature),"clickedFeature"in Pe&&M(1,Me=Pe.clickedFeature),"clickedFeaturePosition"in Pe&&M(2,me=Pe.clickedFeaturePosition)},E.$$.update=()=>{if(E.$$.dirty&296){let Pe=k.getSource(U);Pe&&(console.log(`GeoJSON data for ${U} changed, updating`),Ie(),Pe.setData(le??Ad()),M(0,O=null),Be=void 0,M(1,Me=null),M(2,me=null),dt=void 0)}E.$$.dirty&272&&k.getLayer(be)&&k.setLayoutProperty(be,"visibility",J?"visible":"none")},[O,Me,me,U,J,le,c,ae,k]}class Jl extends Mn{constructor(b){super(),An(this,b,hm,null,dn,{source:3,show:4,gj:5,layerStyle:6,interactive:7,hoveredFeature:0,clickedFeature:1,clickedFeaturePosition:2})}}const dm=E=>({}),Pd=E=>({}),pm=E=>({}),kd=E=>({});function fm(E){let b,M,k,U;const J=E[1].left,le=Pu(J,E,E[0],kd),c=E[1].main,ae=Pu(c,E,E[0],Pd);return{c(){b=Wt("div"),le&&le.c(),M=sr(),k=Wt("div"),ae&&ae.c(),or(b,"class","left svelte-we0xuz"),or(k,"class","main svelte-we0xuz")},m(O,Me){ki(O,b,Me),le&&le.m(b,null),ki(O,M,Me),ki(O,k,Me),ae&&ae.m(k,null),U=!0},p(O,[Me]){le&&le.p&&(!U||Me&1)&&zu(le,J,O,O[0],U?ku(J,O[0],Me,pm):Lu(O[0]),kd),ae&&ae.p&&(!U||Me&1)&&zu(ae,c,O,O[0],U?ku(c,O[0],Me,dm):Lu(O[0]),Pd)},i(O){U||(Di(le,O),Di(ae,O),U=!0)},o(O){Yi(le,O),Yi(ae,O),U=!1},d(O){O&&(Ti(b),Ti(M),Ti(k)),le&&le.d(O),ae&&ae.d(O)}}}function mm(E,b,M){let{$$slots:k={},$$scope:U}=b;return E.$$set=J=>{"$$scope"in J&&M(0,U=J.$$scope)},[U,k]}class ag extends Mn{constructor(b){super(),An(this,b,mm,fm,dn,{})}}var il=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gm(E){return E&&E.__esModule&&Object.prototype.hasOwnProperty.call(E,"default")?E.default:E}var Wd={exports:{}};(function(E,b){(function(M,k){E.exports=k()})(il,function(){var M,k,U;function J(c,ae){if(!M)M=ae;else if(!k)k=ae;else{var O="var sharedChunk = {}; ("+M+")(sharedChunk); ("+k+")(sharedChunk);",Me={};M(Me),U=ae(Me),typeof window<"u"&&(U.workerUrl=window.URL.createObjectURL(new Blob([O],{type:"text/javascript"})))}}J(["exports"],function(c){function ae(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var O=Me;function Me(i,e){this.x=i,this.y=e}Me.prototype={clone:function(){return new Me(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),l=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Me.convert=function(i){return i instanceof Me?i:Array.isArray(i)?new Me(i[0],i[1]):i};var me=ae(O),Be=dt;function dt(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}dt.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:m=r,r=.5*(m-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var be=ae(Be);function Ie(i,e,r,o){const l=new be(i,e,r,o);return function(h){return l.solve(h)}}const nt=Ie(.25,.1,.25,1);function et(i,e,r){return Math.min(r,Math.max(e,i))}function yt(i,e,r){const o=r-e,l=((i-e)%o+o)%o+e;return l===e?r:l}function at(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Pe=1;function St(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function oi(i,e,r){const o={};for(const l in i)o[l]=e.call(r||this,i[l],l,i);return o}function Rt(i,e,r){const o={};for(const l in i)e.call(r||this,i[l],l,i)&&(o[l]=i[l]);return o}function Qt(i){return Array.isArray(i)?i.map(Qt):typeof i=="object"&&i?oi(i,Qt):i}const Ei={};function di(i){Ei[i]||(typeof console<"u"&&console.warn(i),Ei[i]=!0)}function zt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function jr(i){let e=0;for(let r,o,l=0,h=i.length,d=h-1;lcancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(no||(no=document.createElement("a")),no.href=i,no.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(mn==null&&(mn=matchMedia("(prefers-reduced-motion: reduce)")),mn.matches)}},qi={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Mr extends Error{constructor(e,r,o,l){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=l}}const Si=pi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Ii=i=>qi.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function ar(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Si(),signal:r.signal});let l=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),h||fetch(o).then(d=>d.ok?(m=>{(i.type==="arrayBuffer"||i.type==="image"?m.arrayBuffer():i.type==="json"?m.json():m.text()).then(_=>{h||(l=!0,e(null,_,m.headers.get("Cache-Control"),m.headers.get("Expires")))}).catch(_=>{h||e(new Error(_.message))})})(d):d.blob().then(m=>e(new Mr(d.status,d.statusText,i.url,m)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{h=!0,l||r.abort()}}}const Vn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!pi())return(Ii(i.url)||ar)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Si())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return ar(i,e);if(pi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,l){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(h.responseType="arraybuffer");for(const d in o.headers)h.setRequestHeader(d,o.headers[d]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{l(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let d=h.response;if(o.type==="json")try{d=JSON.parse(h.response)}catch(m){return l(m)}l(null,d,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const d=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});l(new Mr(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},Zi=function(i,e){return Vn(at(i,{type:"arrayBuffer"}),e)};function At(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function jn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function $n(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class Gn{constructor(e,r={}){at(this,r),this.type=e}}class fr extends Gn{constructor(e,r={}){super("error",at({error:e},r))}}class $o{on(e,r){return this._listeners=this._listeners||{},jn(e,r,this._listeners),this}off(e,r){return $n(e,r,this._listeners),$n(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},jn(e,r,this._oneTimeListeners),this):new Promise(o=>this.once(e,o))}fire(e,r){typeof e=="string"&&(e=new Gn(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const l=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of l)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)$n(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&(at(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof fr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var _e={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},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:{}},default:"mapbox"},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-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":{},within:{}}},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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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 qn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Yr(i,e){const r={};for(const o in i)o!=="ref"&&(r[o]=i[o]);return qn.forEach(o=>{o in e&&(r[o]=e[o])}),r}function si(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const os=[gn,Ue,Dt,xt,mr,Wi,_i,Qi(Tt),Er,Xn];function zn(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!zn(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of os)if(!zn(r,e))return null}}return`Expected ${ui(i)} but found ${ui(e)} instead.`}function q(i,e){return e.some(r=>r.kind===i.kind)}function P(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function L(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const N=.96422,X=.82521,Y=4/29,se=6/29,ee=3*se*se,Q=se*se*se,ce=Math.PI/180,Te=180/Math.PI;function Se(i){return(i%=360)<0&&(i+=360),i}function Ce([i,e,r,o]){let l,h;const d=Et((.2225045*(i=it(i))+.7168786*(e=it(e))+.0606169*(r=it(r)))/1);i===e&&e===r?l=h=d:(l=Et((.4360747*i+.3850649*e+.1430804*r)/N),h=Et((.0139322*i+.0971045*e+.7141733*r)/X));const m=116*d-16;return[m<0?0:m,500*(l-d),200*(d-h),o]}function it(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Et(i){return i>Q?Math.pow(i,1/3):i/ee+Y}function st([i,e,r,o]){let l=(i+16)/116,h=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*bt(l),h=N*bt(h),d=X*bt(d),[pt(3.1338561*h-1.6168667*l-.4906146*d),pt(-.9787684*h+1.9161415*l+.033454*d),pt(.0719453*h-.2289914*l+1.4052427*d),o]}function pt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function bt(i){return i>se?i*i*i:ee*(i-Y)}function Vt(i){return parseInt(i.padEnd(2,i),16)/255}function Lt(i,e){return jt(e?i/100:i,0,1)}function jt(i,e,r){return Math.min(Math.max(e,i),r)}function ti(i){return!i.some(Number.isNaN)}const zi={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]};class ot{constructor(e,r,o,l=1,h=!0){this.r=e,this.g=r,this.b=o,this.a=l,h||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,o,l]))}static parse(e){if(e instanceof ot)return e;if(typeof e!="string")return;const r=function(o){if((o=o.toLowerCase())==="transparent")return[0,0,0,0];const l=zi[o];if(l){const[d,m,_]=l;return[d/255,m/255,_/255,1]}if(o.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)){const d=o.length<6?1:2;let m=1;return[Vt(o.slice(m,m+=d)),Vt(o.slice(m,m+=d)),Vt(o.slice(m,m+=d)),Vt(o.slice(m,m+d)||"ff")]}if(o.startsWith("rgb")){const d=o.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[m,_,T,S,A,z,D,B,Z,$,ne,ue]=d,te=[S||" ",D||" ",$].join("");if(te===" "||te===" /"||te===",,"||te===",,,"){const fe=[T,z,Z].join(""),ye=fe==="%%%"?100:fe===""?255:0;if(ye){const Ee=[jt(+_/ye,0,1),jt(+A/ye,0,1),jt(+B/ye,0,1),ne?Lt(+ne,ue):1];if(ti(Ee))return Ee}}return}}const h=o.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){const[d,m,_,T,S,A,z,D,B]=h,Z=[_||" ",S||" ",z].join("");if(Z===" "||Z===" /"||Z===",,"||Z===",,,"){const $=[+m,jt(+T,0,100),jt(+A,0,100),D?Lt(+D,B):1];if(ti($))return function([ne,ue,te,fe]){function ye(Ee){const rt=(Ee+ne/30)%12,ct=ue*Math.min(te,1-te);return te-ct*Math.max(-1,Math.min(rt-3,9-rt,1))}return ne=Se(ne),ue/=100,te/=100,[ye(0),ye(8),ye(4),fe]}($)}}}(e);return r?new ot(...r,!1):void 0}get rgb(){const{r:e,g:r,b:o,a:l}=this,h=l||1/0;return this.overwriteGetter("rgb",[e/h,r/h,o/h,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,o,l,h]=Ce(e),d=Math.sqrt(o*o+l*l);return[Math.round(1e4*d)?Se(Math.atan2(l,o)*Te):NaN,d,r,h]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ce(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,o,l]=this.rgb;return`rgba(${[e,r,o].map(h=>Math.round(255*h)).join(",")},${l})`}}ot.black=new ot(0,0,0,1),ot.white=new ot(1,1,1,1),ot.transparent=new ot(0,0,0,0),ot.red=new ot(1,0,0,1);class yi{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ao{constructor(e,r,o,l,h){this.text=e,this.image=r,this.scale=o,this.fontStack=l,this.textColor=h}}class vi{constructor(e){this.sections=e}static fromString(e){return new vi([new ao(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof vi?e:vi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Li(e)}}toString(){return JSON.stringify(this.values)}}class Sr{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Sr({name:e,available:!1}):null}}function en(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ln(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ot||i instanceof yi||i instanceof vi||i instanceof Li||i instanceof Sr)return!0;if(Array.isArray(i)){for(const e of i)if(!Ln(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Ln(i[e]))return!1;return!0}return!1}function Fi(i){if(i===null)return gn;if(typeof i=="string")return Dt;if(typeof i=="boolean")return xt;if(typeof i=="number")return Ue;if(i instanceof ot)return mr;if(i instanceof yi)return Qr;if(i instanceof vi)return Wi;if(i instanceof Li)return Er;if(i instanceof Sr)return Xn;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const l=Fi(o);if(r){if(r===l)continue;r=Tt;break}r=l}return Qi(r||Tt,e)}return _i}function ss(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ot||i instanceof vi||i instanceof Li||i instanceof Sr?i.toString():JSON.stringify(i)}class lo{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ln(e[1]))return r.error("invalid value");const o=e[1];let l=Fi(o);const h=r.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new lo(l,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Bi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const as={string:Dt,number:Ue,boolean:xt,object:_i};class kr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,l=1;const h=e[0];if(h==="array"){let m,_;if(e.length>2){const T=e[1];if(typeof T!="string"||!(T in as)||T==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=as[T],l++}else m=Tt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],l++}o=Qi(m,_)}else{if(!as[h])throw new Error(`Types doesn't contain name = ${h}`);o=as[h]}const d=[];for(;le.outputDefined())}}const ba={"to-boolean":xt,"to-color":mr,"to-number":Ue,"to-string":Dt};class er{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!ba[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=ba[o],h=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:en(r[0],r[1],r[2],r[3]),!o))return new ot(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Bi(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const l=Li.parse(r);if(l)return l}throw new Bi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Bi(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?vi.fromString(ss(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Sr.fromString(ss(this.args[0].evaluate(e))):ss(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Hs=["Unknown","Point","LineString","Polygon"];class As{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"?Hs[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=ot.parse(e)),r}}class co{constructor(e,r,o=[],l,h=new Zn,d=[]){this.registry=e,this.path=o,this.key=o.map(m=>`[${m}]`).join(""),this.scope=h,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,o,l,h={}){return r?this.concat(r,o,l)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(l,h,d){return d==="assert"?new kr(h,[l]):d==="coerce"?new er(h,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[l];if(h){let d=h.parse(e,this);if(!d)return null;if(this.expectedType){const m=this.expectedType,_=d.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||_.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(m.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array"){if(this.checkSubtype(m,_))return null}else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"assert")}if(!(d instanceof lo)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const m=new As;try{d=new lo(d.type,d.evaluate(m))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,o){const l=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new co(this.registry,this._isConstant,l,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Xi(o,e))}checkSubtype(e,r){const o=zn(e,r);return o&&this.error(o),o}}class $t{constructor(e,r,o){this.type=Qr,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const l=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,xt);if(!l)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,xt);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,Dt),!d)?null:new $t(l,h,d)}evaluate(e){return new yi(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const f=8192;function x(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function R(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function H(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*f),Math.round(o*l*f)]}function ie(i,e,r){const o=i[0]-e[0],l=i[1]-e[1],h=i[0]-r[0],d=i[1]-r[1];return o*d-h*l==0&&o*h<=0&&l*d<=0}function oe(i,e){let r=!1;for(let d=0,m=e.length;d(o=i)[1]!=(h=_[T+1])[1]>o[1]&&o[0]<(h[0]-l[0])*(o[1]-l[1])/(h[1]-l[1])+l[0]&&(r=!r)}}var o,l,h;return r}function he(i,e){for(let r=0;r0&&m<0||d<0&&m>0}function Fe(i,e,r){for(const T of r)for(let S=0;Sr[2]){const l=.5*o;let h=i[0]-r[0]>l?-o:r[0]-i[0]>l?o:0;h===0&&(h=i[0]-r[2]>l?-o:r[2]-i[0]>l?o:0),i[0]+=h}x(e,i)}function Mt(i,e,r,o){const l=Math.pow(2,o.z)*f,h=[o.x*f,o.y*f],d=[];for(const m of i)for(const _ of m){const T=[_.x+h[0],_.y+h[1]];fi(T,e,r,l),d.push(T)}return d}function Oi(i,e,r,o){const l=Math.pow(2,o.z)*f,h=[o.x*f,o.y*f],d=[];for(const _ of i){const T=[];for(const S of _){const A=[S.x+h[0],S.y+h[1]];x(e,A),T.push(A)}d.push(T)}if(e[2]-e[0]<=l/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const _ of d)for(const T of _)fi(T,e,r,l)}var m;return d}class we{constructor(e,r){this.type=xt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ln(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let l=0;l!Array.isArray(T)||T.length===e.length-1);let _=null;for(const[T,S]of m){_=new co(r.registry,Ui,r.path,null,r.scope);const A=[];let z=!1;for(let D=1;D{return z=A,Array.isArray(z)?`(${z.map(ui).join(", ")})`:`(${ui(z.type)}...)`;var z}).join(" | "),S=[];for(let A=1;A{r=e?r&&Ui(o):r&&o instanceof lo}),!!r&&xi(i)&&Ms(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function xi(i){if(i instanceof Bt&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof we)return!1;let e=!0;return i.eachChild(r=>{e&&!xi(r)&&(e=!1)}),e}function uo(i){if(i instanceof Bt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!uo(r)&&(e=!1)}),e}function Ms(i,e){if(i instanceof Bt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Ms(o,e)&&(r=!1)}),r}function ai(i,e){const r=i.length-1;let o,l,h=0,d=r,m=0;for(;h<=d;)if(m=Math.floor((h+d)/2),o=i[m],l=i[m+1],o<=e){if(m===r||ee))throw new Bi("Input is not a number.");d=m-1}return 0}class Co{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,h]of o)this.labels.push(l),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Ue);if(!o)return null;const l=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);const A=r.parse(_,S,h);if(!A)return null;h=h||A.type,l.push([m,A])}return new Co(h,o,l)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return o[0].evaluate(e);const h=r.length;return l>=r[h-1]?o[h-1].evaluate(e):o[ai(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function qo(i,e,r){return i+r*(e-i)}function tn(i,e,r){return i.map((o,l)=>qo(o,e[l],r))}const zr={number:qo,color:function(i,e,r,o="rgb"){switch(o){case"rgb":{const[l,h,d,m]=tn(i.rgb,e.rgb,r);return new ot(l,h,d,m,!1)}case"hcl":{const[l,h,d,m]=i.hcl,[_,T,S,A]=e.hcl;let z,D;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?z=NaN:(z=_,d!==1&&d!==0||(D=T)):(z=l,S!==1&&S!==0||(D=h));else{let ue=_-l;_>l&&ue>180?ue-=360:_180&&(ue+=360),z=l+r*ue}const[B,Z,$,ne]=function([ue,te,fe,ye]){return ue=isNaN(ue)?0:ue*ce,st([fe,Math.cos(ue)*te,Math.sin(ue)*te,ye])}([z,D??qo(h,T,r),qo(d,S,r),qo(m,A,r)]);return new ot(B,Z,$,ne,!1)}case"lab":{const[l,h,d,m]=st(tn(i.lab,e.lab,r));return new ot(l,h,d,m,!1)}}},array:tn,padding:function(i,e,r){return new Li(tn(i.values,e.values,r))}};class Lr{constructor(e,r,o,l,h){this.type=e,this.operator=r,this.interpolation=o,this.input=l,this.labels=[],this.outputs=[];for(const[d,m]of h)this.labels.push(d),this.outputs.push(m)}static interpolationFactor(e,r,o,l){let h=0;if(e.name==="exponential")h=Ps(r,e.base,o,l);else if(e.name==="linear")h=Ps(r,1,o,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;h=new be(d[0],d[1],d[2],d[3]).solve(Ps(r,1,o,l))}return h}static parse(e,r){let[o,l,h,...d]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const T=l[1];if(typeof T!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:T}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const T=l.slice(1);if(T.length!==4||T.some(S=>typeof S!="number"||S<0||S>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:T}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ue),!h)return null;const m=[];let _=null;o==="interpolate-hcl"||o==="interpolate-lab"?_=mr:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let T=0;T=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',z);const B=r.parse(A,D,_);if(!B)return null;_=_||B.type,m.push([S,B])}return L(_,Ue)||L(_,mr)||L(_,Er)||L(_,Qi(Ue))?new Lr(_,o,l,h,m):r.error(`Type ${ui(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return o[0].evaluate(e);const h=r.length;if(l>=r[h-1])return o[h-1].evaluate(e);const d=ai(r,l),m=Lr.interpolationFactor(this.interpolation,l,r[d],r[d+1]),_=o[d].evaluate(e),T=o[d+1].evaluate(e);switch(this.operator){case"interpolate":return zr[this.type.kind](_,T,m);case"interpolate-hcl":return zr.color(_,T,m,"hcl");case"interpolate-lab":return zr.color(_,T,m,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ps(i,e,r,o){const l=o-r,h=i-r;return l===0?0:e===1?h/l:(Math.pow(e,h)-1)/(Math.pow(e,l)-1)}class Zo{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const l=r.expectedType;l&&l.kind!=="value"&&(o=l);const h=[];for(const m of e.slice(1)){const _=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!_)return null;o=o||_.type,h.push(_)}if(!o)throw new Error("No output type");const d=l&&h.some(m=>zn(l,m.type));return new Zo(d?Tt:o,h)}evaluate(e){let r,o=null,l=0;for(const h of this.args)if(l++,o=h.evaluate(e),o&&o instanceof Sr&&!o.available&&(r||(r=o.name),o=null,l===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ls{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h=o.length)throw new Bi(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Bi(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class cs{constructor(e,r){this.type=xt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Tt),l=r.parse(e[2],2,Tt);return o&&l?q(o.type,[xt,Dt,Ue,gn,Tt])?new cs(o,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ui(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!P(r,["boolean","string","number","null"]))throw new Bi(`Expected first argument to be of type boolean, string, number or null, but found ${ui(Fi(r))} instead.`);if(!P(o,["string","array"]))throw new Bi(`Expected second argument to be of type array or string, but found ${ui(Fi(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ao{constructor(e,r,o){this.type=Ue,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Tt),l=r.parse(e[2],2,Tt);if(!o||!l)return null;if(!q(o.type,[xt,Dt,Ue,gn,Tt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ui(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ue);return h?new Ao(o,l,h):null}return new Ao(o,l)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!P(r,["boolean","string","number","null"]))throw new Bi(`Expected first argument to be of type boolean, string, number or null, but found ${ui(Fi(r))} instead.`);if(!P(o,["string","array"]))throw new Bi(`Expected second argument to be of type array or string, but found ${ui(Fi(o))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return o.indexOf(r,l)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class qt{constructor(e,r,o,l,h,d){this.inputType=e,this.type=r,this.input=o,this.cases=l,this.outputs=h,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const h={},d=[];for(let T=2;TNumber.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(o){if(z.checkSubtype(o,Fi(B)))return null}else o=Fi(B);if(h[String(B)]!==void 0)return z.error("Branch labels must be unique.");h[String(B)]=d.length}const D=r.parse(A,T,l);if(!D)return null;l=l||D.type,d.push(D)}const m=r.parse(e[1],1,Tt);if(!m)return null;const _=r.parse(e[e.length-1],e.length-1,l);return _?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new qt(o,l,m,h,d,_):null}evaluate(e){const r=this.input.evaluate(e);return(Fi(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class zs{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class us{constructor(e,r,o,l){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Tt),l=r.parse(e[2],2,Ue);if(!o||!l)return null;if(!q(o.type,[Qi(Tt),Dt,Tt]))return r.error(`Expected first argument to be of type array or string, but found ${ui(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ue);return h?new us(o.type,o,l,h):null}return new us(o.type,o,l)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!P(r,["string","array"]))throw new Bi(`Expected first argument to be of type array or string, but found ${ui(Fi(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(o,l)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ks(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function wa(i,e,r,o){return o.compare(e,r)===0}function Xo(i,e,r){const o=i!=="=="&&i!=="!=";return class Hd{constructor(h,d,m){this.type=xt,this.lhs=h,this.rhs=d,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");const m=h[0];let _=d.parse(h[1],1,Tt);if(!_)return null;if(!Ks(m,_.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${ui(_.type)}'.`);let T=d.parse(h[2],2,Tt);if(!T)return null;if(!Ks(m,T.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${ui(T.type)}'.`);if(_.type.kind!==T.type.kind&&_.type.kind!=="value"&&T.type.kind!=="value")return d.error(`Cannot compare types '${ui(_.type)}' and '${ui(T.type)}'.`);o&&(_.type.kind==="value"&&T.type.kind!=="value"?_=new kr(T.type,[_]):_.type.kind!=="value"&&T.type.kind==="value"&&(T=new kr(_.type,[T])));let S=null;if(h.length===4){if(_.type.kind!=="string"&&T.type.kind!=="string"&&_.type.kind!=="value"&&T.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(S=d.parse(h[3],3,Qr),!S)return null}return new Hd(_,T,S)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const _=Fi(d),T=Fi(m);if(_.kind!==T.kind||_.kind!=="string"&&_.kind!=="number")throw new Bi(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${T.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const _=Fi(d),T=Fi(m);if(_.kind!=="string"||T.kind!=="string")return e(h,d,m)}return this.collator?r(h,d,m,this.collator.evaluate(h)):e(h,d,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const Ls=Xo("==",function(i,e,r){return e===r},wa),Js=Xo("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!wa(0,e,r,o)}),Ta=Xo("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),Ea=Xo("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Sa=Xo(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class Ys{constructor(e,r,o,l,h){this.type=Dt,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ue);if(!o)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=r.parse(l.locale,1,Dt),!h))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Dt),!d))return null;let m=null;if(l["min-fraction-digits"]&&(m=r.parse(l["min-fraction-digits"],1,Ue),!m))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,Ue),!_)?null:new Ys(o,h,d,m,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class hs{constructor(e){this.type=Wi,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const l=[];let h=!1;for(let d=1;d<=e.length-1;++d){const m=e[d];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let _=null;if(m["font-scale"]&&(_=r.parse(m["font-scale"],1,Ue),!_))return null;let T=null;if(m["text-font"]&&(T=r.parse(m["text-font"],1,Qi(Dt)),!T))return null;let S=null;if(m["text-color"]&&(S=r.parse(m["text-color"],1,mr),!S))return null;const A=l[l.length-1];A.scale=_,A.font=T,A.textColor=S}else{const _=r.parse(e[d],1,Tt);if(!_)return null;const T=_.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:_,scale:null,font:null,textColor:null})}}return new hs(l)}evaluate(e){return new vi(this.sections.map(r=>{const o=r.content.evaluate(e);return Fi(o)===Xn?new ao("",o,null,null,null):new ao(ss(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Wo{constructor(e){this.type=Xn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Dt);return o?new Wo(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=Sr.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ds{constructor(e){this.type=Ue,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ui(o.type)} instead.`):new Ds(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Bi(`Expected value to be of type string or array, but found ${ui(Fi(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mo={"==":Ls,"!=":Js,">":Dn,"<":Ta,">=":Sa,"<=":Ea,array:kr,at:ks,boolean:kr,case:zs,coalesce:Zo,collator:$t,format:hs,image:Wo,in:cs,"index-of":Ao,interpolate:Lr,"interpolate-hcl":Lr,"interpolate-lab":Lr,length:Ds,let:ls,literal:lo,match:qt,number:kr,"number-format":Ys,object:kr,slice:us,step:Co,string:kr,"to-boolean":er,"to-color":er,"to-number":er,"to-string":er,var:lt,within:we};function Ia(i,[e,r,o,l]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=l?l.evaluate(i):1,d=en(e,r,o,h);if(d)throw new Bi(d);return new ot(e/255,r/255,o/255,h,!1)}function ho(i,e){return i in e}function Rs(i,e){const r=e[i];return r===void 0?null:r}function Po(i){return{type:i}}function Ca(i){return{result:"success",value:i}}function po(i){return{result:"error",value:i}}function Rn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Fs(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function ds(i){return!!i.expression&&i.expression.interpolated}function Zt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function fo(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ol(i){return i}function Aa(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",l=o||!(o||i.property!==void 0),h=i.type||(ds(e)?"exponential":"interval");if(r||e.type==="padding"){const S=r?ot.parse:Li.parse;(i=Pr({},i)).stops&&(i.stops=i.stops.map(A=>[A[0],S(A[1])])),i.default=S(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let m,_,T;if(h==="exponential")m=ea;else if(h==="interval")m=Qs;else if(h==="categorical"){m=sl,_=Object.create(null);for(const S of i.stops)_[S[0]]=S[1];T=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);m=ta}if(o){const S={},A=[];for(let B=0;BB[0]),evaluate:({zoom:B},Z)=>ea({stops:z,base:i.base},e,B).evaluate(B,Z)}}if(l){const S=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Lr.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>m(i,e,A,_,T)}}return{kind:"source",evaluate(S,A){const z=A&&A.properties?A.properties[i.property]:void 0;return z===void 0?ps(i.default,e.default):m(i,e,z,_,T)}}}function ps(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function sl(i,e,r,o,l){return ps(typeof r===l?o[r]:void 0,i.default,e.default)}function Qs(i,e,r){if(Zt(r)!=="number")return ps(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const l=ai(i.stops.map(h=>h[0]),r);return i.stops[l][1]}function ea(i,e,r){const o=i.base!==void 0?i.base:1;if(Zt(r)!=="number")return ps(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const h=ai(i.stops.map(S=>S[0]),r),d=function(S,A,z,D){const B=D-z,Z=S-z;return B===0?0:A===1?Z/B:(Math.pow(A,Z)-1)/(Math.pow(A,B)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],_=i.stops[h+1][1],T=zr[e.type]||ol;return typeof m.evaluate=="function"?{evaluate(...S){const A=m.evaluate.apply(void 0,S),z=_.evaluate.apply(void 0,S);if(A!==void 0&&z!==void 0)return T(A,z,d,i.colorSpace)}}:T(m,_,d,i.colorSpace)}function ta(i,e,r){switch(e.type){case"color":r=ot.parse(r);break;case"formatted":r=vi.fromString(r.toString());break;case"resolvedImage":r=Sr.fromString(r.toString());break;case"padding":r=Li.parse(r);break;default:Zt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return ps(r,i.default,e.default)}Bt.register(Mo,{error:[{kind:"error"},[Dt],(i,[e])=>{throw new Bi(e.evaluate(i))}],typeof:[Dt,[Tt],(i,[e])=>ui(Fi(e.evaluate(i)))],"to-rgba":[Qi(Ue,4),[mr],(i,[e])=>{const[r,o,l,h]=e.evaluate(i).rgb;return[255*r,255*o,255*l,h]}],rgb:[mr,[Ue,Ue,Ue],Ia],rgba:[mr,[Ue,Ue,Ue,Ue],Ia],has:{type:xt,overloads:[[[Dt],(i,[e])=>ho(e.evaluate(i),i.properties())],[[Dt,_i],(i,[e,r])=>ho(e.evaluate(i),r.evaluate(i))]]},get:{type:Tt,overloads:[[[Dt],(i,[e])=>Rs(e.evaluate(i),i.properties())],[[Dt,_i],(i,[e,r])=>Rs(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Tt,[Dt],(i,[e])=>Rs(e.evaluate(i),i.featureState||{})],properties:[_i,[],i=>i.properties()],"geometry-type":[Dt,[],i=>i.geometryType()],id:[Tt,[],i=>i.id()],zoom:[Ue,[],i=>i.globals.zoom],"heatmap-density":[Ue,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ue,[],i=>i.globals.lineProgress||0],accumulated:[Tt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ue,Po(Ue),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ue,Po(Ue),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ue,overloads:[[[Ue,Ue],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ue],(i,[e])=>-e.evaluate(i)]]},"/":[Ue,[Ue,Ue],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ue,[Ue,Ue],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ue,[],()=>Math.LN2],pi:[Ue,[],()=>Math.PI],e:[Ue,[],()=>Math.E],"^":[Ue,[Ue,Ue],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ue,[Ue],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ue,[Ue],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ue,[Ue],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ue,[Ue],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ue,[Ue],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ue,[Ue],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ue,[Ue],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ue,[Ue],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ue,[Ue],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ue,[Ue],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ue,Po(Ue),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ue,Po(Ue),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ue,[Ue],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ue,[Ue],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ue,[Ue],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ue,[Ue],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[xt,[Dt,Tt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[xt,[Tt],(i,[e])=>i.id()===e.value],"filter-type-==":[xt,[Dt],(i,[e])=>i.geometryType()===e.value],"filter-<":[xt,[Dt,Tt],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o{const r=i.id(),o=e.value;return typeof r==typeof o&&r":[xt,[Dt,Tt],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o>l}],"filter-id->":[xt,[Tt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[xt,[Dt,Tt],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o<=l}],"filter-id-<=":[xt,[Tt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[xt,[Dt,Tt],(i,[e,r])=>{const o=i.properties()[e.value],l=r.value;return typeof o==typeof l&&o>=l}],"filter-id->=":[xt,[Tt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[xt,[Tt],(i,[e])=>e.value in i.properties()],"filter-has-id":[xt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[xt,[Qi(Dt)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[xt,[Qi(Tt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[xt,[Dt,Qi(Tt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[xt,[Dt,Qi(Tt)],(i,[e,r])=>function(o,l,h,d){for(;h<=d;){const m=h+d>>1;if(l[m]===o)return!0;l[m]>o?d=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:xt,overloads:[[[xt,xt],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Po(xt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:xt,overloads:[[[xt,xt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Po(xt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[xt,[xt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[xt,[Dt],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Dt,[Dt],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Dt,[Dt],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Dt,Po(Tt),(i,e)=>e.map(r=>ss(r.evaluate(i))).join("")],"resolved-locale":[Dt,[Qr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Wn{constructor(e,r){var o;this.expression=e,this._warningHistory={},this._evaluator=new As,this._defaultValue=r?(o=r).type==="color"&&fo(o.default)?new ot(0,0,0,0):o.type==="color"?ot.parse(o.default)||null:o.type==="padding"?Li.parse(o.default)||null:o.default===void 0?null:o.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,l,h,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,l,h,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||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 Bi(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).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 rn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Mo}function ii(i,e){const r=new co(Mo,Ui,[],e?function(l){const h={color:mr,string:Dt,number:Ue,enum:Dt,boolean:xt,formatted:Wi,padding:Er,resolvedImage:Xn};return l.type==="array"?Qi(h[l.value]||Tt,l.length):h[l.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Ca(new Wn(o,e)):po(r.errors)}class Ho{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!uo(r.expression)}evaluateWithoutErrorHandling(e,r,o,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,l,h,d)}evaluate(e,r,o,l,h,d){return this._styleExpression.evaluate(e,r,o,l,h,d)}}class It{constructor(e,r,o,l){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!uo(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,o,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,l,h,d)}evaluate(e,r,o,l,h,d){return this._styleExpression.evaluate(e,r,o,l,h,d)}interpolationFactor(e,r,o){return this.interpolationType?Lr.interpolationFactor(this.interpolationType,e,r,o):0}}function Bs(i,e){const r=ii(i,e);if(r.result==="error")return r;const o=r.value.expression,l=xi(o);if(!l&&!Rn(e))return po([new Xi("","data expressions not supported")]);const h=Ms(o,["zoom"]);if(!h&&!Fs(e))return po([new Xi("","zoom expressions not supported")]);const d=Ht(o);return d||h?d instanceof Xi?po([d]):d instanceof Lr&&!ds(e)?po([new Xi("",'"interpolate" expressions cannot be used with this property')]):Ca(d?new It(l?"camera":"composite",r.value,d.labels,d instanceof Lr?d.interpolation:void 0):new Ho(l?"constant":"source",r.value)):po([new Xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ri{constructor(e,r){this._parameters=e,this._specification=r,Pr(this,Aa(this._parameters,this._specification))}static deserialize(e){return new ri(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ht(i){let e=null;if(i instanceof ls)e=Ht(i.result);else if(i instanceof Zo){for(const r of i.args)if(e=Ht(r),e)break}else(i instanceof Co||i instanceof Lr)&&i.input instanceof Bt&&i.input.name==="zoom"&&(e=i);return e instanceof Xi||i.eachChild(r=>{const o=Ht(r);o instanceof Xi?e=o:!e&&o?e=new Xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Xi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function ko(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!ko(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ia={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ra(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ko(i)||(i=fs(i));const e=ii(i,ia);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,l)=>e.value.evaluate(r,o,{},l),needGeometry:na(i)}}function al(i,e){return ie?1:0}function na(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?zo(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(fs))):e==="all"?["all"].concat(i.slice(1).map(fs)):e==="none"?["all"].concat(i.slice(1).map(fs).map(nn)):e==="in"?mo(i[1],i.slice(2)):e==="!in"?nn(mo(i[1],i.slice(2))):e==="has"?oa(i[1]):e==="!has"?nn(oa(i[1])):e!=="within"||i;var r}function zo(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function mo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(al)]]:["filter-in-small",i,["literal",e]]}}function oa(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function nn(i){return["!",i]}function ms(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const h of i)l+=`${ms(h)},`;return`${l}]`}const r=Object.keys(i).sort();let o="{";for(let l=0;lo.maximum?[new Oe(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function la(i){const e=i.valueSpec,r=Ni(i.value.type);let o,l,h,d={};const m=r!=="categorical"&&i.value.property===void 0,_=!m,T=Zt(i.value.stops)==="array"&&Zt(i.value.stops[0])==="array"&&Zt(i.value.stops[0][0])==="object",S=Dr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new Oe(D.key,D.value,'identity function may not have a "stops" property')];let B=[];const Z=D.value;return B=B.concat(aa({key:D.key,value:Z,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:A})),Zt(Z)==="array"&&Z.length===0&&B.push(new Oe(D.key,Z,"array must have at least one stop")),B},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&S.push(new Oe(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||S.push(new Oe(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!ds(i.valueSpec)&&S.push(new Oe(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!Rn(i.valueSpec)?S.push(new Oe(i.key,i.value,"property functions not supported")):m&&!Fs(i.valueSpec)&&S.push(new Oe(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!T||i.value.property!==void 0||S.push(new Oe(i.key,i.value,'"property" property is required')),S;function A(D){let B=[];const Z=D.value,$=D.key;if(Zt(Z)!=="array")return[new Oe($,Z,`array expected, ${Zt(Z)} found`)];if(Z.length!==2)return[new Oe($,Z,`array length 2 expected, length ${Z.length} found`)];if(T){if(Zt(Z[0])!=="object")return[new Oe($,Z,`object expected, ${Zt(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Oe($,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Oe($,Z,"object stop key must have value")];if(h&&h>Ni(Z[0].zoom))return[new Oe($,Z[0].zoom,"stop zoom values must appear in ascending order")];Ni(Z[0].zoom)!==h&&(h=Ni(Z[0].zoom),l=void 0,d={}),B=B.concat(Dr({key:`${$}[0]`,value:Z[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Os,value:z}}))}else B=B.concat(z({key:`${$}[0]`,value:Z[0],valueSpec:{},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},Z));return rn(Fn(Z[1]))?B.concat([new Oe(`${$}[1]`,Z[1],"expressions are not allowed in function stops.")]):B.concat(D.validateSpec({key:`${$}[1]`,value:Z[1],valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function z(D,B){const Z=Zt(D.value),$=Ni(D.value),ne=D.value!==null?D.value:B;if(o){if(Z!==o)return[new Oe(D.key,ne,`${Z} stop domain type must match previous stop domain type ${o}`)]}else o=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Oe(D.key,ne,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let ue=`number expected, ${Z} found`;return Rn(e)&&r===void 0&&(ue+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Oe(D.key,ne,ue)]}return r!=="categorical"||Z!=="number"||isFinite($)&&Math.floor($)===$?r!=="categorical"&&Z==="number"&&l!==void 0&&$new Oe(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Oe(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!uo(r))return[new Oe(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!uo(r))return[new Oe(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ms(r,["zoom","feature-state"]))return[new Oe(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!xi(r))return[new Oe(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ko(i){const e=i.key,r=i.value,o=i.valueSpec,l=[];return Array.isArray(o.values)?o.values.indexOf(Ni(r))===-1&&l.push(new Oe(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(Ni(r))===-1&&l.push(new Oe(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Jo(i){return ko(Fn(i.value))?_n(Pr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):de(i)}function de(i){const e=i.value,r=i.key;if(Zt(e)!=="array")return[new Oe(r,e,`array expected, ${Zt(e)} found`)];const o=i.styleSpec;let l,h=[];if(e.length<1)return[new Oe(r,e,"filter array must have at least 1 element")];switch(h=h.concat(Ko({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ni(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ni(e[1])==="$type"&&h.push(new Oe(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Oe(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=Zt(e[1]),l!=="string"&&h.push(new Oe(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{T in r&&e.push(new Oe(o,r[T],`"${T}" is prohibited for ref layers`))}),l.layers.forEach(T=>{Ni(T.id)===m&&(_=T)}),_?_.ref?e.push(new Oe(o,r.ref,"ref cannot reference another ref layer")):d=Ni(_.type):e.push(new Oe(o,r.ref,`ref layer "${m}" not found`))}else if(d!=="background")if(r.source){const _=l.sources&&l.sources[r.source],T=_&&Ni(_.type);_?T==="vector"&&d==="raster"?e.push(new Oe(o,r.source,`layer "${r.id}" requires a raster source`)):T==="raster"&&d!=="raster"?e.push(new Oe(o,r.source,`layer "${r.id}" requires a vector source`)):T!=="vector"||r["source-layer"]?T==="raster-dem"&&d!=="hillshade"?e.push(new Oe(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||T==="geojson"&&_.lineMetrics||e.push(new Oe(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Oe(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Oe(o,r.source,`source "${r.source}" not found`))}else e.push(new Oe(o,r,'missing required property "source"'));return e=e.concat(Dr({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Jo,layout:_=>Dr({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":T=>gt(Pr({layerType:d},T))}}),paint:_=>Dr({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":T=>qe(Pr({layerType:d},T))}})}})),e}function Pt(i){const e=i.value,r=i.key,o=Zt(e);return o!=="string"?[new Oe(r,e,`string expected, ${o} found`)]:[]}const mi={promoteId:function({key:i,value:e}){if(Zt(e)==="string")return Pt({key:i,value:e});{const r=[];for(const o in e)r.push(...Pt({key:`${i}.${o}`,value:e[o]}));return r}}};function Ci(i){const e=i.value,r=i.key,o=i.styleSpec,l=i.style,h=i.validateSpec;if(!e.type)return[new Oe(r,e,'"type" is required')];const d=Ni(e.type);let m;switch(d){case"vector":case"raster":case"raster-dem":return m=Dr({key:r,value:e,valueSpec:o[`source_${d.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:mi,validateSpec:h}),m;case"geojson":if(m=Dr({key:r,value:e,valueSpec:o.source_geojson,style:l,styleSpec:o,validateSpec:h,objectElementValidators:mi}),e.cluster)for(const _ in e.clusterProperties){const[T,S]=e.clusterProperties[_],A=typeof T=="string"?[T,["accumulated"],["get",_]]:T;m.push(..._n({key:`${r}.${_}.map`,value:S,validateSpec:h,expressionContext:"cluster-map"})),m.push(..._n({key:`${r}.${_}.reduce`,value:A,validateSpec:h,expressionContext:"cluster-reduce"}))}return m;case"video":return Dr({key:r,value:e,valueSpec:o.source_video,style:l,validateSpec:h,styleSpec:o});case"image":return Dr({key:r,value:e,valueSpec:o.source_image,style:l,validateSpec:h,styleSpec:o});case"canvas":return[new Oe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ko({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:h,styleSpec:o})}}function on(i){const e=i.value,r=i.styleSpec,o=r.light,l=i.style;let h=[];const d=Zt(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Oe("light",e,`object expected, ${d} found`)]),h;for(const m in e){const _=m.match(/^(.*)-transition$/);h=h.concat(_&&o[_[1]]&&o[_[1]].transition?i.validateSpec({key:m,value:e[m],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):o[m]?i.validateSpec({key:m,value:e[m],valueSpec:o[m],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Oe(m,e[m],`unknown property "${m}"`)])}return h}function Ai(i){const e=i.value,r=i.styleSpec,o=r.terrain,l=i.style;let h=[];const d=Zt(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Oe("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?i.validateSpec({key:m,value:e[m],valueSpec:o[m],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Oe(m,e[m],`unknown property "${m}"`)]);return h}function Vi(i){let e=[];const r=i.value,o=i.key;if(Array.isArray(r)){const l=[],h=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new Oe(o,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&h.includes(r[d].url)&&e.push(new Oe(o,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),h.push(r[d].url),e=e.concat(Dr({key:`${o}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Pt({key:o,value:r})}const yn={"*":()=>[],array:aa,boolean:function(i){const e=i.value,r=i.key,o=Zt(e);return o!=="boolean"?[new Oe(r,e,`boolean expected, ${o} found`)]:[]},number:Os,color:function(i){const e=i.key,r=i.value,o=Zt(r);return o!=="string"?[new Oe(e,r,`color expected, ${o} found`)]:ot.parse(String(r))?[]:[new Oe(e,r,`color expected, "${r}" found`)]},constants:sa,enum:Ko,filter:Jo,function:la,layer:li,object:Dr,source:Ci,light:on,terrain:Ai,string:Pt,formatted:function(i){return Pt(i).length===0?[]:_n(i)},resolvedImage:function(i){return Pt(i).length===0?[]:_n(i)},padding:function(i){const e=i.key,r=i.value;if(Zt(r)==="array"){if(r.length<1||r.length>4)return[new Oe(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let l=[];for(let h=0;h[]}})),i.constants&&(r=r.concat(sa({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Gr}))),go(r)}function lr(i){return function(e){return i({...e,validateSpec:Gr})}}function go(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function gi(i){return function(...e){return go(i.apply(this,e))}}tr.source=gi(lr(Ci)),tr.sprite=gi(lr(Vi)),tr.glyphs=gi(lr(gr)),tr.light=gi(lr(on)),tr.terrain=gi(lr(Ai)),tr.layer=gi(lr(li)),tr.filter=gi(lr(Jo)),tr.paintProperty=gi(lr(qe)),tr.layoutProperty=gi(lr(gt));const sn=tr,Ma=sn.light,ll=sn.paintProperty,cl=sn.layoutProperty;function Kt(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new fr(new Error(o.message))),r=!0;return r}class Xt{constructor(e,r,o){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(o=d[2]);for(let _=0;_=A[B+0]&&l>=A[B+1])?(m[D]=!0,d.push(S[D])):m[D]=!1}}}}_forEachCell(e,r,o,l,h,d,m,_){const T=this._convertToCellCoord(e),S=this._convertToCellCoord(r),A=this._convertToCellCoord(o),z=this._convertToCellCoord(l);for(let D=T;D<=A;D++)for(let B=S;B<=z;B++){const Z=this.d*B+D;if((!_||_(this._convertFromCellCoord(D),this._convertFromCellCoord(B),this._convertFromCellCoord(D+1),this._convertFromCellCoord(B+1)))&&h.call(this,e,r,o,l,Z,d,m,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let o=0;for(let d=0;d=0)continue;const d=i[h];l[h]=qr[o].shallow.indexOf(h)>=0?d:_r(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(l.$name=o),l}throw new Error("can't serialize object of type "+typeof i)}function cr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Yo(i)||Nn(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(cr);if(typeof i=="object"){const e=i.$name||"Object";if(!qr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=qr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const h=i[l];o[l]=qr[e].shallow.indexOf(l)>=0?h:cr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Hn{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Do(i){for(const e of i)if(gs(e.charCodeAt(0)))return!0;return!1}function _o(i){for(const e of i)if(!yo(e.charCodeAt(0)))return!1;return!0}function yo(i){return!($e.Arabic(i)||$e["Arabic Supplement"](i)||$e["Arabic Extended-A"](i)||$e["Arabic Presentation Forms-A"](i)||$e["Arabic Presentation Forms-B"](i))}function gs(i){return!(i!==746&&i!==747&&(i<4352||!($e["Bopomofo Extended"](i)||$e.Bopomofo(i)||$e["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||$e["CJK Compatibility Ideographs"](i)||$e["CJK Compatibility"](i)||$e["CJK Radicals Supplement"](i)||$e["CJK Strokes"](i)||!(!$e["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||$e["CJK Unified Ideographs Extension A"](i)||$e["CJK Unified Ideographs"](i)||$e["Enclosed CJK Letters and Months"](i)||$e["Hangul Compatibility Jamo"](i)||$e["Hangul Jamo Extended-A"](i)||$e["Hangul Jamo Extended-B"](i)||$e["Hangul Jamo"](i)||$e["Hangul Syllables"](i)||$e.Hiragana(i)||$e["Ideographic Description Characters"](i)||$e.Kanbun(i)||$e["Kangxi Radicals"](i)||$e["Katakana Phonetic Extensions"](i)||$e.Katakana(i)&&i!==12540||!(!$e["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!$e["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||$e["Unified Canadian Aboriginal Syllabics"](i)||$e["Unified Canadian Aboriginal Syllabics Extended"](i)||$e["Vertical Forms"](i)||$e["Yijing Hexagram Symbols"](i)||$e["Yi Syllables"](i)||$e["Yi Radicals"](i))))}function _s(i){return!(gs(i)||function(e){return!!($e["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||$e["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||$e["Letterlike Symbols"](e)||$e["Number Forms"](e)||$e["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||$e["Control Pictures"](e)&&e!==9251||$e["Optical Character Recognition"](e)||$e["Enclosed Alphanumerics"](e)||$e["Geometric Shapes"](e)||$e["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||$e["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||$e["CJK Symbols and Punctuation"](e)||$e.Katakana(e)||$e["Private Use Area"](e)||$e["CJK Compatibility Forms"](e)||$e["Small Form Variants"](e)||$e["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Qo(i){return i>=1424&&i<=2303||$e["Arabic Presentation Forms-A"](i)||$e["Arabic Presentation Forms-B"](i)}function Ro(i,e){return!(!e&&Qo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||$e.Khmer(i))}function ys(i){for(const e of i)if(Qo(e.charCodeAt(0)))return!0;return!1}const Us="deferred",Fo="loading",es="loaded";let ca=null,an="unavailable",ts=null;const Ql=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(an="error"),ca&&ca(i)};function ul(){Pa.fire(new Gn("pluginStateChange",{pluginStatus:an,pluginURL:ts}))}const Pa=new $o,hl=function(){return an},ec=function(){if(an!==Us||!ts)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");an=Fo,ul(),ts&&Zi({url:ts},i=>{i?Ql(i):(an=es,ul())})},Bn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>an===es||Bn.applyArabicShaping!=null,isLoading:()=>an===Fo,setState(i){if(!pi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");an=i.pluginStatus,ts=i.pluginURL},isParsed(){if(!pi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Bn.applyArabicShaping!=null&&Bn.processBidirectionalText!=null&&Bn.processStyledBidirectionalText!=null},getPluginURL(){if(!pi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return ts}};class Mi{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Hn,this.transition={})}isSupportedScript(e){return function(r,o){for(const l of r)if(!Ro(l.charCodeAt(0),o))return!1;return!0}(e,Bn.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class ka{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,l){if(fo(o))return new ri(o,l);if(rn(o)){const h=Bs(o,l);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=o;return l.type==="color"&&typeof o=="string"?h=ot.parse(o):l.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=Li.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class dl{constructor(e){this.property=e,this.value=new ka(e,void 0)}transitioned(e,r){return new ua(this.property,this.value,r,at({},e.transition,this.transition),e.now)}untransitioned(){return new ua(this.property,this.value,null,{},0)}}class tc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Qt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new dl(this._values[e].property)),this._values[e].value=new ka(this._values[e].property,r===null?void 0:Qt(r))}getTransition(e){return Qt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new dl(this._values[e].property)),this._values[e].transition=Qt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const o=new ic(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].transitioned(e,r._values[l]);return o}untransitioned(){const e=new ic(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ua{constructor(e,r,o,l,h){this.property=e,this.value=r,this.begin=h+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const l=e.now||0,h=this.value.possiblyEvaluate(e,r,o),d=this.prior;if(d){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l=1)return 1;const T=_*_,S=T*_;return 4*(_<.5?S:3*(_-T)+S-.75)}(m))}}return h}}class ic{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const l=new za(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(e,r,o);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class pl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Qt(this._values[e].value)}setValue(e,r){this._values[e]=new ka(this._values[e].property,r===null?void 0:Qt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const l=new za(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(e,r,o);return l}}class vo{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,l){return this.property.evaluate(this.value,this.parameters,e,r,o,l)}}class za{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class ht{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const l=zr[this.specification.type];return l?l(e,r,o):e}}class _t{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,l){return new vo(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,l)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new vo(this,{kind:"constant",value:void 0},e.parameters);const l=zr[this.specification.type];if(l){const h=l(e.value.value,r.value.value,o);return new vo(this,{kind:"constant",value:h},e.parameters)}return e}evaluate(e,r,o,l,h,d){return e.kind==="constant"?e.value:e.evaluate(r,o,l,h,d)}}class ha extends _t{possiblyEvaluate(e,r,o,l){if(e.value===void 0)return new vo(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,l),d=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(d,d,d,r);return new vo(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new vo(this,{kind:"constant",value:h},r)}return new vo(this,e.expression,r)}evaluate(e,r,o,l,h,d){if(e.kind==="source"){const m=e.evaluate(r,o,l,h,d);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,l),e.evaluate({zoom:Math.floor(r.zoom)},o,l),e.evaluate({zoom:Math.floor(r.zoom)+1},o,l),r):e.value}_calculate(e,r,o,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class fl{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,l);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Mi(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Mi(Math.floor(r.zoom),r)),e.expression.evaluate(new Mi(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class ml{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,l){return!!e.expression.evaluate(r,null,{},o,l)}interpolate(){return!1}}class ln{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new ka(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new dl(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}He("DataDrivenProperty",_t),He("DataConstantProperty",ht),He("CrossFadedDataDrivenProperty",ha),He("CrossFadedProperty",fl),He("ColorRampProperty",ml);const rc="-transition";class xo extends $o{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new pl(r.layout)),r.paint)){this._transitionablePaint=new tc(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new za(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(cl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(rc)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(ll,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(rc))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],h=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),m=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(e,m,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Rt(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,l,h={}){return(!h||h.validate!==!1)&&Kt(this,e.call(sn,{key:r,layerType:this.type,objectKey:o,value:l,styleSpec:_e,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof vo&&Rn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Dc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Bo{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ji{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ir(i,e=1){let r=0,o=0;return{members:i.map(l=>{const h=Dc[l.type].BYTES_PER_ELEMENT,d=r=nc(r,Math.max(e,h)),m=l.components||1;return o=Math.max(o,h),r+=h*m,{name:l.name,type:l.type,components:m,offset:d}}),size:nc(r,Math.max(o,e)),alignment:e}}function nc(i,e){return Math.ceil(i/e)*e}class Ns extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=o,e}}Ns.prototype.bytesPerElement=4,He("StructArrayLayout2i4",Ns);class La extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=l,e}}La.prototype.bytesPerElement=6,He("StructArrayLayout3i6",La);class gl extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,l)}emplace(e,r,o,l,h){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=o,this.int16[d+2]=l,this.int16[d+3]=h,e}}gl.prototype.bytesPerElement=8,He("StructArrayLayout4i8",gl);class bo extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,l,h,d)}emplace(e,r,o,l,h,d,m){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=o,this.int16[_+2]=l,this.int16[_+3]=h,this.int16[_+4]=d,this.int16[_+5]=m,e}}bo.prototype.bytesPerElement=12,He("StructArrayLayout2i4i12",bo);class Da extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,l,h,d)}emplace(e,r,o,l,h,d,m){const _=4*e,T=8*e;return this.int16[_+0]=r,this.int16[_+1]=o,this.uint8[T+4]=l,this.uint8[T+5]=h,this.uint8[T+6]=d,this.uint8[T+7]=m,e}}Da.prototype.bytesPerElement=8,He("StructArrayLayout2i4ub8",Da);class vs extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=o,e}}vs.prototype.bytesPerElement=8,He("StructArrayLayout2f8",vs);class Ra extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,h,d,m,_,T,S){const A=this.length;return this.resize(A+1),this.emplace(A,e,r,o,l,h,d,m,_,T,S)}emplace(e,r,o,l,h,d,m,_,T,S,A){const z=10*e;return this.uint16[z+0]=r,this.uint16[z+1]=o,this.uint16[z+2]=l,this.uint16[z+3]=h,this.uint16[z+4]=d,this.uint16[z+5]=m,this.uint16[z+6]=_,this.uint16[z+7]=T,this.uint16[z+8]=S,this.uint16[z+9]=A,e}}Ra.prototype.bytesPerElement=20,He("StructArrayLayout10ui20",Ra);class da extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,h,d,m,_,T,S,A,z){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,o,l,h,d,m,_,T,S,A,z)}emplace(e,r,o,l,h,d,m,_,T,S,A,z,D){const B=12*e;return this.int16[B+0]=r,this.int16[B+1]=o,this.int16[B+2]=l,this.int16[B+3]=h,this.uint16[B+4]=d,this.uint16[B+5]=m,this.uint16[B+6]=_,this.uint16[B+7]=T,this.int16[B+8]=S,this.int16[B+9]=A,this.int16[B+10]=z,this.int16[B+11]=D,e}}da.prototype.bytesPerElement=24,He("StructArrayLayout4i4ui4i24",da);class _l extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=l,e}}_l.prototype.bytesPerElement=12,He("StructArrayLayout3f12",_l);class Vs extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}Vs.prototype.bytesPerElement=4,He("StructArrayLayout1ul4",Vs);class xs extends ji{_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(e,r,o,l,h,d,m,_,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,o,l,h,d,m,_,T)}emplace(e,r,o,l,h,d,m,_,T,S){const A=10*e,z=5*e;return this.int16[A+0]=r,this.int16[A+1]=o,this.int16[A+2]=l,this.int16[A+3]=h,this.int16[A+4]=d,this.int16[A+5]=m,this.uint32[z+3]=_,this.uint16[A+8]=T,this.uint16[A+9]=S,e}}xs.prototype.bytesPerElement=20,He("StructArrayLayout6i1ul2ui20",xs);class yl extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,l,h,d)}emplace(e,r,o,l,h,d,m){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=o,this.int16[_+2]=l,this.int16[_+3]=h,this.int16[_+4]=d,this.int16[_+5]=m,e}}yl.prototype.bytesPerElement=12,He("StructArrayLayout2i2i2i12",yl);class Fa extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,l,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,l,h)}emplace(e,r,o,l,h,d){const m=4*e,_=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=l,this.int16[_+6]=h,this.int16[_+7]=d,e}}Fa.prototype.bytesPerElement=16,He("StructArrayLayout2f1f2i16",Fa);class bs extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,l)}emplace(e,r,o,l,h){const d=12*e,m=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=o,this.float32[m+1]=l,this.float32[m+2]=h,e}}bs.prototype.bytesPerElement=12,He("StructArrayLayout2ub2f12",bs);class Ba extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=l,e}}Ba.prototype.bytesPerElement=6,He("StructArrayLayout3ui6",Ba);class vl extends ji{_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(e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z,$,ne){const ue=this.length;return this.resize(ue+1),this.emplace(ue,e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z,$,ne)}emplace(e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z,$,ne,ue){const te=24*e,fe=12*e,ye=48*e;return this.int16[te+0]=r,this.int16[te+1]=o,this.uint16[te+2]=l,this.uint16[te+3]=h,this.uint32[fe+2]=d,this.uint32[fe+3]=m,this.uint32[fe+4]=_,this.uint16[te+10]=T,this.uint16[te+11]=S,this.uint16[te+12]=A,this.float32[fe+7]=z,this.float32[fe+8]=D,this.uint8[ye+36]=B,this.uint8[ye+37]=Z,this.uint8[ye+38]=$,this.uint32[fe+10]=ne,this.int16[te+22]=ue,e}}vl.prototype.bytesPerElement=48,He("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",vl);class Oa extends ji{_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(e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z,$,ne,ue,te,fe,ye,Ee,rt,ct,Je,Ze,Ve,Ye){const Xe=this.length;return this.resize(Xe+1),this.emplace(Xe,e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z,$,ne,ue,te,fe,ye,Ee,rt,ct,Je,Ze,Ve,Ye)}emplace(e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z,$,ne,ue,te,fe,ye,Ee,rt,ct,Je,Ze,Ve,Ye,Xe){const De=34*e,mt=17*e;return this.int16[De+0]=r,this.int16[De+1]=o,this.int16[De+2]=l,this.int16[De+3]=h,this.int16[De+4]=d,this.int16[De+5]=m,this.int16[De+6]=_,this.int16[De+7]=T,this.uint16[De+8]=S,this.uint16[De+9]=A,this.uint16[De+10]=z,this.uint16[De+11]=D,this.uint16[De+12]=B,this.uint16[De+13]=Z,this.uint16[De+14]=$,this.uint16[De+15]=ne,this.uint16[De+16]=ue,this.uint16[De+17]=te,this.uint16[De+18]=fe,this.uint16[De+19]=ye,this.uint16[De+20]=Ee,this.uint16[De+21]=rt,this.uint16[De+22]=ct,this.uint32[mt+12]=Je,this.float32[mt+13]=Ze,this.float32[mt+14]=Ve,this.float32[mt+15]=Ye,this.float32[mt+16]=Xe,e}}Oa.prototype.bytesPerElement=68,He("StructArrayLayout8i15ui1ul4f68",Oa);class Ua extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}Ua.prototype.bytesPerElement=4,He("StructArrayLayout1f4",Ua);class Na extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,o)}emplace(e,r,o,l){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=l,e}}Na.prototype.bytesPerElement=8,He("StructArrayLayout1ul2ui8",Na);class a extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=o,e}}a.prototype.bytesPerElement=4,He("StructArrayLayout2ui4",a);class t extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}t.prototype.bytesPerElement=2,He("StructArrayLayout1ui2",t);class n extends ji{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,l)}emplace(e,r,o,l,h){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=o,this.float32[d+2]=l,this.float32[d+3]=h,e}}n.prototype.bytesPerElement=16,He("StructArrayLayout4f16",n);class s extends Bo{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 me(this.anchorPointX,this.anchorPointY)}}s.prototype.size=20;class u extends xs{get(e){return new s(this,e)}}He("CollisionBoxArray",u);class p extends Bo{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}p.prototype.size=48;class g extends vl{get(e){return new p(this,e)}}He("PlacedSymbolArray",g);class v extends Bo{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}v.prototype.size=68;class y extends Oa{get(e){return new v(this,e)}}He("SymbolInstanceArray",y);class w extends Ua{getoffsetX(e){return this.float32[1*e+0]}}He("GlyphOffsetArray",w);class C extends La{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}He("SymbolLineVertexArray",C);class I extends Bo{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]}}I.prototype.size=8;class F extends Na{get(e){return new I(this,e)}}He("FeatureIndexArray",F);class G extends Ns{}class V extends Ns{}class j extends Ns{}class K extends bo{}class re extends Da{}class ge extends vs{}class W extends Ra{}class pe extends da{}class ve extends _l{}class Ae extends Vs{}class Le extends yl{}class Re extends bs{}class ke extends Ba{}class Qe extends a{}const ft=ir([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ct}=ft;class Ge{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,l){let h=this.segments[this.segments.length-1];return e>Ge.MAX_VERTEX_ARRAY_LENGTH&&di(`Max vertices per segment is ${Ge.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>Ge.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,l){return new Ge([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:l,vaos:{},sortKey:0}])}}function vt(i,e){return 256*(i=et(Math.floor(i),0,255))+et(Math.floor(e),0,255)}Ge.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,He("SegmentVector",Ge);const tt=ir([{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 Jt={exports:{}},Hi={exports:{}};Hi.exports=function(i,e){var r,o,l,h,d,m,_,T;for(o=i.length-(r=3&i.length),l=e,d=3432918353,m=461845907,T=0;T>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(T+2))<<16;case 2:_^=(255&i.charCodeAt(T+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(T)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var Yt=Hi.exports,kt={exports:{}};kt.exports=function(i,e){for(var r,o=i.length,l=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var $i=Yt,Zr=kt.exports;Jt.exports=$i,Jt.exports.murmur3=$i,Jt.exports.murmur2=Zr;var Ki=ae(Jt.exports);class yr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,l){this.ids.push(vn(e)),this.positions.push(r,o,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=vn(e);let o=0,l=this.ids.length-1;for(;o>1;this.ids[d]>=r?l=d:o=d+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Kn(o,l,0,o.length-1),r&&r.push(o.buffer,l.buffer),{ids:o,positions:l}}static deserialize(e){const r=new yr;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function vn(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ki(String(i))}function Kn(i,e,r,o){for(;r>1];let h=r-1,d=o+1;for(;;){do h++;while(i[h]l);if(h>=d)break;Jn(i,h,d),Jn(e,3*h,3*d),Jn(e,3*h+1,3*d+1),Jn(e,3*h+2,3*d+2)}d-r`u_${l}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new Rr(e,r):new wo(e,r)}}class xr{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,l){const h=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new pa(e,r):new wo(e,r)}}class ni{constructor(e,r,o,l){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,o,l,h){const d=this.paintVertexArray.length,m=this.expression.evaluate(new Mi(0),r,{},l,[],h);this.paintVertexArray.resize(e),this._setPaintValue(d,e,m)}updatePaintArray(e,r,o,l){const h=this.expression.evaluate({zoom:0},o,l);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const l=ei(o);for(let h=e;h`u_${m}_t`),this.type=o,this.useIntegerZoom=l,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,o,l,h){const d=this.expression.evaluate(new Mi(this.zoom),r,{},l,[],h),m=this.expression.evaluate(new Mi(this.zoom+1),r,{},l,[],h),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,d,m)}updatePaintArray(e,r,o,l){const h=this.expression.evaluate({zoom:this.zoom},o,l),d=this.expression.evaluate({zoom:this.zoom+1},o,l);this._setPaintValue(e,r,h,d)}_setPaintValue(e,r,o,l){if(this.type==="color"){const h=ei(o),d=ei(l);for(let m=e;m`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof ni||o instanceof hr)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Va(l,r,o);this.needsUpload=!1,this._featureMap=new yr,this._bufferOffset=0}populatePaintArrays(e,r,o,l,h,d){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,l,h,d);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,l){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Rc(i,e){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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function oc(i,e,r){const o={color:{source:vs,composite:n},number:{source:Ua,composite:vs}},l=function(h){return{"line-pattern":{source:W,composite:W},"fill-pattern":{source:W,composite:W},"fill-extrusion-pattern":{source:W,composite:W}}[h]}(i);return l&&l[r]||o[e][r]}He("ConstantBinder",ur),He("CrossFadedConstantBinder",xr),He("SourceExpressionBinder",ni),He("CrossFadedCompositeBinder",xn),He("CompositeExpressionBinder",hr),He("ProgramConfiguration",Va,{omit:["_buffers"]}),He("ProgramConfigurationSet",Oo);var bi=8192;const xl=Math.pow(2,14)-1,fa=-xl-1;function Uo(i){const e=bi/i.extent,r=i.loadGeometry();for(let o=0;od.x+1||_d.y+1)&&di("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function ma(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Uo(i):[]}}function sc(i,e,r,o,l){i.emplaceBack(2*e+(o+1)/2,2*r+(l+1)/2)}class Fc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new V,this.indexArray=new ke,this.segments=new Ge,this.programConfigurations=new Oo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const l=this.layers[0],h=[];let d=null,m=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),m=!d.isConstant());for(const{feature:_,id:T,index:S,sourceLayerIndex:A}of e){const z=this.layers[0]._featureFilter.needGeometry,D=ma(_,z);if(!this.layers[0]._featureFilter.filter(new Mi(this.zoom),D,o))continue;const B=m?d.evaluate(D,{},o):void 0,Z={id:T,properties:_.properties,type:_.type,sourceLayerIndex:A,index:S,geometry:z?D.geometry:Uo(_),patterns:{},sortKey:B};h.push(Z)}m&&h.sort((_,T)=>_.sortKey-T.sortKey);for(const _ of h){const{geometry:T,index:S,sourceLayerIndex:A}=_,z=e[S].feature;this.addFeature(_,T,S,o),r.featureIndex.insert(z,T,S,A,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ct),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,o,l){for(const h of r)for(const d of h){const m=d.x,_=d.y;if(m<0||m>=bi||_<0||_>=bi)continue;const T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=T.vertexLength;sc(this.layoutVertexArray,m,_,-1,-1),sc(this.layoutVertexArray,m,_,1,-1),sc(this.layoutVertexArray,m,_,1,1),sc(this.layoutVertexArray,m,_,-1,1),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+3,S+2),T.vertexLength+=4,T.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},l)}}function Hu(i,e){for(let r=0;r1){if(Bc(i,e))return!0;for(let o=0;o1?r:r.sub(e)._mult(l)._add(e))}function Yu(i,e){let r,o,l,h=!1;for(let d=0;de.y!=l.y>e.y&&e.x<(l.x-o.x)*(e.y-o.y)/(l.y-o.y)+o.x&&(h=!h)}return h}function ja(i,e){let r=!1;for(let o=0,l=i.length-1;oe.y!=d.y>e.y&&e.x<(d.x-h.x)*(e.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function ep(i,e,r){const o=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const h=zt(i,e,r[0]);return h!==zt(i,e,r[1])||h!==zt(i,e,r[2])||h!==zt(i,e,r[3])}function bl(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ac(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function lc(i,e,r,o,l){if(!e[0]&&!e[1])return i;const h=me.convert(e)._mult(l);r==="viewport"&&h._rotate(-o);const d=[];for(let m=0;mi.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||o.x>e.width-l.width||o.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,m=e.data;if(d===m)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{e[i.evaluationKey]=_;const T=i.expression.evaluate(e);l.data[d+m+0]=Math.floor(255*T.r/T.a),l.data[d+m+1]=Math.floor(255*T.g/T.a),l.data[d+m+2]=Math.floor(255*T.b/T.a),l.data[d+m+3]=Math.floor(255*T.a)};if(i.clips)for(let d=0,m=0;d80*r){o=h=i[0],l=d=i[1];for(var B=r;Bh&&(h=m),_>d&&(d=_);T=(T=Math.max(h-o,d-l))!==0?32767/T:0}return El(z,D,r,o,l,T,0),D}function lh(i,e,r,o,l){var h,d;if(l===qc(i,e,r,o)>0)for(h=e;h=e;h-=o)d=hh(h,i[h],i[h+1],d);return d&&hc(d,d.next)&&(Il(d),d=d.next),d}function ga(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!hc(o,o.next)&&Ji(o.prev,o,o.next)!==0)o=o.next;else{if(Il(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function El(i,e,r,o,l,h,d){if(i){!d&&h&&function(S,A,z,D){var B=S;do B.z===0&&(B.z=$c(B.x,B.y,A,z,D)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==S);B.prevZ.nextZ=null,B.prevZ=null,function(Z){var $,ne,ue,te,fe,ye,Ee,rt,ct=1;do{for(ne=Z,Z=null,fe=null,ye=0;ne;){for(ye++,ue=ne,Ee=0,$=0;$0||rt>0&&ue;)Ee!==0&&(rt===0||!ue||ne.z<=ue.z)?(te=ne,ne=ne.nextZ,Ee--):(te=ue,ue=ue.nextZ,rt--),fe?fe.nextZ=te:Z=te,te.prevZ=fe,fe=te;ne=ue}fe.nextZ=null,ct*=2}while(ye>1)}(B)}(i,o,l,h);for(var m,_,T=i;i.prev!==i.next;)if(m=i.prev,_=i.next,h?lp(i,o,l,h):ap(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),Il(i),i=_.next,T=_.next;else if((i=_)===T){d?d===1?El(i=cp(ga(i),e,r),e,r,o,l,h,2):d===2&&up(i,e,r,o,l,h):El(ga(i),e,r,o,l,h,1);break}}}function ap(i){var e=i.prev,r=i,o=i.next;if(Ji(e,r,o)>=0)return!1;for(var l=e.x,h=r.x,d=o.x,m=e.y,_=r.y,T=o.y,S=lh?l>d?l:d:h>d?h:d,D=m>_?m>T?m:T:_>T?_:T,B=o.next;B!==e;){if(B.x>=S&&B.x<=z&&B.y>=A&&B.y<=D&&Ga(l,m,h,_,d,T,B.x,B.y)&&Ji(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function lp(i,e,r,o){var l=i.prev,h=i,d=i.next;if(Ji(l,h,d)>=0)return!1;for(var m=l.x,_=h.x,T=d.x,S=l.y,A=h.y,z=d.y,D=m<_?m_?m>T?m:T:_>T?_:T,$=S>A?S>z?S:z:A>z?A:z,ne=$c(D,B,e,r,o),ue=$c(Z,$,e,r,o),te=i.prevZ,fe=i.nextZ;te&&te.z>=ne&&fe&&fe.z<=ue;){if(te.x>=D&&te.x<=Z&&te.y>=B&&te.y<=$&&te!==l&&te!==d&&Ga(m,S,_,A,T,z,te.x,te.y)&&Ji(te.prev,te,te.next)>=0||(te=te.prevZ,fe.x>=D&&fe.x<=Z&&fe.y>=B&&fe.y<=$&&fe!==l&&fe!==d&&Ga(m,S,_,A,T,z,fe.x,fe.y)&&Ji(fe.prev,fe,fe.next)>=0))return!1;fe=fe.nextZ}for(;te&&te.z>=ne;){if(te.x>=D&&te.x<=Z&&te.y>=B&&te.y<=$&&te!==l&&te!==d&&Ga(m,S,_,A,T,z,te.x,te.y)&&Ji(te.prev,te,te.next)>=0)return!1;te=te.prevZ}for(;fe&&fe.z<=ue;){if(fe.x>=D&&fe.x<=Z&&fe.y>=B&&fe.y<=$&&fe!==l&&fe!==d&&Ga(m,S,_,A,T,z,fe.x,fe.y)&&Ji(fe.prev,fe,fe.next)>=0)return!1;fe=fe.nextZ}return!0}function cp(i,e,r){var o=i;do{var l=o.prev,h=o.next.next;!hc(l,h)&&ch(l,o,o.next,h)&&Sl(l,h)&&Sl(h,l)&&(e.push(l.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Il(o),Il(o.next),o=i=h),o=o.next}while(o!==i);return ga(o)}function up(i,e,r,o,l,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&mp(d,m)){var _=uh(d,m);return d=ga(d,d.next),_=ga(_,_.next),El(d,e,r,o,l,h,0),void El(_,e,r,o,l,h,0)}m=m.next}d=d.next}while(d!==i)}function hp(i,e){return i.x-e.x}function dp(i,e){var r=function(l,h){var d,m=h,_=l.x,T=l.y,S=-1/0;do{if(T<=m.y&&T>=m.next.y&&m.next.y!==m.y){var A=m.x+(T-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(A<=_&&A>S&&(S=A,d=m.x=m.x&&m.x>=B&&_!==m.x&&Ga(Td.x||m.x===d.x&&pp(d,m)))&&(d=m,$=z)),m=m.next;while(m!==D);return d}(i,e);if(!r)return e;var o=uh(r,i);return ga(o,o.next),ga(r,r.next)}function pp(i,e){return Ji(i.prev,i,e.prev)<0&&Ji(e.next,i,i.next)<0}function $c(i,e,r,o,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fp(i){var e=i,r=i;do(e.x=(i-d)*(h-m)&&(i-d)*(o-m)>=(r-d)*(e-m)&&(r-d)*(h-m)>=(l-d)*(o-m)}function mp(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==o.i&&l.next.i!==o.i&&ch(l,l.next,r,o))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Sl(i,e)&&Sl(e,i)&&function(r,o){var l=r,h=!1,d=(r.x+o.x)/2,m=(r.y+o.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&d<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==r);return h}(i,e)&&(Ji(i.prev,i,e.prev)||Ji(i,e.prev,e))||hc(i,e)&&Ji(i.prev,i,i.next)>0&&Ji(e.prev,e,e.next)>0)}function Ji(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function hc(i,e){return i.x===e.x&&i.y===e.y}function ch(i,e,r,o){var l=pc(Ji(i,e,r)),h=pc(Ji(i,e,o)),d=pc(Ji(r,o,i)),m=pc(Ji(r,o,e));return l!==h&&d!==m||!(l!==0||!dc(i,r,e))||!(h!==0||!dc(i,o,e))||!(d!==0||!dc(r,i,o))||!(m!==0||!dc(r,e,o))}function dc(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function pc(i){return i>0?1:i<0?-1:0}function Sl(i,e){return Ji(i.prev,i,i.next)<0?Ji(i,e,i.next)>=0&&Ji(i,i.prev,e)>=0:Ji(i,e,i.prev)<0||Ji(i,i.next,e)<0}function uh(i,e){var r=new Gc(i.i,i.x,i.y),o=new Gc(e.i,e.x,e.y),l=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function hh(i,e,r,o){var l=new Gc(i,e,r);return o?(l.next=o.next,l.prev=o,o.next.prev=l,o.next=l):(l.prev=l,l.next=l),l}function Il(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Gc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qc(i,e,r,o){for(var l=0,h=e,d=r-o;h0&&r.holes.push(o+=i[l-1].length)}return r};var dh=ae(jc.exports);function gp(i,e,r,o,l){ph(i,e,r||0,o||i.length-1,l||_p)}function ph(i,e,r,o,l){for(;o>r;){if(o-r>600){var h=o-r+1,d=e-r+1,m=Math.log(h),_=.5*Math.exp(2*m/3),T=.5*Math.sqrt(m*_*(h-_)/h)*(d-h/2<0?-1:1);ph(i,e,Math.max(r,Math.floor(e-d*_/h+T)),Math.min(o,Math.floor(e+(h-d)*_/h+T)),l)}var S=i[e],A=r,z=o;for(Cl(i,r,e),l(i[o],S)>0&&Cl(i,r,o);A0;)z--}l(i[r],S)===0?Cl(i,r,z):Cl(i,++z,o),z<=e&&(r=z+1),e<=z&&(o=z-1)}}function Cl(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function _p(i,e){return ie?1:0}function Zc(i,e){const r=i.length;if(r<=1)return[i];const o=[];let l,h;for(let d=0;d1)for(let d=0;dr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new j,this.indexArray=new ke,this.indexArray2=new Qe,this.programConfigurations=new Oo(e.layers,e.zoom),this.segments=new Ge,this.segments2=new Ge,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Xc("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),h=!l.isConstant(),d=[];for(const{feature:m,id:_,index:T,sourceLayerIndex:S}of e){const A=this.layers[0]._featureFilter.needGeometry,z=ma(m,A);if(!this.layers[0]._featureFilter.filter(new Mi(this.zoom),z,o))continue;const D=h?l.evaluate(z,{},o,r.availableImages):void 0,B={id:_,properties:m.properties,type:m.type,sourceLayerIndex:S,index:T,geometry:A?z.geometry:Uo(m),patterns:{},sortKey:D};d.push(B)}h&&d.sort((m,_)=>m.sortKey-_.sortKey);for(const m of d){const{geometry:_,index:T,sourceLayerIndex:S}=m;if(this.hasPattern){const A=Wc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(m,_,T,o,{});r.featureIndex.insert(e[T].feature,_,T,S,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,o,l,h){for(const d of Zc(r,500)){let m=0;for(const D of d)m+=D.length;const _=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),T=_.vertexLength,S=[],A=[];for(const D of d){if(D.length===0)continue;D!==d[0]&&A.push(S.length/2);const B=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),Z=B.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(Z+D.length-1,Z),S.push(D[0].x),S.push(D[0].y);for(let $=1;$>3}if(l--,o===1||o===2)h+=i.readSVarint(),d+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new Tp(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},qa.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,l=0,h=0,d=1/0,m=-1/0,_=1/0,T=-1/0;i.pos>3}if(o--,r===1||r===2)(l+=i.readSVarint())m&&(m=l),(h+=i.readSVarint())<_&&(_=h),h>T&&(T=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,m,T]},qa.prototype.toGeoJSON=function(i,e,r){var o,l,h=this.extent*Math.pow(2,r),d=this.extent*i,m=this.extent*e,_=this.loadGeometry(),T=qa.types[this.type];function S(D){for(var B=0;B>3;l=d===1?o.readString():d===2?o.readFloat():d===3?o.readDouble():d===4?o.readVarint64():d===5?o.readVarint():d===6?o.readSVarint():d===7?o.readBoolean():null}return l}(r))}yh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Ip(this._pbf,e,this.extent,this._keys,this._values)};var Ap=_h;function Mp(i,e,r){if(i===3){var o=new Ap(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}js.VectorTile=function(i,e){this.layers=i.readFields(Mp,{},e)},js.VectorTileFeature=gh,js.VectorTileLayer=_h;const Pp=js.VectorTileFeature.types,Kc=Math.pow(2,13);function Al(i,e,r,o,l,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*Kc)+d,l*Kc*2,h*Kc*2,Math.round(m))}class Jc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new K,this.centroidVertexArray=new G,this.indexArray=new ke,this.programConfigurations=new Oo(e.layers,e.zoom),this.segments=new Ge,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=Xc("fill-extrusion",this.layers,r);for(const{feature:l,id:h,index:d,sourceLayerIndex:m}of e){const _=this.layers[0]._featureFilter.needGeometry,T=ma(l,_);if(!this.layers[0]._featureFilter.filter(new Mi(this.zoom),T,o))continue;const S={id:h,sourceLayerIndex:m,index:d,geometry:_?T.geometry:Uo(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Wc("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,d,o,{}),r.featureIndex.insert(l,S.geometry,d,m,this.index,!0)}}addFeatures(e,r,o){for(const l of this.features){const{geometry:h}=l;this.addFeature(l,h,l.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,bp.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,o,l,h){const d={x:0,y:0,vertexCount:0};for(const m of Zc(r,500)){let _=0;for(const B of m)_+=B.length;let T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const B of m){if(B.length===0||zp(B))continue;let Z=0;for(let $=0;$=1){const ue=B[$-1];if(!kp(ne,ue)){T.vertexLength+4>Ge.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const te=ne.sub(ue)._perp()._unit(),fe=ue.dist(ne);Z+fe>32768&&(Z=0),Al(this.layoutVertexArray,ne.x,ne.y,te.x,te.y,0,0,Z),Al(this.layoutVertexArray,ne.x,ne.y,te.x,te.y,0,1,Z),d.x+=2*ne.x,d.y+=2*ne.y,d.vertexCount+=2,Z+=fe,Al(this.layoutVertexArray,ue.x,ue.y,te.x,te.y,0,0,Z),Al(this.layoutVertexArray,ue.x,ue.y,te.x,te.y,0,1,Z),d.x+=2*ue.x,d.y+=2*ue.y,d.vertexCount+=2;const ye=T.vertexLength;this.indexArray.emplaceBack(ye,ye+2,ye+1),this.indexArray.emplaceBack(ye+1,ye+2,ye+3),T.vertexLength+=4,T.primitiveLength+=2}}}}if(T.vertexLength+_>Ge.MAX_VERTEX_ARRAY_LENGTH&&(T=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),Pp[e.type]!=="Polygon")continue;const S=[],A=[],z=T.vertexLength;for(const B of m)if(B.length!==0){B!==m[0]&&A.push(S.length/2);for(let Z=0;Zbi)||i.y===e.y&&(i.y<0||i.y>bi)}function zp(i){return i.every(e=>e.x<0)||i.every(e=>e.x>bi)||i.every(e=>e.y<0)||i.every(e=>e.y>bi)}let vh;He("FillExtrusionBucket",Jc,{omit:["layers","features"]});var Lp={get paint(){return vh=vh||new ln({"fill-extrusion-opacity":new ht(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new _t(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ht(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ht(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ha(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new _t(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new _t(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ht(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function Ml(i,e){return i.x*e.x+i.y*e.y}function xh(i,e){if(i.length===1){let r=0;const o=e[r++];let l;for(;!l||o.equals(l);)if(l=e[r++],!l)return 1/0;for(;rr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new re,this.layoutVertexArray2=new ge,this.indexArray=new ke,this.programConfigurations=new Oo(e.layers,e.zoom),this.segments=new Ge,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Xc("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),h=!l.isConstant(),d=[];for(const{feature:m,id:_,index:T,sourceLayerIndex:S}of e){const A=this.layers[0]._featureFilter.needGeometry,z=ma(m,A);if(!this.layers[0]._featureFilter.filter(new Mi(this.zoom),z,o))continue;const D=h?l.evaluate(z,{},o):void 0,B={id:_,properties:m.properties,type:m.type,sourceLayerIndex:S,index:T,geometry:A?z.geometry:Uo(m),patterns:{},sortKey:D};d.push(B)}h&&d.sort((m,_)=>m.sortKey-_.sortKey);for(const m of d){const{geometry:_,index:T,sourceLayerIndex:S}=m;if(this.hasPattern){const A=Wc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(m,_,T,o,{});r.featureIndex.insert(e[T].feature,_,T,S,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Bp)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rp),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,l,h){const d=this.layers[0].layout,m=d.get("line-join").evaluate(e,{}),_=d.get("line-cap"),T=d.get("line-miter-limit"),S=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const A of r)this.addLine(A,e,m,_,T,S);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,l)}addLine(e,r,o,l,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ne=0;ne=2&&e[_-1].equals(e[_-2]);)_--;let T=0;for(;T<_-1&&e[T].equals(e[T+1]);)T++;if(_<(m?3:2))return;o==="bevel"&&(h=1.05);const S=this.overscaling<=16?15*bi/(512*this.overscaling):0,A=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let z,D,B,Z,$;this.e1=this.e2=-1,m&&(z=e[_-2],$=e[T].sub(z)._unit()._perp());for(let ne=T;ne<_;ne++){if(B=ne===_-1?m?e[T+1]:void 0:e[ne+1],B&&e[ne].equals(B))continue;$&&(Z=$),z&&(D=z),z=e[ne],$=B?B.sub(z)._unit()._perp():Z,Z=Z||$;let ue=Z.add($);ue.x===0&&ue.y===0||ue._unit();const te=Z.x*$.x+Z.y*$.y,fe=ue.x*$.x+ue.y*$.y,ye=fe!==0?1/fe:1/0,Ee=2*Math.sqrt(2-2*fe),rt=fe0;if(rt&&ne>T){const Ve=z.dist(D);if(Ve>2*S){const Ye=z.sub(z.sub(D)._mult(S/Ve)._round());this.updateDistance(D,Ye),this.addCurrentVertex(Ye,Z,0,0,A),D=Ye}}const Je=D&&B;let Ze=Je?o:m?"butt":l;if(Je&&Ze==="round"&&(yeh&&(Ze="bevel"),Ze==="bevel"&&(ye>2&&(Ze="flipbevel"),ye100)ue=$.mult(-1);else{const Ve=ye*Z.add($).mag()/Z.sub($).mag();ue._perp()._mult(Ve*(ct?-1:1))}this.addCurrentVertex(z,ue,0,0,A),this.addCurrentVertex(z,ue.mult(-1),0,0,A)}else if(Ze==="bevel"||Ze==="fakeround"){const Ve=-Math.sqrt(ye*ye-1),Ye=ct?Ve:0,Xe=ct?0:Ve;if(D&&this.addCurrentVertex(z,Z,Ye,Xe,A),Ze==="fakeround"){const De=Math.round(180*Ee/Math.PI/20);for(let mt=1;mt2*S){const Ye=z.add(B.sub(z)._mult(S/Ve)._round());this.updateDistance(z,Ye),this.addCurrentVertex(Ye,$,0,0,A),z=Ye}}}}addCurrentVertex(e,r,o,l,h,d=!1){const m=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,d,!1,o,h),this.addHalfVertex(e,m,_,d,!0,-l,h),this.distance>bh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,o,l,h,d))}addHalfVertex({x:e,y:r},o,l,h,d,m,_){const T=.5*(this.lineClips?this.scaledDistance*(bh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*o)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1)|(63&T)<<2,T>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const S=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),_.primitiveLength++),d?this.e2=S:this.e1=S}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let wh,Th;He("LineBucket",Yc,{omit:["layers","patternFeatures"]});var Eh={get paint(){return Th=Th||new ln({"line-opacity":new _t(_e.paint_line["line-opacity"]),"line-color":new _t(_e.paint_line["line-color"]),"line-translate":new ht(_e.paint_line["line-translate"]),"line-translate-anchor":new ht(_e.paint_line["line-translate-anchor"]),"line-width":new _t(_e.paint_line["line-width"]),"line-gap-width":new _t(_e.paint_line["line-gap-width"]),"line-offset":new _t(_e.paint_line["line-offset"]),"line-blur":new _t(_e.paint_line["line-blur"]),"line-dasharray":new fl(_e.paint_line["line-dasharray"]),"line-pattern":new ha(_e.paint_line["line-pattern"]),"line-gradient":new ml(_e.paint_line["line-gradient"])})},get layout(){return wh=wh||new ln({"line-cap":new ht(_e.layout_line["line-cap"]),"line-join":new _t(_e.layout_line["line-join"]),"line-miter-limit":new ht(_e.layout_line["line-miter-limit"]),"line-round-limit":new ht(_e.layout_line["line-round-limit"]),"line-sort-key":new _t(_e.layout_line["line-sort-key"])})}};class Np extends _t{possiblyEvaluate(e,r){return r=new Mi(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,o,l){return r=at({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,o,l)}}let fc;function Sh(i,e){return e>0?e+2*i:i}const Vp=ir([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),jp=ir([{name:"a_projected_pos",components:3,type:"Float32"}],4);ir([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $p=ir([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ir([{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 Ih=ir([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Gp=ir([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function qp(i,e,r){return i.sections.forEach(o=>{o.text=function(l,h,d){const m=h.layout.get("text-transform").evaluate(d,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),Bn.applyArabicShaping&&(l=Bn.applyArabicShaping(l)),l}(o.text,e,r)}),i}ir([{name:"triangle",components:3,type:"Uint16"}]),ir([{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"}]),ir([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ir([{type:"Float32",name:"offsetX"}]),ir([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Pl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var br=24,Ch=hi,Ah=function(i,e,r,o,l){var h,d,m=8*l-o-1,_=(1<>1,S=-7,A=r?l-1:0,z=r?-1:1,D=i[e+A];for(A+=z,h=D&(1<<-S)-1,D>>=-S,S+=m;S>0;h=256*h+i[e+A],A+=z,S-=8);for(d=h&(1<<-S)-1,h>>=-S,S+=o;S>0;d=256*d+i[e+A],A+=z,S-=8);if(h===0)h=1-T;else{if(h===_)return d?NaN:1/0*(D?-1:1);d+=Math.pow(2,o),h-=T}return(D?-1:1)*d*Math.pow(2,h-o)},Mh=function(i,e,r,o,l,h){var d,m,_,T=8*h-l-1,S=(1<>1,z=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=o?0:h-1,B=o?1:-1,Z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,d=S):(d=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-d))<1&&(d--,_*=2),(e+=d+A>=1?z/_:z*Math.pow(2,1-A))*_>=2&&(d++,_/=2),d+A>=S?(m=0,d=S):d+A>=1?(m=(e*_-1)*Math.pow(2,l),d+=A):(m=e*Math.pow(2,A-1)*Math.pow(2,l),d=0));l>=8;i[r+D]=255&m,D+=B,m/=256,l-=8);for(d=d<0;i[r+D]=255&d,D+=B,d/=256,T-=8);i[r+D-B]|=128*Z};function hi(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}hi.Varint=0,hi.Fixed64=1,hi.Bytes=2,hi.Fixed32=5;var Qc=4294967296,Ph=1/Qc,kh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ws(i){return i.type===hi.Bytes?i.readVarint()+i.pos:i.pos+1}function Za(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function zh(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var l=r.pos-1;l>=i;l--)r.buf[l+o]=r.buf[l]}function Zp(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Lh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}hi.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,h=this.pos;this.type=7&o,i(l,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=mc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Lh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=mc(this.buf,this.pos)+mc(this.buf,this.pos+4)*Qc;return this.pos+=8,i},readSFixed64:function(){var i=mc(this.buf,this.pos)+Lh(this.buf,this.pos+4)*Qc;return this.pos+=8,i},readFloat:function(){var i=Ah(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Ah(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(l,h,d){var m,_,T=d.buf;if(m=(112&(_=T[d.pos++]))>>4,_<128||(m|=(127&(_=T[d.pos++]))<<3,_<128)||(m|=(127&(_=T[d.pos++]))<<10,_<128)||(m|=(127&(_=T[d.pos++]))<<17,_<128)||(m|=(127&(_=T[d.pos++]))<<24,_<128)||(m|=(1&(_=T[d.pos++]))<<31,_<128))return Za(l,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&kh?function(r,o,l){return kh.decode(r.subarray(o,l))}(this.buf,e,i):function(r,o,l){for(var h="",d=o;d239?4:S>223?3:S>191?2:1;if(d+z>l)break;z===1?S<128&&(A=S):z===2?(192&(m=r[d+1]))==128&&(A=(31&S)<<6|63&m)<=127&&(A=null):z===3?(_=r[d+2],(192&(m=r[d+1]))==128&&(192&_)==128&&((A=(15&S)<<12|(63&m)<<6|63&_)<=2047||A>=55296&&A<=57343)&&(A=null)):z===4&&(_=r[d+2],T=r[d+3],(192&(m=r[d+1]))==128&&(192&_)==128&&(192&T)==128&&((A=(15&S)<<18|(63&m)<<12|(63&_)<<6|63&T)<=65535||A>=1114112)&&(A=null)),A===null?(A=65533,z=1):A>65535&&(A-=65536,h+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),h+=String.fromCharCode(A),d+=z}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==hi.Bytes)return i.push(this.readVarint(e));var r=ws(this);for(i=i||[];this.pos127;);else if(e===hi.Bytes)this.pos=this.readVarint()+this.pos;else if(e===hi.Fixed32)this.pos+=4;else{if(e!==hi.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var o,l;if(e>=0?(o=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,d){var m=(7&h)<<4;d.buf[d.pos++]|=m|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,l,h){for(var d,m,_=0;_55295&&d<57344){if(!m){d>56319||_+1===l.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=d;continue}if(d<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=d;continue}d=m-55296<<10|d-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);d<128?o[h++]=d:(d<2048?o[h++]=d>>6|192:(d<65536?o[h++]=d>>12|224:(o[h++]=d>>18|240,o[h++]=d>>12&63|128),o[h++]=d>>6&63|128),o[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&zh(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Mh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Mh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&zh(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,hi.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Zp,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Xp,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Kp,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Wp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Hp,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Jp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Yp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Qp,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,ef,e)},writeBytesField:function(i,e){this.writeTag(i,hi.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,hi.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,hi.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,hi.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,hi.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,hi.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,hi.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,hi.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,hi.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,hi.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var eu=ae(Ch);const tu=3;function tf(i,e,r){i===1&&r.readMessage(rf,e)}function rf(i,e,r){if(i===3){const{id:o,bitmap:l,width:h,height:d,left:m,top:_,advance:T}=r.readMessage(nf,{});e.push({id:o,bitmap:new Tl({width:h+2*tu,height:d+2*tu},l),metrics:{width:h,height:d,left:m,top:_,advance:T}})}}function nf(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const Dh=tu;function Rh(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,m)=>m.h-d.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,h=0;for(const d of i)for(let m=o.length-1;m>=0;m--){const _=o[m];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,h=Math.max(h,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===_.w&&d.h===_.h){const T=o.pop();m=0&&o>=e&&_c[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new Wa;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(zl.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function gc(i,e,r,o,l,h,d,m,_,T,S,A,z,D,B,Z){const $=Wa.fromFeature(i,l);let ne;A===c.WritingMode.vertical&&$.verticalizePunctuation();const{processBidirectionalText:ue,processStyledBidirectionalText:te}=Bn;if(ue&&$.sections.length===1){ne=[];const Ee=ue($.toString(),ru($,T,h,e,o,D,B));for(const rt of Ee){const ct=new Wa;ct.text=rt,ct.sections=$.sections;for(let Je=0;Je0&&Es>En&&(En=Es)}else{const to=ct[Ut.fontStack],Sn=to&&to[Nr];if(Sn&&Sn.rect)No=Sn.rect,To=Sn.metrics;else{const Es=rt[Ut.fontStack],Bl=Es&&Es[Nr];if(!Bl)continue;To=Bl.metrics}Kr=(Or-Ut.scale)*br}Eo?(Ee.verticalizable=!0,Tn.push({glyph:Nr,imageName:Vo,x:wi,y:Pi+Kr,vertical:Eo,scale:Ut.scale,fontStack:Ut.fontStack,sectionIndex:On,metrics:To,rect:No}),wi+=Ts*Ut.scale+mt):(Tn.push({glyph:Nr,imageName:Vo,x:wi,y:Pi+Kr,vertical:Eo,scale:Ut.scale,fontStack:Ut.fontStack,sectionIndex:On,metrics:To,rect:No}),wi+=To.advance*Ut.scale+mt)}Tn.length!==0&&(dr=Math.max(wi-mt,dr),af(Tn,0,Tn.length-1,Fr,En)),wi=0;const Gi=Ve*Or+En;un.lineOffset=Math.max(En,Hr),Pi+=Gi,eo=Math.max(Gi,eo),++rr}var wr;const Br=Pi-kl,{horizontalAlign:Wr,verticalAlign:wn}=nu(Ye);(function(nr,Or,Hr,un,Tn,En,Gi,Ur,Ut){const On=(Or-Hr)*Tn;let Nr=0;Nr=En!==Gi?-Ur*un-kl:(-un*Ut+.5)*Gi;for(const Kr of nr)for(const To of Kr.positionedGlyphs)To.x+=On,To.y+=Nr})(Ee.positionedLines,Fr,Wr,wn,dr,eo,Ve,Br,Ze.length),Ee.top+=-wn*Br,Ee.bottom=Ee.top+Br,Ee.left+=-Wr*dr,Ee.right=Ee.left+dr}(ye,e,r,o,ne,d,m,_,A,T,z,Z),!function(Ee){for(const rt of Ee)if(rt.positionedGlyphs.length!==0)return!1;return!0}(fe)&&ye}const _c={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},of={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Bh(i,e,r,o,l,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*br/h+l:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+l:0}}function Oh(i,e,r,o){const l=Math.pow(i-e,2);return o?i=0;let S=0;for(let z=0;zd.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Uc([]),this.placementViewportMatrix=Uc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=jh(this.zoom,r["text-size"]),this.iconSizeData=jh(this.zoom,r["icon-size"]);const o=this.layers[0].layout,l=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=ou(o,"text-overlap","text-allow-overlap")!=="never"||ou(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(d=>c.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new au(new Oo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new au(new Oo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new w,this.lineVertexArray=new C,this.symbolInstances=new y}calculateGlyphDependencies(e,r,o,l,h){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),S=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,A=h.get("symbol-sort-key");if(this.features=[],!T&&!S)return;const z=r.iconDependencies,D=r.glyphDependencies,B=r.availableImages,Z=new Mi(this.zoom);for(const{feature:$,id:ne,index:ue,sourceLayerIndex:te}of e){const fe=l._featureFilter.needGeometry,ye=ma($,fe);if(!l._featureFilter.filter(Z,ye,o))continue;let Ee,rt;if(fe||(ye.geometry=Uo($)),T){const Je=l.getValueAndResolveTokens("text-field",ye,o,B),Ze=vi.factory(Je);hf(Ze)&&(this.hasRTLText=!0),(!this.hasRTLText||hl()==="unavailable"||this.hasRTLText&&Bn.isParsed())&&(Ee=qp(Ze,l,ye))}if(S){const Je=l.getValueAndResolveTokens("icon-image",ye,o,B);rt=Je instanceof Sr?Je:Sr.fromString(Je)}if(!Ee&&!rt)continue;const ct=this.sortFeaturesByKey?A.evaluate(ye,{},o):void 0;if(this.features.push({id:ne,text:Ee,icon:rt,index:ue,sourceLayerIndex:te,geometry:ye.geometry,properties:$.properties,type:cf[$.type],sortKey:ct}),rt&&(z[rt.name]=!0),Ee){const Je=d.evaluate(ye,{},o).join(","),Ze=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.WritingMode.vertical)>=0;for(const Ve of Ee.sections)if(Ve.image)z[Ve.image.name]=!0;else{const Ye=Do(Ee.toString()),Xe=Ve.fontStack||Je,De=D[Xe]=D[Xe]||{};this.calculateGlyphDependencies(Ve.text,De,Ze,this.allowVerticalPlacement,Ye)}}}h.get("symbol-placement")==="line"&&(this.features=function($){const ne={},ue={},te=[];let fe=0;function ye(Je){te.push($[Je]),fe++}function Ee(Je,Ze,Ve){const Ye=ue[Je];return delete ue[Je],ue[Ze]=Ye,te[Ye].geometry[0].pop(),te[Ye].geometry[0]=te[Ye].geometry[0].concat(Ve[0]),Ye}function rt(Je,Ze,Ve){const Ye=ne[Ze];return delete ne[Ze],ne[Je]=Ye,te[Ye].geometry[0].shift(),te[Ye].geometry[0]=Ve[0].concat(te[Ye].geometry[0]),Ye}function ct(Je,Ze,Ve){const Ye=Ve?Ze[0][Ze[0].length-1]:Ze[0][0];return`${Je}:${Ye.x}:${Ye.y}`}for(let Je=0;Je<$.length;Je++){const Ze=$[Je],Ve=Ze.geometry,Ye=Ze.text?Ze.text.toString():null;if(!Ye){ye(Je);continue}const Xe=ct(Ye,Ve),De=ct(Ye,Ve,!0);if(Xe in ue&&De in ne&&ue[Xe]!==ne[De]){const mt=rt(Xe,De,Ve),ut=Ee(Xe,De,te[mt].geometry);delete ne[Xe],delete ue[De],ue[ct(Ye,te[ut].geometry,!0)]=ut,te[mt].geometry=null}else Xe in ue?Ee(Xe,De,Ve):De in ne?rt(Xe,De,Ve):(ye(Je),ne[Xe]=fe-1,ue[De]=fe-1)}return te.filter(Je=>Je.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,ne)=>$.sortKey-ne.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const d={};for(let m=e.segment+1;m=0;m--)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m0}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(e,r){const o=e.placedSymbolArray.get(r),l=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;hl[m]-l[_]||h[_]-h[m]),d}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((l,h,d)=>{l>=0&&d.indexOf(l)===h&&this.addIndicesForPlacedSymbol(this.text,l)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let $h,Gh;He("SymbolBucket",Ha,{omit:["layers","collisionBoxArray","features","compareText"]}),Ha.MAX_GLYPHS=65535,Ha.addDynamicAttributes=su;var cu={get paint(){return Gh=Gh||new ln({"icon-opacity":new _t(_e.paint_symbol["icon-opacity"]),"icon-color":new _t(_e.paint_symbol["icon-color"]),"icon-halo-color":new _t(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new _t(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new _t(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new ht(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new ht(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new _t(_e.paint_symbol["text-opacity"]),"text-color":new _t(_e.paint_symbol["text-color"],{runtimeType:mr,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new _t(_e.paint_symbol["text-halo-color"]),"text-halo-width":new _t(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new _t(_e.paint_symbol["text-halo-blur"]),"text-translate":new ht(_e.paint_symbol["text-translate"]),"text-translate-anchor":new ht(_e.paint_symbol["text-translate-anchor"])})},get layout(){return $h=$h||new ln({"symbol-placement":new ht(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new ht(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ht(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new _t(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ht(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ht(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ht(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ht(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new ht(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ht(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new _t(_e.layout_symbol["icon-size"]),"icon-text-fit":new ht(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ht(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new _t(_e.layout_symbol["icon-image"]),"icon-rotate":new _t(_e.layout_symbol["icon-rotate"]),"icon-padding":new _t(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new ht(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new _t(_e.layout_symbol["icon-offset"]),"icon-anchor":new _t(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ht(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ht(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ht(_e.layout_symbol["text-rotation-alignment"]),"text-field":new _t(_e.layout_symbol["text-field"]),"text-font":new _t(_e.layout_symbol["text-font"]),"text-size":new _t(_e.layout_symbol["text-size"]),"text-max-width":new _t(_e.layout_symbol["text-max-width"]),"text-line-height":new ht(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new _t(_e.layout_symbol["text-letter-spacing"]),"text-justify":new _t(_e.layout_symbol["text-justify"]),"text-radial-offset":new _t(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ht(_e.layout_symbol["text-variable-anchor"]),"text-anchor":new _t(_e.layout_symbol["text-anchor"]),"text-max-angle":new ht(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new ht(_e.layout_symbol["text-writing-mode"]),"text-rotate":new _t(_e.layout_symbol["text-rotate"]),"text-padding":new ht(_e.layout_symbol["text-padding"]),"text-keep-upright":new ht(_e.layout_symbol["text-keep-upright"]),"text-transform":new _t(_e.layout_symbol["text-transform"]),"text-offset":new _t(_e.layout_symbol["text-offset"]),"text-allow-overlap":new ht(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new ht(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new ht(_e.layout_symbol["text-ignore-placement"]),"text-optional":new ht(_e.layout_symbol["text-optional"])})}};class qh{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:gn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}He("FormatSectionOverride",qh,{omit:["defaultValue"]});class vc extends xo{constructor(e){super(e,cu)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const o=this.layout.get("text-writing-mode");if(o){const l=[];for(const h of o)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,l){const h=this.layout.get(e).evaluate(r,{},o,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||rn(d.value)||!h?h:function(m,_){return _.replace(/{([^{}]+)}/g,(T,S)=>S in m?String(m[S]):"")}(r.properties,h)}createBucket(e){return new Ha(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of cu.paint.overridableProperties){if(!vc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new qh(r),l=new Wn(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Ho("source",l):new It("composite",l,r.value.zoomStops),this.paint._values[e]=new vo(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&vc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),l=cu.paint.properties[r];let h=!1;const d=m=>{for(const _ of m)if(l.overrides&&l.overrides.hasOverride(_))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof vi)d(o.value.value.sections);else if(o.value.kind==="source"){const m=T=>{h||(T instanceof lo&&Fi(T.value)===Wi?d(T.value.sections):T instanceof hs?d(T.sections):T.eachChild(m))},_=o.value;_._styleExpression&&m(_._styleExpression.expression)}return h}}let Zh;var df={get paint(){return Zh=Zh||new ln({"background-color":new ht(_e.paint_background["background-color"]),"background-pattern":new fl(_e.paint_background["background-pattern"]),"background-opacity":new ht(_e.paint_background["background-opacity"])})}};let Xh;var pf={get paint(){return Xh=Xh||new ln({"raster-opacity":new ht(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new ht(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ht(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ht(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new ht(_e.paint_raster["raster-saturation"]),"raster-contrast":new ht(_e.paint_raster["raster-contrast"]),"raster-resampling":new ht(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new ht(_e.paint_raster["raster-fade-duration"])})}};class ff extends xo{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}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")}}const mf={circle:class extends xo{constructor(i){super(i,tp)}createBucket(i){return new Fc(i)}queryRadius(i){const e=i;return bl("circle-radius",this,e)+bl("circle-stroke-width",this,e)+ac(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,l,h,d,m){const _=lc(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,d),T=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),S=this.paint.get("circle-pitch-alignment")==="map",A=S?_:function(D,B){return D.map(Z=>ih(Z,B))}(_,m),z=S?T*d:T;for(const D of o)for(const B of D){const Z=S?B:ih(B,m);let $=z;const ne=cc([],[B.x,B.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=ne[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=h.cameraToCenterDistance/ne[3]),Jd(A,Z,$))return!0}return!1}},heatmap:class extends xo{createBucket(i){return new rh(i)}constructor(i){super(i,rp),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sh({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends xo{constructor(i){super(i,np)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends xo{constructor(i){super(i,vp)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Hc(i)}queryRadius(){return ac(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,l,h,d){return Ku(lc(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends xo{constructor(i){super(i,Lp)}createBucket(i){return new Jc(i)}queryRadius(){return ac(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,l,h,d,m){const _=lc(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,d),T=this.paint.get("fill-extrusion-height").evaluate(e,r),S=this.paint.get("fill-extrusion-base").evaluate(e,r),A=function(D,B,Z,$){const ne=[];for(const ue of D){const te=[ue.x,ue.y,0,1];cc(te,te,B),ne.push(new me(te[0]/te[3],te[1]/te[3]))}return ne}(_,m),z=function(D,B,Z,$){const ne=[],ue=[],te=$[8]*B,fe=$[9]*B,ye=$[10]*B,Ee=$[11]*B,rt=$[8]*Z,ct=$[9]*Z,Je=$[10]*Z,Ze=$[11]*Z;for(const Ve of D){const Ye=[],Xe=[];for(const De of Ve){const mt=De.x,ut=De.y,Ot=$[0]*mt+$[4]*ut+$[12],wi=$[1]*mt+$[5]*ut+$[13],Pi=$[2]*mt+$[6]*ut+$[14],dr=$[3]*mt+$[7]*ut+$[15],eo=Pi+ye,Fr=dr+Ee,rr=Ot+rt,wr=wi+ct,Br=Pi+Je,Wr=dr+Ze,wn=new me((Ot+te)/Fr,(wi+fe)/Fr);wn.z=eo/Fr,Ye.push(wn);const nr=new me(rr/Wr,wr/Wr);nr.z=Br/Wr,Xe.push(nr)}ne.push(Ye),ue.push(Xe)}return[ne,ue]}(o,S,T,m);return function(D,B,Z){let $=1/0;Ku(Z,B)&&($=xh(Z,B[0]));for(let ne=0;ne=3){for(let Z=0;Z{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const uu=63710088e-1;class qs{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new qs(yt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,l=e.lat*r,h=Math.sin(o)*Math.sin(l)+Math.cos(o)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return uu*Math.acos(Math.min(h,1))}static convert(e){if(e instanceof qs)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new qs(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new qs(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Wh=2*Math.PI*uu;function Hh(i){return Wh*Math.cos(i*Math.PI/180)}function Kh(i){return(180+i)/360}function Jh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Yh(i,e){return i/Hh(e)}function hu(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class xc{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=qs.convert(e);return new xc(Kh(o.lng),Jh(o.lat),Yh(r,o.lat))}toLngLat(){return new qs(360*this.x-180,hu(this.y))}toAltitude(){return this.z*Hh(hu(this.y))}meterInMercatorCoordinateUnits(){return 1/Wh*(e=hu(this.y),1/Math.cos(e*Math.PI/180));var e}}function Qh(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class du{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=o,this.key=Dl(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const l=(d=this.y,m=this.z,_=Qh(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),T=Qh(256*(h+1),256*(d+1),m),_[0]+","+_[1]+","+T[0]+","+T[1]);var h,d,m,_,T;const S=function(A,z,D){let B,Z="";for(let $=A;$>0;$--)B=1<<$-1,Z+=(z&B?1:0)+(D&B?2:0);return Z}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,S).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new me((e.x*r-this.x)*bi,(e.y*r-this.y)*bi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ed{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Dl(e,r.z,r.z,r.x,r.y)}}class Qn{constructor(e,r,o,l,h){if(e= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new du(o,+l,+h),this.key=Dl(r,e,o,l,h)}clone(){return new Qn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Qn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Qn(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?Dl(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Dl(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Qn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,l=2*this.canonical.y;return[new Qn(r,this.wrap,r,o,l),new Qn(r,this.wrap,r,o+1,l),new Qn(r,this.wrap,r,o,l+1),new Qn(r,this.wrap,r,o+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=m),m=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new Yn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,h=r*this.dim+this.dim,d=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:l=h-1;break;case 1:h=l+1}switch(o){case-1:d=m-1;break;case 1:m=d+1}const _=-r*this.dim,T=-o*this.dim;for(let S=d;S=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class rd{constructor(e,r,o,l,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=l,this.properties=e.properties,this.id=h}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class nd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Xt(bi,16,0),this.grid3D=new Xt(bi,16,0),this.featureIndexArray=new F,this.promoteId=r}insert(e,r,o,l,h,d){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,l,h);const _=d?this.grid3D:this.grid;for(let T=0;T=0&&A[3]>=0&&_.insert(m,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new js.VectorTile(new eu(this.rawTileData)).layers,this.sourceLayerCoder=new id(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,l){this.loadVTLayers();const h=e.params||{},d=bi/e.tileSize/e.scale,m=ra(h.filter),_=e.queryGeometry,T=e.queryPadding*d,S=sd(_),A=this.grid.query(S.minX-T,S.minY-T,S.maxX+T,S.maxY+T),z=sd(e.cameraQueryGeometry),D=this.grid3D.query(z.minX-T,z.minY-T,z.maxX+T,z.maxY+T,($,ne,ue,te)=>function(fe,ye,Ee,rt,ct){for(const Ze of fe)if(ye<=Ze.x&&Ee<=Ze.y&&rt>=Ze.x&&ct>=Ze.y)return!0;const Je=[new me(ye,Ee),new me(ye,ct),new me(rt,ct),new me(rt,Ee)];if(fe.length>2){for(const Ze of Je)if(ja(fe,Ze))return!0}for(let Ze=0;Ze(te||(te=Uo(fe)),ye.queryIntersectsFeature(_,fe,Ee,te,this.z,e.transform,d,e.pixelPosMatrix)))}return B}loadMatchingFeature(e,r,o,l,h,d,m,_,T,S,A){const z=this.bucketLayerIDs[r];if(d&&!function($,ne){for(let ue=0;ue<$.length;ue++)if(ne.indexOf($[ue])>=0)return!0;return!1}(d,z))return;const D=this.sourceLayerCoder.decode(o),B=this.vtLayers[D].feature(l);if(h.needGeometry){const $=ma(B,!0);if(!h.filter(new Mi(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!h.filter(new Mi(this.tileID.overscaledZ),B))return;const Z=this.getId(B,D);for(let $=0;${const m=e instanceof za?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,l):m})}function sd(i){let e=1/0,r=1/0,o=-1/0,l=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),l=Math.max(l,h.y);return{minX:e,minY:r,maxX:o,maxY:l}}function _f(i,e){return e-i}function ad(i,e,r,o,l){const h=[];for(let d=0;d=o&&A.x>=o||(S.x>=o?S=new me(o,S.y+(o-S.x)/(A.x-S.x)*(A.y-S.y))._round():A.x>=o&&(A=new me(o,S.y+(o-S.x)/(A.x-S.x)*(A.y-S.y))._round()),S.y>=l&&A.y>=l||(S.y>=l?S=new me(S.x+(l-S.y)/(A.y-S.y)*(A.x-S.x),l)._round():A.y>=l&&(A=new me(S.x+(l-S.y)/(A.y-S.y)*(A.x-S.x),l)._round()),_&&S.equals(_[_.length-1])||(_=[S],h.push(_)),_.push(A)))))}}return h}He("FeatureIndex",nd,{omit:["rawTileData","sourceLayerCoder"]});class Zs extends me{constructor(e,r,o,l){super(e,r),this.angle=o,l!==void 0&&(this.segment=l)}clone(){return new Zs(this.x,this.y,this.angle,this.segment)}}function ld(i,e,r,o,l){if(e.segment===void 0)return!0;let h=e,d=e.segment+1,m=0;for(;m>-r/2;){if(d--,d<0)return!1;m-=i[d].dist(h),h=i[d]}m+=i[d].dist(i[d+1]),d++;const _=[];let T=0;for(;mo;)T-=_.shift().angleDelta;if(T>l)return!1;d++,m+=S.dist(A)}return!0}function cd(i){let e=0;for(let r=0;rT){const B=(T-_)/D,Z=zr.number(A.x,z.x,B),$=zr.number(A.y,z.y,B),ne=new Zs(Z,$,z.angleTo(A),S);return ne._round(),!d||ld(i,ne,m,d,e)?ne:void 0}_+=D}}function vf(i,e,r,o,l,h,d,m,_){const T=ud(o,h,d),S=hd(o,l),A=S*d,z=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-A=0&&fe<_&&ye>=0&&ye<_&&z-T>=0&&z+T<=S){const Ee=new Zs(fe,ye,ue,B);Ee._round(),o&&!ld(i,Ee,h,o,l)||D.push(Ee)}}A+=ne}return m||D.length||d||(D=dd(i,A/2,r,o,l,h,d,!0,_)),D}He("Anchor",Zs);const Ka=bn;function pd(i,e,r,o){const l=[],h=i.image,d=h.pixelRatio,m=h.paddedRect.w-2*Ka,_=h.paddedRect.h-2*Ka,T=i.right-i.left,S=i.bottom-i.top,A=h.stretchX||[[0,m]],z=h.stretchY||[[0,_]],D=(Ve,Ye)=>Ve+Ye[1]-Ye[0],B=A.reduce(D,0),Z=z.reduce(D,0),$=m-B,ne=_-Z;let ue=0,te=B,fe=0,ye=Z,Ee=0,rt=$,ct=0,Je=ne;if(h.content&&o){const Ve=h.content;ue=bc(A,0,Ve[0]),fe=bc(z,0,Ve[1]),te=bc(A,Ve[0],Ve[2]),ye=bc(z,Ve[1],Ve[3]),Ee=Ve[0]-ue,ct=Ve[1]-fe,rt=Ve[2]-Ve[0]-te,Je=Ve[3]-Ve[1]-ye}const Ze=(Ve,Ye,Xe,De)=>{const mt=wc(Ve.stretch-ue,te,T,i.left),ut=Tc(Ve.fixed-Ee,rt,Ve.stretch,B),Ot=wc(Ye.stretch-fe,ye,S,i.top),wi=Tc(Ye.fixed-ct,Je,Ye.stretch,Z),Pi=wc(Xe.stretch-ue,te,T,i.left),dr=Tc(Xe.fixed-Ee,rt,Xe.stretch,B),eo=wc(De.stretch-fe,ye,S,i.top),Fr=Tc(De.fixed-ct,Je,De.stretch,Z),rr=new me(mt,Ot),wr=new me(Pi,Ot),Br=new me(Pi,eo),Wr=new me(mt,eo),wn=new me(ut/d,wi/d),nr=new me(dr/d,Fr/d),Or=e*Math.PI/180;if(Or){const Tn=Math.sin(Or),En=Math.cos(Or),Gi=[En,-Tn,Tn,En];rr._matMult(Gi),wr._matMult(Gi),Wr._matMult(Gi),Br._matMult(Gi)}const Hr=Ve.stretch+Ve.fixed,un=Ye.stretch+Ye.fixed;return{tl:rr,tr:wr,bl:Wr,br:Br,tex:{x:h.paddedRect.x+Ka+Hr,y:h.paddedRect.y+Ka+un,w:Xe.stretch+Xe.fixed-Hr,h:De.stretch+De.fixed-un},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wn,pixelOffsetBR:nr,minFontScaleX:rt/d/T,minFontScaleY:Je/d/S,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Ve=fd(A,$,B),Ye=fd(z,ne,Z);for(let Xe=0;Xe0&&(B=Math.max(10,B),this.circleDiameter=B)}else{let A=d.top*m-_[0],z=d.bottom*m+_[2],D=d.left*m-_[3],B=d.right*m+_[1];const Z=d.collisionPadding;if(Z&&(D-=Z[0]*m,A-=Z[1]*m,B+=Z[2]*m,z+=Z[3]*m),S){const $=new me(D,A),ne=new me(B,A),ue=new me(D,z),te=new me(B,z),fe=S*Math.PI/180;$._rotate(fe),ne._rotate(fe),ue._rotate(fe),te._rotate(fe),D=Math.min($.x,ne.x,ue.x,te.x),B=Math.max($.x,ne.x,ue.x,te.x),A=Math.min($.y,ne.y,ue.y,te.y),z=Math.max($.y,ne.y,ue.y,te.y)}e.emplaceBack(r.x,r.y,D,A,B,z,o,l,h)}this.boxEndIndex=e.length}}class xf{constructor(e=[],r=bf){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,l=r[e];for(;e>0;){const h=e-1>>1,d=r[h];if(o(l,d)>=0)break;r[e]=d,e=h}r[e]=l}_down(e){const{data:r,compare:o}=this,l=this.length>>1,h=r[e];for(;e=0)break;r[e]=m,e=d}r[e]=h}}function bf(i,e){return ie?1:0}function wf(i,e=1,r=!1){let o=1/0,l=1/0,h=-1/0,d=-1/0;const m=i[0];for(let D=0;Dh)&&(h=B.x),(!D||B.y>d)&&(d=B.y)}const _=Math.min(h-o,d-l);let T=_/2;const S=new xf([],Tf);if(_===0)return new me(o,l);for(let D=o;DA.d||!A.d)&&(A=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,z)),D.max-A.d<=e||(T=D.h/2,S.push(new Ja(D.p.x-T,D.p.y-T,T,i)),S.push(new Ja(D.p.x+T,D.p.y-T,T,i)),S.push(new Ja(D.p.x-T,D.p.y+T,T,i)),S.push(new Ja(D.p.x+T,D.p.y+T,T,i)),z+=4)}return r&&(console.log(`num probes: ${z}`),console.log(`best distance: ${A.d}`)),A.p}function Tf(i,e){return e.max-i.max}function Ja(i,e,r,o){this.p=new me(i,e),this.h=r,this.d=function(l,h){let d=!1,m=1/0;for(let _=0;_l.y!=B.y>l.y&&l.x<(B.x-D.x)*(l.y-D.y)/(B.y-D.y)+D.x&&(d=!d),m=Math.min(m,Ju(l,D,B))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const pu=Number.POSITIVE_INFINITY;function md(i,e){return e[1]!==pu?function(r,o,l){let h=0,d=0;switch(o=Math.abs(o),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,d]}(i,e[0],e[1]):function(r,o){let l=0,h=0;o<0&&(o=0);const d=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=d-7;break;case"bottom-right":case"bottom-left":h=7-d;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=o;break;case"right":l=-o}return[l,h]}(i,e[0])}function fu(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ef(i,e,r,o,l,h,d,m,_,T,S){let A=h.textMaxSize.evaluate(e,{});A===void 0&&(A=d);const z=i.layers[0].layout,D=z.get("icon-offset").evaluate(e,{},S),B=_d(r.horizontal),Z=d/24,$=i.tilePixelRatio*Z,ne=i.tilePixelRatio*A/24,ue=i.tilePixelRatio*m,te=i.tilePixelRatio*z.get("symbol-spacing"),fe=z.get("text-padding")*i.tilePixelRatio,ye=function(De,mt,ut,Ot=1){const wi=De.get("icon-padding").evaluate(mt,{},ut),Pi=wi&&wi.values;return[Pi[0]*Ot,Pi[1]*Ot,Pi[2]*Ot,Pi[3]*Ot]}(z,e,S,i.tilePixelRatio),Ee=z.get("text-max-angle")/180*Math.PI,rt=z.get("text-rotation-alignment")!=="viewport"&&z.get("symbol-placement")!=="point",ct=z.get("icon-rotation-alignment")==="map"&&z.get("symbol-placement")!=="point",Je=z.get("symbol-placement"),Ze=te/2,Ve=z.get("icon-text-fit");let Ye;o&&Ve!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ye=Vh(o,r.vertical,Ve,z.get("icon-text-fit-padding"),D,Z)),B&&(o=Vh(o,B,Ve,z.get("icon-text-fit-padding"),D,Z)));const Xe=(De,mt)=>{mt.x<0||mt.x>=bi||mt.y<0||mt.y>=bi||function(ut,Ot,wi,Pi,dr,eo,Fr,rr,wr,Br,Wr,wn,nr,Or,Hr,un,Tn,En,Gi,Ur,Ut,On,Nr,Kr,To){const No=ut.addToLineVertexArray(Ot,wi);let Vo,Ts,Eo,to,Sn=0,Es=0,Bl=0,bd=0,wu=-1,Tu=-1;const Ss={};let wd=Ki(""),Eu=0,Su=0;if(rr._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Eu,Su]=rr.layout.get("text-offset").evaluate(Ut,{},Kr).map(In=>In*br):(Eu=rr.layout.get("text-radial-offset").evaluate(Ut,{},Kr)*br,Su=pu),ut.allowVerticalPlacement&&Pi.vertical){const In=rr.layout.get("text-rotate").evaluate(Ut,{},Kr)+90;Eo=new Ec(wr,Ot,Br,Wr,wn,Pi.vertical,nr,Or,Hr,In),Fr&&(to=new Ec(wr,Ot,Br,Wr,wn,Fr,Tn,En,Hr,In))}if(dr){const In=rr.layout.get("icon-rotate").evaluate(Ut,{}),rs=rr.layout.get("icon-text-fit")!=="none",Ol=pd(dr,In,Nr,rs),Ul=Fr?pd(Fr,In,Nr,rs):void 0;Ts=new Ec(wr,Ot,Br,Wr,wn,dr,Tn,En,!1,In),Sn=4*Ol.length;const Sd=ut.iconSizeData;let _a=null;Sd.kind==="source"?(_a=[is*rr.layout.get("icon-size").evaluate(Ut,{})],_a[0]>Gs&&di(`${ut.layerIds[0]}: Value for "icon-size" is >= ${Ll}. Reduce your "icon-size".`)):Sd.kind==="composite"&&(_a=[is*On.compositeIconSizes[0].evaluate(Ut,{},Kr),is*On.compositeIconSizes[1].evaluate(Ut,{},Kr)],(_a[0]>Gs||_a[1]>Gs)&&di(`${ut.layerIds[0]}: Value for "icon-size" is >= ${Ll}. Reduce your "icon-size".`)),ut.addSymbols(ut.icon,Ol,_a,Ur,Gi,Ut,c.WritingMode.none,Ot,No.lineStartIndex,No.lineLength,-1,Kr),wu=ut.icon.placedSymbolArray.length-1,Ul&&(Es=4*Ul.length,ut.addSymbols(ut.icon,Ul,_a,Ur,Gi,Ut,c.WritingMode.vertical,Ot,No.lineStartIndex,No.lineLength,-1,Kr),Tu=ut.icon.placedSymbolArray.length-1)}const Td=Object.keys(Pi.horizontal);for(const In of Td){const rs=Pi.horizontal[In];if(!Vo){wd=Ki(rs.text);const Ul=rr.layout.get("text-rotate").evaluate(Ut,{},Kr);Vo=new Ec(wr,Ot,Br,Wr,wn,rs,nr,Or,Hr,Ul)}const Ol=rs.positionedLines.length===1;if(Bl+=gd(ut,Ot,rs,eo,rr,Hr,Ut,un,No,Pi.vertical?c.WritingMode.horizontal:c.WritingMode.horizontalOnly,Ol?Td:[In],Ss,wu,On,Kr),Ol)break}Pi.vertical&&(bd+=gd(ut,Ot,Pi.vertical,eo,rr,Hr,Ut,un,No,c.WritingMode.vertical,["vertical"],Ss,Tu,On,Kr));const Cf=Vo?Vo.boxStartIndex:ut.collisionBoxArray.length,Af=Vo?Vo.boxEndIndex:ut.collisionBoxArray.length,Mf=Eo?Eo.boxStartIndex:ut.collisionBoxArray.length,Pf=Eo?Eo.boxEndIndex:ut.collisionBoxArray.length,kf=Ts?Ts.boxStartIndex:ut.collisionBoxArray.length,zf=Ts?Ts.boxEndIndex:ut.collisionBoxArray.length,Lf=to?to.boxStartIndex:ut.collisionBoxArray.length,Df=to?to.boxEndIndex:ut.collisionBoxArray.length;let jo=-1;const Ic=(In,rs)=>In&&In.circleDiameter?Math.max(In.circleDiameter,rs):rs;jo=Ic(Vo,jo),jo=Ic(Eo,jo),jo=Ic(Ts,jo),jo=Ic(to,jo);const Ed=jo>-1?1:0;Ed&&(jo*=To/br),ut.glyphOffsetArray.length>=Ha.MAX_GLYPHS&&di("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ut.sortKey!==void 0&&ut.addToSortKeyRanges(ut.symbolInstances.length,Ut.sortKey),ut.symbolInstances.emplaceBack(Ot.x,Ot.y,Ss.right>=0?Ss.right:-1,Ss.center>=0?Ss.center:-1,Ss.left>=0?Ss.left:-1,Ss.vertical||-1,wu,Tu,wd,Cf,Af,Mf,Pf,kf,zf,Lf,Df,Br,Bl,bd,Sn,Es,Ed,0,nr,Eu,Su,jo)}(i,mt,De,r,o,l,Ye,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,$,[fe,fe,fe,fe],rt,_,ue,ye,ct,D,e,h,T,S,d)};if(Je==="line")for(const De of ad(e.geometry,0,0,bi,bi)){const mt=vf(De,te,Ee,r.vertical||B,o,24,ne,i.overscaling,bi);for(const ut of mt)B&&Sf(i,B.text,Ze,ut)||Xe(De,ut)}else if(Je==="line-center"){for(const De of e.geometry)if(De.length>1){const mt=yf(De,Ee,r.vertical||B,o,24,ne);mt&&Xe(De,mt)}}else if(e.type==="Polygon")for(const De of Zc(e.geometry,0)){const mt=wf(De,16);Xe(De[0],new Zs(mt.x,mt.y,0))}else if(e.type==="LineString")for(const De of e.geometry)Xe(De,new Zs(De[0].x,De[0].y,0));else if(e.type==="Point")for(const De of e.geometry)for(const mt of De)Xe([mt],new Zs(mt.x,mt.y,0))}function gd(i,e,r,o,l,h,d,m,_,T,S,A,z,D,B){const Z=function(ue,te,fe,ye,Ee,rt,ct,Je){const Ze=ye.layout.get("text-rotate").evaluate(rt,{})*Math.PI/180,Ve=[];for(const Ye of te.positionedLines)for(const Xe of Ye.positionedGlyphs){if(!Xe.rect)continue;const De=Xe.rect||{};let mt=Dh+1,ut=!0,Ot=1,wi=0;const Pi=(Ee||Je)&&Xe.vertical,dr=Xe.metrics.advance*Xe.scale/2;if(Je&&te.verticalizable&&(wi=Ye.lineOffset/2-(Xe.imageName?-(br-Xe.metrics.width*Xe.scale)/2:(Xe.scale-1)*br)),Xe.imageName){const Gi=ct[Xe.imageName];ut=Gi.sdf,Ot=Gi.pixelRatio,mt=bn/Ot}const eo=Ee?[Xe.x+dr,Xe.y]:[0,0];let Fr=Ee?[0,0]:[Xe.x+dr+fe[0],Xe.y+fe[1]-wi],rr=[0,0];Pi&&(rr=Fr,Fr=[0,0]);const wr=(Xe.metrics.left-mt)*Xe.scale-dr+Fr[0],Br=(-Xe.metrics.top-mt)*Xe.scale+Fr[1],Wr=wr+De.w*Xe.scale/Ot,wn=Br+De.h*Xe.scale/Ot,nr=new me(wr,Br),Or=new me(Wr,Br),Hr=new me(wr,wn),un=new me(Wr,wn);if(Pi){const Gi=new me(-dr,dr-kl),Ur=-Math.PI/2,Ut=br/2-dr,On=new me(5-kl-Ut,-(Xe.imageName?Ut:0)),Nr=new me(...rr);nr._rotateAround(Ur,Gi)._add(On)._add(Nr),Or._rotateAround(Ur,Gi)._add(On)._add(Nr),Hr._rotateAround(Ur,Gi)._add(On)._add(Nr),un._rotateAround(Ur,Gi)._add(On)._add(Nr)}if(Ze){const Gi=Math.sin(Ze),Ur=Math.cos(Ze),Ut=[Ur,-Gi,Gi,Ur];nr._matMult(Ut),Or._matMult(Ut),Hr._matMult(Ut),un._matMult(Ut)}const Tn=new me(0,0),En=new me(0,0);Ve.push({tl:nr,tr:Or,bl:Hr,br:un,tex:De,writingMode:te.writingMode,glyphOffset:eo,sectionIndex:Xe.sectionIndex,isSDF:ut,pixelOffsetTL:Tn,pixelOffsetBR:En,minFontScaleX:0,minFontScaleY:0})}return Ve}(0,r,m,l,h,d,o,i.allowVerticalPlacement),$=i.textSizeData;let ne=null;$.kind==="source"?(ne=[is*l.layout.get("text-size").evaluate(d,{})],ne[0]>Gs&&di(`${i.layerIds[0]}: Value for "text-size" is >= ${Ll}. Reduce your "text-size".`)):$.kind==="composite"&&(ne=[is*D.compositeTextSizes[0].evaluate(d,{},B),is*D.compositeTextSizes[1].evaluate(d,{},B)],(ne[0]>Gs||ne[1]>Gs)&&di(`${i.layerIds[0]}: Value for "text-size" is >= ${Ll}. Reduce your "text-size".`)),i.addSymbols(i.text,Z,ne,m,h,d,T,e,_.lineStartIndex,_.lineLength,z,B);for(const ue of S)A[ue]=i.text.placedSymbolArray.length-1;return 4*Z.length}function _d(i){for(const e in i)return i[e];return null}function Sf(i,e,r,o){const l=i.compareText;if(e in l){const h=l[e];for(let d=h.length-1;d>=0;d--)if(o.dist(h[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const h=yd[15&o];if(!h)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new mu(m,d,h,e)}constructor(e,r=64,o=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const h=yd.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-m%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${o}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+m+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=r,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return gu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,o,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:d,nodeSize:m}=this,_=[0,h.length-1,0],T=[];for(;_.length;){const S=_.pop()||0,A=_.pop()||0,z=_.pop()||0;if(A-z<=m){for(let $=z;$<=A;$++){const ne=d[2*$],ue=d[2*$+1];ne>=e&&ne<=o&&ue>=r&&ue<=l&&T.push(h[$])}continue}const D=z+A>>1,B=d[2*D],Z=d[2*D+1];B>=e&&B<=o&&Z>=r&&Z<=l&&T.push(h[D]),(S===0?e<=B:r<=Z)&&(_.push(z),_.push(D-1),_.push(1-S)),(S===0?o>=B:l>=Z)&&(_.push(D+1),_.push(A),_.push(1-S))}return T}within(e,r,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:d}=this,m=[0,l.length-1,0],_=[],T=o*o;for(;m.length;){const S=m.pop()||0,A=m.pop()||0,z=m.pop()||0;if(A-z<=d){for(let $=z;$<=A;$++)xd(h[2*$],h[2*$+1],e,r)<=T&&_.push(l[$]);continue}const D=z+A>>1,B=h[2*D],Z=h[2*D+1];xd(B,Z,e,r)<=T&&_.push(l[D]),(S===0?e-o<=B:r-o<=Z)&&(m.push(z),m.push(D-1),m.push(1-S)),(S===0?e+o>=B:r+o>=Z)&&(m.push(D+1),m.push(A),m.push(1-S))}return _}}function gu(i,e,r,o,l,h){if(l-o<=r)return;const d=o+l>>1;vd(i,e,d,o,l,h),gu(i,e,r,o,d-1,1-h),gu(i,e,r,d+1,l,1-h)}function vd(i,e,r,o,l,h){for(;l>o;){if(l-o>600){const T=l-o+1,S=r-o+1,A=Math.log(T),z=.5*Math.exp(2*A/3),D=.5*Math.sqrt(A*z*(T-z)/T)*(S-T/2<0?-1:1);vd(i,e,r,Math.max(o,Math.floor(r-S*z/T+D)),Math.min(l,Math.floor(r+(T-S)*z/T+D)),h)}const d=e[2*r+h];let m=o,_=l;for(Rl(i,e,o,r),e[2*l+h]>d&&Rl(i,e,o,l);m<_;){for(Rl(i,e,m,_),m++,_--;e[2*m+h]d;)_--}e[2*o+h]===d?Rl(i,e,o,_):(_++,Rl(i,e,_,l)),_<=r&&(o=_+1),r<=_&&(l=_-1)}}function Rl(i,e,r,o){_u(i,r,o),_u(e,2*r,2*o),_u(e,2*r+1,2*o+1)}function _u(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}function xd(i,e,r,o){const l=i-r,h=e-o;return l*l+h*h}var yu;c.PerformanceMarkers=void 0,(yu=c.PerformanceMarkers||(c.PerformanceMarkers={})).create="create",yu.load="load",yu.fullLoad="fullLoad";let Sc=null,Fl=[];const vu=1e3/60,xu="loadTime",bu="fullLoadTime",If={mark(i){performance.mark(i)},frame(i){const e=i;Sc!=null&&Fl.push(e-Sc),Sc=e},clearMetrics(){Sc=null,Fl=[],performance.clearMeasures(xu),performance.clearMeasures(bu);for(const i in c.PerformanceMarkers)performance.clearMarks(c.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(xu,c.PerformanceMarkers.create,c.PerformanceMarkers.load),performance.measure(bu,c.PerformanceMarkers.create,c.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(xu)[0].duration,e=performance.getEntriesByName(bu)[0].duration,r=Fl.length,o=1/(Fl.reduce((h,d)=>h+d,0)/r/1e3),l=Fl.filter(h=>h>vu).reduce((h,d)=>h+(d-vu)/vu,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};c.AJAXError=Mr,c.ARRAY_TYPE=$a,c.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},St(["receive","process"],this),this.invoker=new gf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=pi()?i:window}send(i,e,r,o,l=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const d=pn(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:l,sourceMapId:this.mapId,data:_r(e,d)},d),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type===""){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else pi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(cr(e.error)):r(null,cr(e.data)))}else{let r=!1;const o=pn(this.globalScope)?void 0:[],l=e.hasCallback?(m,_)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:m?_r(m):null,data:_r(_,o)},o)}:m=>{r=!0};let h=null;const d=cr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],d.source)[m[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.AlphaImage=Tl,c.CanonicalTileID=du,c.CollisionBoxArray=u,c.CollisionCircleLayoutArray=class extends Fa{},c.Color=ot,c.DEMData=td,c.DataConstantProperty=ht,c.DictionaryCoder=id,c.EXTENT=bi,c.ErrorEvent=fr,c.EvaluationParameters=Mi,c.Event=Gn,c.Evented=$o,c.FeatureIndex=nd,c.FillBucket=Hc,c.FillExtrusionBucket=Jc,c.GeoJSONFeature=rd,c.ImageAtlas=Fh,c.ImagePosition=iu,c.KDBush=mu,c.LineBucket=Yc,c.LineStripIndexArray=class extends t{},c.LngLat=qs,c.MercatorCoordinate=xc,c.ONE_EM=br,c.OverscaledTileID=Qn,c.PerformanceUtils=If,c.Point=me,c.Pos3dArray=class extends La{},c.PosArray=G,c.Properties=ln,c.Protobuf=eu,c.QuadTriangleArray=class extends Ba{},c.RGBAImage=Yn,c.RasterBoundsArray=class extends gl{},c.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},c.SegmentVector=Ge,c.SymbolBucket=Ha,c.Transitionable=tc,c.TriangleIndexArray=ke,c.Uniform1f=wo,c.Uniform1i=class extends Xr{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},c.Uniform2f=class extends Xr{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},c.Uniform3f=class extends Xr{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},c.Uniform4f=pa,c.UniformColor=Rr,c.UniformMatrix4f=class extends Xr{constructor(i,e){super(i,e),this.current=vr}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},c.UnwrappedTileID=ed,c.ValidationError=Oe,c.ZoomHistory=Hn,c.addDynamicAttributes=su,c.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=fn})},r.onerror=()=>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."));const o=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(o):fn},c.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(o=>{e(null,o)}).catch(o=>{e(new Error(`Could not load image because of ${o.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},c.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const l=new Array(i.length);let h=null;i.forEach((d,m)=>{e(d,(_,T)=>{_&&(h=_),l[m]=T,--o==0&&r(h,l)})})},c.bezier=Ie,c.bindAll=St,c.clamp=et,c.clipLine=ad,c.clone=function(i){var e=new $a(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},c.clone$1=Qt,c.collisionCircleLayout=Gp,c.config=qi,c.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.create=function(){var i=new $a(16);return $a!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},c.createExpression=ii,c.createFilter=ra,c.createLayout=ir,c.createStyleLayer=function(i){return i.type==="custom"?new ff(i):new mf[i.type](i)},c.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let o=0;o{o[d.source]?r.push({command:Gt.removeLayer,args:[d.id]}):h.push(d)}),r=r.concat(l),function(d,m,_){m=m||[];const T=(d=d||[]).map(so),S=m.map(so),A=d.reduce(kn,{}),z=m.reduce(kn,{}),D=T.slice(),B=Object.create(null);let Z,$,ne,ue,te,fe,ye;for(Z=0,$=0;Z{}}},c.groupByLayout=function(i,e){const r={};for(let l=0;l@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,l,h)=>{const d=l||h;return e[o]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},c.parseGlyphPbf=function(i){return new eu(i).readFields(tf,[])},c.pbf=Ch,c.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=bi/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Mi(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Mi(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Mi(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:_,maxZoom:T}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Mi(_),i.canonical),r["text-size"].possiblyEvaluate(new Mi(T),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:_,maxZoom:T}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Mi(_),i.canonical),r["icon-size"].possiblyEvaluate(new Mi(T),i.canonical)]}const l=e.get("text-line-height")*br,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),m=e.get("text-size");for(const _ of i.bucket.features){const T=e.get("text-font").evaluate(_,{},i.canonical).join(","),S=m.evaluate(_,{},i.canonical),A=o.layoutTextSize.evaluate(_,{},i.canonical),z=o.layoutIconSize.evaluate(_,{},i.canonical),D={horizontal:{},vertical:void 0},B=_.text;let Z,$=[0,0];if(B){const te=B.toString(),fe=e.get("text-letter-spacing").evaluate(_,{},i.canonical)*br,ye=_o(te)?fe:0,Ee=e.get("text-anchor").evaluate(_,{},i.canonical),rt=e.get("text-variable-anchor");if(!rt){const Ye=e.get("text-radial-offset").evaluate(_,{},i.canonical);$=Ye?md(Ee,[Ye*br,pu]):e.get("text-offset").evaluate(_,{},i.canonical).map(Xe=>Xe*br)}let ct=h?"center":e.get("text-justify").evaluate(_,{},i.canonical);const Je=e.get("symbol-placement"),Ze=Je==="point"?e.get("text-max-width").evaluate(_,{},i.canonical)*br:0,Ve=()=>{i.bucket.allowVerticalPlacement&&Do(te)&&(D.vertical=gc(B,i.glyphMap,i.glyphPositions,i.imagePositions,T,Ze,l,Ee,"left",ye,$,c.WritingMode.vertical,!0,Je,A,S))};if(!h&&rt){const Ye=ct==="auto"?rt.map(De=>fu(De)):[ct];let Xe=!1;for(let De=0;Dethis._layers[Se.id]),se=Y[0];if(se.visibility==="none")continue;const ee=se.source||"";let Q=this.familiesBySource[ee];Q||(Q=this.familiesBySource[ee]={});const ce=se.sourceLayer||"_geojsonTileLayer";let Te=Q[ce];Te||(Te=Q[ce]=[]),Te.push(Y)}}}class O{constructor(P){const L={},N=[];for(const ee in P){const Q=P[ee],ce=L[ee]={};for(const Te in Q){const Se=Q[+Te];if(!Se||Se.bitmap.width===0||Se.bitmap.height===0)continue;const Ce={x:0,y:0,w:Se.bitmap.width+2,h:Se.bitmap.height+2};N.push(Ce),ce[Te]={rect:Ce,metrics:Se.metrics}}}const{w:X,h:Y}=c.potpack(N),se=new c.AlphaImage({width:X||1,height:Y||1});for(const ee in P){const Q=P[ee];for(const ce in Q){const Te=Q[+ce];if(!Te||Te.bitmap.width===0||Te.bitmap.height===0)continue;const Se=L[ee][ce].rect;c.AlphaImage.copy(Te.bitmap,se,{x:0,y:0},{x:Se.x+1,y:Se.y+1},Te.bitmap)}}this.image=se,this.positions=L}}c.register("GlyphAtlas",O);class Me{constructor(P){this.tileID=new c.OverscaledTileID(P.tileID.overscaledZ,P.tileID.wrap,P.tileID.canonical.z,P.tileID.canonical.x,P.tileID.canonical.y),this.uid=P.uid,this.zoom=P.zoom,this.pixelRatio=P.pixelRatio,this.tileSize=P.tileSize,this.source=P.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=P.showCollisionBoxes,this.collectResourceTiming=!!P.collectResourceTiming,this.returnDependencies=!!P.returnDependencies,this.promoteId=P.promoteId}parse(P,L,N,X,Y){this.status="parsing",this.data=P,this.collisionBoxArray=new c.CollisionBoxArray;const se=new c.DictionaryCoder(Object.keys(P.layers).sort()),ee=new c.FeatureIndex(this.tileID,this.promoteId);ee.bucketLayerIDs=[];const Q={},ce={featureIndex:ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:N},Te=L.familiesBySource[this.source];for(const Lt in Te){const jt=P.layers[Lt];if(!jt)continue;jt.version===1&&c.warnOnce(`Vector tile source "${this.source}" layer "${Lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ti=se.encode(Lt),zi=[];for(let ot=0;ot=yi.maxzoom||yi.visibility!=="none"&&(me(ot,this.zoom,N),(Q[yi.id]=yi.createBucket({index:ee.bucketLayerIDs.length,layers:ot,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ti,sourceID:this.source})).populate(zi,ce,this.tileID.canonical),ee.bucketLayerIDs.push(ot.map(ao=>ao.id)))}}let Se,Ce,it,Et;const st=c.mapObject(ce.glyphDependencies,Lt=>Object.keys(Lt).map(Number));Object.keys(st).length?X.send("getGlyphs",{uid:this.uid,stacks:st,source:this.source,tileID:this.tileID,type:"glyphs"},(Lt,jt)=>{Se||(Se=Lt,Ce=jt,Vt.call(this))}):Ce={};const pt=Object.keys(ce.iconDependencies);pt.length?X.send("getImages",{icons:pt,source:this.source,tileID:this.tileID,type:"icons"},(Lt,jt)=>{Se||(Se=Lt,it=jt,Vt.call(this))}):it={};const bt=Object.keys(ce.patternDependencies);function Vt(){if(Se)return Y(Se);if(Ce&&it&&Et){const Lt=new O(Ce),jt=new c.ImageAtlas(it,Et);for(const ti in Q){const zi=Q[ti];zi instanceof c.SymbolBucket?(me(zi.layers,this.zoom,N),c.performSymbolLayout({bucket:zi,glyphMap:Ce,glyphPositions:Lt.positions,imageMap:it,imagePositions:jt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):zi.hasPattern&&(zi instanceof c.LineBucket||zi instanceof c.FillBucket||zi instanceof c.FillExtrusionBucket)&&(me(zi.layers,this.zoom,N),zi.addFeatures(ce,this.tileID.canonical,jt.patternPositions))}this.status="done",Y(null,{buckets:Object.values(Q).filter(ti=>!ti.isEmpty()),featureIndex:ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Lt.image,imageAtlas:jt,glyphMap:this.returnDependencies?Ce:null,iconMap:this.returnDependencies?it:null,glyphPositions:this.returnDependencies?Lt.positions:null})}}bt.length?X.send("getImages",{icons:bt,source:this.source,tileID:this.tileID,type:"patterns"},(Lt,jt)=>{Se||(Se=Lt,Et=jt,Vt.call(this))}):Et={},Vt.call(this)}}function me(q,P,L){const N=new c.EvaluationParameters(P);for(const X of q)X.recalculate(N,L)}function Be(q,P){const L=c.getArrayBuffer(q.request,(N,X,Y,se)=>{N?P(N):X&&P(null,{vectorTile:new c.vectorTile.VectorTile(new c.Protobuf(X)),rawData:X,cacheControl:Y,expires:se})});return()=>{L.cancel(),P()}}class dt{constructor(P,L,N,X){this.actor=P,this.layerIndex=L,this.availableImages=N,this.loadVectorData=X||Be,this.loading={},this.loaded={}}loadTile(P,L){const N=P.uid;this.loading||(this.loading={});const X=!!(P&&P.request&&P.request.collectResourceTiming)&&new c.RequestPerformance(P.request),Y=this.loading[N]=new Me(P);Y.abort=this.loadVectorData(P,(se,ee)=>{if(delete this.loading[N],se||!ee)return Y.status="done",this.loaded[N]=Y,L(se);const Q=ee.rawData,ce={};ee.expires&&(ce.expires=ee.expires),ee.cacheControl&&(ce.cacheControl=ee.cacheControl);const Te={};if(X){const Se=X.finish();Se&&(Te.resourceTiming=JSON.parse(JSON.stringify(Se)))}Y.vectorTile=ee.vectorTile,Y.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor,(Se,Ce)=>{if(Se||!Ce)return L(Se);L(null,c.extend({rawTileData:Q.slice(0)},Ce,ce,Te))}),this.loaded=this.loaded||{},this.loaded[N]=Y})}reloadTile(P,L){const N=this.loaded,X=P.uid,Y=this;if(N&&N[X]){const se=N[X];se.showCollisionBoxes=P.showCollisionBoxes;const ee=(Q,ce)=>{const Te=se.reloadCallback;Te&&(delete se.reloadCallback,se.parse(se.vectorTile,Y.layerIndex,this.availableImages,Y.actor,Te)),L(Q,ce)};se.status==="parsing"?se.reloadCallback=ee:se.status==="done"&&(se.vectorTile?se.parse(se.vectorTile,this.layerIndex,this.availableImages,this.actor,ee):ee())}}abortTile(P,L){const N=this.loading,X=P.uid;N&&N[X]&&N[X].abort&&(N[X].abort(),delete N[X]),L()}removeTile(P,L){const N=this.loaded,X=P.uid;N&&N[X]&&delete N[X],L()}}class be{constructor(){this.loaded={}}loadTile(P,L){const{uid:N,encoding:X,rawImageData:Y}=P,se=c.isImageBitmap(Y)?this.getImageData(Y):Y,ee=new c.DEMData(N,se,X);this.loaded=this.loaded||{},this.loaded[N]=ee,L(null,ee)}getImageData(P){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(P.width,P.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=P.width,this.offscreenCanvas.height=P.height,this.offscreenCanvasContext.drawImage(P,0,0,P.width,P.height);const L=this.offscreenCanvasContext.getImageData(-1,-1,P.width+2,P.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new c.RGBAImage({width:L.width,height:L.height},L.data)}removeTile(P){const L=this.loaded,N=P.uid;L&&L[N]&&delete L[N]}}function Ie(q,P){if(q.length!==0){nt(q[0],P);for(var L=1;L=Math.abs(ee)?L-Q+ee:ee-Q+L,L=Q}L+N>=0!=!!P&&q.reverse()}var et=c.getDefaultExportFromCjs(function q(P,L){var N,X=P&&P.type;if(X==="FeatureCollection")for(N=0;N>31}function fn(q,P){for(var L=q.loadGeometry(),N=q.type,X=0,Y=0,se=L.length,ee=0;eeq},qi=Math.fround||(Mr=new Float32Array(1),q=>(Mr[0]=+q,Mr[0]));var Mr;const Si=3,Ii=5,ar=6;class Vn{constructor(P){this.options=Object.assign(Object.create(oo),P),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(P){const{log:L,minZoom:N,maxZoom:X}=this.options;L&&console.time("total time");const Y=`prepare ${P.length} points`;L&&console.time(Y),this.points=P;const se=[];for(let Q=0;Q=N;Q--){const ce=+Date.now();ee=this.trees[Q]=this._createTree(this._cluster(ee,Q)),L&&console.log("z%d: %d clusters in %dms",Q,ee.numItems,+Date.now()-ce)}return L&&console.timeEnd("total time"),this}getClusters(P,L){let N=((P[0]+180)%360+360)%360-180;const X=Math.max(-90,Math.min(90,P[1]));let Y=P[2]===180?180:((P[2]+180)%360+360)%360-180;const se=Math.max(-90,Math.min(90,P[3]));if(P[2]-P[0]>=360)N=-180,Y=180;else if(N>Y){const Se=this.getClusters([N,X,180,se],L),Ce=this.getClusters([-180,X,Y,se],L);return Se.concat(Ce)}const ee=this.trees[this._limitZoom(L)],Q=ee.range(jn(N),$n(se),jn(Y),$n(X)),ce=ee.data,Te=[];for(const Se of Q){const Ce=this.stride*Se;Te.push(ce[Ce+Ii]>1?Zi(ce,Ce,this.clusterProps):this.points[ce[Ce+Si]])}return Te}getChildren(P){const L=this._getOriginId(P),N=this._getOriginZoom(P),X="No cluster with the specified id.",Y=this.trees[N];if(!Y)throw new Error(X);const se=Y.data;if(L*this.stride>=se.length)throw new Error(X);const ee=this.options.radius/(this.options.extent*Math.pow(2,N-1)),Q=Y.within(se[L*this.stride],se[L*this.stride+1],ee),ce=[];for(const Te of Q){const Se=Te*this.stride;se[Se+4]===P&&ce.push(se[Se+Ii]>1?Zi(se,Se,this.clusterProps):this.points[se[Se+Si]])}if(ce.length===0)throw new Error(X);return ce}getLeaves(P,L,N){const X=[];return this._appendLeaves(X,P,L=L||10,N=N||0,0),X}getTile(P,L,N){const X=this.trees[this._limitZoom(P)],Y=Math.pow(2,P),{extent:se,radius:ee}=this.options,Q=ee/se,ce=(N-Q)/Y,Te=(N+1+Q)/Y,Se={features:[]};return this._addTileFeatures(X.range((L-Q)/Y,ce,(L+1+Q)/Y,Te),X.data,L,N,Y,Se),L===0&&this._addTileFeatures(X.range(1-Q/Y,ce,1,Te),X.data,Y,N,Y,Se),L===Y-1&&this._addTileFeatures(X.range(0,ce,Q/Y,Te),X.data,-1,N,Y,Se),Se.features.length?Se:null}getClusterExpansionZoom(P){let L=this._getOriginZoom(P)-1;for(;L<=this.options.maxZoom;){const N=this.getChildren(P);if(L++,N.length!==1)break;P=N[0].properties.cluster_id}return L}_appendLeaves(P,L,N,X,Y){const se=this.getChildren(L);for(const ee of se){const Q=ee.properties;if(Q&&Q.cluster?Y+Q.point_count<=X?Y+=Q.point_count:Y=this._appendLeaves(P,Q.cluster_id,N,X,Y):Y1;let Te,Se,Ce;if(ce)Te=At(L,Q,this.clusterProps),Se=L[Q],Ce=L[Q+1];else{const st=this.points[L[Q+Si]];Te=st.properties;const[pt,bt]=st.geometry.coordinates;Se=jn(pt),Ce=$n(bt)}const it={type:1,geometry:[[Math.round(this.options.extent*(Se*Y-N)),Math.round(this.options.extent*(Ce*Y-X))]],tags:Te};let Et;Et=ce||this.options.generateId?L[Q+Si]:this.points[L[Q+Si]].id,Et!==void 0&&(it.id=Et),se.features.push(it)}}_limitZoom(P){return Math.max(this.options.minZoom,Math.min(Math.floor(+P),this.options.maxZoom+1))}_cluster(P,L){const{radius:N,extent:X,reduce:Y,minPoints:se}=this.options,ee=N/(X*Math.pow(2,L)),Q=P.data,ce=[],Te=this.stride;for(let Se=0;SeL&&(pt+=Q[Vt+Ii])}if(pt>st&&pt>=se){let bt,Vt=Ce*st,Lt=it*st,jt=-1;const ti=((Se/Te|0)<<5)+(L+1)+this.points.length;for(const zi of Et){const ot=zi*Te;if(Q[ot+2]<=L)continue;Q[ot+2]=L;const yi=Q[ot+Ii];Vt+=Q[ot]*yi,Lt+=Q[ot+1]*yi,Q[ot+4]=ti,Y&&(bt||(bt=this._map(Q,Se,!0),jt=this.clusterProps.length,this.clusterProps.push(bt)),Y(bt,this._map(Q,ot)))}Q[Se+4]=ti,ce.push(Vt/pt,Lt/pt,1/0,ti,-1,pt),Y&&ce.push(jt)}else{for(let bt=0;bt1)for(const bt of Et){const Vt=bt*Te;if(!(Q[Vt+2]<=L)){Q[Vt+2]=L;for(let Lt=0;Lt>5}_getOriginZoom(P){return(P-this.points.length)%32}_map(P,L,N){if(P[L+Ii]>1){const se=this.clusterProps[P[L+ar]];return N?Object.assign({},se):se}const X=this.points[P[L+Si]].properties,Y=this.options.map(X);return N&&Y===X?Object.assign({},Y):Y}}function Zi(q,P,L){return{type:"Feature",id:q[P+Si],properties:At(q,P,L),geometry:{type:"Point",coordinates:[(N=q[P],360*(N-.5)),Gn(q[P+1])]}};var N}function At(q,P,L){const N=q[P+Ii],X=N>=1e4?`${Math.round(N/1e3)}k`:N>=1e3?Math.round(N/100)/10+"k":N,Y=q[P+ar],se=Y===-1?{}:Object.assign({},L[Y]);return Object.assign(se,{cluster:!0,cluster_id:q[P+Si],point_count:N,point_count_abbreviated:X})}function jn(q){return q/360+.5}function $n(q){const P=Math.sin(q*Math.PI/180),L=.5-.25*Math.log((1+P)/(1-P))/Math.PI;return L<0?0:L>1?1:L}function Gn(q){const P=(180-360*q)*Math.PI/180;return 360*Math.atan(Math.exp(P))/Math.PI-90}function fr(q,P,L,N){for(var X,Y=N,se=L-P>>1,ee=L-P,Q=q[P],ce=q[P+1],Te=q[L],Se=q[L+1],Ce=P+3;CeY)X=Ce,Y=it;else if(it===Y){var Et=Math.abs(Ce-se);EtN&&(X-P>3&&fr(q,P,X,N),q[X+2]=Y,L-X>3&&fr(q,X,L,N))}function $o(q,P,L,N,X,Y){var se=X-L,ee=Y-N;if(se!==0||ee!==0){var Q=((q-L)*se+(P-N)*ee)/(se*se+ee*ee);Q>1?(L=X,N=Y):Q>0&&(L+=se*Q,N+=ee*Q)}return(se=q-L)*se+(ee=P-N)*ee}function _e(q,P,L,N){var X={id:q===void 0?null:q,type:P,geometry:L,tags:N,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Y){var se=Y.geometry,ee=Y.type;if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")qn(Y,se);else if(ee==="Polygon"||ee==="MultiLineString")for(var Q=0;Q0&&(se+=N?(X*ce-Q*Y)/2:Math.sqrt(Math.pow(Q-X,2)+Math.pow(ce-Y,2))),X=Q,Y=ce}var Te=P.length-3;P[2]=1,fr(P,0,Te,L),P[Te+2]=1,P.size=Math.abs(se),P.start=0,P.end=P.size}function So(q,P,L,N){for(var X=0;X1?1:L}function Ri(q,P,L,N,X,Y,se,ee){if(N/=P,Y>=(L/=P)&&se=N)return null;for(var Q=[],ce=0;ce=L&&Et=N)){var st=[];if(Ce==="Point"||Ce==="MultiPoint")$r(Se,st,L,N,X);else if(Ce==="LineString")so(Se,st,L,N,X,!1,ee.lineMetrics);else if(Ce==="MultiLineString")Oe(Se,st,L,N,X,!1);else if(Ce==="Polygon")Oe(Se,st,L,N,X,!0);else if(Ce==="MultiPolygon")for(var pt=0;pt=L&&se<=N&&(P.push(q[Y]),P.push(q[Y+1]),P.push(q[Y+2]))}}function so(q,P,L,N,X,Y,se){for(var ee,Q,ce=kn(q),Te=X===0?Xi:Zn,Se=q.start,Ce=0;CeL&&(Q=Te(ce,it,Et,pt,bt,L),se&&(ce.start=Se+ee*Q)):Vt>N?Lt=L&&(Q=Te(ce,it,Et,pt,bt,L),jt=!0),Lt>N&&Vt<=N&&(Q=Te(ce,it,Et,pt,bt,N),jt=!0),!Y&&jt&&(se&&(ce.end=Se+ee*Q),P.push(ce),ce=kn(q)),se&&(Se+=ee)}var ti=q.length-3;it=q[ti],Et=q[ti+1],st=q[ti+2],(Vt=X===0?it:Et)>=L&&Vt<=N&&Pr(ce,it,Et,st),ti=ce.length-3,Y&&ti>=3&&(ce[ti]!==ce[0]||ce[ti+1]!==ce[1])&&Pr(ce,ce[0],ce[1],ce[2]),ce.length&&P.push(ce)}function kn(q){var P=[];return P.size=q.size,P.start=q.start,P.end=q.end,P}function Oe(q,P,L,N,X,Y){for(var se=0;sese.maxX&&(se.maxX=Te),Se>se.maxY&&(se.maxY=Se)}return se}function _i(q,P,L,N){var X=P.geometry,Y=P.type,se=[];if(Y==="Point"||Y==="MultiPoint")for(var ee=0;ee0&&P.size<(X?se:N))L.numPoints+=P.length/3;else{for(var ee=[],Q=0;Qse)&&(L.numSimplified++,ee.push(P[Q]),ee.push(P[Q+1])),L.numPoints++;X&&function(ce,Te){for(var Se=0,Ce=0,it=ce.length,Et=it-2;Ce0===Te)for(Ce=0,it=ce.length;Ce24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");var N=function(X,Y){var se=[];if(X.type==="FeatureCollection")for(var ee=0;ee1&&console.time("creation"),Ce=this.tiles[Se]=mr(q,P,L,N,Q),this.tileCoords.push({z:P,x:L,y:N}),ce)){ce>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,L,N,Ce.numFeatures,Ce.numPoints,Ce.numSimplified),console.timeEnd("creation"));var it="z"+P;this.stats[it]=(this.stats[it]||0)+1,this.total++}if(Ce.source=q,X){if(P===Q.maxZoom||P===X)continue;var Et=1<1&&console.time("clipping");var st,pt,bt,Vt,Lt,jt,ti=.5*Q.buffer/Q.extent,zi=.5-ti,ot=.5+ti,yi=1+ti;st=pt=bt=Vt=null,Lt=Ri(q,Te,L-ti,L+ot,0,Ce.minX,Ce.maxX,Q),jt=Ri(q,Te,L+zi,L+yi,0,Ce.minX,Ce.maxX,Q),q=null,Lt&&(st=Ri(Lt,Te,N-ti,N+ot,1,Ce.minY,Ce.maxY,Q),pt=Ri(Lt,Te,N+zi,N+yi,1,Ce.minY,Ce.maxY,Q),Lt=null),jt&&(bt=Ri(jt,Te,N-ti,N+ot,1,Ce.minY,Ce.maxY,Q),Vt=Ri(jt,Te,N+zi,N+yi,1,Ce.minY,Ce.maxY,Q),jt=null),ce>1&&console.timeEnd("clipping"),ee.push(st||[],P+1,2*L,2*N),ee.push(pt||[],P+1,2*L,2*N+1),ee.push(bt||[],P+1,2*L+1,2*N),ee.push(Vt||[],P+1,2*L+1,2*N+1)}}},Qr.prototype.getTile=function(q,P,L){var N=this.options,X=N.extent,Y=N.debug;if(q<0||q>24)return null;var se=1<1&&console.log("drilling down to z%d-%d-%d",q,P,L);for(var Q,ce=q,Te=P,Se=L;!Q&&ce>0;)ce--,Te=Math.floor(Te/2),Se=Math.floor(Se/2),Q=this.tiles[Wi(ce,Te,Se)];return Q&&Q.source?(Y>1&&console.log("found parent tile z%d-%d-%d",ce,Te,Se),Y>1&&console.time("drilling down"),this.splitTile(Q.source,ce,Te,Se,q,P,L),Y>1&&console.timeEnd("drilling down"),this.tiles[ee]?Dt(this.tiles[ee],X):null):null};class os extends dt{constructor(P,L,N,X){super(P,L,N,ui),this._dataUpdateable=new Map,this.loadGeoJSON=(Y,se)=>{const{promoteId:ee}=Y;if(Y.request)return c.getJSON(Y.request,(Q,ce,Te,Se)=>{this._dataUpdateable=Xn(ce,ee)?Qi(ce,ee):void 0,se(Q,ce,Te,Se)});if(typeof Y.data=="string")try{const Q=JSON.parse(Y.data);this._dataUpdateable=Xn(Q,ee)?Qi(Q,ee):void 0,se(null,Q)}catch{se(new Error(`Input data given to '${Y.source}' is not a valid GeoJSON object.`))}else Y.dataDiff?this._dataUpdateable?(function(Q,ce,Te){var Se,Ce,it,Et;if(ce.removeAll&&Q.clear(),ce.remove)for(const st of ce.remove)Q.delete(st);if(ce.add)for(const st of ce.add){const pt=Er(st,Te);pt!=null&&Q.set(pt,st)}if(ce.update)for(const st of ce.update){let pt=Q.get(st.id);if(pt==null)continue;const bt=!st.removeAllProperties&&(((Se=st.removeProperties)===null||Se===void 0?void 0:Se.length)>0||((Ce=st.addOrUpdateProperties)===null||Ce===void 0?void 0:Ce.length)>0);if((st.newGeometry||st.removeAllProperties||bt)&&(pt={...pt},Q.set(st.id,pt),bt&&(pt.properties={...pt.properties})),st.newGeometry&&(pt.geometry=st.newGeometry),st.removeAllProperties)pt.properties={};else if(((it=st.removeProperties)===null||it===void 0?void 0:it.length)>0)for(const Vt of st.removeProperties)Object.prototype.hasOwnProperty.call(pt.properties,Vt)&&delete pt.properties[Vt];if(((Et=st.addOrUpdateProperties)===null||Et===void 0?void 0:Et.length)>0)for(const{key:Vt,value:Lt}of st.addOrUpdateProperties)pt.properties[Vt]=Lt}}(this._dataUpdateable,Y.dataDiff,ee),se(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):se(new Error(`Cannot update existing geojson data in ${Y.source}`)):se(new Error(`Input data given to '${Y.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},X&&(this.loadGeoJSON=X)}loadData(P,L){var N;(N=this._pendingRequest)===null||N===void 0||N.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const X=!!(P&&P.request&&P.request.collectResourceTiming)&&new c.RequestPerformance(P.request);this._pendingCallback=L,this._pendingRequest=this.loadGeoJSON(P,(Y,se)=>{if(delete this._pendingCallback,delete this._pendingRequest,Y||!se)return L(Y);if(typeof se!="object")return L(new Error(`Input data given to '${P.source}' is not a valid GeoJSON object.`));{et(se,!0);try{if(P.filter){const Q=c.createExpression(P.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(Te=>`${Te.key}: ${Te.message}`).join(", "));se={type:"FeatureCollection",features:se.features.filter(Te=>Q.value.evaluate({zoom:0},Te))}}this._geoJSONIndex=P.cluster?new Vn(function({superclusterOptions:Q,clusterProperties:ce}){if(!ce||!Q)return Q;const Te={},Se={},Ce={accumulated:null,zoom:0},it={properties:null},Et=Object.keys(ce);for(const st of Et){const[pt,bt]=ce[st],Vt=c.createExpression(bt),Lt=c.createExpression(typeof pt=="string"?[pt,["accumulated"],["get",st]]:pt);Te[st]=Vt.value,Se[st]=Lt.value}return Q.map=st=>{it.properties=st;const pt={};for(const bt of Et)pt[bt]=Te[bt].evaluate(Ce,it);return pt},Q.reduce=(st,pt)=>{it.properties=pt;for(const bt of Et)Ce.accumulated=st[bt],st[bt]=Se[bt].evaluate(Ce,it)},Q}(P)).load(se.features):function(Q,ce){return new Qr(Q,ce)}(se,P.geojsonVtOptions)}catch(Q){return L(Q)}this.loaded={};const ee={};if(X){const Q=X.finish();Q&&(ee.resourceTiming={},ee.resourceTiming[P.source]=JSON.parse(JSON.stringify(Q)))}L(null,ee)}})}reloadTile(P,L){const N=this.loaded;return N&&N[P.uid]?super.reloadTile(P,L):this.loadTile(P,L)}removeSource(P,L){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),L()}getClusterExpansionZoom(P,L){try{L(null,this._geoJSONIndex.getClusterExpansionZoom(P.clusterId))}catch(N){L(N)}}getClusterChildren(P,L){try{L(null,this._geoJSONIndex.getChildren(P.clusterId))}catch(N){L(N)}}getClusterLeaves(P,L){try{L(null,this._geoJSONIndex.getLeaves(P.clusterId,P.limit,P.offset))}catch(N){L(N)}}}class zn{constructor(P){this.self=P,this.actor=new c.Actor(P,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:dt,geojson:os},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(L,N)=>{if(this.workerSourceTypes[L])throw new Error(`Worker source with name "${L}" already registered.`);this.workerSourceTypes[L]=N},this.self.registerRTLTextPlugin=L=>{if(c.plugin.isParsed())throw new Error("RTL text plugin already registered.");c.plugin.applyArabicShaping=L.applyArabicShaping,c.plugin.processBidirectionalText=L.processBidirectionalText,c.plugin.processStyledBidirectionalText=L.processStyledBidirectionalText}}setReferrer(P,L){this.referrer=L}setImages(P,L,N){this.availableImages[P]=L;for(const X in this.workerSources[P]){const Y=this.workerSources[P][X];for(const se in Y)Y[se].availableImages=L}N()}setLayers(P,L,N){this.getLayerIndex(P).replace(L),N()}updateLayers(P,L,N){this.getLayerIndex(P).update(L.layers,L.removedIds),N()}loadTile(P,L,N){this.getWorkerSource(P,L.type,L.source).loadTile(L,N)}loadDEMTile(P,L,N){this.getDEMWorkerSource(P,L.source).loadTile(L,N)}reloadTile(P,L,N){this.getWorkerSource(P,L.type,L.source).reloadTile(L,N)}abortTile(P,L,N){this.getWorkerSource(P,L.type,L.source).abortTile(L,N)}removeTile(P,L,N){this.getWorkerSource(P,L.type,L.source).removeTile(L,N)}removeDEMTile(P,L){this.getDEMWorkerSource(P,L.source).removeTile(L)}removeSource(P,L,N){if(!this.workerSources[P]||!this.workerSources[P][L.type]||!this.workerSources[P][L.type][L.source])return;const X=this.workerSources[P][L.type][L.source];delete this.workerSources[P][L.type][L.source],X.removeSource!==void 0?X.removeSource(L,N):N()}loadWorkerSource(P,L,N){try{this.self.importScripts(L.url),N()}catch(X){N(X.toString())}}syncRTLPluginState(P,L,N){try{c.plugin.setState(L);const X=c.plugin.getPluginURL();if(c.plugin.isLoaded()&&!c.plugin.isParsed()&&X!=null){this.self.importScripts(X);const Y=c.plugin.isParsed();N(Y?void 0:new Error(`RTL Text Plugin failed to import scripts from ${X}`),Y)}}catch(X){N(X.toString())}}getAvailableImages(P){let L=this.availableImages[P];return L||(L=[]),L}getLayerIndex(P){let L=this.layerIndexes[P];return L||(L=this.layerIndexes[P]=new ae),L}getWorkerSource(P,L,N){if(this.workerSources[P]||(this.workerSources[P]={}),this.workerSources[P][L]||(this.workerSources[P][L]={}),!this.workerSources[P][L][N]){const X={send:(Y,se,ee)=>{this.actor.send(Y,se,ee,P)}};this.workerSources[P][L][N]=new this.workerSourceTypes[L](X,this.getLayerIndex(P),this.getAvailableImages(P))}return this.workerSources[P][L][N]}getDEMWorkerSource(P,L){return this.demWorkerSources[P]||(this.demWorkerSources[P]={}),this.demWorkerSources[P][L]||(this.demWorkerSources[P][L]=new be),this.demWorkerSources[P][L]}}return c.isWorker()&&(self.worker=new zn(self)),zn}),J(["./shared"],function(c){var ae="3.1.0";class O{static testProp(t){if(!O.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",O.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new c.Point(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let p=0;p{t=[],n=0,s=0,u={}},a.addThrottleControl=w=>{const C=s++;return u[C]=w,C},a.removeThrottleControl=w=>{delete u[w],v()},a.getImage=(w,C,I=!0)=>{Me.supported&&(w.headers||(w.headers={}),w.headers.accept="image/webp,*/*");const F={requestParameters:w,supportImageRefresh:I,callback:C,cancelled:!1,completed:!1,cancel:()=>{F.completed||F.cancelled||(F.cancelled=!0,F.innerRequest&&(F.innerRequest.cancel(),n--),v())}};return t.push(F),v(),F};const p=w=>{const{requestParameters:C,supportImageRefresh:I,callback:F}=w;return c.extend(C,{type:"image"}),(I!==!1||c.isWorker()||c.getProtocolAction(C.url)||C.headers&&!Object.keys(C.headers).reduce((G,V)=>G&&V==="accept",!0)?c.makeRequest:y)(C,(G,V,j,K)=>{g(w,F,G,V,j,K)})},g=(w,C,I,F,G,V)=>{I?C(I):F instanceof HTMLImageElement||F instanceof ImageBitmap?C(null,F):F&&((j,K)=>{typeof createImageBitmap=="function"?c.arrayBufferToImageBitmap(j,K):c.arrayBufferToImage(j,K)})(F,(j,K)=>{j!=null?C(j):K!=null&&C(null,K,{cacheControl:G,expires:V})}),w.cancelled||(w.completed=!0,n--,v())},v=()=>{const w=(()=>{const C=Object.keys(u);let I=!1;if(C.length>0){for(const F of C)if(I=u[F](),I)break}return I})()?c.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let C=n;C0;C++){const I=t.shift();if(I.cancelled){C--;continue}const F=p(I);n++,I.innerRequest=F}},y=(w,C)=>{const I=new Image,F=w.url;let G=!1;const V=w.credentials;return V&&V==="include"?I.crossOrigin="use-credentials":(V&&V==="same-origin"||!c.sameOrigin(F))&&(I.crossOrigin="anonymous"),I.fetchPriority="high",I.onload=()=>{C(null,I),I.onerror=I.onload=null},I.onerror=()=>{G||C(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.")),I.onerror=I.onload=null},I.src=F,{cancel:()=>{G=!0,I.src=""}}}}(nt||(nt={})),nt.resetRequestQueue();var et,yt=nt;(function(a){a.Glyphs="Glyphs",a.Image="Image",a.Source="Source",a.SpriteImage="SpriteImage",a.SpriteJSON="SpriteJSON",a.Style="Style",a.Tile="Tile",a.Unknown="Unknown"})(et||(et={}));class at{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(p){const g=p.match(Pe);if(!g)throw new Error(`Unable to parse URL "${p}"`);return{protocol:g[1],authority:g[2],path:g[3]||"/",params:g[4]?g[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(p){const g=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${g}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const Pe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function St(a){var t=new c.ARRAY_TYPE(3);return t[0]=a[0],t[1]=a[1],t[2]=a[2],t}var oi,Rt=function(a,t,n){return a[0]=t[0]-n[0],a[1]=t[1]-n[1],a[2]=t[2]-n[2],a};oi=new c.ARRAY_TYPE(3),c.ARRAY_TYPE!=Float32Array&&(oi[0]=0,oi[1]=0,oi[2]=0);var Qt=function(a){var t=a[0],n=a[1];return t*t+n*n};function Ei(a){const t=[];if(typeof a=="string")t.push({id:"default",url:a});else if(a&&a.length>0){const n=[];for(const{id:s,url:u}of a){const p=`${s}${u}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:s,url:u}))}}return t}function di(a,t,n,s,u){if(s)return void a(s);if(u!==Object.values(t).length||u!==Object.values(n).length)return;const p={};for(const g in t){p[g]={};const v=c.exported.getImageCanvasContext(n[g]),y=t[g];for(const w in y){const{width:C,height:I,x:F,y:G,sdf:V,pixelRatio:j,stretchX:K,stretchY:re,content:ge}=y[w];p[g][w]={data:null,pixelRatio:j,sdf:V,stretchX:K,stretchY:re,content:ge,spriteData:{width:C,height:I,x:F,y:G,context:v}}}}a(null,p)}(function(){var a=new c.ARRAY_TYPE(2);c.ARRAY_TYPE!=Float32Array&&(a[0]=0,a[1]=0)})();class zt{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:p}=t,g=!(this.size&&this.size[0]===u&&this.size[1]===p||s),{context:v}=this,{gl:y}=v;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),v.pixelStoreUnpackFlipY.set(!1),v.pixelStoreUnpack.set(1),v.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),g)this.size=[u,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:w,y:C}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,w,C,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,w,C,u,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:p}=u;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function jr(a){const{userImage:t}=a;return!!(t&&t.render&&t.render())&&(a.data.replace(new Uint8Array(t.data.buffer)),!0)}class pi extends c.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const s=n.spriteData;n.data=new c.RGBAImage({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;const u=n.data||n.spriteData;return this._validateStretch(n.stretchX,u&&u.width)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,u&&u.height)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]-1);y++,p[y]=v,g[y]=w,g[y+1]=Pn}for(let v=0,y=0;v{let v=this.entries[u];v||(v=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=v.glyphs[p];if(y!==void 0)return void g(null,{stack:u,id:p,glyph:y});if(y=this._tinySDF(v,u,p),y)return v.glyphs[p]=y,void g(null,{stack:u,id:p,glyph:y});const w=Math.floor(p/256);if(256*w>65535)return void g(new Error("glyphs > 65535 not supported"));if(v.ranges[w])return void g(null,{stack:u,id:p,glyph:y});if(!this.url)return void g(new Error("glyphsUrl is not set"));let C=v.requests[w];C||(C=v.requests[w]=[],fn.loadGlyphRange(u,w,this.url,this.requestManager,(I,F)=>{if(F){for(const G in F)this._doesCharSupportLocalGlyph(+G)||(v.glyphs[+G]=F[+G]);v.ranges[w]=!0}for(const G of C)G(I,F);delete v.requests[w]})),C.push((I,F)=>{I?g(I):F&&g(null,{stack:u,id:p,glyph:F[p]||null})})},(u,p)=>{if(u)n(u);else if(p){const g={};for(const{stack:v,id:y,glyph:w}of p)(g[v]||(g[v]={}))[y]=w&&{id:w.id,bitmap:w.bitmap.clone(),metrics:w.metrics};n(null,g)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.unicodeBlockLookup["CJK Unified Ideographs"](t)||c.unicodeBlockLookup["Hangul Syllables"](t)||c.unicodeBlockLookup.Hiragana(t)||c.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let p=t.tinySDF;if(!p){let v="400";/bold/i.test(n)?v="900":/medium/i.test(n)?v="500":/light/i.test(n)&&(v="200"),p=t.tinySDF=new fn.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:v})}const g=p.draw(String.fromCharCode(s));return{id:s,bitmap:new c.AlphaImage({width:g.width||30,height:g.height||30},g.data),metrics:{width:g.glyphWidth||24,height:g.glyphHeight||24,left:g.glyphLeft||0,top:g.glyphTop-27||-8,advance:g.glyphAdvance||24}}}}fn.loadGlyphRange=function(a,t,n,s,u){const p=256*t,g=p+255,v=s.transformRequest(n.replace("{fontstack}",a).replace("{range}",`${p}-${g}`),et.Glyphs);c.getArrayBuffer(v,(y,w)=>{if(y)u(y);else if(w){const C={};for(const I of c.parseGlyphPbf(w))C[I.id]=I;u(null,C)}})},fn.TinySDF=class{constructor({fontSize:a=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:p="normal",fontStyle:g="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const v=this.size=a+4*t,y=this._createCanvas(v),w=this.ctx=y.getContext("2d",{willReadFrequently:!0});w.font=`${g} ${p} ${a}px ${u}`,w.textBaseline="alphabetic",w.textAlign="left",w.fillStyle="black",this.gridOuter=new Float64Array(v*v),this.gridInner=new Float64Array(v*v),this.f=new Float64Array(v),this.z=new Float64Array(v+1),this.v=new Uint16Array(v)}_createCanvas(a){const t=document.createElement("canvas");return t.width=t.height=a,t}draw(a){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(a),g=Math.ceil(n),v=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-u))),y=Math.min(this.size-this.buffer,g+Math.ceil(s)),w=v+2*this.buffer,C=y+2*this.buffer,I=Math.max(w*C,0),F=new Uint8ClampedArray(I),G={data:F,width:w,height:C,glyphWidth:v,glyphHeight:y,glyphTop:g,glyphLeft:0,glyphAdvance:t};if(v===0||y===0)return G;const{ctx:V,buffer:j,gridInner:K,gridOuter:re}=this;V.clearRect(j,j,v,y),V.fillText(a,j,j+g);const ge=V.getImageData(j,j,v,y);re.fill(Pn,0,I),K.fill(0,0,I);for(let W=0;W0?Le*Le:0,K[Ae]=Le<0?Le*Le:0}}pn(re,0,0,w,C,w,this.f,this.v,this.z),pn(K,j,j,v,y,w,this.f,this.v,this.z);for(let W=0;W1&&(y=t[++v]);const C=Math.abs(w-y.left),I=Math.abs(w-y.right),F=Math.min(C,I);let G;const V=p/s*(u+1);if(y.isDash){const j=u-Math.abs(V);G=Math.sqrt(F*F+j*j)}else G=u-Math.sqrt(F*F+V*V);this.data[g+w]=Math.max(0,Math.min(255,G+128))}}}addRegularDash(t){for(let v=t.length-1;v>=0;--v){const y=t[v],w=t[v+1];y.zeroLength?t.splice(v,1):w&&w.isDash===y.isDash&&(w.left=y.left,t.splice(v,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let p=0,g=t[p];for(let v=0;v1&&(g=t[++p]);const y=Math.abs(v-g.left),w=Math.abs(v-g.right),C=Math.min(y,w);this.data[u+v]=Math.max(0,Math.min(255,(g.isDash?C:-C)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return c.warnOnce("LineAtlas out of space"),null;let p=0;for(let v=0;v{u.send(t,n,p)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Ii(a,t,n){const s=function(u,p){if(u)return n(u);if(p){const g=c.pick(c.extend(p,a),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(g.vectorLayers=p.vector_layers,g.vectorLayerIds=g.vectorLayers.map(v=>v.id)),n(null,g)}};return a.url?c.getJSON(t.transformRequest(a.url,et.Source),s):c.exported.frame(()=>s(null,a))}Si.Actor=c.Actor;class ar{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof c.LngLat?new c.LngLat(t.lng,t.lat):c.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.LngLat?new c.LngLat(t.lng,t.lat):c.LngLat.convert(t),this}extend(t){const n=this._sw,s=this._ne;let u,p;if(t instanceof c.LngLat)u=t,p=t;else{if(!(t instanceof ar))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ar.convert(t)):this.extend(c.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.LngLat.convert(t)):this;if(u=t._sw,p=t._ne,!u||!p)return this}return n||s?(n.lng=Math.min(u.lng,n.lng),n.lat=Math.min(u.lat,n.lat),s.lng=Math.max(p.lng,s.lng),s.lat=Math.max(p.lat,s.lat)):(this._sw=new c.LngLat(u.lng,u.lat),this._ne=new c.LngLat(p.lng,p.lat)),this}getCenter(){return new c.LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new c.LngLat(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(t){const{lng:n,lat:s}=c.LngLat.convert(t);let u=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(u=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&u}static convert(t){return t instanceof ar?t:t&&new ar(t)}static fromLngLat(t,n=0){const s=360*n/40075017,u=s/Math.cos(Math.PI/180*t.lat);return new ar(new c.LngLat(t.lng-u,t.lat-s),new c.LngLat(t.lng+u,t.lat+s))}}class Vn{constructor(t,n,s){this.bounds=ar.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),s=Math.floor(c.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(c.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(c.mercatorXfromLng(this.bounds.getEast())*n),g=Math.ceil(c.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x=u&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new Vn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,et.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(g,v){return delete t.request,t.aborted?n(null):g&&g.status!==404?n(g):(v&&v.resourceTiming&&(t.resourceTiming=v.resourceTiming),this.map._refreshExpiredTiles&&v&&t.setExpiryData(v),t.loadVectorData(v,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class At extends c.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.extend({type:"raster"},n),c.extend(this,c.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Ii(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new Vn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=yt.getImage(this.map._requestManager.transformRequest(s,et.Tile),(u,p,g)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(p){this.map._refreshExpiredTiles&&g&&t.setExpiryData(g);const v=this.map.painter.context,y=v.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new zt(v,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),v.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,v.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,v.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class jn extends At{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=c.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(p,g){p&&(t.state="errored",n(p)),g&&(t.dem=g,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=yt.getImage(this.map._requestManager.transformRequest(s,et.Tile),function(p,g){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(g){this.map._refreshExpiredTiles&&t.setExpiryData(g),delete g.cacheControl,delete g.expires;const v=c.isImageBitmap(g)&&(oo==null&&(oo=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),oo)?g:c.exported.getImageData(g,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:v,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,g=(n.x+1+s)%s,v=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new c.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,v,n.z,g,n.y).key]={backfilled:!1},n.y>0&&(y[new c.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,v,n.z,g,n.y-1).key]={backfilled:!1}),n.y+1{if(this._pendingLoads--,this._removed||u&&u.abandoned)return void this.fire(new c.Event("dataabort",{dataType:"source"}));let p=null;if(u&&u.resourceTiming&&u.resourceTiming[this.id]&&(p=u.resourceTiming[this.id].slice(0)),s)return void this.fire(new c.ErrorEvent(s));const g={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&c.extend(g,{resourceTiming:p}),this.fire(new c.Event("data",{...g,sourceDataType:"metadata"})),this.fire(new c.Event("data",{...g,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,u,(p,g)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(g,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return c.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Gn=c.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fr extends c.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=yt.getImage(this.map._requestManager.transformRequest(this.url,et.Image),(s,u)=>{this._request=null,this._loaded=!0,s?this.fire(new c.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.MercatorCoordinate.fromLngLat);this.tileID=function(u){let p=1/0,g=1/0,v=-1/0,y=-1/0;for(const F of u)p=Math.min(p,F.x),g=Math.min(g,F.y),v=Math.max(v,F.x),y=Math.max(y,F.y);const w=Math.max(v-p,y-g),C=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),I=Math.pow(2,C);return new c.CanonicalTileID(C,Math.floor((p+v)/2*I),Math.floor((g+y)/2*I))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new c.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,c.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,c.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,c.EXTENT,c.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Gn.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new zt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,s=!0)}s&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class $o extends fr{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,et.Source).url);c.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new c.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Gn.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new zt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,s=!0)}s&&this.fire(new c.Event("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 fr{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(g=>typeof g!="number"))||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.ErrorEvent(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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Gn.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new zt(n,this.canvas,s.RGBA,{premultiply:!0});let u=!1;for(const p in this.tiles){const g=this.tiles[p];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,u=!0)}u&&this.fire(new c.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const qn={vector:Zi,raster:At,"raster-dem":jn,geojson:$n,video:$o,image:fr,canvas:_e};function Yr(a,t){const n=c.create();return c.translate(n,n,[1,1,0]),c.scale(n,n,[.5*a.width,.5*a.height,1]),c.multiply(n,n,a.calculatePosMatrix(t.toUnwrapped()))}function si(a,t,n,s,u,p){const g=function(I,F,G){if(I)for(const V of I){const j=F[V];if(j&&j.source===G&&j.type==="fill-extrusion")return!0}else for(const V in F){const j=F[V];if(j.source===G&&j.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,a.id),v=p.maxPitchScaleFactor(),y=a.tilesIn(s,v,g);y.sort(Gt);const w=[];for(const I of y)w.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(t,n,a._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,u,p,v,Yr(a.transform,I.tileID))});const C=function(I){const F={},G={};for(const V of I){const j=V.queryResults,K=V.wrappedTileID,re=G[K]=G[K]||{};for(const ge in j){const W=j[ge],pe=re[ge]=re[ge]||{},ve=F[ge]=F[ge]||[];for(const Ae of W)pe[Ae.featureIndex]||(pe[Ae.featureIndex]=!0,ve.push(Ae))}}return F}(w);for(const I in C)C[I].forEach(F=>{const G=F.feature,V=a.getFeatureState(G.layer["source-layer"],G.id);G.source=G.layer.source,G.layer["source-layer"]&&(G.sourceLayer=G.layer["source-layer"]),G.state=V});return C}function Gt(a,t){const n=a.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class So{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.uniqueId(),this.uses=0,this.tileSize=n,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(t){const n=t+this.timeAdded;np.getLayer(w)).filter(Boolean);if(y.length!==0){v.layers=y,v.stateDependentLayerIds&&(v.stateDependentLayers=v.stateDependentLayerIds.map(w=>y.filter(C=>C.id===w)[0]));for(const w of y)g[w.id]=v}}return g}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const p=this.buckets[u];if(p instanceof c.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const p=this.buckets[u];if(p instanceof c.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,c.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const p=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new zt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new zt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,p,g,v,y,w,C){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:g,tileSize:this.tileSize,pixelPosMatrix:C,transform:y,params:v,queryPadding:this.queryPadding*w},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",g=u._geojsonTileLayer||u[p];if(!g)return;const v=c.createFilter(n&&n.filter),{z:y,x:w,y:C}=this.tileID.canonical,I={z:y,x:w,y:C};for(let F=0;Fs)u=!1;else if(n)if(this.expirationTime{this.remove(t,p)},s)),this.data[u].push(p),this.order.push(u),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),p=this.data[s][u];return this.data[s].splice(u,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Io{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},c.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==u&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const p in this.state[t][u])s[p]||(this.deletedStates[t][u][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][p]===null&&delete this.deletedStates[t][u][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=c.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const g in p)delete u[g]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const p={};for(const g in this.stateChanges[u])this.state[u][g]||(this.state[u][g]={}),c.extend(this.state[u][g],this.stateChanges[u][g]),p[g]=this.state[u][g];s[u]=p}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const p={};if(this.deletedStates[u]===null)for(const g in this.state[u])p[g]={},this.state[u][g]={};else for(const g in this.deletedStates[u]){if(this.deletedStates[u][g]===null)this.state[u][g]={};else for(const v of Object.keys(this.deletedStates[u][g]))delete this.state[u][g][v];p[g]=this.state[u][g]}s[u]=s[u]||{},c.extend(s[u],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class Ri extends c.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,p,g,v){const y=new qn[p.type](u,p,g,v);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return c.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Go(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Io,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}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 t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new c.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort($r).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const p=s.tileID,g=u.tileID,v=new c.Point(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new c.Point(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-g.overscaledZ||y.y-v.y||y.x-v.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort($r).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new c.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=c.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u1||(Math.abs(g)>1&&(Math.abs(g+y)===1?g+=y:Math.abs(g-y)===1&&(g-=y)),p.dem&&u.dem&&(u.dem.backfillBorder(p.dem,g,v),u.neighboringTiles&&u.neighboringTiles[w]&&(u.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const p in this._tiles){let g=this._tiles[p];if(u[p]||!g.hasData()||g.tileID.overscaledZ<=n||g.tileID.overscaledZ>s)continue;let v=g.tileID;for(;g&&g.tileID.overscaledZ>n+1;){const w=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[w.key],g&&g.hasData()&&(v=w)}let y=v;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[v.key]=v;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),p=this._getLoadedTile(u);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?c.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const p=this._tiles[u];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(C=>new c.OverscaledTileID(C.canonical.z,C.wrap,C.canonical.z,C.canonical.x,C.canonical.y)):(s=t.coveringTiles({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:n}),this._source.hasTile&&(s=s.filter(C=>this._source.hasTile(C)))):s=[];const u=t.coveringZoomLevel(this._source),p=Math.max(u-Ri.maxOverzooming,this._source.minzoom),g=Math.max(u+Ri.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const C={};for(const I of s)if(I.canonical.z>this._source.minzoom){const F=I.scaledTo(I.canonical.z-1);C[F.key]=F;const G=I.scaledTo(Math.max(this._source.minzoom,Math.min(I.canonical.z,5)));C[G.key]=G}s=s.concat(Object.values(C))}const v=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,v&&this.fire(new c.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(s,u);if(so(this._source.type)){const C={},I={},F=Object.keys(y),G=c.exported.now();for(const V of F){const j=y[V],K=this._tiles[V];if(!K||K.fadeEndTime!==0&&K.fadeEndTime<=G)continue;const re=this.findLoadedParent(j,p);re&&(this._addTile(re.tileID),C[re.tileID.key]=re.tileID),I[V]=j}this._retainLoadedChildren(I,u,g,y);for(const V in C)y[V]||(this._coveredTiles[V]=!0,y[V]=C[V]);if(n){const V={},j={};for(const K of s)this._tiles[K.key].hasData()?V[K.key]=K:j[K.key]=K;for(const K in j){const re=j[K].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(V[re[0].key]=y[re[0].key]=re[0],V[re[1].key]=y[re[1].key]=re[1],V[re[2].key]=y[re[2].key]=re[2],V[re[3].key]=y[re[3].key]=re[3],delete j[K])}for(const K in j){const re=this.findLoadedParent(j[K],this._source.minzoom);if(re){V[re.tileID.key]=y[re.tileID.key]=re.tileID;for(const ge in V)V[ge].isChildOf(re.tileID)&&delete V[ge]}}for(const K in this._tiles)V[K]||(this._coveredTiles[K]=!0)}}for(const C in y)this._tiles[C].clearFadeHold();const w=c.keysDifference(this._tiles,y);for(const C of w){const I=this._tiles[C];I.hasSymbolBuckets&&!I.holdingForFade()?I.setHoldDuration(this.map._fadeDuration):I.hasSymbolBuckets&&!I.symbolFadeFinished()||this._removeTile(C)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},p=Math.max(n-Ri.maxOverzooming,this._source.minzoom),g=Math.max(n+Ri.maxUnderzooming,this._source.minzoom),v={};for(const y of t){const w=this._addTile(y);s[y.key]=y,w.hasData()||nthis._source.maxzoom){const I=y.children(this._source.maxzoom)[0],F=this.getTile(I);if(F&&F.hasData()){s[I.key]=I;continue}}else{const I=y.children(this._source.maxzoom);if(s[I[0].key]&&s[I[1].key]&&s[I[2].key]&&s[I[3].key])continue}let C=w.wasRequested();for(let I=y.overscaledZ-1;I>=p;--I){const F=y.scaledTo(I);if(u[F.key])break;if(u[F.key]=!0,w=this.getTile(F),!w&&C&&(w=this._addTile(F)),w){const G=w.hasData();if((C||G)&&(s[F.key]=F),C=w.wasRequested(),G)break}}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const p=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;u=p}for(const p of n)this._loadedParentTiles[p]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new So(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new c.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],p=this.transform;if(!p)return u;const g=s?p.getCameraQueryGeometry(t):t,v=t.map(V=>p.pointCoordinate(V,this.terrain)),y=g.map(V=>p.pointCoordinate(V,this.terrain)),w=this.getIds();let C=1/0,I=1/0,F=-1/0,G=-1/0;for(const V of y)C=Math.min(C,V.x),I=Math.min(I,V.y),F=Math.max(F,V.x),G=Math.max(G,V.y);for(let V=0;V=0&&W[1].y+ge>=0){const pe=v.map(Ae=>K.getTilePoint(Ae)),ve=y.map(Ae=>K.getTilePoint(Ae));u.push({tile:j,tileID:K,queryGeometry:pe,cameraQueryGeometry:ve,scale:re})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(so(this._source.type)){const t=c.exported.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function $r(a,t){const n=Math.abs(2*a.wrap)-+(a.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return a.overscaledZ-t.overscaledZ||s-n||t.canonical.y-a.canonical.y||t.canonical.x-a.canonical.x}function so(a){return a==="raster"||a==="image"||a==="video"}Ri.maxOverzooming=10,Ri.maxUnderzooming=3;const kn="mapboxgl_preloaded_worker_pool";class Oe{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[kn]}numActive(){return Object.keys(this.active).length}}const Pr=Math.floor(c.exported.hardwareConcurrency/2);let Xi;function Zn(){return Xi||(Xi=new Oe),Xi}Oe.workerCount=c.isSafari(globalThis)?Math.max(Math.min(Pr,3),1):1;class gn{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s0?(u-g)/v:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function Ue(a,t){let n=!0;return a==="always"||a!=="never"&&t!=="never"||(n=!1),n}class Dt{constructor(t,n,s){const u=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let g=0;gthis.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let w=0;w0}hitTestCircle(t,n,s,u,p){const g=t-s,v=t+s,y=n-s,w=n+s;if(v<0||g>this.width||w<0||y>this.height)return!1;const C=[];return this._forEachCell(g,y,v,w,this._queryCellCircle,C,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),C.length>0}_queryCell(t,n,s,u,p,g,v,y){const{seenUids:w,hitTest:C,overlapMode:I}=v,F=this.boxCells[p];if(F!==null){const V=this.bboxes;for(const j of F)if(!w.box[j]){w.box[j]=!0;const K=4*j,re=this.boxKeys[j];if(t<=V[K+2]&&n<=V[K+3]&&s>=V[K+0]&&u>=V[K+1]&&(!y||y(re))&&(!C||!Ue(I,re.overlapMode))&&(g.push({key:re,x1:V[K],y1:V[K+1],x2:V[K+2],y2:V[K+3]}),C))return!0}}const G=this.circleCells[p];if(G!==null){const V=this.circles;for(const j of G)if(!w.circle[j]){w.circle[j]=!0;const K=3*j,re=this.circleKeys[j];if(this._circleAndRectCollide(V[K],V[K+1],V[K+2],t,n,s,u)&&(!y||y(re))&&(!C||!Ue(I,re.overlapMode))){const ge=V[K],W=V[K+1],pe=V[K+2];if(g.push({key:re,x1:ge-pe,y1:W-pe,x2:ge+pe,y2:W+pe}),C)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,g,v,y){const{circle:w,seenUids:C,overlapMode:I}=v,F=this.boxCells[p];if(F!==null){const V=this.bboxes;for(const j of F)if(!C.box[j]){C.box[j]=!0;const K=4*j,re=this.boxKeys[j];if(this._circleAndRectCollide(w.x,w.y,w.radius,V[K+0],V[K+1],V[K+2],V[K+3])&&(!y||y(re))&&!Ue(I,re.overlapMode))return g.push(!0),!0}}const G=this.circleCells[p];if(G!==null){const V=this.circles;for(const j of G)if(!C.circle[j]){C.circle[j]=!0;const K=3*j,re=this.circleKeys[j];if(this._circlesCollide(V[K],V[K+1],V[K+2],w.x,w.y,w.radius)&&(!y||y(re))&&!Ue(I,re.overlapMode))return g.push(!0),!0}}}_forEachCell(t,n,s,u,p,g,v,y){const w=this._convertToXCellCoord(t),C=this._convertToYCellCoord(n),I=this._convertToXCellCoord(s),F=this._convertToYCellCoord(u);for(let G=w;G<=I;G++)for(let V=C;V<=F;V++)if(p.call(this,t,n,s,u,this.xCellCount*V+G,g,v,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,s,u,p,g){const v=u-t,y=p-n,w=s+g;return w*w>v*v+y*y}_circleAndRectCollide(t,n,s,u,p,g,v){const y=(g-u)/2,w=Math.abs(t-(u+y));if(w>y+s)return!1;const C=(v-p)/2,I=Math.abs(n-(p+C));if(I>C+s)return!1;if(w<=y||I<=C)return!0;const F=w-y,G=I-C;return F*F+G*G<=s*s}}function xt(a,t,n,s,u){const p=c.create();return t?(c.scale(p,p,[1/u,1/u,1]),n||c.rotateZ(p,p,s.angle)):c.multiply(p,s.labelPlaneMatrix,a),p}function mr(a,t,n,s,u){if(t){const p=c.clone(a);return c.scale(p,p,[u,u,1]),n||c.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function _i(a,t,n){let s;n?(s=[a.x,a.y,n(a.x,a.y),1],c.transformMat4(s,s,t)):(s=[a.x,a.y,0,1],X(s,s,t));const u=s[3];return{point:new c.Point(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Tt(a,t){return .5+a/t*.5}function Qr(a,t){const n=a[0]/a[3],s=a[1]/a[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Wi(a,t,n,s,u,p,g,v,y,w){const C=s?a.textSizeData:a.iconSizeData,I=c.evaluateSizeForZoom(C,n.transform.zoom),F=[256/n.width*2+1,256/n.height*2+1],G=s?a.text.dynamicLayoutVertexArray:a.icon.dynamicLayoutVertexArray;G.clear();const V=a.lineVertexArray,j=s?a.text.placedSymbolArray:a.icon.placedSymbolArray,K=n.transform.width/n.transform.height;let re=!1;for(let ge=0;geMath.abs(n.x-t.x)*s?{useVertical:!0}:(a===c.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function Qi(a,t,n,s,u,p,g,v,y,w,C,I,F,G,V,j){const K=t/24,re=a.lineOffsetX*K,ge=a.lineOffsetY*K;let W;if(a.numGlyphs>1){const pe=a.glyphStartIndex+a.numGlyphs,ve=a.lineStartIndex,Ae=a.lineStartIndex+a.lineLength,Le=Er(K,v,re,ge,n,C,I,a,y,p,F,V,j);if(!Le)return{notEnoughRoom:!0};const Re=_i(Le.first.point,g,j).point,ke=_i(Le.last.point,g,j).point;if(s&&!n){const Qe=Xn(a.writingMode,Re,ke,G);if(Qe)return Qe}W=[Le.first];for(let Qe=a.glyphStartIndex+1;Qe0?Re.point:ui(I,Le,ve,1,u,j),Qe=Xn(a.writingMode,ve,ke,G);if(Qe)return Qe}const pe=P(K*v.getoffsetX(a.glyphStartIndex),re,ge,n,C,I,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,y,p,F,V,j);if(!pe)return{notEnoughRoom:!0};W=[pe]}for(const pe of W)c.addDynamicAttributes(w,pe.point,pe.angle);return{}}function ui(a,t,n,s,u,p){const g=_i(a.add(a.sub(t)._unit()),u,p).point,v=n.sub(g);return n.add(v._mult(s/v.mag()))}function os(a,t){const{projectionCache:n,lineVertexArray:s,labelPlaneMatrix:u,tileAnchorPoint:p,distanceFromAnchor:g,getElevation:v,previousVertex:y,direction:w,absOffsetX:C}=t;if(n.projections[a])return n.projections[a];const I=new c.Point(s.getx(a),s.gety(a)),F=_i(I,u,v);if(F.signedDistanceFromCamera>0)return n.projections[a]=F.point,F.point;const G=a-w;return ui(g===0?p:new c.Point(s.getx(G),s.gety(G)),I,y,C-g+1,u,v)}function zn(a,t,n){return a._unit()._perp()._mult(t*n)}function q(a,t,n,s,u,p,g,v){const{projectionCache:y,direction:w}=v;if(y.offsets[a])return y.offsets[a];const C=n.add(t);if(a+w=u)return y.offsets[a]=C,C;const I=os(a+w,v),F=zn(I.sub(n),g,w),G=n.add(F),V=I.add(F);return y.offsets[a]=c.findLineIntersection(p,C,G,V)||C,y.offsets[a]}function P(a,t,n,s,u,p,g,v,y,w,C,I,F,G){const V=s?a-t:a+t;let j=V>0?1:-1,K=0;s&&(j*=-1,K=Math.PI),j<0&&(K+=Math.PI);let re,ge,W=j>0?v+g:v+g+1,pe=u,ve=u,Ae=0,Le=0;const Re=Math.abs(V),ke=[];let Qe;for(;Ae+Le<=Re;){if(W+=j,W=y)return null;Ae+=Le,ve=pe,ge=re;const Ge={projectionCache:I,lineVertexArray:w,labelPlaneMatrix:C,tileAnchorPoint:p,distanceFromAnchor:Ae,getElevation:G,previousVertex:ve,direction:j,absOffsetX:Re};if(pe=os(W,Ge),n===0)ke.push(ve),Qe=pe.sub(ve);else{let vt;const tt=pe.sub(ve);vt=tt.mag()===0?zn(os(W+j,Ge).sub(pe),n,j):zn(tt,n,j),ge||(ge=ve.add(vt)),re=q(W,vt,pe,v,y,ge,n,Ge),ke.push(ge),Qe=re.sub(ge)}Le=Qe.mag()}const ft=Qe._mult((Re-Ae)/Le)._add(ge||ve),Ct=K+Math.atan2(pe.y-ve.y,pe.x-ve.x);return ke.push(ft),{point:ft,angle:F?Ct:0,path:ke}}const L=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function N(a,t){for(let n=0;n=1;Yt--)tt.push(Ge.path[Yt]);for(let Yt=1;Yt_i(kt,y,V));tt=Yt.some(kt=>kt.signedDistanceFromCamera<=0)?[]:Yt.map(kt=>kt.point)}let Hi=[];if(tt.length>0){const Yt=tt[0].clone(),kt=tt[0].clone();for(let $i=1;$i=Qe.x&&kt.x<=ft.x&&Yt.y>=Qe.y&&kt.y<=ft.y?[tt]:kt.xft.x||kt.yft.y?[]:c.clipLine([tt],Qe.x,Qe.y,ft.x,ft.y)}for(const Yt of Hi){Ct.reset(Yt,.25*ke);let kt=0;kt=Ct.length<=.5*ke?1:Math.ceil(Ct.paddedLength/Jt)+1;for(let $i=0;$i=this.screenRightBoundary||uthis.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t=0&&ns.collisionGroupID===n}}return this.collisionGroups[t]}}function Et(a,t,n,s,u){const{horizontalAlign:p,verticalAlign:g}=c.getAnchorAlignment(a),v=-(p-.5)*t,y=-(g-.5)*n,w=c.evaluateVariableOffset(a,s);return new c.Point(v+w[0]*u,y+w[1]*u)}function st(a,t,n,s,u,p){const{x1:g,x2:v,y1:y,y2:w,anchorPointX:C,anchorPointY:I}=a,F=new c.Point(t,n);return s&&F._rotate(u?p:-p),{x1:g+F.x,y1:y+F.y,x2:v+F.x,y2:w+F.y,anchorPointX:C,anchorPointY:I}}class pt{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new se(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new it(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const p=s.getBucket(n),g=s.latestFeatureIndex;if(!p||!g||n.id!==p.layerIds[0])return;const v=s.collisionBoxArray,y=p.layers[0].layout,w=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),C=s.tileSize/c.EXTENT,I=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),F=y.get("text-pitch-alignment")==="map",G=y.get("text-rotation-alignment")==="map",V=ee(s,1,this.transform.zoom),j=xt(I,F,G,this.transform,V);let K=null;if(F){const ge=mr(I,F,G,this.transform,V);K=c.multiply([],this.transform.labelPlaneMatrix,ge)}this.retainedQueryData[p.bucketInstanceId]=new Ce(p.bucketInstanceId,g,p.sourceLayerIndex,p.index,s.tileID);const re={bucket:p,layout:y,posMatrix:I,textLabelPlaneMatrix:j,labelToScreenMatrix:K,scale:w,textPixelRatio:C,holdingForFade:s.holdingForFade(),collisionBoxArray:v,partiallyEvaluatedTextSize:c.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const ge of p.sortKeyRanges){const{sortKey:W,symbolInstanceStart:pe,symbolInstanceEnd:ve}=ge;t.push({sortKey:W,symbolInstanceStart:pe,symbolInstanceEnd:ve,parameters:re})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:re})}attemptAnchorPlacement(t,n,s,u,p,g,v,y,w,C,I,F,G,V,j,K){const re=[F.textOffset0,F.textOffset1],ge=Et(t,s,u,re,p),W=this.collisionIndex.placeCollisionBox(st(n,ge.x,ge.y,g,v,this.transform.angle),I,y,w,C.predicate,K);if((!j||this.collisionIndex.placeCollisionBox(st(j,ge.x,ge.y,g,v,this.transform.angle),I,y,w,C.predicate,K).box.length!==0)&&W.box.length>0){let pe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(pe=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:re,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:pe},this.markUsedJustification(G,t,F,V),G.allowVerticalPlacement&&(this.markUsedOrientation(G,V,F),this.placedOrientations[F.crossTileID]=V),{shift:ge,placedGlyphBoxes:W}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:g,textLabelPlaneMatrix:v,labelToScreenMatrix:y,textPixelRatio:w,holdingForFade:C,collisionBoxArray:I,partiallyEvaluatedTextSize:F,collisionGroup:G}=t.parameters,V=p.get("text-optional"),j=p.get("icon-optional"),K=c.getOverlapMode(p,"text-overlap","text-allow-overlap"),re=K==="always",ge=c.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),W=ge==="always",pe=p.get("text-rotation-alignment")==="map",ve=p.get("text-pitch-alignment")==="map",Ae=p.get("icon-text-fit")!=="none",Le=p.get("symbol-z-order")==="viewport-y",Re=re&&(W||!u.hasIconData()||j),ke=W&&(re||!u.hasTextData()||V);!u.collisionArrays&&I&&u.deserializeCollisionBoxes(I);const Qe=this.retainedQueryData[u.bucketInstanceId].tileID,ft=this.terrain?(Ge,vt)=>this.terrain.getElevation(Qe,Ge,vt):null,Ct=(Ge,vt)=>{if(n[Ge.crossTileID])return;if(C)return void(this.placements[Ge.crossTileID]=new Te(!1,!1,!1));let tt=!1,Jt=!1,Hi=!0,Yt=null,kt={box:null,offscreen:null},$i={box:null,offscreen:null},Zr=null,Ki=null,yr=null,vn=0,Kn=0,Jn=0;vt.textFeatureIndex?vn=vt.textFeatureIndex:Ge.useRuntimeCollisionCircles&&(vn=Ge.featureIndex),vt.verticalTextFeatureIndex&&(Kn=vt.verticalTextFeatureIndex);const Xr=vt.textBox;if(Xr){const Rr=ei=>{let ur=c.WritingMode.horizontal;if(u.allowVerticalPlacement&&!ei&&this.prevPlacement){const xr=this.prevPlacement.placedOrientations[Ge.crossTileID];xr&&(this.placedOrientations[Ge.crossTileID]=xr,ur=xr,this.markUsedOrientation(u,ur,Ge))}return ur},vr=(ei,ur)=>{if(u.allowVerticalPlacement&&Ge.numVerticalGlyphVertices>0&&vt.verticalTextBox){for(const xr of u.writingModes)if(xr===c.WritingMode.vertical?(kt=ur(),$i=kt):kt=ei(),kt&&kt.box&&kt.box.length)break}else kt=ei()};if(p.get("text-variable-anchor")){let ei=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ge.crossTileID]){const ni=this.prevPlacement.variableOffsets[Ge.crossTileID];ei.indexOf(ni.anchor)>0&&(ei=ei.filter(hr=>hr!==ni.anchor),ei.unshift(ni.anchor))}const ur=(ni,hr,xn)=>{const Va=ni.x2-ni.x1,Oo=ni.y2-ni.y1,Rc=Ge.textBoxScale,oc=Ae&&ge==="never"?hr:null;let bi={box:[],offscreen:!1};const xl=K!=="never"?2*ei.length:ei.length;for(let fa=0;fa=ei.length?K:"never",Ge,u,xn,oc,ft);if(Uo&&(bi=Uo.placedGlyphBoxes,bi&&bi.box&&bi.box.length)){tt=!0,Yt=Uo.shift;break}}return bi};vr(()=>ur(Xr,vt.iconBox,c.WritingMode.horizontal),()=>{const ni=vt.verticalTextBox;return u.allowVerticalPlacement&&!(kt&&kt.box&&kt.box.length)&&Ge.numVerticalGlyphVertices>0&&ni?ur(ni,vt.verticalIconBox,c.WritingMode.vertical):{box:null,offscreen:null}}),kt&&(tt=kt.box,Hi=kt.offscreen);const xr=Rr(kt&&kt.box);if(!tt&&this.prevPlacement){const ni=this.prevPlacement.variableOffsets[Ge.crossTileID];ni&&(this.variableOffsets[Ge.crossTileID]=ni,this.markUsedJustification(u,ni.anchor,Ge,xr))}}else{const ei=(ur,xr)=>{const ni=this.collisionIndex.placeCollisionBox(ur,K,w,g,G.predicate,ft);return ni&&ni.box&&ni.box.length&&(this.markUsedOrientation(u,xr,Ge),this.placedOrientations[Ge.crossTileID]=xr),ni};vr(()=>ei(Xr,c.WritingMode.horizontal),()=>{const ur=vt.verticalTextBox;return u.allowVerticalPlacement&&Ge.numVerticalGlyphVertices>0&&ur?ei(ur,c.WritingMode.vertical):{box:null,offscreen:null}}),Rr(kt&&kt.box&&kt.box.length)}}if(Zr=kt,tt=Zr&&Zr.box&&Zr.box.length>0,Hi=Zr&&Zr.offscreen,Ge.useRuntimeCollisionCircles){const Rr=u.text.placedSymbolArray.get(Ge.centerJustifiedTextSymbolIndex),vr=c.evaluateSizeForFeature(u.textSizeData,F,Rr),ei=p.get("text-padding");Ki=this.collisionIndex.placeCollisionCircles(K,Rr,u.lineVertexArray,u.glyphOffsetArray,vr,g,v,y,s,ve,G.predicate,Ge.collisionCircleDiameter,ei,ft),Ki.circles.length&&Ki.collisionDetected&&!s&&c.warnOnce("Collisions detected, but collision boxes are not shown"),tt=re||Ki.circles.length>0&&!Ki.collisionDetected,Hi=Hi&&Ki.offscreen}if(vt.iconFeatureIndex&&(Jn=vt.iconFeatureIndex),vt.iconBox){const Rr=vr=>{const ei=Ae&&Yt?st(vr,Yt.x,Yt.y,pe,ve,this.transform.angle):vr;return this.collisionIndex.placeCollisionBox(ei,ge,w,g,G.predicate,ft)};$i&&$i.box&&$i.box.length&&vt.verticalIconBox?(yr=Rr(vt.verticalIconBox),Jt=yr.box.length>0):(yr=Rr(vt.iconBox),Jt=yr.box.length>0),Hi=Hi&&yr.offscreen}const wo=V||Ge.numHorizontalGlyphVertices===0&&Ge.numVerticalGlyphVertices===0,pa=j||Ge.numIconVertices===0;if(wo||pa?pa?wo||(Jt=Jt&&tt):tt=Jt&&tt:Jt=tt=Jt&&tt,tt&&Zr&&Zr.box&&this.collisionIndex.insertCollisionBox(Zr.box,K,p.get("text-ignore-placement"),u.bucketInstanceId,$i&&$i.box&&Kn?Kn:vn,G.ID),Jt&&yr&&this.collisionIndex.insertCollisionBox(yr.box,ge,p.get("icon-ignore-placement"),u.bucketInstanceId,Jn,G.ID),Ki&&(tt&&this.collisionIndex.insertCollisionCircles(Ki.circles,K,p.get("text-ignore-placement"),u.bucketInstanceId,vn,G.ID),s)){const Rr=u.bucketInstanceId;let vr=this.collisionCircleArrays[Rr];vr===void 0&&(vr=this.collisionCircleArrays[Rr]=new Se);for(let ei=0;ei=0;--vt){const tt=Ge[vt];Ct(u.symbolInstances.get(tt),u.collisionArrays[tt])}}else for(let Ge=t.symbolInstanceStart;Ge=0&&(t.text.placedSymbolArray.get(v).crossTileID=p>=0&&v!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===c.WritingMode.horizontal||n===c.WritingMode.horizontalOnly?n:0,p=n===c.WritingMode.vertical?n:0,g=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const v of g)t.text.placedSymbolArray.get(v).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},g=n?n.variableOffsets:{},v=n?n.placedOrientations:{};for(const y in this.placements){const w=this.placements[y],C=p[y];C?(this.opacities[y]=new ce(C,u,w.text,w.icon),s=s||w.text!==C.text.placed||w.icon!==C.icon.placed):(this.opacities[y]=new ce(null,u,w.text,w.icon,w.skipFade),s=s||w.text||w.icon)}for(const y in p){const w=p[y];if(!this.opacities[y]){const C=new ce(w,u,!1,!1);C.isHidden()||(this.opacities[y]=C,s=s||w.text.placed||w.icon.placed)}}for(const y in g)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=g[y]);for(const y in v)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=v[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const p=u.getBucket(t);p&&u.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,p=new ce(null,0,!1,!1,!0),g=u.get("text-allow-overlap"),v=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),w=u.get("text-rotation-alignment")==="map",C=u.get("text-pitch-alignment")==="map",I=u.get("icon-text-fit")!=="none",F=new ce(null,0,g&&(v||!t.hasIconData()||u.get("icon-optional")),v&&(g||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const G=(V,j,K)=>{for(let re=0;re0,ve=this.placedOrientations[j.crossTileID],Ae=ve===c.WritingMode.vertical,Le=ve===c.WritingMode.horizontal||ve===c.WritingMode.horizontalOnly;if(K>0||re>0){const Re=ao(W.text);G(t.text,K,Ae?vi:Re),G(t.text,re,Le?vi:Re);const ke=W.text.isHidden();[j.rightJustifiedTextSymbolIndex,j.centerJustifiedTextSymbolIndex,j.leftJustifiedTextSymbolIndex].forEach(Ct=>{Ct>=0&&(t.text.placedSymbolArray.get(Ct).hidden=ke||Ae?1:0)}),j.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(j.verticalPlacedTextSymbolIndex).hidden=ke||Le?1:0);const Qe=this.variableOffsets[j.crossTileID];Qe&&this.markUsedJustification(t,Qe.anchor,j,ve);const ft=this.placedOrientations[j.crossTileID];ft&&(this.markUsedJustification(t,"left",j,ft),this.markUsedOrientation(t,ft,j))}if(pe){const Re=ao(W.icon),ke=!(I&&j.verticalPlacedIconSymbolIndex&&Ae);j.placedIconSymbolIndex>=0&&(G(t.icon,j.numIconVertices,ke?Re:vi),t.icon.placedSymbolArray.get(j.placedIconSymbolIndex).hidden=W.icon.isHidden()),j.verticalPlacedIconSymbolIndex>=0&&(G(t.icon,j.numVerticalIconVertices,ke?vi:Re),t.icon.placedSymbolArray.get(j.verticalPlacedIconSymbolIndex).hidden=W.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Re=t.collisionArrays[V];if(Re){let ke=new c.Point(0,0);if(Re.textBox||Re.verticalTextBox){let ft=!0;if(y){const Ct=this.variableOffsets[ge];Ct?(ke=Et(Ct.anchor,Ct.width,Ct.height,Ct.textOffset,Ct.textBoxScale),w&&ke._rotate(C?this.transform.angle:-this.transform.angle)):ft=!1}Re.textBox&&bt(t.textCollisionBox.collisionVertexArray,W.text.placed,!ft||Ae,ke.x,ke.y),Re.verticalTextBox&&bt(t.textCollisionBox.collisionVertexArray,W.text.placed,!ft||Le,ke.x,ke.y)}const Qe=!!(!Le&&Re.verticalIconBox);Re.iconBox&&bt(t.iconCollisionBox.collisionVertexArray,W.icon.placed,Qe,I?ke.x:0,I?ke.y:0),Re.verticalIconBox&&bt(t.iconCollisionBox.collisionVertexArray,W.icon.placed,!Qe,I?ke.x:0,I?ke.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const V=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=V.invProjMatrix,t.placementViewportMatrix=V.viewportMatrix,t.collisionCircleArray=V.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function bt(a,t,n,s,u){a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const Vt=Math.pow(2,25),Lt=Math.pow(2,24),jt=Math.pow(2,17),ti=Math.pow(2,16),zi=Math.pow(2,9),ot=Math.pow(2,8),yi=Math.pow(2,1);function ao(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;const t=a.placed?1:0,n=Math.floor(127*a.opacity);return n*Vt+t*Lt+n*jt+t*ti+n*zi+t*ot+n*yi+t}const vi=0;class Li{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,u,p){const g=this._bucketParts;for(;this._currentTileIndexv.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&c.exported.now()-u>2;for(;this._currentPlacementIndex>=0;){const g=n[t[this._currentPlacementIndex]],v=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=v)&&(!g.maxzoom||g.maxzoom>v)){if(this._inProgressLayer||(this._inProgressLayer=new Li(g)),this._inProgressLayer.continuePlacement(s[g.source],this.placement,this._showCollisionBoxes,g,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const en=512/c.EXTENT/2;class Ln{constructor(t,n,s){this.tileID=t,this.bucketInstanceId=s,this._symbolsByKey={};const u=new Map;for(let p=0;p({x:Math.floor(y.anchorX*en),y:Math.floor(y.anchorY*en)})),crossTileIDs:g.map(y=>y.crossTileID)};if(v.positions.length>128){const y=new c.KDBush(v.positions.length,16,Uint16Array);for(const{x:w,y:C}of v.positions)y.add(w,C);y.finish(),delete v.positions,v.index=y}this._symbolsByKey[p]=v}}getScaledCoordinates(t,n){const{x:s,y:u,z:p}=this.tileID.canonical,{x:g,y:v,z:y}=n.canonical,w=en/Math.pow(2,y-p),C=(v*c.EXTENT+t.anchorY)*w,I=u*c.EXTENT*en;return{x:Math.floor((g*c.EXTENT+t.anchorX)*w-s*c.EXTENT*en),y:Math.floor(C-I)}}findMatches(t,n,s){const u=this.tileID.canonical.zt)}}class Fi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ss{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],p={};for(const g in u){const v=u[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+n),p[v.tileID.key]=v}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;pt.overscaledZ)for(const v in g){const y=g[v];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const v=g[t.scaledTo(Number(p)).key];v&&v.findMatches(n.symbolInstances,t,u)}}for(let p=0;p{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}const Bi=(a,t)=>c.emitValidationErrors(a,t&&t.filter(n=>n.identifier!=="source.canvas")),as=c.pick(c.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),kr=c.pick(c.operations,["setCenter","setZoom","setBearing","setPitch"]),ba=c.emptyStyle();class er extends c.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Si(Zn(),this,t._getMapId()),this.imageManager=new pi,this.imageManager.setEventedParent(this),this.glyphManager=new fn(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Mr(256,512),this.crossTileSymbolIndex=new lo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.getReferrer());const s=this;this._rtlTextPluginCallback=er.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(p,g)=>{if(c.triggerPluginCompletionEvent(p),g&&g.every(v=>v))for(const v in s.sourceCaches){const y=s.sourceCaches[v].getSource().type;y!=="vector"&&y!=="geojson"||s.sourceCaches[v].reload()}})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const p=this.sourceCaches[u.sourceId];if(!p)return;const g=p.getSource();if(g&&g.vectorLayerIds)for(const v in this._layers){const y=this._layers[v];y.source===g.id&&this._validateLayer(y)}})}loadURL(t,n={},s){this.fire(new c.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const u=this.map._requestManager.transformRequest(t,et.Style);this._request=c.getJSON(u,(p,g)=>{this._request=null,p?this.fire(new c.ErrorEvent(p)):g&&this._load(g,n,s)})}loadJSON(t,n={},s){this.fire(new c.Event("dataloading",{dataType:"style"})),this._request=c.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,s)})}loadEmpty(){this.fire(new c.Event("dataloading",{dataType:"style"})),this._load(ba,{validate:!1})}_load(t,n,s){const u=n.transformStyle?n.transformStyle(s,t):t;if(!n.validate||!Bi(this,c.validateStyle(u))){this._loaded=!0,this.stylesheet=u;for(const p in u.sources)this.addSource(p,u.sources[p],{validate:!1});u.sprite?this._loadSprite(u.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(u.glyphs),this._createLayers(),this.light=new qi(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new c.Event("data",{dataType:"style"})),this.fire(new c.Event("style.load"))}}_createLayers(){const t=c.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const s=c.createStyleLayer(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(t,n=!1,s=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(u,p,g,v){const y=Ei(u),w=y.length,C=g>1?"@2x":"",I={},F={},G={};for(const{id:V,url:j}of y){const K=p.transformRequest(p.normalizeSpriteURL(j,C,".json"),et.SpriteJSON),re=`${V}_${K.url}`;I[re]=c.getJSON(K,(pe,ve)=>{delete I[re],F[V]=ve,di(v,F,G,pe,w)});const ge=p.transformRequest(p.normalizeSpriteURL(j,C,".png"),et.SpriteImage),W=`${V}_${ge.url}`;I[W]=yt.getImage(ge,(pe,ve)=>{delete I[W],G[V]=ve,di(v,F,G,pe,w)})}return{cancel(){for(const V of Object.values(I))V.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(u,p)=>{if(this._spriteRequest=null,u)this.fire(new c.ErrorEvent(u));else if(p)for(const g in p){this._spritesImagesIds[g]=[];const v=this._spritesImagesIds[g]?this._spritesImagesIds[g].filter(y=>!(y in p)):[];for(const y of v)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in p[g]){const w=g==="default"?y:`${g}:${y}`;this._spritesImagesIds[g].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,p[g][y],!1):this.imageManager.addImage(w,p[g][y]),n&&(this._changedImages[w]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"})),s&&s(u)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new c.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const s=[];for(const u of t)n[u]&&s.push(n[u]);return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const s of n){const u=this._layers[s];u.type!=="custom"&&(t[s]=u.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const u=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(u.length||p.length)&&this._updateWorkerLayers(u,p);for(const g in this._updatedSources){const v=this._updatedSources[g];if(v==="reload")this._reloadSource(g);else{if(v!=="clear")throw new Error(`Invalid action ${v}`);this._clearSource(g)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const p=this.sourceCaches[u];s[u]=p.used,p.used=!1}for(const u of this._order){const p=this._layers[u];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const u in s){const p=this.sourceCaches[u];s[u]!==p.used&&p.fire(new c.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new c.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const s=this.serialize();if(t=n.transformStyle?n.transformStyle(s,t):t,Bi(this,c.validateStyle(t)))return!1;(t=c.clone$1(t)).layers=c.derefLayers(t.layers);const u=c.diffStyles(s,t).filter(g=>!(g.command in kr));if(u.length===0)return!1;const p=u.filter(g=>!(g.command in as));if(p.length>0)throw new Error(`Unimplemented: ${p.map(g=>g.command).join(", ")}.`);for(const g of u)g.command!=="setTransition"&&this[g.command].apply(this,g.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new Ri(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:u.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new c.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new c.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let p;if(t.type==="custom"){if(Bi(this,c.validateCustomStyleLayer(t)))return;p=c.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=c.clone$1(t),t=c.extend(t,{source:u})),this._validate(c.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;p=c.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:u}})}const g=n?this._order.indexOf(n):this._order.length;if(n&&g===-1)this.fire(new c.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(g,0,u),this._layerOrderChanged=!0,this._layers[u]=p,this._removedLayers[u]&&p.source&&p.type!=="custom"){const v=this._removedLayers[u];delete this._removedLayers[u],v.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new c.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new c.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!c.deepEqual(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(c.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=c.clone$1(n),this._updateLayer(u)))}else this.fire(new c.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?c.deepEqual(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new c.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?c.deepEqual(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const g=p.getSource().type;g==="geojson"&&u?this.fire(new c.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):g!=="vector"||u?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,t.id,n)):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const p=u.getSource().type,g=p==="vector"?t.sourceLayer:void 0;p!=="vector"||g?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(g,t.id,n):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t=c.mapObject(this.sourceCaches,u=>u.serialize()),n=this._serializeByIds(this._order),s=this.stylesheet;return c.filterObject({version:s.version,name:s.name,metadata:s.metadata,light:s.light,center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,sprite:s.sprite,glyphs:s.glyphs,transition:s.transition,sources:t,layers:n},u=>u!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=g=>this._layers[g].type==="fill-extrusion",s={},u=[];for(let g=this._order.length-1;g>=0;g--){const v=this._order[g];if(n(v)){s[v]=g;for(const y of t){const w=y[v];if(w)for(const C of w)u.push(C)}}}u.sort((g,v)=>v.intersectionZ-g.intersectionZ);const p=[];for(let g=this._order.length-1;g>=0;g--){const v=this._order[g];if(n(v))for(let y=u.length-1;y>=0;y--){const w=u[y].feature;if(s[w.layer.id]{const Re=re.featureSortOrder;if(Re){const ke=Re.indexOf(Ae.featureIndex);return Re.indexOf(Le.featureIndex)-ke}return Le.featureIndex-Ae.featureIndex});for(const Ae of ve)pe.push(Ae)}}for(const re in V)V[re].forEach(ge=>{const W=ge.feature,pe=w[v[re].source].getFeatureState(W.layer["source-layer"],W.id);W.source=W.layer.source,W.layer["source-layer"]&&(W.sourceLayer=W.layer["source-layer"]),W.state=pe});return V}(this._layers,g,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,p){const g=u.getRenderableIds().map(w=>u.getTileByID(w)),v=[],y={};for(let w=0;wF.getTileByID(G)).sort((G,V)=>V.tileID.overscaledZ-G.tileID.overscaledZ||(G.tileID.isLessThan(V.tileID)?-1:1))}const I=this.crossTileSymbolIndex.addLayer(C,y[C.source],t.center.lng);g=g||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.exported.now(),t.zoom))&&(this.pauseablePlacement=new Sr(t,this.map.terrain,this._order,p,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c.exported.now()),v=!0),g&&this.pauseablePlacement.placement.setStale()),v||g)for(const w of this._order){const C=this._layers[w];C.type==="symbol"&&this.placement.updateLayerOpacities(C,y[C.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s);const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,s){return c.makeRequest(n,s)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,s={},u){this._checkLoaded();const p=[{id:t,url:n}],g=[...Ei(this.stylesheet.sprite),...p];this._validate(c.validateStyle.sprite,"sprite",g,null,s)||(this.stylesheet.sprite=g,this._loadSprite(p,!0,u))}removeSprite(t){this._checkLoaded();const n=Ei(this.stylesheet.sprite);if(n.find(s=>s.id===t)){if(this._spritesImagesIds[t])for(const s of this._spritesImagesIds[t])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}else this.fire(new c.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Ei(this.stylesheet.sprite)}setSprite(t,n={},s){this._checkLoaded(),t&&this._validate(c.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,s):(this._unloadSprite(),s&&s(null)))}}er.getSourceType=function(a){return qn[a]},er.setSourceType=function(a,t){qn[a]=t},er.registerForPluginStateChange=c.registerForPluginStateChange;var Hs=c.createLayout([{name:"a_pos",type:"Int16",components:2}]),As="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const co={prelude:$t(`#ifdef GL_ES precision mediump float; diff --git a/assets/main-c3ebdbba.js b/assets/main-b760fa4d.js similarity index 98% rename from assets/main-c3ebdbba.js rename to assets/main-b760fa4d.js index 64522bb2..f8279a7c 100644 --- a/assets/main-c3ebdbba.js +++ b/assets/main-b760fa4d.js @@ -1,4 +1,4 @@ -import{S as M,i as P,s as T,c as Y,e as g,a as O,b as $,u as x,g as ee,d as te,t as b,f as k,h as _,L as F,j as H,k as q,l as U,m as v,n as y,o as L,p as K,q as C,r as S,v as Q,w as D,x as ne,y as E,z as w,A as J,B as I,C as V,D as W,E as N,F as Z,G as X,H as se,I as re,J as oe,K as le,M as ie,N as ae,O as pe,P as ue,Q as fe,R as ce,T as me,U as de,V as $e}from"./MainLayers-fe4bfc4b.js";function _e(l){let e,r;const t=l[1].default,s=Y(t,l,l[0],null);return{c(){e=g("div"),s&&s.c(),O(e,"class","svelte-eycl9h")},m(n,i){$(n,e,i),s&&s.m(e,null),r=!0},p(n,[i]){s&&s.p&&(!r||i&1)&&x(s,t,n,n[0],r?te(t,n[0],i,null):ee(n[0]),null)},i(n){r||(b(s,n),r=!0)},o(n){k(s,n),r=!1},d(n){n&&_(e),s&&s.d(n)}}}function ge(l,e,r){let{$$slots:t={},$$scope:s}=e;return l.$$set=n=>{"$$scope"in n&&r(0,s=n.$$scope)},[s,t]}class we extends M{constructor(e){super(),P(this,e,ge,_e,T,{})}}function he(l){let e,r,t,s,n;e=new F({props:{source:"connected-roads",gj:l[0],layerStyle:l[2],show:l[1]}});function i(a){l[5](a)}let o={gj:l[0],name:"Roads connected to intersection",downloadable:!1};return l[1]!==void 0&&(o.show=l[1]),t=new H({props:o}),q.push(()=>U(t,"show",i)),{c(){v(e.$$.fragment),r=y(),v(t.$$.fragment)},m(a,p){L(e,a,p),$(a,r,p),L(t,a,p),n=!0},p(a,[p]){const m={};p&1&&(m.gj=a[0]),p&2&&(m.show=a[1]),e.$set(m);const c={};p&1&&(c.gj=a[0]),!s&&p&2&&(s=!0,c.show=a[1],K(()=>s=!1)),t.$set(c)},i(a){n||(b(e.$$.fragment,a),b(t.$$.fragment,a),n=!0)},o(a){k(e.$$.fragment,a),k(t.$$.fragment,a),n=!1},d(a){a&&_(r),C(e,a),C(t,a)}}}function ye(l,e,r){let t,s;S(l,Q,p=>r(3,t=p)),S(l,D,p=>r(4,s=p));let n,i=!0,o={type:"fill",paint:{"fill-color":"blue","fill-opacity":.5}};function a(p){i=p,r(1,i)}return l.$$.update=()=>{l.$$.dirty&24&&(s&&t?r(0,n=JSON.parse(s.debugRoadsConnectedToIntersectionGeojson(t.properties.id))):r(0,n=void 0))},[n,i,o,t,s,a]}class be extends M{constructor(e){super(),P(this,e,ye,he,T,{})}}function ke(l){let e,r,t,s,n;e=new F({props:{source:"movements",gj:l[0],layerStyle:l[2],show:l[1]}});function i(a){l[5](a)}let o={gj:l[0],name:"Movement arrows",downloadable:!1};return l[1]!==void 0&&(o.show=l[1]),t=new H({props:o}),q.push(()=>U(t,"show",i)),{c(){v(e.$$.fragment),r=y(),v(t.$$.fragment)},m(a,p){L(e,a,p),$(a,r,p),L(t,a,p),n=!0},p(a,[p]){const m={};p&1&&(m.gj=a[0]),p&2&&(m.show=a[1]),e.$set(m);const c={};p&1&&(c.gj=a[0]),!s&&p&2&&(s=!0,c.show=a[1],K(()=>s=!1)),t.$set(c)},i(a){n||(b(e.$$.fragment,a),b(t.$$.fragment,a),n=!0)},o(a){k(e.$$.fragment,a),k(t.$$.fragment,a),n=!1},d(a){a&&_(r),C(e,a),C(t,a)}}}function ve(l,e,r){let t,s;S(l,D,p=>r(3,t=p)),S(l,ne,p=>r(4,s=p));let n,i=!0,o={type:"fill",paint:{"fill-color":"blue","fill-opacity":.5}};function a(p){i=p,r(1,i)}return l.$$.update=()=>{if(l.$$.dirty&24)if(t&&s){let p=s.properties;r(0,n=JSON.parse(t.debugMovementsFromLaneGeojson(p.road,p.index)))}else r(0,n=void 0)},[n,i,o,t,s,a]}class Le extends M{constructor(e){super(),P(this,e,ve,ke,T,{})}}function Ce(l){let e,r,t,s,n,i;return{c(){e=g("div"),r=g("label"),t=g("input"),s=E(` +import{S as M,i as P,s as T,c as Y,e as g,a as O,b as $,u as x,g as ee,d as te,t as b,f as k,h as _,L as F,j as H,k as q,l as U,m as v,n as y,o as L,p as K,q as C,r as S,v as Q,w as D,x as ne,y as E,z as w,A as J,B as I,C as V,D as W,E as N,F as Z,G as X,H as se,I as re,J as oe,K as le,M as ie,N as ae,O as pe,P as ue,Q as fe,R as ce,T as me,U as de,V as $e}from"./MainLayers-86931c4d.js";function _e(l){let e,r;const t=l[1].default,s=Y(t,l,l[0],null);return{c(){e=g("div"),s&&s.c(),O(e,"class","svelte-eycl9h")},m(n,i){$(n,e,i),s&&s.m(e,null),r=!0},p(n,[i]){s&&s.p&&(!r||i&1)&&x(s,t,n,n[0],r?te(t,n[0],i,null):ee(n[0]),null)},i(n){r||(b(s,n),r=!0)},o(n){k(s,n),r=!1},d(n){n&&_(e),s&&s.d(n)}}}function ge(l,e,r){let{$$slots:t={},$$scope:s}=e;return l.$$set=n=>{"$$scope"in n&&r(0,s=n.$$scope)},[s,t]}class we extends M{constructor(e){super(),P(this,e,ge,_e,T,{})}}function he(l){let e,r,t,s,n;e=new F({props:{source:"connected-roads",gj:l[0],layerStyle:l[2],show:l[1]}});function i(a){l[5](a)}let o={gj:l[0],name:"Roads connected to intersection",downloadable:!1};return l[1]!==void 0&&(o.show=l[1]),t=new H({props:o}),q.push(()=>U(t,"show",i)),{c(){v(e.$$.fragment),r=y(),v(t.$$.fragment)},m(a,p){L(e,a,p),$(a,r,p),L(t,a,p),n=!0},p(a,[p]){const m={};p&1&&(m.gj=a[0]),p&2&&(m.show=a[1]),e.$set(m);const c={};p&1&&(c.gj=a[0]),!s&&p&2&&(s=!0,c.show=a[1],K(()=>s=!1)),t.$set(c)},i(a){n||(b(e.$$.fragment,a),b(t.$$.fragment,a),n=!0)},o(a){k(e.$$.fragment,a),k(t.$$.fragment,a),n=!1},d(a){a&&_(r),C(e,a),C(t,a)}}}function ye(l,e,r){let t,s;S(l,Q,p=>r(3,t=p)),S(l,D,p=>r(4,s=p));let n,i=!0,o={type:"fill",paint:{"fill-color":"blue","fill-opacity":.5}};function a(p){i=p,r(1,i)}return l.$$.update=()=>{l.$$.dirty&24&&(s&&t?r(0,n=JSON.parse(s.debugRoadsConnectedToIntersectionGeojson(t.properties.id))):r(0,n=void 0))},[n,i,o,t,s,a]}class be extends M{constructor(e){super(),P(this,e,ye,he,T,{})}}function ke(l){let e,r,t,s,n;e=new F({props:{source:"movements",gj:l[0],layerStyle:l[2],show:l[1]}});function i(a){l[5](a)}let o={gj:l[0],name:"Movement arrows",downloadable:!1};return l[1]!==void 0&&(o.show=l[1]),t=new H({props:o}),q.push(()=>U(t,"show",i)),{c(){v(e.$$.fragment),r=y(),v(t.$$.fragment)},m(a,p){L(e,a,p),$(a,r,p),L(t,a,p),n=!0},p(a,[p]){const m={};p&1&&(m.gj=a[0]),p&2&&(m.show=a[1]),e.$set(m);const c={};p&1&&(c.gj=a[0]),!s&&p&2&&(s=!0,c.show=a[1],K(()=>s=!1)),t.$set(c)},i(a){n||(b(e.$$.fragment,a),b(t.$$.fragment,a),n=!0)},o(a){k(e.$$.fragment,a),k(t.$$.fragment,a),n=!1},d(a){a&&_(r),C(e,a),C(t,a)}}}function ve(l,e,r){let t,s;S(l,D,p=>r(3,t=p)),S(l,ne,p=>r(4,s=p));let n,i=!0,o={type:"fill",paint:{"fill-color":"blue","fill-opacity":.5}};function a(p){i=p,r(1,i)}return l.$$.update=()=>{if(l.$$.dirty&24)if(t&&s){let p=s.properties;r(0,n=JSON.parse(t.debugMovementsFromLaneGeojson(p.road,p.index)))}else r(0,n=void 0)},[n,i,o,t,s,a]}class Le extends M{constructor(e){super(),P(this,e,ve,ke,T,{})}}function Ce(l){let e,r,t,s,n,i;return{c(){e=g("div"),r=g("label"),t=g("input"),s=E(` Clockwise ordering of roads`),O(t,"type","checkbox")},m(o,a){$(o,e,a),w(e,r),w(r,t),t.checked=l[0],w(r,s),n||(i=J(t,"change",l[5]),n=!0)},p(o,[a]){a&1&&(t.checked=o[0])},i:I,o:I,d(o){o&&_(e),n=!1,i()}}}function Se(l,e,r){let t,s,n;S(l,V,p=>r(2,t=p)),S(l,Q,p=>r(3,s=p)),S(l,D,p=>r(4,n=p));let i=[],o=!1;function a(){o=this.checked,r(0,o)}return l.$$.update=()=>{if(l.$$.dirty&31){for(let p of i)p.remove();if(r(1,i=[]),o&&s){let p=JSON.parse(n.debugClockwiseOrderingForIntersectionGeojson(s.properties.id));for(let m of p.features)i.push(new W.Popup({closeButton:!1,closeOnClick:!1,focusAfterOpen:!1}).setLngLat(m.geometry.coordinates).setHTML(m.properties.label).addTo(t))}}},[o,i,t,s,n,a]}class Oe extends M{constructor(e){super(),P(this,e,Se,Ce,T,{})}}function je(l){let e,r,t,s,n,i;return e=new Le({}),t=new Oe({}),n=new be({}),{c(){v(e.$$.fragment),r=y(),v(t.$$.fragment),s=y(),v(n.$$.fragment)},m(o,a){L(e,o,a),$(o,r,a),L(t,o,a),$(o,s,a),L(n,o,a),i=!0},p:I,i(o){i||(b(e.$$.fragment,o),b(t.$$.fragment,o),b(n.$$.fragment,o),i=!0)},o(o){k(e.$$.fragment,o),k(t.$$.fragment,o),k(n.$$.fragment,o),i=!1},d(o){o&&(_(r),_(s)),C(e,o),C(t,o),C(n,o)}}}class Ie extends M{constructor(e){super(),P(this,e,null,je,T,{})}}function A(l,e,r){const t=l.slice();return t[4]=e[r],t}function G(l){let e,r=l[4]+"",t,s,n;return{c(){e=g("a"),t=E(r),n=E(","),O(e,"href",s="https://www.openstreetmap.org/node/"+l[4]),O(e,"target","_blank")},m(i,o){$(i,e,o),w(e,t),$(i,n,o)},p(i,o){o&1&&r!==(r=i[4]+"")&&X(t,r),o&1&&s!==(s="https://www.openstreetmap.org/node/"+i[4])&&O(e,"href",s)},d(i){i&&(_(e),_(n))}}}function Me(l){let e,r,t,s,n,i,o,a,p,m=N(l[0].properties.osm_node_ids),c=[];for(let f=0;fr(3,t=o));let{intersection:s}=e,n=structuredClone(s.properties);delete n.osm_node_ids;function i(){t.collapseIntersection(s.properties.id),D.set(t)}return l.$$set=o=>{"intersection"in o&&r(0,s=o.intersection)},[s,n,i]}class Te extends M{constructor(e){super(),P(this,e,Pe,Me,T,{intersection:0})}}function B(l,e,r){const t=l.slice();return t[5]=e[r],t}function z(l){let e,r=l[5]+"",t,s,n;return{c(){e=g("a"),t=E(r),n=E(","),O(e,"href",s="https://www.openstreetmap.org/way/"+l[5]),O(e,"target","_blank")},m(i,o){$(i,e,o),w(e,t),$(i,n,o)},p(i,o){o&1&&r!==(r=i[5]+"")&&X(t,r),o&1&&s!==(s="https://www.openstreetmap.org/way/"+i[5])&&O(e,"href",s)},d(i){i&&(_(e),_(n))}}}function De(l){let e,r,t,s,n,i,o,a,p,m,c,f=N(l[0].properties.osm_way_ids),d=[];for(let u=0;ur(4,t=a));let{lane:s}=e,n=structuredClone(s.properties);delete n.osm_way_ids;function i(){t.collapseShortRoad(s.properties.road),D.set(t)}function o(){t.zipSidepath(s.properties.road),D.set(t)}return l.$$set=a=>{"lane"in a&&r(0,s=a.lane)},[s,n,i,o]}class Je extends M{constructor(e){super(),P(this,e,Ee,De,T,{lane:0})}}function Ne(l,e,r){let t,s,n,i,o;S(l,V,p=>r(0,t=p)),S(l,oe,p=>r(1,s=p)),S(l,le,p=>r(2,n=p)),S(l,ie,p=>r(3,i=p)),S(l,ae,p=>r(4,o=p));let a=new W.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none"});return re(()=>{a.remove()}),l.$$.update=()=>{if(l.$$.dirty&31)if(o){let p=document.createElement("div");new Je({target:p,props:{lane:o}}),a.setLngLat(i).setDOMContent(p).addTo(t)}else if(n){let p=document.createElement("div");new Te({target:p,props:{intersection:n}}),a.setLngLat(s).setDOMContent(p).addTo(t)}else a.remove()},[t,s,n,i,o]}class Re extends M{constructor(e){super(),P(this,e,Ne,null,T,{})}}function Ae(l){let e,r,t,s,n,i,o,a,p,m,c;return s=new fe({}),m=new ce({}),{c(){e=g("div"),r=g("h1"),r.textContent="osm2streets Street Explorer",t=y(),v(s.$$.fragment),n=y(),i=g("p"),i.innerHTML=`Understanding OSM streets & intersections with diff --git a/assets/nested-5844dc17.js b/assets/nested-eefdc3fb.js similarity index 99% rename from assets/nested-5844dc17.js rename to assets/nested-eefdc3fb.js index 56993d41..c7ca118b 100644 --- a/assets/nested-5844dc17.js +++ b/assets/nested-eefdc3fb.js @@ -1,4 +1,4 @@ -import{S as q,i as z,s as j,e as g,y as N,n as k,a as W,b as $,z as m,A as D,G as X,B as S,h,r as B,w as F,W as Z,E as G,X as K,H as P,Y as x,Z as I,_ as ee,m as C,$ as Q,o as O,a0 as U,f as w,a1 as V,t as b,q as T,k as te,L as ne,N as le,O as se,P as re,Q as ae,R as oe,T as ie,U as ue,V as fe,a2 as ce}from"./MainLayers-fe4bfc4b.js";function pe(i){let e,t=i[0].size+"",n,l,a,r,u,d;return{c(){e=g("div"),n=N(t),l=N(" ways edited"),a=k(),r=g("button"),r.textContent="Download .osc",W(r,"type","button")},m(_,p){$(_,e,p),m(e,n),m(e,l),$(_,a,p),$(_,r,p),u||(d=D(r,"click",i[1]),u=!0)},p(_,[p]){p&1&&t!==(t=_[0].size+"")&&X(n,t)},i:S,o:S,d(_){_&&(h(e),h(a),h(r)),u=!1,d()}}}function de(i,e,t){let n;B(i,F,u=>t(3,n=u));let l=new Set;function a(u){l.add(u.detail),t(0,l)}function r(){let u=` +import{S as q,i as z,s as j,e as g,y as N,n as k,a as W,b as $,z as m,A as D,G as X,B as S,h,r as B,w as F,W as Z,E as G,X as K,H as P,Y as x,Z as I,_ as ee,m as C,$ as Q,o as O,a0 as U,f as w,a1 as V,t as b,q as T,k as te,L as ne,N as le,O as se,P as re,Q as ae,R as oe,T as ie,U as ue,V as fe,a2 as ce}from"./MainLayers-86931c4d.js";function pe(i){let e,t=i[0].size+"",n,l,a,r,u,d;return{c(){e=g("div"),n=N(t),l=N(" ways edited"),a=k(),r=g("button"),r.textContent="Download .osc",W(r,"type","button")},m(_,p){$(_,e,p),m(e,n),m(e,l),$(_,a,p),$(_,r,p),u||(d=D(r,"click",i[1]),u=!0)},p(_,[p]){p&1&&t!==(t=_[0].size+"")&&X(n,t)},i:S,o:S,d(_){_&&(h(e),h(a),h(r)),u=!1,d()}}}function de(i,e,t){let n;B(i,F,u=>t(3,n=u));let l=new Set;function a(u){l.add(u.detail),t(0,l)}function r(){let u=` `;u+=` `,u+=` `;for(let d of l)u+=n.wayToXml(d),u+=` diff --git a/assets/osm2streets_js_bg.wasm b/assets/osm2streets_js_bg.wasm index 34113dcf..f2355271 100644 Binary files a/assets/osm2streets_js_bg.wasm and b/assets/osm2streets_js_bg.wasm differ diff --git a/index.html b/index.html index 830b941c..4f2072a8 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@ StreetExplorer - - + + diff --git a/lane_editor.html b/lane_editor.html index 3172b3d4..18071773 100644 --- a/lane_editor.html +++ b/lane_editor.html @@ -4,8 +4,8 @@ osm2streets lane editor - - + +