diff --git a/assets/MainLayers-057e9a81.js b/assets/MainLayers-fe4bfc4b.js similarity index 99% rename from assets/MainLayers-057e9a81.js rename to assets/MainLayers-fe4bfc4b.js index c2cc2dfc..9fe64b60 100644 --- a/assets/MainLayers-057e9a81.js +++ b/assets/MainLayers-fe4bfc4b.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;c<le;c+=1)J[c]=b.dirty[c]|U[c];return J}return b.dirty|U}return b.dirty}function zu(E,b,M,k,U,J){if(U){const le=Ud(b,M,k,J);E.p(le,U)}}function Lu(E){if(E.ctx.length>32){const b=[],M=E.ctx.length/32;for(let k=0;k<M;k++)b[k]=-1;return b}return-1}const Nf=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function Ft(E,b){E.appendChild(b)}function ki(E,b,M){E.insertBefore(b,M||null)}function Ti(E){E.parentNode&&E.parentNode.removeChild(E)}function Vf(E,b){for(let M=0;M<E.length;M+=1)E[M]&&E[M].d(b)}function Wt(E){return document.createElement(E)}function Cn(E){return document.createTextNode(E)}function sr(){return Cn(" ")}function ig(){return Cn("")}function hn(E,b,M,k){return E.addEventListener(b,M,k),()=>E.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<E.options.length;k+=1){const U=E.options[k];if(U.__value===b){U.selected=!0;return}}(!M||b!==void 0)&&(E.selectedIndex=-1)}function Nd(E){const b=E.querySelector(":checked");return b&&b.__value}function Gf(E,b,{bubbles:M=!1,cancelable:k=!1}={}){return new CustomEvent(E,{detail:b,bubbles:M,cancelable:k})}let Xl;function ql(E){Xl=E}function qu(){if(!Xl)throw new Error("Function called outside component initialization");return Xl}function Zu(E){qu().$$.on_mount.push(E)}function Xu(E){qu().$$.on_destroy.push(E)}function Vd(){const E=qu();return(b,M,{cancelable:k=!1}={})=>{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(;Ya<tl.length;){const b=tl[Ya];Ya++,ql(b),Xf(b.$$)}}catch(b){throw tl.length=0,Ya=0,b}for(ql(null),tl.length=0,Ya=0;Jr.length;)Jr.pop()();for(let b=0;b<rl.length;b+=1){const M=rl[b];Cu.has(M)||(Cu.add(M),M())}rl.length=0}while(tl.length);for(;Du.length;)Du.pop()();Ru=!1,Cu.clear(),ql(E)}function Xf(E){if(E.fragment!==null){E.update(),ns(E.before_update);const b=E.dirty;E.dirty=[-1],E.fragment&&E.fragment.p(E.ctx,b),E.after_update.forEach(Wl)}}function Wf(E){const b=[],M=[];rl.forEach(k=>E.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<<b%31}function An(E,b,M,k,U,J,le,c=[-1]){const ae=Xl;ql(E);const O=E.$$={fragment:null,ctx:[],props:J,update:pr,not_equal:U,bound:Id(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(b.context||(ae?ae.$$.context:[])),callbacks:Id(),dirty:c,skip_bound:!1,root:b.target||ae.$$.root};le&&le(O.root);let Me=!1;if(O.ctx=M?M(E,b.props||{},(me,Be,...dt)=>{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(;le<k;le++){const c=E.charCodeAt(le);if(c>127)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;le<U;le++)J+=", "+Fu(E[le]);return J+="]",J}const M=/\[object ([^\]]+)\]/.exec(toString.call(E));let k;if(M.length>1)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<k.length;J++)U.push(zc(k[J]));return U}function Qa(E,b){try{return E.apply(this,b)}catch(M){Ne.__wbindgen_exn_store(Ir(M))}}class Wu{static __wrap(b){const M=Object.create(Wu.prototype);return M.ptr=b,M}__destroy_into_raw(){const b=this.ptr;return this.ptr=0,b}free(){const b=this.__destroy_into_raw();Ne.__wbg_jsdebugstreets_free(b)}getLabel(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsdebugstreets_getLabel(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}getNetwork(){const b=Ne.jsdebugstreets_getNetwork(this.ptr);return zc(b)}toDebugGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsdebugstreets_toDebugGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];let U;return b!==0&&(U=Tr(b,M).slice(),Ne.__wbindgen_free(b,M*1)),U}finally{Ne.__wbindgen_add_to_stack_pointer(16)}}}class Hl{static __wrap(b){const M=Object.create(Hl.prototype);return M.ptr=b,M}__destroy_into_raw(){const b=this.ptr;return this.ptr=0,b}free(){const b=this.__destroy_into_raw();Ne.__wbg_jsstreetnetwork_free(b)}constructor(b,M,k){try{const c=Ne.__wbindgen_add_to_stack_pointer(-16),ae=nl(b,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),O=Ws,Me=nl(M,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),me=Ws;Ne.jsstreetnetwork_new(c,ae,O,Me,me,Ir(k));var U=Nt()[c/4+0],J=Nt()[c/4+1],le=Nt()[c/4+2];if(le)throw zc(J);return Hl.__wrap(U)}finally{Ne.__wbindgen_add_to_stack_pointer(16)}}toGeojsonPlain(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toGeojsonPlain(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toLanePolygonsGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toLanePolygonsGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toLaneMarkingsGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toLaneMarkingsGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toIntersectionMarkingsGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toIntersectionMarkingsGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toGraphviz(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toGraphviz(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}getDebugSteps(){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_getDebugSteps(U,this.ptr);var b=Nt()[U/4+0],M=Nt()[U/4+1],k=rm(b,M).slice();return Ne.__wbindgen_free(b,M*4),k}finally{Ne.__wbindgen_add_to_stack_pointer(16)}}debugClockwiseOrderingGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugClockwiseOrderingGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}debugClockwiseOrderingForIntersectionGeojson(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugClockwiseOrderingForIntersectionGeojson(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}debugMovementsFromLaneGeojson(b,M){try{const J=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugMovementsFromLaneGeojson(J,this.ptr,b,M);var k=Nt()[J/4+0],U=Nt()[J/4+1];return Tr(k,U)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(k,U)}}debugRoadsConnectedToIntersectionGeojson(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugRoadsConnectedToIntersectionGeojson(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}getOsmTagsForWay(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_getOsmTagsForWay(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}toJson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toJson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}getGeometryForWay(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_getGeometryForWay(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}wayToXml(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_wayToXml(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}overwriteOsmTagsForWay(b,M){const k=nl(M,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),U=Ws;Ne.jsstreetnetwork_overwriteOsmTagsForWay(this.ptr,b,k,U)}collapseShortRoad(b){Ne.jsstreetnetwork_collapseShortRoad(this.ptr,b)}collapseIntersection(b){Ne.jsstreetnetwork_collapseIntersection(this.ptr,b)}zipSidepath(b){Ne.jsstreetnetwork_zipSidepath(this.ptr,b)}}async function nm(E,b){if(typeof Response=="function"&&E instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(E,b)}catch(k){if(E.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",k);else throw k}const M=await E.arrayBuffer();return await WebAssembly.instantiate(M,b)}else{const M=await WebAssembly.instantiate(E,b);return M instanceof WebAssembly.Instance?{instance:M,module:E}:M}}function om(){const E={};return E.wbg={},E.wbg.__wbindgen_string_new=function(b,M){const k=Tr(b,M);return Ir(k)},E.wbg.__wbg_jsstreetnetwork_new=function(b){const M=Hl.__wrap(b);return Ir(M)},E.wbg.__wbindgen_boolean_get=function(b){const M=ci(b);return typeof M=="boolean"?M?1:0:2},E.wbg.__wbindgen_object_drop_ref=function(b){zc(b)},E.wbg.__wbindgen_is_object=function(b){const M=ci(b);return typeof M=="object"&&M!==null},E.wbg.__wbindgen_is_undefined=function(b){return ci(b)===void 0},E.wbg.__wbindgen_in=function(b,M){return ci(b)in ci(M)},E.wbg.__wbg_jsdebugstreets_new=function(b){const M=Wu.__wrap(b);return Ir(M)},E.wbg.__wbindgen_error_new=function(b,M){const k=new Error(Tr(b,M));return Ir(k)},E.wbg.__wbindgen_object_clone_ref=function(b){const M=ci(b);return Ir(M)},E.wbg.__wbindgen_jsval_loose_eq=function(b,M){return ci(b)==ci(M)},E.wbg.__wbindgen_number_get=function(b,M){const k=ci(M),U=typeof k=="number"?k:void 0;em()[b/8+1]=Au(U)?0:U,Nt()[b/4+0]=!Au(U)},E.wbg.__wbindgen_string_get=function(b,M){const k=ci(M),U=typeof k=="string"?k:void 0;var J=Au(U)?0:nl(U,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),le=Ws;Nt()[b/4+1]=le,Nt()[b/4+0]=J},E.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(b,M){const k=ci(b)[ci(M)];return Ir(k)},E.wbg.__wbg_new_abda76e883ba8a5f=function(){const b=new Error;return Ir(b)},E.wbg.__wbg_stack_658279fe44541cf6=function(b,M){const k=ci(M).stack,U=nl(k,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),J=Ws;Nt()[b/4+1]=J,Nt()[b/4+0]=U},E.wbg.__wbg_error_f851667af71bcfc6=function(b,M){try{console.error(Tr(b,M))}finally{Ne.__wbindgen_free(b,M)}},E.wbg.__wbg_debug_8db2eed1bf6c1e2a=function(b){console.debug(ci(b))},E.wbg.__wbg_error_fe807da27c4a4ced=function(b){console.error(ci(b))},E.wbg.__wbg_info_9e6db45ac337c3b5=function(b){console.info(ci(b))},E.wbg.__wbg_log_7bb108d119bafbc1=function(b){console.log(ci(b))},E.wbg.__wbg_warn_e57696dbb3977030=function(b){console.warn(ci(b))},E.wbg.__wbg_now_c644db5194be8437=function(b){return ci(b).now()},E.wbg.__wbg_newnoargs_2b8b6bd7753c76ba=function(b,M){const k=new Function(Tr(b,M));return Ir(k)},E.wbg.__wbg_get_baf4855f9a986186=function(){return Qa(function(b,M){const k=Reflect.get(ci(b),ci(M));return Ir(k)},arguments)},E.wbg.__wbg_call_95d1ea488d03e4e8=function(){return Qa(function(b,M){const k=ci(b).call(ci(M));return Ir(k)},arguments)},E.wbg.__wbg_self_e7c1f827057f6584=function(){return Qa(function(){const b=self.self;return Ir(b)},arguments)},E.wbg.__wbg_window_a09ec664e14b1b81=function(){return Qa(function(){const b=window.window;return Ir(b)},arguments)},E.wbg.__wbg_globalThis_87cbb8506fecf3a9=function(){return Qa(function(){const b=globalThis.globalThis;return Ir(b)},arguments)},E.wbg.__wbg_global_c85a9259e621f3db=function(){return Qa(function(){const b=global.global;return Ir(b)},arguments)},E.wbg.__wbg_instanceof_ArrayBuffer_a69f02ee4c4f5065=function(b){let M;try{M=ci(b)instanceof ArrayBuffer}catch{M=!1}return M},E.wbg.__wbg_buffer_cf65c07de34b9a08=function(b){const M=ci(b).buffer;return Ir(M)},E.wbg.__wbg_new_537b7341ce90bb31=function(b){const M=new Uint8Array(ci(b));return Ir(M)},E.wbg.__wbg_set_17499e8aa4003ebd=function(b,M,k){ci(b).set(ci(M),k>>>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<k.length;J++)U.push(zc(k[J]));return U}function Qa(E,b){try{return E.apply(this,b)}catch(M){Ne.__wbindgen_exn_store(Ir(M))}}class Wu{static __wrap(b){const M=Object.create(Wu.prototype);return M.ptr=b,M}__destroy_into_raw(){const b=this.ptr;return this.ptr=0,b}free(){const b=this.__destroy_into_raw();Ne.__wbg_jsdebugstreets_free(b)}getLabel(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsdebugstreets_getLabel(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}getNetwork(){const b=Ne.jsdebugstreets_getNetwork(this.ptr);return zc(b)}toDebugGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsdebugstreets_toDebugGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];let U;return b!==0&&(U=Tr(b,M).slice(),Ne.__wbindgen_free(b,M*1)),U}finally{Ne.__wbindgen_add_to_stack_pointer(16)}}}class Hl{static __wrap(b){const M=Object.create(Hl.prototype);return M.ptr=b,M}__destroy_into_raw(){const b=this.ptr;return this.ptr=0,b}free(){const b=this.__destroy_into_raw();Ne.__wbg_jsstreetnetwork_free(b)}constructor(b,M,k){try{const c=Ne.__wbindgen_add_to_stack_pointer(-16),ae=nl(b,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),O=Ws,Me=nl(M,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),me=Ws;Ne.jsstreetnetwork_new(c,ae,O,Me,me,Ir(k));var U=Nt()[c/4+0],J=Nt()[c/4+1],le=Nt()[c/4+2];if(le)throw zc(J);return Hl.__wrap(U)}finally{Ne.__wbindgen_add_to_stack_pointer(16)}}toGeojsonPlain(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toGeojsonPlain(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toLanePolygonsGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toLanePolygonsGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toLaneMarkingsGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toLaneMarkingsGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toIntersectionMarkingsGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toIntersectionMarkingsGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}toGraphviz(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toGraphviz(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}getDebugSteps(){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_getDebugSteps(U,this.ptr);var b=Nt()[U/4+0],M=Nt()[U/4+1],k=rm(b,M).slice();return Ne.__wbindgen_free(b,M*4),k}finally{Ne.__wbindgen_add_to_stack_pointer(16)}}debugClockwiseOrderingGeojson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugClockwiseOrderingGeojson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}debugClockwiseOrderingForIntersectionGeojson(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugClockwiseOrderingForIntersectionGeojson(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}debugMovementsFromLaneGeojson(b,M){try{const J=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugMovementsFromLaneGeojson(J,this.ptr,b,M);var k=Nt()[J/4+0],U=Nt()[J/4+1];return Tr(k,U)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(k,U)}}debugRoadsConnectedToIntersectionGeojson(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_debugRoadsConnectedToIntersectionGeojson(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}getOsmTagsForWay(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_getOsmTagsForWay(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}toJson(){try{const k=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_toJson(k,this.ptr);var b=Nt()[k/4+0],M=Nt()[k/4+1];return Tr(b,M)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(b,M)}}getGeometryForWay(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_getGeometryForWay(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}wayToXml(b){try{const U=Ne.__wbindgen_add_to_stack_pointer(-16);Ne.jsstreetnetwork_wayToXml(U,this.ptr,b);var M=Nt()[U/4+0],k=Nt()[U/4+1];return Tr(M,k)}finally{Ne.__wbindgen_add_to_stack_pointer(16),Ne.__wbindgen_free(M,k)}}overwriteOsmTagsForWay(b,M){const k=nl(M,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),U=Ws;Ne.jsstreetnetwork_overwriteOsmTagsForWay(this.ptr,b,k,U)}collapseShortRoad(b){Ne.jsstreetnetwork_collapseShortRoad(this.ptr,b)}collapseIntersection(b){Ne.jsstreetnetwork_collapseIntersection(this.ptr,b)}zipSidepath(b){Ne.jsstreetnetwork_zipSidepath(this.ptr,b)}}async function nm(E,b){if(typeof Response=="function"&&E instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(E,b)}catch(k){if(E.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",k);else throw k}const M=await E.arrayBuffer();return await WebAssembly.instantiate(M,b)}else{const M=await WebAssembly.instantiate(E,b);return M instanceof WebAssembly.Instance?{instance:M,module:E}:M}}function om(){const E={};return E.wbg={},E.wbg.__wbindgen_string_new=function(b,M){const k=Tr(b,M);return Ir(k)},E.wbg.__wbg_jsstreetnetwork_new=function(b){const M=Hl.__wrap(b);return Ir(M)},E.wbg.__wbindgen_is_object=function(b){const M=ci(b);return typeof M=="object"&&M!==null},E.wbg.__wbindgen_is_undefined=function(b){return ci(b)===void 0},E.wbg.__wbindgen_in=function(b,M){return ci(b)in ci(M)},E.wbg.__wbindgen_object_drop_ref=function(b){zc(b)},E.wbg.__wbindgen_boolean_get=function(b){const M=ci(b);return typeof M=="boolean"?M?1:0:2},E.wbg.__wbg_jsdebugstreets_new=function(b){const M=Wu.__wrap(b);return Ir(M)},E.wbg.__wbindgen_error_new=function(b,M){const k=new Error(Tr(b,M));return Ir(k)},E.wbg.__wbindgen_object_clone_ref=function(b){const M=ci(b);return Ir(M)},E.wbg.__wbindgen_jsval_loose_eq=function(b,M){return ci(b)==ci(M)},E.wbg.__wbindgen_number_get=function(b,M){const k=ci(M),U=typeof k=="number"?k:void 0;em()[b/8+1]=Au(U)?0:U,Nt()[b/4+0]=!Au(U)},E.wbg.__wbindgen_string_get=function(b,M){const k=ci(M),U=typeof k=="string"?k:void 0;var J=Au(U)?0:nl(U,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),le=Ws;Nt()[b/4+1]=le,Nt()[b/4+0]=J},E.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(b,M){const k=ci(b)[ci(M)];return Ir(k)},E.wbg.__wbg_new_abda76e883ba8a5f=function(){const b=new Error;return Ir(b)},E.wbg.__wbg_stack_658279fe44541cf6=function(b,M){const k=ci(M).stack,U=nl(k,Ne.__wbindgen_malloc,Ne.__wbindgen_realloc),J=Ws;Nt()[b/4+1]=J,Nt()[b/4+0]=U},E.wbg.__wbg_error_f851667af71bcfc6=function(b,M){try{console.error(Tr(b,M))}finally{Ne.__wbindgen_free(b,M)}},E.wbg.__wbg_debug_8db2eed1bf6c1e2a=function(b){console.debug(ci(b))},E.wbg.__wbg_error_fe807da27c4a4ced=function(b){console.error(ci(b))},E.wbg.__wbg_info_9e6db45ac337c3b5=function(b){console.info(ci(b))},E.wbg.__wbg_log_7bb108d119bafbc1=function(b){console.log(ci(b))},E.wbg.__wbg_warn_e57696dbb3977030=function(b){console.warn(ci(b))},E.wbg.__wbg_now_c644db5194be8437=function(b){return ci(b).now()},E.wbg.__wbg_newnoargs_2b8b6bd7753c76ba=function(b,M){const k=new Function(Tr(b,M));return Ir(k)},E.wbg.__wbg_get_baf4855f9a986186=function(){return Qa(function(b,M){const k=Reflect.get(ci(b),ci(M));return Ir(k)},arguments)},E.wbg.__wbg_call_95d1ea488d03e4e8=function(){return Qa(function(b,M){const k=ci(b).call(ci(M));return Ir(k)},arguments)},E.wbg.__wbg_self_e7c1f827057f6584=function(){return Qa(function(){const b=self.self;return Ir(b)},arguments)},E.wbg.__wbg_window_a09ec664e14b1b81=function(){return Qa(function(){const b=window.window;return Ir(b)},arguments)},E.wbg.__wbg_globalThis_87cbb8506fecf3a9=function(){return Qa(function(){const b=globalThis.globalThis;return Ir(b)},arguments)},E.wbg.__wbg_global_c85a9259e621f3db=function(){return Qa(function(){const b=global.global;return Ir(b)},arguments)},E.wbg.__wbg_instanceof_ArrayBuffer_a69f02ee4c4f5065=function(b){let M;try{M=ci(b)instanceof ArrayBuffer}catch{M=!1}return M},E.wbg.__wbg_buffer_cf65c07de34b9a08=function(b){const M=ci(b).buffer;return Ir(M)},E.wbg.__wbg_new_537b7341ce90bb31=function(b){const M=new Uint8Array(ci(b));return Ir(M)},E.wbg.__wbg_set_17499e8aa4003ebd=function(b,M,k){ci(b).set(ci(M),k>>>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<el.length;O+=2)el[O][0](el[O+1]);el.length=0}}}function J(c){U(c(E))}function le(c,ae=pr){const O=[c,ae];return k.add(O),k.size===1&&(M=b(U,J)||pr),c(E),()=>{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;et<nt;et++){O=be?E.features[et].geometry:Ie?E.geometry:E,Be=O?O.type==="GeometryCollection":!1,c=Be?O.geometries.length:1;for(var yt=0;yt<c;yt++){var at=0,Pe=0;if(le=Be?O.geometries[yt]:O,le!==null){ae=le.coordinates;var St=le.type;switch(Me=M&&(St==="Polygon"||St==="MultiPolygon")?1:0,St){case null:break;case"Point":if(b(ae,me,et,at,Pe)===!1)return!1;me++,at++;break;case"LineString":case"MultiPoint":for(k=0;k<ae.length;k++){if(b(ae[k],me,et,at,Pe)===!1)return!1;me++,St==="MultiPoint"&&at++}St==="LineString"&&at++;break;case"Polygon":case"MultiLineString":for(k=0;k<ae.length;k++){for(U=0;U<ae[k].length-Me;U++){if(b(ae[k][U],me,et,at,Pe)===!1)return!1;me++}St==="MultiLineString"&&at++,St==="Polygon"&&Pe++}St==="Polygon"&&at++;break;case"MultiPolygon":for(k=0;k<ae.length;k++){for(Pe=0,U=0;U<ae[k].length;U++){for(J=0;J<ae[k][U].length-Me;J++){if(b(ae[k][U][J],me,et,at,Pe)===!1)return!1;me++}Pe++}at++}break;case"GeometryCollection":for(k=0;k<le.geometries.length;k++)if(Gd(le.geometries[k],b,M)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Gu(E){var b=[1/0,1/0,-1/0,-1/0];return Gd(E,function(M){b[0]>M[0]&&(b[0]=M[0]),b[1]>M[1]&&(b[1]=M[1]),b[2]<M[0]&&(b[2]=M[0]),b[3]<M[1]&&(b[3]=M[1])}),b}Gu.default=Gu;function qd(E,b){var M=document.createElement("a");M.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(b)),M.setAttribute("download",E),document.body.appendChild(M),M.click(),document.body.removeChild(M)}function Lc(E,b,M){let k=["case"];for(let[U,J]of Object.entries(b))k.push(["==",["get",E],U]),k.push(J);return k.push(M),k}function Zd(E,b,M){return["case",["boolean",["feature-state",E],!1],M,b]}function Ad(){return{type:"FeatureCollection",features:[]}}function Xd(E){return Gu(E)}function um(E){let b=Uf(Kl),M,k=!1;for(let U=Md.length-1;U>=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)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var d=0,m=1;for(r=i,o=0;o<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));o++)i>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;l<h;d=l++)r=i[l],o=i[d],e+=(o.x-r.x)*(r.y+o.y);return e}function pi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let Pn=null;function pn(i){if(Pn==null){const e=i.navigator?i.navigator.userAgent:null;Pn=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Pn}function Nn(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const fn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let no,mn;const oo={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(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.length;r++)if(!si(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!si(i[r],e[r]))return!1;return!0}return i===e}const Gt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function So(i,e,r){r.push({command:Gt.addSource,args:[i,e[i]]})}function Go(i,e,r){e.push({command:Gt.removeSource,args:[i]}),r[i]=!0}function Io(i,e,r,o){Go(i,r,o),So(i,e,r)}function Ri(i,e,r){let o;for(o in i[r])if(Object.prototype.hasOwnProperty.call(i[r],o)&&o!=="data"&&!si(i[r][o],e[r][o]))return!1;for(o in e[r])if(Object.prototype.hasOwnProperty.call(e[r],o)&&o!=="data"&&!si(i[r][o],e[r][o]))return!1;return!0}function $r(i,e,r,o,l,h){let d;for(d in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,d)&&(si(i[d],e[d])||r.push({command:h,args:[o,d,e[d],l]}));for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(si(i[d],e[d])||r.push({command:h,args:[o,d,e[d],l]}))}function so(i){return i.id}function kn(i,e){return i[e.id]=e,i}class Oe{constructor(e,r,o,l){this.message=(e?`${e}: `:"")+o,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Pr(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}class Xi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Zn{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,l]of r)this.bindings[o]=l}concat(e){return new Zn(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const gn={kind:"null"},Ue={kind:"number"},Dt={kind:"string"},xt={kind:"boolean"},mr={kind:"color"},_i={kind:"object"},Tt={kind:"value"},Qr={kind:"collator"},Wi={kind:"formatted"},Er={kind:"padding"},Xn={kind:"resolvedImage"};function Qi(i,e){return{kind:"array",itemType:i,N:e}}function ui(i){if(i.kind==="array"){const e=ui(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`: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(;l<e.length;l++){const m=r.parse(e[l],l,Tt);if(!m)return null;d.push(m)}return new kr(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!zn(this.type,Fi(o)))return o;if(r===this.args.length-1)throw new Bi(`Expected value to be of type ${ui(this.type)}, but found ${ui(Fi(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.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;d<e.length;d++){const m=r.parse(e[d],d,Tt);if(!m)return null;h.push(m)}return new er(l,h)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let r,o;for(const l of this.args){if(r=l.evaluate(e),o=null,r instanceof ot)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`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<m;d++){const _=e[d];for(let T=0,S=_.length;T<S-1;T++){if(ie(i,_[T],_[T+1]))return!1;(l=_[T])[1]>(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;r<e.length;r++)if(oe(i,e[r]))return!0;return!1}function ze(i,e,r,o){const l=o[0]-r[0],h=o[1]-r[1],d=(i[0]-r[0])*h-l*(i[1]-r[1]),m=(e[0]-r[0])*h-l*(e[1]-r[1]);return d>0&&m<0||d<0&&m>0}function Fe(i,e,r){for(const T of r)for(let S=0;S<T.length-1;++S)if((m=[(d=T[S+1])[0]-(h=T[S])[0],d[1]-h[1]])[0]*(_=[(l=e)[0]-(o=i)[0],l[1]-o[1]])[1]-m[1]*_[0]!=0&&ze(o,l,h,d)&&ze(h,d,o,l))return!0;var o,l,h,d,m,_;return!1}function Ke(i,e){for(let r=0;r<i.length;++r)if(!oe(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Fe(i[r],i[r+1],e))return!1;return!0}function We(i,e){for(let r=0;r<e.length;r++)if(Ke(i,e[r]))return!0;return!1}function je(i,e,r){const o=[];for(let l=0;l<i.length;l++){const h=[];for(let d=0;d<i[l].length;d++){const m=H(i[l][d],r);x(e,m),h.push(m)}o.push(h)}return o}function wt(i,e,r){const o=[];for(let l=0;l<i.length;l++){const h=je(i[l],e,r);o.push(h)}return o}function fi(i,e,r,o){if(i[0]<r[0]||i[0]>r[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<o.features.length;++l){const h=o.features[l].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new we(o,o.features[l].geometry)}else if(o.type==="Feature"){const l=o.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new we(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new we(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,o){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=je(o.coordinates,h,d),_=Mt(r.geometry(),l,h,d);if(!R(l,h))return!1;for(const T of _)if(!oe(T,m))return!1}if(o.type==="MultiPolygon"){const m=wt(o.coordinates,h,d),_=Mt(r.geometry(),l,h,d);if(!R(l,h))return!1;for(const T of _)if(!he(T,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=je(o.coordinates,h,d),_=Oi(r.geometry(),l,h,d);if(!R(l,h))return!1;for(const T of _)if(!Ke(T,m))return!1}if(o.type==="MultiPolygon"){const m=wt(o.coordinates,h,d),_=Oi(r.geometry(),l,h,d);if(!R(l,h))return!1;for(const T of _)if(!We(T,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class lt{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new lt(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Bt{constructor(e,r,o,l){this.name=e,this.type=r,this._evaluate=o,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],l=Bt.definitions[o];if(!l)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=d.filter(([T])=>!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<e.length;D++){const B=e[D],Z=Array.isArray(T)?T[D-1]:T.type,$=_.parse(B,1+A.length,Z);if(!$){z=!0;break}A.push($)}if(!z)if(Array.isArray(T)&&T.length!==A.length)_.error(`Expected ${T.length} arguments, but found ${A.length} instead.`);else{for(let D=0;D<A.length;D++){const B=Array.isArray(T)?T[D]:T.type,Z=A[D];_.concat(D+1).checkSubtype(B,Z.type)}if(_.errors.length===0)return new Bt(o,h,S,A)}}if(m.length===1)r.errors.push(..._.errors);else{const T=(m.length?m:d).map(([A])=>{return z=A,Array.isArray(z)?`(${z.map(ui).join(", ")})`:`(${ui(z.type)}...)`;var z}).join(" | "),S=[];for(let A=1;A<e.length;A++){const z=r.parse(e[A],1+S.length);if(!z)return null;S.push(ui(z.type))}r.error(`Expected arguments of type ${T}, but found (${S.join(", ")}) instead.`)}return null}static register(e,r){Bt.definitions=r;for(const o in r)e[o]=Bt}}function Ui(i){if(i instanceof lt)return Ui(i.boundExpression);if(i instanceof Bt&&i.name==="error"||i instanceof $t||i instanceof we)return!1;const e=i instanceof er||i instanceof kr;let r=!0;return i.eachChild(o=>{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||e<l)return m;h=m+1}else{if(!(o>e))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<e.length;d+=2){const m=d===1?-1/0:e[d],_=e[d+1],T=d,S=d+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(l.length&&l[l.length-1][0]>=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:_<l&&l-_>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<d.length;T+=2){const S=d[T],A=d[T+1],z=T+3,D=T+4;if(typeof S!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',z);if(m.length&&m[m.length-1][0]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',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<e.length-1;h+=2){const d=e[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([d,m])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return l?new ls(o,l):null}outputDefined(){return this.result.outputDefined()}}class ks{constructor(e,r,o){this.type=e,this.index=r,this.input=o}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,Ue),l=r.parse(e[2],2,Qi(r.expectedType||Tt));return o&&l?new ks(l.type.itemType,o,l):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Bi(`Array index out of bounds: ${r} < 0.`);if(r>=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;T<e.length-1;T+=2){let S=e[T];const A=e[T+1];Array.isArray(S)||(S=[S]);const z=r.concat(T);if(S.length===0)return z.error("Expected at least one branch label.");for(const B of S){if(typeof B!="number"&&typeof B!="string")return z.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return z.error("Numeric branch labels must be integer values.");if(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;d<e.length-1;d+=2){const m=r.parse(e[d],d,xt);if(!m)return null;const _=r.parse(e[d+1],d+1,o);if(!_)return null;l.push([m,_]),o=o||_.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new zs(o,l,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.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<r},function(i,e,r,o){return o.compare(e,r)<0}),Dn=Xo(">",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;B<i.stops.length;B++){const Z=i.stops[B],$=Z[0].zoom;S[$]===void 0&&(S[$]={zoom:$,type:i.type,property:i.property,default:i.default,stops:[]},A.push($)),S[$].stops.push([Z[0].value,Z[1]])}const z=[];for(const B of A)z.push([S[B].zoom,Aa(S[B],e)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:Lr.interpolationFactor.bind(void 0,D),zoomStops:z.map(B=>B[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<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->=":[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 i<e?-1:i>e?1:0}function na(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(na(i[e]))return!0;return!1}function fs(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?zo(i[1],i[2],"=="):e==="!="?nn(zo(i[1],i[2],"==")):e==="<"||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;l<r.length;l++)o+=`${JSON.stringify(r[l])}:${ms(i[r[l]])},`;return`${o}}`}function Lo(i){let e="";for(const r of qn)e+=`/${ms(i[r])}`;return e}function sa(i){const e=i.value;return e?[new Oe(i.key,e,"constants have been deprecated as of v8")]:[]}function Ni(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Fn(i){if(Array.isArray(i))return i.map(Fn);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Fn(i[r]);return e}return Ni(i)}function Dr(i){const e=i.key,r=i.value,o=i.valueSpec||{},l=i.objectElementValidators||{},h=i.style,d=i.styleSpec,m=i.validateSpec;let _=[];const T=Zt(r);if(T!=="object")return[new Oe(e,r,`object expected, ${T} found`)];for(const S in r){const A=S.split(".")[0],z=o[A]||o["*"];let D;if(l[A])D=l[A];else if(o[A])D=m;else if(l["*"])D=l["*"];else{if(!o["*"]){_.push(new Oe(e,r[S],`unknown property "${S}"`));continue}D=m}_=_.concat(D({key:(e&&`${e}.`)+S,value:r[S],valueSpec:z,style:h,styleSpec:d,object:r,objectKey:S,validateSpec:m},r))}for(const S in o)l[S]||o[S].required&&o[S].default===void 0&&r[S]===void 0&&_.push(new Oe(e,r,`missing required property "${S}"`));return _}function aa(i){const e=i.value,r=i.valueSpec,o=i.style,l=i.styleSpec,h=i.key,d=i.arrayElementValidator||i.validateSpec;if(Zt(e)!=="array")return[new Oe(h,e,`array expected, ${Zt(e)} found`)];if(r.length&&e.length!==r.length)return[new Oe(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Oe(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};l.$version<7&&(m.function=r.function),Zt(r.value)==="object"&&(m=r.value);let _=[];for(let T=0;T<e.length;T++)_=_.concat(d({array:e,arrayIndex:T,value:e[T],valueSpec:m,validateSpec:i.validateSpec,style:o,styleSpec:l,key:`${h}[${T}]`}));return _}function Os(i){const e=i.key,r=i.value,o=i.valueSpec;let l=Zt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Oe(e,r,`number expected, ${l} found`)]:"minimum"in o&&r<o.minimum?[new Oe(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.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&&$<l?[new Oe(D.key,ne,"stop domain values must appear in ascending order")]:(l=$,r==="categorical"&&$ in d?[new Oe(D.key,ne,"stop domain values must be unique")]:(d[$]=!0,[])):[new Oe(D.key,ne,`integer expected, found ${$}`)]}}function _n(i){const e=(i.expressionContext==="property"?Bs:ii)(Fn(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>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<e.length;d++)l=Zt(e[d]),Ni(e[1])==="$type"?h=h.concat(Ko({key:`${r}[${d}]`,value:e[d],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&h.push(new Oe(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)h=h.concat(de({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=Zt(e[1]),e.length!==2?h.push(new Oe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&h.push(new Oe(`${r}[1]`,e[1],`string expected, ${l} found`));break;case"within":l=Zt(e[1]),e.length!==2?h.push(new Oe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="object"&&h.push(new Oe(`${r}[1]`,e[1],`object expected, ${l} found`))}return h}function xe(i,e){const r=i.key,o=i.validateSpec,l=i.style,h=i.styleSpec,d=i.value,m=i.objectKey,_=h[`${e}_${i.layerType}`];if(!_)return[];const T=m.match(/^(.*)-transition$/);if(e==="paint"&&T&&_[T[1]]&&_[T[1]].transition)return o({key:r,value:d,valueSpec:h.transition,style:l,styleSpec:h});const S=i.valueSpec||_[m];if(!S)return[new Oe(r,d,`unknown property "${m}"`)];let A;if(Zt(d)==="string"&&Rn(S)&&!S.tokens&&(A=/^{([^}]+)}$/.exec(d)))return[new Oe(r,d,`"${m}" does not support interpolation syntax Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];const z=[];return i.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&z.push(new Oe(r,d,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&fo(Fn(d))&&Ni(d.type)==="identity"&&z.push(new Oe(r,d,'"text-font" does not support identity functions'))),z.concat(o({key:i.key,value:d,valueSpec:S,style:l,styleSpec:h,expressionContext:"property",propertyType:e,propertyKey:m}))}function qe(i){return xe(i,"paint")}function gt(i){return xe(i,"layout")}function li(i){let e=[];const r=i.value,o=i.key,l=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Oe(o,r,'either "type" or "ref" is required'));let d=Ni(r.type);const m=Ni(r.ref);if(r.id){const _=Ni(r.id);for(let T=0;T<i.arrayIndex;T++){const S=l.layers[T];Ni(S.id)===_&&e.push(new Oe(o,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach(T=>{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<r.length;h++)l=l.concat(i.validateSpec({key:`${e}[${h}]`,value:r[h],validateSpec:i.validateSpec,valueSpec:o}));return l}return Os({key:e,value:r,valueSpec:{}})},sprite:Vi};function Gr(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return i.validateSpec=Gr,r.expression&&fo(Ni(e))?la(i):r.expression&&rn(Fn(e))?_n(i):r.type&&yn[r.type]?yn[r.type](i):Dr(Pr({},i,{valueSpec:r.type?o[r.type]:r}))}function gr(i){const e=i.value,r=i.key,o=Pt(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Oe(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Oe(r,e,'"glyphs" url must include a "{range}" token'))),o}function tr(i,e=_e){let r=[];return r=r.concat(Gr({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:Gr,objectElementValidators:{glyphs:gr,"*":()=>[]}})),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;_<this.d*this.d;_++){const T=d[3+_],S=d[3+_+1];l.push(T===S?null:d.subarray(T,S))}const m=d[3+l.length+1];this.keys=d.subarray(d[3+l.length],m),this.bboxes=d.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,l,h){this._forEachCell(r,o,l,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(l),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,l,h,d){this.cells[h].push(d)}query(e,r,o,l,h){const d=this.min,m=this.max;if(e<=d&&r<=d&&m<=o&&m<=l&&!h)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(e,r,o,l,this._queryCell,_,{},h),_}}_queryCell(e,r,o,l,h,d,m,_){const T=this.cells[h];if(T!==null){const S=this.keys,A=this.bboxes;for(let z=0;z<T.length;z++){const D=T[z];if(m[D]===void 0){const B=4*D;(_?_(A[B+0],A[B+1],A[B+2],A[B+3]):e<=A[B+2]&&r<=A[B+3]&&o>=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<this.cells.length;d++)o+=this.cells[d].length;const l=new Int32Array(r+o+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let h=r;for(let d=0;d<e.length;d++){const m=e[d];l[3+d]=h,l.set(m,h),h+=m.length}return l[3+e.length]=h,l.set(this.keys,h),h+=this.keys.length,l[3+e.length+1]=h,l.set(this.bboxes,h),h+=this.bboxes.length,l.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new Xt(e.buffer)}}const qr={};function He(i,e,r={}){if(qr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),qr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}He("Object",Object),He("TransferableGridIndex",Xt),He("Color",ot),He("Error",Error),He("AJAXError",Mr),He("ResolvedImage",Sr),He("StylePropertyFunction",ri),He("StyleExpression",Wn,{omit:["_evaluator"]}),He("ZoomDependentExpression",It),He("ZoomConstantExpression",Ho),He("CompoundExpression",Bt,{omit:["_evaluate"]});for(const i in Mo)Mo[i]._classRegistryKey||He(`Expression_${i}`,Mo[i]);function Yo(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function _r(i,e){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)return i;if(Yo(i)||Nn(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(_r(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!qr[o])throw new Error(`${o} is not registered.`);const l=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||qr[o].omit.indexOf(h)>=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.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const $e={"Latin-1 Supplement":i=>i>=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<this.begin)return d.possiblyEvaluate(e,r,o);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,o),h,function(_){if(_<=0)return 0;if(_>=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.minzoom)||!!(this.maxzoom&&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<o;)_=255&i.charCodeAt(T)|(255&i.charCodeAt(++T))<<8|(255&i.charCodeAt(++T))<<16|(255&i.charCodeAt(++T))<<24,++T,l=27492+(65535&(h=5*(65535&(l=(l^=_=(65535&(_=(_=(65535&_)*d+(((_>>>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<l;){const d=o+l>>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<o;){const l=i[r+o>>1];let h=r-1,d=o+1;for(;;){do h++;while(i[h]<l);do d--;while(i[d]>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<o-d?(Kn(i,e,r,d),r=d+1):(Kn(i,e,d+1,o),o=d)}}function Jn(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}He("FeaturePositionMap",yr);class Xr{constructor(e,r){this.gl=e.gl,this.location=r}}class wo extends Xr{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class pa extends Xr{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Rr extends Xr{constructor(e,r){super(e,r),this.current=ot.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const vr=new Float32Array(16);function ei(i){return[vt(255*i.r,255*i.g),vt(255*i.b,255*i.a)]}class ur{constructor(e,r,o){this.value=e,this.uniformNames=r.map(l=>`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<r;h++)this.paintVertexArray.emplace(h,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class hr{constructor(e,r,o,l,h,d){this.expression=e,this.uniformNames=r.map(m=>`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<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],d[0],d[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,l);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=et(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,o){return new wo(e,r)}}class xn{constructor(e,r,o,l,h,d){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,l,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,l){if(!l||!o)return;const{min:h,mid:d,max:m}=o,_=l[h],T=l[d],S=l[m];if(_&&T&&S)for(let A=e;A<r;A++)this.zoomInPaintVertexArray.emplace(A,T.tl[0],T.tl[1],T.br[0],T.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],T.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(A,T.tl[0],T.tl[1],T.br[0],T.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],T.pixelRatio,S.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,tt.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,tt.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Va{constructor(e,r,o){this.binders={},this._buffers=[];const l=[];for(const h in e.paint._values){if(!o(h))continue;const d=e.paint.get(h);if(!(d instanceof vo&&Rn(d.property.specification)))continue;const m=Rc(h,e.type),_=d.value,T=d.property.specification.type,S=d.property.useIntegerZoom,A=d.property.specification["property-type"],z=A==="cross-faded"||A==="cross-faded-data-driven";if(_.kind==="constant")this.binders[h]=z?new xr(_.value,m):new ur(_.value,m,T),l.push(`/u_${h}`);else if(_.kind==="source"||z){const D=oc(h,T,"source");this.binders[h]=z?new xn(_,T,S,r,D,e.id):new ni(_,m,T,D),l.push(`/a_${h}`)}else{const D=oc(h,T,"composite");this.binders[h]=new hr(_,m,T,S,r,D),l.push(`/z_${h}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof ni||r instanceof hr?r.maxValue:0}populatePaintArrays(e,r,o,l,h){for(const d in this.binders){const m=this.binders[d];(m instanceof ni||m instanceof hr||m instanceof xn)&&m.populatePaintArray(e,r,o,l,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const l=this.binders[o];l instanceof xr&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,l,h){let d=!1;for(const m in e){const _=r.getPositions(m);for(const T of _){const S=o.feature(T.index);for(const A in this.binders){const z=this.binders[A];if((z instanceof ni||z instanceof hr||z instanceof xn)&&z.expression.isStateDependent===!0){const D=l.paint.get(A);z.expression=D.value,z.updatePaintArray(T.start,T.end,S,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof ur||o instanceof xr)&&e.push(...o.uniformNames.map(l=>`#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<o.paintVertexAttributes.length;l++)e.push(o.paintVertexAttributes[l].name);else if(o instanceof xn)for(let l=0;l<tt.members.length;l++)e.push(tt.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof ur||o instanceof xr||o instanceof hr)for(const l of o.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const l in this.binders){const h=this.binders[l];if(h instanceof ur||h instanceof xr||h instanceof hr){for(const d of h.uniformNames)if(r[d]){const m=h.getBinding(e,r[d],d);o.push({name:d,property:l,binding:m})}}}return o}setUniforms(e,r,o,l){for(const{name:h,property:d,binding:m}of r)this.binders[d].setUniform(m,l,o.get(d),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof xn){const l=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(o instanceof ni||o instanceof hr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof ni||o instanceof hr||o instanceof xn)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof ni||r instanceof hr||r instanceof xn)&&r.destroy()}}}class Oo{constructor(e,r,o=()=>!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;o<r.length;o++){const l=r[o];for(let h=0;h<l.length;h++){const d=l[h],m=Math.round(d.x*e),_=Math.round(d.y*e);d.x=et(m,fa,xl),d.y=et(_,fa,xl),(m<d.x||m>d.x+1||_<d.y||_>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;r<i.length;r++)if(ja(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(ja(i,e[r]))return!0;return!!Bc(i,e)}function Jd(i,e,r){return!!ja(i,e)||!!Oc(e,i,r)}function Ku(i,e){if(i.length===1)return Yu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let l=0;l<o.length;l++)if(ja(i,o[l]))return!0}for(let r=0;r<i.length;r++)if(Yu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Bc(i,e[r]))return!0;return!1}function Yd(i,e,r){if(i.length>1){if(Bc(i,e))return!0;for(let o=0;o<e.length;o++)if(Oc(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Oc(i[o],e,r))return!0;return!1}function Bc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],l=i[r+1];for(let h=0;h<e.length-1;h++)if(Qd(o,l,e[h],e[h+1]))return!0}return!1}function Qd(i,e,r,o){return zt(i,r,o)!==zt(e,r,o)&&zt(i,e,r)!==zt(i,e,o)}function Oc(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let l=1;l<e.length;l++)if(Ju(i,e[l-1],e[l])<o)return!0;return!1}function Ju(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function Yu(i,e){let r,o,l,h=!1;for(let d=0;d<i.length;d++){r=i[d];for(let m=0,_=r.length-1;m<r.length;_=m++)o=r[m],l=r[_],o.y>e.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;o<i.length;l=o++){const h=i[o],d=i[l];h.y>e.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.x<o.x&&e.x<o.x||i.x>l.x&&e.x>l.x||i.y<o.y&&e.y<o.y||i.y>l.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;m<i.length;m++)d.push(i[m].sub(h));return d}let Qu,eh;He("CircleBucket",Fc,{omit:["layers"]});var tp={get paint(){return eh=eh||new ln({"circle-radius":new _t(_e.paint_circle["circle-radius"]),"circle-color":new _t(_e.paint_circle["circle-color"]),"circle-blur":new _t(_e.paint_circle["circle-blur"]),"circle-opacity":new _t(_e.paint_circle["circle-opacity"]),"circle-translate":new ht(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new ht(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ht(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ht(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new _t(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new _t(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new _t(_e.paint_circle["circle-stroke-opacity"])})},get layout(){return Qu=Qu||new ln({"circle-sort-key":new _t(_e.layout_circle["circle-sort-key"])})}},cn=1e-6,$a=typeof Float32Array<"u"?Float32Array:Array;function Uc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function th(i,e,r){var o=e[0],l=e[1],h=e[2],d=e[3],m=e[4],_=e[5],T=e[6],S=e[7],A=e[8],z=e[9],D=e[10],B=e[11],Z=e[12],$=e[13],ne=e[14],ue=e[15],te=r[0],fe=r[1],ye=r[2],Ee=r[3];return i[0]=te*o+fe*m+ye*A+Ee*Z,i[1]=te*l+fe*_+ye*z+Ee*$,i[2]=te*h+fe*T+ye*D+Ee*ne,i[3]=te*d+fe*S+ye*B+Ee*ue,i[4]=(te=r[4])*o+(fe=r[5])*m+(ye=r[6])*A+(Ee=r[7])*Z,i[5]=te*l+fe*_+ye*z+Ee*$,i[6]=te*h+fe*T+ye*D+Ee*ne,i[7]=te*d+fe*S+ye*B+Ee*ue,i[8]=(te=r[8])*o+(fe=r[9])*m+(ye=r[10])*A+(Ee=r[11])*Z,i[9]=te*l+fe*_+ye*z+Ee*$,i[10]=te*h+fe*T+ye*D+Ee*ne,i[11]=te*d+fe*S+ye*B+Ee*ue,i[12]=(te=r[12])*o+(fe=r[13])*m+(ye=r[14])*A+(Ee=r[15])*Z,i[13]=te*l+fe*_+ye*z+Ee*$,i[14]=te*h+fe*T+ye*D+Ee*ne,i[15]=te*d+fe*S+ye*B+Ee*ue,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var wl,ip=th;function cc(i,e,r){var o=e[0],l=e[1],h=e[2],d=e[3];return i[0]=r[0]*o+r[4]*l+r[8]*h+r[12]*d,i[1]=r[1]*o+r[5]*l+r[9]*h+r[13]*d,i[2]=r[2]*o+r[6]*l+r[10]*h+r[14]*d,i[3]=r[3]*o+r[7]*l+r[11]*h+r[15]*d,i}function ih(i,e){const r=cc([],[i.x,i.y,0,1],e);return new me(r[0]/r[3],r[1]/r[3])}wl=new $a(4),$a!=Float32Array&&(wl[0]=0,wl[1]=0,wl[2]=0,wl[3]=0);class rh extends Fc{}let nh;He("HeatmapBucket",rh,{omit:["layers"]});var rp={get paint(){return nh=nh||new ln({"heatmap-radius":new _t(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new _t(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ht(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ml(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ht(_e.paint_heatmap["heatmap-opacity"])})}};function Nc(i,{width:e,height:r},o,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*o}`)}else l=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=l,i}function oh(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const l=Nc({},{width:e,height:r},o);Vc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=l.data}function Vc(i,e,r,o,l,h){if(l.width===0||l.height===0)return e;if(l.width>i.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;_<l.height;_++){const T=((r.y+_)*i.width+r.x)*h,S=((o.y+_)*e.width+o.x)*h;for(let A=0;A<l.width*h;A++)m[S+A]=d[T+A]}return e}class Tl{constructor(e,r){Nc(this,e,1,r)}resize(e){oh(this,e,1)}clone(){return new Tl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,l,h){Vc(e,r,o,l,h,1)}}class Yn{constructor(e,r){Nc(this,e,4,r)}resize(e){oh(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Yn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,l,h){Vc(e,r,o,l,h,4)}}function sh(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,l=i.image||new Yn({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(d,m,_)=>{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;d<o;++d,m+=4*r)for(let _=0,T=0;_<r;_++,T+=4){const S=_/(r-1),{start:A,end:z}=i.clips[d];h(m,T,A*(1-S)+z*S)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return l}let ah;He("AlphaImage",Tl),He("RGBAImage",Yn);var np={get paint(){return ah=ah||new ln({"hillshade-illumination-direction":new ht(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ht(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ht(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ht(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ht(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ht(_e.paint_hillshade["hillshade-accent-color"])})}};const op=ir([{name:"a_pos",components:2,type:"Int16"}],4),{members:sp}=op;var jc={exports:{}};function uc(i,e,r){r=r||2;var o,l,h,d,m,_,T,S=e&&e.length,A=S?e[0]*r:i.length,z=lh(i,0,A,r,!0),D=[];if(!z||z.next===z.prev)return D;if(S&&(z=function(Z,$,ne,ue){var te,fe,ye,Ee=[];for(te=0,fe=$.length;te<fe;te++)(ye=lh(Z,$[te]*ue,te<fe-1?$[te+1]*ue:Z.length,ue,!1))===ye.next&&(ye.steiner=!0),Ee.push(fp(ye));for(Ee.sort(hp),te=0;te<Ee.length;te++)ne=dp(Ee[te],ne);return ne}(i,e,z,r)),i.length>80*r){o=h=i[0],l=d=i[1];for(var B=r;B<A;B+=r)(m=i[B])<o&&(o=m),(_=i[B+1])<l&&(l=_),m>h&&(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<r;h+=o)d=hh(h,i[h],i[h+1],d);else for(h=r-o;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;$<ct&&(Ee++,ue=ue.nextZ);$++);for(rt=ct;Ee>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=l<h?l<d?l:d:h<d?h:d,A=m<_?m<T?m:T:_<T?_:T,z=l>h?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<T?m:T:_<T?_:T,B=S<A?S<z?S:z:A<z?A:z,Z=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.next.x?m:m.next,A===_))return d}m=m.next}while(m!==h);if(!d)return null;var z,D=d,B=d.x,Z=d.y,$=1/0;m=d;do _>=m.x&&m.x>=B&&_!==m.x&&Ga(T<Z?_:S,T,B,Z,T<Z?S:_,T,m.x,m.y)&&(z=Math.abs(T-m.y)/(_-m.x),Sl(m,l)&&(z<$||z===$&&(m.x>d.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<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Ga(i,e,r,o,l,h,d,m){return(l-d)*(e-m)>=(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;h<r;h+=o)l+=(i[d]-i[h])*(i[h+1]+i[d+1]),d=h;return l}jc.exports=uc,jc.exports.default=uc,uc.deviation=function(i,e,r,o){var l=e&&e.length,h=Math.abs(qc(i,0,l?e[0]*r:i.length,r));if(l)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(qc(i,e[d]*r,d<m-1?e[d+1]*r:i.length,r));var _=0;for(d=0;d<o.length;d+=3){var T=o[d]*r,S=o[d+1]*r,A=o[d+2]*r;_+=Math.abs((i[T]-i[A])*(i[S+1]-i[T+1])-(i[T]-i[S])*(i[A+1]-i[T+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)},uc.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,l=0;l<i.length;l++){for(var h=0;h<i[l].length;h++)for(var d=0;d<e;d++)r.vertices.push(i[l][h][d]);l>0&&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);A<z;){for(Cl(i,A,z),A++,z--;l(i[A],S)<0;)A++;for(;l(i[z],S)>0;)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 i<e?-1:i>e?1:0}function Zc(i,e){const r=i.length;if(r<=1)return[i];const o=[];let l,h;for(let d=0;d<r;d++){const m=jr(i[d]);m!==0&&(i[d].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(l&&o.push(l),l=[i[d]]):l.push(i[d]))}if(l&&o.push(l),e>1)for(let d=0;d<o.length;d++)o[d].length<=e||(gp(o[d],e,1,o[d].length-1,yp),o[d]=o[d].slice(0,e));return o}function yp(i,e){return e.area-i.area}function Xc(i,e,r){const o=r.patternDependencies;let l=!1;for(const h of e){const d=h.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);const m=d.constantOr(null);m&&(l=!0,o[m.to]=!0,o[m.from]=!0)}return l}function Wc(i,e,r,o,l){const h=l.patternDependencies;for(const d of e){const m=d.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let _=m.evaluate({zoom:o-1},r,{},l.availableImages),T=m.evaluate({zoom:o},r,{},l.availableImages),S=m.evaluate({zoom:o+1},r,{},l.availableImages);_=_&&_.name?_.name:_,T=T&&T.name?T.name:T,S=S&&S.name?S.name:S,h[_]=!0,h[T]=!0,h[S]=!0,r.patterns[d.id]={min:_,mid:T,max:S}}}return r}class Hc{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.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;$<D.length;$++)this.layoutVertexArray.emplaceBack(D[$].x,D[$].y),this.indexArray2.emplaceBack(Z+$-1,Z+$),S.push(D[$].x),S.push(D[$].y);B.vertexLength+=D.length,B.primitiveLength+=D.length}const z=dh(S,A);for(let D=0;D<z.length;D+=3)this.indexArray.emplaceBack(T+z[D],T+z[D+1],T+z[D+2]);_.vertexLength+=m,_.primitiveLength+=z.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,l)}}let fh,mh;He("FillBucket",Hc,{omit:["layers","patternFeatures"]});var vp={get paint(){return mh=mh||new ln({"fill-antialias":new ht(_e.paint_fill["fill-antialias"]),"fill-opacity":new _t(_e.paint_fill["fill-opacity"]),"fill-color":new _t(_e.paint_fill["fill-color"]),"fill-outline-color":new _t(_e.paint_fill["fill-outline-color"]),"fill-translate":new ht(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new ht(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new ha(_e.paint_fill["fill-pattern"])})},get layout(){return fh=fh||new ln({"fill-sort-key":new _t(_e.layout_fill["fill-sort-key"])})}};const xp=ir([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),bp=ir([{name:"a_centroid",components:2,type:"Int16"}],4),{members:wp}=xp;var js={},Tp=O,gh=qa;function qa(i,e,r,o,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=l,i.readFields(Ep,this,e)}function Ep(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,l){for(var h=o.readVarint()+o.pos;o.pos<h;){var d=l._keys[o.readVarint()],m=l._values[o.readVarint()];l.properties[d]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function Sp(i){for(var e,r,o=0,l=0,h=i.length,d=h-1;l<h;d=l++)o+=((r=i[d]).x-(e=i[l]).x)*(e.y+r.y);return o}qa.types=["Unknown","Point","LineString","Polygon"],qa.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,l=0,h=0,d=0,m=[];i.pos<r;){if(l<=0){var _=i.readVarint();o=7&_,l=_>>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<e;){if(o<=0){var S=i.readVarint();r=7&S,o=S>>3}if(o--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>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<D.length;B++){var Z=D[B];D[B]=[360*(Z.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var A=[];for(o=0;o<_.length;o++)A[o]=_[o][0];S(_=A);break;case 2:for(o=0;o<_.length;o++)S(_[o]);break;case 3:for(_=function(D){var B=D.length;if(B<=1)return[D];for(var Z,$,ne=[],ue=0;ue<B;ue++){var te=Sp(D[ue]);te!==0&&($===void 0&&($=te<0),$===te<0?(Z&&ne.push(Z),Z=[D[ue]]):Z.push(D[ue]))}return Z&&ne.push(Z),ne}(_),o=0;o<_.length;o++)for(l=0;l<_[o].length;l++)S(_[o][l])}_.length===1?_=_[0]:T="Multi"+T;var z={type:"Feature",geometry:{type:T,coordinates:_},properties:this.properties};return"id"in this&&(z.id=this.id),z};var Ip=gh,_h=yh;function yh(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Cp,this,e),this.length=this._features.length}function Cp(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var l=null,h=o.readVarint()+o.pos;o.pos<h;){var d=o.readVarint()>>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;$<B.length;$++){const ne=B[$];if($>=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;Z<B.length;Z++){const $=B[Z];Al(this.layoutVertexArray,$.x,$.y,0,0,1,1,0),d.x+=$.x,d.y+=$.y,d.vertexCount+=1,S.push($.x),S.push($.y)}}const D=dh(S,A);for(let B=0;B<D.length;B+=3)this.indexArray.emplaceBack(z+D[B],z+D[B+2],z+D[B+1]);T.primitiveLength+=D.length/3,T.vertexLength+=_}for(let m=0;m<d.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,l)}}function kp(i,e){return i.x===e.x&&(i.x<0||i.x>bi)||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(;r<e.length;r++){const h=e[r],d=i[0],m=l.sub(o),_=h.sub(o),T=d.sub(o),S=Ml(m,m),A=Ml(m,_),z=Ml(_,_),D=Ml(T,m),B=Ml(T,_),Z=S*z-A*A,$=(z*D-A*B)/Z,ne=(S*B-A*D)/Z,ue=o.z*(1-$-ne)+l.z*$+h.z*ne;if(isFinite(ue))return ue}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const Dp=ir([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Rp}=Dp,Fp=ir([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Bp}=Fp,Op=js.VectorTileFeature.types,Up=Math.cos(Math.PI/180*37.5),bh=Math.pow(2,14)/.5;class Yc{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.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<e.length-1;ne++)this.totalDistance+=e[ne].dist(e[ne+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Op[r.type]==="Polygon";let _=e.length;for(;_>=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=fe<Up&&D&&B,ct=Z.x*$.y-Z.y*$.x>0;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"&&(ye<d?Ze="miter":ye<=2&&(Ze="fakeround")),Ze==="miter"&&ye>h&&(Ze="bevel"),Ze==="bevel"&&(ye>2&&(Ze="flipbevel"),ye<h&&(Ze="miter")),D&&this.updateDistance(D,z),Ze==="miter")ue._mult(ye),this.addCurrentVertex(z,ue,0,0,A);else if(Ze==="flipbevel"){if(ye>100)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;mt<De;mt++){let ut=mt/De;if(ut!==.5){const wi=ut-.5;ut+=ut*wi*(ut-1)*((1.0904+te*(te*(3.55645-1.43519*te)-3.2452))*wi*wi+(.848013+te*(.215638*te-1.06021)))}const Ot=$.sub(Z)._mult(ut)._add(Z)._unit()._mult(ct?-1:1);this.addHalfVertex(z,Ot.x,Ot.y,!1,ct,0,A)}}B&&this.addCurrentVertex(z,$,-Ye,-Xe,A)}else if(Ze==="butt")this.addCurrentVertex(z,ue,0,0,A);else if(Ze==="square"){const Ve=D?1:-1;this.addCurrentVertex(z,ue,Ve,Ve,A)}else Ze==="round"&&(D&&(this.addCurrentVertex(z,Z,0,0,A),this.addCurrentVertex(z,Z,1,1,A,!0)),B&&(this.addCurrentVertex(z,$,-1,-1,A,!0),this.addCurrentVertex(z,$,0,0,A)));if(rt&&ne<_-1){const Ve=z.dist(B);if(Ve>2*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<<m)-1,T=_>>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<<T)-1,A=S>>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<<l|m,T+=l;T>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<i.length;r++)e.writeVarint(i[r])}function Xp(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Wp(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Hp(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Kp(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Jp(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Yp(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Qp(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function ef(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function mc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Xa(i,e,r){i[r]=e,i[r+1]=e>>>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<r;){var o=this.readVarint(),l=o>>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;d<l;){var m,_,T,S=r[d],A=null,z=S>239?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.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==hi.Bytes)return i.push(this.readSVarint());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==hi.Bytes)return i.push(this.readBoolean());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==hi.Bytes)return i.push(this.readFloat());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==hi.Bytes)return i.push(this.readDouble());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==hi.Bytes)return i.push(this.readFixed32());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==hi.Bytes)return i.push(this.readSFixed32());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==hi.Bytes)return i.push(this.readFixed64());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==hi.Bytes)return i.push(this.readSFixed64());var e=ws(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===hi.Varint)for(;this.buf[this.pos++]>127;);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;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Xa(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Xa(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Xa(this.buf,-1&i,this.pos),Xa(this.buf,Math.floor(i*Ph),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Xa(this.buf,-1&i,this.pos),Xa(this.buf,Math.floor(i*Ph),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||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;_<l.length;_++){if((d=l.charCodeAt(_))>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<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=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<o.length&&(o[m]=T)}else d.h===_.h?(_.x+=d.w,_.w-=d.w):d.w===_.w?(_.y+=d.h,_.h-=d.h):(o.push({x:_.x+d.w,y:_.y,w:_.w-d.w,h:d.h}),_.y+=d.h,_.h-=d.h);break}}return{w:l,h,fill:e/(l*h)||0}}const bn=1;class iu{constructor(e,{pixelRatio:r,version:o,stretchX:l,stretchY:h,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=h,this.content=d,this.version=o}get tl(){return[this.paddedRect.x+bn,this.paddedRect.y+bn]}get br(){return[this.paddedRect.x+this.paddedRect.w-bn,this.paddedRect.y+this.paddedRect.h-bn]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*bn)/this.pixelRatio,(this.paddedRect.h-2*bn)/this.pixelRatio]}}class Fh{constructor(e,r){const o={},l={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,l,h);const{w:d,h:m}=Rh(h),_=new Yn({width:d||1,height:m||1});for(const T in e){const S=e[T],A=o[T].paddedRect;Yn.copy(S.data,_,{x:0,y:0},{x:A.x+bn,y:A.y+bn},S.data)}for(const T in r){const S=r[T],A=l[T].paddedRect,z=A.x+bn,D=A.y+bn,B=S.data.width,Z=S.data.height;Yn.copy(S.data,_,{x:0,y:0},{x:z,y:D},S.data),Yn.copy(S.data,_,{x:0,y:Z-1},{x:z,y:D-1},{width:B,height:1}),Yn.copy(S.data,_,{x:0,y:0},{x:z,y:D+Z},{width:B,height:1}),Yn.copy(S.data,_,{x:B-1,y:0},{x:z-1,y:D},{width:1,height:Z}),Yn.copy(S.data,_,{x:0,y:0},{x:z+B,y:D},{width:1,height:Z})}this.image=_,this.iconPositions=o,this.patternPositions=l}addImages(e,r,o){for(const l in e){const h=e[l],d={x:0,y:0,w:h.data.width+2*bn,h:h.data.height+2*bn};o.push(d),r[l]=new iu(d,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,h]=e.tl;o.update(r.data,void 0,{x:l,y:h})}}var $s;He("ImagePosition",iu),He("ImageAtlas",Fh),c.WritingMode=void 0,($s=c.WritingMode||(c.WritingMode={}))[$s.none=0]="none",$s[$s.horizontal=1]="horizontal",$s[$s.vertical=2]="vertical",$s[$s.horizontalOnly=3]="horizontalOnly";const kl=-17;class zl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new zl;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new zl;return r.imageName=e,r}}class Wa{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new Wa;for(let l=0;l<e.sections.length;l++){const h=e.sections[l];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const l=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=l&&_s(l)&&!Pl[e[o+1]]||h&&_s(h)&&!Pl[e[o-1]]||!Pl[e[o]]?e[o]:Pl[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&_c[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=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<e.text.length;++l)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void di("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(zl.forImage(r)),this.sectionIndex.push(this.sections.length-1)):di("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=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;Je<rt.length;Je++)ct.sectionIndex.push(0);ne.push(ct)}}else if(te){ne=[];const Ee=te($.text,$.sectionIndex,ru($,T,h,e,o,D,B));for(const rt of Ee){const ct=new Wa;ct.text=rt[0],ct.sectionIndex=rt[1],ct.sections=$.sections,ne.push(ct)}}else ne=function(Ee,rt){const ct=[],Je=Ee.text;let Ze=0;for(const Ve of rt)ct.push(Ee.substring(Ze,Ve)),Ze=Ve;return Ze<Je.length&&ct.push(Ee.substring(Ze,Je.length)),ct}($,ru($,T,h,e,o,D,B));const fe=[],ye={positionedLines:fe,text:$.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:A,iconsInText:!1,verticalizable:!1};return function(Ee,rt,ct,Je,Ze,Ve,Ye,Xe,De,mt,ut,Ot){let wi=0,Pi=kl,dr=0,eo=0;const Fr=Xe==="right"?1:Xe==="left"?0:.5;let rr=0;for(const nr of Ze){nr.trim();const Or=nr.getMaxScale(),Hr=(Or-1)*br,un={positionedGlyphs:[],lineOffset:0};Ee.positionedLines[rr]=un;const Tn=un.positionedGlyphs;let En=0;if(!nr.length()){Pi+=Ve,++rr;continue}for(let Ur=0;Ur<nr.length();Ur++){const Ut=nr.getSection(Ur),On=nr.getSectionIndex(Ur),Nr=nr.getCharCode(Ur);let Kr=0,To=null,No=null,Vo=null,Ts=br;const Eo=!(De===c.WritingMode.horizontal||!ut&&!gs(Nr)||ut&&(_c[Nr]||(wr=Nr,$e.Arabic(wr)||$e["Arabic Supplement"](wr)||$e["Arabic Extended-A"](wr)||$e["Arabic Presentation Forms-A"](wr)||$e["Arabic Presentation Forms-B"](wr))));if(Ut.imageName){const to=Je[Ut.imageName];if(!to)continue;Vo=Ut.imageName,Ee.iconsInText=Ee.iconsInText||!0,No=to.paddedRect;const Sn=to.displaySize;Ut.scale=Ut.scale*br/Ot,To={width:Sn[0],height:Sn[1],left:bn,top:-Dh,advance:Eo?Sn[1]:Sn[0]},Kr=Hr+(br-Sn[1]*Ut.scale),Ts=To.advance;const Es=Eo?Sn[0]*Ut.scale-br*Or:Sn[1]*Ut.scale-br*Or;Es>0&&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<e?l/2:2*l:l+Math.abs(r)*r}function sf(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function Uh(i,e,r,o,l,h){let d=null,m=Oh(e,r,l,h);for(const _ of o){const T=Oh(e-_.x,r,l,h)+_.badness;T<=m&&(d=_,m=T)}return{index:i,x:e,priorBreak:d,badness:m}}function Nh(i){return i?Nh(i.priorBreak).concat(i.index):[]}function ru(i,e,r,o,l,h,d){if(h!=="point")return[];if(!i)return[];const m=[],_=function(z,D,B,Z,$,ne){let ue=0;for(let te=0;te<z.length();te++){const fe=z.getSection(te);ue+=Bh(z.getCharCode(te),fe,Z,$,D,ne)}return ue/Math.max(1,Math.ceil(ue/B))}(i,e,r,o,l,d),T=i.text.indexOf("")>=0;let S=0;for(let z=0;z<i.length();z++){const D=i.getSection(z),B=i.getCharCode(z);if(_c[B]||(S+=Bh(B,D,o,l,e,d)),z<i.length()-1){const Z=!((A=B)<11904||!($e["Bopomofo Extended"](A)||$e.Bopomofo(A)||$e["CJK Compatibility Forms"](A)||$e["CJK Compatibility Ideographs"](A)||$e["CJK Compatibility"](A)||$e["CJK Radicals Supplement"](A)||$e["CJK Strokes"](A)||$e["CJK Symbols and Punctuation"](A)||$e["CJK Unified Ideographs Extension A"](A)||$e["CJK Unified Ideographs"](A)||$e["Enclosed CJK Letters and Months"](A)||$e["Halfwidth and Fullwidth Forms"](A)||$e.Hiragana(A)||$e["Ideographic Description Characters"](A)||$e["Kangxi Radicals"](A)||$e["Katakana Phonetic Extensions"](A)||$e.Katakana(A)||$e["Vertical Forms"](A)||$e["Yi Radicals"](A)||$e["Yi Syllables"](A)));(of[B]||Z||D.imageName)&&m.push(Uh(z+1,S,_,m,sf(B,i.getCharCode(z+1),Z&&T),!1))}}var A;return Nh(Uh(i.length(),S,_,m,0,!0))}function nu(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function af(i,e,r,o,l){if(!o&&!l)return;const h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=d,i[m].y+=l}function lf(i,e,r){const{horizontalAlign:o,verticalAlign:l}=nu(r),h=e[0]-i.displaySize[0]*o,d=e[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function Vh(i,e,r,o,l,h){const d=i.image;let m;if(d.content){const $=d.content,ne=d.pixelRatio||1;m=[$[0]/ne,$[1]/ne,d.displaySize[0]-$[2]/ne,d.displaySize[1]-$[3]/ne]}const _=e.left*h,T=e.right*h;let S,A,z,D;r==="width"||r==="both"?(D=l[0]+_-o[3],A=l[0]+T+o[1]):(D=l[0]+(_+T-d.displaySize[0])/2,A=D+d.displaySize[0]);const B=e.top*h,Z=e.bottom*h;return r==="height"||r==="both"?(S=l[1]+B-o[0],z=l[1]+Z+o[2]):(S=l[1]+(B+Z-d.displaySize[1])/2,z=S+d.displaySize[1]),{image:d,top:S,right:A,bottom:z,left:D,collisionPadding:m}}const Ll=255,is=128,Gs=Ll*is;function jh(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Mi(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:l}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let d=h;for(;d<o.length&&o[d]<i+1;)d++;d=Math.min(o.length-1,d);const m=o[h],_=o[d];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:_,interpolationType:l}:{kind:"camera",minZoom:m,maxZoom:_,minSize:r.evaluate(new Mi(m)),maxSize:r.evaluate(new Mi(_)),interpolationType:l}}}function ou(i,e,r){let o="never";const l=i.get(e);return l?o=l:i.get(r)&&(o="always"),o}const cf=js.VectorTileFeature.types,uf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function yc(i,e,r,o,l,h,d,m,_,T,S,A,z){const D=m?Math.min(Gs,Math.round(m[0])):0,B=m?Math.min(Gs,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*l),h,d,(D<<1)+(_?1:0),B,16*T,16*S,256*A,256*z)}function su(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function hf(i){for(const e of i.sections)if(ys(e.text))return!0;return!1}class au{constructor(e){this.layoutVertexArray=new pe,this.indexArray=new ke,this.programConfigurations=e,this.segments=new Ge,this.dynamicLayoutVertexArray=new ve,this.opacityVertexArray=new Ae,this.hasVisibleVertices=!1,this.placedSymbolArray=new g}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,l){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,jp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,uf,!0),this.opacityVertexBuffer.itemSize=1),(o||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}He("SymbolBuffers",au);class lu{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new Ge,this.collisionVertexArray=new Re}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,$p.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}He("CollisionBuffers",lu);class Ha{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.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;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(o||l)&&h){const m=Pl[e.charAt(d)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const l=this.layers[0],h=l.layout,d=h.get("text-font"),m=h.get("text-field"),_=h.get("icon-image"),T=(m.value.kind!=="constant"||m.value.value instanceof vi&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(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<r.length;m++)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:l},m<r.length-1&&(l+=r[m+1].dist(r[m]));for(let m=e.segment||0;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;m<r.length;m++){const _=d[m];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,l,h,d,m,_,T,S,A,z){const D=e.indexArray,B=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,B,D,this.canOverlap?d.sortKey:void 0),$=this.glyphOffsetArray.length,ne=Z.vertexLength,ue=this.allowVerticalPlacement&&m===c.WritingMode.vertical?Math.PI/2:0,te=d.text&&d.text.sections;for(let fe=0;fe<r.length;fe++){const{tl:ye,tr:Ee,bl:rt,br:ct,tex:Je,pixelOffsetTL:Ze,pixelOffsetBR:Ve,minFontScaleX:Ye,minFontScaleY:Xe,glyphOffset:De,isSDF:mt,sectionIndex:ut}=r[fe],Ot=Z.vertexLength,wi=De[1];yc(B,_.x,_.y,ye.x,wi+ye.y,Je.x,Je.y,o,mt,Ze.x,Ze.y,Ye,Xe),yc(B,_.x,_.y,Ee.x,wi+Ee.y,Je.x+Je.w,Je.y,o,mt,Ve.x,Ze.y,Ye,Xe),yc(B,_.x,_.y,rt.x,wi+rt.y,Je.x,Je.y+Je.h,o,mt,Ze.x,Ve.y,Ye,Xe),yc(B,_.x,_.y,ct.x,wi+ct.y,Je.x+Je.w,Je.y+Je.h,o,mt,Ve.x,Ve.y,Ye,Xe),su(e.dynamicLayoutVertexArray,_,ue),D.emplaceBack(Ot,Ot+1,Ot+2),D.emplaceBack(Ot+1,Ot+2,Ot+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(De[0]),fe!==r.length-1&&ut===r[fe+1].sectionIndex||e.programConfigurations.populatePaintArrays(B.length,d,d.index,{},z,te&&te[ut])}e.placedSymbolArray.emplaceBack(_.x,_.y,$,this.glyphOffsetArray.length-$,ne,T,S,_.segment,o?o[0]:0,o?o[1]:0,l[0],l[1],m,0,!1,0,A)}_addCollisionDebugVertex(e,r,o,l,h,d){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,l,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,o,l,h,d,m){const _=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),T=_.vertexLength,S=h.layoutVertexArray,A=h.collisionVertexArray,z=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(S,A,d,z,D,new me(e,r)),this._addCollisionDebugVertex(S,A,d,z,D,new me(o,r)),this._addCollisionDebugVertex(S,A,d,z,D,new me(o,l)),this._addCollisionDebugVertex(S,A,d,z,D,new me(e,l)),_.vertexLength+=4;const B=h.indexArray;B.emplaceBack(T,T+1),B.emplaceBack(T+1,T+2),B.emplaceBack(T+2,T+3),B.emplaceBack(T+3,T),_.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,l){for(let h=e;h<r;h++){const d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new lu(Le,Ih.members,Qe),this.iconCollisionBox=new lu(Le,Ih.members,Qe);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,l,h,d,m,_,T){const S={};for(let A=r;A<o;A++){const z=e.get(A);S.textBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.textFeatureIndex=z.featureIndex;break}for(let A=l;A<h;A++){const z=e.get(A);S.verticalTextBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.verticalTextFeatureIndex=z.featureIndex;break}for(let A=d;A<m;A++){const z=e.get(A);S.iconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.iconFeatureIndex=z.featureIndex;break}for(let A=_;A<T;A++){const z=e.get(A);S.verticalIconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.verticalIconFeatureIndex=z.featureIndex;break}return S}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const o=e.placedSymbolArray.get(r),l=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<l;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),l=[],h=[],d=[];for(let m=0;m<this.symbolInstances.length;++m){d.push(m);const _=this.symbolInstances.get(m);l.push(0|Math.round(r*_.anchorX+o*_.anchorY)),h.push(_.featureIndex)}return d.sort((m,_)=>l[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<B.length;ne++){const ue=B[ne],te=D[ne];for(let fe=0;fe<ue.length-1;fe++){const ye=ue[fe],Ee=[ye,ue[fe+1],te[fe+1],te[fe],ye];Hu(Z,Ee)&&($=Math.min($,xh(Z,Ee)))}}return $!==1/0&&$}(z[0],z[1],A)}},line:class extends xo{constructor(i){super(i,Eh),this.gradientVersion=0,fc||(fc=new Np(Eh.paint.properties["line-width"].specification),fc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Co,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=fc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Yc(i)}queryRadius(i){const e=i,r=Sh(bl("line-width",this,e),bl("line-gap-width",this,e)),o=bl("line-offset",this,e);return r/2+Math.abs(o)+ac(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,l,h,d){const m=lc(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),_=d/2*Sh(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),T=this.paint.get("line-offset").evaluate(e,r);return T&&(o=function(S,A){const z=[];for(let D=0;D<S.length;D++){const B=S[D],Z=[];for(let $=0;$<B.length;$++){const ne=B[$-1],ue=B[$],te=B[$+1],fe=$===0?new me(0,0):ue.sub(ne)._unit()._perp(),ye=$===B.length-1?new me(0,0):te.sub(ue)._unit()._perp(),Ee=fe._add(ye)._unit(),rt=Ee.x*ye.x+Ee.y*ye.y;rt!==0&&Ee._mult(1/rt),Z.push(Ee._mult(A)._add(ue))}z.push(Z)}return z}(o,T*d)),function(S,A,z){for(let D=0;D<A.length;D++){const B=A[D];if(S.length>=3){for(let Z=0;Z<B.length;Z++)if(ja(S,B[Z]))return!0}if(Yd(S,B,z))return!0}return!1}(m,o,_)}isTileClipped(){return!0}},symbol:vc,background:class extends xo{constructor(i){super(i,df)}},raster:class extends xo{constructor(i){super(i,pf)}}};class gf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{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: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}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<o)throw new Error(`overscaledZ should be >= 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<this.overscaledZ&&e.canonical.x===this.canonical.x>>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.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Qn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Qn(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ed(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new xc(e.x-this.wrap,e.y))}}function Dl(i,e,r,o,l){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*l+o).toString(36)+r.toString(36)+e.toString(36)}He("CanonicalTileID",du),He("OverscaledTileID",Qn,{omit:["posMatrix"]});class td{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void di(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const l=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<l;h++)for(let d=0;d<l;d++){const m=this.get(h,d);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[l],o[l+1],o[l+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=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<m;S++)for(let A=l;A<h;A++)this.data[this._idx(A,S)]=e.data[this._idx(A+_,S+T)]}}He("DEMData",td);class id{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=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<r.length;T++){const S=r[T],A=[1/0,1/0,-1/0,-1/0];for(let z=0;z<S.length;z++){const D=S[z];A[0]=Math.min(A[0],D.x),A[1]=Math.min(A[1],D.y),A[2]=Math.max(A[2],D.x),A[3]=Math.max(A[3],D.y)}A[0]<bi&&A[1]<bi&&A[2]>=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<fe.length-1;Ze++)if(ep(fe[Ze],fe[Ze+1],Je))return!0;return!1}(e.cameraQueryGeometry,$-T,ne-T,ue+T,te+T));for(const $ of D)A.push($);A.sort(_f);const B={};let Z;for(let $=0;$<A.length;$++){const ne=A[$];if(ne===Z)continue;Z=ne;const ue=this.featureIndexArray.get(ne);let te=null;this.loadMatchingFeature(B,ue.bucketIndex,ue.sourceLayerIndex,ue.featureIndex,m,h.layers,h.availableImages,r,o,l,(fe,ye,Ee)=>(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;$<z.length;$++){const ne=z[$];if(d&&d.indexOf(ne)<0)continue;const ue=_[ne];if(!ue)continue;let te={};Z&&S&&(te=S.getState(ue.sourceLayer||"_geojsonTileLayer",Z));const fe=at({},T[ne]);fe.paint=od(fe.paint,ue.paint,B,te,m),fe.layout=od(fe.layout,ue.layout,B,te,m);const ye=!A||A(B,ue,te);if(!ye)continue;const Ee=new rd(B,this.z,this.x,this.y,Z);Ee.layer=fe;let rt=e[ne];rt===void 0&&(rt=e[ne]=[]),rt.push({featureIndex:l,feature:Ee,intersectionZ:ye})}}lookupSymbolFeatures(e,r,o,l,h,d,m,_){const T={};this.loadVTLayers();const S=ra(h);for(const A of e)this.loadMatchingFeature(T,o,l,A,S,d,m,_,r);return T}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function od(i,e,r,o,l){return oi(i,(h,d)=>{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<i.length;d++){const m=i[d];let _;for(let T=0;T<m.length-1;T++){let S=m[T],A=m[T+1];S.x<e&&A.x<e||(S.x<e?S=new me(e,S.y+(e-S.x)/(A.x-S.x)*(A.y-S.y))._round():A.x<e&&(A=new me(e,S.y+(e-S.x)/(A.x-S.x)*(A.y-S.y))._round()),S.y<r&&A.y<r||(S.y<r?S=new me(S.x+(r-S.y)/(A.y-S.y)*(A.x-S.x),r)._round():A.y<r&&(A=new me(S.x+(r-S.y)/(A.y-S.y)*(A.x-S.x),r)._round()),S.x>=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(;m<r/2;){const S=i[d],A=i[d+1];if(!A)return!1;let z=i[d-1].angleTo(S)-S.angleTo(A);for(z=Math.abs((z+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:m,angleDelta:z}),T+=z;m-_[0].distance>o;)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;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function ud(i,e,r){return i?.6*e*r:0}function hd(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function yf(i,e,r,o,l,h){const d=ud(r,l,h),m=hd(r,o)*h;let _=0;const T=cd(i)/2;for(let S=0;S<i.length-1;S++){const A=i[S],z=i[S+1],D=A.dist(z);if(_+D>T){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<e/4&&(e=A+e/4),dd(i,z?e/2*m%e:(S/2+2*h)*d*m%e,e,T,r,A,z,!1,_)}function dd(i,e,r,o,l,h,d,m,_){const T=h/2,S=cd(i);let A=0,z=e-r,D=[];for(let B=0;B<i.length-1;B++){const Z=i[B],$=i[B+1],ne=Z.dist($),ue=$.angleTo(Z);for(;z+r<A+ne;){z+=r;const te=(z-A)/ne,fe=zr.number(Z.x,$.x,te),ye=zr.number(Z.y,$.y,te);if(fe>=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;Xe<Ve.length-1;Xe++){const De=Ve[Xe],mt=Ve[Xe+1];for(let ut=0;ut<Ye.length-1;ut++)l.push(Ze(De,Ye[ut],mt,Ye[ut+1]))}}else l.push(Ze({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:_+1}));return l}function bc(i,e,r){let o=0;for(const l of i)o+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return o}function fd(i,e,r){const o=[{fixed:-Ka,stretch:0}];for(const[l,h]of i){const d=o[o.length-1];o.push({fixed:l-d.stretch,stretch:d.stretch}),o.push({fixed:l-d.stretch,stretch:d.stretch+(h-l)})}return o.push({fixed:e+Ka,stretch:r}),o}function wc(i,e,r,o){return i/e*r+o}function Tc(i,e,r,o){return i-e*r/o}class Ec{constructor(e,r,o,l,h,d,m,_,T,S){if(this.boxStartIndex=e.length,T){let A=d.top,z=d.bottom;const D=d.collisionPadding;D&&(A-=D[1],z+=D[3]);let B=z-A;B>0&&(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<l;){let d=1+(e<<1),m=r[d];const _=d+1;if(_<this.length&&o(r[_],m)<0&&(d=_,m=r[_]),o(m,h)>=0)break;r[e]=m,e=d}r[e]=h}}function bf(i,e){return i<e?-1:i>e?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;D<m.length;D++){const B=m[D];(!D||B.x<o)&&(o=B.x),(!D||B.y<l)&&(l=B.y),(!D||B.x>h)&&(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;D<h;D+=_)for(let B=l;B<d;B+=_)S.push(new Ja(D+T,B+T,T,i));let A=function(D){let B=0,Z=0,$=0;const ne=D[0];for(let ue=0,te=ne.length,fe=te-1;ue<te;fe=ue++){const ye=ne[ue],Ee=ne[fe],rt=ye.x*Ee.y-Ee.x*ye.y;Z+=(ye.x+Ee.x)*rt,$+=(ye.y+Ee.y)*rt,B+=3*rt}return new Ja(Z/B,$/B,0,D)}(i),z=S.length;for(;S.length;){const D=S.pop();(D.d>A.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;_<h.length;_++){const T=h[_];for(let S=0,A=T.length,z=A-1;S<A;z=S++){const D=T[S],B=T[z];D.y>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])<r)return!0}else l[e]=[];return l[e].push(o),!1}const yd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class mu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,o]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=o>>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;)m++;for(;e[2*_+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:"<cancel>",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==="<cancel>"){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==="<response>"){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:"<response>",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<e.length;o++)if(!i(e[o],r[o]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const o in e)if(!i(e[o],r[o]))return!1;return!0}return e===r},c.derefLayers=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=Yr(i[r],e[i[r].ref]));return i},c.diffStyles=function(i,e){if(!i)return[{command:Gt.setStyle,args:[e]}];let r=[];try{if(!si(i.version,e.version))return[{command:Gt.setStyle,args:[e]}];si(i.center,e.center)||r.push({command:Gt.setCenter,args:[e.center]}),si(i.zoom,e.zoom)||r.push({command:Gt.setZoom,args:[e.zoom]}),si(i.bearing,e.bearing)||r.push({command:Gt.setBearing,args:[e.bearing]}),si(i.pitch,e.pitch)||r.push({command:Gt.setPitch,args:[e.pitch]}),si(i.sprite,e.sprite)||r.push({command:Gt.setSprite,args:[e.sprite]}),si(i.glyphs,e.glyphs)||r.push({command:Gt.setGlyphs,args:[e.glyphs]}),si(i.transition,e.transition)||r.push({command:Gt.setTransition,args:[e.transition]}),si(i.light,e.light)||r.push({command:Gt.setLight,args:[e.light]});const o={},l=[];(function(d,m,_,T){let S;for(S in m=m||{},d=d||{})Object.prototype.hasOwnProperty.call(d,S)&&(Object.prototype.hasOwnProperty.call(m,S)||Go(S,_,T));for(S in m)Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(d,S)?si(d[S],m[S])||(d[S].type==="geojson"&&m[S].type==="geojson"&&Ri(d,m,S)?_.push({command:Gt.setGeoJSONSourceData,args:[S,m[S].data]}):Io(S,m,_,T)):So(S,m,_))})(i.sources,e.sources,l,o);const h=[];i.layers&&i.layers.forEach(d=>{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<T.length;Z++)ne=T[Z],Object.prototype.hasOwnProperty.call(z,ne)?$++:(_.push({command:Gt.removeLayer,args:[ne]}),D.splice(D.indexOf(ne,$),1));for(Z=0,$=0;Z<S.length;Z++)ne=S[S.length-1-Z],D[D.length-1-Z]!==ne&&(Object.prototype.hasOwnProperty.call(A,ne)?(_.push({command:Gt.removeLayer,args:[ne]}),D.splice(D.lastIndexOf(ne,D.length-$),1)):$++,fe=D[D.length-Z],_.push({command:Gt.addLayer,args:[z[ne],fe]}),D.splice(D.length-Z,0,ne),B[ne]=!0);for(Z=0;Z<S.length;Z++)if(ne=S[Z],ue=A[ne],te=z[ne],!B[ne]&&!si(ue,te))if(si(ue.source,te.source)&&si(ue["source-layer"],te["source-layer"])&&si(ue.type,te.type)){for(ye in $r(ue.layout,te.layout,_,ne,null,Gt.setLayoutProperty),$r(ue.paint,te.paint,_,ne,null,Gt.setPaintProperty),si(ue.filter,te.filter)||_.push({command:Gt.setFilter,args:[ne,te.filter]}),si(ue.minzoom,te.minzoom)&&si(ue.maxzoom,te.maxzoom)||_.push({command:Gt.setLayerZoomRange,args:[ne,te.minzoom,te.maxzoom]}),ue)Object.prototype.hasOwnProperty.call(ue,ye)&&ye!=="layout"&&ye!=="paint"&&ye!=="filter"&&ye!=="metadata"&&ye!=="minzoom"&&ye!=="maxzoom"&&(ye.indexOf("paint.")===0?$r(ue[ye],te[ye],_,ne,ye.slice(6),Gt.setPaintProperty):si(ue[ye],te[ye])||_.push({command:Gt.setLayerProperty,args:[ne,ye,te[ye]]}));for(ye in te)Object.prototype.hasOwnProperty.call(te,ye)&&!Object.prototype.hasOwnProperty.call(ue,ye)&&ye!=="layout"&&ye!=="paint"&&ye!=="filter"&&ye!=="metadata"&&ye!=="minzoom"&&ye!=="maxzoom"&&(ye.indexOf("paint.")===0?$r(ue[ye],te[ye],_,ne,ye.slice(6),Gt.setPaintProperty):si(ue[ye],te[ye])||_.push({command:Gt.setLayerProperty,args:[ne,ye,te[ye]]}))}else _.push({command:Gt.removeLayer,args:[ne]}),fe=D[D.lastIndexOf(ne)+1],_.push({command:Gt.addLayer,args:[te,fe]})}(h,e.layers,r)}catch(o){console.warn("Unable to compute style diff:",o),r=[{command:Gt.setStyle,args:[e]}]}return r},c.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},c.earthRadius=uu,c.ease=nt,c.emitValidationErrors=Kt,c.emptyStyle=function(){const i={},e=_e.$version;for(const r in _e.$root){const o=_e.$root[r];if(o.required){let l=null;l=r==="version"?e:o.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},c.equals=function(i,e){var r=i[0],o=i[1],l=i[2],h=i[3],d=i[4],m=i[5],_=i[6],T=i[7],S=i[8],A=i[9],z=i[10],D=i[11],B=i[12],Z=i[13],$=i[14],ne=i[15],ue=e[0],te=e[1],fe=e[2],ye=e[3],Ee=e[4],rt=e[5],ct=e[6],Je=e[7],Ze=e[8],Ve=e[9],Ye=e[10],Xe=e[11],De=e[12],mt=e[13],ut=e[14],Ot=e[15];return Math.abs(r-ue)<=cn*Math.max(1,Math.abs(r),Math.abs(ue))&&Math.abs(o-te)<=cn*Math.max(1,Math.abs(o),Math.abs(te))&&Math.abs(l-fe)<=cn*Math.max(1,Math.abs(l),Math.abs(fe))&&Math.abs(h-ye)<=cn*Math.max(1,Math.abs(h),Math.abs(ye))&&Math.abs(d-Ee)<=cn*Math.max(1,Math.abs(d),Math.abs(Ee))&&Math.abs(m-rt)<=cn*Math.max(1,Math.abs(m),Math.abs(rt))&&Math.abs(_-ct)<=cn*Math.max(1,Math.abs(_),Math.abs(ct))&&Math.abs(T-Je)<=cn*Math.max(1,Math.abs(T),Math.abs(Je))&&Math.abs(S-Ze)<=cn*Math.max(1,Math.abs(S),Math.abs(Ze))&&Math.abs(A-Ve)<=cn*Math.max(1,Math.abs(A),Math.abs(Ve))&&Math.abs(z-Ye)<=cn*Math.max(1,Math.abs(z),Math.abs(Ye))&&Math.abs(D-Xe)<=cn*Math.max(1,Math.abs(D),Math.abs(Xe))&&Math.abs(B-De)<=cn*Math.max(1,Math.abs(B),Math.abs(De))&&Math.abs(Z-mt)<=cn*Math.max(1,Math.abs(Z),Math.abs(mt))&&Math.abs($-ut)<=cn*Math.max(1,Math.abs($),Math.abs(ut))&&Math.abs(ne-Ot)<=cn*Math.max(1,Math.abs(ne),Math.abs(Ot))},c.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:l}){return i.kind==="source"?o/is:i.kind==="composite"?zr.number(o/is,l/is,r):e},c.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:h,maxZoom:d}=i,m=l?et(Lr.interpolationFactor(l,e,h,d),0,1):0;i.kind==="camera"?o=zr.number(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},c.evaluateVariableOffset=md,c.evented=Pa,c.exported=oo,c.extend=at,c.filterObject=Rt,c.findLineIntersection=function(i,e,r,o){const l=e.y-i.y,h=e.x-i.x,d=o.y-r.y,m=o.x-r.x,_=d*h-m*l;if(_===0)return null;const T=(m*(i.y-r.y)-d*(i.x-r.x))/_;return new me(i.x+T*h,i.y+T*l)},c.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},c.getAnchorAlignment=nu,c.getAnchorJustification=fu,c.getArrayBuffer=Zi,c.getDefaultExportFromCjs=ae,c.getJSON=function(i,e){return Vn(at(i,{type:"json"}),e)},c.getOverlapMode=ou,c.getProtocolAction=Ii,c.getRTLTextPluginStatus=hl,c.getReferrer=Si,c.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const l=window.document.createElement("source");At(i[o])||(r.crossOrigin="Anonymous"),l.src=i[o],r.appendChild(l)}return{cancel:()=>{}}},c.groupByLayout=function(i,e){const r={};for(let l=0;l<i.length;l++){const h=e&&e[i[l].id]||Lo(i[l]);e&&(e[i[l].id]=h);let d=r[h];d||(d=r[h]=[]),d.push(i[l])}const o=[];for(const l in r)o.push(r[l]);return o},c.identity=Uc,c.interpolate=zr,c.invert=function(i,e){var r=e[0],o=e[1],l=e[2],h=e[3],d=e[4],m=e[5],_=e[6],T=e[7],S=e[8],A=e[9],z=e[10],D=e[11],B=e[12],Z=e[13],$=e[14],ne=e[15],ue=r*m-o*d,te=r*_-l*d,fe=r*T-h*d,ye=o*_-l*m,Ee=o*T-h*m,rt=l*T-h*_,ct=S*Z-A*B,Je=S*$-z*B,Ze=S*ne-D*B,Ve=A*$-z*Z,Ye=A*ne-D*Z,Xe=z*ne-D*$,De=ue*Xe-te*Ye+fe*Ve+ye*Ze-Ee*Je+rt*ct;return De?(i[0]=(m*Xe-_*Ye+T*Ve)*(De=1/De),i[1]=(l*Ye-o*Xe-h*Ve)*De,i[2]=(Z*rt-$*Ee+ne*ye)*De,i[3]=(z*Ee-A*rt-D*ye)*De,i[4]=(_*Ze-d*Xe-T*Je)*De,i[5]=(r*Xe-l*Ze+h*Je)*De,i[6]=($*fe-B*rt-ne*te)*De,i[7]=(S*rt-z*fe+D*te)*De,i[8]=(d*Ye-m*Ze+T*ct)*De,i[9]=(o*Ze-r*Ye-h*ct)*De,i[10]=(B*Ee-Z*fe+ne*ue)*De,i[11]=(A*fe-S*Ee-D*ue)*De,i[12]=(m*Je-d*Ve-_*ct)*De,i[13]=(r*Ve-o*Je+l*ct)*De,i[14]=(Z*te-B*ye-$*ue)*De,i[15]=(S*ye-A*te+z*ue)*De,i):null},c.isImageBitmap=Nn,c.isSafari=pn,c.isWorker=pi,c.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},c.lazyLoadRTLTextPlugin=function(){Bn.isLoading()||Bn.isLoaded()||hl()!=="deferred"||ec()},c.makeRequest=Vn,c.mapObject=oi,c.mercatorXfromLng=Kh,c.mercatorYfromLat=Jh,c.mercatorZfromAltitude=Yh,c.mul=ip,c.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},c.multiply=th,c.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},c.operations=Gt,c.ortho=function(i,e,r,o,l,h,d){var m=1/(e-r),_=1/(o-l),T=1/(h-d);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*T,i[11]=0,i[12]=(e+r)*m,i[13]=(l+o)*_,i[14]=(d+h)*T,i[15]=1,i},c.parseCacheControl=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\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;De<Ye.length;De++){const mt=Ye[De];if(!D.horizontal[mt])if(Xe)D.horizontal[mt]=D.horizontal[0];else{const ut=gc(B,i.glyphMap,i.glyphPositions,i.imagePositions,T,Ze,l,"center",mt,ye,$,c.WritingMode.horizontal,!1,Je,A,S);ut&&(D.horizontal[mt]=ut,Xe=ut.positionedLines.length===1)}}Ve()}else{ct==="auto"&&(ct=fu(Ee));const Ye=gc(B,i.glyphMap,i.glyphPositions,i.imagePositions,T,Ze,l,Ee,ct,ye,$,c.WritingMode.horizontal,!1,Je,A,S);Ye&&(D.horizontal[ct]=Ye),Ve(),Do(te)&&h&&d&&(D.vertical=gc(B,i.glyphMap,i.glyphPositions,i.imagePositions,T,Ze,l,Ee,ct,ye,$,c.WritingMode.vertical,!1,Je,A,S))}}let ne=!1;if(_.icon&&_.icon.name){const te=i.imageMap[_.icon.name];te&&(Z=lf(i.imagePositions[_.icon.name],e.get("icon-offset").evaluate(_,{},i.canonical),e.get("icon-anchor").evaluate(_,{},i.canonical)),ne=!!te.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ne:i.bucket.sdfIcons!==ne&&di("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(te.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ue=_d(D.horizontal)||D.vertical;i.bucket.iconsInText=!!ue&&ue.iconsInText,(ue||Z)&&Ef(i.bucket,_,D,Z,i.imageMap,o,A,z,$,ne,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},c.perspective=function(i,e,r,o,l){var h,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+o)*(h=1/(o-l)),i[14]=2*l*o*h):(i[10]=-1,i[14]=-2*o),i},c.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const l=e[o];l in i&&(r[l]=i[l])}return r},c.plugin=Bn,c.pointGeometry=O,c.polygonIntersectsPolygon=Hu,c.potpack=Rh,c.register=He,c.registerForPluginStateChange=function(i){return i({pluginStatus:an,pluginURL:ts}),Pa.on("pluginStateChange",i),i},c.renderColorRamp=sh,c.rotateX=function(i,e,r){var o=Math.sin(r),l=Math.cos(r),h=e[4],d=e[5],m=e[6],_=e[7],T=e[8],S=e[9],A=e[10],z=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*l+T*o,i[5]=d*l+S*o,i[6]=m*l+A*o,i[7]=_*l+z*o,i[8]=T*l-h*o,i[9]=S*l-d*o,i[10]=A*l-m*o,i[11]=z*l-_*o,i},c.rotateZ=function(i,e,r){var o=Math.sin(r),l=Math.cos(r),h=e[0],d=e[1],m=e[2],_=e[3],T=e[4],S=e[5],A=e[6],z=e[7];return e!==i&&(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[0]=h*l+T*o,i[1]=d*l+S*o,i[2]=m*l+A*o,i[3]=_*l+z*o,i[4]=T*l-h*o,i[5]=S*l-d*o,i[6]=A*l-m*o,i[7]=z*l-_*o,i},c.sameOrigin=At,c.scale=function(i,e,r){var o=r[0],l=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.setRTLTextPlugin=function(i,e,r=!1){if(an===Us||an===Fo||an===es)throw new Error("setRTLTextPlugin cannot be called multiple times.");ts=oo.resolveURL(i),an=Us,ca=e,ul(),r||ec()},c.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},c.toEvaluationFeature=ma,c.transformMat4=cc,c.translate=function(i,e,r){var o,l,h,d,m,_,T,S,A,z,D,B,Z=r[0],$=r[1],ne=r[2];return e===i?(i[12]=e[0]*Z+e[4]*$+e[8]*ne+e[12],i[13]=e[1]*Z+e[5]*$+e[9]*ne+e[13],i[14]=e[2]*Z+e[6]*$+e[10]*ne+e[14],i[15]=e[3]*Z+e[7]*$+e[11]*ne+e[15]):(l=e[1],h=e[2],d=e[3],m=e[4],_=e[5],T=e[6],S=e[7],A=e[8],z=e[9],D=e[10],B=e[11],i[0]=o=e[0],i[1]=l,i[2]=h,i[3]=d,i[4]=m,i[5]=_,i[6]=T,i[7]=S,i[8]=A,i[9]=z,i[10]=D,i[11]=B,i[12]=o*Z+m*$+A*ne+e[12],i[13]=l*Z+_*$+z*ne+e[13],i[14]=h*Z+T*$+D*ne+e[14],i[15]=d*Z+S*$+B*ne+e[15]),i},c.triggerPluginCompletionEvent=Ql,c.unicodeBlockLookup=$e,c.uniqueId=function(){return Pe++},c.v8Spec=_e,c.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},c.validateLight=Ma,c.validateStyle=sn,c.vectorTile=js,c.warnOnce=di,c.wrap=yt}),J(["./shared"],function(c){class ae{constructor(P){this.keyCache={},P&&this.replace(P)}replace(P){this._layerConfigs={},this._layers={},this.update(P,[])}update(P,L){for(const X of P){this._layerConfigs[X.id]=X;const Y=this._layers[X.id]=c.createStyleLayer(X);Y._featureFilter=c.createFilter(Y.filter),this.keyCache[X.id]&&delete this.keyCache[X.id]}for(const X of L)delete this.keyCache[X],delete this._layerConfigs[X],delete this._layers[X];this.familiesBySource={};const N=c.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const X of N){const Y=X.map(Se=>this._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<jt.length;ot++){const yi=jt.feature(ot),ao=ee.getId(yi,Lt);zi.push({feature:yi,id:ao,index:ot,sourceLayerIndex:ti})}for(const ot of Te[Lt]){const yi=ot[0];yi.source!==this.source&&c.warnOnce(`layer.source = ${yi.source} does not equal this.source = ${this.source}`),yi.minzoom&&this.zoom<Math.floor(yi.minzoom)||yi.maxzoom&&this.zoom>=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<q.length;L++)nt(q[L],!P)}}function nt(q,P){for(var L=0,N=0,X=0,Y=q.length,se=Y-1;X<Y;se=X++){var ee=(q[X][0]-q[se][0])*(q[se][1]+q[X][1]),Q=L+ee;N+=Math.abs(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<P.features.length;N++)q(P.features[N],L);else if(X==="GeometryCollection")for(N=0;N<P.geometries.length;N++)q(P.geometries[N],L);else if(X==="Feature")q(P.geometry,L);else if(X==="Polygon")Ie(P.coordinates,L);else if(X==="MultiPolygon")for(N=0;N<P.coordinates.length;N++)Ie(P.coordinates[N],L);return P});const yt=c.vectorTile.VectorTileFeature.prototype.toGeoJSON;var at={exports:{}},Pe=c.pointGeometry,St=c.vectorTile.VectorTileFeature,oi=Rt;function Rt(q,P){this.options=P||{},this.features=q,this.length=q.length}function Qt(q,P){this.id=typeof q.id=="number"?q.id:void 0,this.type=q.type,this.rawGeometry=q.type===1?[q.geometry]:q.geometry,this.properties=q.tags,this.extent=P||4096}Rt.prototype.feature=function(q){return new Qt(this.features[q],this.options.extent)},Qt.prototype.loadGeometry=function(){var q=this.rawGeometry;this.geometry=[];for(var P=0;P<q.length;P++){for(var L=q[P],N=[],X=0;X<L.length;X++)N.push(new Pe(L[X][0],L[X][1]));this.geometry.push(N)}return this.geometry},Qt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var q=this.geometry,P=1/0,L=-1/0,N=1/0,X=-1/0,Y=0;Y<q.length;Y++)for(var se=q[Y],ee=0;ee<se.length;ee++){var Q=se[ee];P=Math.min(P,Q.x),L=Math.max(L,Q.x),N=Math.min(N,Q.y),X=Math.max(X,Q.y)}return[P,N,L,X]},Qt.prototype.toGeoJSON=St.prototype.toGeoJSON;var Ei=c.pbf,di=oi;function zt(q){var P=new Ei;return function(L,N){for(var X in L.layers)N.writeMessage(3,jr,L.layers[X])}(q,P),P.finish()}function jr(q,P){var L;P.writeVarintField(15,q.version||1),P.writeStringField(1,q.name||""),P.writeVarintField(5,q.extent||4096);var N={keys:[],values:[],keycache:{},valuecache:{}};for(L=0;L<q.length;L++)N.feature=q.feature(L),P.writeMessage(2,pi,N);var X=N.keys;for(L=0;L<X.length;L++)P.writeStringField(3,X[L]);var Y=N.values;for(L=0;L<Y.length;L++)P.writeMessage(4,no,Y[L])}function pi(q,P){var L=q.feature;L.id!==void 0&&P.writeVarintField(1,L.id),P.writeMessage(2,Pn,q),P.writeVarintField(3,L.type),P.writeMessage(4,fn,L)}function Pn(q,P){var L=q.feature,N=q.keys,X=q.values,Y=q.keycache,se=q.valuecache;for(var ee in L.properties){var Q=L.properties[ee],ce=Y[ee];if(Q!==null){ce===void 0&&(N.push(ee),Y[ee]=ce=N.length-1),P.writeVarint(ce);var Te=typeof Q;Te!=="string"&&Te!=="boolean"&&Te!=="number"&&(Q=JSON.stringify(Q));var Se=Te+":"+Q,Ce=se[Se];Ce===void 0&&(X.push(Q),se[Se]=Ce=X.length-1),P.writeVarint(Ce)}}}function pn(q,P){return(P<<3)+(7&q)}function Nn(q){return q<<1^q>>31}function fn(q,P){for(var L=q.loadGeometry(),N=q.type,X=0,Y=0,se=L.length,ee=0;ee<se;ee++){var Q=L[ee],ce=1;N===1&&(ce=Q.length),P.writeVarint(pn(1,ce));for(var Te=N===3?Q.length-1:Q.length,Se=0;Se<Te;Se++){Se===1&&N!==1&&P.writeVarint(pn(2,Te-1));var Ce=Q[Se].x-X,it=Q[Se].y-Y;P.writeVarint(Nn(Ce)),P.writeVarint(Nn(it)),X+=Ce,Y+=it}N===3&&P.writeVarint(pn(7,1))}}function no(q,P){var L=typeof q;L==="string"?P.writeStringField(1,q):L==="boolean"?P.writeBooleanField(7,q):L==="number"&&(q%1!=0?P.writeDoubleField(3,q):q<0?P.writeSVarintField(6,q):P.writeVarintField(5,q))}at.exports=zt,at.exports.fromVectorTileJs=zt,at.exports.fromGeojsonVt=function(q,P){P=P||{};var L={};for(var N in q)L[N]=new di(q[N].features,P),L[N].name=N,L[N].version=P.version,L[N].extent=P.extent;return zt({layers:L})},at.exports.GeoJSONWrapper=di;var mn=c.getDefaultExportFromCjs(at.exports);const oo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:q=>q},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<P.length;Q++){const ce=P[Q];if(!ce.geometry)continue;const[Te,Se]=ce.geometry.coordinates,Ce=qi(jn(Te)),it=qi($n(Se));se.push(Ce,it,1/0,Q,-1,1),this.options.reduce&&se.push(0)}let ee=this.trees[X+1]=this._createTree(se);L&&console.timeEnd(Y);for(let Q=X;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):Y<X?Y++:P.push(ee),P.length===N)break}return Y}_createTree(P){const L=new c.KDBush(P.length/this.stride|0,this.options.nodeSize,Float32Array);for(let N=0;N<P.length;N+=this.stride)L.add(P[N],P[N+1]);return L.finish(),L.data=P,L}_addTileFeatures(P,L,N,X,Y,se){for(const ee of P){const Q=ee*this.stride,ce=L[Q+Ii]>1;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;Se<Q.length;Se+=Te){if(Q[Se+2]<=L)continue;Q[Se+2]=L;const Ce=Q[Se],it=Q[Se+1],Et=P.within(Q[Se],Q[Se+1],ee),st=Q[Se+Ii];let pt=st;for(const bt of Et){const Vt=bt*Te;Q[Vt+2]>L&&(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;bt<Te;bt++)ce.push(Q[Se+bt]);if(pt>1)for(const bt of Et){const Vt=bt*Te;if(!(Q[Vt+2]<=L)){Q[Vt+2]=L;for(let Lt=0;Lt<Te;Lt++)ce.push(Q[Vt+Lt])}}}}return ce}_getOriginId(P){return P-this.points.length>>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;Ce<L;Ce+=3){var it=$o(q[Ce],q[Ce+1],Q,ce,Te,Se);if(it>Y)X=Ce,Y=it;else if(it===Y){var Et=Math.abs(Ce-se);Et<ee&&(X=Ce,ee=Et)}}Y>N&&(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;Q<se.length;Q++)qn(Y,se[Q]);else if(ee==="MultiPolygon")for(Q=0;Q<se.length;Q++)for(var ce=0;ce<se[Q].length;ce++)qn(Y,se[Q][ce])}(X),X}function qn(q,P){for(var L=0;L<P.length;L+=3)q.minX=Math.min(q.minX,P[L]),q.minY=Math.min(q.minY,P[L+1]),q.maxX=Math.max(q.maxX,P[L]),q.maxY=Math.max(q.maxY,P[L+1])}function Yr(q,P,L,N){if(P.geometry){var X=P.geometry.coordinates,Y=P.geometry.type,se=Math.pow(L.tolerance/((1<<L.maxZoom)*L.extent),2),ee=[],Q=P.id;if(L.promoteId?Q=P.properties[L.promoteId]:L.generateId&&(Q=N||0),Y==="Point")si(X,ee);else if(Y==="MultiPoint")for(var ce=0;ce<X.length;ce++)si(X[ce],ee);else if(Y==="LineString")Gt(X,ee,se,!1);else if(Y==="MultiLineString"){if(L.lineMetrics){for(ce=0;ce<X.length;ce++)Gt(X[ce],ee=[],se,!1),q.push(_e(Q,"LineString",ee,P.properties));return}So(X,ee,se,!1)}else if(Y==="Polygon")So(X,ee,se,!0);else{if(Y!=="MultiPolygon"){if(Y==="GeometryCollection"){for(ce=0;ce<P.geometry.geometries.length;ce++)Yr(q,{id:Q,geometry:P.geometry.geometries[ce],properties:P.properties},L,N);return}throw new Error("Input data is not a valid GeoJSON object.")}for(ce=0;ce<X.length;ce++){var Te=[];So(X[ce],Te,se,!0),ee.push(Te)}}q.push(_e(Q,Y,ee,P.properties))}}function si(q,P){P.push(Go(q[0])),P.push(Io(q[1])),P.push(0)}function Gt(q,P,L,N){for(var X,Y,se=0,ee=0;ee<q.length;ee++){var Q=Go(q[ee][0]),ce=Io(q[ee][1]);P.push(Q),P.push(ce),P.push(0),ee>0&&(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;X<q.length;X++){var Y=[];Gt(q[X],Y,L,N),P.push(Y)}}function Go(q){return q/360+.5}function Io(q){var 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 Ri(q,P,L,N,X,Y,se,ee){if(N/=P,Y>=(L/=P)&&se<N)return q;if(se<L||Y>=N)return null;for(var Q=[],ce=0;ce<q.length;ce++){var Te=q[ce],Se=Te.geometry,Ce=Te.type,it=X===0?Te.minX:Te.minY,Et=X===0?Te.maxX:Te.maxY;if(it>=L&&Et<N)Q.push(Te);else if(!(Et<L||it>=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<Se.length;pt++){var bt=[];Oe(Se[pt],bt,L,N,X,!0),bt.length&&st.push(bt)}if(st.length){if(ee.lineMetrics&&Ce==="LineString"){for(pt=0;pt<st.length;pt++)Q.push(_e(Te.id,Ce,st[pt],Te.tags));continue}Ce!=="LineString"&&Ce!=="MultiLineString"||(st.length===1?(Ce="LineString",st=st[0]):Ce="MultiLineString"),Ce!=="Point"&&Ce!=="MultiPoint"||(Ce=st.length===3?"Point":"MultiPoint"),Q.push(_e(Te.id,Ce,st,Te.tags))}}}return Q.length?Q:null}function $r(q,P,L,N,X){for(var Y=0;Y<q.length;Y+=3){var se=q[Y+X];se>=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;Ce<q.length-3;Ce+=3){var it=q[Ce],Et=q[Ce+1],st=q[Ce+2],pt=q[Ce+3],bt=q[Ce+4],Vt=X===0?it:Et,Lt=X===0?pt:bt,jt=!1;se&&(ee=Math.sqrt(Math.pow(it-pt,2)+Math.pow(Et-bt,2))),Vt<L?Lt>L&&(Q=Te(ce,it,Et,pt,bt,L),se&&(ce.start=Se+ee*Q)):Vt>N?Lt<N&&(Q=Te(ce,it,Et,pt,bt,N),se&&(ce.start=Se+ee*Q)):Pr(ce,it,Et,st),Lt<L&&Vt>=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;se<q.length;se++)so(q[se],P,L,N,X,Y,!1)}function Pr(q,P,L,N){q.push(P),q.push(L),q.push(N)}function Xi(q,P,L,N,X,Y){var se=(Y-P)/(N-P);return q.push(Y),q.push(L+(X-L)*se),q.push(1),se}function Zn(q,P,L,N,X,Y){var se=(Y-L)/(X-L);return q.push(P+(N-P)*se),q.push(Y),q.push(1),se}function gn(q,P){for(var L=[],N=0;N<q.length;N++){var X,Y=q[N],se=Y.type;if(se==="Point"||se==="MultiPoint"||se==="LineString")X=Ue(Y.geometry,P);else if(se==="MultiLineString"||se==="Polygon"){X=[];for(var ee=0;ee<Y.geometry.length;ee++)X.push(Ue(Y.geometry[ee],P))}else if(se==="MultiPolygon")for(X=[],ee=0;ee<Y.geometry.length;ee++){for(var Q=[],ce=0;ce<Y.geometry[ee].length;ce++)Q.push(Ue(Y.geometry[ee][ce],P));X.push(Q)}L.push(_e(Y.id,se,X,Y.tags))}return L}function Ue(q,P){var L=[];L.size=q.size,q.start!==void 0&&(L.start=q.start,L.end=q.end);for(var N=0;N<q.length;N+=3)L.push(q[N]+P,q[N+1],q[N+2]);return L}function Dt(q,P){if(q.transformed)return q;var L,N,X,Y=1<<q.z,se=q.x,ee=q.y;for(L=0;L<q.features.length;L++){var Q=q.features[L],ce=Q.geometry,Te=Q.type;if(Q.geometry=[],Te===1)for(N=0;N<ce.length;N+=2)Q.geometry.push(xt(ce[N],ce[N+1],P,Y,se,ee));else for(N=0;N<ce.length;N++){var Se=[];for(X=0;X<ce[N].length;X+=2)Se.push(xt(ce[N][X],ce[N][X+1],P,Y,se,ee));Q.geometry.push(Se)}}return q.transformed=!0,q}function xt(q,P,L,N,X,Y){return[Math.round(L*(q*N-X)),Math.round(L*(P*N-Y))]}function mr(q,P,L,N,X){for(var Y=P===X.maxZoom?0:X.tolerance/((1<<P)*X.extent),se={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:L,y:N,z:P,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ee=0;ee<q.length;ee++){se.numFeatures++,_i(se,q[ee],Y,X);var Q=q[ee].minX,ce=q[ee].minY,Te=q[ee].maxX,Se=q[ee].maxY;Q<se.minX&&(se.minX=Q),ce<se.minY&&(se.minY=ce),Te>se.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;ee<X.length;ee+=3)se.push(X[ee]),se.push(X[ee+1]),q.numPoints++,q.numSimplified++;else if(Y==="LineString")Tt(se,X,q,L,!1,!1);else if(Y==="MultiLineString"||Y==="Polygon")for(ee=0;ee<X.length;ee++)Tt(se,X[ee],q,L,Y==="Polygon",ee===0);else if(Y==="MultiPolygon")for(var Q=0;Q<X.length;Q++){var ce=X[Q];for(ee=0;ee<ce.length;ee++)Tt(se,ce[ee],q,L,!0,ee===0)}if(se.length){var Te=P.tags||null;if(Y==="LineString"&&N.lineMetrics){for(var Se in Te={},P.tags)Te[Se]=P.tags[Se];Te.mapbox_clip_start=X.start/X.size,Te.mapbox_clip_end=X.end/X.size}var Ce={geometry:se,type:Y==="Polygon"||Y==="MultiPolygon"?3:Y==="LineString"||Y==="MultiLineString"?2:1,tags:Te};P.id!==null&&(Ce.id=P.id),q.features.push(Ce)}}function Tt(q,P,L,N,X,Y){var se=N*N;if(N>0&&P.size<(X?se:N))L.numPoints+=P.length/3;else{for(var ee=[],Q=0;Q<P.length;Q+=3)(N===0||P[Q+2]>se)&&(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;Ce<it;Et=Ce,Ce+=2)Se+=(ce[Ce]-ce[Et])*(ce[Ce+1]+ce[Et+1]);if(Se>0===Te)for(Ce=0,it=ce.length;Ce<it/2;Ce+=2){var st=ce[Ce],pt=ce[Ce+1];ce[Ce]=ce[it-2-Ce],ce[Ce+1]=ce[it-1-Ce],ce[it-2-Ce]=st,ce[it-1-Ce]=pt}}(ee,Y),q.push(ee)}}function Qr(q,P){var L=(P=this.options=function(X,Y){for(var se in Y)X[se]=Y[se];return X}(Object.create(this.options),P)).debug;if(L&&console.time("preprocess data"),P.maxZoom<0||P.maxZoom>24)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;ee<X.features.length;ee++)Yr(se,X.features[ee],Y,ee);else Yr(se,X.type==="Feature"?X:{geometry:X},Y);return se}(q,P);this.tiles={},this.tileCoords=[],L&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",P.indexMaxZoom,P.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),N=function(X,Y){var se=Y.buffer/Y.extent,ee=X,Q=Ri(X,1,-1-se,se,0,-1,2,Y),ce=Ri(X,1,1-se,2+se,0,-1,2,Y);return(Q||ce)&&(ee=Ri(X,1,-se,1+se,0,-1,2,Y)||[],Q&&(ee=gn(Q,1).concat(ee)),ce&&(ee=ee.concat(gn(ce,-1)))),ee}(N,P),N.length&&this.splitTile(N,0,0,0),L&&(N.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Wi(q,P,L){return 32*((1<<q)*L+P)+q}function Er(q,P){return P?q.properties[P]:q.id}function Xn(q,P){if(q==null)return!0;if(q.type==="Feature")return Er(q,P)!=null;if(q.type==="FeatureCollection"){const L=new Set;for(const N of q.features){const X=Er(N,P);if(X==null||L.has(X))return!1;L.add(X)}return!0}return!1}function Qi(q,P){const L=new Map;if(q!=null)if(q.type==="Feature")L.set(Er(q,P),q);else for(const N of q.features)L.set(Er(N,P),N);return L}function ui(q,P){const L=q.tileID.canonical;if(!this._geoJSONIndex)return P(null,null);const N=this._geoJSONIndex.getTile(L.z,L.x,L.y);if(!N)return P(null,null);const X=new class{constructor(se){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.EXTENT,this.length=se.length,this._features=se}feature(se){return new class{constructor(ee){this._feature=ee,this.extent=c.EXTENT,this.type=ee.type,this.properties=ee.tags,"id"in ee&&!isNaN(ee.id)&&(this.id=parseInt(ee.id,10))}loadGeometry(){if(this._feature.type===1){const ee=[];for(const Q of this._feature.geometry)ee.push([new c.Point(Q[0],Q[1])]);return ee}{const ee=[];for(const Q of this._feature.geometry){const ce=[];for(const Te of Q)ce.push(new c.Point(Te[0],Te[1]));ee.push(ce)}return ee}}toGeoJSON(ee,Q,ce){return yt.call(this,ee,Q,ce)}}(this._features[se])}}(N.features);let Y=mn(X);Y.byteOffset===0&&Y.byteLength===Y.buffer.byteLength||(Y=new Uint8Array(Y)),P(null,{vectorTile:X,rawData:Y.buffer})}Qr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Qr.prototype.splitTile=function(q,P,L,N,X,Y,se){for(var ee=[q,P,L,N],Q=this.options,ce=Q.debug;ee.length;){N=ee.pop(),L=ee.pop(),P=ee.pop(),q=ee.pop();var Te=1<<P,Se=Wi(P,L,N),Ce=this.tiles[Se];if(!Ce&&(ce>1&&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<<X-P;if(L!==Math.floor(Y/Et)||N!==Math.floor(se/Et))continue}else if(P===Q.indexMaxZoom||Ce.numPoints<=Q.indexMaxPoints)continue;if(Ce.source=null,q.length!==0){ce>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<<q,ee=Wi(q,P=(P%se+se)%se,L);if(this.tiles[ee])return Dt(this.tiles[ee],X);Y>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<t.length;n++)if(t[n]in O.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){O.docStyle&&O.selectProp&&(O.userSelect=O.docStyle[O.selectProp],O.docStyle[O.selectProp]="none")}static enableDrag(){O.docStyle&&O.selectProp&&(O.docStyle[O.selectProp]=O.userSelect)}static setTransform(t,n){t.style[O.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",O.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",O.suppressClickInternal,!0),window.setTimeout(()=>{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<n.length;p++)u.push(new c.Point(n[p].clientX-s.left-t.clientLeft,n[p].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}O.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,O.selectProp=O.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),O.transformProp=O.testProp(["transform","WebkitTransform"]);const Me={supported:!1,testSupport:function(a){!dt&&Be&&(be?Ie(a):me=a)}};let me,Be,dt=!1,be=!1;function Ie(a){const t=a.createTexture();a.bindTexture(a.TEXTURE_2D,t);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,Be),a.isContextLost())return;Me.supported=!0}catch{}a.deleteTexture(t),dt=!0}var nt;typeof document<"u"&&(Be=document.createElement("img"),Be.onload=function(){me&&Ie(me),me=null,be=!0},Be.onerror=function(){dt=!0,me=null},Be.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(a){let t,n,s,u;a.resetRequestQueue=()=>{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;C<w&&t.length>0;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]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const s=n.spriteData,u=s&&s.width||n.data.width,p=s&&s.height||n.data.height;return!(t[0]<0||u<t[0]||t[1]<0||p<t[1]||t[2]<0||u<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,s=!0){const u=this.getImage(t);if(s&&(u.data.width!==n.data.width||u.data.height!==n.data.height))throw new Error(`size mismatch between old image (${u.data.width}x${u.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=u.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){let p=this.getImage(u);p||(this.fire(new c.Event("styleimagemissing",{id:u})),p=this.getImage(u)),p?s[u]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:c.warnOnce(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new c.ImagePosition(u,s);this.patterns[t]={bin:u,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new zt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=c.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:g}=this.patterns[p],v=g.x+1,y=g.y+1,w=this.getImage(p).data,C=w.width,I=w.height;c.RGBAImage.copy(w,u,{x:0,y:0},{x:v,y},{width:C,height:I}),c.RGBAImage.copy(w,u,{x:0,y:I-1},{x:v,y:y-1},{width:C,height:1}),c.RGBAImage.copy(w,u,{x:0,y:0},{x:v,y:y+I},{width:C,height:1}),c.RGBAImage.copy(w,u,{x:C-1,y:0},{x:v-1,y},{width:1,height:I}),c.RGBAImage.copy(w,u,{x:0,y:0},{x:v+C,y},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.getImage(n);s||c.warnOnce(`Image with ID: "${n}" was not found`),jr(s)&&this.updateImage(n,s)}}}const Pn=1e20;function pn(a,t,n,s,u,p,g,v,y){for(let w=t;w<t+s;w++)Nn(a,n*p+w,p,u,g,v,y);for(let w=n;w<n+u;w++)Nn(a,w*p+t,1,s,g,v,y)}function Nn(a,t,n,s,u,p,g){p[0]=0,g[0]=-Pn,g[1]=Pn,u[0]=a[t];for(let v=1,y=0,w=0;v<s;v++){u[v]=a[t+v*n];const C=v*v;do{const I=p[y];w=(u[v]-u[I]+C-I*I)/(v-I)/2}while(w<=g[y]&&--y>-1);y++,p[y]=v,g[y]=w,g[y+1]=Pn}for(let v=0,y=0;v<s;v++){for(;g[y+1]<v;)y++;const w=p[y],C=v-w;a[t+v*n]=u[w]+C*C}}class fn{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const p of t[u])s.push({stack:u,id:p});c.asyncAll(s,({stack:u,id:p},g)=>{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;W<y;W++)for(let pe=0;pe<v;pe++){const ve=ge.data[4*(W*v+pe)+3]/255;if(ve===0)continue;const Ae=(W+j)*w+pe+j;if(ve===1)re[Ae]=0,K[Ae]=Pn;else{const Le=.5-ve;re[Ae]=Le>0?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;W<I;W++){const pe=Math.sqrt(re[W])-Math.sqrt(K[W]);F[W]=Math.round(255-255*(pe/this.radius+this.cutoff))}return G}};class no{constructor(){this.specification=c.v8Spec.light.position}possiblyEvaluate(t,n){return c.sphericalToCartesian(t.expression.evaluate(n))}interpolate(t,n,s){return{x:c.interpolate.number(t.x,n.x,s),y:c.interpolate.number(t.y,n.y,s),z:c.interpolate.number(t.z,n.z,s)}}}let mn,oo;class qi extends c.Evented{constructor(t){super(),mn=mn||new c.Properties({anchor:new c.DataConstantProperty(c.v8Spec.light.anchor),position:new no,color:new c.DataConstantProperty(c.v8Spec.light.color),intensity:new c.DataConstantProperty(c.v8Spec.light.intensity)}),this._transitionable=new c.Transitionable(mn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),u):this._transitionable.setValue(s,u)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&c.emitValidationErrors(this,t.call(c.validateStyle,c.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v8Spec})))}}class Mr{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let p=t.length%2==1?-t[t.length-1]*s:0,g=t[0]*s,v=!0;u.push({left:p,right:g,isDash:v,zeroLength:t[0]===0});let y=t[0];for(let w=1;w<t.length;w++){v=!v;const C=t[w];p=y*s,y+=C,g=y*s,u.push({left:p,right:g,isDash:v,zeroLength:C===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let p=-s;p<=s;p++){const g=this.width*(this.nextRow+s+p);let v=0,y=t[v];for(let w=0;w<this.width;w++){w/y.right>1&&(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;v<this.width;v++){v/g.right>1&&(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<t.length;v++)p+=t[v];if(p!==0){const v=this.width/p,y=this.getDashRanges(t,this.width,v);n?this.addRoundDash(y,v,s):this.addRegularDash(y)}const g={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:p};return this.nextRow+=u,this.dirty=!0,g}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class Si{constructor(t,n,s){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=s;const u=this.workerPool.acquire(s);for(let p=0;p<u.length;p++){const g=new Si.Actor(u[p],n,s);g.name=`Worker ${p}`,this.actors.push(g)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){c.asyncAll(this.actors,(u,p)=>{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<p&&t.y>=u&&t.y<g}}class Zi extends c.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.extend(this,c.pick(n,["url","scheme","tileSize","promoteId"])),this._options=c.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}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,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<s&&(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}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class $n extends c.Evented{constructor(t,n,s,u){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=c.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const p=c.EXTENT/this.tileSize;this.workerOptions=c.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:c.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=c.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(c.exported.resolveURL(this._data),et.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(s,u)=>{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;t<n.start(0)||t>n.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;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,p){const g={};if(!p)return g;for(const v of u){const y=v.layerIds.map(w=>p.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;F<g.length;F++){const G=g.feature(F);if(v.needGeometry){const K=c.toEvaluationFeature(G,!0);if(!v.filter(new c.EvaluationParameters(this.tileID.overscaledZ),K,this.tileID.canonical))continue}else if(!v.filter(new c.EvaluationParameters(this.tileID.overscaledZ),G))continue;const V=s.getId(G,p),j=new c.GeoJSONFeature(G,y,w,C,V);j.tile=I,t.push(j)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=c.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+Math.max(p,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const p=this.buckets[u],g=p.layers[0].sourceLayer||"_geojsonTileLayer",v=s[g],y=t[g];if(!v||!y||Object.keys(y).length===0)continue;p.update(y,v,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=n&&n.style&&n.style.getLayer(u);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=c.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const p of n)if(u[p])return!0}}return!1}}class Go{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{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;u<n.length;u++){const p=n[u];if(t.neighboringTiles&&t.neighboringTiles[p]){const g=this.getTileByID(p);s(t,g),s(g,t)}}function s(u,p){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let g=p.tileID.canonical.x-u.tileID.canonical.x;const v=p.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),w=p.tileID.key;g===0&&v===0||Math.abs(v)>1||(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()||n<this._source.maxzoom&&(v[y.key]=y)}this._retainLoadedChildren(v,n,g,s);for(const y of t){let w=this._tiles[y.key];if(w.hasData())continue;if(n+1>this._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<w.length;V++){const j=this._tiles[w[V]];if(j.holdingForFade())continue;const K=j.tileID,re=Math.pow(2,p.zoom-j.tileID.overscaledZ),ge=n*j.queryPadding*c.EXTENT/j.tileSize/re,W=[K.getTilePoint(new c.MercatorCoordinate(C,I)),K.getTilePoint(new c.MercatorCoordinate(F,G))];if(W[0].x-ge<c.EXTENT&&W[0].y-ge<c.EXTENT&&W[1].x+ge>=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<Oe.workerCount;)this.workers.push(new Worker(c.config.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{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;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const p=n-1,g=this._distances[p],v=s-g,y=v>0?(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;g<this.xCellCount*this.yCellCount;g++)u.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,u,p){this._forEachCell(n,s,u,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(p)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,p,g){this.boxCells[p].push(g)}_insertCircleCell(t,n,s,u,p,g){this.circleCells[p].push(g)}_query(t,n,s,u,p,g,v){if(s<0||t>this.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;w<this.boxKeys.length;w++)y.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const C=this.circles[3*w],I=this.circles[3*w+1],F=this.circles[3*w+2];y.push({key:this.circleKeys[w],x1:C-F,y1:I-F,x2:C+F,y2:I+F})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:p,overlapMode:g,seenUids:{box:{},circle:{}}},v);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,p,g){return this._query(t,n,s,u,!0,p,g).length>0}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;ge<j.length;ge++){const W=j.get(ge);if(W.hidden||W.writingMode===c.WritingMode.vertical&&!re){N(W.numGlyphs,G);continue}let pe;if(re=!1,w?(pe=[W.anchorX,W.anchorY,w(W.anchorX,W.anchorY),1],c.transformMat4(pe,pe,t)):(pe=[W.anchorX,W.anchorY,0,1],X(pe,pe,t)),!Qr(pe,F)){N(W.numGlyphs,G);continue}const ve=Tt(n.transform.cameraToCenterDistance,pe[3]),Ae=c.evaluateSizeForFeature(C,I,W),Le=g?Ae/ve:Ae*ve,Re=new c.Point(W.anchorX,W.anchorY),ke=_i(Re,u,w).point,Qe={projections:{},offsets:{}},ft=Qi(W,Le,!1,v,t,u,p,a.glyphOffsetArray,V,G,ke,Re,Qe,K,y,w);re=ft.useVertical,(ft.notEnoughRoom||re||ft.needsFlipping&&Qi(W,Le,!0,v,t,u,p,a.glyphOffsetArray,V,G,ke,Re,Qe,K,y,w).notEnoughRoom)&&N(W.numGlyphs,G)}s?a.text.dynamicLayoutVertexBuffer.updateData(G):a.icon.dynamicLayoutVertexBuffer.updateData(G)}function Er(a,t,n,s,u,p,g,v,y,w,C,I,F){const G=v.glyphStartIndex+v.numGlyphs,V=v.lineStartIndex,j=v.lineStartIndex+v.lineLength,K=t.getoffsetX(v.glyphStartIndex),re=t.getoffsetX(G-1),ge=P(a*K,n,s,u,p,g,v.segment,V,j,y,w,C,I,F);if(!ge)return null;const W=P(a*re,n,s,u,p,g,v.segment,V,j,y,w,C,I,F);return W?{first:ge,last:W}:null}function Xn(a,t,n,s){return a===c.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(a===c.WritingMode.vertical?t.y<n.y:t.x>n.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;Qe<pe-1;Qe++)W.push(P(K*v.getoffsetX(Qe),re,ge,n,C,I,a.segment,ve,Ae,y,p,F,V,j));W.push(Le.last)}else{if(s&&!n){const ve=_i(I,u,j).point,Ae=a.lineStartIndex+a.segment+1,Le=new c.Point(y.getx(Ae),y.gety(Ae)),Re=_i(Le,u,j),ke=Re.signedDistanceFromCamera>0?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<s||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<v||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<a;n++){const s=t.length;t.resize(s+4),t.float32.set(L,3*s)}}function X(a,t,n){const s=t[0],u=t[1];return a[0]=n[0]*s+n[4]*u+n[12],a[1]=n[1]*s+n[5]*u+n[13],a[3]=n[3]*s+n[7]*u+n[15],a}const Y=100;class se{constructor(t,n=new Dt(t.width+200,t.height+200,25),s=new Dt(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Y,this.screenBottomBoundary=t.height+Y,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,p,g){const v=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,g),y=s*v.perspectiveRatio,w=t.x1*y+v.point.x,C=t.y1*y+v.point.y,I=t.x2*y+v.point.x,F=t.y2*y+v.point.y;return!this.isInsideGrid(w,C,I,F)||n!=="always"&&this.grid.hitTest(w,C,I,F,n,p)||v.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[w,C,I,F],offscreen:this.isOffscreen(w,C,I,F)}}placeCollisionCircles(t,n,s,u,p,g,v,y,w,C,I,F,G,V){const j=[],K=new c.Point(n.anchorX,n.anchorY),re=_i(K,g,V),ge=Tt(this.transform.cameraToCenterDistance,re.signedDistanceFromCamera),W=(C?p/ge:p*ge)/c.ONE_EM,pe=_i(K,v,V).point,ve=Er(W,u,n.lineOffsetX*W,n.lineOffsetY*W,!1,pe,K,n,s,v,{projections:{},offsets:{}},!1,V);let Ae=!1,Le=!1,Re=!0;if(ve){const ke=.5*F*ge+G,Qe=new c.Point(-100,-100),ft=new c.Point(this.screenRightBoundary,this.screenBottomBoundary),Ct=new gn,Ge=ve.first,vt=ve.last;let tt=[];for(let Yt=Ge.path.length-1;Yt>=1;Yt--)tt.push(Ge.path[Yt]);for(let Yt=1;Yt<vt.path.length;Yt++)tt.push(vt.path[Yt]);const Jt=2.5*ke;if(y){const Yt=tt.map(kt=>_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<tt.length;$i++)Yt.x=Math.min(Yt.x,tt[$i].x),Yt.y=Math.min(Yt.y,tt[$i].y),kt.x=Math.max(kt.x,tt[$i].x),kt.y=Math.max(kt.y,tt[$i].y);Hi=Yt.x>=Qe.x&&kt.x<=ft.x&&Yt.y>=Qe.y&&kt.y<=ft.y?[tt]:kt.x<Qe.x||Yt.x>ft.x||kt.y<Qe.y||Yt.y>ft.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<kt;$i++){const Zr=$i/Math.max(kt-1,1),Ki=Ct.lerp(Zr),yr=Ki.x+Y,vn=Ki.y+Y;j.push(yr,vn,ke,0);const Kn=yr-ke,Jn=vn-ke,Xr=yr+ke,wo=vn+ke;if(Re=Re&&this.isOffscreen(Kn,Jn,Xr,wo),Le=Le||this.isInsideGrid(Kn,Jn,Xr,wo),t!=="always"&&this.grid.hitTestCircle(yr,vn,ke,t,I)&&(Ae=!0,!w))return{circles:[],offscreen:!1,collisionDetected:Ae}}}}return{circles:!w&&Ae||!Le||ge<this.perspectiveRatioCutoff?[]:j,offscreen:Re,collisionDetected:Ae}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,p=-1/0,g=-1/0;for(const C of t){const I=new c.Point(C.x+Y,C.y+Y);s=Math.min(s,I.x),u=Math.min(u,I.y),p=Math.max(p,I.x),g=Math.max(g,I.y),n.push(I)}const v=this.grid.query(s,u,p,g).concat(this.ignoredGrid.query(s,u,p,g)),y={},w={};for(const C of v){const I=C.key;if(y[I.bucketInstanceId]===void 0&&(y[I.bucketInstanceId]={}),y[I.bucketInstanceId][I.featureIndex])continue;const F=[new c.Point(C.x1,C.y1),new c.Point(C.x2,C.y1),new c.Point(C.x2,C.y2),new c.Point(C.x1,C.y2)];c.polygonIntersectsPolygon(n,F)&&(y[I.bucketInstanceId][I.featureIndex]=!0,w[I.bucketInstanceId]===void 0&&(w[I.bucketInstanceId]=[]),w[I.bucketInstanceId].push(I.featureIndex))}return w}insertCollisionBox(t,n,s,u,p,g){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:g,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,p,g){const v=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:p,collisionGroupID:g,overlapMode:n};for(let w=0;w<t.length;w+=4)v.insertCircle(y,t[w],t[w+1],t[w+2])}projectAndGetPerspectiveRatio(t,n,s,u){let p;return u?(p=[n,s,u(n,s),1],c.transformMat4(p,p,t)):(p=[n,s,0,1],X(p,p,t)),{point:new c.Point((p[0]/p[3]+1)/2*this.transform.width+Y,(-p[1]/p[3]+1)/2*this.transform.height+Y),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<Y||t>=this.screenRightBoundary||u<Y||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.identity([]);return c.translate(t,t,[-100,-100,0]),t}}function ee(a,t,n){return t*(c.EXTENT/(a.tileSize*Math.pow(2,n-a.tileID.overscaledZ)))}class Q{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class ce{constructor(t,n,s,u,p){this.text=new Q(t?t.text:null,n,s,p),this.icon=new Q(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Te{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class Se{constructor(){this.invProjMatrix=c.create(),this.viewportMatrix=c.create(),this.circles=[]}}class Ce{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class it{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.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<xl;++fa){const Uo=this.attemptAnchorPlacement(ei[fa%ei.length],ni,Va,Oo,Rc,pe,ve,w,g,G,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<Ki.circles.length;ei+=4)vr.circles.push(Ki.circles[ei+0]),vr.circles.push(Ki.circles[ei+1]),vr.circles.push(Ki.circles[ei+2]),vr.circles.push(Ki.collisionDetected?1:0)}if(Ge.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ge.crossTileID]=new Te(tt||Re,Jt||ke,Hi||u.justReloaded),n[Ge.crossTileID]=!0};if(Le){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ge=u.getSortedSymbolIndexes(this.transform.angle);for(let vt=Ge.length-1;vt>=0;--vt){const tt=Ge[vt];Ct(u.symbolInstances.get(tt),u.collisionArrays[tt])}}else for(let Ge=t.symbolInstanceStart;Ge<t.symbolInstanceEnd;Ge++)Ct(u.symbolInstances.get(Ge),u.collisionArrays[Ge]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ge=this.collisionCircleArrays[u.bucketInstanceId];c.invert(Ge.invProjMatrix,g),Ge.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=u===c.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[c.getAnchorJustification(n)];const g=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const v of g)v>=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;re<j/4;re++)V.opacityVertexArray.emplaceBack(K);V.hasVisibleVertices=V.hasVisibleVertices||K!==vi};for(let V=0;V<t.symbolInstances.length;V++){const j=t.symbolInstances.get(V),{numHorizontalGlyphVertices:K,numVerticalGlyphVertices:re,crossTileID:ge}=j;let W=this.opacities[ge];n[ge]?W=p:W||(W=F,this.opacities[ge]=W),n[ge]=!0;const pe=j.numIconVertices>0,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.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}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._currentTileIndex<t.length;)if(n.getBucketParts(g,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((v,y)=>v.sortKey-y.sortKey));this._currentPartIndex<g.length;)if(n.placeLayerBucketPart(g[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class Sr{constructor(t,n,s,u,p,g,v,y){this.placement=new pt(t,n,g,v,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=c.exported.now(),p=()=>!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<n.length;p++){const g=n.get(p),v=g.key,y=u.get(v);y?y.push(g):u.set(v,[g])}for(const[p,g]of u){const v={positions:g.map(y=>({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.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const g=t.get(p);if(g.crossTileID)continue;const v=this._symbolsByKey[g.key];if(!v)continue;const y=this.getScaledCoordinates(g,n);if(v.index){const w=v.index.range(y.x-u,y.y-u,y.x+u,y.y+u).sort();for(const C of w){const I=v.crossTileIDs[C];if(!s[I]){s[I]=!0,g.crossTileID=I;break}}}else if(v.positions)for(let w=0;w<v.positions.length;w++){const C=v.positions[w],I=v.crossTileIDs[w];if(Math.abs(C.x-y.x)<=u&&Math.abs(C.y-y.y)<=u&&!s[I]){s[I]=!0,g.crossTileID=I;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}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;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const g=this.indexes[p];if(Number(p)>t.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.symbolInstances.length;p++){const g=n.symbolInstances.get(p);g.crossTileID||(g.crossTileID=s.generate(),u[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ln(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s of n.getCrossTileIDsLists())for(const u of s)delete this.usedCrossTileIDs[t][u]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const p in u)t[u[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[p]),delete u[p],n=!0)}return n}}class lo{constructor(){this.layerIndexes={},this.crossTileIDs=new Fi,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new ss);let p=!1;const g={};u.handleWrapJump(s);for(const v of n){const y=v.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(v.tileID,y,this.crossTileIDs)&&(p=!0),g[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(g)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{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]<g)break;p.push(w),u.pop()}else for(const y of t){const w=y[v];if(w)for(const C of w)p.push(C.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(c.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new c.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const v of n.layers){const y=this._layers[v];if(!y)return this.fire(new c.ErrorEvent(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];u[y.source]=!0}}const p=[];n.availableImages=this._availableImages;const g=this._serializedAllLayers();for(const v in this.sourceCaches)n.layers&&!u[v]||p.push(si(this.sourceCaches[v],this._layers,g,t,n,s));return this.placement&&p.push(function(v,y,w,C,I,F,G){const V={},j=F.queryRenderedSymbols(C),K=[];for(const re of Object.keys(j).map(Number))K.push(G[re]);K.sort(Gt);for(const re of K){const ge=re.featureIndex.lookupSymbolFeatures(j[re.bucketInstanceId],y,re.bucketIndex,re.sourceLayerIndex,I.filter,I.layers,I.availableImages,v);for(const W in ge){const pe=V[W]=V[W]||[],ve=ge[W];ve.sort((Ae,Le)=>{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;w<g.length;w++){const C=g[w],I=C.tileID.canonical.key;y[I]||(y[I]=!0,C.querySourceFeatures(v,p))}return v}(s,n):[]}addSourceType(t,n,s){return er.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(er.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const g in t)if(!c.deepEqual(t[g],s[g])){u=!0;break}if(!u)return;const p={now:c.exported.now(),transition:c.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,u,p={}){return(!p||p.validate!==!1)&&Bi(this,t.call(c.validateStyle,c.extend({key:n,style:this.serialize(),value:s,styleSpec:c.v8Spec},u)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const s=this.sourceCaches[n];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,p=!1){let g=!1,v=!1;const y={};for(const w of this._order){const C=this._layers[w];if(C.type!=="symbol")continue;if(!y[C.source]){const F=this.sourceCaches[C.source];y[C.source]=F.getRenderableIds(!0).map(G=>F.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-04967259.js b/assets/main-c3ebdbba.js similarity index 98% rename from assets/main-04967259.js rename to assets/main-c3ebdbba.js index 2981851f..64522bb2 100644 --- a/assets/main-04967259.js +++ b/assets/main-c3ebdbba.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-057e9a81.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-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(` 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;f<m.length;f+=1)c[f]=G(A(l,m,f));return{c(){e=g("pre"),e.textContent=`${JSON.stringify(l[1],null," ")}`,r=y(),t=g("div"),s=E(`OSM nodes: `);for(let f=0;f<c.length;f+=1)c[f].c();n=y(),i=g("div"),o=g("button"),o.textContent="Collapse intersection",O(o,"type","button")},m(f,d){$(f,e,d),$(f,r,d),$(f,t,d),w(t,s);for(let u=0;u<c.length;u+=1)c[u]&&c[u].m(t,null);$(f,n,d),$(f,i,d),w(i,o),a||(p=J(o,"click",l[2]),a=!0)},p(f,[d]){if(d&1){m=N(f[0].properties.osm_node_ids);let u;for(u=0;u<m.length;u+=1){const j=A(f,m,u);c[u]?c[u].p(j,d):(c[u]=G(j),c[u].c(),c[u].m(t,null))}for(;u<c.length;u+=1)c[u].d(1);c.length=m.length}},i:I,o:I,d(f){f&&(_(e),_(r),_(t),_(n),_(i)),Z(c,f),a=!1,p()}}}function Pe(l,e,r){let t;S(l,D,o=>r(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;u<f.length;u+=1)d[u]=z(B(l,f,u));return{c(){e=g("pre"),e.textContent=`${JSON.stringify(l[1],null," ")}`,r=y(),t=g("div"),s=E(`OSM ways: `);for(let u=0;u<d.length;u+=1)d[u].c();n=y(),i=g("div"),o=g("button"),o.textContent="Collapse short road",a=y(),p=g("button"),p.textContent="Zip side-path",O(o,"type","button"),O(p,"type","button")},m(u,j){$(u,e,j),$(u,r,j),$(u,t,j),w(t,s);for(let h=0;h<d.length;h+=1)d[h]&&d[h].m(t,null);$(u,n,j),$(u,i,j),w(i,o),w(i,a),w(i,p),m||(c=[J(o,"click",l[2]),J(p,"click",l[3])],m=!0)},p(u,[j]){if(j&1){f=N(u[0].properties.osm_way_ids);let h;for(h=0;h<f.length;h+=1){const R=B(u,f,h);d[h]?d[h].p(R,j):(d[h]=z(R),d[h].c(),d[h].m(t,null))}for(;h<d.length;h+=1)d[h].d(1);d.length=f.length}},i:I,o:I,d(u){u&&(_(e),_(r),_(t),_(n),_(i)),Z(d,u),m=!1,se(c)}}}function Ee(l,e,r){let t;S(l,D,a=>r(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-bbcfbb64.js b/assets/nested-5844dc17.js similarity index 99% rename from assets/nested-bbcfbb64.js rename to assets/nested-5844dc17.js index 65b048a2..56993d41 100644 --- a/assets/nested-bbcfbb64.js +++ b/assets/nested-5844dc17.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-057e9a81.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=`<osmChange version="0.6" generator="osm2streets"> +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=`<osmChange version="0.6" generator="osm2streets"> `;u+=`<create/> `,u+=`<modify> `;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 0a6dd940..34113dcf 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 19622093..830b941c 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>StreetExplorer</title> - <script type="module" crossorigin src="/osm2streets/assets/main-04967259.js"></script> - <link rel="modulepreload" crossorigin href="/osm2streets/assets/MainLayers-057e9a81.js"> + <script type="module" crossorigin src="/osm2streets/assets/main-c3ebdbba.js"></script> + <link rel="modulepreload" crossorigin href="/osm2streets/assets/MainLayers-fe4bfc4b.js"> <link rel="stylesheet" href="/osm2streets/assets/MainLayers-82f6406d.css"> </head> <body> diff --git a/lane_editor.html b/lane_editor.html index aee4ec8e..3172b3d4 100644 --- a/lane_editor.html +++ b/lane_editor.html @@ -4,8 +4,8 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>osm2streets lane editor</title> - <script type="module" crossorigin src="/osm2streets/assets/nested-bbcfbb64.js"></script> - <link rel="modulepreload" crossorigin href="/osm2streets/assets/MainLayers-057e9a81.js"> + <script type="module" crossorigin src="/osm2streets/assets/nested-5844dc17.js"></script> + <link rel="modulepreload" crossorigin href="/osm2streets/assets/MainLayers-fe4bfc4b.js"> <link rel="stylesheet" href="/osm2streets/assets/MainLayers-82f6406d.css"> </head> <body> diff --git a/tests/lib.rs b/tests/lib.rs index 0d86d591..e41eb2b0 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,15 +1,22 @@ #[cfg(test)] mod tests { - use abstutil::Timer; + use std::sync::Once; + use anyhow::{bail, Result}; + use env_logger::{Builder, Env}; + + use abstutil::Timer; use experimental::RoadNetwork; use geom::LonLat; use osm2streets::{MapConfig, Transformation}; + static SETUP_LOGGER: Once = Once::new(); + include!(concat!(env!("OUT_DIR"), "/tests.rs")); fn test(path: &str) -> Result<()> { - abstutil::logger::setup(); + SETUP_LOGGER + .call_once(|| Builder::from_env(Env::default().default_filter_or("info")).init()); let mut timer = Timer::new("test osm2streets");