diff --git a/assets/main-33e9dbf7.js b/assets/main-c7cf6965.js similarity index 61% rename from assets/main-33e9dbf7.js rename to assets/main-c7cf6965.js index 36604ff..43850ea 100644 --- a/assets/main-33e9dbf7.js +++ b/assets/main-c7cf6965.js @@ -1,7 +1,7 @@ -var IS=Object.defineProperty;var CS=(e,t,n)=>t in e?IS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Zn=(e,t,n)=>(CS(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const f of l.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();function we(){}function Tr(e,t){for(const n in t)e[n]=t[n];return e}function zb(e){return e()}function Fv(){return Object.create(null)}function Wi(e){e.forEach(zb)}function fg(e){return typeof e=="function"}function Ye(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Tm;function hr(e,t){return e===t?!0:(Tm||(Tm=document.createElement("a")),Tm.href=t,e===Tm.href)}function TS(e){return Object.keys(e).length===0}function Fb(e,...t){if(e==null){for(const i of t)i(void 0);return we}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Bb(e){let t;return Fb(e,n=>t=n)(),t}function Ee(e,t,n){e.$$.on_destroy.push(Fb(t,n))}function sr(e,t,n,i){if(e){const r=Vb(e,t,n,i);return e[0](r)}}function Vb(e,t,n,i){return e[1]&&i?Tr(n.ctx.slice(),e[1](i(t))):n.ctx}function ar(e,t,n,i){if(e[2]&&i){const r=e[2](i(n));if(t.dirty===void 0)return r;if(typeof r=="object"){const l=[],f=Math.max(t.dirty.length,r.length);for(let a=0;a32){const t=[],n=e.ctx.length/32;for(let i=0;ie.removeEventListener(t,n,i)}function PS(e){return function(t){return t.preventDefault(),e.call(this,t)}}function It(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function kS(e){return Array.from(e.childNodes)}function qi(e,t){t=""+t,e.data!==t&&(e.data=t)}function jl(e,t){e.value=t??""}function pi(e,t,n,i){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,i?"important":"")}function Zm(e,t,n){for(let i=0;i{const r=e.$$.callbacks[t];if(r){const l=AS(t,n,{cancelable:i});return r.slice().forEach(f=>{f.call(e,l)}),!l.defaultPrevented}return!0}}function Gb(e,t){return ud().$$.context.set(e,t),t}function NS(e){return ud().$$.context.get(e)}function ii(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(i=>i.call(this,t))}const Lh=[],cr=[];let Ah=[];const $_=[],jb=Promise.resolve();let ty=!1;function qb(){ty||(ty=!0,jb.then(Zb))}function DS(){return qb(),jb}function Gp(e){Ah.push(e)}function _c(e){$_.push(e)}const G_=new Set;let Eh=0;function Zb(){if(Eh!==0)return;const e=Up;do{try{for(;Ehe.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Ah=t}const Fm=new Set;let gc;function Ti(){gc={r:0,c:[],p:gc}}function Li(){gc.r||Wi(gc.c),gc=gc.p}function wt(e,t){e&&e.i&&(Fm.delete(e),e.i(t))}function Pt(e,t,n,i){if(e&&e.o){if(Fm.has(e))return;Fm.add(e),gc.c.push(()=>{Fm.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function aa(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function zS(e,t){Pt(e,1,1,()=>{t.delete(e.key)})}function FS(e,t,n,i,r,l,f,a,_,x,S,L){let A=e.length,k=l.length,R=A;const U={};for(;R--;)U[e[R].key]=R;const j=[],Q=new Map,B=new Map,X=[];for(R=k;R--;){const mt=L(r,l,R),_t=n(mt);let ct=f.get(_t);ct?i&&X.push(()=>ct.p(mt,t)):(ct=x(_t,mt),ct.c()),Q.set(_t,j[R]=ct),_t in U&&B.set(_t,Math.abs(R-U[_t]))}const J=new Set,it=new Set;function ft(mt){wt(mt,1),mt.m(a,S),f.set(mt.key,mt),S=mt.first,k--}for(;A&&k;){const mt=j[k-1],_t=e[A-1],ct=mt.key,Mt=_t.key;mt===_t?(S=mt.first,A--,k--):Q.has(Mt)?!f.has(ct)||J.has(ct)?ft(mt):it.has(Mt)?A--:B.get(ct)>B.get(Mt)?(it.add(ct),ft(mt)):(J.add(Mt),A--):(_(_t,f),A--)}for(;A--;){const mt=e[A];Q.has(mt.key)||_(mt,f)}for(;k;)ft(j[k-1]);return Wi(X),j}function Wb(e,t){const n={},i={},r={$$scope:1};let l=e.length;for(;l--;){const f=e[l],a=t[l];if(a){for(const _ in f)_ in a||(i[_]=1);for(const _ in a)r[_]||(n[_]=a[_],r[_]=1);e[l]=a}else for(const _ in f)r[_]=1}for(const f in i)f in n||(n[f]=void 0);return n}function yc(e,t,n){const i=e.$$.props[t];i!==void 0&&(e.$$.bound[i]=n,n(e.$$.ctx[i]))}function Qt(e){e&&e.c()}function Kt(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),Gp(()=>{const l=e.$$.on_mount.map(zb).filter(fg);e.$$.on_destroy?e.$$.on_destroy.push(...l):Wi(l),e.$$.on_mount=[]}),r.forEach(Gp)}function Jt(e,t){const n=e.$$;n.fragment!==null&&(OS(n.after_update),Wi(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function BS(e,t){e.$$.dirty[0]===-1&&(Lh.push(e),qb(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=k.length?k[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=R)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](R),S&&BS(e,L)),A}):[],x.update(),S=!0,Wi(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=kS(t.target);x.fragment&&x.fragment.l(L),L.forEach(kt)}else x.fragment&&x.fragment.c();t.intro&&wt(e.$$.fragment),Kt(e,t.target,t.anchor),Zb()}Rp(_)}class nn{constructor(){Zn(this,"$$");Zn(this,"$$set")}$destroy(){Jt(this,1),this.$destroy=we}$on(t,n){if(!fg(n))return we;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!TS(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const VS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(VS);const US="/ltn/assets/logo-7ace0a42.png";let de;const Xb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Xb.decode();let Ip=null;function Nh(){return(Ip===null||Ip.byteLength===0)&&(Ip=new Uint8Array(de.memory.buffer)),Ip}function ta(e,t){return e=e>>>0,Xb.decode(Nh().subarray(e,e+t))}const Vl=new Array(128).fill(void 0);Vl.push(void 0,null,!0,!1);let Op=Vl.length;function ai(e){Op===Vl.length&&Vl.push(Vl.length+1);const t=Op;return Op=Vl[t],Vl[t]=e,t}function cn(e){return Vl[e]}function GS(e){e<132||(Vl[e]=Op,Op=e)}function hs(e){const t=cn(e);return GS(e),t}let Ts=0;const Bm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},jS=typeof Bm.encodeInto=="function"?function(e,t){return Bm.encodeInto(e,t)}:function(e,t){const n=Bm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Bl(e,t,n){if(n===void 0){const a=Bm.encode(e),_=t(a.length,1)>>>0;return Nh().subarray(_,_+a.length).set(a),Ts=a.length,_}let i=e.length,r=t(i,1)>>>0;const l=Nh();let f=0;for(;f127)break;l[r+f]=a}if(f!==i){f!==0&&(e=e.slice(f)),r=n(r,i,i=f+e.length*3,1)>>>0;const a=Nh().subarray(r+f,r+i),_=jS(e,a);f+=_.written}return Ts=f,r}function Mh(e){return e==null}let Cp=null;function Qe(){return(Cp===null||Cp.byteLength===0)&&(Cp=new Int32Array(de.memory.buffer)),Cp}let Tp=null;function Hb(){return(Tp===null||Tp.byteLength===0)&&(Tp=new Float64Array(de.memory.buffer)),Tp}let Lp=null;function qS(){return(Lp===null||Lp.byteLength===0)&&(Lp=new BigInt64Array(de.memory.buffer)),Lp}function ey(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let l="[";r>0&&(l+=ey(e[0]));for(let f=1;f1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:i}function ZS(e,t){const n=t(e.length*1,1)>>>0;return Nh().set(e,n/1),Ts=e.length,n}function WS(e,t){return e=e>>>0,Hb().subarray(e/8,e/8+t)}function XS(e,t){return e=e>>>0,Nh().subarray(e/1,e/1+t)}function dc(e,t){try{return e.apply(this,t)}catch(n){de.__wbindgen_exn_store(ai(n))}}class HS{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();de.__wbg_ltn_free(t)}constructor(t,n){try{const _=de.__wbindgen_add_to_stack_pointer(-16),x=ZS(t,de.__wbindgen_malloc),S=Ts;var i=Mh(n)?0:Bl(n,de.__wbindgen_malloc,de.__wbindgen_realloc),r=Ts;de.ltn_new(_,x,S,i,r);var l=Qe()[_/4+0],f=Qe()[_/4+1],a=Qe()[_/4+2];if(a)throw hs(f);return this.__wbg_ptr=l>>>0,this}finally{de.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_getInvertedBoundary(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],l=Qe()[x/4+2],f=Qe()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,hs(l);return t=a,n=_,ta(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}getBounds(){try{const r=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_getBounds(r,this.__wbg_ptr);var t=Qe()[r/4+0],n=Qe()[r/4+1],i=WS(t,n).slice();return de.__wbindgen_free(t,n*8,8),i}finally{de.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const r=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_toRouteSnapper(r,this.__wbg_ptr);var t=Qe()[r/4+0],n=Qe()[r/4+1],i=XS(t,n).slice();return de.__wbindgen_free(t,n*1,1),i}finally{de.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_toRouteSnapperGj(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],l=Qe()[x/4+2],f=Qe()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,hs(l);return t=a,n=_,ta(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}renderModalFilters(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_renderModalFilters(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],l=Qe()[x/4+2],f=Qe()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,hs(l);return t=a,n=_,ta(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}renderNeighbourhood(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_renderNeighbourhood(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],l=Qe()[x/4+2],f=Qe()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,hs(l);return t=a,n=_,ta(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}setNeighbourhoodBoundary(t,n){try{const l=de.__wbindgen_add_to_stack_pointer(-16),f=Bl(t,de.__wbindgen_malloc,de.__wbindgen_realloc),a=Ts;de.ltn_setNeighbourhoodBoundary(l,this.__wbg_ptr,f,a,ai(n));var i=Qe()[l/4+0],r=Qe()[l/4+1];if(r)throw hs(i)}finally{de.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(t){const n=Bl(t,de.__wbindgen_malloc,de.__wbindgen_realloc),i=Ts;de.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,n,i)}setCurrentNeighbourhood(t){try{const r=de.__wbindgen_add_to_stack_pointer(-16),l=Bl(t,de.__wbindgen_malloc,de.__wbindgen_realloc),f=Ts;de.ltn_setCurrentNeighbourhood(r,this.__wbg_ptr,l,f);var n=Qe()[r/4+0],i=Qe()[r/4+1];if(i)throw hs(n)}finally{de.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(t,n){try{const l=de.__wbindgen_add_to_stack_pointer(-16),f=Bl(n,de.__wbindgen_malloc,de.__wbindgen_realloc),a=Ts;de.ltn_addModalFilter(l,this.__wbg_ptr,ai(t),f,a);var i=Qe()[l/4+0],r=Qe()[l/4+1];if(r)throw hs(i)}finally{de.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(t,n){try{const l=de.__wbindgen_add_to_stack_pointer(-16),f=Bl(n,de.__wbindgen_malloc,de.__wbindgen_realloc),a=Ts;de.ltn_addManyModalFilters(l,this.__wbg_ptr,ai(t),f,a);var i=Qe()[l/4+0],r=Qe()[l/4+1];if(r)throw hs(i)}finally{de.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(t){de.ltn_deleteModalFilter(this.__wbg_ptr,t)}undo(){de.ltn_undo(this.__wbg_ptr)}redo(){de.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(t){let n,i;try{const S=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,t);var r=Qe()[S/4+0],l=Qe()[S/4+1],f=Qe()[S/4+2],a=Qe()[S/4+3],_=r,x=l;if(a)throw _=0,x=0,hs(f);return n=_,i=x,ta(_,x)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(n,i,1)}}toSavefile(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_toSavefile(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],l=Qe()[x/4+2],f=Qe()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,hs(l);return t=a,n=_,ta(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}loadSavefile(t){try{const r=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_loadSavefile(r,this.__wbg_ptr,ai(t));var n=Qe()[r/4+0],i=Qe()[r/4+1];if(i)throw hs(n)}finally{de.__wbindgen_add_to_stack_pointer(16)}}compareRoute(t,n,i,r){let l,f;try{const k=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_compareRoute(k,this.__wbg_ptr,t,n,i,r);var a=Qe()[k/4+0],_=Qe()[k/4+1],x=Qe()[k/4+2],S=Qe()[k/4+3],L=a,A=_;if(S)throw L=0,A=0,hs(x);return l=L,f=A,ta(L,A)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(l,f,1)}}}async function YS(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function KS(){const e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(ta(t,n));return ai(i)},e.wbg.__wbindgen_string_new=function(t,n){const i=ta(t,n);return ai(i)},e.wbg.__wbindgen_object_drop_ref=function(t){hs(t)},e.wbg.__wbindgen_string_get=function(t,n){const i=cn(n),r=typeof i=="string"?i:void 0;var l=Mh(r)?0:Bl(r,de.__wbindgen_malloc,de.__wbindgen_realloc),f=Ts;Qe()[t/4+1]=f,Qe()[t/4+0]=l},e.wbg.__wbindgen_boolean_get=function(t){const n=cn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_is_bigint=function(t){return typeof cn(t)=="bigint"},e.wbg.__wbindgen_bigint_from_i64=function(t){return ai(t)},e.wbg.__wbindgen_jsval_eq=function(t,n){return cn(t)===cn(n)},e.wbg.__wbindgen_bigint_from_u64=function(t){const n=BigInt.asUintN(64,t);return ai(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=cn(n),r=typeof i=="number"?i:void 0;Hb()[t/8+1]=Mh(r)?0:r,Qe()[t/4+0]=!Mh(r)},e.wbg.__wbindgen_is_object=function(t){const n=cn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_in=function(t,n){return cn(t)in cn(n)},e.wbg.__wbindgen_is_undefined=function(t){return cn(t)===void 0},e.wbg.__wbindgen_object_clone_ref=function(t){const n=cn(t);return ai(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return cn(t)==cn(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const i=cn(t)[cn(n)];return ai(i)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(cn(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(cn(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(cn(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(cn(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(cn(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return ai(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=cn(n).stack,r=Bl(i,de.__wbindgen_malloc,de.__wbindgen_realloc),l=Ts;Qe()[t/4+1]=l,Qe()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(ta(t,n))}finally{de.__wbindgen_free(i,r,1)}},e.wbg.__wbg_performance_3f3012faa4463882=function(t){const n=cn(t).performance;return ai(n)},e.wbg.__wbg_now_2fd65358804c9485=function(t){return cn(t).now()},e.wbg.__wbg_get_f01601b5a68d10e3=function(t,n){const i=cn(t)[n>>>0];return ai(i)},e.wbg.__wbg_length_1009b1af0c481d7b=function(t){return cn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof cn(t)=="function"},e.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(t,n){const i=new Function(ta(t,n));return ai(i)},e.wbg.__wbg_next_9b877f231f476d01=function(t){const n=cn(t).next;return ai(n)},e.wbg.__wbg_next_6529ee0cca8d57ed=function(){return dc(function(t){const n=cn(t).next();return ai(n)},arguments)},e.wbg.__wbg_done_5fe336b092d60cf2=function(t){return cn(t).done},e.wbg.__wbg_value_0c248a78fdc8e19f=function(t){const n=cn(t).value;return ai(n)},e.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return ai(Symbol.iterator)},e.wbg.__wbg_get_7b48513de5dc5ea4=function(){return dc(function(t,n){const i=Reflect.get(cn(t),cn(n));return ai(i)},arguments)},e.wbg.__wbg_call_90c26b09837aba1c=function(){return dc(function(t,n){const i=cn(t).call(cn(n));return ai(i)},arguments)},e.wbg.__wbg_self_f0e34d89f33b99fd=function(){return dc(function(){const t=self.self;return ai(t)},arguments)},e.wbg.__wbg_window_d3b084224f4774d7=function(){return dc(function(){const t=window.window;return ai(t)},arguments)},e.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return dc(function(){const t=globalThis.globalThis;return ai(t)},arguments)},e.wbg.__wbg_global_35dfdd59a4da3e74=function(){return dc(function(){const t=global.global;return ai(t)},arguments)},e.wbg.__wbg_isArray_74fb723e24f76012=function(t){return Array.isArray(cn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=cn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(t){return Number.isSafeInteger(cn(t))},e.wbg.__wbg_entries_9e2e2aa45aa5094a=function(t){const n=Object.entries(cn(t));return ai(n)},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=cn(t).buffer;return ai(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(cn(t));return ai(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,i){cn(t).set(cn(n),i>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return cn(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=cn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_bigint_get_as_i64=function(t,n){const i=cn(n),r=typeof i=="bigint"?i:void 0;qS()[t/8+1]=Mh(r)?BigInt(0):r,Qe()[t/4+0]=!Mh(r)},e.wbg.__wbindgen_debug_string=function(t,n){const i=ey(cn(n)),r=Bl(i,de.__wbindgen_malloc,de.__wbindgen_realloc),l=Ts;Qe()[t/4+1]=l,Qe()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(ta(t,n))},e.wbg.__wbindgen_memory=function(){const t=de.memory;return ai(t)},e}function JS(e,t){return de=e.exports,Yb.__wbindgen_wasm_module=t,Lp=null,Tp=null,Cp=null,Ip=null,de}async function Yb(e){if(de!==void 0)return de;typeof e>"u"&&(e="/ltn/assets/backend_bg.wasm");const t=KS();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await YS(await e,t);return JS(n,i)}let He;const Kb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Kb.decode();let Mp=null;function zp(){return(Mp===null||Mp.byteLength===0)&&(Mp=new Uint8Array(He.memory.buffer)),Mp}function Ul(e,t){return e=e>>>0,Kb.decode(zp().subarray(e,e+t))}const Gl=new Array(128).fill(void 0);Gl.push(void 0,null,!0,!1);let Fp=Gl.length;function Fr(e){Fp===Gl.length&&Gl.push(Gl.length+1);const t=Fp;return Fp=Gl[t],Gl[t]=e,t}function Ln(e){return Gl[e]}function QS(e){e<132||(Gl[e]=Fp,Fp=e)}function Vm(e){const t=Ln(e);return QS(e),t}function j_(e){return e==null}let Pp=null;function $S(){return(Pp===null||Pp.byteLength===0)&&(Pp=new Float64Array(He.memory.buffer)),Pp}let kp=null;function Ii(){return(kp===null||kp.byteLength===0)&&(kp=new Int32Array(He.memory.buffer)),kp}let Lu=0;const Um=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},tE=typeof Um.encodeInto=="function"?function(e,t){return Um.encodeInto(e,t)}:function(e,t){const n=Um.encode(e);return t.set(n),{read:e.length,written:n.length}};function Lm(e,t,n){if(n===void 0){const a=Um.encode(e),_=t(a.length,1)>>>0;return zp().subarray(_,_+a.length).set(a),Lu=a.length,_}let i=e.length,r=t(i,1)>>>0;const l=zp();let f=0;for(;f127)break;l[r+f]=a}if(f!==i){f!==0&&(e=e.slice(f)),r=n(r,i,i=f+e.length*3,1)>>>0;const a=zp().subarray(r+f,r+i),_=tE(e,a);f+=_.written}return Lu=f,r}function ny(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let l="[";r>0&&(l+=ny(e[0]));for(let f=1;f1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:i}function eE(e,t){const n=t(e.length*1,1)>>>0;return zp().set(e,n/1),Lu=e.length,n}function q_(e,t){try{return e.apply(this,t)}catch(n){He.__wbindgen_exn_store(Fr(n))}}class Wm{static __wrap(t){t=t>>>0;const n=Object.create(Wm.prototype);return n.__wbg_ptr=t,n}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();He.__wbg_jsroutesnapper_free(t)}constructor(t){try{const l=He.__wbindgen_add_to_stack_pointer(-16),f=eE(t,He.__wbindgen_malloc),a=Lu;He.jsroutesnapper_new(l,f,a);var n=Ii()[l/4+0],i=Ii()[l/4+1],r=Ii()[l/4+2];if(r)throw Vm(i);return Wm.__wrap(n)}finally{He.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(t){He.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Fr(t))}setAreaMode(){He.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let t,n;try{const l=He.__wbindgen_add_to_stack_pointer(-16);He.jsroutesnapper_getConfig(l,this.__wbg_ptr);var i=Ii()[l/4+0],r=Ii()[l/4+1];return t=i,n=r,Ul(i,r)}finally{He.__wbindgen_add_to_stack_pointer(16),He.__wbindgen_free(t,n,1)}}toFinalFeature(){try{const i=He.__wbindgen_add_to_stack_pointer(-16);He.jsroutesnapper_toFinalFeature(i,this.__wbg_ptr);var t=Ii()[i/4+0],n=Ii()[i/4+1];let r;return t!==0&&(r=Ul(t,n).slice(),He.__wbindgen_free(t,n*1)),r}finally{He.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let t,n;try{const l=He.__wbindgen_add_to_stack_pointer(-16);He.jsroutesnapper_renderGeojson(l,this.__wbg_ptr);var i=Ii()[l/4+0],r=Ii()[l/4+1];return t=i,n=r,Ul(i,r)}finally{He.__wbindgen_add_to_stack_pointer(16),He.__wbindgen_free(t,n,1)}}toggleSnapMode(){He.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(t,n,i){return He.jsroutesnapper_onMouseMove(this.__wbg_ptr,t,n,i)!==0}onClick(){He.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return He.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return He.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){He.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(t){try{const r=He.__wbindgen_add_to_stack_pointer(-16);He.jsroutesnapper_editExisting(r,this.__wbg_ptr,Fr(t));var n=Ii()[r/4+0],i=Ii()[r/4+1];if(i)throw Vm(n)}finally{He.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let t,n;try{const l=He.__wbindgen_add_to_stack_pointer(-16);He.jsroutesnapper_debugRenderGraph(l,this.__wbg_ptr);var i=Ii()[l/4+0],r=Ii()[l/4+1];return t=i,n=r,Ul(i,r)}finally{He.__wbindgen_add_to_stack_pointer(16),He.__wbindgen_free(t,n,1)}}routeNameForWaypoints(t){let n,i;try{const S=He.__wbindgen_add_to_stack_pointer(-16);He.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Fr(t));var r=Ii()[S/4+0],l=Ii()[S/4+1],f=Ii()[S/4+2],a=Ii()[S/4+3],_=r,x=l;if(a)throw _=0,x=0,Vm(f);return n=_,i=x,Ul(_,x)}finally{He.__wbindgen_add_to_stack_pointer(16),He.__wbindgen_free(n,i,1)}}addSnappedWaypoint(t,n){He.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,t,n)}undo(){He.jsroutesnapper_undo(this.__wbg_ptr)}}async function nE(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function iE(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const i=Ul(t,n);return Fr(i)},e.wbg.__wbindgen_object_drop_ref=function(t){Vm(t)},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(Ul(t,n));return Fr(i)},e.wbg.__wbindgen_is_object=function(t){const n=Ln(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return Ln(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return Ln(t)in Ln(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=Ln(n),r=typeof i=="number"?i:void 0;$S()[t/8+1]=j_(r)?0:r,Ii()[t/4+0]=!j_(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=Ln(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_object_clone_ref=function(t){const n=Ln(t);return Fr(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return Ln(t)==Ln(n)},e.wbg.__wbindgen_string_get=function(t,n){const i=Ln(n),r=typeof i=="string"?i:void 0;var l=j_(r)?0:Lm(r,He.__wbindgen_malloc,He.__wbindgen_realloc),f=Lu;Ii()[t/4+1]=f,Ii()[t/4+0]=l},e.wbg.__wbg_String_4370c5505c674d30=function(t,n){const i=String(Ln(n)),r=Lm(i,He.__wbindgen_malloc,He.__wbindgen_realloc),l=Lu;Ii()[t/4+1]=l,Ii()[t/4+0]=r},e.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(t,n){const i=Ln(t)[Ln(n)];return Fr(i)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Fr(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=Ln(n).stack,r=Lm(i,He.__wbindgen_malloc,He.__wbindgen_realloc),l=Lu;Ii()[t/4+1]=l,Ii()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(Ul(t,n))}finally{He.__wbindgen_free(i,r,1)}},e.wbg.__wbg_debug_9a6b3243fbbebb61=function(t){console.debug(Ln(t))},e.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(Ln(t))},e.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(Ln(t))},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(Ln(t))},e.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(Ln(t))},e.wbg.__wbg_get_44be0491f933a435=function(t,n){const i=Ln(t)[n>>>0];return Fr(i)},e.wbg.__wbg_length_fff51ee6522a1a18=function(t){return Ln(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof Ln(t)=="function"},e.wbg.__wbg_next_526fc47e980da008=function(t){const n=Ln(t).next;return Fr(n)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return q_(function(t){const n=Ln(t).next();return Fr(n)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Ln(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){const n=Ln(t).value;return Fr(n)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Fr(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return q_(function(t,n){const i=Reflect.get(Ln(t),Ln(n));return Fr(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return q_(function(t,n){const i=Ln(t).call(Ln(n));return Fr(i)},arguments)},e.wbg.__wbg_isArray_4c24b343cb13cfb1=function(t){return Array.isArray(Ln(t))},e.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let n;try{n=Ln(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const n=Ln(t).buffer;return Fr(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){const n=new Uint8Array(Ln(t));return Fr(n)},e.wbg.__wbg_set_5cf90238115182c3=function(t,n,i){Ln(t).set(Ln(n),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Ln(t).length},e.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let n;try{n=Ln(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const i=ny(Ln(n)),r=Lm(i,He.__wbindgen_malloc,He.__wbindgen_realloc),l=Lu;Ii()[t/4+1]=l,Ii()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(Ul(t,n))},e.wbg.__wbindgen_memory=function(){const t=He.memory;return Fr(t)},e}function rE(e,t){return He=e.exports,Jb.__wbindgen_wasm_module=t,Pp=null,kp=null,Mp=null,He}async function Jb(e){if(He!==void 0)return He;typeof e>"u"&&(e="/ltn/assets/route_snapper_bg.wasm");const t=iE();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await nE(await e,t);return rE(n,i)}const Ih=[];function Z_(e,t){return{subscribe:li(e,t).subscribe}}function li(e,t=we){let n;const i=new Set;function r(a){if(Ye(e,a)&&(e=a,n)){const _=!Ih.length;for(const x of i)x[1](),Ih.push(x,e);if(_){for(let x=0;x{i.delete(x),i.size===0&&n&&(n(),n=null)}}return{set:r,update:l,subscribe:f}}let oE=Date.now();function rf(e){return`${e}-${oE++}`}const Ty=Symbol.for("svelte-maplibre");function of(){return NS(Ty)}function sE(e){let t=new WeakMap;return n=>{var f;let i=t.get(n.originalEvent);if(i!==void 0)return i;let l=(f=n.target.queryRenderedFeatures(n.point).find(a=>{var _;return(_=e.get(a.layer.id))==null?void 0:_.interactive}))==null?void 0:f.layer.id;return t.set(n.originalEvent,l),l}}function aE(){let e=new Map;return Gb(Ty,{map:li(null),source:Z_(null),layer:Z_(null),popupTarget:Z_(null),cluster:li(),loadedImages:li(new Set),minzoom:li(0),maxzoom:li(24),layerEvent:li(null),layerInfo:e,eventTopMost:sE(e)})}function Bv(e){return{subscribe:e.subscribe}}function Ly({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:i=!1}){let r=of(),l=li(null),f=Bv(l),a={...r,[e]:Bv(l)};if(t&&(a.popupTarget=f),i){let _=li(null);a.layerEvent=_,r.layerEvent=_}return n&&(a.cluster=li()),Gb(Ty,a),{...r,self:l}}function lE(){return Ly({key:"source",setCluster:!0})}function uE(e=!0){return Ly({key:"layer",setPopupTarget:e,setMouseEvent:e})}function cE(){return Ly({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function hE(e){return"layerType"in e&&e.layerType==="deckgl"}var Qb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tx(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var ex={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Qb,function(){var n,i,r;function l(a,_){if(!n)n=_;else if(!i)i=_;else{var x="var sharedChunk = {}; ("+n+")(sharedChunk); ("+i+")(sharedChunk);",S={};n(S),r=_(S),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([x],{type:"text/javascript"})))}}l(["exports"],function(a){function _(u,o,c,p){return new(c||(c=Promise))(function(m,v){function w(P){try{T(p.next(P))}catch(D){v(D)}}function E(P){try{T(p.throw(P))}catch(D){v(D)}}function T(P){var D;P.done?m(P.value):(D=P.value,D instanceof c?D:new c(function(F){F(D)})).then(w,E)}T((p=p.apply(u,o||[])).next())})}function x(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}typeof SuppressedError=="function"&&SuppressedError;var S=L;function L(u,o){this.x=u,this.y=o}L.prototype={clone:function(){return new L(this.x,this.y)},add:function(u){return this.clone()._add(u)},sub:function(u){return this.clone()._sub(u)},multByPoint:function(u){return this.clone()._multByPoint(u)},divByPoint:function(u){return this.clone()._divByPoint(u)},mult:function(u){return this.clone()._mult(u)},div:function(u){return this.clone()._div(u)},rotate:function(u){return this.clone()._rotate(u)},rotateAround:function(u,o){return this.clone()._rotateAround(u,o)},matMult:function(u){return this.clone()._matMult(u)},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(u){return this.x===u.x&&this.y===u.y},dist:function(u){return Math.sqrt(this.distSqr(u))},distSqr:function(u){var o=u.x-this.x,c=u.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(u){return Math.atan2(this.y-u.y,this.x-u.x)},angleWith:function(u){return this.angleWithSep(u.x,u.y)},angleWithSep:function(u,o){return Math.atan2(this.x*o-this.y*u,this.x*u+this.y*o)},_matMult:function(u){var o=u[2]*this.x+u[3]*this.y;return this.x=u[0]*this.x+u[1]*this.y,this.y=o,this},_add:function(u){return this.x+=u.x,this.y+=u.y,this},_sub:function(u){return this.x-=u.x,this.y-=u.y,this},_mult:function(u){return this.x*=u,this.y*=u,this},_div:function(u){return this.x/=u,this.y/=u,this},_multByPoint:function(u){return this.x*=u.x,this.y*=u.y,this},_divByPoint:function(u){return this.x/=u.x,this.y/=u.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var u=this.y;return this.y=this.x,this.x=-u,this},_rotate:function(u){var o=Math.cos(u),c=Math.sin(u),p=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=p,this},_rotateAround:function(u,o){var c=Math.cos(u),p=Math.sin(u),m=o.y+p*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-p*(this.y-o.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},L.convert=function(u){return u instanceof L?u:Array.isArray(u)?new L(u[0],u[1]):u};var A=x(S),k=R;function R(u,o,c,p){this.cx=3*u,this.bx=3*(c-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=o,this.p2x=c,this.p2y=p}R.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,o){if(o===void 0&&(o=1e-6),u<0)return 0;if(u>1)return 1;for(var c=u,p=0;p<8;p++){var m=this.sampleCurveX(c)-u;if(Math.abs(m)m?w=c:E=c,c=.5*(E-w)+w;return c},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var U=x(k);let j,Q;function B(){return j==null&&(j=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),j}function X(){if(Q==null&&(Q=!1,B())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const m=4*p;o.fillStyle=`rgb(${m},${m+1},${m+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){Q=!0;break}}}return Q||!1}function J(u,o,c,p){const m=new U(u,o,c,p);return function(v){return m.solve(v)}}const it=J(.25,.1,.25,1);function ft(u,o,c){return Math.min(c,Math.max(o,u))}function mt(u,o,c){const p=c-o,m=((u-o)%p+p)%p+o;return m===o?c:m}function _t(u,...o){for(const c of o)for(const p in c)u[p]=c[p];return u}let ct=1;function Mt(u,o,c){const p={};for(const m in u)p[m]=o.call(c||this,u[m],m,u);return p}function xt(u,o,c){const p={};for(const m in u)o.call(c||this,u[m],m,u)&&(p[m]=u[m]);return p}function vt(u){return Array.isArray(u)?u.map(vt):typeof u=="object"&&u?Mt(u,vt):u}const me={};function Rt(u){me[u]||(typeof console<"u"&&console.warn(u),me[u]=!0)}function Gt(u,o,c){return(c.y-u.y)*(o.x-u.x)>(o.y-u.y)*(c.x-u.x)}function te(u){let o=0;for(let c,p,m=0,v=u.length,w=v-1;m"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(u,{timestamp:0});try{const w=v==null?void 0:v.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const E=w.startsWith("BGR"),T=new Uint8ClampedArray(p*m*4);if(yield v.copyTo(T,function(P,D,F,G,H){const Y=4*Math.max(-D,0),tt=(Math.max(0,F)-F)*G*4+Y,ut=4*G,pt=Math.max(0,D),Lt=Math.max(0,F);return{rect:{x:pt,y:Lt,width:Math.min(P.width,D+G)-pt,height:Math.min(P.height,F+H)-Lt},layout:[{offset:tt,stride:ut}]}}(u,o,c,p,m)),E)for(let P=0;PcancelAnimationFrame(o)}},getImageData(u,o=0){return this.getImageCanvasContext(u).getImageData(-o,-o,u.width+2*o,u.height+2*o)},getImageCanvasContext(u){const o=window.document.createElement("canvas"),c=o.getContext("2d",{willReadFrequently:!0});if(!c)throw new Error("failed to create canvas 2d context");return o.width=u.width,o.height=u.height,c.drawImage(u,0,0,u.width,u.height),c},resolveURL:u=>(fn||(fn=document.createElement("a")),fn.href=u,fn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Jn==null&&(Jn=matchMedia("(prefers-reduced-motion: reduce)")),Jn.matches)}},ie={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class De extends Error{constructor(o,c,p,m){super(`AJAXError: ${c} (${o}): ${p}`),this.status=o,this.statusText=c,this.url=p,this.body=m}}const hn=se()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,On=u=>ie.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf("://"))];function mi(u,o){const c=new AbortController,p=new Request(u.url,{method:u.method||"GET",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:hn(),signal:c.signal});let m=!1,v=!1;return u.type==="json"&&p.headers.set("Accept","application/json"),v||fetch(p).then(w=>w.ok?(E=>{(u.type==="arrayBuffer"||u.type==="image"?E.arrayBuffer():u.type==="json"?E.json():E.text()).then(T=>{v||(m=!0,o(null,T,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(T=>{v||o(new Error(T.message))})})(w):w.blob().then(E=>o(new De(w.status,w.statusText,u.url,E)))).catch(w=>{w.code!==20&&o(new Error(w.message))}),{cancel:()=>{v=!0,m||c.abort()}}}const wn=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(se()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,o);if(!se())return(On(u.url)||mi)(u,o)}if(!(/^file:/.test(c=u.url)||/^file:/.test(hn())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mi(u,o);if(se()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,o,void 0,!0)}var c;return function(p,m){const v=new XMLHttpRequest;v.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(v.responseType="arraybuffer");for(const w in p.headers)v.setRequestHeader(w,p.headers[w]);return p.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=p.credentials==="include",v.onerror=()=>{m(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let w=v.response;if(p.type==="json")try{w=JSON.parse(v.response)}catch(E){return m(E)}m(null,w,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else{const w=new Blob([v.response],{type:v.getResponseHeader("Content-Type")});m(new De(v.status,v.statusText,p.url,w))}},v.send(p.body),{cancel:()=>v.abort()}}(u,o)},gt=function(u,o){return wn(_t(u,{type:"arrayBuffer"}),o)};function Ie(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function qe(u,o,c){c[u]&&c[u].indexOf(o)!==-1||(c[u]=c[u]||[],c[u].push(o))}function nr(u,o,c){if(c&&c[u]){const p=c[u].indexOf(o);p!==-1&&c[u].splice(p,1)}}class Xn{constructor(o,c={}){_t(this,c),this.type=o}}class pn extends Xn{constructor(o,c={}){super("error",_t({error:o},c))}}class Xi{on(o,c){return this._listeners=this._listeners||{},qe(o,c,this._listeners),this}off(o,c){return nr(o,c,this._listeners),nr(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},qe(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new Xn(o,c||{}));const p=o.type;if(this.listens(p)){o.target=this;const m=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of m)E.call(this,o);const v=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of v)nr(p,E,this._oneTimeListeners),E.call(this,o);const w=this._eventedParent;w&&(_t(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof pn&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var jt={$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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},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 Fi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function fr(u,o){const c={};for(const p in u)p!=="ref"&&(c[p]=u[p]);return Fi.forEach(p=>{p in o&&(c[p]=o[p])}),c}function zn(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let c=0;c`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Ct=[xs,ue,ln,Je,Ar,st,ns,Z(on),V,q,K];function yt(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!yt(u.itemType,o.itemType))&&(typeof u.N!="number"||u.N===o.N))return null}else{if(u.kind===o.kind)return null;if(u.kind==="value"){for(const c of Ct)if(!yt(c,o))return null}}return`Expected ${ot(u)} but found ${ot(o)} instead.`}function rt(u,o){return o.some(c=>c.kind===u.kind)}function St(u,o){return o.some(c=>c==="null"?u===null:c==="array"?Array.isArray(u):c==="object"?u&&!Array.isArray(u)&&typeof u=="object":c===typeof u)}function qt(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const Wt=.96422,Ht=.82521,Ne=4/29,Ke=6/29,Te=3*Ke*Ke,Ve=Ke*Ke*Ke,rn=Math.PI/180,Gn=180/Math.PI;function Qn(u){return(u%=360)<0&&(u+=360),u}function kn([u,o,c,p]){let m,v;const w=qr((.2225045*(u=Pn(u))+.7168786*(o=Pn(o))+.0606169*(c=Pn(c)))/1);u===o&&o===c?m=v=w:(m=qr((.4360747*u+.3850649*o+.1430804*c)/Wt),v=qr((.0139322*u+.0971045*o+.7141733*c)/Ht));const E=116*w-16;return[E<0?0:E,500*(m-w),200*(w-v),p]}function Pn(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function qr(u){return u>Ve?Math.pow(u,1/3):u/Te+Ne}function oi([u,o,c,p]){let m=(u+16)/116,v=isNaN(o)?m:m+o/500,w=isNaN(c)?m:m-c/200;return m=1*Nr(m),v=Wt*Nr(v),w=Ht*Nr(w),[ir(3.1338561*v-1.6168667*m-.4906146*w),ir(-.9787684*v+1.9161415*m+.033454*w),ir(.0719453*v-.2289914*m+1.4052427*w),p]}function ir(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function Nr(u){return u>Ke?u*u*u:Te*(u-Ne)}function is(u){return parseInt(u.padEnd(2,u),16)/255}function bd(u,o){return ru(o?u/100:u,0,1)}function ru(u,o,c){return Math.min(Math.max(o,u),c)}function ou(u){return!u.some(Number.isNaN)}const Rg={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 Hn{constructor(o,c,p,m=1,v=!0){this.r=o,this.g=c,this.b=p,this.a=m,v||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[o,c,p,m]))}static parse(o){if(o instanceof Hn)return o;if(typeof o!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=Rg[p];if(m){const[w,E,T]=m;return[w/255,E/255,T/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const w=p.length<6?1:2;let E=1;return[is(p.slice(E,E+=w)),is(p.slice(E,E+=w)),is(p.slice(E,E+=w)),is(p.slice(E,E+w)||"ff")]}if(p.startsWith("rgb")){const w=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[E,T,P,D,F,G,H,Y,tt,ut,pt,Lt]=w,bt=[D||" ",H||" ",ut].join("");if(bt===" "||bt===" /"||bt===",,"||bt===",,,"){const Nt=[P,G,tt].join(""),Ft=Nt==="%%%"?100:Nt===""?255:0;if(Ft){const Yt=[ru(+T/Ft,0,1),ru(+F/Ft,0,1),ru(+Y/Ft,0,1),pt?bd(+pt,Lt):1];if(ou(Yt))return Yt}}return}}const v=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[w,E,T,P,D,F,G,H,Y]=v,tt=[T||" ",D||" ",G].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ut=[+E,ru(+P,0,100),ru(+F,0,100),H?bd(+H,Y):1];if(ou(ut))return function([pt,Lt,bt,Nt]){function Ft(Yt){const ye=(Yt+pt/30)%12,Me=Lt*Math.min(bt,1-bt);return bt-Me*Math.max(-1,Math.min(ye-3,9-ye,1))}return pt=Qn(pt),Lt/=100,bt/=100,[Ft(0),Ft(8),Ft(4),Nt]}(ut)}}}(o);return c?new Hn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:p,a:m}=this,v=m||1/0;return this.overwriteGetter("rgb",[o/v,c/v,p/v,m])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,p,m,v]=kn(o),w=Math.sqrt(p*p+m*m);return[Math.round(1e4*w)?Qn(Math.atan2(m,p)*Gn):NaN,w,c,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",kn(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,p,m]=this.rgb;return`rgba(${[o,c,p].map(v=>Math.round(255*v)).join(",")},${m})`}}Hn.black=new Hn(0,0,0,1),Hn.white=new Hn(1,1,1,1),Hn.transparent=new Hn(0,0,0,0),Hn.red=new Hn(1,0,0,1);class df{constructor(o,c,p){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Bc{constructor(o,c,p,m,v){this.text=o,this.image=c,this.scale=p,this.fontStack=m,this.textColor=v}}class Zr{constructor(o){this.sections=o}static fromString(o){return new Zr([new Bc(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Zr?o:Zr.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class No{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof No)return o;if(typeof o=="number")return new No([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new No(o)}}toString(){return JSON.stringify(this.values)}}const Og=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class rs{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof rs)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&u<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,o,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,c,p]:[u,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function su(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof Hn||u instanceof df||u instanceof Zr||u instanceof No||u instanceof rs||u instanceof Dr)return!0;if(Array.isArray(u)){for(const o of u)if(!su(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!su(u[o]))return!1;return!0}return!1}function xi(u){if(u===null)return xs;if(typeof u=="string")return ln;if(typeof u=="boolean")return Je;if(typeof u=="number")return ue;if(u instanceof Hn)return Ar;if(u instanceof df)return ws;if(u instanceof Zr)return st;if(u instanceof No)return V;if(u instanceof rs)return K;if(u instanceof Dr)return q;if(Array.isArray(u)){const o=u.length;let c;for(const p of u){const m=xi(p);if(c){if(c===m)continue;c=on;break}c=m}return Z(c||on,o)}return ns}function Fn(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Hn||u instanceof Zr||u instanceof No||u instanceof rs||u instanceof Dr?u.toString():JSON.stringify(u)}class wl{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!su(o[1]))return c.error("invalid value");const p=o[1];let m=xi(p);const v=c.expectedType;return m.kind!=="array"||m.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(m=v),new wl(m,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ki{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Uc={string:ln,number:ue,boolean:Je,object:ns};class os{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let p,m=1;const v=o[0];if(v==="array"){let E,T;if(o.length>2){const P=o[1];if(typeof P!="string"||!(P in Uc)||P==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Uc[P],m++}else E=on;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);T=o[2],m++}p=Z(E,T)}else{if(!Uc[v])throw new Error(`Types doesn't contain name = ${v}`);p=Uc[v]}const w=[];for(;mo.outputDefined())}}const mf={"to-boolean":Je,"to-color":Ar,"to-number":ue,"to-string":ln};class Ya{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[0];if(!mf[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return c.error("Expected one argument.");const m=mf[p],v=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Vc(c[0],c[1],c[2],c[3]),!p))return new Hn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new ki(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(o);const m=No.parse(c);if(m)return m}throw new ki(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(o);const m=rs.parse(c);if(m)return m}throw new ki(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(o),c===null)return 0;const m=Number(c);if(!isNaN(m))return m}throw new ki(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Zr.fromString(Fn(this.args[0].evaluate(o)));case"resolvedImage":return Dr.fromString(Fn(this.args[0].evaluate(o)));default:return Fn(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const xd=["Unknown","Point","LineString","Polygon"];class gf{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"?xd[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(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=Hn.parse(o)),c}}class Gc{constructor(o,c,p=[],m,v=new Sa,w=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=v,this.errors=w,this.expectedType=m,this._isConstant=c}parse(o,c,p,m,v={}){return c?this.concat(c,p,m)._parse(o,v):this._parse(o,v)}_parse(o,c){function p(m,v,w){return w==="assert"?new os(v,[m]):w==="coerce"?new Ya(v,[m]):m}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=o[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[m];if(v){let w=v.parse(o,this);if(!w)return null;if(this.expectedType){const E=this.expectedType,T=w.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||T.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||T.kind!=="value"&&T.kind!=="string")if(E.kind!=="padding"||T.kind!=="value"&&T.kind!=="number"&&T.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||T.kind!=="value"&&T.kind!=="array"){if(this.checkSubtype(E,T))return null}else w=p(w,E,c.typeAnnotation||"coerce");else w=p(w,E,c.typeAnnotation||"coerce");else w=p(w,E,c.typeAnnotation||"coerce");else w=p(w,E,c.typeAnnotation||"assert")}if(!(w instanceof wl)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const E=new gf;try{w=new wl(w.type,w.evaluate(E))}catch(T){return this.error(T.message),null}}return w}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,p){const m=typeof o=="number"?this.path.concat(o):this.path,v=p?this.scope.concat(p):this.scope;return new Gc(this.registry,this._isConstant,m,c||null,v,this.errors)}error(o,...c){const p=`${this.key}${c.map(m=>`[${m}]`).join("")}`;this.errors.push(new ri(p,o))}checkSubtype(o,c){const p=yt(o,c);return p&&this.error(p),p}}class jc{constructor(o,c,p){this.type=ws,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const m=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Je);if(!m)return null;const v=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Je);if(!v)return null;let w=null;return p.locale&&(w=c.parse(p.locale,1,ln),!w)?null:new jc(m,v,w)}evaluate(o){return new df(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ka=8192;function _f(u,o){u[0]=Math.min(u[0],o[0]),u[1]=Math.min(u[1],o[1]),u[2]=Math.max(u[2],o[0]),u[3]=Math.max(u[3],o[1])}function Xu(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function wd(u,o){const c=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,m=Math.pow(2,o.z);return[Math.round(c*m*Ka),Math.round(p*m*Ka)]}function zg(u,o,c){const p=u[0]-o[0],m=u[1]-o[1],v=u[0]-c[0],w=u[1]-c[1];return p*w-v*m==0&&p*v<=0&&m*w<=0}function yf(u,o){let c=!1;for(let w=0,E=o.length;w(p=u)[1]!=(v=T[P+1])[1]>p[1]&&p[0]<(v[0]-m[0])*(p[1]-m[1])/(v[1]-m[1])+m[0]&&(c=!c)}}var p,m,v;return c}function vf(u,o){for(let c=0;c0&&E<0||w<0&&E>0}function Fg(u,o,c){for(const P of c)for(let D=0;Dc[2]){const m=.5*p;let v=u[0]-c[0]>m?-p:c[0]-u[0]>m?p:0;v===0&&(v=u[0]-c[2]>m?-p:c[2]-u[0]>m?p:0),u[0]+=v}_f(o,u)}function bf(u,o,c,p){const m=Math.pow(2,p.z)*Ka,v=[p.x*Ka,p.y*Ka],w=[];for(const E of u)for(const T of E){const P=[T.x+v[0],T.y+v[1]];Td(P,o,c,m),w.push(P)}return w}function xf(u,o,c,p){const m=Math.pow(2,p.z)*Ka,v=[p.x*Ka,p.y*Ka],w=[];for(const T of u){const P=[];for(const D of T){const F=[D.x+v[0],D.y+v[1]];_f(o,F),P.push(F)}w.push(P)}if(o[2]-o[0]<=m/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const T of w)for(const P of T)Td(P,o,c,m)}var E;return w}class Sl{constructor(o,c){this.type=Je,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(su(o[1])){const p=o[1];if(p.type==="FeatureCollection")for(let m=0;m!Array.isArray(P)||P.length===o.length-1);let T=null;for(const[P,D]of E){T=new Gc(c.registry,Wc,c.path,null,c.scope);const F=[];let G=!1;for(let H=1;H{return G=F,Array.isArray(G)?`(${G.map(ot).join(", ")})`:`(${ot(G.type)}...)`;var G}).join(" | "),D=[];for(let F=1;F{c=o?c&&Wc(p):c&&p instanceof wl}),!!c&&Xc(u)&&Hc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xc(u){if(u instanceof ss&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof Sl)return!1;let o=!0;return u.eachChild(c=>{o&&!Xc(c)&&(o=!1)}),o}function Hu(u){if(u instanceof ss&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(c=>{o&&!Hu(c)&&(o=!1)}),o}function Hc(u,o){if(u instanceof ss&&o.indexOf(u.name)>=0)return!1;let c=!0;return u.eachChild(p=>{c&&!Hc(p,o)&&(c=!1)}),c}function au(u,o){const c=u.length-1;let p,m,v=0,w=c,E=0;for(;v<=w;)if(E=Math.floor((v+w)/2),p=u[E],m=u[E+1],p<=o){if(E===c||oo))throw new ki("Input is not a number.");w=E-1}return 0}class Ja{constructor(o,c,p){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[m,v]of p)this.labels.push(m),this.outputs.push(v)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const p=c.parse(o[1],1,ue);if(!p)return null;const m=[];let v=null;c.expectedType&&c.expectedType.kind!=="value"&&(v=c.expectedType);for(let w=1;w=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',P);const F=c.parse(T,D,v);if(!F)return null;v=v||F.type,m.push([E,F])}return new Ja(v,p,m)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return p[0].evaluate(o);const v=c.length;return m>=c[v-1]?p[v-1].evaluate(o):p[au(c,m)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Cn(u,o,c){return u+c*(o-u)}function Yc(u,o,c){return u.map((p,m)=>Cn(p,o[m],c))}const Do={number:Cn,color:function(u,o,c,p="rgb"){switch(p){case"rgb":{const[m,v,w,E]=Yc(u.rgb,o.rgb,c);return new Hn(m,v,w,E,!1)}case"hcl":{const[m,v,w,E]=u.hcl,[T,P,D,F]=o.hcl;let G,H;if(isNaN(m)||isNaN(T))isNaN(m)?isNaN(T)?G=NaN:(G=T,w!==1&&w!==0||(H=P)):(G=m,D!==1&&D!==0||(H=v));else{let Lt=T-m;T>m&&Lt>180?Lt-=360:T180&&(Lt+=360),G=m+c*Lt}const[Y,tt,ut,pt]=function([Lt,bt,Nt,Ft]){return Lt=isNaN(Lt)?0:Lt*rn,oi([Nt,Math.cos(Lt)*bt,Math.sin(Lt)*bt,Ft])}([G,H??Cn(v,P,c),Cn(w,D,c),Cn(E,F,c)]);return new Hn(Y,tt,ut,pt,!1)}case"lab":{const[m,v,w,E]=oi(Yc(u.lab,o.lab,c));return new Hn(m,v,w,E,!1)}}},array:Yc,padding:function(u,o,c){return new No(Yc(u.values,o.values,c))},variableAnchorOffsetCollection:function(u,o,c){const p=u.values,m=o.values;if(p.length!==m.length)throw new ki(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:P}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(v=c.parse(v,2,ue),!v)return null;const E=[];let T=null;p==="interpolate-hcl"||p==="interpolate-lab"?T=Ar:c.expectedType&&c.expectedType.kind!=="value"&&(T=c.expectedType);for(let P=0;P=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',G);const Y=c.parse(F,H,T);if(!Y)return null;T=T||Y.type,E.push([D,Y])}return qt(T,ue)||qt(T,Ar)||qt(T,V)||qt(T,K)||qt(T,Z(ue))?new Ro(T,p,m,v,E):c.error(`Type ${ot(T)} is not interpolatable.`)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return p[0].evaluate(o);const v=c.length;if(m>=c[v-1])return p[v-1].evaluate(o);const w=au(c,m),E=Ro.interpolationFactor(this.interpolation,m,c[w],c[w+1]),T=p[w].evaluate(o),P=p[w+1].evaluate(o);switch(this.operator){case"interpolate":return Do[this.type.kind](T,P,E);case"interpolate-hcl":return Do.color(T,P,E,"hcl");case"interpolate-lab":return Do.color(T,P,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function wf(u,o,c,p){const m=p-c,v=u-c;return m===0?0:o===1?v/m:(Math.pow(o,v)-1)/(Math.pow(o,m)-1)}class Kc{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let p=null;const m=c.expectedType;m&&m.kind!=="value"&&(p=m);const v=[];for(const E of o.slice(1)){const T=c.parse(E,1+v.length,p,void 0,{typeAnnotation:"omit"});if(!T)return null;p=p||T.type,v.push(T)}if(!p)throw new Error("No output type");const w=m&&v.some(E=>yt(m,E.type));return new Kc(w?on:p,v)}evaluate(o){let c,p=null,m=0;for(const v of this.args)if(m++,p=v.evaluate(o),p&&p instanceof Dr&&!p.available&&(c||(c=p.name),p=null,m===this.args.length&&(p=c)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class Jc{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let v=1;v=p.length)throw new ki(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new ki(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Ef{constructor(o,c){this.type=Je,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,on),m=c.parse(o[2],2,on);return p&&m?rt(p.type,[Je,ln,ue,xs,on])?new Ef(p,m):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(p.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!St(c,["boolean","string","number","null"]))throw new ki(`Expected first argument to be of type boolean, string, number or null, but found ${ot(xi(c))} instead.`);if(!St(p,["string","array"]))throw new ki(`Expected second argument to be of type array or string, but found ${ot(xi(p))} instead.`);return p.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Qc{constructor(o,c,p){this.type=ue,this.needle=o,this.haystack=c,this.fromIndex=p}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,on),m=c.parse(o[2],2,on);if(!p||!m)return null;if(!rt(p.type,[Je,ln,ue,xs,on]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(p.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,ue);return v?new Qc(p,m,v):null}return new Qc(p,m)}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!St(c,["boolean","string","number","null"]))throw new ki(`Expected first argument to be of type boolean, string, number or null, but found ${ot(xi(c))} instead.`);if(!St(p,["string","array"]))throw new ki(`Expected second argument to be of type array or string, but found ${ot(xi(p))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(o);return p.indexOf(c,m)}return p.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class If{constructor(o,c,p,m,v,w){this.inputType=o,this.type=c,this.input=p,this.cases=m,this.outputs=v,this.otherwise=w}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let p,m;c.expectedType&&c.expectedType.kind!=="value"&&(m=c.expectedType);const v={},w=[];for(let P=2;PNumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,xi(Y)))return null}else p=xi(Y);if(v[String(Y)]!==void 0)return G.error("Branch labels must be unique.");v[String(Y)]=w.length}const H=c.parse(F,P,m);if(!H)return null;m=m||H.type,w.push(H)}const E=c.parse(o[1],1,on);if(!E)return null;const T=c.parse(o[o.length-1],o.length-1,m);return T?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new If(p,m,E,v,w,T):null}evaluate(o){const c=this.input.evaluate(o);return(xi(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Cf{constructor(o,c,p){this.type=o,this.branches=c,this.otherwise=p}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const m=[];for(let w=1;wc.outputDefined())&&this.otherwise.outputDefined()}}class $c{constructor(o,c,p,m){this.type=o,this.input=c,this.beginIndex=p,this.endIndex=m}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,on),m=c.parse(o[2],2,ue);if(!p||!m)return null;if(!rt(p.type,[Z(on),ln,on]))return c.error(`Expected first argument to be of type array or string, but found ${ot(p.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,ue);return v?new $c(p.type,p,m,v):null}return new $c(p.type,p,m)}evaluate(o){const c=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!St(c,["string","array"]))throw new ki(`Expected first argument to be of type array or string, but found ${ot(xi(c))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(o);return c.slice(p,m)}return c.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Ld(u,o){return u==="=="||u==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Md(u,o,c,p){return p.compare(o,c)===0}function lu(u,o,c){const p=u!=="=="&&u!=="!=";return class nx{constructor(v,w,E){this.type=Je,this.lhs=v,this.rhs=w,this.collator=E,this.hasUntypedArgument=v.type.kind==="value"||w.type.kind==="value"}static parse(v,w){if(v.length!==3&&v.length!==4)return w.error("Expected two or three arguments.");const E=v[0];let T=w.parse(v[1],1,on);if(!T)return null;if(!Ld(E,T.type))return w.concat(1).error(`"${E}" comparisons are not supported for type '${ot(T.type)}'.`);let P=w.parse(v[2],2,on);if(!P)return null;if(!Ld(E,P.type))return w.concat(2).error(`"${E}" comparisons are not supported for type '${ot(P.type)}'.`);if(T.type.kind!==P.type.kind&&T.type.kind!=="value"&&P.type.kind!=="value")return w.error(`Cannot compare types '${ot(T.type)}' and '${ot(P.type)}'.`);p&&(T.type.kind==="value"&&P.type.kind!=="value"?T=new os(P.type,[T]):T.type.kind!=="value"&&P.type.kind==="value"&&(P=new os(T.type,[P])));let D=null;if(v.length===4){if(T.type.kind!=="string"&&P.type.kind!=="string"&&T.type.kind!=="value"&&P.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(v[3],3,ws),!D)return null}return new nx(T,P,D)}evaluate(v){const w=this.lhs.evaluate(v),E=this.rhs.evaluate(v);if(p&&this.hasUntypedArgument){const T=xi(w),P=xi(E);if(T.kind!==P.kind||T.kind!=="string"&&T.kind!=="number")throw new ki(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${T.kind}, ${P.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const T=xi(w),P=xi(E);if(T.kind!=="string"||P.kind!=="string")return o(v,w,E)}return this.collator?c(v,w,E,this.collator.evaluate(v)):o(v,w,E)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Bg=lu("==",function(u,o,c){return o===c},Md),Vg=lu("!=",function(u,o,c){return o!==c},function(u,o,c,p){return!Md(0,o,c,p)}),Ug=lu("<",function(u,o,c){return o",function(u,o,c){return o>c},function(u,o,c,p){return p.compare(o,c)>0}),jg=lu("<=",function(u,o,c){return o<=c},function(u,o,c,p){return p.compare(o,c)<=0}),qg=lu(">=",function(u,o,c){return o>=c},function(u,o,c,p){return p.compare(o,c)>=0});class Tf{constructor(o,c,p,m,v){this.type=ln,this.number=o,this.locale=c,this.currency=p,this.minFractionDigits=m,this.maxFractionDigits=v}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ue);if(!p)return null;const m=o[2];if(typeof m!="object"||Array.isArray(m))return c.error("NumberFormat options argument must be an object.");let v=null;if(m.locale&&(v=c.parse(m.locale,1,ln),!v))return null;let w=null;if(m.currency&&(w=c.parse(m.currency,1,ln),!w))return null;let E=null;if(m["min-fraction-digits"]&&(E=c.parse(m["min-fraction-digits"],1,ue),!E))return null;let T=null;return m["max-fraction-digits"]&&(T=c.parse(m["max-fraction-digits"],1,ue),!T)?null:new Tf(p,v,w,E,T)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class th{constructor(o){this.type=st,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const m=[];let v=!1;for(let w=1;w<=o.length-1;++w){const E=o[w];if(v&&typeof E=="object"&&!Array.isArray(E)){v=!1;let T=null;if(E["font-scale"]&&(T=c.parse(E["font-scale"],1,ue),!T))return null;let P=null;if(E["text-font"]&&(P=c.parse(E["text-font"],1,Z(ln)),!P))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,Ar),!D))return null;const F=m[m.length-1];F.scale=T,F.font=P,F.textColor=D}else{const T=c.parse(o[w],1,on);if(!T)return null;const P=T.type.kind;if(P!=="string"&&P!=="value"&&P!=="null"&&P!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,m.push({content:T,scale:null,font:null,textColor:null})}}return new th(m)}evaluate(o){return new Zr(this.sections.map(c=>{const p=c.content.evaluate(o);return xi(p)===q?new Bc("",p,null,null,null):new Bc(Fn(p),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class Lf{constructor(o){this.type=q,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ln);return p?new Lf(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=Dr.fromString(c);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(c)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class Mf{constructor(o){this.type=ue,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=c.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${ot(p.type)} instead.`):new Mf(p):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new ki(`Expected value to be of type string or array, but found ${ot(xi(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const uu={"==":Bg,"!=":Vg,">":Gg,"<":Ug,">=":qg,"<=":jg,array:os,at:Sf,boolean:os,case:Cf,coalesce:Kc,collator:jc,format:th,image:Lf,in:Ef,"index-of":Qc,interpolate:Ro,"interpolate-hcl":Ro,"interpolate-lab":Ro,length:Mf,let:Jc,literal:wl,match:If,number:os,"number-format":Tf,object:os,slice:$c,step:Ja,string:os,"to-boolean":Ya,"to-color":Ya,"to-number":Ya,"to-string":Ya,var:Zc,within:Sl};function Pd(u,[o,c,p,m]){o=o.evaluate(u),c=c.evaluate(u),p=p.evaluate(u);const v=m?m.evaluate(u):1,w=Vc(o,c,p,v);if(w)throw new ki(w);return new Hn(o/255,c/255,p/255,v,!1)}function kd(u,o){return u in o}function Pf(u,o){const c=o[u];return c===void 0?null:c}function El(u){return{type:u}}function Ad(u){return{result:"success",value:u}}function Qa(u){return{result:"error",value:u}}function cu(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function Nd(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function kf(u){return!!u.expression&&u.expression.interpolated}function Bn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function wi(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Zg(u){return u}function Tn(u,o){const c=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",m=p||!(p||u.property!==void 0),v=u.type||(kf(o)?"exponential":"interval");if(c||o.type==="padding"){const D=c?Hn.parse:No.parse;(u=yo({},u)).stops&&(u.stops=u.stops.map(F=>[F[0],D(F[1])])),u.default=D(u.default?u.default:o.default)}if(u.colorSpace&&(w=u.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var w;let E,T,P;if(v==="exponential")E=Yu;else if(v==="interval")E=gi;else if(v==="categorical"){E=Si,T=Object.create(null);for(const D of u.stops)T[D[0]]=D[1];P=typeof u.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Dd}if(p){const D={},F=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},tt)=>Yu({stops:G,base:u.base},o,Y).evaluate(Y,tt)}}if(m){const D=v==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ro.interpolationFactor.bind(void 0,D),zoomStops:u.stops.map(F=>F[0]),evaluate:({zoom:F})=>E(u,o,F,T,P)}}return{kind:"source",evaluate(D,F){const G=F&&F.properties?F.properties[u.property]:void 0;return G===void 0?Il(u.default,o.default):E(u,o,G,T,P)}}}function Il(u,o,c){return u!==void 0?u:o!==void 0?o:c!==void 0?c:void 0}function Si(u,o,c,p,m){return Il(typeof c===m?p[c]:void 0,u.default,o.default)}function gi(u,o,c){if(Bn(c)!=="number")return Il(u.default,o.default);const p=u.stops.length;if(p===1||c<=u.stops[0][0])return u.stops[0][1];if(c>=u.stops[p-1][0])return u.stops[p-1][1];const m=au(u.stops.map(v=>v[0]),c);return u.stops[m][1]}function Yu(u,o,c){const p=u.base!==void 0?u.base:1;if(Bn(c)!=="number")return Il(u.default,o.default);const m=u.stops.length;if(m===1||c<=u.stops[0][0])return u.stops[0][1];if(c>=u.stops[m-1][0])return u.stops[m-1][1];const v=au(u.stops.map(D=>D[0]),c),w=function(D,F,G,H){const Y=H-G,tt=D-G;return Y===0?0:F===1?tt/Y:(Math.pow(F,tt)-1)/(Math.pow(F,Y)-1)}(c,p,u.stops[v][0],u.stops[v+1][0]),E=u.stops[v][1],T=u.stops[v+1][1],P=Do[o.type]||Zg;return typeof E.evaluate=="function"?{evaluate(...D){const F=E.evaluate.apply(void 0,D),G=T.evaluate.apply(void 0,D);if(F!==void 0&&G!==void 0)return P(F,G,w,u.colorSpace)}}:P(E,T,w,u.colorSpace)}function Dd(u,o,c){switch(o.type){case"color":c=Hn.parse(c);break;case"formatted":c=Zr.fromString(c.toString());break;case"resolvedImage":c=Dr.fromString(c.toString());break;case"padding":c=No.parse(c);break;default:Bn(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return Il(c,u.default,o.default)}ss.register(uu,{error:[{kind:"error"},[ln],(u,[o])=>{throw new ki(o.evaluate(u))}],typeof:[ln,[on],(u,[o])=>ot(xi(o.evaluate(u)))],"to-rgba":[Z(ue,4),[Ar],(u,[o])=>{const[c,p,m,v]=o.evaluate(u).rgb;return[255*c,255*p,255*m,v]}],rgb:[Ar,[ue,ue,ue],Pd],rgba:[Ar,[ue,ue,ue,ue],Pd],has:{type:Je,overloads:[[[ln],(u,[o])=>kd(o.evaluate(u),u.properties())],[[ln,ns],(u,[o,c])=>kd(o.evaluate(u),c.evaluate(u))]]},get:{type:on,overloads:[[[ln],(u,[o])=>Pf(o.evaluate(u),u.properties())],[[ln,ns],(u,[o,c])=>Pf(o.evaluate(u),c.evaluate(u))]]},"feature-state":[on,[ln],(u,[o])=>Pf(o.evaluate(u),u.featureState||{})],properties:[ns,[],u=>u.properties()],"geometry-type":[ln,[],u=>u.geometryType()],id:[on,[],u=>u.id()],zoom:[ue,[],u=>u.globals.zoom],"heatmap-density":[ue,[],u=>u.globals.heatmapDensity||0],"line-progress":[ue,[],u=>u.globals.lineProgress||0],accumulated:[on,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ue,El(ue),(u,o)=>{let c=0;for(const p of o)c+=p.evaluate(u);return c}],"*":[ue,El(ue),(u,o)=>{let c=1;for(const p of o)c*=p.evaluate(u);return c}],"-":{type:ue,overloads:[[[ue,ue],(u,[o,c])=>o.evaluate(u)-c.evaluate(u)],[[ue],(u,[o])=>-o.evaluate(u)]]},"/":[ue,[ue,ue],(u,[o,c])=>o.evaluate(u)/c.evaluate(u)],"%":[ue,[ue,ue],(u,[o,c])=>o.evaluate(u)%c.evaluate(u)],ln2:[ue,[],()=>Math.LN2],pi:[ue,[],()=>Math.PI],e:[ue,[],()=>Math.E],"^":[ue,[ue,ue],(u,[o,c])=>Math.pow(o.evaluate(u),c.evaluate(u))],sqrt:[ue,[ue],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ue,[ue],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ue,[ue],(u,[o])=>Math.log(o.evaluate(u))],log2:[ue,[ue],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ue,[ue],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ue,[ue],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ue,[ue],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ue,[ue],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ue,[ue],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ue,[ue],(u,[o])=>Math.atan(o.evaluate(u))],min:[ue,El(ue),(u,o)=>Math.min(...o.map(c=>c.evaluate(u)))],max:[ue,El(ue),(u,o)=>Math.max(...o.map(c=>c.evaluate(u)))],abs:[ue,[ue],(u,[o])=>Math.abs(o.evaluate(u))],round:[ue,[ue],(u,[o])=>{const c=o.evaluate(u);return c<0?-Math.round(-c):Math.round(c)}],floor:[ue,[ue],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ue,[ue],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[Je,[ln,on],(u,[o,c])=>u.properties()[o.value]===c.value],"filter-id-==":[Je,[on],(u,[o])=>u.id()===o.value],"filter-type-==":[Je,[ln],(u,[o])=>u.geometryType()===o.value],"filter-<":[Je,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p{const c=u.id(),p=o.value;return typeof c==typeof p&&c":[Je,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>m}],"filter-id->":[Je,[on],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Je,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p<=m}],"filter-id-<=":[Je,[on],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Je,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>=m}],"filter-id->=":[Je,[on],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Je,[on],(u,[o])=>o.value in u.properties()],"filter-has-id":[Je,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[Je,[Z(ln)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[Je,[Z(on)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[Je,[ln,Z(on)],(u,[o,c])=>c.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[Je,[ln,Z(on)],(u,[o,c])=>function(p,m,v,w){for(;v<=w;){const E=v+w>>1;if(m[E]===p)return!0;m[E]>p?w=E-1:v=E+1}return!1}(u.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Je,overloads:[[[Je,Je],(u,[o,c])=>o.evaluate(u)&&c.evaluate(u)],[El(Je),(u,o)=>{for(const c of o)if(!c.evaluate(u))return!1;return!0}]]},any:{type:Je,overloads:[[[Je,Je],(u,[o,c])=>o.evaluate(u)||c.evaluate(u)],[El(Je),(u,o)=>{for(const c of o)if(c.evaluate(u))return!0;return!1}]]},"!":[Je,[Je],(u,[o])=>!o.evaluate(u)],"is-supported-script":[Je,[ln],(u,[o])=>{const c=u.globals&&u.globals.isSupportedScript;return!c||c(o.evaluate(u))}],upcase:[ln,[ln],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[ln,[ln],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[ln,El(on),(u,o)=>o.map(c=>Fn(c.evaluate(u))).join("")],"resolved-locale":[ln,[ws],(u,[o])=>o.evaluate(u).resolvedLocale()]});class Af{constructor(o,c){var p;this.expression=o,this._warningHistory={},this._evaluator=new gf,this._defaultValue=c?(p=c).type==="color"&&wi(p.default)?new Hn(0,0,0,0):p.type==="color"?Hn.parse(p.default)||null:p.type==="padding"?No.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?rs.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,p,m,v,w){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,c,p,m,v,w){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new ki(`Expected value to be one of ${Object.keys(this._enumValues).map(T=>JSON.stringify(T)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function eh(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in uu}function nh(u,o){const c=new Gc(uu,Wc,[],o?function(m){const v={color:Ar,string:ln,number:ue,enum:ln,boolean:Je,formatted:st,padding:V,resolvedImage:q,variableAnchorOffsetCollection:K};return m.type==="array"?Z(v[m.value]||on,m.length):v[m.type]}(o):void 0),p=c.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?Ad(new Af(p,o)):Qa(c.errors)}class Nf{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Hu(c.expression)}evaluateWithoutErrorHandling(o,c,p,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,m,v,w)}evaluate(o,c,p,m,v,w){return this._styleExpression.evaluate(o,c,p,m,v,w)}}class ih{constructor(o,c,p,m){this.kind=o,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Hu(c.expression),this.interpolationType=m}evaluateWithoutErrorHandling(o,c,p,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,m,v,w)}evaluate(o,c,p,m,v,w){return this._styleExpression.evaluate(o,c,p,m,v,w)}interpolationFactor(o,c,p){return this.interpolationType?Ro.interpolationFactor(this.interpolationType,o,c,p):0}}function Df(u,o){const c=nh(u,o);if(c.result==="error")return c;const p=c.value.expression,m=Xc(p);if(!m&&!cu(o))return Qa([new ri("","data expressions not supported")]);const v=Hc(p,["zoom"]);if(!v&&!Nd(o))return Qa([new ri("","zoom expressions not supported")]);const w=Ju(p);return w||v?w instanceof ri?Qa([w]):w instanceof Ro&&!kf(o)?Qa([new ri("",'"interpolate" expressions cannot be used with this property')]):Ad(w?new ih(m?"camera":"composite",c.value,w.labels,w instanceof Ro?w.interpolation:void 0):new Nf(m?"constant":"source",c.value)):Qa([new ri("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ku{constructor(o,c){this._parameters=o,this._specification=c,yo(this,Tn(this._parameters,this._specification))}static deserialize(o){return new Ku(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Ju(u){let o=null;if(u instanceof Jc)o=Ju(u.result);else if(u instanceof Kc){for(const c of u.args)if(o=Ju(c),o)break}else(u instanceof Ja||u instanceof Ro)&&u.input instanceof ss&&u.input.name==="zoom"&&(o=u);return o instanceof ri||u.eachChild(c=>{const p=Ju(c);p instanceof ri?o=p:!o&&p?o=new ri("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new ri("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function Qu(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const o of u.slice(1))if(!Qu(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Wg={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Rf(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Qu(u)||(u=rh(u));const o=nh(u,Wg);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,m)=>o.value.evaluate(c,p,{},m),needGeometry:Rd(u)}}function Xg(u,o){return uo?1:0}function Rd(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?Of(u[1],u[2],o):o==="any"?(c=u.slice(1),["any"].concat(c.map(rh))):o==="all"?["all"].concat(u.slice(1).map(rh)):o==="none"?["all"].concat(u.slice(1).map(rh).map($u)):o==="in"?Od(u[1],u.slice(2)):o==="!in"?$u(Od(u[1],u.slice(2))):o==="has"?zd(u[1]):o==="!has"?$u(zd(u[1])):o!=="within"||u;var c}function Of(u,o,c){switch(u){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,u,o]}}function Od(u,o){if(o.length===0)return!1;switch(u){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",u,["literal",o.sort(Xg)]]:["filter-in-small",u,["literal",o]]}}function zd(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function $u(u){return["!",u]}function oh(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let m="[";for(const v of u)m+=`${oh(v)},`;return`${m}]`}const c=Object.keys(u).sort();let p="{";for(let m=0;mp.maximum?[new ae(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function ah(u){const o=u.valueSpec,c=Ai(u.value.type);let p,m,v,w={};const E=c!=="categorical"&&u.value.property===void 0,T=!E,P=Bn(u.value.stops)==="array"&&Bn(u.value.stops[0])==="array"&&Bn(u.value.stops[0][0])==="object",D=vo({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(H){if(c==="identity")return[new ae(H.key,H.value,'identity function may not have a "stops" property')];let Y=[];const tt=H.value;return Y=Y.concat(hu({key:H.key,value:tt,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:F})),Bn(tt)==="array"&&tt.length===0&&Y.push(new ae(H.key,tt,"array must have at least one stop")),Y},default:function(H){return H.validateSpec({key:H.key,value:H.value,valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec})}}});return c==="identity"&&E&&D.push(new ae(u.key,u.value,'missing required property "property"')),c==="identity"||u.value.stops||D.push(new ae(u.key,u.value,'missing required property "stops"')),c==="exponential"&&u.valueSpec.expression&&!kf(u.valueSpec)&&D.push(new ae(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(T&&!cu(u.valueSpec)?D.push(new ae(u.key,u.value,"property functions not supported")):E&&!Nd(u.valueSpec)&&D.push(new ae(u.key,u.value,"zoom functions not supported"))),c!=="categorical"&&!P||u.value.property!==void 0||D.push(new ae(u.key,u.value,'"property" property is required')),D;function F(H){let Y=[];const tt=H.value,ut=H.key;if(Bn(tt)!=="array")return[new ae(ut,tt,`array expected, ${Bn(tt)} found`)];if(tt.length!==2)return[new ae(ut,tt,`array length 2 expected, length ${tt.length} found`)];if(P){if(Bn(tt[0])!=="object")return[new ae(ut,tt,`object expected, ${Bn(tt[0])} found`)];if(tt[0].zoom===void 0)return[new ae(ut,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new ae(ut,tt,"object stop key must have value")];if(v&&v>Ai(tt[0].zoom))return[new ae(ut,tt[0].zoom,"stop zoom values must appear in ascending order")];Ai(tt[0].zoom)!==v&&(v=Ai(tt[0].zoom),m=void 0,w={}),Y=Y.concat(vo({key:`${ut}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:tc,value:G}}))}else Y=Y.concat(G({key:`${ut}[0]`,value:tt[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},tt));return eh(Cl(tt[1]))?Y.concat([new ae(`${ut}[1]`,tt[1],"expressions are not allowed in function stops.")]):Y.concat(H.validateSpec({key:`${ut}[1]`,value:tt[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function G(H,Y){const tt=Bn(H.value),ut=Ai(H.value),pt=H.value!==null?H.value:Y;if(p){if(tt!==p)return[new ae(H.key,pt,`${tt} stop domain type must match previous stop domain type ${p}`)]}else p=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new ae(H.key,pt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let Lt=`number expected, ${tt} found`;return cu(o)&&c===void 0&&(Lt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ae(H.key,pt,Lt)]}return c!=="categorical"||tt!=="number"||isFinite(ut)&&Math.floor(ut)===ut?c!=="categorical"&&tt==="number"&&m!==void 0&&utnew ae(`${u.key}${p.key}`,u.value,p.message));const c=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!c.outputDefined())return[new ae(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!Hu(c))return[new ae(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!Hu(c))return[new ae(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!Hc(c,["zoom","feature-state"]))return[new ae(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Xc(c))return[new ae(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ec(u){const o=u.key,c=u.value,p=u.valueSpec,m=[];return Array.isArray(p.values)?p.values.indexOf(Ai(c))===-1&&m.push(new ae(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(Ai(c))===-1&&m.push(new ae(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),m}function fu(u){return Qu(Cl(u.value))?Tl(yo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Bd(u)}function Bd(u){const o=u.value,c=u.key;if(Bn(o)!=="array")return[new ae(c,o,`array expected, ${Bn(o)} found`)];const p=u.styleSpec;let m,v=[];if(o.length<1)return[new ae(c,o,"filter array must have at least 1 element")];switch(v=v.concat(ec({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Ai(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Ai(o[1])==="$type"&&v.push(new ae(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new ae(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(m=Bn(o[1]),m!=="string"&&v.push(new ae(`${c}[1]`,o[1],`string expected, ${m} found`)));for(let w=2;w{P in c&&o.push(new ae(p,c[P],`"${P}" is prohibited for ref layers`))}),m.layers.forEach(P=>{Ai(P.id)===E&&(T=P)}),T?T.ref?o.push(new ae(p,c.ref,"ref cannot reference another ref layer")):w=Ai(T.type):o.push(new ae(p,c.ref,`ref layer "${E}" not found`))}else if(w!=="background")if(c.source){const T=m.sources&&m.sources[c.source],P=T&&Ai(T.type);T?P==="vector"&&w==="raster"?o.push(new ae(p,c.source,`layer "${c.id}" requires a raster source`)):P!=="raster-dem"&&w==="hillshade"?o.push(new ae(p,c.source,`layer "${c.id}" requires a raster-dem source`)):P==="raster"&&w!=="raster"?o.push(new ae(p,c.source,`layer "${c.id}" requires a vector source`)):P!=="vector"||c["source-layer"]?P==="raster-dem"&&w!=="hillshade"?o.push(new ae(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!c.paint||!c.paint["line-gradient"]||P==="geojson"&&T.lineMetrics||o.push(new ae(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new ae(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new ae(p,c.source,`source "${c.source}" not found`))}else o.push(new ae(p,c,'missing required property "source"'));return o=o.concat(vo({key:p,value:c,valueSpec:v.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:c.type,valueSpec:v.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:c,objectKey:"type"}),filter:fu,layout:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":P=>Gd(yo({layerType:w},P))}}),paint:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":P=>Ud(yo({layerType:w},P))}})}})),o}function js(u){const o=u.value,c=u.key,p=Bn(o);return p!=="string"?[new ae(c,o,`string expected, ${p} found`)]:[]}const nc={promoteId:function({key:u,value:o}){if(Bn(o)==="string")return js({key:u,value:o});{const c=[];for(const p in o)c.push(...js({key:`${u}.${p}`,value:o[p]}));return c}}};function Oo(u){const o=u.value,c=u.key,p=u.styleSpec,m=u.style,v=u.validateSpec;if(!o.type)return[new ae(c,o,'"type" is required')];const w=Ai(o.type);let E;switch(w){case"vector":case"raster":return E=vo({key:c,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:nc,validateSpec:v}),E;case"raster-dem":return E=function(T){var P;const D=(P=T.sourceName)!==null&&P!==void 0?P:"",F=T.value,G=T.styleSpec,H=G.source_raster_dem,Y=T.style;let tt=[];const ut=Bn(F);if(F===void 0)return tt;if(ut!=="object")return tt.push(new ae("source_raster_dem",F,`object expected, ${ut} found`)),tt;const pt=Ai(F.encoding)==="custom",Lt=["redFactor","greenFactor","blueFactor","baseShift"],bt=T.value.encoding?`"${T.value.encoding}"`:"Default";for(const Nt in F)!pt&&Lt.includes(Nt)?tt.push(new ae(Nt,F[Nt],`In "${D}": "${Nt}" is only valid when "encoding" is set to "custom". ${bt} encoding found`)):H[Nt]?tt=tt.concat(T.validateSpec({key:Nt,value:F[Nt],valueSpec:H[Nt],validateSpec:T.validateSpec,style:Y,styleSpec:G})):tt.push(new ae(Nt,F[Nt],`unknown property "${Nt}"`));return tt}({sourceName:c,value:o,style:u.style,styleSpec:p,validateSpec:v}),E;case"geojson":if(E=vo({key:c,value:o,valueSpec:p.source_geojson,style:m,styleSpec:p,validateSpec:v,objectElementValidators:nc}),o.cluster)for(const T in o.clusterProperties){const[P,D]=o.clusterProperties[T],F=typeof P=="string"?[P,["accumulated"],["get",T]]:P;E.push(...Tl({key:`${c}.${T}.map`,value:D,validateSpec:v,expressionContext:"cluster-map"})),E.push(...Tl({key:`${c}.${T}.reduce`,value:F,validateSpec:v,expressionContext:"cluster-reduce"}))}return E;case"video":return vo({key:c,value:o,valueSpec:p.source_video,style:m,validateSpec:v,styleSpec:p});case"image":return vo({key:c,value:o,valueSpec:p.source_image,style:m,validateSpec:v,styleSpec:p});case"canvas":return[new ae(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ec({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:p})}}function ic(u){const o=u.value,c=u.styleSpec,p=c.light,m=u.style;let v=[];const w=Bn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new ae("light",o,`object expected, ${w} found`)]),v;for(const E in o){const T=E.match(/^(.*)-transition$/);v=v.concat(T&&p[T[1]]&&p[T[1]].transition?u.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:u.validateSpec,style:m,styleSpec:c}):p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:m,styleSpec:c}):[new ae(E,o[E],`unknown property "${E}"`)])}return v}function qd(u){const o=u.value,c=u.styleSpec,p=c.terrain,m=u.style;let v=[];const w=Bn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new ae("terrain",o,`object expected, ${w} found`)]),v;for(const E in o)v=v.concat(p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:m,styleSpec:c}):[new ae(E,o[E],`unknown property "${E}"`)]);return v}function Zd(u){let o=[];const c=u.value,p=u.key;if(Array.isArray(c)){const m=[],v=[];for(const w in c)c[w].id&&m.includes(c[w].id)&&o.push(new ae(p,c,`all the sprites' ids must be unique, but ${c[w].id} is duplicated`)),m.push(c[w].id),c[w].url&&v.includes(c[w].url)&&o.push(new ae(p,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),v.push(c[w].url),o=o.concat(vo({key:`${p}[${w}]`,value:c[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return js({key:p,value:c})}const Wd={"*":()=>[],array:hu,boolean:function(u){const o=u.value,c=u.key,p=Bn(o);return p!=="boolean"?[new ae(c,o,`boolean expected, ${p} found`)]:[]},number:tc,color:function(u){const o=u.key,c=u.value,p=Bn(c);return p!=="string"?[new ae(o,c,`color expected, ${p} found`)]:Hn.parse(String(c))?[]:[new ae(o,c,`color expected, "${c}" found`)]},constants:Fd,enum:ec,filter:fu,function:ah,layer:jd,object:vo,source:Oo,light:ic,terrain:qd,string:js,formatted:function(u){return js(u).length===0?[]:Tl(u)},resolvedImage:function(u){return js(u).length===0?[]:Tl(u)},padding:function(u){const o=u.key,c=u.value;if(Bn(c)==="array"){if(c.length<1||c.length>4)return[new ae(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let m=[];for(let v=0;v[]}})),u.constants&&(c=c.concat(Fd({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:Ea}))),lh(c)}function Ia(u){return function(o){return u({...o,validateSpec:Ea})}}function lh(u){return[].concat(u).sort((o,c)=>o.line-c.line)}function Ca(u){return function(...o){return lh(u.apply(this,o))}}as.source=Ca(Ia(Oo)),as.sprite=Ca(Ia(Zd)),as.glyphs=Ca(Ia(Xd)),as.light=Ca(Ia(ic)),as.terrain=Ca(Ia(qd)),as.layer=Ca(Ia(jd)),as.filter=Ca(Ia(fu)),as.paintProperty=Ca(Ia(Ud)),as.layoutProperty=Ca(Ia(Gd));const Ta=as,Hg=Ta.light,zf=Ta.paintProperty,Hd=Ta.layoutProperty;function uh(u,o){let c=!1;if(o&&o.length)for(const p of o)u.fire(new pn(new Error(p.message))),c=!0;return c}class pu{constructor(o,c,p){const m=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(c=w[1])+2*(p=w[2]);for(let T=0;T=F[Y+0]&&m>=F[Y+1])?(E[H]=!0,w.push(D[H])):E[H]=!1}}}}_forEachCell(o,c,p,m,v,w,E,T){const P=this._convertToCellCoord(o),D=this._convertToCellCoord(c),F=this._convertToCellCoord(p),G=this._convertToCellCoord(m);for(let H=P;H<=F;H++)for(let Y=D;Y<=G;Y++){const tt=this.d*Y+H;if((!T||T(this._convertFromCellCoord(H),this._convertFromCellCoord(Y),this._convertFromCellCoord(H+1),this._convertFromCellCoord(Y+1)))&&v.call(this,o,c,p,m,tt,w,E,T))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let p=0;for(let w=0;w=0)continue;const w=u[v];m[v]=La[p].shallow.indexOf(v)>=0?w:$a(w,o)}u instanceof Error&&(m.message=u.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(m.$name=p),m}throw new Error("can't serialize object of type "+typeof u)}function du(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||ch(u)||yn(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(du);if(typeof u=="object"){const o=u.$name||"Object";if(!La[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=La[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(u);const p=Object.create(c.prototype);for(const m of Object.keys(u)){if(m==="$name")continue;const v=u[m];p[m]=La[o].shallow.indexOf(m)>=0?v:du(v)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Yd{constructor(){this.first=!0}update(o,c){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519};function Ff(u){for(const o of u)if(Vf(o.charCodeAt(0)))return!0;return!1}function Bf(u){for(const o of u)if(!Yg(o.charCodeAt(0)))return!1;return!0}function Yg(u){return!(_e.Arabic(u)||_e["Arabic Supplement"](u)||_e["Arabic Extended-A"](u)||_e["Arabic Presentation Forms-A"](u)||_e["Arabic Presentation Forms-B"](u))}function Vf(u){return!(u!==746&&u!==747&&(u<4352||!(_e["Bopomofo Extended"](u)||_e.Bopomofo(u)||_e["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||_e["CJK Compatibility Ideographs"](u)||_e["CJK Compatibility"](u)||_e["CJK Radicals Supplement"](u)||_e["CJK Strokes"](u)||!(!_e["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||_e["CJK Unified Ideographs Extension A"](u)||_e["CJK Unified Ideographs"](u)||_e["Enclosed CJK Letters and Months"](u)||_e["Hangul Compatibility Jamo"](u)||_e["Hangul Jamo Extended-A"](u)||_e["Hangul Jamo Extended-B"](u)||_e["Hangul Jamo"](u)||_e["Hangul Syllables"](u)||_e.Hiragana(u)||_e["Ideographic Description Characters"](u)||_e.Kanbun(u)||_e["Kangxi Radicals"](u)||_e["Katakana Phonetic Extensions"](u)||_e.Katakana(u)&&u!==12540||!(!_e["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!_e["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||_e["Unified Canadian Aboriginal Syllabics"](u)||_e["Unified Canadian Aboriginal Syllabics Extended"](u)||_e["Vertical Forms"](u)||_e["Yijing Hexagram Symbols"](u)||_e["Yi Syllables"](u)||_e["Yi Radicals"](u))))}function Kd(u){return!(Vf(u)||function(o){return!!(_e["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_e["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||_e["Letterlike Symbols"](o)||_e["Number Forms"](o)||_e["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||_e["Control Pictures"](o)&&o!==9251||_e["Optical Character Recognition"](o)||_e["Enclosed Alphanumerics"](o)||_e["Geometric Shapes"](o)||_e["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_e["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_e["CJK Symbols and Punctuation"](o)||_e.Katakana(o)||_e["Private Use Area"](o)||_e["CJK Compatibility Forms"](o)||_e["Small Form Variants"](o)||_e["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function Jd(u){return u>=1424&&u<=2303||_e["Arabic Presentation Forms-A"](u)||_e["Arabic Presentation Forms-B"](u)}function Qd(u,o){return!(!o&&Jd(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||_e.Khmer(u))}function Kg(u){for(const o of u)if(Jd(o.charCodeAt(0)))return!0;return!1}const Uf="deferred",Gf="loading",jf="loaded";let qf=null,bo="unavailable",tl=null;const rc=function(u){u&&typeof u=="string"&&u.indexOf("NetworkError")>-1&&(bo="error"),qf&&qf(u)};function Zf(){oc.fire(new Xn("pluginStateChange",{pluginStatus:bo,pluginURL:tl}))}const oc=new Xi,Wf=function(){return bo},$d=function(){if(bo!==Uf||!tl)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");bo=Gf,Zf(),tl&>({url:tl},u=>{u?rc(u):(bo=jf,Zf())})},zo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>bo===jf||zo.applyArabicShaping!=null,isLoading:()=>bo===Gf,setState(u){if(!se())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");bo=u.pluginStatus,tl=u.pluginURL},isParsed(){if(!se())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return zo.applyArabicShaping!=null&&zo.processBidirectionalText!=null&&zo.processStyledBidirectionalText!=null},getPluginURL(){if(!se())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return tl}};class ci{constructor(o,c){this.zoom=o,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Yd,this.transition={})}isSupportedScript(o){return function(c,p){for(const m of c)if(!Qd(m.charCodeAt(0),p))return!1;return!0}(o,zo.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class hh{constructor(o,c){this.property=o,this.value=c,this.expression=function(p,m){if(wi(p))return new Ku(p,m);if(eh(p)){const v=Df(p,m);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=p;return m.type==="color"&&typeof p=="string"?v=Hn.parse(p):m.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(v=rs.parse(p)):v=No.parse(p),{kind:"constant",evaluate:()=>v}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,p){return this.property.possiblyEvaluate(this,o,c,p)}}class Xf{constructor(o){this.property=o,this.value=new hh(o,void 0)}transitioned(o,c){return new em(this.property,this.value,c,_t({},o.transition,this.transition),o.now)}untransitioned(){return new em(this.property,this.value,null,{},0)}}class tm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return vt(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Xf(this._values[o].property)),this._values[o].value=new hh(this._values[o].property,c===null?void 0:vt(c))}getTransition(o){return vt(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Xf(this._values[o].property)),this._values[o].transition=vt(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p);const m=this.getTransition(c);m!==void 0&&(o[`${c}-transition`]=m)}return o}transitioned(o,c){const p=new nm(this._properties);for(const m of Object.keys(this._values))p._values[m]=this._values[m].transitioned(o,c._values[m]);return p}untransitioned(){const o=new nm(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class em{constructor(o,c,p,m,v){this.property=o,this.value=c,this.begin=v+m.delay||0,this.end=this.begin+m.duration||0,o.specification.transition&&(m.delay||m.duration)&&(this.prior=p)}possiblyEvaluate(o,c,p){const m=o.now||0,v=this.value.possiblyEvaluate(o,c,p),w=this.prior;if(w){if(m>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(m=1)return 1;const P=T*T,D=P*T;return 4*(T<.5?D:3*(T-P)+D-.75)}(E))}}return v}}class nm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,p){const m=new fh(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,p);return m}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Jg{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return vt(this._values[o].value)}setValue(o,c){this._values[o]=new hh(this._values[o].property,c===null?void 0:vt(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p)}return o}possiblyEvaluate(o,c,p){const m=new fh(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,p);return m}}class so{constructor(o,c,p){this.property=o,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,p,m){return this.property.evaluate(this.value,this.parameters,o,c,p,m)}}class fh{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Re{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,p){const m=Do[this.specification.type];return m?m(o,c,p):o}}class Ue{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,p,m){return new so(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},p,m)}:o.expression,c)}interpolate(o,c,p){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new so(this,{kind:"constant",value:void 0},o.parameters);const m=Do[this.specification.type];if(m){const v=m(o.value.value,c.value.value,p);return new so(this,{kind:"constant",value:v},o.parameters)}return o}evaluate(o,c,p,m,v,w){return o.kind==="constant"?o.value:o.evaluate(c,p,m,v,w)}}class sc extends Ue{possiblyEvaluate(o,c,p,m){if(o.value===void 0)return new so(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},p,m),w=o.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,E=this._calculate(w,w,w,c);return new so(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const v=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new so(this,{kind:"constant",value:v},c)}return new so(this,o.expression,c)}evaluate(o,c,p,m,v,w){if(o.kind==="source"){const E=o.evaluate(c,p,m,v,w);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},p,m),o.evaluate({zoom:Math.floor(c.zoom)},p,m),o.evaluate({zoom:Math.floor(c.zoom)+1},p,m),c):o.value}_calculate(o,c,p,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class Hf{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,m){if(o.value!==void 0){if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},p,m);return this._calculate(v,v,v,c)}return this._calculate(o.expression.evaluate(new ci(Math.floor(c.zoom-1),c)),o.expression.evaluate(new ci(Math.floor(c.zoom),c)),o.expression.evaluate(new ci(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,p,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class Yf{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,m){return!!o.expression.evaluate(c,null,{},p,m)}interpolate(){return!1}}class Hi{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const p=o[c];p.specification.overridable&&this.overridableProperties.push(c);const m=this.defaultPropertyValues[c]=new hh(p,void 0),v=this.defaultTransitionablePropertyValues[c]=new Xf(p);this.defaultTransitioningPropertyValues[c]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate({})}}}xe("DataDrivenProperty",Ue),xe("DataConstantProperty",Re),xe("CrossFadedDataDrivenProperty",sc),xe("CrossFadedProperty",Hf),xe("ColorRampProperty",Yf);const Kf="-transition";class ls extends Xi{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new Jg(c.layout)),c.paint)){this._transitionablePaint=new tm(c.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new fh(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,p={}){c!=null&&this._validate(Hd,`layers.${this.id}.layout.${o}`,o,c,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(Kf)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,p={}){if(c!=null&&this._validate(zf,`layers.${this.id}.paint.${o}`,o,c,p))return!1;if(o.endsWith(Kf))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const m=this._transitionablePaint._values[o],v=m.property.specification["property-type"]==="cross-faded-data-driven",w=m.value.isDataDriven(),E=m.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const T=this._transitionablePaint._values[o].value;return T.isDataDriven()||w||v||this._handleOverridablePaintPropertyUpdate(o,E,T)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={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&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),xt(o,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(o,c,p,m,v={}){return(!v||v.validate!==!1)&&uh(this,o.call(Ta,{key:c,layerType:this.type,objectKey:p,value:m,styleSpec:jt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof so&&cu(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const im={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ll{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ni{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_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(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ei(u,o=1){let c=0,p=0;return{members:u.map(m=>{const v=im[m.type].BYTES_PER_ELEMENT,w=c=mu(c,Math.max(o,v)),E=m.components||1;return p=Math.max(p,v),c+=v*E,{name:m.name,type:m.type,components:E,offset:w}}),size:mu(c,Math.max(p,o)),alignment:o}}function mu(u,o){return Math.ceil(u/o)*o}class ac extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const m=2*o;return this.int16[m+0]=c,this.int16[m+1]=p,o}}ac.prototype.bytesPerElement=4,xe("StructArrayLayout2i4",ac);class lc extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.int16[v+0]=c,this.int16[v+1]=p,this.int16[v+2]=m,o}}lc.prototype.bytesPerElement=6,xe("StructArrayLayout3i6",lc);class Ml extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,p,m)}emplace(o,c,p,m,v){const w=4*o;return this.int16[w+0]=c,this.int16[w+1]=p,this.int16[w+2]=m,this.int16[w+3]=v,o}}Ml.prototype.bytesPerElement=8,xe("StructArrayLayout4i8",Ml);class Jf extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,m,v,w)}emplace(o,c,p,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=p,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}Jf.prototype.bytesPerElement=12,xe("StructArrayLayout2i4i12",Jf);class Qf extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,m,v,w)}emplace(o,c,p,m,v,w,E){const T=4*o,P=8*o;return this.int16[T+0]=c,this.int16[T+1]=p,this.uint8[P+4]=m,this.uint8[P+5]=v,this.uint8[P+6]=w,this.uint8[P+7]=E,o}}Qf.prototype.bytesPerElement=8,xe("StructArrayLayout2i4ub8",Qf);class gu extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const m=2*o;return this.float32[m+0]=c,this.float32[m+1]=p,o}}gu.prototype.bytesPerElement=8,xe("StructArrayLayout2f8",gu);class $f extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w,E,T,P,D){const F=this.length;return this.resize(F+1),this.emplace(F,o,c,p,m,v,w,E,T,P,D)}emplace(o,c,p,m,v,w,E,T,P,D,F){const G=10*o;return this.uint16[G+0]=c,this.uint16[G+1]=p,this.uint16[G+2]=m,this.uint16[G+3]=v,this.uint16[G+4]=w,this.uint16[G+5]=E,this.uint16[G+6]=T,this.uint16[G+7]=P,this.uint16[G+8]=D,this.uint16[G+9]=F,o}}$f.prototype.bytesPerElement=20,xe("StructArrayLayout10ui20",$f);class tp extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w,E,T,P,D,F,G){const H=this.length;return this.resize(H+1),this.emplace(H,o,c,p,m,v,w,E,T,P,D,F,G)}emplace(o,c,p,m,v,w,E,T,P,D,F,G,H){const Y=12*o;return this.int16[Y+0]=c,this.int16[Y+1]=p,this.int16[Y+2]=m,this.int16[Y+3]=v,this.uint16[Y+4]=w,this.uint16[Y+5]=E,this.uint16[Y+6]=T,this.uint16[Y+7]=P,this.int16[Y+8]=D,this.int16[Y+9]=F,this.int16[Y+10]=G,this.int16[Y+11]=H,o}}tp.prototype.bytesPerElement=24,xe("StructArrayLayout4i4ui4i24",tp);class Vn extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.float32[v+0]=c,this.float32[v+1]=p,this.float32[v+2]=m,o}}Vn.prototype.bytesPerElement=12,xe("StructArrayLayout3f12",Vn);class y extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}y.prototype.bytesPerElement=4,xe("StructArrayLayout1ul4",y);class s extends Ni{_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(o,c,p,m,v,w,E,T,P){const D=this.length;return this.resize(D+1),this.emplace(D,o,c,p,m,v,w,E,T,P)}emplace(o,c,p,m,v,w,E,T,P,D){const F=10*o,G=5*o;return this.int16[F+0]=c,this.int16[F+1]=p,this.int16[F+2]=m,this.int16[F+3]=v,this.int16[F+4]=w,this.int16[F+5]=E,this.uint32[G+3]=T,this.uint16[F+8]=P,this.uint16[F+9]=D,o}}s.prototype.bytesPerElement=20,xe("StructArrayLayout6i1ul2ui20",s);class h extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,m,v,w)}emplace(o,c,p,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=p,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}h.prototype.bytesPerElement=12,xe("StructArrayLayout2i2i2i12",h);class d extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v){const w=this.length;return this.resize(w+1),this.emplace(w,o,c,p,m,v)}emplace(o,c,p,m,v,w){const E=4*o,T=8*o;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=m,this.int16[T+6]=v,this.int16[T+7]=w,o}}d.prototype.bytesPerElement=16,xe("StructArrayLayout2f1f2i16",d);class g extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,p,m)}emplace(o,c,p,m,v){const w=12*o,E=3*o;return this.uint8[w+0]=c,this.uint8[w+1]=p,this.float32[E+1]=m,this.float32[E+2]=v,o}}g.prototype.bytesPerElement=12,xe("StructArrayLayout2ub2f12",g);class b extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.uint16[v+0]=c,this.uint16[v+1]=p,this.uint16[v+2]=m,o}}b.prototype.bytesPerElement=6,xe("StructArrayLayout3ui6",b);class I extends Ni{_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(o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt,ut,pt){const Lt=this.length;return this.resize(Lt+1),this.emplace(Lt,o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt,ut,pt)}emplace(o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt,ut,pt,Lt){const bt=24*o,Nt=12*o,Ft=48*o;return this.int16[bt+0]=c,this.int16[bt+1]=p,this.uint16[bt+2]=m,this.uint16[bt+3]=v,this.uint32[Nt+2]=w,this.uint32[Nt+3]=E,this.uint32[Nt+4]=T,this.uint16[bt+10]=P,this.uint16[bt+11]=D,this.uint16[bt+12]=F,this.float32[Nt+7]=G,this.float32[Nt+8]=H,this.uint8[Ft+36]=Y,this.uint8[Ft+37]=tt,this.uint8[Ft+38]=ut,this.uint32[Nt+10]=pt,this.int16[bt+22]=Lt,o}}I.prototype.bytesPerElement=48,xe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",I);class C extends Ni{_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(o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt,ut,pt,Lt,bt,Nt,Ft,Yt,ye,Me,ge,pe,le,Se){const ce=this.length;return this.resize(ce+1),this.emplace(ce,o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt,ut,pt,Lt,bt,Nt,Ft,Yt,ye,Me,ge,pe,le,Se)}emplace(o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt,ut,pt,Lt,bt,Nt,Ft,Yt,ye,Me,ge,pe,le,Se,ce){const ne=32*o,Be=16*o;return this.int16[ne+0]=c,this.int16[ne+1]=p,this.int16[ne+2]=m,this.int16[ne+3]=v,this.int16[ne+4]=w,this.int16[ne+5]=E,this.int16[ne+6]=T,this.int16[ne+7]=P,this.uint16[ne+8]=D,this.uint16[ne+9]=F,this.uint16[ne+10]=G,this.uint16[ne+11]=H,this.uint16[ne+12]=Y,this.uint16[ne+13]=tt,this.uint16[ne+14]=ut,this.uint16[ne+15]=pt,this.uint16[ne+16]=Lt,this.uint16[ne+17]=bt,this.uint16[ne+18]=Nt,this.uint16[ne+19]=Ft,this.uint16[ne+20]=Yt,this.uint16[ne+21]=ye,this.uint16[ne+22]=Me,this.uint32[Be+12]=ge,this.float32[Be+13]=pe,this.float32[Be+14]=le,this.uint16[ne+30]=Se,this.uint16[ne+31]=ce,o}}C.prototype.bytesPerElement=64,xe("StructArrayLayout8i15ui1ul2f2ui64",C);class M extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}M.prototype.bytesPerElement=4,xe("StructArrayLayout1f4",M);class N extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.uint16[6*o+0]=c,this.float32[v+1]=p,this.float32[v+2]=m,o}}N.prototype.bytesPerElement=12,xe("StructArrayLayout1ui2f12",N);class O extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=4*o;return this.uint32[2*o+0]=c,this.uint16[v+2]=p,this.uint16[v+3]=m,o}}O.prototype.bytesPerElement=8,xe("StructArrayLayout1ul2ui8",O);class z extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const m=2*o;return this.uint16[m+0]=c,this.uint16[m+1]=p,o}}z.prototype.bytesPerElement=4,xe("StructArrayLayout2ui4",z);class W extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}W.prototype.bytesPerElement=2,xe("StructArrayLayout1ui2",W);class nt extends Ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,p,m)}emplace(o,c,p,m,v){const w=4*o;return this.float32[w+0]=c,this.float32[w+1]=p,this.float32[w+2]=m,this.float32[w+3]=v,o}}nt.prototype.bytesPerElement=16,xe("StructArrayLayout4f16",nt);class et extends Ll{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 A(this.anchorPointX,this.anchorPointY)}}et.prototype.size=20;class at extends s{get(o){return new et(this,o)}}xe("CollisionBoxArray",at);class $ extends Ll{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(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}$.prototype.size=48;class Et extends I{get(o){return new $(this,o)}}xe("PlacedSymbolArray",Et);class Ot extends Ll{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(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ot.prototype.size=64;class ht extends C{get(o){return new Ot(this,o)}}xe("SymbolInstanceArray",ht);class Tt extends M{getoffsetX(o){return this.float32[1*o+0]}}xe("GlyphOffsetArray",Tt);class Bt extends lc{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}xe("SymbolLineVertexArray",Bt);class Vt extends Ll{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Vt.prototype.size=12;class Xt extends N{get(o){return new Vt(this,o)}}xe("TextAnchorOffsetArray",Xt);class ee extends Ll{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]}}ee.prototype.size=8;class $t extends O{get(o){return new ee(this,o)}}xe("FeatureIndexArray",$t);class oe extends ac{}class Le extends ac{}class vn extends ac{}class fe extends Jf{}class Ge extends Qf{}class Pe extends gu{}class Yn extends $f{}class _n extends tp{}class un extends Vn{}class bn extends y{}class Bi extends h{}class si extends g{}class Rr extends b{}class pr extends z{}const Yi=Ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fo}=Yi;class hi{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,m){let v=this.segments[this.segments.length-1];return o>hi.MAX_VERTEX_ARRAY_LENGTH&&Rt(`Max vertices per segment is ${hi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>hi.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==m)&&(v={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},m!==void 0&&(v.sortKey=m),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,p,m){return new hi([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:m,vaos:{},sortKey:0}])}}function qs(u,o){return 256*(u=ft(Math.floor(u),0,255))+ft(Math.floor(o),0,255)}hi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,xe("SegmentVector",hi);const Zs=Ei([{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 el={exports:{}},Pl={exports:{}};Pl.exports=function(u,o){var c,p,m,v,w,E,T,P;for(p=u.length-(c=3&u.length),m=o,w=3432918353,E=461845907,P=0;P>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(T=0,c){case 3:T^=(255&u.charCodeAt(P+2))<<16;case 2:T^=(255&u.charCodeAt(P+1))<<8;case 1:m^=T=(65535&(T=(T=(65535&(T^=255&u.charCodeAt(P)))*w+(((T>>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295}return m^=u.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var _u=Pl.exports,Wr={exports:{}};Wr.exports=function(u,o){for(var c,p=u.length,m=o^p,v=0;p>=4;)c=1540483477*(65535&(c=255&u.charCodeAt(v)|(255&u.charCodeAt(++v))<<8|(255&u.charCodeAt(++v))<<16|(255&u.charCodeAt(++v))<<24))+((1540483477*(c>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++v;switch(p){case 3:m^=(255&u.charCodeAt(v+2))<<16;case 2:m^=(255&u.charCodeAt(v+1))<<8;case 1:m=1540483477*(65535&(m^=255&u.charCodeAt(v)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var Or=_u,ao=Wr.exports;el.exports=Or,el.exports.murmur3=Or,el.exports.murmur2=ao;var kl=x(el.exports);class Vi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,p,m){this.ids.push(dr(o)),this.positions.push(c,p,m)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=dr(o);let p=0,m=this.ids.length-1;for(;p>1;this.ids[w]>=c?m=w:p=w+1}const v=[];for(;this.ids[p]===c;)v.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return v}static serialize(o,c){const p=new Float64Array(o.ids),m=new Uint32Array(o.positions);return xo(p,m,0,p.length-1),c&&c.push(p.buffer,m.buffer),{ids:p,positions:m}}static deserialize(o){const c=new Vi;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function dr(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:kl(String(u))}function xo(u,o,c,p){for(;c>1];let v=c-1,w=p+1;for(;;){do v++;while(u[v]m);if(v>=w)break;Ui(u,v,w),Ui(o,3*v,3*w),Ui(o,3*v+1,3*w+1),Ui(o,3*v+2,3*w+2)}w-c`u_${m}`),this.type=p}setUniform(o,c,p){o.set(p.constantOr(this.value))}getBinding(o,c,p){return this.type==="color"?new om(o,c):new ph(o,c)}}class Nl{constructor(o,c){this.uniformNames=c.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,p,m){const v=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&o.set(v)}getBinding(o,c,p){return p.substr(0,9)==="u_pattern"?new rm(o,c):new ph(o,c)}}class Xs{constructor(o,c,p,m){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(v=>({name:`a_${v}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(o,c,p,m,v){const w=this.paintVertexArray.length,E=this.expression.evaluate(new ci(0),c,{},m,[],v);this.paintVertexArray.resize(o),this._setPaintValue(w,o,E)}updatePaintArray(o,c,p,m){const v=this.expression.evaluate({zoom:0},p,m);this._setPaintValue(o,c,v)}_setPaintValue(o,c,p){if(this.type==="color"){const m=ep(p);for(let v=o;v`u_${E}_t`),this.type=p,this.useIntegerZoom=m,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,c,p,m,v){const w=this.expression.evaluate(new ci(this.zoom),c,{},m,[],v),E=this.expression.evaluate(new ci(this.zoom+1),c,{},m,[],v),T=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(T,o,w,E)}updatePaintArray(o,c,p,m){const v=this.expression.evaluate({zoom:this.zoom},p,m),w=this.expression.evaluate({zoom:this.zoom+1},p,m);this._setPaintValue(o,c,v,w)}_setPaintValue(o,c,p,m){if(this.type==="color"){const v=ep(p),w=ep(m);for(let E=o;E`#define HAS_UNIFORM_${m}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof Xs||p instanceof us)for(let m=0;m!0){this.programConfigurations={};for(const m of o)this.programConfigurations[m.id]=new np(m,c,p);this.needsUpload=!1,this._featureMap=new Vi,this._bufferOffset=0}populatePaintArrays(o,c,p,m,v,w){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,m,v,w);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,p,m){for(const v of p)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(o,this._featureMap,c,v,m)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function kw(u,o){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"]}[u]||[u.replace(`${o}-`,"").replace(/-/g,"_")]}function r0(u,o,c){const p={color:{source:gu,composite:nt},number:{source:M,composite:gu}},m=function(v){return{"line-pattern":{source:Yn,composite:Yn},"fill-pattern":{source:Yn,composite:Yn},"fill-extrusion-pattern":{source:Yn,composite:Yn}}[v]}(u);return m&&m[c]||p[o][c]}xe("ConstantBinder",Ws),xe("CrossFadedConstantBinder",Nl),xe("SourceExpressionBinder",Xs),xe("CrossFadedCompositeBinder",Hs),xe("CompositeExpressionBinder",us),xe("ProgramConfiguration",np,{omit:["_buffers"]}),xe("ProgramConfigurationSet",Ma);const rr=8192,$g=Math.pow(2,14)-1,o0=-$g-1;function uc(u){const o=rr/u.extent,c=u.loadGeometry();for(let p=0;pw.x+1||Tw.y+1)&&Rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function cc(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?uc(u):[]}}function sm(u,o,c,p,m){u.emplaceBack(2*o+(p+1)/2,2*c+(m+1)/2)}class t_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Le,this.indexArray=new Rr,this.segments=new hi,this.programConfigurations=new Ma(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){const m=this.layers[0],v=[];let w=null,E=!1;m.type==="circle"&&(w=m.layout.get("circle-sort-key"),E=!w.isConstant());for(const{feature:T,id:P,index:D,sourceLayerIndex:F}of o){const G=this.layers[0]._featureFilter.needGeometry,H=cc(T,G);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),H,p))continue;const Y=E?w.evaluate(H,{},p):void 0,tt={id:P,properties:T.properties,type:T.type,sourceLayerIndex:F,index:D,geometry:G?H.geometry:uc(T),patterns:{},sortKey:Y};v.push(tt)}E&&v.sort((T,P)=>T.sortKey-P.sortKey);for(const T of v){const{geometry:P,index:D,sourceLayerIndex:F}=T,G=o[D].feature;this.addFeature(T,P,D,p),c.featureIndex.insert(G,P,D,F,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Fo),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,p,m){for(const v of c)for(const w of v){const E=w.x,T=w.y;if(E<0||E>=rr||T<0||T>=rr)continue;const P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),D=P.vertexLength;sm(this.layoutVertexArray,E,T,-1,-1),sm(this.layoutVertexArray,E,T,1,-1),sm(this.layoutVertexArray,E,T,1,1),sm(this.layoutVertexArray,E,T,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),P.vertexLength+=4,P.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},m)}}function s0(u,o){for(let c=0;c1){if(e_(u,o))return!0;for(let p=0;p1?c:c.sub(o)._mult(m)._add(o))}function u0(u,o){let c,p,m,v=!1;for(let w=0;wo.y!=m.y>o.y&&o.x<(m.x-p.x)*(o.y-p.y)/(m.y-p.y)+p.x&&(v=!v)}return v}function dh(u,o){let c=!1;for(let p=0,m=u.length-1;po.y!=w.y>o.y&&o.x<(w.x-v.x)*(o.y-v.y)/(w.y-v.y)+v.x&&(c=!c)}return c}function Rw(u,o,c){const p=c[0],m=c[2];if(u.xm.x&&o.x>m.x||u.ym.y&&o.y>m.y)return!1;const v=Gt(u,o,c[0]);return v!==Gt(u,o,c[1])||v!==Gt(u,o,c[2])||v!==Gt(u,o,c[3])}function ip(u,o,c){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:c.programConfigurations.get(o.id).getMaxValue(u)}function am(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function lm(u,o,c,p,m){if(!o[0]&&!o[1])return u;const v=A.convert(o)._mult(m);c==="viewport"&&v._rotate(-p);const w=[];for(let E=0;Ep0(ut,tt))}(P,T),H=F?D*E:D;for(const Y of m)for(const tt of Y){const ut=F?tt:p0(tt,T);let pt=H;const Lt=um([],[tt.x,tt.y,0,1],T);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=Lt[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=w.cameraToCenterDistance/Lt[3]),Aw(G,ut,pt))return!0}return!1}}function p0(u,o){const c=um([],[u.x,u.y,0,1],o);return new A(c[0]/c[3],c[1]/c[3])}class d0 extends t_{}let m0;xe("HeatmapBucket",d0,{omit:["layers"]});var Bw={get paint(){return m0=m0||new Hi({"heatmap-radius":new Ue(jt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ue(jt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Re(jt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yf(jt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Re(jt.paint_heatmap["heatmap-opacity"])})}};function r_(u,{width:o,height:c},p,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==o*c*p)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${o*c*p}`)}else m=new Uint8Array(o*c*p);return u.width=o,u.height=c,u.data=m,u}function g0(u,{width:o,height:c},p){if(o===u.width&&c===u.height)return;const m=r_({},{width:o,height:c},p);o_(u,m,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,c)},p),u.width=o,u.height=c,u.data=m.data}function o_(u,o,c,p,m,v){if(m.width===0||m.height===0)return o;if(m.width>u.width||m.height>u.height||c.x>u.width-m.width||c.y>u.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>o.width||m.height>o.height||p.x>o.width-m.width||p.y>o.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const w=u.data,E=o.data;if(w===E)throw new Error("srcData equals dstData, so image is already copied");for(let T=0;T{o[u.evaluationKey]=T;const P=u.expression.evaluate(o);m.data[w+E+0]=Math.floor(255*P.r/P.a),m.data[w+E+1]=Math.floor(255*P.g/P.a),m.data[w+E+2]=Math.floor(255*P.b/P.a),m.data[w+E+3]=Math.floor(255*P.a)};if(u.clips)for(let w=0,E=0;w80*c){p=v=u[0],m=w=u[1];for(var Y=c;Yv&&(v=E),T>w&&(w=T);P=(P=Math.max(v-p,w-m))!==0?32767/P:0}return sp(G,H,c,p,m,P,0),H}function v0(u,o,c,p,m){var v,w;if(m===u_(u,o,c,p)>0)for(v=o;v=o;v-=p)w=w0(v,u[v],u[v+1],w);return w&&hm(w,w.next)&&(lp(w),w=w.next),w}function hc(u,o){if(!u)return u;o||(o=u);var c,p=u;do if(c=!1,p.steiner||!hm(p,p.next)&&Ki(p.prev,p,p.next)!==0)p=p.next;else{if(lp(p),(p=o=p.prev)===p.next)break;c=!0}while(c||p!==o);return o}function sp(u,o,c,p,m,v,w){if(u){!w&&v&&function(D,F,G,H){var Y=D;do Y.z===0&&(Y.z=a_(Y.x,Y.y,F,G,H)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==D);Y.prevZ.nextZ=null,Y.prevZ=null,function(tt){var ut,pt,Lt,bt,Nt,Ft,Yt,ye,Me=1;do{for(pt=tt,tt=null,Nt=null,Ft=0;pt;){for(Ft++,Lt=pt,Yt=0,ut=0;ut0||ye>0&≪)Yt!==0&&(ye===0||!Lt||pt.z<=Lt.z)?(bt=pt,pt=pt.nextZ,Yt--):(bt=Lt,Lt=Lt.nextZ,ye--),Nt?Nt.nextZ=bt:tt=bt,bt.prevZ=Nt,Nt=bt;pt=Lt}Nt.nextZ=null,Me*=2}while(Ft>1)}(Y)}(u,p,m,v);for(var E,T,P=u;u.prev!==u.next;)if(E=u.prev,T=u.next,v?Ww(u,p,m,v):Zw(u))o.push(E.i/c|0),o.push(u.i/c|0),o.push(T.i/c|0),lp(u),u=T.next,P=T.next;else if((u=T)===P){w?w===1?sp(u=Xw(hc(u),o,c),o,c,p,m,v,2):w===2&&Hw(u,o,c,p,m,v):sp(hc(u),o,c,p,m,v,1);break}}}function Zw(u){var o=u.prev,c=u,p=u.next;if(Ki(o,c,p)>=0)return!1;for(var m=o.x,v=c.x,w=p.x,E=o.y,T=c.y,P=p.y,D=mv?m>w?m:w:v>w?v:w,H=E>T?E>P?E:P:T>P?T:P,Y=p.next;Y!==o;){if(Y.x>=D&&Y.x<=G&&Y.y>=F&&Y.y<=H&&gh(m,E,v,T,w,P,Y.x,Y.y)&&Ki(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function Ww(u,o,c,p){var m=u.prev,v=u,w=u.next;if(Ki(m,v,w)>=0)return!1;for(var E=m.x,T=v.x,P=w.x,D=m.y,F=v.y,G=w.y,H=ET?E>P?E:P:T>P?T:P,ut=D>F?D>G?D:G:F>G?F:G,pt=a_(H,Y,o,c,p),Lt=a_(tt,ut,o,c,p),bt=u.prevZ,Nt=u.nextZ;bt&&bt.z>=pt&&Nt&&Nt.z<=Lt;){if(bt.x>=H&&bt.x<=tt&&bt.y>=Y&&bt.y<=ut&&bt!==m&&bt!==w&&gh(E,D,T,F,P,G,bt.x,bt.y)&&Ki(bt.prev,bt,bt.next)>=0||(bt=bt.prevZ,Nt.x>=H&&Nt.x<=tt&&Nt.y>=Y&&Nt.y<=ut&&Nt!==m&&Nt!==w&&gh(E,D,T,F,P,G,Nt.x,Nt.y)&&Ki(Nt.prev,Nt,Nt.next)>=0))return!1;Nt=Nt.nextZ}for(;bt&&bt.z>=pt;){if(bt.x>=H&&bt.x<=tt&&bt.y>=Y&&bt.y<=ut&&bt!==m&&bt!==w&&gh(E,D,T,F,P,G,bt.x,bt.y)&&Ki(bt.prev,bt,bt.next)>=0)return!1;bt=bt.prevZ}for(;Nt&&Nt.z<=Lt;){if(Nt.x>=H&&Nt.x<=tt&&Nt.y>=Y&&Nt.y<=ut&&Nt!==m&&Nt!==w&&gh(E,D,T,F,P,G,Nt.x,Nt.y)&&Ki(Nt.prev,Nt,Nt.next)>=0)return!1;Nt=Nt.nextZ}return!0}function Xw(u,o,c){var p=u;do{var m=p.prev,v=p.next.next;!hm(m,v)&&b0(m,p,p.next,v)&&ap(m,v)&&ap(v,m)&&(o.push(m.i/c|0),o.push(p.i/c|0),o.push(v.i/c|0),lp(p),lp(p.next),p=u=v),p=p.next}while(p!==u);return hc(p)}function Hw(u,o,c,p,m,v){var w=u;do{for(var E=w.next.next;E!==w.prev;){if(w.i!==E.i&&$w(w,E)){var T=x0(w,E);return w=hc(w,w.next),T=hc(T,T.next),sp(w,o,c,p,m,v,0),void sp(T,o,c,p,m,v,0)}E=E.next}w=w.next}while(w!==u)}function Yw(u,o){return u.x-o.x}function Kw(u,o){var c=function(m,v){var w,E=v,T=m.x,P=m.y,D=-1/0;do{if(P<=E.y&&P>=E.next.y&&E.next.y!==E.y){var F=E.x+(P-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(F<=T&&F>D&&(D=F,w=E.x=E.x&&E.x>=Y&&T!==E.x&&gh(Pw.x||E.x===w.x&&Jw(w,E)))&&(w=E,ut=G)),E=E.next;while(E!==H);return w}(u,o);if(!c)return o;var p=x0(c,u);return hc(p,p.next),hc(c,c.next)}function Jw(u,o){return Ki(u.prev,u,o.prev)<0&&Ki(o.next,u,u.next)<0}function a_(u,o,c,p,m){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-c)*m|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*m|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function Qw(u){var o=u,c=u;do(o.x=(u-w)*(v-E)&&(u-w)*(p-E)>=(c-w)*(o-E)&&(c-w)*(v-E)>=(m-w)*(p-E)}function $w(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(c,p){var m=c;do{if(m.i!==c.i&&m.next.i!==c.i&&m.i!==p.i&&m.next.i!==p.i&&b0(m,m.next,c,p))return!0;m=m.next}while(m!==c);return!1}(u,o)&&(ap(u,o)&&ap(o,u)&&function(c,p){var m=c,v=!1,w=(c.x+p.x)/2,E=(c.y+p.y)/2;do m.y>E!=m.next.y>E&&m.next.y!==m.y&&w<(m.next.x-m.x)*(E-m.y)/(m.next.y-m.y)+m.x&&(v=!v),m=m.next;while(m!==c);return v}(u,o)&&(Ki(u.prev,u,o.prev)||Ki(u,o.prev,o))||hm(u,o)&&Ki(u.prev,u,u.next)>0&&Ki(o.prev,o,o.next)>0)}function Ki(u,o,c){return(o.y-u.y)*(c.x-o.x)-(o.x-u.x)*(c.y-o.y)}function hm(u,o){return u.x===o.x&&u.y===o.y}function b0(u,o,c,p){var m=pm(Ki(u,o,c)),v=pm(Ki(u,o,p)),w=pm(Ki(c,p,u)),E=pm(Ki(c,p,o));return m!==v&&w!==E||!(m!==0||!fm(u,c,o))||!(v!==0||!fm(u,p,o))||!(w!==0||!fm(c,u,p))||!(E!==0||!fm(c,o,p))}function fm(u,o,c){return o.x<=Math.max(u.x,c.x)&&o.x>=Math.min(u.x,c.x)&&o.y<=Math.max(u.y,c.y)&&o.y>=Math.min(u.y,c.y)}function pm(u){return u>0?1:u<0?-1:0}function ap(u,o){return Ki(u.prev,u,u.next)<0?Ki(u,o,u.next)>=0&&Ki(u,u.prev,o)>=0:Ki(u,o,u.prev)<0||Ki(u,u.next,o)<0}function x0(u,o){var c=new l_(u.i,u.x,u.y),p=new l_(o.i,o.x,o.y),m=u.next,v=o.prev;return u.next=o,o.prev=u,c.next=m,m.prev=c,p.next=c,c.prev=p,v.next=p,p.prev=v,p}function w0(u,o,c,p){var m=new l_(u,o,c);return p?(m.next=p.next,m.prev=p,p.next.prev=m,p.next=m):(m.prev=m,m.next=m),m}function lp(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function l_(u,o,c){this.i=u,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function u_(u,o,c,p){for(var m=0,v=o,w=c-p;v0&&c.holes.push(p+=u[m-1].length)}return c};var S0=x(s_.exports);function t2(u,o,c,p,m){E0(u,o,c||0,p||u.length-1,m||e2)}function E0(u,o,c,p,m){for(;p>c;){if(p-c>600){var v=p-c+1,w=o-c+1,E=Math.log(v),T=.5*Math.exp(2*E/3),P=.5*Math.sqrt(E*T*(v-T)/v)*(w-v/2<0?-1:1);E0(u,o,Math.max(c,Math.floor(o-w*T/v+P)),Math.min(p,Math.floor(o+(v-w)*T/v+P)),m)}var D=u[o],F=c,G=p;for(up(u,c,o),m(u[p],D)>0&&up(u,c,p);F0;)G--}m(u[c],D)===0?up(u,c,G):up(u,++G,p),G<=o&&(c=G+1),o<=G&&(p=G-1)}}function up(u,o,c){var p=u[o];u[o]=u[c],u[c]=p}function e2(u,o){return uo?1:0}function c_(u,o){const c=u.length;if(c<=1)return[u];const p=[];let m,v;for(let w=0;w1)for(let w=0;wc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new vn,this.indexArray=new Rr,this.indexArray2=new pr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new hi,this.segments2=new hi,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=h_("fill",this.layers,c);const m=this.layers[0].layout.get("fill-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:P,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,G=cc(E,F);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),G,p))continue;const H=v?m.evaluate(G,{},p,c.availableImages):void 0,Y={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:P,geometry:F?G.geometry:uc(E),patterns:{},sortKey:H};w.push(Y)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:P,sourceLayerIndex:D}=E;if(this.hasPattern){const F=f_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,P,p,{});c.featureIndex.insert(o[P].feature,T,P,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,qw),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),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(o,c,p,m,v){for(const w of c_(c,500)){let E=0;for(const H of w)E+=H.length;const T=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),P=T.vertexLength,D=[],F=[];for(const H of w){if(H.length===0)continue;H!==w[0]&&F.push(D.length/2);const Y=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),tt=Y.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(tt+H.length-1,tt),D.push(H[0].x),D.push(H[0].y);for(let ut=1;ut>3}if(m--,p===1||p===2)v+=u.readSVarint(),w+=u.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new l2(v,w));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},_h.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,c=1,p=0,m=0,v=0,w=1/0,E=-1/0,T=1/0,P=-1/0;u.pos>3}if(p--,c===1||c===2)(m+=u.readSVarint())E&&(E=m),(v+=u.readSVarint())P&&(P=v);else if(c!==7)throw new Error("unknown command "+c)}return[w,T,E,P]},_h.prototype.toGeoJSON=function(u,o,c){var p,m,v=this.extent*Math.pow(2,c),w=this.extent*u,E=this.extent*o,T=this.loadGeometry(),P=_h.types[this.type];function D(H){for(var Y=0;Y>3;m=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return m}(c))}M0.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var o=this._pbf.readVarint()+this._pbf.pos;return new h2(this._pbf,o,this.extent,this._keys,this._values)};var p2=L0;function d2(u,o,c){if(u===3){var p=new p2(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}yu.VectorTile=function(u,o){this.layers=u.readFields(d2,{},o)},yu.VectorTileFeature=T0,yu.VectorTileLayer=L0;const m2=yu.VectorTileFeature.types,d_=Math.pow(2,13);function cp(u,o,c,p,m,v,w,E){u.emplaceBack(o,c,2*Math.floor(p*d_)+w,m*d_*2,v*d_*2,Math.round(E))}class m_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new fe,this.centroidVertexArray=new oe,this.indexArray=new Rr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new hi,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.features=[],this.hasPattern=h_("fill-extrusion",this.layers,c);for(const{feature:m,id:v,index:w,sourceLayerIndex:E}of o){const T=this.layers[0]._featureFilter.needGeometry,P=cc(m,T);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),P,p))continue;const D={id:v,sourceLayerIndex:E,index:w,geometry:T?P.geometry:uc(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(f_("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,w,p,{}),c.featureIndex.insert(m,D.geometry,w,E,this.index,!0)}}addFeatures(o,c,p){for(const m of this.features){const{geometry:v}=m;this.addFeature(m,v,m.index,c,p)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,a2),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,s2.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,p,m,v){const w={x:0,y:0,vertexCount:0};for(const E of c_(c,500)){let T=0;for(const Y of E)T+=Y.length;let P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of E){if(Y.length===0||_2(Y))continue;let tt=0;for(let ut=0;ut=1){const Lt=Y[ut-1];if(!g2(pt,Lt)){P.vertexLength+4>hi.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const bt=pt.sub(Lt)._perp()._unit(),Nt=Lt.dist(pt);tt+Nt>32768&&(tt=0),cp(this.layoutVertexArray,pt.x,pt.y,bt.x,bt.y,0,0,tt),cp(this.layoutVertexArray,pt.x,pt.y,bt.x,bt.y,0,1,tt),w.x+=2*pt.x,w.y+=2*pt.y,w.vertexCount+=2,tt+=Nt,cp(this.layoutVertexArray,Lt.x,Lt.y,bt.x,bt.y,0,0,tt),cp(this.layoutVertexArray,Lt.x,Lt.y,bt.x,bt.y,0,1,tt),w.x+=2*Lt.x,w.y+=2*Lt.y,w.vertexCount+=2;const Ft=P.vertexLength;this.indexArray.emplaceBack(Ft,Ft+2,Ft+1),this.indexArray.emplaceBack(Ft+1,Ft+2,Ft+3),P.vertexLength+=4,P.primitiveLength+=2}}}}if(P.vertexLength+T>hi.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),m2[o.type]!=="Polygon")continue;const D=[],F=[],G=P.vertexLength;for(const Y of E)if(Y.length!==0){Y!==E[0]&&F.push(D.length/2);for(let tt=0;ttrr)||u.y===o.y&&(u.y<0||u.y>rr)}function _2(u){return u.every(o=>o.x<0)||u.every(o=>o.x>rr)||u.every(o=>o.y<0)||u.every(o=>o.y>rr)}let P0;xe("FillExtrusionBucket",m_,{omit:["layers","features"]});var y2={get paint(){return P0=P0||new Hi({"fill-extrusion-opacity":new Re(jt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ue(jt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Re(jt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Re(jt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new sc(jt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ue(jt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ue(jt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Re(jt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class v2 extends ls{constructor(o){super(o,y2)}createBucket(o){return new m_(o)}queryRadius(){return am(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,p,m,v,w,E,T){const P=lm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,p),F=this.paint.get("fill-extrusion-base").evaluate(c,p),G=function(Y,tt,ut,pt){const Lt=[];for(const bt of Y){const Nt=[bt.x,bt.y,0,1];um(Nt,Nt,tt),Lt.push(new A(Nt[0]/Nt[3],Nt[1]/Nt[3]))}return Lt}(P,T),H=function(Y,tt,ut,pt){const Lt=[],bt=[],Nt=pt[8]*tt,Ft=pt[9]*tt,Yt=pt[10]*tt,ye=pt[11]*tt,Me=pt[8]*ut,ge=pt[9]*ut,pe=pt[10]*ut,le=pt[11]*ut;for(const Se of Y){const ce=[],ne=[];for(const Be of Se){const Ae=Be.x,dn=Be.y,fi=pt[0]*Ae+pt[4]*dn+pt[12],_i=pt[1]*Ae+pt[5]*dn+pt[13],gr=pt[2]*Ae+pt[6]*dn+pt[14],cs=pt[3]*Ae+pt[7]*dn+pt[15],So=gr+Yt,or=cs+ye,zr=fi+Me,Hr=_i+ge,Eo=gr+pe,Io=cs+le,_r=new A((fi+Nt)/or,(_i+Ft)/or);_r.z=So/or,ce.push(_r);const yr=new A(zr/Io,Hr/Io);yr.z=Eo/Io,ne.push(yr)}Lt.push(ce),bt.push(ne)}return[Lt,bt]}(m,F,D,T);return function(Y,tt,ut){let pt=1/0;a0(ut,tt)&&(pt=k0(ut,tt[0]));for(let Lt=0;Ltc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new Ge,this.layoutVertexArray2=new Pe,this.indexArray=new Rr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new hi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=h_("line",this.layers,c);const m=this.layers[0].layout.get("line-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:P,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,G=cc(E,F);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),G,p))continue;const H=v?m.evaluate(G,{},p):void 0,Y={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:P,geometry:F?G.geometry:uc(E),patterns:{},sortKey:H};w.push(Y)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:P,sourceLayerIndex:D}=E;if(this.hasPattern){const F=f_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,P,p,{});c.featureIndex.insert(o[P].feature,T,P,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,S2)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,x2),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,p,m,v){const w=this.layers[0].layout,E=w.get("line-join").evaluate(o,{}),T=w.get("line-cap"),P=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const F of c)this.addLine(F,o,E,T,P,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,m)}addLine(o,c,p,m,v,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pt=0;pt=2&&o[T-1].equals(o[T-2]);)T--;let P=0;for(;P0;if(ye&&pt>P){const le=G.dist(H);if(le>2*D){const Se=G.sub(G.sub(H)._mult(D/le)._round());this.updateDistance(H,Se),this.addCurrentVertex(Se,tt,0,0,F),H=Se}}const ge=H&&Y;let pe=ge?p:E?"butt":m;if(ge&&pe==="round"&&(Ftv&&(pe="bevel"),pe==="bevel"&&(Ft>2&&(pe="flipbevel"),Ft100)Lt=ut.mult(-1);else{const le=Ft*tt.add(ut).mag()/tt.sub(ut).mag();Lt._perp()._mult(le*(Me?-1:1))}this.addCurrentVertex(G,Lt,0,0,F),this.addCurrentVertex(G,Lt.mult(-1),0,0,F)}else if(pe==="bevel"||pe==="fakeround"){const le=-Math.sqrt(Ft*Ft-1),Se=Me?le:0,ce=Me?0:le;if(H&&this.addCurrentVertex(G,tt,Se,ce,F),pe==="fakeround"){const ne=Math.round(180*Yt/Math.PI/20);for(let Be=1;Be2*D){const Se=G.add(Y.sub(G)._mult(D/le)._round());this.updateDistance(G,Se),this.addCurrentVertex(Se,ut,0,0,F),G=Se}}}}addCurrentVertex(o,c,p,m,v,w=!1){const E=c.y*m-c.x,T=-c.y-c.x*m;this.addHalfVertex(o,c.x+c.y*p,c.y-c.x*p,w,!1,p,v),this.addHalfVertex(o,E,T,w,!0,-m,v),this.distance>A0/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,p,m,v,w))}addHalfVertex({x:o,y:c},p,m,v,w,E,T){const P=.5*(this.lineClips?this.scaledDistance*(A0-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(v?1:0),(c<<1)+(w?1:0),Math.round(63*p)+128,Math.round(63*m)+128,1+(E===0?0:E<0?-1:1)|(63&P)<<2,P>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=T.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),T.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let N0,D0;xe("LineBucket",g_,{omit:["layers","patternFeatures"]});var R0={get paint(){return D0=D0||new Hi({"line-opacity":new Ue(jt.paint_line["line-opacity"]),"line-color":new Ue(jt.paint_line["line-color"]),"line-translate":new Re(jt.paint_line["line-translate"]),"line-translate-anchor":new Re(jt.paint_line["line-translate-anchor"]),"line-width":new Ue(jt.paint_line["line-width"]),"line-gap-width":new Ue(jt.paint_line["line-gap-width"]),"line-offset":new Ue(jt.paint_line["line-offset"]),"line-blur":new Ue(jt.paint_line["line-blur"]),"line-dasharray":new Hf(jt.paint_line["line-dasharray"]),"line-pattern":new sc(jt.paint_line["line-pattern"]),"line-gradient":new Yf(jt.paint_line["line-gradient"])})},get layout(){return N0=N0||new Hi({"line-cap":new Re(jt.layout_line["line-cap"]),"line-join":new Ue(jt.layout_line["line-join"]),"line-miter-limit":new Re(jt.layout_line["line-miter-limit"]),"line-round-limit":new Re(jt.layout_line["line-round-limit"]),"line-sort-key":new Ue(jt.layout_line["line-sort-key"])})}};class C2 extends Ue{possiblyEvaluate(o,c){return c=new ci(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,p,m){return c=_t({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,p,m)}}let dm;class T2 extends ls{constructor(o){super(o,R0),this.gradientVersion=0,dm||(dm=new C2(R0.paint.properties["line-width"].specification),dm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Ja,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=dm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new g_(o)}queryRadius(o){const c=o,p=O0(ip("line-width",this,c),ip("line-gap-width",this,c)),m=ip("line-offset",this,c);return p/2+Math.abs(m)+am(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,p,m,v,w,E){const T=lm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,E),P=E/2*O0(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),D=this.paint.get("line-offset").evaluate(c,p);return D&&(m=function(F,G){const H=[];for(let Y=0;Y=3){for(let ut=0;ut0?o+2*u:u}const L2=Ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),M2=Ei([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const P2=Ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ei([{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 z0=Ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),k2=Ei([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function A2(u,o,c){return u.sections.forEach(p=>{p.text=function(m,v,w){const E=v.layout.get("text-transform").evaluate(w,{});return E==="uppercase"?m=m.toLocaleUpperCase():E==="lowercase"&&(m=m.toLocaleLowerCase()),zo.applyArabicShaping&&(m=zo.applyArabicShaping(m)),m}(p.text,o,c)}),u}Ei([{name:"triangle",components:3,type:"Uint16"}]),Ei([{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"}]),Ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ei([{type:"Float32",name:"offsetX"}]),Ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ei([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const fp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var mr=24,F0=$n,B0=function(u,o,c,p,m){var v,w,E=8*m-p-1,T=(1<>1,D=-7,F=c?m-1:0,G=c?-1:1,H=u[o+F];for(F+=G,v=H&(1<<-D)-1,H>>=-D,D+=E;D>0;v=256*v+u[o+F],F+=G,D-=8);for(w=v&(1<<-D)-1,v>>=-D,D+=p;D>0;w=256*w+u[o+F],F+=G,D-=8);if(v===0)v=1-P;else{if(v===T)return w?NaN:1/0*(H?-1:1);w+=Math.pow(2,p),v-=P}return(H?-1:1)*w*Math.pow(2,v-p)},V0=function(u,o,c,p,m,v){var w,E,T,P=8*v-m-1,D=(1<>1,G=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=p?0:v-1,Y=p?1:-1,tt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,w=D):(w=Math.floor(Math.log(o)/Math.LN2),o*(T=Math.pow(2,-w))<1&&(w--,T*=2),(o+=w+F>=1?G/T:G*Math.pow(2,1-F))*T>=2&&(w++,T/=2),w+F>=D?(E=0,w=D):w+F>=1?(E=(o*T-1)*Math.pow(2,m),w+=F):(E=o*Math.pow(2,F-1)*Math.pow(2,m),w=0));m>=8;u[c+H]=255&E,H+=Y,E/=256,m-=8);for(w=w<0;u[c+H]=255&w,H+=Y,w/=256,P-=8);u[c+H-Y]|=128*tt};function $n(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}$n.Varint=0,$n.Fixed64=1,$n.Bytes=2,$n.Fixed32=5;var __=4294967296,U0=1/__,G0=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Dl(u){return u.type===$n.Bytes?u.readVarint()+u.pos:u.pos+1}function yh(u,o,c){return c?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function j0(u,o,c){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(p);for(var m=c.pos-1;m>=u;m--)c.buf[m+p]=c.buf[m]}function N2(u,o){for(var c=0;c>>8,u[c+2]=o>>>16,u[c+3]=o>>>24}function q0(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}$n.prototype={destroy:function(){this.buf=null},readFields:function(u,o,c){for(c=c||this.length;this.pos>3,v=this.pos;this.type=7&p,u(m,o,this),this.pos===v&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=mm(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=q0(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=mm(this.buf,this.pos)+mm(this.buf,this.pos+4)*__;return this.pos+=8,u},readSFixed64:function(){var u=mm(this.buf,this.pos)+q0(this.buf,this.pos+4)*__;return this.pos+=8,u},readFloat:function(){var u=B0(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=B0(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var o,c,p=this.buf;return o=127&(c=p[this.pos++]),c<128?o:(o|=(127&(c=p[this.pos++]))<<7,c<128?o:(o|=(127&(c=p[this.pos++]))<<14,c<128?o:(o|=(127&(c=p[this.pos++]))<<21,c<128?o:function(m,v,w){var E,T,P=w.buf;if(E=(112&(T=P[w.pos++]))>>4,T<128||(E|=(127&(T=P[w.pos++]))<<3,T<128)||(E|=(127&(T=P[w.pos++]))<<10,T<128)||(E|=(127&(T=P[w.pos++]))<<17,T<128)||(E|=(127&(T=P[w.pos++]))<<24,T<128)||(E|=(1&(T=P[w.pos++]))<<31,T<128))return yh(m,E,v);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=p[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,o=this.pos;return this.pos=u,u-o>=12&&G0?function(c,p,m){return G0.decode(c.subarray(p,m))}(this.buf,o,u):function(c,p,m){for(var v="",w=p;w239?4:D>223?3:D>191?2:1;if(w+G>m)break;G===1?D<128&&(F=D):G===2?(192&(E=c[w+1]))==128&&(F=(31&D)<<6|63&E)<=127&&(F=null):G===3?(T=c[w+2],(192&(E=c[w+1]))==128&&(192&T)==128&&((F=(15&D)<<12|(63&E)<<6|63&T)<=2047||F>=55296&&F<=57343)&&(F=null)):G===4&&(T=c[w+2],P=c[w+3],(192&(E=c[w+1]))==128&&(192&T)==128&&(192&P)==128&&((F=(15&D)<<18|(63&E)<<12|(63&T)<<6|63&P)<=65535||F>=1114112)&&(F=null)),F===null?(F=65533,G=1):F>65535&&(F-=65536,v+=String.fromCharCode(F>>>10&1023|55296),F=56320|1023&F),v+=String.fromCharCode(F),w+=G}return v}(this.buf,o,u)},readBytes:function(){var u=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,u);return this.pos=u,o},readPackedVarint:function(u,o){if(this.type!==$n.Bytes)return u.push(this.readVarint(o));var c=Dl(this);for(u=u||[];this.pos127;);else if(o===$n.Bytes)this.pos=this.readVarint()+this.pos;else if(o===$n.Fixed32)this.pos+=4;else{if(o!==$n.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(u,o){this.writeVarint(u<<3|o)},realloc:function(u){for(var o=this.length||16;o268435455||u<0?function(o,c){var p,m;if(o>=0?(p=o%4294967296|0,m=o/4294967296|0):(m=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,m=m+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(v,w,E){E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,E.buf[E.pos]=127&(v>>>=7)}(p,0,c),function(v,w){var E=(7&v)<<4;w.buf[w.pos++]|=E|((v>>>=3)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v)))))}(m,c)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var o=this.pos;this.pos=function(p,m,v){for(var w,E,T=0;T55295&&w<57344){if(!E){w>56319||T+1===m.length?(p[v++]=239,p[v++]=191,p[v++]=189):E=w;continue}if(w<56320){p[v++]=239,p[v++]=191,p[v++]=189,E=w;continue}w=E-55296<<10|w-56320|65536,E=null}else E&&(p[v++]=239,p[v++]=191,p[v++]=189,E=null);w<128?p[v++]=w:(w<2048?p[v++]=w>>6|192:(w<65536?p[v++]=w>>12|224:(p[v++]=w>>18|240,p[v++]=w>>12&63|128),p[v++]=w>>6&63|128),p[v++]=63&w|128)}return v}(this.buf,u,this.pos);var c=this.pos-o;c>=128&&j0(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(u){this.realloc(4),V0(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),V0(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var o=u.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&j0(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,c){this.writeTag(u,$n.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,N2,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,D2,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,z2,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,R2,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,O2,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,F2,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,B2,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,V2,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,U2,o)},writeBytesField:function(u,o){this.writeTag(u,$n.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,$n.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,$n.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,$n.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,$n.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,$n.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,$n.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,$n.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,$n.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,$n.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var y_=x(F0);const v_=3;function G2(u,o,c){u===1&&c.readMessage(j2,o)}function j2(u,o,c){if(u===3){const{id:p,bitmap:m,width:v,height:w,left:E,top:T,advance:P}=c.readMessage(q2,{});o.push({id:p,bitmap:new op({width:v+2*v_,height:w+2*v_},m),metrics:{width:v,height:w,left:E,top:T,advance:P}})}}function q2(u,o,c){u===1?o.id=c.readVarint():u===2?o.bitmap=c.readBytes():u===3?o.width=c.readVarint():u===4?o.height=c.readVarint():u===5?o.left=c.readSVarint():u===6?o.top=c.readSVarint():u===7&&(o.advance=c.readVarint())}const Z0=v_;function W0(u){let o=0,c=0;for(const w of u)o+=w.w*w.h,c=Math.max(c,w.w);u.sort((w,E)=>E.h-w.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let m=0,v=0;for(const w of u)for(let E=p.length-1;E>=0;E--){const T=p[E];if(!(w.w>T.w||w.h>T.h)){if(w.x=T.x,w.y=T.y,v=Math.max(v,w.y+w.h),m=Math.max(m,w.x+w.w),w.w===T.w&&w.h===T.h){const P=p.pop();E=0&&p>=o&&_m[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const p=new bh;return p.text=this.text.substring(o,c),p.sectionIndex=this.sectionIndex.slice(o,c),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(dp.forText(o.scale,o.fontStack||c));const p=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function gm(u,o,c,p,m,v,w,E,T,P,D,F,G,H,Y,tt){const ut=bh.fromFeature(u,m);let pt;F===a.ai.vertical&&ut.verticalizePunctuation();const{processBidirectionalText:Lt,processStyledBidirectionalText:bt}=zo;if(Lt&&ut.sections.length===1){pt=[];const Yt=Lt(ut.toString(),x_(ut,P,v,o,p,H,Y));for(const ye of Yt){const Me=new bh;Me.text=ye,Me.sections=ut.sections;for(let ge=0;ge0&&Ol>Vo&&(Vo=Ol)}else{const Is=Me[Sn.fontStack],Go=Is&&Is[Yr];if(Go&&Go.rect)Pa=Go.rect,Ys=Go.metrics;else{const Ol=ye[Sn.fontStack],vp=Ol&&Ol[Yr];if(!vp)continue;Ys=vp.metrics}br=(yr-Sn.scale)*mr}Ks?(Yt.verticalizable=!0,uo.push({glyph:Yr,imageName:ka,x:fi,y:_i+br,vertical:Ks,scale:Sn.scale,fontStack:Sn.fontStack,sectionIndex:co,metrics:Ys,rect:Pa}),fi+=Rl*Sn.scale+Be):(uo.push({glyph:Yr,imageName:ka,x:fi,y:_i+br,vertical:Ks,scale:Sn.scale,fontStack:Sn.fontStack,sectionIndex:co,metrics:Ys,rect:Pa}),fi+=Ys.advance*Sn.scale+Be)}uo.length!==0&&(gr=Math.max(fi-Be,gr),X2(uo,0,uo.length-1,So,Vo)),fi=0;const Uo=le*yr+Vo;Co.lineOffset=Math.max(Vo,lo),_i+=Uo,cs=Math.max(Uo,cs),++or}var zr;const Hr=_i-pp,{horizontalAlign:Eo,verticalAlign:Io}=w_(Se);(function(_r,yr,lo,Co,uo,Vo,Uo,vr,Sn){const co=(yr-lo)*uo;let Yr=0;Yr=Vo!==Uo?-vr*Co-pp:(-Co*Sn+.5)*Uo;for(const br of _r)for(const Ys of br.positionedGlyphs)Ys.x+=co,Ys.y+=Yr})(Yt.positionedLines,So,Eo,Io,gr,cs,le,Hr,pe.length),Yt.top+=-Io*Hr,Yt.bottom=Yt.top+Hr,Yt.left+=-Eo*gr,Yt.right=Yt.left+gr}(Ft,o,c,p,pt,w,E,T,F,P,G,tt),!function(Yt){for(const ye of Yt)if(ye.positionedGlyphs.length!==0)return!1;return!0}(Nt)&&Ft}const _m={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Z2={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 H0(u,o,c,p,m,v){if(o.imageName){const w=p[o.imageName];return w?w.displaySize[0]*o.scale*mr/v+m:0}{const w=c[o.fontStack],E=w&&w[u];return E?E.metrics.advance*o.scale+m:0}}function Y0(u,o,c,p){const m=Math.pow(u-o,2);return p?u=0;let D=0;for(let G=0;Gw.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=i_([]),this.placementViewportMatrix=i_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=$0(this.zoom,c["text-size"]),this.iconSizeData=$0(this.zoom,c["icon-size"]);const p=this.layers[0].layout,m=p.get("symbol-sort-key"),v=p.get("symbol-z-order");this.canOverlap=S_(p,"text-overlap","text-allow-overlap")!=="never"||S_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(w=>a.ai[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new I_(new Ma(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new I_(new Ma(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new Tt,this.lineVertexArray=new Bt,this.symbolInstances=new ht,this.textAnchorOffsets=new Xt}calculateGlyphDependencies(o,c,p,m,v){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,F=v.get("symbol-sort-key");if(this.features=[],!P&&!D)return;const G=c.iconDependencies,H=c.glyphDependencies,Y=c.availableImages,tt=new ci(this.zoom);for(const{feature:ut,id:pt,index:Lt,sourceLayerIndex:bt}of o){const Nt=m._featureFilter.needGeometry,Ft=cc(ut,Nt);if(!m._featureFilter.filter(tt,Ft,p))continue;let Yt,ye;if(Nt||(Ft.geometry=uc(ut)),P){const ge=m.getValueAndResolveTokens("text-field",Ft,p,Y),pe=Zr.factory(ge);J2(pe)&&(this.hasRTLText=!0),(!this.hasRTLText||Wf()==="unavailable"||this.hasRTLText&&zo.isParsed())&&(Yt=A2(pe,m,Ft))}if(D){const ge=m.getValueAndResolveTokens("icon-image",Ft,p,Y);ye=ge instanceof Dr?ge:Dr.fromString(ge)}if(!Yt&&!ye)continue;const Me=this.sortFeaturesByKey?F.evaluate(Ft,{},p):void 0;if(this.features.push({id:pt,text:Yt,icon:ye,index:Lt,sourceLayerIndex:bt,geometry:Ft.geometry,properties:ut.properties,type:Y2[ut.type],sortKey:Me}),ye&&(G[ye.name]=!0),Yt){const ge=w.evaluate(Ft,{},p).join(","),pe=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ai.vertical)>=0;for(const le of Yt.sections)if(le.image)G[le.image.name]=!0;else{const Se=Ff(Yt.toString()),ce=le.fontStack||ge,ne=H[ce]=H[ce]||{};this.calculateGlyphDependencies(le.text,ne,pe,this.allowVerticalPlacement,Se)}}}v.get("symbol-placement")==="line"&&(this.features=function(ut){const pt={},Lt={},bt=[];let Nt=0;function Ft(ge){bt.push(ut[ge]),Nt++}function Yt(ge,pe,le){const Se=Lt[ge];return delete Lt[ge],Lt[pe]=Se,bt[Se].geometry[0].pop(),bt[Se].geometry[0]=bt[Se].geometry[0].concat(le[0]),Se}function ye(ge,pe,le){const Se=pt[pe];return delete pt[pe],pt[ge]=Se,bt[Se].geometry[0].shift(),bt[Se].geometry[0]=le[0].concat(bt[Se].geometry[0]),Se}function Me(ge,pe,le){const Se=le?pe[0][pe[0].length-1]:pe[0][0];return`${ge}:${Se.x}:${Se.y}`}for(let ge=0;gege.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ut,pt)=>ut.sortKey-pt.sortKey)}update(o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,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(o,c){const p=this.lineVertexArray.length;if(o.segment!==void 0){let m=o.dist(c[o.segment+1]),v=o.dist(c[o.segment]);const w={};for(let E=o.segment+1;E=0;E--)w[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:v},E>0&&(v+=c[E-1].dist(c[E]));for(let E=0;E0}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(o,c){const p=o.placedSymbolArray.get(c),m=p.vertexStartIndex+4*p.numGlyphs;for(let v=p.vertexStartIndex;vm[E]-m[T]||v[T]-v[E]),w}addToSortKeyRanges(o,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((m,v,w)=>{m>=0&&w.indexOf(m)===v&&this.addIndicesForPlacedSymbol(this.text,m)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let tv,ev;xe("SymbolBucket",xh,{omit:["layers","collisionBoxArray","features","compareText"]}),xh.MAX_GLYPHS=65535,xh.addDynamicAttributes=E_;var T_={get paint(){return ev=ev||new Hi({"icon-opacity":new Ue(jt.paint_symbol["icon-opacity"]),"icon-color":new Ue(jt.paint_symbol["icon-color"]),"icon-halo-color":new Ue(jt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ue(jt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ue(jt.paint_symbol["icon-halo-blur"]),"icon-translate":new Re(jt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Re(jt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ue(jt.paint_symbol["text-opacity"]),"text-color":new Ue(jt.paint_symbol["text-color"],{runtimeType:Ar,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Ue(jt.paint_symbol["text-halo-color"]),"text-halo-width":new Ue(jt.paint_symbol["text-halo-width"]),"text-halo-blur":new Ue(jt.paint_symbol["text-halo-blur"]),"text-translate":new Re(jt.paint_symbol["text-translate"]),"text-translate-anchor":new Re(jt.paint_symbol["text-translate-anchor"])})},get layout(){return tv=tv||new Hi({"symbol-placement":new Re(jt.layout_symbol["symbol-placement"]),"symbol-spacing":new Re(jt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Re(jt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ue(jt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Re(jt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Re(jt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Re(jt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Re(jt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Re(jt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Re(jt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ue(jt.layout_symbol["icon-size"]),"icon-text-fit":new Re(jt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Re(jt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ue(jt.layout_symbol["icon-image"]),"icon-rotate":new Ue(jt.layout_symbol["icon-rotate"]),"icon-padding":new Ue(jt.layout_symbol["icon-padding"]),"icon-keep-upright":new Re(jt.layout_symbol["icon-keep-upright"]),"icon-offset":new Ue(jt.layout_symbol["icon-offset"]),"icon-anchor":new Ue(jt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Re(jt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Re(jt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Re(jt.layout_symbol["text-rotation-alignment"]),"text-field":new Ue(jt.layout_symbol["text-field"]),"text-font":new Ue(jt.layout_symbol["text-font"]),"text-size":new Ue(jt.layout_symbol["text-size"]),"text-max-width":new Ue(jt.layout_symbol["text-max-width"]),"text-line-height":new Re(jt.layout_symbol["text-line-height"]),"text-letter-spacing":new Ue(jt.layout_symbol["text-letter-spacing"]),"text-justify":new Ue(jt.layout_symbol["text-justify"]),"text-radial-offset":new Ue(jt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Re(jt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ue(jt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ue(jt.layout_symbol["text-anchor"]),"text-max-angle":new Re(jt.layout_symbol["text-max-angle"]),"text-writing-mode":new Re(jt.layout_symbol["text-writing-mode"]),"text-rotate":new Ue(jt.layout_symbol["text-rotate"]),"text-padding":new Re(jt.layout_symbol["text-padding"]),"text-keep-upright":new Re(jt.layout_symbol["text-keep-upright"]),"text-transform":new Ue(jt.layout_symbol["text-transform"]),"text-offset":new Ue(jt.layout_symbol["text-offset"]),"text-allow-overlap":new Re(jt.layout_symbol["text-allow-overlap"]),"text-overlap":new Re(jt.layout_symbol["text-overlap"]),"text-ignore-placement":new Re(jt.layout_symbol["text-ignore-placement"]),"text-optional":new Re(jt.layout_symbol["text-optional"])})}};class nv{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:xs,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}xe("FormatSectionOverride",nv,{omit:["defaultValue"]});class vm extends ls{constructor(o){super(o,T_)}recalculate(o,c){if(super.recalculate(o,c),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 p=this.layout.get("text-writing-mode");if(p){const m=[];for(const v of p)m.indexOf(v)<0&&m.push(v);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,p,m){const v=this.layout.get(o).evaluate(c,{},p,m),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||eh(w.value)||!v?v:function(E,T){return T.replace(/{([^{}]+)}/g,(P,D)=>E&&D in E?String(E[D]):"")}(c.properties,v)}createBucket(o){return new xh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of T_.paint.overridableProperties){if(!vm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),p=new nv(c),m=new Af(p,c.property.specification);let v=null;v=c.value.kind==="constant"||c.value.kind==="source"?new Nf("source",m):new ih("composite",m,c.value.zoomStops),this.paint._values[o]=new so(c.property,v,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&vm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const p=o.get("text-field"),m=T_.paint.properties[c];let v=!1;const w=E=>{for(const T of E)if(m.overrides&&m.overrides.hasOverride(T))return void(v=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Zr)w(p.value.value.sections);else if(p.value.kind==="source"){const E=P=>{v||(P instanceof wl&&xi(P.value)===st?w(P.value.sections):P instanceof th?w(P.sections):P.eachChild(E))},T=p.value;T._styleExpression&&E(T._styleExpression.expression)}return v}}let iv;var Q2={get paint(){return iv=iv||new Hi({"background-color":new Re(jt.paint_background["background-color"]),"background-pattern":new Hf(jt.paint_background["background-pattern"]),"background-opacity":new Re(jt.paint_background["background-opacity"])})}};class $2 extends ls{constructor(o){super(o,Q2)}}let rv;var tS={get paint(){return rv=rv||new Hi({"raster-opacity":new Re(jt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Re(jt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Re(jt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Re(jt.paint_raster["raster-brightness-max"]),"raster-saturation":new Re(jt.paint_raster["raster-saturation"]),"raster-contrast":new Re(jt.paint_raster["raster-contrast"]),"raster-resampling":new Re(jt.paint_raster["raster-resampling"]),"raster-fade-duration":new Re(jt.paint_raster["raster-fade-duration"])})}};class eS extends ls{constructor(o){super(o,tS)}}class nS extends ls{constructor(o){super(o,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class iS{constructor(o){this._callback=o,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 L_=63710088e-1;class xu{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new xu(mt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,p=this.lat*c,m=o.lat*c,v=Math.sin(p)*Math.sin(m)+Math.cos(p)*Math.cos(m)*Math.cos((o.lng-this.lng)*c);return L_*Math.acos(Math.min(v,1))}static convert(o){if(o instanceof xu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new xu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new xu(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const ov=2*Math.PI*L_;function sv(u){return ov*Math.cos(u*Math.PI/180)}function av(u){return(180+u)/360}function lv(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function uv(u,o){return u/sv(o)}function cv(u){return 360*u-180}function M_(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class bm{constructor(o,c,p=0){this.x=+o,this.y=+c,this.z=+p}static fromLngLat(o,c=0){const p=xu.convert(o);return new bm(av(p.lng),lv(p.lat),uv(c,p.lat))}toLngLat(){return new xu(cv(this.x),M_(this.y))}toAltitude(){return this.z*sv(M_(this.y))}meterInMercatorCoordinateUnits(){return 1/ov*(o=M_(this.y),1/Math.cos(o*Math.PI/180));var o}}function hv(u,o,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class P_{constructor(o,c,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=p,this.key=gp(0,o,o,c,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,p){const m=(w=this.y,E=this.z,T=hv(256*(v=this.x),256*(w=Math.pow(2,E)-w-1),E),P=hv(256*(v+1),256*(w+1),E),T[0]+","+T[1]+","+P[0]+","+P[1]);var v,w,E,T,P;const D=function(F,G,H){let Y,tt="";for(let ut=F;ut>0;ut--)Y=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,m)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new A((o.x*c-this.x)*rr,(o.y*c-this.y)*rr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class fv{constructor(o,c){this.wrap=o,this.canonical=c,this.key=gp(o,c.z,c.z,c.x,c.y)}}class Es{constructor(o,c,p,m,v){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=c,this.canonical=new P_(p,+m,+v),this.key=gp(c,o,p,m,v)}clone(){return new Es(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new Es(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Es(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?gp(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):gp(this.wrap*+c,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new Es(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,m=2*this.canonical.y;return[new Es(c,this.wrap,c,p,m),new Es(c,this.wrap,c,p+1,m),new Es(c,this.wrap,c,p,m+1),new Es(c,this.wrap,c,p+1,m+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=F),F=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(o+1)}unpack(o,c,p){return o*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new Ss({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let m=c*this.dim,v=c*this.dim+this.dim,w=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:m=v-1;break;case 1:v=m+1}switch(p){case-1:w=E-1;break;case 1:E=w+1}const T=-c*this.dim,P=-p*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class mv{constructor(o,c,p,m,v){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=p,o._y=m,this.properties=o.properties,this.id=v}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(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class gv{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new pu(rr,16,0),this.grid3D=new pu(rr,16,0),this.featureIndexArray=new $t,this.promoteId=c}insert(o,c,p,m,v,w){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,m,v);const T=w?this.grid3D:this.grid;for(let P=0;P=0&&F[3]>=0&&T.insert(E,F[0],F[1],F[2],F[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new yu.VectorTile(new y_(this.rawTileData)).layers,this.sourceLayerCoder=new dv(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,p,m){this.loadVTLayers();const v=o.params||{},w=rr/o.tileSize/o.scale,E=Rf(v.filter),T=o.queryGeometry,P=o.queryPadding*w,D=yv(T),F=this.grid.query(D.minX-P,D.minY-P,D.maxX+P,D.maxY+P),G=yv(o.cameraQueryGeometry),H=this.grid3D.query(G.minX-P,G.minY-P,G.maxX+P,G.maxY+P,(ut,pt,Lt,bt)=>function(Nt,Ft,Yt,ye,Me){for(const pe of Nt)if(Ft<=pe.x&&Yt<=pe.y&&ye>=pe.x&&Me>=pe.y)return!0;const ge=[new A(Ft,Yt),new A(Ft,Me),new A(ye,Me),new A(ye,Yt)];if(Nt.length>2){for(const pe of ge)if(dh(Nt,pe))return!0}for(let pe=0;pe(bt||(bt=uc(Nt)),Ft.queryIntersectsFeature(T,Nt,Yt,bt,this.z,o.transform,w,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,c,p,m,v,w,E,T,P,D,F){const G=this.bucketLayerIDs[c];if(w&&!function(ut,pt){for(let Lt=0;Lt=0)return!0;return!1}(w,G))return;const H=this.sourceLayerCoder.decode(p),Y=this.vtLayers[H].feature(m);if(v.needGeometry){const ut=cc(Y,!0);if(!v.filter(new ci(this.tileID.overscaledZ),ut,this.tileID.canonical))return}else if(!v.filter(new ci(this.tileID.overscaledZ),Y))return;const tt=this.getId(Y,H);for(let ut=0;ut{const E=o instanceof fh?o.get(w):null;return E&&E.evaluate?E.evaluate(c,p,m):E})}function yv(u){let o=1/0,c=1/0,p=-1/0,m=-1/0;for(const v of u)o=Math.min(o,v.x),c=Math.min(c,v.y),p=Math.max(p,v.x),m=Math.max(m,v.y);return{minX:o,minY:c,maxX:p,maxY:m}}function rS(u,o){return o-u}function vv(u,o,c,p,m){const v=[];for(let w=0;w=p&&F.x>=p||(D.x>=p?D=new A(p,D.y+(p-D.x)/(F.x-D.x)*(F.y-D.y))._round():F.x>=p&&(F=new A(p,D.y+(p-D.x)/(F.x-D.x)*(F.y-D.y))._round()),D.y>=m&&F.y>=m||(D.y>=m?D=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round():F.y>=m&&(F=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round()),T&&D.equals(T[T.length-1])||(T=[D],v.push(T)),T.push(F)))))}}return v}xe("FeatureIndex",gv,{omit:["rawTileData","sourceLayerCoder"]});class wu extends A{constructor(o,c,p,m){super(o,c),this.angle=p,m!==void 0&&(this.segment=m)}clone(){return new wu(this.x,this.y,this.angle,this.segment)}}function bv(u,o,c,p,m){if(o.segment===void 0||c===0)return!0;let v=o,w=o.segment+1,E=0;for(;E>-c/2;){if(w--,w<0)return!1;E-=u[w].dist(v),v=u[w]}E+=u[w].dist(u[w+1]),w++;const T=[];let P=0;for(;Ep;)P-=T.shift().angleDelta;if(P>m)return!1;w++,E+=D.dist(F)}return!0}function xv(u){let o=0;for(let c=0;cP){const Y=(P-T)/H,tt=Do.number(F.x,G.x,Y),ut=Do.number(F.y,G.y,Y),pt=new wu(tt,ut,G.angleTo(F),D);return pt._round(),!w||bv(u,pt,E,w,o)?pt:void 0}T+=H}}function sS(u,o,c,p,m,v,w,E,T){const P=wv(p,v,w),D=Sv(p,m),F=D*w,G=u[0].x===0||u[0].x===T||u[0].y===0||u[0].y===T;return o-F=0&&Nt=0&&Ft=0&&G+P<=D){const Yt=new wu(Nt,Ft,Lt,Y);Yt._round(),p&&!bv(u,Yt,v,p,m)||H.push(Yt)}}F+=pt}return E||H.length||w||(H=Ev(u,F/2,c,p,m,v,w,!0,T)),H}xe("Anchor",wu);const wh=Bo;function Iv(u,o,c,p){const m=[],v=u.image,w=v.pixelRatio,E=v.paddedRect.w-2*wh,T=v.paddedRect.h-2*wh,P=u.right-u.left,D=u.bottom-u.top,F=v.stretchX||[[0,E]],G=v.stretchY||[[0,T]],H=(le,Se)=>le+Se[1]-Se[0],Y=F.reduce(H,0),tt=G.reduce(H,0),ut=E-Y,pt=T-tt;let Lt=0,bt=Y,Nt=0,Ft=tt,Yt=0,ye=ut,Me=0,ge=pt;if(v.content&&p){const le=v.content;Lt=xm(F,0,le[0]),Nt=xm(G,0,le[1]),bt=xm(F,le[0],le[2]),Ft=xm(G,le[1],le[3]),Yt=le[0]-Lt,Me=le[1]-Nt,ye=le[2]-le[0]-bt,ge=le[3]-le[1]-Ft}const pe=(le,Se,ce,ne)=>{const Be=wm(le.stretch-Lt,bt,P,u.left),Ae=Sm(le.fixed-Yt,ye,le.stretch,Y),dn=wm(Se.stretch-Nt,Ft,D,u.top),fi=Sm(Se.fixed-Me,ge,Se.stretch,tt),_i=wm(ce.stretch-Lt,bt,P,u.left),gr=Sm(ce.fixed-Yt,ye,ce.stretch,Y),cs=wm(ne.stretch-Nt,Ft,D,u.top),So=Sm(ne.fixed-Me,ge,ne.stretch,tt),or=new A(Be,dn),zr=new A(_i,dn),Hr=new A(_i,cs),Eo=new A(Be,cs),Io=new A(Ae/w,fi/w),_r=new A(gr/w,So/w),yr=o*Math.PI/180;if(yr){const uo=Math.sin(yr),Vo=Math.cos(yr),Uo=[Vo,-uo,uo,Vo];or._matMult(Uo),zr._matMult(Uo),Eo._matMult(Uo),Hr._matMult(Uo)}const lo=le.stretch+le.fixed,Co=Se.stretch+Se.fixed;return{tl:or,tr:zr,bl:Eo,br:Hr,tex:{x:v.paddedRect.x+wh+lo,y:v.paddedRect.y+wh+Co,w:ce.stretch+ce.fixed-lo,h:ne.stretch+ne.fixed-Co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Io,pixelOffsetBR:_r,minFontScaleX:ye/w/P,minFontScaleY:ge/w/D,isSDF:c}};if(p&&(v.stretchX||v.stretchY)){const le=Cv(F,ut,Y),Se=Cv(G,pt,tt);for(let ce=0;ce0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let F=w.top*E-T[0],G=w.bottom*E+T[2],H=w.left*E-T[3],Y=w.right*E+T[1];const tt=w.collisionPadding;if(tt&&(H-=tt[0]*E,F-=tt[1]*E,Y+=tt[2]*E,G+=tt[3]*E),D){const ut=new A(H,F),pt=new A(Y,F),Lt=new A(H,G),bt=new A(Y,G),Nt=D*Math.PI/180;ut._rotate(Nt),pt._rotate(Nt),Lt._rotate(Nt),bt._rotate(Nt),H=Math.min(ut.x,pt.x,Lt.x,bt.x),Y=Math.max(ut.x,pt.x,Lt.x,bt.x),F=Math.min(ut.y,pt.y,Lt.y,bt.y),G=Math.max(ut.y,pt.y,Lt.y,bt.y)}o.emplaceBack(c.x,c.y,H,F,Y,G,p,m,v)}this.boxEndIndex=o.length}}class aS{constructor(o=[],c=lS){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:p}=this,m=c[o];for(;o>0;){const v=o-1>>1,w=c[v];if(p(m,w)>=0)break;c[o]=w,o=v}c[o]=m}_down(o){const{data:c,compare:p}=this,m=this.length>>1,v=c[o];for(;o=0)break;c[o]=E,o=w}c[o]=v}}function lS(u,o){return uo?1:0}function uS(u,o=1,c=!1){let p=1/0,m=1/0,v=-1/0,w=-1/0;const E=u[0];for(let H=0;Hv)&&(v=Y.x),(!H||Y.y>w)&&(w=Y.y)}const T=Math.min(v-p,w-m);let P=T/2;const D=new aS([],cS);if(T===0)return new A(p,m);for(let H=p;HF.d||!F.d)&&(F=H,c&&console.log("found best %d after %d probes",Math.round(1e4*H.d)/1e4,G)),H.max-F.d<=o||(P=H.h/2,D.push(new Sh(H.p.x-P,H.p.y-P,P,u)),D.push(new Sh(H.p.x+P,H.p.y-P,P,u)),D.push(new Sh(H.p.x-P,H.p.y+P,P,u)),D.push(new Sh(H.p.x+P,H.p.y+P,P,u)),G+=4)}return c&&(console.log(`num probes: ${G}`),console.log(`best distance: ${F.d}`)),F.p}function cS(u,o){return o.max-u.max}function Sh(u,o,c,p){this.p=new A(u,o),this.h=c,this.d=function(m,v){let w=!1,E=1/0;for(let T=0;Tm.y!=Y.y>m.y&&m.x<(Y.x-H.x)*(m.y-H.y)/(Y.y-H.y)+H.x&&(w=!w),E=Math.min(E,l0(m,H,Y))}}return(w?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Xr;a.aq=void 0,(Xr=a.aq||(a.aq={}))[Xr.center=1]="center",Xr[Xr.left=2]="left",Xr[Xr.right=3]="right",Xr[Xr.top=4]="top",Xr[Xr.bottom=5]="bottom",Xr[Xr["top-left"]=6]="top-left",Xr[Xr["top-right"]=7]="top-right",Xr[Xr["bottom-left"]=8]="bottom-left",Xr[Xr["bottom-right"]=9]="bottom-right";const Su=7,k_=Number.POSITIVE_INFINITY;function Tv(u,o){return o[1]!==k_?function(c,p,m){let v=0,w=0;switch(p=Math.abs(p),m=Math.abs(m),c){case"top-right":case"top-left":case"top":w=m-Su;break;case"bottom-right":case"bottom-left":case"bottom":w=-m+Su}switch(c){case"top-right":case"bottom-right":case"right":v=-p;break;case"top-left":case"bottom-left":case"left":v=p}return[v,w]}(u,o[0],o[1]):function(c,p){let m=0,v=0;p<0&&(p=0);const w=p/Math.SQRT2;switch(c){case"top-right":case"top-left":v=w-Su;break;case"bottom-right":case"bottom-left":v=-w+Su;break;case"bottom":v=-p+Su;break;case"top":v=p-Su}switch(c){case"top-right":case"bottom-right":m=-w;break;case"top-left":case"bottom-left":m=w;break;case"left":m=p;break;case"right":m=-p}return[m,v]}(u,o[0])}function Lv(u,o,c){var p;const m=u.layout,v=(p=m.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},c);if(v){const E=v.values,T=[];for(let P=0;PG*mr);D.startsWith("top")?F[1]-=Su:D.startsWith("bottom")&&(F[1]+=Su),T[P+1]=F}return new rs(T)}const w=m.get("text-variable-anchor");if(w){let E;E=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(o,{},c)*mr,k_]:m.get("text-offset").evaluate(o,{},c).map(P=>P*mr);const T=[];for(const P of w)T.push(P,Tv(P,E));return new rs(T)}return null}function A_(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function hS(u,o,c,p,m,v,w,E,T,P,D){let F=v.textMaxSize.evaluate(o,{});F===void 0&&(F=w);const G=u.layers[0].layout,H=G.get("icon-offset").evaluate(o,{},D),Y=Pv(c.horizontal),tt=w/24,ut=u.tilePixelRatio*tt,pt=u.tilePixelRatio*F/24,Lt=u.tilePixelRatio*E,bt=u.tilePixelRatio*G.get("symbol-spacing"),Nt=G.get("text-padding")*u.tilePixelRatio,Ft=function(ne,Be,Ae,dn=1){const fi=ne.get("icon-padding").evaluate(Be,{},Ae),_i=fi&&fi.values;return[_i[0]*dn,_i[1]*dn,_i[2]*dn,_i[3]*dn]}(G,o,D,u.tilePixelRatio),Yt=G.get("text-max-angle")/180*Math.PI,ye=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Me=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",ge=G.get("symbol-placement"),pe=bt/2,le=G.get("icon-text-fit");let Se;p&&le!=="none"&&(u.allowVerticalPlacement&&c.vertical&&(Se=Q0(p,c.vertical,le,G.get("icon-text-fit-padding"),H,tt)),Y&&(p=Q0(p,Y,le,G.get("icon-text-fit-padding"),H,tt)));const ce=(ne,Be)=>{Be.x<0||Be.x>=rr||Be.y<0||Be.y>=rr||function(Ae,dn,fi,_i,gr,cs,So,or,zr,Hr,Eo,Io,_r,yr,lo,Co,uo,Vo,Uo,vr,Sn,co,Yr,br,Ys){const Pa=Ae.addToLineVertexArray(dn,fi);let ka,Rl,Ks,Is,Go=0,Ol=0,vp=0,Dv=0,V_=-1,U_=-1;const zl={};let Rv=kl("");if(Ae.allowVerticalPlacement&&_i.vertical){const ho=or.layout.get("text-rotate").evaluate(Sn,{},br)+90;Ks=new Em(zr,dn,Hr,Eo,Io,_i.vertical,_r,yr,lo,ho),So&&(Is=new Em(zr,dn,Hr,Eo,Io,So,uo,Vo,lo,ho))}if(gr){const ho=or.layout.get("icon-rotate").evaluate(Sn,{}),Cs=or.layout.get("icon-text-fit")!=="none",fc=Iv(gr,ho,Yr,Cs),Na=So?Iv(So,ho,Yr,Cs):void 0;Rl=new Em(zr,dn,Hr,Eo,Io,gr,uo,Vo,!1,ho),Go=4*fc.length;const pc=Ae.iconSizeData;let il=null;pc.kind==="source"?(il=[nl*or.layout.get("icon-size").evaluate(Sn,{})],il[0]>bu&&Rt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${mp}. Reduce your "icon-size".`)):pc.kind==="composite"&&(il=[nl*co.compositeIconSizes[0].evaluate(Sn,{},br),nl*co.compositeIconSizes[1].evaluate(Sn,{},br)],(il[0]>bu||il[1]>bu)&&Rt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${mp}. Reduce your "icon-size".`)),Ae.addSymbols(Ae.icon,fc,il,vr,Uo,Sn,a.ai.none,dn,Pa.lineStartIndex,Pa.lineLength,-1,br),V_=Ae.icon.placedSymbolArray.length-1,Na&&(Ol=4*Na.length,Ae.addSymbols(Ae.icon,Na,il,vr,Uo,Sn,a.ai.vertical,dn,Pa.lineStartIndex,Pa.lineLength,-1,br),U_=Ae.icon.placedSymbolArray.length-1)}const Ov=Object.keys(_i.horizontal);for(const ho of Ov){const Cs=_i.horizontal[ho];if(!ka){Rv=kl(Cs.text);const Na=or.layout.get("text-rotate").evaluate(Sn,{},br);ka=new Em(zr,dn,Hr,Eo,Io,Cs,_r,yr,lo,Na)}const fc=Cs.positionedLines.length===1;if(vp+=Mv(Ae,dn,Cs,cs,or,lo,Sn,Co,Pa,_i.vertical?a.ai.horizontal:a.ai.horizontalOnly,fc?Ov:[ho],zl,V_,co,br),fc)break}_i.vertical&&(Dv+=Mv(Ae,dn,_i.vertical,cs,or,lo,Sn,Co,Pa,a.ai.vertical,["vertical"],zl,U_,co,br));const dS=ka?ka.boxStartIndex:Ae.collisionBoxArray.length,mS=ka?ka.boxEndIndex:Ae.collisionBoxArray.length,gS=Ks?Ks.boxStartIndex:Ae.collisionBoxArray.length,_S=Ks?Ks.boxEndIndex:Ae.collisionBoxArray.length,yS=Rl?Rl.boxStartIndex:Ae.collisionBoxArray.length,vS=Rl?Rl.boxEndIndex:Ae.collisionBoxArray.length,bS=Is?Is.boxStartIndex:Ae.collisionBoxArray.length,xS=Is?Is.boxEndIndex:Ae.collisionBoxArray.length;let Aa=-1;const Cm=(ho,Cs)=>ho&&ho.circleDiameter?Math.max(ho.circleDiameter,Cs):Cs;Aa=Cm(ka,Aa),Aa=Cm(Ks,Aa),Aa=Cm(Rl,Aa),Aa=Cm(Is,Aa);const zv=Aa>-1?1:0;zv&&(Aa*=Ys/mr),Ae.glyphOffsetArray.length>=xh.MAX_GLYPHS&&Rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Sn.sortKey!==void 0&&Ae.addToSortKeyRanges(Ae.symbolInstances.length,Sn.sortKey);const wS=Lv(or,Sn,br),[SS,ES]=function(ho,Cs){const fc=ho.length,Na=Cs==null?void 0:Cs.values;if((Na==null?void 0:Na.length)>0)for(let pc=0;pc=0?zl.right:-1,zl.center>=0?zl.center:-1,zl.left>=0?zl.left:-1,zl.vertical||-1,V_,U_,Rv,dS,mS,gS,_S,yS,vS,bS,xS,Hr,vp,Dv,Go,Ol,zv,0,_r,Aa,SS,ES)}(u,Be,ne,c,p,m,Se,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ut,[Nt,Nt,Nt,Nt],ye,T,Lt,Ft,Me,H,o,v,P,D,w)};if(ge==="line")for(const ne of vv(o.geometry,0,0,rr,rr)){const Be=sS(ne,bt,Yt,c.vertical||Y,p,24,pt,u.overscaling,rr);for(const Ae of Be)Y&&fS(u,Y.text,pe,Ae)||ce(ne,Ae)}else if(ge==="line-center"){for(const ne of o.geometry)if(ne.length>1){const Be=oS(ne,Yt,c.vertical||Y,p,24,pt);Be&&ce(ne,Be)}}else if(o.type==="Polygon")for(const ne of c_(o.geometry,0)){const Be=uS(ne,16);ce(ne[0],new wu(Be.x,Be.y,0))}else if(o.type==="LineString")for(const ne of o.geometry)ce(ne,new wu(ne[0].x,ne[0].y,0));else if(o.type==="Point")for(const ne of o.geometry)for(const Be of ne)ce([Be],new wu(Be.x,Be.y,0))}function Mv(u,o,c,p,m,v,w,E,T,P,D,F,G,H,Y){const tt=function(Lt,bt,Nt,Ft,Yt,ye,Me,ge){const pe=Ft.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,le=[];for(const Se of bt.positionedLines)for(const ce of Se.positionedGlyphs){if(!ce.rect)continue;const ne=ce.rect||{};let Be=Z0+1,Ae=!0,dn=1,fi=0;const _i=(Yt||ge)&&ce.vertical,gr=ce.metrics.advance*ce.scale/2;if(ge&&bt.verticalizable&&(fi=Se.lineOffset/2-(ce.imageName?-(mr-ce.metrics.width*ce.scale)/2:(ce.scale-1)*mr)),ce.imageName){const vr=Me[ce.imageName];Ae=vr.sdf,dn=vr.pixelRatio,Be=Bo/dn}const cs=Yt?[ce.x+gr,ce.y]:[0,0];let So=Yt?[0,0]:[ce.x+gr+Nt[0],ce.y+Nt[1]-fi],or=[0,0];_i&&(or=So,So=[0,0]);const zr=ce.metrics.isDoubleResolution?2:1,Hr=(ce.metrics.left-Be)*ce.scale-gr+So[0],Eo=(-ce.metrics.top-Be)*ce.scale+So[1],Io=Hr+ne.w/zr*ce.scale/dn,_r=Eo+ne.h/zr*ce.scale/dn,yr=new A(Hr,Eo),lo=new A(Io,Eo),Co=new A(Hr,_r),uo=new A(Io,_r);if(_i){const vr=new A(-gr,gr-pp),Sn=-Math.PI/2,co=mr/2-gr,Yr=new A(5-pp-co,-(ce.imageName?co:0)),br=new A(...or);yr._rotateAround(Sn,vr)._add(Yr)._add(br),lo._rotateAround(Sn,vr)._add(Yr)._add(br),Co._rotateAround(Sn,vr)._add(Yr)._add(br),uo._rotateAround(Sn,vr)._add(Yr)._add(br)}if(pe){const vr=Math.sin(pe),Sn=Math.cos(pe),co=[Sn,-vr,vr,Sn];yr._matMult(co),lo._matMult(co),Co._matMult(co),uo._matMult(co)}const Vo=new A(0,0),Uo=new A(0,0);le.push({tl:yr,tr:lo,bl:Co,br:uo,tex:ne,writingMode:bt.writingMode,glyphOffset:cs,sectionIndex:ce.sectionIndex,isSDF:Ae,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return le}(0,c,E,m,v,w,p,u.allowVerticalPlacement),ut=u.textSizeData;let pt=null;ut.kind==="source"?(pt=[nl*m.layout.get("text-size").evaluate(w,{})],pt[0]>bu&&Rt(`${u.layerIds[0]}: Value for "text-size" is >= ${mp}. Reduce your "text-size".`)):ut.kind==="composite"&&(pt=[nl*H.compositeTextSizes[0].evaluate(w,{},Y),nl*H.compositeTextSizes[1].evaluate(w,{},Y)],(pt[0]>bu||pt[1]>bu)&&Rt(`${u.layerIds[0]}: Value for "text-size" is >= ${mp}. Reduce your "text-size".`)),u.addSymbols(u.text,tt,pt,E,v,w,P,o,T.lineStartIndex,T.lineLength,G,Y);for(const Lt of D)F[Lt]=u.text.placedSymbolArray.length-1;return 4*tt.length}function Pv(u){for(const o in u)return u[o];return null}function fS(u,o,c,p){const m=u.compareText;if(o in m){const v=m[o];for(let w=v.length-1;w>=0;w--)if(p.dist(v[w])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const v=kv[15&p];if(!v)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new N_(E,w,v,o)}constructor(o,c=64,p=Float64Array,m){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const v=kv.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,T=(8-E%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${p}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+E+T),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=c,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return D_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,p,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:w,nodeSize:E}=this,T=[0,v.length-1,0],P=[];for(;T.length;){const D=T.pop()||0,F=T.pop()||0,G=T.pop()||0;if(F-G<=E){for(let ut=G;ut<=F;ut++){const pt=w[2*ut],Lt=w[2*ut+1];pt>=o&&pt<=p&&Lt>=c&&Lt<=m&&P.push(v[ut])}continue}const H=G+F>>1,Y=w[2*H],tt=w[2*H+1];Y>=o&&Y<=p&&tt>=c&&tt<=m&&P.push(v[H]),(D===0?o<=Y:c<=tt)&&(T.push(G),T.push(H-1),T.push(1-D)),(D===0?p>=Y:m>=tt)&&(T.push(H+1),T.push(F),T.push(1-D))}return P}within(o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:v,nodeSize:w}=this,E=[0,m.length-1,0],T=[],P=p*p;for(;E.length;){const D=E.pop()||0,F=E.pop()||0,G=E.pop()||0;if(F-G<=w){for(let ut=G;ut<=F;ut++)Nv(v[2*ut],v[2*ut+1],o,c)<=P&&T.push(m[ut]);continue}const H=G+F>>1,Y=v[2*H],tt=v[2*H+1];Nv(Y,tt,o,c)<=P&&T.push(m[H]),(D===0?o-p<=Y:c-p<=tt)&&(E.push(G),E.push(H-1),E.push(1-D)),(D===0?o+p>=Y:c+p>=tt)&&(E.push(H+1),E.push(F),E.push(1-D))}return T}}function D_(u,o,c,p,m,v){if(m-p<=c)return;const w=p+m>>1;Av(u,o,w,p,m,v),D_(u,o,c,p,w-1,1-v),D_(u,o,c,w+1,m,1-v)}function Av(u,o,c,p,m,v){for(;m>p;){if(m-p>600){const P=m-p+1,D=c-p+1,F=Math.log(P),G=.5*Math.exp(2*F/3),H=.5*Math.sqrt(F*G*(P-G)/P)*(D-P/2<0?-1:1);Av(u,o,c,Math.max(p,Math.floor(c-D*G/P+H)),Math.min(m,Math.floor(c+(P-D)*G/P+H)),v)}const w=o[2*c+v];let E=p,T=m;for(_p(u,o,p,c),o[2*m+v]>w&&_p(u,o,p,m);Ew;)T--}o[2*p+v]===w?_p(u,o,p,T):(T++,_p(u,o,T,m)),T<=c&&(p=T+1),c<=T&&(m=T-1)}}function _p(u,o,c,p){R_(u,c,p),R_(o,2*c,2*p),R_(o,2*c+1,2*p+1)}function R_(u,o,c){const p=u[o];u[o]=u[c],u[c]=p}function Nv(u,o,c,p){const m=u-c,v=o-p;return m*m+v*v}var O_;a.bh=void 0,(O_=a.bh||(a.bh={})).create="create",O_.load="load",O_.fullLoad="fullLoad";let Im=null,yp=[];const z_=1e3/60,F_="loadTime",B_="fullLoadTime",pS={mark(u){performance.mark(u)},frame(u){const o=u;Im!=null&&yp.push(o-Im),Im=o},clearMetrics(){Im=null,yp=[],performance.clearMeasures(F_),performance.clearMeasures(B_);for(const u in a.bh)performance.clearMarks(a.bh[u])},getPerformanceMetrics(){performance.measure(F_,a.bh.create,a.bh.load),performance.measure(B_,a.bh.create,a.bh.fullLoad);const u=performance.getEntriesByName(F_)[0].duration,o=performance.getEntriesByName(B_)[0].duration,c=yp.length,p=1/(yp.reduce((v,w)=>v+w,0)/c/1e3),m=yp.filter(v=>v>z_).reduce((v,w)=>v+(w-z_)/z_,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:m/(c+m)*100,totalFrames:c}}};a.$=function(u,o,c){var p,m,v,w,E,T,P,D,F,G,H,Y,tt=c[0],ut=c[1],pt=c[2];return o===u?(u[12]=o[0]*tt+o[4]*ut+o[8]*pt+o[12],u[13]=o[1]*tt+o[5]*ut+o[9]*pt+o[13],u[14]=o[2]*tt+o[6]*ut+o[10]*pt+o[14],u[15]=o[3]*tt+o[7]*ut+o[11]*pt+o[15]):(m=o[1],v=o[2],w=o[3],E=o[4],T=o[5],P=o[6],D=o[7],F=o[8],G=o[9],H=o[10],Y=o[11],u[0]=p=o[0],u[1]=m,u[2]=v,u[3]=w,u[4]=E,u[5]=T,u[6]=P,u[7]=D,u[8]=F,u[9]=G,u[10]=H,u[11]=Y,u[12]=p*tt+E*ut+F*pt+o[12],u[13]=m*tt+T*ut+G*pt+o[13],u[14]=v*tt+P*ut+H*pt+o[14],u[15]=w*tt+D*ut+Y*pt+o[15]),u},a.A=mh,a.B=Do,a.C=class{constructor(u,o,c){this.receive=p=>{const m=p.data,v=m.id;if(v&&(!m.targetMapId||this.mapId===m.targetMapId))if(m.type===""){delete this.tasks[v];const w=this.cancelCallbacks[v];delete this.cancelCallbacks[v],w&&w()}else se()||m.mustQueue?(this.tasks[v]=m,this.taskQueue.push(v),this.invoker.trigger()):this.processTask(v,m)},this.process=()=>{if(!this.taskQueue.length)return;const p=this.taskQueue.shift(),m=this.tasks[p];delete this.tasks[p],this.taskQueue.length&&this.invoker.trigger(),m&&this.processTask(p,m)},this.target=u,this.parent=o,this.mapId=c,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new iS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=se()?u:window}send(u,o,c,p,m=!1){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);c&&(this.callbacks[v]=c);const w=[],E={id:v,type:u,hasCallback:!!c,targetMapId:p,mustQueue:m,sourceMapId:this.mapId,data:$a(o,w)};return this.target.postMessage(E,{transfer:w}),{cancel:()=>{c&&delete this.callbacks[v],this.target.postMessage({id:v,type:"",targetMapId:p,sourceMapId:this.mapId})}}}processTask(u,o){if(o.type===""){const c=this.callbacks[u];delete this.callbacks[u],c&&(o.error?c(du(o.error)):c(null,du(o.data)))}else{let c=!1;const p=[],m=o.hasCallback?(E,T)=>{c=!0,delete this.cancelCallbacks[u];const P={id:u,type:"",sourceMapId:this.mapId,error:E?$a(E):null,data:$a(T,p)};this.target.postMessage(P,{transfer:p})}:E=>{c=!0};let v=null;const w=du(o.data);if(this.parent[o.type])v=this.parent[o.type](o.sourceMapId,w,m);else if("getWorkerSource"in this.parent){const E=o.type.split(".");v=this.parent.getWorkerSource(o.sourceMapId,E[0],w.source)[E[1]](w,m)}else m(new Error(`Could not find function ${o.type}`));!c&&v&&v.cancel&&(this.cancelCallbacks[u]=v.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.D=Re,a.E=Xi,a.F=function(u,o){const c={};for(let p=0;p{}}},a.Y=ae,a.Z=function(){var u=new mh(16);return mh!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},a._=_,a.a=yn,a.a$=class extends W{},a.a0=function(u,o,c){var p=c[0],m=c[1],v=c[2];return u[0]=o[0]*p,u[1]=o[1]*p,u[2]=o[2]*p,u[3]=o[3]*p,u[4]=o[4]*m,u[5]=o[5]*m,u[6]=o[6]*m,u[7]=o[7]*m,u[8]=o[8]*v,u[9]=o[9]*v,u[10]=o[10]*v,u[11]=o[11]*v,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},a.a1=f0,a.a2=function(){return ct++},a.a3=at,a.a4=xh,a.a5=function(){zo.isLoading()||zo.isLoaded()||Wf()!=="deferred"||$d()},a.a6=Rf,a.a7=cc,a.a8=ci,a.a9=mv,a.aA=rc,a.aB=function(u){u=u.slice();const o=Object.create(null);for(let c=0;c{p[w.source]?c.push({command:In.removeLayer,args:[w.id]}):v.push(w)}),c=c.concat(m),function(w,E,T){E=E||[];const P=(w=w||[]).map(Gs),D=E.map(Gs),F=w.reduce(wa,{}),G=E.reduce(wa,{}),H=P.slice(),Y=Object.create(null);let tt,ut,pt,Lt,bt,Nt,Ft;for(tt=0,ut=0;tt@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,m,v)=>{const w=m||v;return o[p]=!w||w.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},a.ab=function(u,o){const c=[];for(const p in u)p in o||c.push(p);return c},a.ac=function(u){if(Ce==null){const o=u.navigator?u.navigator.userAgent:null;Ce=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Ce},a.ad=ft,a.ae=function(u,o,c){var p=Math.sin(c),m=Math.cos(c),v=o[0],w=o[1],E=o[2],T=o[3],P=o[4],D=o[5],F=o[6],G=o[7];return o!==u&&(u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[0]=v*m+P*p,u[1]=w*m+D*p,u[2]=E*m+F*p,u[3]=T*m+G*p,u[4]=P*m-v*p,u[5]=D*m-w*p,u[6]=F*m-E*p,u[7]=G*m-T*p,u},a.af=function(u){var o=new mh(16);return o[0]=u[0],o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=u[6],o[7]=u[7],o[8]=u[8],o[9]=u[9],o[10]=u[10],o[11]=u[11],o[12]=u[12],o[13]=u[13],o[14]=u[14],o[15]=u[15],o},a.ag=um,a.ah=function(u,o){let c=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:m,minZoom:v,maxZoom:w}=u,E=m?ft(Ro.interpolationFactor(m,o,v,w),0,1):0;u.kind==="camera"?p=Do.number(u.minSize,u.maxSize,E):c=E}return{uSizeT:c,uSize:p}},a.aj=function(u,{uSize:o,uSizeT:c},{lowerSize:p,upperSize:m}){return u.kind==="source"?p/nl:u.kind==="composite"?Do.number(p/nl,m/nl,c):o},a.ak=E_,a.al=function(u,o,c,p){const m=o.y-u.y,v=o.x-u.x,w=p.y-c.y,E=p.x-c.x,T=w*v-E*m;if(T===0)return null;const P=(E*(u.y-c.y)-w*(u.x-c.x))/T;return new A(u.x+P*v,u.y+P*m)},a.am=vv,a.an=s0,a.ao=i_,a.ap=mr,a.ar=S_,a.as=function(u,o){var c=o[0],p=o[1],m=o[2],v=o[3],w=o[4],E=o[5],T=o[6],P=o[7],D=o[8],F=o[9],G=o[10],H=o[11],Y=o[12],tt=o[13],ut=o[14],pt=o[15],Lt=c*E-p*w,bt=c*T-m*w,Nt=c*P-v*w,Ft=p*T-m*E,Yt=p*P-v*E,ye=m*P-v*T,Me=D*tt-F*Y,ge=D*ut-G*Y,pe=D*pt-H*Y,le=F*ut-G*tt,Se=F*pt-H*tt,ce=G*pt-H*ut,ne=Lt*ce-bt*Se+Nt*le+Ft*pe-Yt*ge+ye*Me;return ne?(u[0]=(E*ce-T*Se+P*le)*(ne=1/ne),u[1]=(m*Se-p*ce-v*le)*ne,u[2]=(tt*ye-ut*Yt+pt*Ft)*ne,u[3]=(G*Yt-F*ye-H*Ft)*ne,u[4]=(T*pe-w*ce-P*ge)*ne,u[5]=(c*ce-m*pe+v*ge)*ne,u[6]=(ut*Nt-Y*ye-pt*bt)*ne,u[7]=(D*ye-G*Nt+H*bt)*ne,u[8]=(w*Se-E*pe+P*Me)*ne,u[9]=(p*pe-c*Se-v*Me)*ne,u[10]=(Y*Yt-tt*Nt+pt*Lt)*ne,u[11]=(F*Nt-D*Yt-H*Lt)*ne,u[12]=(E*ge-w*le-T*Me)*ne,u[13]=(c*le-p*ge+m*Me)*ne,u[14]=(tt*bt-Y*Ft-ut*Lt)*ne,u[15]=(D*Ft-F*bt+G*Lt)*ne,u):null},a.at=A_,a.au=w_,a.av=N_,a.aw=function(){const u={},o=jt.$version;for(const c in jt.$root){const p=jt.$root[c];if(p.required){let m=null;m=c==="version"?o:p.type==="array"?[]:{},m!=null&&(u[c]=m)}}return u},a.ax=In,a.ay=Yd,a.az=hn,a.b=function(u,o){const c=new Blob([new Uint8Array(u)],{type:"image/png"});createImageBitmap(c).then(p=>{o(null,p)}).catch(p=>{o(new Error(`Could not load image because of ${p.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},a.b0=Rr,a.b1=function(u,o){var c=u[0],p=u[1],m=u[2],v=u[3],w=u[4],E=u[5],T=u[6],P=u[7],D=u[8],F=u[9],G=u[10],H=u[11],Y=u[12],tt=u[13],ut=u[14],pt=u[15],Lt=o[0],bt=o[1],Nt=o[2],Ft=o[3],Yt=o[4],ye=o[5],Me=o[6],ge=o[7],pe=o[8],le=o[9],Se=o[10],ce=o[11],ne=o[12],Be=o[13],Ae=o[14],dn=o[15];return Math.abs(c-Lt)<=wo*Math.max(1,Math.abs(c),Math.abs(Lt))&&Math.abs(p-bt)<=wo*Math.max(1,Math.abs(p),Math.abs(bt))&&Math.abs(m-Nt)<=wo*Math.max(1,Math.abs(m),Math.abs(Nt))&&Math.abs(v-Ft)<=wo*Math.max(1,Math.abs(v),Math.abs(Ft))&&Math.abs(w-Yt)<=wo*Math.max(1,Math.abs(w),Math.abs(Yt))&&Math.abs(E-ye)<=wo*Math.max(1,Math.abs(E),Math.abs(ye))&&Math.abs(T-Me)<=wo*Math.max(1,Math.abs(T),Math.abs(Me))&&Math.abs(P-ge)<=wo*Math.max(1,Math.abs(P),Math.abs(ge))&&Math.abs(D-pe)<=wo*Math.max(1,Math.abs(D),Math.abs(pe))&&Math.abs(F-le)<=wo*Math.max(1,Math.abs(F),Math.abs(le))&&Math.abs(G-Se)<=wo*Math.max(1,Math.abs(G),Math.abs(Se))&&Math.abs(H-ce)<=wo*Math.max(1,Math.abs(H),Math.abs(ce))&&Math.abs(Y-ne)<=wo*Math.max(1,Math.abs(Y),Math.abs(ne))&&Math.abs(tt-Be)<=wo*Math.max(1,Math.abs(tt),Math.abs(Be))&&Math.abs(ut-Ae)<=wo*Math.max(1,Math.abs(ut),Math.abs(Ae))&&Math.abs(pt-dn)<=wo*Math.max(1,Math.abs(pt),Math.abs(dn))},a.b2=function(u,o){return u[0]=o[0],u[1]=o[1],u[2]=o[2],u[3]=o[3],u[4]=o[4],u[5]=o[5],u[6]=o[6],u[7]=o[7],u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},a.b3=function(u,o,c){return u[0]=o[0]*c[0],u[1]=o[1]*c[1],u[2]=o[2]*c[2],u[3]=o[3]*c[3],u},a.b4=function(u,o){return u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]*o[3]},a.b5=mt,a.b6=fv,a.b7=uv,a.b8=function(u,o,c,p,m){var v,w=1/Math.tan(o/2);return u[0]=w/c,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=w,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,m!=null&&m!==1/0?(u[10]=(m+p)*(v=1/(p-m)),u[14]=2*m*p*v):(u[10]=-1,u[14]=-2*p),u},a.b9=function(u,o,c){var p=Math.sin(c),m=Math.cos(c),v=o[4],w=o[5],E=o[6],T=o[7],P=o[8],D=o[9],F=o[10],G=o[11];return o!==u&&(u[0]=o[0],u[1]=o[1],u[2]=o[2],u[3]=o[3],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[4]=v*m+P*p,u[5]=w*m+D*p,u[6]=E*m+F*p,u[7]=T*m+G*p,u[8]=P*m-v*p,u[9]=D*m-w*p,u[10]=F*m-E*p,u[11]=G*m-T*p,u},a.bA=S,a.bB=F0,a.bC=nh,a.bD=zo,a.ba=J,a.bb=it,a.bc=function(u,o){return u[0]=o[0],u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=o[1],u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=o[2],u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u},a.bd=class extends lc{},a.be=L_,a.bf=cv,a.bg=pS,a.bi=De,a.bj=function(u,o,c=!1){if(bo===Uf||bo===Gf||bo===jf)throw new Error("setRTLTextPlugin cannot be called multiple times.");tl=qn.resolveURL(u),bo=Uf,qf=o,Zf(),c||$d()},a.bk=Wf,a.bl=function(u,o){const c={};for(let m=0;mne*mr)}let ge=w?"center":c.get("text-justify").evaluate(P,{},u.canonical);const pe=c.get("symbol-placement"),le=pe==="point"?c.get("text-max-width").evaluate(P,{},u.canonical)*mr:0,Se=()=>{u.bucket.allowVerticalPlacement&&Ff(Nt)&&(Y.vertical=gm(tt,u.glyphMap,u.glyphPositions,u.imagePositions,D,le,v,ye,"left",Yt,pt,a.ai.vertical,!0,pe,G,F))};if(!w&&Me){const ce=new Set;if(ge==="auto")for(let Be=0;Be{o(null,c),URL.revokeObjectURL(c.src),c.onload=null,window.requestAnimationFrame(()=>{c.src=jn})},c.onerror=()=>o(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 p=new Blob([new Uint8Array(u)],{type:"image/png"});c.src=u.byteLength?URL.createObjectURL(p):jn},a.e=_t,a.f=function(u,o){return wn(_t(u,{type:"json"}),o)},a.g=On,a.h=qn,a.i=se,a.j=pn,a.k=Xn,a.l=gt,a.m=wn,a.n=function(u){return new y_(u).readFields(G2,[])},a.o=function(u,o,c){if(!u.length)return c(null,[]);let p=u.length;const m=new Array(u.length);let v=null;u.forEach((w,E)=>{o(w,(T,P)=>{T&&(v=T),m[E]=P,--p==0&&c(v,m)})})},a.p=W0,a.q=op,a.r=Hi,a.s=Ie,a.t=Hg,a.u=_e,a.v=jt,a.w=Rt,a.x=uh,a.y=Ta,a.z=function([u,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(c),y:u*Math.sin(o)*Math.sin(c),z:u*Math.cos(c)}}}),l(["./shared"],function(a){class _{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,q){for(const Z of V){this._layerConfigs[Z.id]=Z;const ot=this._layers[Z.id]=a.aC(Z);ot._featureFilter=a.a6(ot.filter),this.keyCache[Z.id]&&delete this.keyCache[Z.id]}for(const Z of q)delete this.keyCache[Z],delete this._layerConfigs[Z],delete this._layers[Z];this.familiesBySource={};const K=a.bl(Object.values(this._layerConfigs),this.keyCache);for(const Z of K){const ot=Z.map(Wt=>this._layers[Wt.id]),Ct=ot[0];if(Ct.visibility==="none")continue;const yt=Ct.source||"";let rt=this.familiesBySource[yt];rt||(rt=this.familiesBySource[yt]={});const St=Ct.sourceLayer||"_geojsonTileLayer";let qt=rt[St];qt||(qt=rt[St]=[]),qt.push(ot)}}}class x{constructor(V){const q={},K=[];for(const yt in V){const rt=V[yt],St=q[yt]={};for(const qt in rt){const Wt=rt[+qt];if(!Wt||Wt.bitmap.width===0||Wt.bitmap.height===0)continue;const Ht={x:0,y:0,w:Wt.bitmap.width+2,h:Wt.bitmap.height+2};K.push(Ht),St[qt]={rect:Ht,metrics:Wt.metrics}}}const{w:Z,h:ot}=a.p(K),Ct=new a.q({width:Z||1,height:ot||1});for(const yt in V){const rt=V[yt];for(const St in rt){const qt=rt[+St];if(!qt||qt.bitmap.width===0||qt.bitmap.height===0)continue;const Wt=q[yt][St].rect;a.q.copy(qt.bitmap,Ct,{x:0,y:0},{x:Wt.x+1,y:Wt.y+1},qt.bitmap)}}this.image=Ct,this.positions=q}}a.bm("GlyphAtlas",x);class S{constructor(V){this.tileID=new a.O(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(V,q,K,Z,ot){this.status="parsing",this.data=V,this.collisionBoxArray=new a.a3;const Ct=new a.bn(Object.keys(V.layers).sort()),yt=new a.bo(this.tileID,this.promoteId);yt.bucketLayerIDs=[];const rt={},St={featureIndex:yt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},qt=q.familiesBySource[this.source];for(const kn in qt){const Pn=V.layers[kn];if(!Pn)continue;Pn.version===1&&a.w(`Vector tile source "${this.source}" layer "${kn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qr=Ct.encode(kn),oi=[];for(let ir=0;ir=Nr.maxzoom||Nr.visibility!=="none"&&(L(ir,this.zoom,K),(rt[Nr.id]=Nr.createBucket({index:yt.bucketLayerIDs.length,layers:ir,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qr,sourceID:this.source})).populate(oi,St,this.tileID.canonical),yt.bucketLayerIDs.push(ir.map(is=>is.id)))}}let Wt,Ht,Ne,Ke;const Te=a.aH(St.glyphDependencies,kn=>Object.keys(kn).map(Number));this.inFlightDependencies.forEach(kn=>kn==null?void 0:kn.cancel()),this.inFlightDependencies=[];const Ve=++this.dependencySentinel;Object.keys(Te).length?this.inFlightDependencies.push(Z.send("getGlyphs",{uid:this.uid,stacks:Te,source:this.source,tileID:this.tileID,type:"glyphs"},(kn,Pn)=>{Ve===this.dependencySentinel&&(Wt||(Wt=kn,Ht=Pn,Qn.call(this)))})):Ht={};const rn=Object.keys(St.iconDependencies);rn.length?this.inFlightDependencies.push(Z.send("getImages",{icons:rn,source:this.source,tileID:this.tileID,type:"icons"},(kn,Pn)=>{Ve===this.dependencySentinel&&(Wt||(Wt=kn,Ne=Pn,Qn.call(this)))})):Ne={};const Gn=Object.keys(St.patternDependencies);function Qn(){if(Wt)return ot(Wt);if(Ht&&Ne&&Ke){const kn=new x(Ht),Pn=new a.bp(Ne,Ke);for(const qr in rt){const oi=rt[qr];oi instanceof a.a4?(L(oi.layers,this.zoom,K),a.bq({bucket:oi,glyphMap:Ht,glyphPositions:kn.positions,imageMap:Ne,imagePositions:Pn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):oi.hasPattern&&(oi instanceof a.br||oi instanceof a.bs||oi instanceof a.bt)&&(L(oi.layers,this.zoom,K),oi.addFeatures(St,this.tileID.canonical,Pn.patternPositions))}this.status="done",ot(null,{buckets:Object.values(rt).filter(qr=>!qr.isEmpty()),featureIndex:yt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:kn.image,imageAtlas:Pn,glyphMap:this.returnDependencies?Ht:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?kn.positions:null})}}Gn.length?this.inFlightDependencies.push(Z.send("getImages",{icons:Gn,source:this.source,tileID:this.tileID,type:"patterns"},(kn,Pn)=>{Ve===this.dependencySentinel&&(Wt||(Wt=kn,Ke=Pn,Qn.call(this)))})):Ke={},Qn.call(this)}}function L(st,V,q){const K=new a.a8(V);for(const Z of st)Z.recalculate(K,q)}function A(st,V){const q=a.l(st.request,(K,Z,ot,Ct)=>{if(K)V(K);else if(Z)try{const yt=new a.bw.VectorTile(new a.bv(Z));V(null,{vectorTile:yt,rawData:Z,cacheControl:ot,expires:Ct})}catch(yt){const rt=new Uint8Array(Z);let St=`Unable to parse the tile at ${st.request.url}, `;St+=rt[0]===31&&rt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${yt.messge}`,V(new Error(St))}});return()=>{q.cancel(),V()}}class k{constructor(V,q,K,Z){this.actor=V,this.layerIndex=q,this.availableImages=K,this.loadVectorData=Z||A,this.fetching={},this.loading={},this.loaded={}}loadTile(V,q){const K=V.uid;this.loading||(this.loading={});const Z=!!(V&&V.request&&V.request.collectResourceTiming)&&new a.bu(V.request),ot=this.loading[K]=new S(V);ot.abort=this.loadVectorData(V,(Ct,yt)=>{if(delete this.loading[K],Ct||!yt)return ot.status="done",this.loaded[K]=ot,q(Ct);const rt=yt.rawData,St={};yt.expires&&(St.expires=yt.expires),yt.cacheControl&&(St.cacheControl=yt.cacheControl);const qt={};if(Z){const Wt=Z.finish();Wt&&(qt.resourceTiming=JSON.parse(JSON.stringify(Wt)))}ot.vectorTile=yt.vectorTile,ot.parse(yt.vectorTile,this.layerIndex,this.availableImages,this.actor,(Wt,Ht)=>{if(delete this.fetching[K],Wt||!Ht)return q(Wt);q(null,a.e({rawTileData:rt.slice(0)},Ht,St,qt))}),this.loaded=this.loaded||{},this.loaded[K]=ot,this.fetching[K]={rawTileData:rt,cacheControl:St,resourceTiming:qt}})}reloadTile(V,q){const K=this.loaded,Z=V.uid;if(K&&K[Z]){const ot=K[Z];ot.showCollisionBoxes=V.showCollisionBoxes,ot.status==="parsing"?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,(Ct,yt)=>{if(Ct||!yt)return q(Ct,yt);let rt;if(this.fetching[Z]){const{rawTileData:St,cacheControl:qt,resourceTiming:Wt}=this.fetching[Z];delete this.fetching[Z],rt=a.e({rawTileData:St.slice(0)},yt,qt,Wt)}else rt=yt;q(null,rt)}):ot.status==="done"&&(ot.vectorTile?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,q):q())}}abortTile(V,q){const K=this.loading,Z=V.uid;K&&K[Z]&&K[Z].abort&&(K[Z].abort(),delete K[Z]),q()}removeTile(V,q){const K=this.loaded,Z=V.uid;K&&K[Z]&&delete K[Z],q()}}class R{constructor(){this.loaded={}}loadTile(V,q){return a._(this,void 0,void 0,function*(){const{uid:K,encoding:Z,rawImageData:ot,redFactor:Ct,greenFactor:yt,blueFactor:rt,baseShift:St}=V,qt=ot.width+2,Wt=ot.height+2,Ht=a.a(ot)?new a.R({width:qt,height:Wt},yield a.bx(ot,-1,-1,qt,Wt)):ot,Ne=new a.by(K,Ht,Z,Ct,yt,rt,St);this.loaded=this.loaded||{},this.loaded[K]=Ne,q(null,Ne)})}removeTile(V){const q=this.loaded,K=V.uid;q&&q[K]&&delete q[K]}}function U(st,V){if(st.length!==0){j(st[0],V);for(var q=1;q=Math.abs(yt)?q-rt+yt:yt-rt+q,q=rt}q+K>=0!=!!V&&st.reverse()}var Q=a.bz(function st(V,q){var K,Z=V&&V.type;if(Z==="FeatureCollection")for(K=0;K>31}function se(st,V){for(var q=st.loadGeometry(),K=st.type,Z=0,ot=0,Ct=q.length,yt=0;ytst},$e=Math.fround||(Fe=new Float32Array(1),st=>(Fe[0]=+st,Fe[0]));var Fe;const ke=3,fn=5,Jn=6;class qn{constructor(V){this.options=Object.assign(Object.create(jn),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:q,minZoom:K,maxZoom:Z}=this.options;q&&console.time("total time");const ot=`prepare ${V.length} points`;q&&console.time(ot),this.points=V;const Ct=[];for(let rt=0;rt=K;rt--){const St=+Date.now();yt=this.trees[rt]=this._createTree(this._cluster(yt,rt)),q&&console.log("z%d: %d clusters in %dms",rt,yt.numItems,+Date.now()-St)}return q&&console.timeEnd("total time"),this}getClusters(V,q){let K=((V[0]+180)%360+360)%360-180;const Z=Math.max(-90,Math.min(90,V[1]));let ot=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Ct=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)K=-180,ot=180;else if(K>ot){const Wt=this.getClusters([K,Z,180,Ct],q),Ht=this.getClusters([-180,Z,ot,Ct],q);return Wt.concat(Ht)}const yt=this.trees[this._limitZoom(q)],rt=yt.range(hn(K),On(Ct),hn(ot),On(Z)),St=yt.data,qt=[];for(const Wt of rt){const Ht=this.stride*Wt;qt.push(St[Ht+fn]>1?ie(St,Ht,this.clusterProps):this.points[St[Ht+ke]])}return qt}getChildren(V){const q=this._getOriginId(V),K=this._getOriginZoom(V),Z="No cluster with the specified id.",ot=this.trees[K];if(!ot)throw new Error(Z);const Ct=ot.data;if(q*this.stride>=Ct.length)throw new Error(Z);const yt=this.options.radius/(this.options.extent*Math.pow(2,K-1)),rt=ot.within(Ct[q*this.stride],Ct[q*this.stride+1],yt),St=[];for(const qt of rt){const Wt=qt*this.stride;Ct[Wt+4]===V&&St.push(Ct[Wt+fn]>1?ie(Ct,Wt,this.clusterProps):this.points[Ct[Wt+ke]])}if(St.length===0)throw new Error(Z);return St}getLeaves(V,q,K){const Z=[];return this._appendLeaves(Z,V,q=q||10,K=K||0,0),Z}getTile(V,q,K){const Z=this.trees[this._limitZoom(V)],ot=Math.pow(2,V),{extent:Ct,radius:yt}=this.options,rt=yt/Ct,St=(K-rt)/ot,qt=(K+1+rt)/ot,Wt={features:[]};return this._addTileFeatures(Z.range((q-rt)/ot,St,(q+1+rt)/ot,qt),Z.data,q,K,ot,Wt),q===0&&this._addTileFeatures(Z.range(1-rt/ot,St,1,qt),Z.data,ot,K,ot,Wt),q===ot-1&&this._addTileFeatures(Z.range(0,St,rt/ot,qt),Z.data,-1,K,ot,Wt),Wt.features.length?Wt:null}getClusterExpansionZoom(V){let q=this._getOriginZoom(V)-1;for(;q<=this.options.maxZoom;){const K=this.getChildren(V);if(q++,K.length!==1)break;V=K[0].properties.cluster_id}return q}_appendLeaves(V,q,K,Z,ot){const Ct=this.getChildren(q);for(const yt of Ct){const rt=yt.properties;if(rt&&rt.cluster?ot+rt.point_count<=Z?ot+=rt.point_count:ot=this._appendLeaves(V,rt.cluster_id,K,Z,ot):ot1;let qt,Wt,Ht;if(St)qt=De(q,rt,this.clusterProps),Wt=q[rt],Ht=q[rt+1];else{const Te=this.points[q[rt+ke]];qt=Te.properties;const[Ve,rn]=Te.geometry.coordinates;Wt=hn(Ve),Ht=On(rn)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(Wt*ot-K)),Math.round(this.options.extent*(Ht*ot-Z))]],tags:qt};let Ke;Ke=St||this.options.generateId?q[rt+ke]:this.points[q[rt+ke]].id,Ke!==void 0&&(Ne.id=Ke),Ct.features.push(Ne)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,q){const{radius:K,extent:Z,reduce:ot,minPoints:Ct}=this.options,yt=K/(Z*Math.pow(2,q)),rt=V.data,St=[],qt=this.stride;for(let Wt=0;Wtq&&(Ve+=rt[Gn+fn])}if(Ve>Te&&Ve>=Ct){let rn,Gn=Ht*Te,Qn=Ne*Te,kn=-1;const Pn=((Wt/qt|0)<<5)+(q+1)+this.points.length;for(const qr of Ke){const oi=qr*qt;if(rt[oi+2]<=q)continue;rt[oi+2]=q;const ir=rt[oi+fn];Gn+=rt[oi]*ir,Qn+=rt[oi+1]*ir,rt[oi+4]=Pn,ot&&(rn||(rn=this._map(rt,Wt,!0),kn=this.clusterProps.length,this.clusterProps.push(rn)),ot(rn,this._map(rt,oi)))}rt[Wt+4]=Pn,St.push(Gn/Ve,Qn/Ve,1/0,Pn,-1,Ve),ot&&St.push(kn)}else{for(let rn=0;rn1)for(const rn of Ke){const Gn=rn*qt;if(!(rt[Gn+2]<=q)){rt[Gn+2]=q;for(let Qn=0;Qn>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,q,K){if(V[q+fn]>1){const Ct=this.clusterProps[V[q+Jn]];return K?Object.assign({},Ct):Ct}const Z=this.points[V[q+ke]].properties,ot=this.options.map(Z);return K&&ot===Z?Object.assign({},ot):ot}}function ie(st,V,q){return{type:"Feature",id:st[V+ke],properties:De(st,V,q),geometry:{type:"Point",coordinates:[(K=st[V],360*(K-.5)),mi(st[V+1])]}};var K}function De(st,V,q){const K=st[V+fn],Z=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,ot=st[V+Jn],Ct=ot===-1?{}:Object.assign({},q[ot]);return Object.assign(Ct,{cluster:!0,cluster_id:st[V+ke],point_count:K,point_count_abbreviated:Z})}function hn(st){return st/360+.5}function On(st){const V=Math.sin(st*Math.PI/180),q=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return q<0?0:q>1?1:q}function mi(st){const V=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function wn(st,V,q,K){for(var Z,ot=K,Ct=q-V>>1,yt=q-V,rt=st[V],St=st[V+1],qt=st[q],Wt=st[q+1],Ht=V+3;Htot)Z=Ht,ot=Ne;else if(Ne===ot){var Ke=Math.abs(Ht-Ct);KeK&&(Z-V>3&&wn(st,V,Z,K),st[Z+2]=ot,q-Z>3&&wn(st,Z,q,K))}function gt(st,V,q,K,Z,ot){var Ct=Z-q,yt=ot-K;if(Ct!==0||yt!==0){var rt=((st-q)*Ct+(V-K)*yt)/(Ct*Ct+yt*yt);rt>1?(q=Z,K=ot):rt>0&&(q+=Ct*rt,K+=yt*rt)}return(Ct=st-q)*Ct+(yt=V-K)*yt}function Ie(st,V,q,K){var Z={id:st===void 0?null:st,type:V,geometry:q,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(ot){var Ct=ot.geometry,yt=ot.type;if(yt==="Point"||yt==="MultiPoint"||yt==="LineString")qe(ot,Ct);else if(yt==="Polygon"||yt==="MultiLineString")for(var rt=0;rt0&&(Ct+=K?(Z*St-rt*ot)/2:Math.sqrt(Math.pow(rt-Z,2)+Math.pow(St-ot,2))),Z=rt,ot=St}var qt=V.length-3;V[2]=1,wn(V,0,qt,q),V[qt+2]=1,V.size=Math.abs(Ct),V.start=0,V.end=V.size}function Xi(st,V,q,K){for(var Z=0;Z1?1:q}function fr(st,V,q,K,Z,ot,Ct,yt){if(K/=V,ot>=(q/=V)&&Ct=K)return null;for(var rt=[],St=0;St=q&&Ke=K)){var Te=[];if(Ht==="Point"||Ht==="MultiPoint")zn(Wt,Te,q,K,Z);else if(Ht==="LineString")In(Wt,Te,q,K,Z,!1,yt.lineMetrics);else if(Ht==="MultiLineString")oo(Wt,Te,q,K,Z,!1);else if(Ht==="Polygon")oo(Wt,Te,q,K,Z,!0);else if(Ht==="MultiPolygon")for(var Ve=0;Ve=q&&Ct<=K&&(V.push(st[ot]),V.push(st[ot+1]),V.push(st[ot+2]))}}function In(st,V,q,K,Z,ot,Ct){for(var yt,rt,St=ts(st),qt=Z===0?Ha:Us,Wt=st.start,Ht=0;Htq&&(rt=qt(St,Ne,Ke,Ve,rn,q),Ct&&(St.start=Wt+yt*rt)):Gn>K?Qn=q&&(rt=qt(St,Ne,Ke,Ve,rn,q),kn=!0),Qn>K&&Gn<=K&&(rt=qt(St,Ne,Ke,Ve,rn,K),kn=!0),!ot&&kn&&(Ct&&(St.end=Wt+yt*rt),V.push(St),St=ts(st)),Ct&&(Wt+=yt)}var Pn=st.length-3;Ne=st[Pn],Ke=st[Pn+1],Te=st[Pn+2],(Gn=Z===0?Ne:Ke)>=q&&Gn<=K&&es(St,Ne,Ke,Te),Pn=St.length-3,ot&&Pn>=3&&(St[Pn]!==St[0]||St[Pn+1]!==St[1])&&es(St,St[0],St[1],St[2]),St.length&&V.push(St)}function ts(st){var V=[];return V.size=st.size,V.start=st.start,V.end=st.end,V}function oo(st,V,q,K,Z,ot){for(var Ct=0;CtCt.maxX&&(Ct.maxX=qt),Wt>Ct.maxY&&(Ct.maxY=Wt)}return Ct}function Sa(st,V,q,K){var Z=V.geometry,ot=V.type,Ct=[];if(ot==="Point"||ot==="MultiPoint")for(var yt=0;yt0&&V.size<(Z?Ct:K))q.numPoints+=V.length/3;else{for(var yt=[],rt=0;rtCt)&&(q.numSimplified++,yt.push(V[rt]),yt.push(V[rt+1])),q.numPoints++;Z&&function(St,qt){for(var Wt=0,Ht=0,Ne=St.length,Ke=Ne-2;Ht0===qt)for(Ht=0,Ne=St.length;Ht24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var K=function(Z,ot){var Ct=[];if(Z.type==="FeatureCollection")for(var yt=0;yt1&&console.time("creation"),Ht=this.tiles[Wt]=ri(st,V,q,K,rt),this.tileCoords.push({z:V,x:q,y:K}),St)){St>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,q,K,Ht.numFeatures,Ht.numPoints,Ht.numSimplified),console.timeEnd("creation"));var Ne="z"+V;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(Ht.source=st,Z){if(V===rt.maxZoom||V===Z)continue;var Ke=1<1&&console.time("clipping");var Te,Ve,rn,Gn,Qn,kn,Pn=.5*rt.buffer/rt.extent,qr=.5-Pn,oi=.5+Pn,ir=1+Pn;Te=Ve=rn=Gn=null,Qn=fr(st,qt,q-Pn,q+oi,0,Ht.minX,Ht.maxX,rt),kn=fr(st,qt,q+qr,q+ir,0,Ht.minX,Ht.maxX,rt),st=null,Qn&&(Te=fr(Qn,qt,K-Pn,K+oi,1,Ht.minY,Ht.maxY,rt),Ve=fr(Qn,qt,K+qr,K+ir,1,Ht.minY,Ht.maxY,rt),Qn=null),kn&&(rn=fr(kn,qt,K-Pn,K+oi,1,Ht.minY,Ht.maxY,rt),Gn=fr(kn,qt,K+qr,K+ir,1,Ht.minY,Ht.maxY,rt),kn=null),St>1&&console.timeEnd("clipping"),yt.push(Te||[],V+1,2*q,2*K),yt.push(Ve||[],V+1,2*q,2*K+1),yt.push(rn||[],V+1,2*q+1,2*K),yt.push(Gn||[],V+1,2*q+1,2*K+1)}}},ue.prototype.getTile=function(st,V,q){var K=this.options,Z=K.extent,ot=K.debug;if(st<0||st>24)return null;var Ct=1<1&&console.log("drilling down to z%d-%d-%d",st,V,q);for(var rt,St=st,qt=V,Wt=q;!rt&&St>0;)St--,qt=Math.floor(qt/2),Wt=Math.floor(Wt/2),rt=this.tiles[ln(St,qt,Wt)];return rt&&rt.source?(ot>1&&console.log("found parent tile z%d-%d-%d",St,qt,Wt),ot>1&&console.time("drilling down"),this.splitTile(rt.source,St,qt,Wt,st,V,q),ot>1&&console.timeEnd("drilling down"),this.tiles[yt]?ae(this.tiles[yt],Z):null):null};class on extends k{constructor(V,q,K,Z){super(V,q,K),this._dataUpdateable=new Map,this.loadGeoJSON=(ot,Ct)=>{const{promoteId:yt}=ot;if(ot.request)return a.f(ot.request,(rt,St,qt,Wt)=>{this._dataUpdateable=Ar(St,yt)?ns(St,yt):void 0,Ct(rt,St,qt,Wt)});if(typeof ot.data=="string")try{const rt=JSON.parse(ot.data);this._dataUpdateable=Ar(rt,yt)?ns(rt,yt):void 0,Ct(null,rt)}catch{Ct(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`))}else ot.dataDiff?this._dataUpdateable?(function(rt,St,qt){var Wt,Ht,Ne,Ke;if(St.removeAll&&rt.clear(),St.remove)for(const Te of St.remove)rt.delete(Te);if(St.add)for(const Te of St.add){const Ve=Je(Te,qt);Ve!=null&&rt.set(Ve,Te)}if(St.update)for(const Te of St.update){let Ve=rt.get(Te.id);if(Ve==null)continue;const rn=!Te.removeAllProperties&&(((Wt=Te.removeProperties)===null||Wt===void 0?void 0:Wt.length)>0||((Ht=Te.addOrUpdateProperties)===null||Ht===void 0?void 0:Ht.length)>0);if((Te.newGeometry||Te.removeAllProperties||rn)&&(Ve=Object.assign({},Ve),rt.set(Te.id,Ve),rn&&(Ve.properties=Object.assign({},Ve.properties))),Te.newGeometry&&(Ve.geometry=Te.newGeometry),Te.removeAllProperties)Ve.properties={};else if(((Ne=Te.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const Gn of Te.removeProperties)Object.prototype.hasOwnProperty.call(Ve.properties,Gn)&&delete Ve.properties[Gn];if(((Ke=Te.addOrUpdateProperties)===null||Ke===void 0?void 0:Ke.length)>0)for(const{key:Gn,value:Qn}of Te.addOrUpdateProperties)Ve.properties[Gn]=Qn}}(this._dataUpdateable,ot.dataDiff,yt),Ct(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):Ct(new Error(`Cannot update existing geojson data in ${ot.source}`)):Ct(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,Z&&(this.loadGeoJSON=Z)}loadGeoJSONTile(V,q){const K=V.tileID.canonical;if(!this._geoJSONIndex)return q(null,null);const Z=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!Z)return q(null,null);const ot=new class{constructor(yt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.N,this.length=yt.length,this._features=yt}feature(yt){return new class{constructor(rt){this._feature=rt,this.extent=a.N,this.type=rt.type,this.properties=rt.tags,"id"in rt&&!isNaN(rt.id)&&(this.id=parseInt(rt.id,10))}loadGeometry(){if(this._feature.type===1){const rt=[];for(const St of this._feature.geometry)rt.push([new a.P(St[0],St[1])]);return rt}{const rt=[];for(const St of this._feature.geometry){const qt=[];for(const Wt of St)qt.push(new a.P(Wt[0],Wt[1]));rt.push(qt)}return rt}}toGeoJSON(rt,St,qt){return B.call(this,rt,St,qt)}}(this._features[yt])}}(Z.features);let Ct=yn(ot);Ct.byteOffset===0&&Ct.byteLength===Ct.buffer.byteLength||(Ct=new Uint8Array(Ct)),q(null,{vectorTile:ot,rawData:Ct.buffer})}loadData(V,q){var K;(K=this._pendingRequest)===null||K===void 0||K.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Z=!!(V&&V.request&&V.request.collectResourceTiming)&&new a.bu(V.request);this._pendingCallback=q,this._pendingRequest=this.loadGeoJSON(V,(ot,Ct)=>{if(delete this._pendingCallback,delete this._pendingRequest,ot||!Ct)return q(ot);if(typeof Ct!="object")return q(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`));{Q(Ct,!0);try{if(V.filter){const rt=a.bC(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(qt=>`${qt.key}: ${qt.message}`).join(", "));Ct={type:"FeatureCollection",features:Ct.features.filter(qt=>rt.value.evaluate({zoom:0},qt))}}this._geoJSONIndex=V.cluster?new qn(function({superclusterOptions:rt,clusterProperties:St}){if(!St||!rt)return rt;const qt={},Wt={},Ht={accumulated:null,zoom:0},Ne={properties:null},Ke=Object.keys(St);for(const Te of Ke){const[Ve,rn]=St[Te],Gn=a.bC(rn),Qn=a.bC(typeof Ve=="string"?[Ve,["accumulated"],["get",Te]]:Ve);qt[Te]=Gn.value,Wt[Te]=Qn.value}return rt.map=Te=>{Ne.properties=Te;const Ve={};for(const rn of Ke)Ve[rn]=qt[rn].evaluate(Ht,Ne);return Ve},rt.reduce=(Te,Ve)=>{Ne.properties=Ve;for(const rn of Ke)Ht.accumulated=Te[rn],Te[rn]=Wt[rn].evaluate(Ht,Ne)},rt}(V)).load(Ct.features):function(rt,St){return new ue(rt,St)}(Ct,V.geojsonVtOptions)}catch(rt){return q(rt)}this.loaded={};const yt={};if(Z){const rt=Z.finish();rt&&(yt.resourceTiming={},yt.resourceTiming[V.source]=JSON.parse(JSON.stringify(rt)))}q(null,yt)}})}reloadTile(V,q){const K=this.loaded;return K&&K[V.uid]?super.reloadTile(V,q):this.loadTile(V,q)}removeSource(V,q){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),q()}getClusterExpansionZoom(V,q){try{q(null,this._geoJSONIndex.getClusterExpansionZoom(V.clusterId))}catch(K){q(K)}}getClusterChildren(V,q){try{q(null,this._geoJSONIndex.getChildren(V.clusterId))}catch(K){q(K)}}getClusterLeaves(V,q){try{q(null,this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset))}catch(K){q(K)}}}class ws{constructor(V){this.self=V,this.actor=new a.C(V,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:k,geojson:on},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(q,K)=>{if(this.workerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.workerSourceTypes[q]=K},this.self.registerRTLTextPlugin=q=>{if(a.bD.isParsed())throw new Error("RTL text plugin already registered.");a.bD.applyArabicShaping=q.applyArabicShaping,a.bD.processBidirectionalText=q.processBidirectionalText,a.bD.processStyledBidirectionalText=q.processStyledBidirectionalText}}setReferrer(V,q){this.referrer=q}setImages(V,q,K){this.availableImages[V]=q;for(const Z in this.workerSources[V]){const ot=this.workerSources[V][Z];for(const Ct in ot)ot[Ct].availableImages=q}K()}setLayers(V,q,K){this.getLayerIndex(V).replace(q),K()}updateLayers(V,q,K){this.getLayerIndex(V).update(q.layers,q.removedIds),K()}loadTile(V,q,K){this.getWorkerSource(V,q.type,q.source).loadTile(q,K)}loadDEMTile(V,q,K){this.getDEMWorkerSource(V,q.source).loadTile(q,K)}reloadTile(V,q,K){this.getWorkerSource(V,q.type,q.source).reloadTile(q,K)}abortTile(V,q,K){this.getWorkerSource(V,q.type,q.source).abortTile(q,K)}removeTile(V,q,K){this.getWorkerSource(V,q.type,q.source).removeTile(q,K)}removeDEMTile(V,q){this.getDEMWorkerSource(V,q.source).removeTile(q)}removeSource(V,q,K){if(!this.workerSources[V]||!this.workerSources[V][q.type]||!this.workerSources[V][q.type][q.source])return;const Z=this.workerSources[V][q.type][q.source];delete this.workerSources[V][q.type][q.source],Z.removeSource!==void 0?Z.removeSource(q,K):K()}loadWorkerSource(V,q,K){try{this.self.importScripts(q.url),K()}catch(Z){K(Z.toString())}}syncRTLPluginState(V,q,K){try{a.bD.setState(q);const Z=a.bD.getPluginURL();if(a.bD.isLoaded()&&!a.bD.isParsed()&&Z!=null){this.self.importScripts(Z);const ot=a.bD.isParsed();K(ot?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Z}`),ot)}}catch(Z){K(Z.toString())}}getAvailableImages(V){let q=this.availableImages[V];return q||(q=[]),q}getLayerIndex(V){let q=this.layerIndexes[V];return q||(q=this.layerIndexes[V]=new _),q}getWorkerSource(V,q,K){return this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][q]||(this.workerSources[V][q]={}),this.workerSources[V][q][K]||(this.workerSources[V][q][K]=new this.workerSourceTypes[q]({send:(Z,ot,Ct)=>{this.actor.send(Z,ot,Ct,V)}},this.getLayerIndex(V),this.getAvailableImages(V))),this.workerSources[V][q][K]}getDEMWorkerSource(V,q){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][q]||(this.demWorkerSources[V][q]=new R),this.demWorkerSources[V][q]}}return a.i()&&(self.worker=new ws(self)),ws}),l(["./shared"],function(a){var _="3.6.2";class x{static testProp(s){if(!x.docStyle)return s[0];for(let h=0;h{window.removeEventListener("click",x.suppressClickInternal,!0)},0)}static mousePos(s,h){const d=s.getBoundingClientRect();return new a.P(h.clientX-d.left-s.clientLeft,h.clientY-d.top-s.clientTop)}static touchPos(s,h){const d=s.getBoundingClientRect(),g=[];for(let b=0;b{s=[],h=0,d=0,g={}},y.addThrottleControl=N=>{const O=d++;return g[O]=N,O},y.removeThrottleControl=N=>{delete g[N],C()},y.getImage=(N,O,z=!0)=>{S.supported&&(N.headers||(N.headers={}),N.headers.accept="image/webp,*/*");const W={requestParameters:N,supportImageRefresh:z,callback:O,cancelled:!1,completed:!1,cancel:()=>{W.completed||W.cancelled||(W.cancelled=!0,W.innerRequest&&(W.innerRequest.cancel(),h--),C())}};return s.push(W),C(),W};const b=N=>{const{requestParameters:O,supportImageRefresh:z,callback:W}=N;return a.e(O,{type:"image"}),(z!==!1||a.i()||a.g(O.url)||O.headers&&!Object.keys(O.headers).reduce((nt,et)=>nt&&et==="accept",!0)?a.m:M)(O,(nt,et,at,$)=>{I(N,W,nt,et,at,$)})},I=(N,O,z,W,nt,et)=>{z?O(z):W instanceof HTMLImageElement||a.a(W)?O(null,W):W&&((at,$)=>{typeof createImageBitmap=="function"?a.b(at,$):a.d(at,$)})(W,(at,$)=>{at!=null?O(at):$!=null&&O(null,$,{cacheControl:nt,expires:et})}),N.cancelled||(N.completed=!0,h--,C())},C=()=>{const N=(()=>{const O=Object.keys(g);let z=!1;if(O.length>0){for(const W of O)if(z=g[W](),z)break}return z})()?a.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let O=h;O0;O++){const z=s.shift();if(z.cancelled){O--;continue}const W=b(z);h++,z.innerRequest=W}},M=(N,O)=>{const z=new Image,W=N.url;let nt=!1;const et=N.credentials;return et&&et==="include"?z.crossOrigin="use-credentials":(et&&et==="same-origin"||!a.s(W))&&(z.crossOrigin="anonymous"),z.fetchPriority="high",z.onload=()=>{O(null,z),z.onerror=z.onload=null},z.onerror=()=>{nt||O(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.")),z.onerror=z.onload=null},z.src=W,{cancel:()=>{nt=!0,z.src=""}}}}(j||(j={})),j.resetRequestQueue(),function(y){y.Glyphs="Glyphs",y.Image="Image",y.Source="Source",y.SpriteImage="SpriteImage",y.SpriteJSON="SpriteJSON",y.Style="Style",y.Tile="Tile",y.Unknown="Unknown"}(Q||(Q={}));class B{constructor(s){this._transformRequestFn=s}transformRequest(s,h){return this._transformRequestFn&&this._transformRequestFn(s,h)||{url:s}}normalizeSpriteURL(s,h,d){const g=function(b){const I=b.match(X);if(!I)throw new Error(`Unable to parse URL "${b}"`);return{protocol:I[1],authority:I[2],path:I[3]||"/",params:I[4]?I[4].split("&"):[]}}(s);return g.path+=`${h}${d}`,function(b){const I=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${I}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const X=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function J(y){var s=new a.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var it,ft=function(y,s,h){return y[0]=s[0]-h[0],y[1]=s[1]-h[1],y[2]=s[2]-h[2],y};it=new a.A(3),a.A!=Float32Array&&(it[0]=0,it[1]=0,it[2]=0);var mt=function(y){var s=y[0],h=y[1];return s*s+h*h};function _t(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const h=[];for(const{id:d,url:g}of y){const b=`${d}${g}`;h.indexOf(b)===-1&&(h.push(b),s.push({id:d,url:g}))}}return s}function ct(y,s,h,d,g){if(d)return void y(d);if(g!==Object.values(s).length||g!==Object.values(h).length)return;const b={};for(const I in s){b[I]={};const C=a.h.getImageCanvasContext(h[I]),M=s[I];for(const N in M){const{width:O,height:z,x:W,y:nt,sdf:et,pixelRatio:at,stretchX:$,stretchY:Et,content:Ot}=M[N];b[I][N]={data:null,pixelRatio:at,sdf:et,stretchX:$,stretchY:Et,content:Ot,spriteData:{width:O,height:z,x:W,y:nt,context:C}}}}y(null,b)}(function(){var y=new a.A(2);a.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Mt{constructor(s,h,d,g){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(h,g)}update(s,h,d){const{width:g,height:b}=s,I=!(this.size&&this.size[0]===g&&this.size[1]===b||d),{context:C}=this,{gl:M}=C;if(this.useMipmap=!!(h&&h.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!h||h.premultiply!==!1)),I)this.size=[g,b],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,b,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:N,y:O}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texSubImage2D(M.TEXTURE_2D,0,N,O,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,N,O,g,b,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,h,d){const{context:g}=this,{gl:b}=g;b.bindTexture(b.TEXTURE_2D,this.texture),d!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=b.LINEAR),s!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,s),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,d||s),this.filter=s),h!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h),this.wrap=h)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function xt(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class vt extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:h,callback:d}of this.requestors)this._notify(h,d);this.requestors=[]}}getImage(s){const h=this.images[s];if(h&&!h.data&&h.spriteData){const d=h.spriteData;h.data=new a.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),h.spriteData=null}return h}addImage(s,h){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,h)&&(this.images[s]=h)}_validate(s,h){let d=!0;const g=h.data||h.spriteData;return this._validateStretch(h.stretchX,g&&g.width)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(h.stretchY,g&&g.height)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(h.content,h)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,h){if(!s)return!0;let d=0;for(const g of s){if(g[0]-1);M++,b[M]=C,I[M]=N,I[M+1]=me}for(let C=0,M=0;C{let C=this.entries[g];C||(C=this.entries[g]={glyphs:{},requests:{},ranges:{}});let M=C.glyphs[b];if(M!==void 0)return void I(null,{stack:g,id:b,glyph:M});if(M=this._tinySDF(C,g,b),M)return C.glyphs[b]=M,void I(null,{stack:g,id:b,glyph:M});const N=Math.floor(b/256);if(256*N>65535)return void I(new Error("glyphs > 65535 not supported"));if(C.ranges[N])return void I(null,{stack:g,id:b,glyph:M});if(!this.url)return void I(new Error("glyphsUrl is not set"));let O=C.requests[N];O||(O=C.requests[N]=[],te.loadGlyphRange(g,N,this.url,this.requestManager,(z,W)=>{if(W){for(const nt in W)this._doesCharSupportLocalGlyph(+nt)||(C.glyphs[+nt]=W[+nt]);C.ranges[N]=!0}for(const nt of O)nt(z,W);delete C.requests[N]})),O.push((z,W)=>{z?I(z):W&&I(null,{stack:g,id:b,glyph:W[b]||null})})},(g,b)=>{if(g)h(g);else if(b){const I={};for(const{stack:C,id:M,glyph:N}of b)(I[C]||(I[C]={}))[M]=N&&{id:N.id,bitmap:N.bitmap.clone(),metrics:N.metrics};h(null,I)}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(a.u["CJK Unified Ideographs"](s)||a.u["Hangul Syllables"](s)||a.u.Hiragana(s)||a.u.Katakana(s))}_tinySDF(s,h,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let b=s.tinySDF;if(!b){let C="400";/bold/i.test(h)?C="900":/medium/i.test(h)?C="500":/light/i.test(h)&&(C="200"),b=s.tinySDF=new te.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:C})}const I=b.draw(String.fromCharCode(d));return{id:d,bitmap:new a.q({width:I.width||60,height:I.height||60},I.data),metrics:{width:I.glyphWidth/2||24,height:I.glyphHeight/2||24,left:I.glyphLeft/2+.5||0,top:I.glyphTop/2-27.5||-8,advance:I.glyphAdvance/2||24,isDoubleResolution:!0}}}}te.loadGlyphRange=function(y,s,h,d,g){const b=256*s,I=b+255,C=d.transformRequest(h.replace("{fontstack}",y).replace("{range}",`${b}-${I}`),Q.Glyphs);a.l(C,(M,N)=>{if(M)g(M);else if(N){const O={};for(const z of a.n(N))O[z.id]=z;g(null,O)}})},te.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:h=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:b="normal",fontStyle:I="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=h;const C=this.size=y+4*s,M=this._createCanvas(C),N=this.ctx=M.getContext("2d",{willReadFrequently:!0});N.font=`${I} ${b} ${y}px ${g}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:h,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:b}=this.ctx.measureText(y),I=Math.ceil(h),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-g))),M=Math.min(this.size-this.buffer,I+Math.ceil(d)),N=C+2*this.buffer,O=M+2*this.buffer,z=Math.max(N*O,0),W=new Uint8ClampedArray(z),nt={data:W,width:N,height:O,glyphWidth:C,glyphHeight:M,glyphTop:I,glyphLeft:0,glyphAdvance:s};if(C===0||M===0)return nt;const{ctx:et,buffer:at,gridInner:$,gridOuter:Et}=this;et.clearRect(at,at,C,M),et.fillText(y,at,at+I);const Ot=et.getImageData(at,at,C,M);Et.fill(me,0,z),$.fill(0,0,z);for(let ht=0;ht0?Xt*Xt:0,$[Vt]=Xt<0?Xt*Xt:0}}Rt(Et,0,0,N,O,N,this.f,this.v,this.z),Rt($,at,at,C,M,N,this.f,this.v,this.z);for(let ht=0;ht1&&(M=s[++C]);const O=Math.abs(N-M.left),z=Math.abs(N-M.right),W=Math.min(O,z);let nt;const et=b/d*(g+1);if(M.isDash){const at=g-Math.abs(et);nt=Math.sqrt(W*W+at*at)}else nt=g-Math.sqrt(W*W+et*et);this.data[I+N]=Math.max(0,Math.min(255,nt+128))}}}addRegularDash(s){for(let C=s.length-1;C>=0;--C){const M=s[C],N=s[C+1];M.zeroLength?s.splice(C,1):N&&N.isDash===M.isDash&&(N.left=M.left,s.splice(C,1))}const h=s[0],d=s[s.length-1];h.isDash===d.isDash&&(h.left=d.left-this.width,d.right=h.right+this.width);const g=this.width*this.nextRow;let b=0,I=s[b];for(let C=0;C1&&(I=s[++b]);const M=Math.abs(C-I.left),N=Math.abs(C-I.right),O=Math.min(M,N);this.data[g+C]=Math.max(0,Math.min(255,(I.isDash?O:-O)+128))}}addDash(s,h){const d=h?7:0,g=2*d+1;if(this.nextRow+g>this.height)return a.w("LineAtlas out of space"),null;let b=0;for(let C=0;C{g.send(s,h,b)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(h=>{h.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}}function Fe(y,s,h){const d=function(g,b){if(g)return h(g);if(b){const I=a.F(a.e(b,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);b.vector_layers&&(I.vectorLayers=b.vector_layers,I.vectorLayerIds=I.vectorLayers.map(C=>C.id)),h(null,I)}};return y.url?a.f(s.transformRequest(y.url,Q.Source),d):a.h.frame(()=>d(null,y))}class ke{constructor(s,h){s&&(h?this.setSouthWest(s).setNorthEast(h):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}setSouthWest(s){return this._sw=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}extend(s){const h=this._sw,d=this._ne;let g,b;if(s instanceof a.L)g=s,b=s;else{if(!(s instanceof ke))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(ke.convert(s)):this.extend(a.L.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(a.L.convert(s)):this;if(g=s._sw,b=s._ne,!g||!b)return this}return h||d?(h.lng=Math.min(g.lng,h.lng),h.lat=Math.min(g.lat,h.lat),d.lng=Math.max(b.lng,d.lng),d.lat=Math.max(b.lat,d.lat)):(this._sw=new a.L(g.lng,g.lat),this._ne=new a.L(b.lng,b.lat)),this}getCenter(){return new a.L((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 a.L(this.getWest(),this.getNorth())}getSouthEast(){return new a.L(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(s){const{lng:h,lat:d}=a.L.convert(s);let g=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(s){return s instanceof ke?s:s&&new ke(s)}static fromLngLat(s,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new ke(new a.L(s.lng-g,s.lat-d),new a.L(s.lng+g,s.lat+d))}}class fn{constructor(s,h,d){this.bounds=ke.convert(this.validateBounds(s)),this.minzoom=h||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const h=Math.pow(2,s.z),d=Math.floor(a.G(this.bounds.getWest())*h),g=Math.floor(a.H(this.bounds.getNorth())*h),b=Math.ceil(a.G(this.bounds.getEast())*h),I=Math.ceil(a.H(this.bounds.getSouth())*h);return s.x>=d&&s.x=g&&s.y{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Fe(this._options,this.map._requestManager,(b,I)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),b?this.fire(new a.j(b)):I&&(a.e(this,I),I.bounds&&(this.tileBounds=new fn(I.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>a.e({},this._options),this.id=s,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.e(this,a.F(h,["url","scheme","tileSize","promoteId"])),this._options=a.e({type:"vector"},h),this._collectResourceTiming=h.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g={request:this.map._requestManager.transformRequest(d,Q.Tile),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function b(I,C){return delete s.request,s.aborted?h(null):I&&I.status!==404?h(I):(C&&C.resourceTiming&&(s.resourceTiming=C.resourceTiming),this.map._refreshExpiredTiles&&C&&s.setExpiryData(C),s.loadVectorData(C,this.map.painter),h(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null)))}g.request.collectResourceTiming=this._collectResourceTiming,s.actor&&s.state!=="expired"?s.state==="loading"?s.reloadCallback=h:s.request=s.actor.send("reloadTile",g,b.bind(this)):(s.actor=this.dispatcher.getActor(),s.request=s.actor.send("loadTile",g,b.bind(this)))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.actor&&s.actor.send("abortTile",{uid:s.uid,type:this.type,source:this.id},void 0)}unloadTile(s){s.unloadVectorData(),s.actor&&s.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class qn extends a.E{constructor(s,h,d,g){super(),this.id=s,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},h),a.e(this,a.F(h,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Fe(this._options,this.map._requestManager,(s,h)=>{this._tileJSONRequest=null,this._loaded=!0,s?this.fire(new a.j(s)):h&&(a.e(this,h),h.bounds&&(this.tileBounds=new fn(h.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}serialize(){return a.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.request=j.getImage(this.map._requestManager.transformRequest(d,Q.Tile),(g,b,I)=>{if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(g)s.state="errored",h(g);else if(b){this.map._refreshExpiredTiles&&I&&s.setExpiryData(I);const C=this.map.painter.context,M=C.gl;s.texture=this.map.painter.getTileTexture(b.width),s.texture?s.texture.update(b,{useMipmap:!0}):(s.texture=new Mt(C,b,M.RGBA,{useMipmap:!0}),s.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),C.extTextureFilterAnisotropic&&M.texParameterf(M.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax)),s.state="loaded",h(null)}},this.map._refreshExpiredTiles)}abortTile(s,h){s.request&&(s.request.cancel(),delete s.request),h()}unloadTile(s,h){s.texture&&this.map.painter.saveTileTexture(s.texture),h()}hasTransition(){return!1}}class ie extends qn{constructor(s,h,d,g){super(s,h,d,g),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},h),this.encoding=h.encoding||"mapbox",this.redFactor=h.redFactor,this.greenFactor=h.greenFactor,this.blueFactor=h.blueFactor,this.baseShift=h.baseShift}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g=this.map._requestManager.transformRequest(d,Q.Tile);function b(I,C){I&&(s.state="errored",h(I)),C&&(s.dem=C,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded",h(null))}s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.request=j.getImage(g,(I,C,M)=>a._(this,void 0,void 0,function*(){if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(I)s.state="errored",h(I);else if(C){this.map._refreshExpiredTiles&&s.setExpiryData(M);const N=a.a(C)&&a.J()?C:yield function(z){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.K()){const W=z.width+2,nt=z.height+2;try{return new a.R({width:W,height:nt},yield a.M(z,-1,-1,W,nt))}catch{}}return a.h.getImageData(z,1)})}(C),O={uid:s.uid,coord:s.tileID,source:this.id,rawImageData:N,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};s.actor&&s.state!=="expired"||(s.actor=this.dispatcher.getActor(),s.actor.send("loadDEMTile",O,b))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(s){const h=s.canonical,d=Math.pow(2,h.z),g=(h.x-1+d)%d,b=h.x===0?s.wrap-1:s.wrap,I=(h.x+1+d)%d,C=h.x+1===d?s.wrap+1:s.wrap,M={};return M[new a.O(s.overscaledZ,b,h.z,g,h.y).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y).key]={backfilled:!1},h.y>0&&(M[new a.O(s.overscaledZ,b,h.z,g,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,s.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y-1).key]={backfilled:!1}),h.y+1{this._updateWorkerData()},this.serialize=()=>a.e({},this._options,{type:this.type,data:this._data}),this.id=s,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=d.getActor(),this.setEventedParent(g),this._data=h.data,this._options=a.e({},h),this._collectResourceTiming=h.collectResourceTiming,h.maxzoom!==void 0&&(this.maxzoom=h.maxzoom),h.type&&(this.type=h.type),h.attribution&&(this.attribution=h.attribution),this.promoteId=h.promoteId;const b=a.N/this.tileSize;this.workerOptions=a.e({source:this.id,cluster:h.cluster||!1,geojsonVtOptions:{buffer:(h.buffer!==void 0?h.buffer:128)*b,tolerance:(h.tolerance!==void 0?h.tolerance:.375)*b,extent:a.N,maxZoom:this.maxzoom,lineMetrics:h.lineMetrics||!1,generateId:h.generateId||!1},superclusterOptions:{maxZoom:h.clusterMaxZoom!==void 0?h.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,h.clusterMinPoints||2),extent:a.N,radius:(h.clusterRadius||50)*b,log:!1,generateId:h.generateId||!1},clusterProperties:h.clusterProperties,filter:h.filter},h.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s,h){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:s,source:this.id},h),this}getClusterChildren(s,h){return this.actor.send("geojson.getClusterChildren",{clusterId:s,source:this.id},h),this}getClusterLeaves(s,h,d,g){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:s,limit:h,offset:d},g),this}_updateWorkerData(s){const h=a.e({},this.workerOptions);s?h.dataDiff=s:typeof this._data=="string"?(h.request=this.map._requestManager.transformRequest(a.h.resolveURL(this._data),Q.Source),h.request.collectResourceTiming=this._collectResourceTiming):h.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new a.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,h,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return void this.fire(new a.k("dataabort",{dataType:"source"}));let b=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(b=g.resourceTiming[this.id].slice(0)),d)return void this.fire(new a.j(d));const I={dataType:"source"};this._collectResourceTiming&&b&&b.length>0&&a.e(I,{resourceTiming:b}),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(s,h){const d=s.actor?"reloadTile":"loadTile";s.actor=this.actor;const g={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request=this.actor.send(d,g,(b,I)=>(delete s.request,s.unloadVectorData(),s.aborted?h(null):b?h(b):(s.loadVectorData(I,this.map.painter,d==="reloadTile"),h(null))))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.aborted=!0}unloadTile(s){s.unloadVectorData(),this.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var hn=a.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class On extends a.E{constructor(s,h,d,g){super(),this.load=(b,I)=>{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=j.getImage(this.map._requestManager.transformRequest(this.url,Q.Image),(C,M)=>{this._request=null,this._loaded=!0,C?this.fire(new a.j(C)):M&&(this.image=M,b&&(this.coordinates=b),I&&I(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,hn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Mt(b,this.image,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const N=this.tiles[M];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=s,this.dispatcher=d,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=h}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=s.url,this.load(s.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(s){this.coordinates=s;const h=s.map(a.U.fromLngLat);this.tileID=function(g){let b=1/0,I=1/0,C=-1/0,M=-1/0;for(const W of g)b=Math.min(b,W.x),I=Math.min(I,W.y),C=Math.max(C,W.x),M=Math.max(M,W.y);const N=Math.max(C-b,M-I),O=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),z=Math.pow(2,O);return new a.W(O,Math.floor((b+C)/2*z),Math.floor((I+M)/2*z))}(h),this.minzoom=this.maxzoom=this.tileID.z;const d=h.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new a.V,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,a.N,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,a.N),this._boundsArray.emplaceBack(d[2].x,d[2].y,a.N,a.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(s,h){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},h(null)):(s.state="errored",h(null))}hasTransition(){return!1}}class mi extends On{constructor(s,h,d,g){super(s,h,d,g),this.load=()=>{this._loaded=!1;const b=this.options;this.urls=[];for(const I of b.urls)this.urls.push(this.map._requestManager.transformRequest(I,Q.Source).url);a.X(this.urls,(I,C)=>{this._loaded=!0,I?this.fire(new a.j(I)):C&&(this.video=C,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,hn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.texSubImage2D(I.TEXTURE_2D,0,0,0,I.RGBA,I.UNSIGNED_BYTE,this.video)):(this.texture=new Mt(b,this.video,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const N=this.tiles[M];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=h}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const h=this.video.seekable;sh.end(0)?this.fire(new a.j(new a.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${h.start(0)} and ${h.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class wn extends On{constructor(s,h,d,g){super(s,h,d,g),this.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 a.j(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())},this.prepare=()=>{let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const I=this.map.painter.context,C=I.gl;this.boundsBuffer||(this.boundsBuffer=I.createVertexBuffer(this._boundsArray,hn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Mt(I,this.canvas,C.RGBA,{premultiply:!0});let M=!1;for(const N in this.tiles){const O=this.tiles[N];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture,M=!0)}M&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(I=>typeof I!="number"))||this.fire(new a.j(new a.Y(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.Y(`sources.${s}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new a.j(new a.Y(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),h.canvas?typeof h.canvas=="string"||h.canvas instanceof HTMLCanvasElement||this.fire(new a.j(new a.Y(`sources.${s}`,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 a.j(new a.Y(`sources.${s}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.animate}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const gt={},Ie=y=>{switch(y){case"geojson":return De;case"image":return On;case"raster":return qn;case"raster-dem":return ie;case"vector":return Jn;case"video":return mi;case"canvas":return wn}return gt[y]};function qe(y,s){const h=a.Z();return a.$(h,h,[1,1,0]),a.a0(h,h,[.5*y.width,.5*y.height,1]),a.a1(h,h,y.calculatePosMatrix(s.toUnwrapped()))}function nr(y,s,h,d,g,b){const I=function(z,W,nt){if(z)for(const et of z){const at=W[et];if(at&&at.source===nt&&at.type==="fill-extrusion")return!0}else for(const et in W){const at=W[et];if(at.source===nt&&at.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),C=b.maxPitchScaleFactor(),M=y.tilesIn(d,C,I);M.sort(Xn);const N=[];for(const z of M)N.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(s,h,y._state,z.queryGeometry,z.cameraQueryGeometry,z.scale,g,b,C,qe(y.transform,z.tileID))});const O=function(z){const W={},nt={};for(const et of z){const at=et.queryResults,$=et.wrappedTileID,Et=nt[$]=nt[$]||{};for(const Ot in at){const ht=at[Ot],Tt=Et[Ot]=Et[Ot]||{},Bt=W[Ot]=W[Ot]||[];for(const Vt of ht)Tt[Vt.featureIndex]||(Tt[Vt.featureIndex]=!0,Bt.push(Vt))}}return W}(N);for(const z in O)O[z].forEach(W=>{const nt=W.feature,et=y.getFeatureState(nt.layer["source-layer"],nt.id);nt.source=nt.layer.source,nt.layer["source-layer"]&&(nt.sourceLayer=nt.layer["source-layer"]),nt.state=et});return O}function Xn(y,s){const h=y.tileID,d=s.tileID;return h.overscaledZ-d.overscaledZ||h.canonical.y-d.canonical.y||h.wrap-d.wrap||h.canonical.x-d.canonical.x}class pn{constructor(s,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=a.a2(),this.uses=0,this.tileSize=h,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(s){const h=s+this.timeAdded;hb.getLayer(N)).filter(Boolean);if(M.length!==0){C.layers=M,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(N=>M.filter(O=>O.id===N)[0]));for(const N of M)I[N.id]=C}}return I}(s.buckets,h.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4){if(this.hasSymbolBuckets=!0,!d)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4&&b.hasRTLText){this.hasRTLText=!0,a.a5();break}}this.queryPadding=0;for(const g in this.buckets){const b=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(g).queryRadius(b))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new a.a3}unloadVectorData(){for(const s in this.buckets)this.buckets[s].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(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(s)}const h=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Mt(s,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Mt(s,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,h,d,g,b,I,C,M,N,O){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:b,scale:I,tileSize:this.tileSize,pixelPosMatrix:O,transform:M,params:C,queryPadding:this.queryPadding*N},s,h,d):{}}querySourceFeatures(s,h){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),b=h&&h.sourceLayer?h.sourceLayer:"",I=g._geojsonTileLayer||g[b];if(!I)return;const C=a.a6(h&&h.filter),{z:M,x:N,y:O}=this.tileID.canonical,z={z:M,x:N,y:O};for(let W=0;Wd)g=!1;else if(h)if(this.expirationTime{this.remove(s,b)},d)),this.data[g].push(b),this.order.push(g),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const h=this.data[s].shift();return h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),h.value}getByKey(s){const h=this.data[s];return h?h[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,h){if(!this.has(s))return this;const d=s.wrapped().key,g=h===void 0?0:this.data[d].indexOf(h),b=this.data[d][g];return this.data[d].splice(g,1),b.timeout&&clearTimeout(b.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(b.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(s){const h=[];for(const d in this.data)for(const g of this.data[d])s(g.value)||h.push(g);for(const d of h)this.remove(d.value.tileID,d)}}class jt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,h,d){const g=String(h);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},a.e(this.stateChanges[s][g],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const b in this.state[s])b!==g&&(this.deletedStates[s][b]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const b in this.state[s][g])d[b]||(this.deletedStates[s][g][b]=null)}else for(const b in d)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][b]===null&&delete this.deletedStates[s][g][b]}removeFeatureState(s,h,d){if(this.deletedStates[s]===null)return;const g=String(h);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&h!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][d]=null);else if(h!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(d in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][d]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,h){const d=String(h),g=a.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const b=this.deletedStates[s][h];if(b===null)return{};for(const I in b)delete g[I]}return g}initializeTileState(s,h){s.setFeatureState(this.state,h)}coalesceChanges(s,h){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const b={};for(const I in this.stateChanges[g])this.state[g][I]||(this.state[g][I]={}),a.e(this.state[g][I],this.stateChanges[g][I]),b[I]=this.state[g][I];d[g]=b}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const b={};if(this.deletedStates[g]===null)for(const I in this.state[g])b[I]={},this.state[g][I]={};else for(const I in this.deletedStates[g]){if(this.deletedStates[g][I]===null)this.state[g][I]={};else for(const C of Object.keys(this.deletedStates[g][I]))delete this.state[g][I][C];b[I]=this.state[g][I]}d[g]=d[g]||{},a.e(d[g],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in s)s[g].setFeatureState(d,h)}}class Fi extends a.E{constructor(s,h,d){super(),this.id=s,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.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=((g,b,I,C)=>{const M=new(Ie(b.type))(g,b,I,C);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,h,d,this),this._tiles={},this._cache=new Xi(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new jt,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}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 s in this._tiles){const h=this._tiles[s];if(h.state!=="loaded"&&h.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,h){return this._source.loadTile(s,h)}_unloadTile(s){if(this._source.unloadTile)return this._source.unloadTile(s,()=>{})}_abortTile(s){this._source.abortTile&&this._source.abortTile(s,()=>{}),this._source.fire(new a.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const d=this._tiles[h];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(fr).map(s=>s.key)}getRenderableIds(s){const h=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&h.push(this._tiles[d]);return s?h.sort((d,g)=>{const b=d.tileID,I=g.tileID,C=new a.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),M=new a.P(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-I.overscaledZ||M.y-C.y||M.x-C.x}).map(d=>d.tileID.key):h.map(d=>d.tileID).sort(fr).map(d=>d.key)}hasRenderableParent(s){const h=this.findLoadedParent(s,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(s,h){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(h||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,h){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=h),this._loadTile(d,this._tileLoaded.bind(this,d,s,h)))}_tileLoaded(s,h,d,g){if(g)return s.state="errored",void(g.status!==404?this._source.fire(new a.j(g,{tile:s})):this.update(this.transform,this.terrain));s.timeAdded=a.h.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(h,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const h=this.getRenderableIds();for(let g=0;g1||(Math.abs(I)>1&&(Math.abs(I+M)===1?I+=M:Math.abs(I-M)===1&&(I-=M)),b.dem&&g.dem&&(g.dem.backfillBorder(b.dem,I,C),g.neighboringTiles&&g.neighboringTiles[N]&&(g.neighboringTiles[N].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,h,d,g){for(const b in this._tiles){let I=this._tiles[b];if(g[b]||!I.hasData()||I.tileID.overscaledZ<=h||I.tileID.overscaledZ>d)continue;let C=I.tileID;for(;I&&I.tileID.overscaledZ>h+1;){const N=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[N.key],I&&I.hasData()&&(C=N)}let M=C;for(;M.overscaledZ>h;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[C.key]=C;break}}}findLoadedParent(s,h){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=h?d:null}for(let d=s.overscaledZ-1;d>=h;d--){const g=s.scaledTo(d),b=this._getLoadedTile(g);if(b)return b}}_getLoadedTile(s){const h=this._tiles[s.key];return h&&h.hasData()?h:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const h=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(h*d*(this._maxTileCacheZoomLevels===null?a.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(b)}handleWrapJump(s){const h=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,h){const d={};for(const g in this._tiles){const b=this._tiles[g];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+h),d[b.tileID.key]=b}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,h){if(this.transform=s,this.terrain=h,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(O=>new a.O(O.canonical.z,O.wrap,O.canonical.z,O.canonical.x,O.canonical.y)):(d=s.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:h}),this._source.hasTile&&(d=d.filter(O=>this._source.hasTile(O)))):d=[];const g=s.coveringZoomLevel(this._source),b=Math.max(g-Fi.maxOverzooming,this._source.minzoom),I=Math.max(g+Fi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const O={};for(const z of d)if(z.canonical.z>this._source.minzoom){const W=z.scaledTo(z.canonical.z-1);O[W.key]=W;const nt=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));O[nt.key]=nt}d=d.concat(Object.values(O))}const C=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(zn(this._source.type)){const O={},z={},W=Object.keys(M),nt=a.h.now();for(const et of W){const at=M[et],$=this._tiles[et];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=nt)continue;const Et=this.findLoadedParent(at,b);Et&&(this._addTile(Et.tileID),O[Et.tileID.key]=Et.tileID),z[et]=at}this._retainLoadedChildren(z,g,I,M);for(const et in O)M[et]||(this._coveredTiles[et]=!0,M[et]=O[et]);if(h){const et={},at={};for(const $ of d)this._tiles[$.key].hasData()?et[$.key]=$:at[$.key]=$;for(const $ in at){const Et=at[$].children(this._source.maxzoom);this._tiles[Et[0].key]&&this._tiles[Et[1].key]&&this._tiles[Et[2].key]&&this._tiles[Et[3].key]&&(et[Et[0].key]=M[Et[0].key]=Et[0],et[Et[1].key]=M[Et[1].key]=Et[1],et[Et[2].key]=M[Et[2].key]=Et[2],et[Et[3].key]=M[Et[3].key]=Et[3],delete at[$])}for(const $ in at){const Et=this.findLoadedParent(at[$],this._source.minzoom);if(Et){et[Et.tileID.key]=M[Et.tileID.key]=Et.tileID;for(const Ot in et)et[Ot].isChildOf(Et.tileID)&&delete et[Ot]}}for(const $ in this._tiles)et[$]||(this._coveredTiles[$]=!0)}}for(const O in M)this._tiles[O].clearFadeHold();const N=a.ab(this._tiles,M);for(const O of N){const z=this._tiles[O];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(O)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,h){const d={},g={},b=Math.max(h-Fi.maxOverzooming,this._source.minzoom),I=Math.max(h+Fi.maxUnderzooming,this._source.minzoom),C={};for(const M of s){const N=this._addTile(M);d[M.key]=M,N.hasData()||hthis._source.maxzoom){const z=M.children(this._source.maxzoom)[0],W=this.getTile(z);if(W&&W.hasData()){d[z.key]=z;continue}}else{const z=M.children(this._source.maxzoom);if(d[z[0].key]&&d[z[1].key]&&d[z[2].key]&&d[z[3].key])continue}let O=N.wasRequested();for(let z=M.overscaledZ-1;z>=b;--z){const W=M.scaledTo(z);if(g[W.key])break;if(g[W.key]=!0,N=this.getTile(W),!N&&O&&(N=this._addTile(W)),N){const nt=N.hasData();if((O||nt)&&(d[W.key]=W),O=N.wasRequested(),nt)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const h=[];let d,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}h.push(g.key);const b=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(b),d)break;g=b}for(const b of h)this._loadedParentTiles[b]=d}}_addTile(s){let h=this._tiles[s.key];if(h)return h;h=this._cache.getAndRemove(s),h&&(this._setTileReloadTimer(s.key,h),h.tileID=s,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,h)));const d=h;return h||(h=new pn(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(h,this._tileLoaded.bind(this,h,s.key,h.state))),h.uses++,this._tiles[s.key]=h,d||this._source.fire(new a.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(s,h){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=h.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const h=this._tiles[s];h&&(h.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),h.uses>0||(h.hasData()&&h.state!=="reloading"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,h,d){const g=[],b=this.transform;if(!b)return g;const I=d?b.getCameraQueryGeometry(s):s,C=s.map(et=>b.pointCoordinate(et,this.terrain)),M=I.map(et=>b.pointCoordinate(et,this.terrain)),N=this.getIds();let O=1/0,z=1/0,W=-1/0,nt=-1/0;for(const et of M)O=Math.min(O,et.x),z=Math.min(z,et.y),W=Math.max(W,et.x),nt=Math.max(nt,et.y);for(let et=0;et=0&&ht[1].y+Ot>=0){const Tt=C.map(Vt=>$.getTilePoint(Vt)),Bt=M.map(Vt=>$.getTilePoint(Vt));g.push({tile:at,tileID:$,queryGeometry:Tt,cameraQueryGeometry:Bt,scale:Et})}}return g}getVisibleCoordinates(s){const h=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of h)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(zn(this._source.type)){const s=a.h.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=s)return!0}return!1}setFeatureState(s,h,d){this._state.updateState(s=s||"_geojsonTileLayer",h,d)}removeFeatureState(s,h,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",h,d)}getFeatureState(s,h){return this._state.getState(s=s||"_geojsonTileLayer",h)}setDependencies(s,h,d){const g=this._tiles[s];g&&g.setDependencies(h,d)}reloadTilesForDependencies(s,h){for(const d in this._tiles)this._tiles[d].hasDependency(s,h)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,h))}}function fr(y,s){const h=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||d-h||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function zn(y){return y==="raster"||y==="image"||y==="video"}Fi.maxOverzooming=10,Fi.maxUnderzooming=3;const In="mapboxgl_preloaded_worker_pool";class ts{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[In]}numActive(){return Object.keys(this.active).length}}const oo=Math.floor(a.h.hardwareConcurrency/2);let es;function Ha(){return es||(es=new ts),es}ts.workerCount=a.ac(globalThis)?Math.max(Math.min(oo,3),1):1;class Us{constructor(s,h){this.reset(s,h)}reset(s,h){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-I)/C:0;return this.points[b].mult(1-M).add(this.points[h].mult(M))}}function Gs(y,s){let h=!0;return y==="always"||y!=="never"&&s!=="never"||(h=!1),h}class wa{constructor(s,h,d){const g=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(h/d);for(let I=0;Ithis.width||g<0||h>this.height)return[];const M=[];if(s<=0&&h<=0&&this.width<=d&&this.height<=g){if(b)return[{key:null,x1:s,y1:h,x2:d,y2:g}];for(let N=0;N0}hitTestCircle(s,h,d,g,b){const I=s-d,C=s+d,M=h-d,N=h+d;if(C<0||I>this.width||N<0||M>this.height)return!1;const O=[];return this._forEachCell(I,M,C,N,this._queryCellCircle,O,{hitTest:!0,overlapMode:g,circle:{x:s,y:h,radius:d},seenUids:{box:{},circle:{}}},b),O.length>0}_queryCell(s,h,d,g,b,I,C,M){const{seenUids:N,hitTest:O,overlapMode:z}=C,W=this.boxCells[b];if(W!==null){const et=this.bboxes;for(const at of W)if(!N.box[at]){N.box[at]=!0;const $=4*at,Et=this.boxKeys[at];if(s<=et[$+2]&&h<=et[$+3]&&d>=et[$+0]&&g>=et[$+1]&&(!M||M(Et))&&(!O||!Gs(z,Et.overlapMode))&&(I.push({key:Et,x1:et[$],y1:et[$+1],x2:et[$+2],y2:et[$+3]}),O))return!0}}const nt=this.circleCells[b];if(nt!==null){const et=this.circles;for(const at of nt)if(!N.circle[at]){N.circle[at]=!0;const $=3*at,Et=this.circleKeys[at];if(this._circleAndRectCollide(et[$],et[$+1],et[$+2],s,h,d,g)&&(!M||M(Et))&&(!O||!Gs(z,Et.overlapMode))){const Ot=et[$],ht=et[$+1],Tt=et[$+2];if(I.push({key:Et,x1:Ot-Tt,y1:ht-Tt,x2:Ot+Tt,y2:ht+Tt}),O)return!0}}}return!1}_queryCellCircle(s,h,d,g,b,I,C,M){const{circle:N,seenUids:O,overlapMode:z}=C,W=this.boxCells[b];if(W!==null){const et=this.bboxes;for(const at of W)if(!O.box[at]){O.box[at]=!0;const $=4*at,Et=this.boxKeys[at];if(this._circleAndRectCollide(N.x,N.y,N.radius,et[$+0],et[$+1],et[$+2],et[$+3])&&(!M||M(Et))&&!Gs(z,Et.overlapMode))return I.push(!0),!0}}const nt=this.circleCells[b];if(nt!==null){const et=this.circles;for(const at of nt)if(!O.circle[at]){O.circle[at]=!0;const $=3*at,Et=this.circleKeys[at];if(this._circlesCollide(et[$],et[$+1],et[$+2],N.x,N.y,N.radius)&&(!M||M(Et))&&!Gs(z,Et.overlapMode))return I.push(!0),!0}}}_forEachCell(s,h,d,g,b,I,C,M){const N=this._convertToXCellCoord(s),O=this._convertToYCellCoord(h),z=this._convertToXCellCoord(d),W=this._convertToYCellCoord(g);for(let nt=N;nt<=z;nt++)for(let et=O;et<=W;et++)if(b.call(this,s,h,d,g,this.xCellCount*et+nt,I,C,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,h,d,g,b,I){const C=g-s,M=b-h,N=d+I;return N*N>C*C+M*M}_circleAndRectCollide(s,h,d,g,b,I,C){const M=(I-g)/2,N=Math.abs(s-(g+M));if(N>M+d)return!1;const O=(C-b)/2,z=Math.abs(h-(b+O));if(z>O+d)return!1;if(N<=M||z<=O)return!0;const W=N-M,nt=z-O;return W*W+nt*nt<=d*d}}function ae(y,s,h,d,g){const b=a.Z();return s?(a.a0(b,b,[1/g,1/g,1]),h||a.ae(b,b,d.angle)):a.a1(b,d.labelPlaneMatrix,y),b}function yo(y,s,h,d,g){if(s){const b=a.af(y);return a.a0(b,b,[g,g,1]),h||a.ae(b,b,-d.angle),b}return d.glCoordMatrix}function ri(y,s,h){let d;h?(d=[y.x,y.y,h(y.x,y.y),1],a.ag(d,d,s)):(d=[y.x,y.y,0,1],Z(d,d,s));const g=d[3];return{point:new a.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function Sa(y,s){return .5+y/s*.5}function xs(y,s){const h=y[0]/y[3],d=y[1]/y[3];return h>=-s[0]&&h<=s[0]&&d>=-s[1]&&d<=s[1]}function ue(y,s,h,d,g,b,I,C,M,N){const O=d?y.textSizeData:y.iconSizeData,z=a.ah(O,h.transform.zoom),W=[256/h.width*2+1,256/h.height*2+1],nt=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;nt.clear();const et=y.lineVertexArray,at=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,$=h.transform.width/h.transform.height;let Et=!1;for(let Ot=0;OtMath.abs(h.x-s.x)*d?{useVertical:!0}:(y===a.ai.vertical?s.yh.x)?{needsFlipping:!0}:null}function Ar(y,s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at){const $=s/24,Et=y.lineOffsetX*$,Ot=y.lineOffsetY*$;let ht;if(y.numGlyphs>1){const Tt=y.glyphStartIndex+y.numGlyphs,Bt=y.lineStartIndex,Vt=y.lineStartIndex+y.lineLength,Xt=ln($,C,Et,Ot,h,O,z,y,M,b,W,et,at);if(!Xt)return{notEnoughRoom:!0};const ee=ri(Xt.first.point,I,at).point,$t=ri(Xt.last.point,I,at).point;if(d&&!h){const oe=Je(y.writingMode,ee,$t,nt);if(oe)return oe}ht=[Xt.first];for(let oe=y.glyphStartIndex+1;oe0?ee.point:ns(z,Xt,Bt,1,g,at),oe=Je(y.writingMode,Bt,$t,nt);if(oe)return oe}const Tt=V($*C.getoffsetX(y.glyphStartIndex),Et,Ot,h,O,z,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,b,W,et,at);if(!Tt)return{notEnoughRoom:!0};ht=[Tt]}for(const Tt of ht)a.ak(N,Tt.point,Tt.angle);return{}}function ns(y,s,h,d,g,b){const I=ri(y.add(y.sub(s)._unit()),g,b).point,C=h.sub(I);return h.add(C._mult(d/C.mag()))}function on(y,s){const{projectionCache:h,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:b,distanceFromAnchor:I,getElevation:C,previousVertex:M,direction:N,absOffsetX:O}=s;if(h.projections[y])return h.projections[y];const z=new a.P(d.getx(y),d.gety(y)),W=ri(z,g,C);if(W.signedDistanceFromCamera>0)return h.projections[y]=W.point,W.point;const nt=y-N;return ns(I===0?b:new a.P(d.getx(nt),d.gety(nt)),z,M,O-I+1,g,C)}function ws(y,s,h){return y._unit()._perp()._mult(s*h)}function st(y,s,h,d,g,b,I,C){const{projectionCache:M,direction:N}=C;if(M.offsets[y])return M.offsets[y];const O=h.add(s);if(y+N=g)return M.offsets[y]=O,O;const z=on(y+N,C),W=ws(z.sub(h),I,N),nt=h.add(W),et=z.add(W);return M.offsets[y]=a.al(b,O,nt,et)||O,M.offsets[y]}function V(y,s,h,d,g,b,I,C,M,N,O,z,W,nt){const et=d?y-s:y+s;let at=et>0?1:-1,$=0;d&&(at*=-1,$=Math.PI),at<0&&($+=Math.PI);let Et,Ot,ht=at>0?C+I:C+I+1,Tt=g,Bt=g,Vt=0,Xt=0;const ee=Math.abs(et),$t=[];let oe;for(;Vt+Xt<=ee;){if(ht+=at,ht=M)return null;Vt+=Xt,Bt=Tt,Ot=Et;const fe={projectionCache:z,lineVertexArray:N,labelPlaneMatrix:O,tileAnchorPoint:b,distanceFromAnchor:Vt,getElevation:nt,previousVertex:Bt,direction:at,absOffsetX:ee};if(Tt=on(ht,fe),h===0)$t.push(Bt),oe=Tt.sub(Bt);else{let Ge;const Pe=Tt.sub(Bt);Ge=Pe.mag()===0?ws(on(ht+at,fe).sub(Tt),h,at):ws(Pe,h,at),Ot||(Ot=Bt.add(Ge)),Et=st(ht,Ge,Tt,C,M,Ot,h,fe),$t.push(Ot),oe=Et.sub(Ot)}Xt=oe.mag()}const Le=oe._mult((ee-Vt)/Xt)._add(Ot||Bt),vn=$+Math.atan2(Tt.y-Bt.y,Tt.x-Bt.x);return $t.push(Le),{point:Le,angle:W?vn:0,path:$t}}const q=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function K(y,s){for(let h=0;h=1;un--)Pe.push(fe.path[un]);for(let un=1;unri(bn,M,et));Pe=un.some(bn=>bn.signedDistanceFromCamera<=0)?[]:un.map(bn=>bn.point)}let _n=[];if(Pe.length>0){const un=Pe[0].clone(),bn=Pe[0].clone();for(let Bi=1;Bi=oe.x&&bn.x<=Le.x&&un.y>=oe.y&&bn.y<=Le.y?[Pe]:bn.xLe.x||bn.yLe.y?[]:a.am([Pe],oe.x,oe.y,Le.x,Le.y)}for(const un of _n){vn.reset(un,.25*$t);let bn=0;bn=vn.length<=.5*$t?1:Math.ceil(vn.paddedLength/Yn)+1;for(let Bi=0;Bi=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,h,d,g){return d>=0&&s=0&&hd.collisionGroupID===h}}return this.collisionGroups[s]}}function Ke(y,s,h,d,g){const{horizontalAlign:b,verticalAlign:I}=a.au(y);return new a.P(-(b-.5)*s+d[0]*g,-(I-.5)*h+d[1]*g)}function Te(y,s,h,d,g,b){const{x1:I,x2:C,y1:M,y2:N,anchorPointX:O,anchorPointY:z}=y,W=new a.P(s,h);return d&&W._rotate(g?b:-b),{x1:I+W.x,y1:M+W.y,x2:C+W.x,y2:N+W.y,anchorPointX:O,anchorPointY:z}}class Ve{constructor(s,h,d,g,b){this.transform=s.clone(),this.terrain=h,this.collisionIndex=new Ct(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Ne(g),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,h,d,g){const b=d.getBucket(h),I=d.latestFeatureIndex;if(!b||!I||h.id!==b.layerIds[0])return;const C=d.collisionBoxArray,M=b.layers[0].layout,N=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),O=d.tileSize/a.N,z=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),W=M.get("text-pitch-alignment")==="map",nt=M.get("text-rotation-alignment")==="map",et=yt(d,1,this.transform.zoom),at=ae(z,W,nt,this.transform,et);let $=null;if(W){const Ot=yo(z,W,nt,this.transform,et);$=a.a1([],this.transform.labelPlaneMatrix,Ot)}this.retainedQueryData[b.bucketInstanceId]=new Ht(b.bucketInstanceId,I,b.sourceLayerIndex,b.index,d.tileID);const Et={bucket:b,layout:M,posMatrix:z,textLabelPlaneMatrix:at,labelToScreenMatrix:$,scale:N,textPixelRatio:O,holdingForFade:d.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:a.ah(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(g)for(const Ot of b.sortKeyRanges){const{sortKey:ht,symbolInstanceStart:Tt,symbolInstanceEnd:Bt}=Ot;s.push({sortKey:ht,symbolInstanceStart:Tt,symbolInstanceEnd:Bt,parameters:Et})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Et})}attemptAnchorPlacement(s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at,$){const Et=a.aq[s.textAnchor],Ot=[s.textOffset0,s.textOffset1],ht=Ke(Et,d,g,Ot,b),Tt=this.collisionIndex.placeCollisionBox(Te(h,ht.x,ht.y,I,C,this.transform.angle),z,M,N,O.predicate,$);if((!at||this.collisionIndex.placeCollisionBox(Te(at,ht.x,ht.y,I,C,this.transform.angle),z,M,N,O.predicate,$).box.length!==0)&&Tt.box.length>0){let Bt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID].text&&(Bt=this.prevPlacement.variableOffsets[W.crossTileID].anchor),W.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[W.crossTileID]={textOffset:Ot,width:d,height:g,anchor:Et,textBoxScale:b,prevAnchor:Bt},this.markUsedJustification(nt,Et,W,et),nt.allowVerticalPlacement&&(this.markUsedOrientation(nt,et,W),this.placedOrientations[W.crossTileID]=et),{shift:ht,placedGlyphBoxes:Tt}}}placeLayerBucketPart(s,h,d){const{bucket:g,layout:b,posMatrix:I,textLabelPlaneMatrix:C,labelToScreenMatrix:M,textPixelRatio:N,holdingForFade:O,collisionBoxArray:z,partiallyEvaluatedTextSize:W,collisionGroup:nt}=s.parameters,et=b.get("text-optional"),at=b.get("icon-optional"),$=a.ar(b,"text-overlap","text-allow-overlap"),Et=$==="always",Ot=a.ar(b,"icon-overlap","icon-allow-overlap"),ht=Ot==="always",Tt=b.get("text-rotation-alignment")==="map",Bt=b.get("text-pitch-alignment")==="map",Vt=b.get("icon-text-fit")!=="none",Xt=b.get("symbol-z-order")==="viewport-y",ee=Et&&(ht||!g.hasIconData()||at),$t=ht&&(Et||!g.hasTextData()||et);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const oe=this.retainedQueryData[g.bucketInstanceId].tileID,Le=this.terrain?(fe,Ge)=>this.terrain.getElevation(oe,fe,Ge):null,vn=(fe,Ge)=>{var Pe,Yn;if(h[fe.crossTileID])return;if(O)return void(this.placements[fe.crossTileID]=new qt(!1,!1,!1));let _n=!1,un=!1,bn=!0,Bi=null,si={box:null,offscreen:null},Rr={box:null,offscreen:null},pr=null,Yi=null,Fo=null,hi=0,qs=0,Zs=0;Ge.textFeatureIndex?hi=Ge.textFeatureIndex:fe.useRuntimeCollisionCircles&&(hi=fe.featureIndex),Ge.verticalTextFeatureIndex&&(qs=Ge.verticalTextFeatureIndex);const el=Ge.textBox;if(el){const Wr=Vi=>{let dr=a.ai.horizontal;if(g.allowVerticalPlacement&&!Vi&&this.prevPlacement){const xo=this.prevPlacement.placedOrientations[fe.crossTileID];xo&&(this.placedOrientations[fe.crossTileID]=xo,dr=xo,this.markUsedOrientation(g,dr,fe))}return dr},Or=(Vi,dr)=>{if(g.allowVerticalPlacement&&fe.numVerticalGlyphVertices>0&&Ge.verticalTextBox){for(const xo of g.writingModes)if(xo===a.ai.vertical?(si=dr(),Rr=si):si=Vi(),si&&si.box&&si.box.length)break}else si=Vi()},ao=fe.textAnchorOffsetStartIndex,kl=fe.textAnchorOffsetEndIndex;if(kl===ao){const Vi=(dr,xo)=>{const Ui=this.collisionIndex.placeCollisionBox(dr,$,N,I,nt.predicate,Le);return Ui&&Ui.box&&Ui.box.length&&(this.markUsedOrientation(g,xo,fe),this.placedOrientations[fe.crossTileID]=xo),Ui};Or(()=>Vi(el,a.ai.horizontal),()=>{const dr=Ge.verticalTextBox;return g.allowVerticalPlacement&&fe.numVerticalGlyphVertices>0&&dr?Vi(dr,a.ai.vertical):{box:null,offscreen:null}}),Wr(si&&si.box&&si.box.length)}else{let Vi=a.aq[(Yn=(Pe=this.prevPlacement)===null||Pe===void 0?void 0:Pe.variableOffsets[fe.crossTileID])===null||Yn===void 0?void 0:Yn.anchor];const dr=(Ui,Al,ph)=>{const rm=Ui.x2-Ui.x1,om=Ui.y2-Ui.y1,Qg=fe.textBoxScale,ep=Vt&&Ot==="never"?Al:null;let Ws={box:[],offscreen:!1},Nl=$==="never"?1:2,Xs="never";Vi&&Nl++;for(let us=0;usdr(el,Ge.iconBox,a.ai.horizontal),()=>{const Ui=Ge.verticalTextBox;return g.allowVerticalPlacement&&!(si&&si.box&&si.box.length)&&fe.numVerticalGlyphVertices>0&&Ui?dr(Ui,Ge.verticalIconBox,a.ai.vertical):{box:null,offscreen:null}}),si&&(_n=si.box,bn=si.offscreen);const xo=Wr(si&&si.box);if(!_n&&this.prevPlacement){const Ui=this.prevPlacement.variableOffsets[fe.crossTileID];Ui&&(this.variableOffsets[fe.crossTileID]=Ui,this.markUsedJustification(g,Ui.anchor,fe,xo))}}}if(pr=si,_n=pr&&pr.box&&pr.box.length>0,bn=pr&&pr.offscreen,fe.useRuntimeCollisionCircles){const Wr=g.text.placedSymbolArray.get(fe.centerJustifiedTextSymbolIndex),Or=a.aj(g.textSizeData,W,Wr),ao=b.get("text-padding");Yi=this.collisionIndex.placeCollisionCircles($,Wr,g.lineVertexArray,g.glyphOffsetArray,Or,I,C,M,d,Bt,nt.predicate,fe.collisionCircleDiameter,ao,Le),Yi.circles.length&&Yi.collisionDetected&&!d&&a.w("Collisions detected, but collision boxes are not shown"),_n=Et||Yi.circles.length>0&&!Yi.collisionDetected,bn=bn&&Yi.offscreen}if(Ge.iconFeatureIndex&&(Zs=Ge.iconFeatureIndex),Ge.iconBox){const Wr=Or=>{const ao=Vt&&Bi?Te(Or,Bi.x,Bi.y,Tt,Bt,this.transform.angle):Or;return this.collisionIndex.placeCollisionBox(ao,Ot,N,I,nt.predicate,Le)};Rr&&Rr.box&&Rr.box.length&&Ge.verticalIconBox?(Fo=Wr(Ge.verticalIconBox),un=Fo.box.length>0):(Fo=Wr(Ge.iconBox),un=Fo.box.length>0),bn=bn&&Fo.offscreen}const Pl=et||fe.numHorizontalGlyphVertices===0&&fe.numVerticalGlyphVertices===0,_u=at||fe.numIconVertices===0;if(Pl||_u?_u?Pl||(un=un&&_n):_n=un&&_n:un=_n=un&&_n,_n&&pr&&pr.box&&this.collisionIndex.insertCollisionBox(pr.box,$,b.get("text-ignore-placement"),g.bucketInstanceId,Rr&&Rr.box&&qs?qs:hi,nt.ID),un&&Fo&&this.collisionIndex.insertCollisionBox(Fo.box,Ot,b.get("icon-ignore-placement"),g.bucketInstanceId,Zs,nt.ID),Yi&&(_n&&this.collisionIndex.insertCollisionCircles(Yi.circles,$,b.get("text-ignore-placement"),g.bucketInstanceId,hi,nt.ID),d)){const Wr=g.bucketInstanceId;let Or=this.collisionCircleArrays[Wr];Or===void 0&&(Or=this.collisionCircleArrays[Wr]=new Wt);for(let ao=0;ao=0;--Ge){const Pe=fe[Ge];vn(g.symbolInstances.get(Pe),g.collisionArrays[Pe])}}else for(let fe=s.symbolInstanceStart;fe=0&&(s.text.placedSymbolArray.get(C).crossTileID=b>=0&&C!==b?0:d.crossTileID)}markUsedOrientation(s,h,d){const g=h===a.ai.horizontal||h===a.ai.horizontalOnly?h:0,b=h===a.ai.vertical?h:0,I=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const C of I)s.text.placedSymbolArray.get(C).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let d=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const g=h?h.symbolFadeChange(s):1,b=h?h.opacities:{},I=h?h.variableOffsets:{},C=h?h.placedOrientations:{};for(const M in this.placements){const N=this.placements[M],O=b[M];O?(this.opacities[M]=new St(O,g,N.text,N.icon),d=d||N.text!==O.text.placed||N.icon!==O.icon.placed):(this.opacities[M]=new St(null,g,N.text,N.icon,N.skipFade),d=d||N.text||N.icon)}for(const M in b){const N=b[M];if(!this.opacities[M]){const O=new St(N,g,!1,!1);O.isHidden()||(this.opacities[M]=O,d=d||N.text.placed||N.icon.placed)}}for(const M in I)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=I[M]);for(const M in C)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=C[M]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:s)}updateLayerOpacities(s,h){const d={};for(const g of h){const b=g.getBucket(s);b&&g.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,d,g.collisionBoxArray)}}updateBucketOpacities(s,h,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],b=g.layout,I=new St(null,0,!1,!1,!0),C=b.get("text-allow-overlap"),M=b.get("icon-allow-overlap"),N=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),O=b.get("text-rotation-alignment")==="map",z=b.get("text-pitch-alignment")==="map",W=b.get("icon-text-fit")!=="none",nt=new St(null,0,C&&(M||!s.hasIconData()||b.get("icon-optional")),M&&(C||!s.hasTextData()||b.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const et=(at,$,Et)=>{for(let Ot=0;Ot<$/4;Ot++)at.opacityVertexArray.emplaceBack(Et);at.hasVisibleVertices=at.hasVisibleVertices||Et!==is};for(let at=0;at0,Vt=this.placedOrientations[$.crossTileID],Xt=Vt===a.ai.vertical,ee=Vt===a.ai.horizontal||Vt===a.ai.horizontalOnly;if(Et>0||Ot>0){const $t=Nr(Tt.text);et(s.text,Et,Xt?is:$t),et(s.text,Ot,ee?is:$t);const oe=Tt.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(fe=>{fe>=0&&(s.text.placedSymbolArray.get(fe).hidden=oe||Xt?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=oe||ee?1:0);const Le=this.variableOffsets[$.crossTileID];Le&&this.markUsedJustification(s,Le.anchor,$,Vt);const vn=this.placedOrientations[$.crossTileID];vn&&(this.markUsedJustification(s,"left",$,vn),this.markUsedOrientation(s,vn,$))}if(Bt){const $t=Nr(Tt.icon),oe=!(W&&$.verticalPlacedIconSymbolIndex&&Xt);$.placedIconSymbolIndex>=0&&(et(s.icon,$.numIconVertices,oe?$t:is),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Tt.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(et(s.icon,$.numVerticalIconVertices,oe?is:$t),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Tt.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $t=s.collisionArrays[at];if($t){let oe=new a.P(0,0);if($t.textBox||$t.verticalTextBox){let vn=!0;if(N){const fe=this.variableOffsets[ht];fe?(oe=Ke(fe.anchor,fe.width,fe.height,fe.textOffset,fe.textBoxScale),O&&oe._rotate(z?this.transform.angle:-this.transform.angle)):vn=!1}$t.textBox&&rn(s.textCollisionBox.collisionVertexArray,Tt.text.placed,!vn||Xt,oe.x,oe.y),$t.verticalTextBox&&rn(s.textCollisionBox.collisionVertexArray,Tt.text.placed,!vn||ee,oe.x,oe.y)}const Le=!!(!ee&&$t.verticalIconBox);$t.iconBox&&rn(s.iconCollisionBox.collisionVertexArray,Tt.icon.placed,Le,W?oe.x:0,W?oe.y:0),$t.verticalIconBox&&rn(s.iconCollisionBox.collisionVertexArray,Tt.icon.placed,!Le,W?oe.x:0,W?oe.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const at=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=at.invProjMatrix,s.placementViewportMatrix=at.viewportMatrix,s.collisionCircleArray=at.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function rn(y,s,h,d,g){y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0)}const Gn=Math.pow(2,25),Qn=Math.pow(2,24),kn=Math.pow(2,17),Pn=Math.pow(2,16),qr=Math.pow(2,9),oi=Math.pow(2,8),ir=Math.pow(2,1);function Nr(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,h=Math.floor(127*y.opacity);return h*Gn+s*Qn+h*kn+s*Pn+h*qr+s*oi+h*ir+s}const is=0;class bd{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,h,d,g,b){const I=this._bucketParts;for(;this._currentTileIndexC.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&a.h.now()-g>2;for(;this._currentPlacementIndex>=0;){const I=h[s[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=C)&&(!I.maxzoom||I.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new bd(I)),this._inProgressLayer.continuePlacement(d[I.source],this.placement,this._showCollisionBoxes,I,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const ou=512/a.N/2;class Rg{constructor(s,h,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let b=0;b({x:Math.floor(M.anchorX*ou),y:Math.floor(M.anchorY*ou)})),crossTileIDs:I.map(M=>M.crossTileID)};if(C.positions.length>128){const M=new a.av(C.positions.length,16,Uint16Array);for(const{x:N,y:O}of C.positions)M.add(N,O);M.finish(),delete C.positions,C.index=M}this._symbolsByKey[b]=C}}getScaledCoordinates(s,h){const{x:d,y:g,z:b}=this.tileID.canonical,{x:I,y:C,z:M}=h.canonical,N=ou/Math.pow(2,M-b),O=(C*a.N+s.anchorY)*N,z=g*a.N*ou;return{x:Math.floor((I*a.N+s.anchorX)*N-d*a.N*ou),y:Math.floor(O-z)}}findMatches(s,h,d){const g=this.tileID.canonical.zs)}}class Hn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class df{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const h=Math.round((s-this.lng)/360);if(h!==0)for(const d in this.indexes){const g=this.indexes[d],b={};for(const I in g){const C=g[I];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+h),b[C.tileID.key]=C}this.indexes[d]=b}this.lng=s}addBucket(s,h,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let b=0;bs.overscaledZ)for(const C in I){const M=I[C];M.tileID.isChildOf(s)&&M.findMatches(h.symbolInstances,s,g)}else{const C=I[s.scaledTo(Number(b)).key];C&&C.findMatches(h.symbolInstances,s,g)}}for(let b=0;b{h[d]=!0});for(const d in this.layerIndexes)h[d]||delete this.layerIndexes[d]}}const Zr=(y,s)=>a.x(y,s&&s.filter(h=>h.identifier!=="source.canvas")),No=a.F(a.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Og=a.F(a.ax,["setCenter","setZoom","setBearing","setPitch"]),rs=a.aw();class Dr extends a.E{constructor(s,h={}){super(),this.map=s,this.dispatcher=new $e(Ha(),this,s._getMapId()),this.imageManager=new vt,this.imageManager.setEventedParent(this),this.glyphManager=new te(s._requestManager,h.localIdeographFontFamily),this.lineAtlas=new jn(256,512),this.crossTileSymbolIndex=new Bc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.az());const d=this;this._rtlTextPluginCallback=Dr.registerForPluginStateChange(g=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:g.pluginStatus,pluginURL:g.pluginURL},(b,I)=>{if(a.aA(b),I&&I.every(C=>C))for(const C in d.sourceCaches){const M=d.sourceCaches[C].getSource().type;M!=="vector"&&M!=="geojson"||d.sourceCaches[C].reload()}})}),this.on("data",g=>{if(g.dataType!=="source"||g.sourceDataType!=="metadata")return;const b=this.sourceCaches[g.sourceId];if(!b)return;const I=b.getSource();if(I&&I.vectorLayerIds)for(const C in this._layers){const M=this._layers[C];M.source===I.id&&this._validateLayer(M)}})}loadURL(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const g=this.map._requestManager.transformRequest(s,Q.Style);this._request=a.f(g,(b,I)=>{this._request=null,b?this.fire(new a.j(b)):I&&this._load(I,h,d)})}loadJSON(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),this._request=a.h.frame(()=>{this._request=null,h.validate=h.validate!==!1,this._load(s,h,d)})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(rs,{validate:!1})}_load(s,h,d){var g;const b=h.transformStyle?h.transformStyle(d,s):s;if(!h.validate||!Zr(this,a.y(b))){this._loaded=!0,this.stylesheet=b;for(const I in b.sources)this.addSource(I,b.sources[I],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new yn(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){const s=a.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",s),this._order=s.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of s){const d=a.aC(h);d.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=d}}_loadSprite(s,h=!1,d=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(g,b,I,C){const M=_t(g),N=M.length,O=I>1?"@2x":"",z={},W={},nt={};for(const{id:et,url:at}of M){const $=b.transformRequest(b.normalizeSpriteURL(at,O,".json"),Q.SpriteJSON),Et=`${et}_${$.url}`;z[Et]=a.f($,(Tt,Bt)=>{delete z[Et],W[et]=Bt,ct(C,W,nt,Tt,N)});const Ot=b.transformRequest(b.normalizeSpriteURL(at,O,".png"),Q.SpriteImage),ht=`${et}_${Ot.url}`;z[ht]=j.getImage(Ot,(Tt,Bt)=>{delete z[ht],nt[et]=Bt,ct(C,W,nt,Tt,N)})}return{cancel(){for(const et of Object.values(z))et.cancel()}}}(s,this.map._requestManager,this.map.getPixelRatio(),(g,b)=>{if(this._spriteRequest=null,g)this.fire(new a.j(g));else if(b)for(const I in b){this._spritesImagesIds[I]=[];const C=this._spritesImagesIds[I]?this._spritesImagesIds[I].filter(M=>!(M in b)):[];for(const M of C)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in b[I]){const N=I==="default"?M:`${I}:${M}`;this._spritesImagesIds[I].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,b[I][M],!1):this.imageManager.addImage(N,b[I][M]),h&&(this._changedImages[N]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(s){const h=this.sourceCaches[s.source];if(!h)return;const d=s.sourceLayer;if(!d)return;const g=h.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new a.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const h=this._serializedAllLayers();if(!s||s.length===0)return Object.values(h);const d=[];for(const g of s)h[g]&&d.push(h[g]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const h=Object.keys(this._layers);for(const d of h){const g=this._layers[d];g.type!=="custom"&&(s[d]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const h=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(g.length||b.length)&&this._updateWorkerLayers(g,b);for(const I in this._updatedSources){const C=this._updatedSources[I];if(C==="reload")this._reloadSource(I);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(I)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const b=this.sourceCaches[g];d[g]=b.used,b.used=!1}for(const g of this._order){const b=this._layers[g];b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const g in d){const b=this.sourceCaches[g];d[g]!==b.used&&b.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,h&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(s),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,h={}){this._checkLoaded();const d=this.serialize();if(s=h.transformStyle?h.transformStyle(d,s):s,Zr(this,a.y(s)))return!1;(s=a.aD(s)).layers=a.aB(s.layers);const g=a.aE(d,s).filter(I=>!(I.command in Og));if(g.length===0)return!1;const b=g.filter(I=>!(I.command in No));if(b.length>0)throw new Error(`Unimplemented: ${b.map(I=>I.command).join(", ")}.`);for(const I of g)I.command!=="setTransition"&&this[I.command].apply(this,I.args);return this.stylesheet=s,this._serializedLayers=null,!0}addImage(s,h){if(this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,h),this._afterImageUpdated(s)}updateImage(s,h){this.imageManager.updateImage(s,h)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,h,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(a.y.source,`sources.${s}`,h,null,d))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const g=this.sourceCaches[s]=new Fi(s,h,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new a.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const h=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],h.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,h){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(h),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,h,d={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new a.j(new Error(`Layer "${g}" already exists on this map.`)));let b;if(s.type==="custom"){if(Zr(this,a.aF(s)))return;b=a.aC(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=a.aD(s),s=a.e(s,{source:g})),this._validate(a.y.layer,`layers.${g}`,s,{arrayIndex:-1},d))return;b=a.aC(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:g}})}const I=h?this._order.indexOf(h):this._order.length;if(h&&I===-1)this.fire(new a.j(new Error(`Cannot add layer "${g}" before non-existing layer "${h}".`)));else{if(this._order.splice(I,0,g),this._layerOrderChanged=!0,this._layers[g]=b,this._removedLayers[g]&&b.source&&b.type!=="custom"){const C=this._removedLayers[g];delete this._removedLayers[g],C.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(s,h){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new a.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===h)return;const d=this._order.indexOf(s);this._order.splice(d,1);const g=h?this._order.indexOf(h):this._order.length;h&&g===-1?this.fire(new a.j(new Error(`Cannot move layer "${s}" before non-existing layer "${h}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const h=this._layers[s];if(!h)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${s}".`)));h.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=h,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],h.onRemove&&h.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,h,d){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===h&&g.maxzoom===d||(h!=null&&(g.minzoom=h),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,h,d={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!a.aG(g.filter,h))return h==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(a.y.filter,`layers.${g.id}.filter`,h,null,d)||(g.filter=a.aD(h),this._updateLayer(g)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return a.aD(this.getLayer(s).filter)}setLayoutProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getLayoutProperty(h),d)||(b.setLayoutProperty(h,d,g),this._updateLayer(b)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,h){const d=this.getLayer(s);if(d)return d.getLayoutProperty(h);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getPaintProperty(h),d)||(b.setPaintProperty(h,d,g)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,h){return this.getLayer(s).getPaintProperty(h)}setFeatureState(s,h){this._checkLoaded();const d=s.source,g=s.sourceLayer,b=this.sourceCaches[d];if(b===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const I=b.getSource().type;I==="geojson"&&g?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||g?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(g,s.id,h)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,h){this._checkLoaded();const d=s.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const b=g.getSource().type,I=b==="vector"?s.sourceLayer:void 0;b!=="vector"||I?h&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(I,s.id,h):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const h=s.source,d=s.sourceLayer,g=this.sourceCaches[h];if(g!==void 0)return g.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,s.id)):void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.j(new Error(`The source '${h}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=a.aH(this.sourceCaches,b=>b.serialize()),h=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return a.aI({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:h,terrain:d},b=>b!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const h=I=>this._layers[I].type==="fill-extrusion",d={},g=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C)){d[C]=I;for(const M of s){const N=M[C];if(N)for(const O of N)g.push(O)}}}g.sort((I,C)=>C.intersectionZ-I.intersectionZ);const b=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C))for(let M=g.length-1;M>=0;M--){const N=g[M].feature;if(d[N.layer.id]{const ee=Et.featureSortOrder;if(ee){const $t=ee.indexOf(Vt.featureIndex);return ee.indexOf(Xt.featureIndex)-$t}return Xt.featureIndex-Vt.featureIndex});for(const Vt of Bt)Tt.push(Vt)}}for(const Et in et)et[Et].forEach(Ot=>{const ht=Ot.feature,Tt=N[C[Et].source].getFeatureState(ht.layer["source-layer"],ht.id);ht.source=ht.layer.source,ht.layer["source-layer"]&&(ht.sourceLayer=ht.layer["source-layer"]),ht.state=Tt});return et}(this._layers,I,this.sourceCaches,s,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,h){h&&h.filter&&this._validate(a.y.filter,"querySourceFeatures.filter",h.filter,null,h);const d=this.sourceCaches[s];return d?function(g,b){const I=g.getRenderableIds().map(N=>g.getTileByID(N)),C=[],M={};for(let N=0;N{gt[g]=b})(s,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:s,url:h.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(s,h={}){this._checkLoaded();const d=this.light.getLight();let g=!1;for(const I in s)if(!a.aG(s[I],d[I])){g=!0;break}if(!g)return;const b={now:a.h.now(),transition:a.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,h),this.light.updateTransitions(b)}_validate(s,h,d,g,b={}){return(!b||b.validate!==!1)&&Zr(this,s.call(a.y,a.e({key:h,style:this.serialize(),value:d,styleSpec:a.v},g)))}_remove(s=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const h in this._layers)this._layers[h].setEventedParent(null);for(const h in this.sourceCaches){const d=this.sourceCaches[h];d.setEventedParent(null),d.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(const h in this.sourceCaches)this.sourceCaches[h].update(s,this.map.terrain)}_generateCollisionBoxes(){for(const s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,h,d,g,b=!1){let I=!1,C=!1;const M={};for(const N of this._order){const O=this._layers[N];if(O.type!=="symbol")continue;if(!M[O.source]){const W=this.sourceCaches[O.source];M[O.source]=W.getRenderableIds(!0).map(nt=>W.getTileByID(nt)).sort((nt,et)=>et.tileID.overscaledZ-nt.tileID.overscaledZ||(nt.tileID.isLessThan(et.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(O,M[O.source],s.center.lng);I=I||z}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.h.now(),s.zoom))&&(this.pauseablePlacement=new ru(s,this.map.terrain,this._order,b,h,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.h.now()),C=!0),I&&this.pauseablePlacement.placement.setStale()),C||I)for(const N of this._order){const O=this._layers[N];O.type==="symbol"&&this.placement.updateLayerOpacities(O,M[O.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.h.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,h,d){this.imageManager.getImages(h.icons,d),this._updateTilesForChangedImages();const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,h.icons)}getGlyphs(s,h,d){this.glyphManager.getGlyphs(h.stacks,d);const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,[""])}getResource(s,h,d){return a.m(h,d)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,h={}){this._checkLoaded(),s&&this._validate(a.y.glyphs,"glyphs",s,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,h,d={},g){this._checkLoaded();const b=[{id:s,url:h}],I=[..._t(this.stylesheet.sprite),...b];this._validate(a.y.sprite,"sprite",I,null,d)||(this.stylesheet.sprite=I,this._loadSprite(b,!0,g))}removeSprite(s){this._checkLoaded();const h=_t(this.stylesheet.sprite);if(h.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;h.splice(h.findIndex(d=>d.id===s),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return _t(this.stylesheet.sprite)}setSprite(s,h={},d){this._checkLoaded(),s&&this._validate(a.y.sprite,"sprite",s,null,h)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}Dr.registerForPluginStateChange=a.aK;var Vc=a.Q([{name:"a_pos",type:"Int16",components:2}]),su="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 xi={prelude:Fn(`#ifdef GL_ES +var CS=Object.defineProperty;var TS=(e,t,n)=>t in e?CS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Zn=(e,t,n)=>(TS(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const f of l.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();function Ie(){}function Tr(e,t){for(const n in t)e[n]=t[n];return e}function Fb(e){return e()}function Bv(){return Object.create(null)}function No(e){e.forEach(Fb)}function pg(e){return typeof e=="function"}function He(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Lm;function hr(e,t){return e===t?!0:(Lm||(Lm=document.createElement("a")),Lm.href=t,e===Lm.href)}function LS(e){return Object.keys(e).length===0}function Bb(e,...t){if(e==null){for(const i of t)i(void 0);return Ie}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Vb(e){let t;return Bb(e,n=>t=n)(),t}function Se(e,t,n){e.$$.on_destroy.push(Bb(t,n))}function sr(e,t,n,i){if(e){const r=Ub(e,t,n,i);return e[0](r)}}function Ub(e,t,n,i){return e[1]&&i?Tr(n.ctx.slice(),e[1](i(t))):n.ctx}function ar(e,t,n,i){if(e[2]&&i){const r=e[2](i(n));if(t.dirty===void 0)return r;if(typeof r=="object"){const l=[],f=Math.max(t.dirty.length,r.length);for(let a=0;a32){const t=[],n=e.ctx.length/32;for(let i=0;ie.removeEventListener(t,n,i)}function kS(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Rt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function AS(e){return Array.from(e.childNodes)}function Zi(e,t){t=""+t,e.data!==t&&(e.data=t)}function ql(e,t){e.value=t??""}function mi(e,t,n,i){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,i?"important":"")}function $m(e,t,n){for(let i=0;i{const r=e.$$.callbacks[t];if(r){const l=NS(t,n,{cancelable:i});return r.slice().forEach(f=>{f.call(e,l)}),!l.defaultPrevented}return!0}}function jb(e,t){return cd().$$.context.set(e,t),t}function DS(e){return cd().$$.context.get(e)}function ii(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(i=>i.call(this,t))}const Mh=[],cr=[];let Nh=[];const ty=[],qb=Promise.resolve();let ey=!1;function Zb(){ey||(ey=!0,qb.then($b))}function RS(){return Zb(),qb}function jp(e){Nh.push(e)}function yc(e){ty.push(e)}const j_=new Set;let Ih=0;function $b(){if(Ih!==0)return;const e=Gp;do{try{for(;Ihe.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Nh=t}const Bm=new Set;let _c;function ui(){_c={r:0,c:[],p:_c}}function ci(){_c.r||No(_c.c),_c=_c.p}function pt(e,t){e&&e.i&&(Bm.delete(e),e.i(t))}function bt(e,t,n,i){if(e&&e.o){if(Bm.has(e))return;Bm.add(e),_c.c.push(()=>{Bm.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function la(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function FS(e,t){bt(e,1,1,()=>{t.delete(e.key)})}function BS(e,t,n,i,r,l,f,a,_,x,S,L){let A=e.length,P=l.length,O=A;const B={};for(;O--;)B[e[O].key]=O;const U=[],Y=new Map,V=new Map,$=[];for(O=P;O--;){const dt=L(r,l,O),gt=n(dt);let ut=f.get(gt);ut?i&&$.push(()=>ut.p(dt,t)):(ut=x(gt,dt),ut.c()),Y.set(gt,U[O]=ut),gt in B&&V.set(gt,Math.abs(O-B[gt]))}const K=new Set,nt=new Set;function ht(dt){pt(dt,1),dt.m(a,S),f.set(dt.key,dt),S=dt.first,P--}for(;A&&P;){const dt=U[P-1],gt=e[A-1],ut=dt.key,Et=gt.key;dt===gt?(S=dt.first,A--,P--):Y.has(Et)?!f.has(ut)||K.has(ut)?ht(dt):nt.has(Et)?A--:V.get(ut)>V.get(Et)?(nt.add(ut),ht(dt)):(K.add(Et),A--):(_(gt,f),A--)}for(;A--;){const dt=e[A];Y.has(dt.key)||_(dt,f)}for(;P;)ht(U[P-1]);return No($),U}function Wb(e,t){const n={},i={},r={$$scope:1};let l=e.length;for(;l--;){const f=e[l],a=t[l];if(a){for(const _ in f)_ in a||(i[_]=1);for(const _ in a)r[_]||(n[_]=a[_],r[_]=1);e[l]=a}else for(const _ in f)r[_]=1}for(const f in i)f in n||(n[f]=void 0);return n}function vc(e,t,n){const i=e.$$.props[t];i!==void 0&&(e.$$.bound[i]=n,n(e.$$.ctx[i]))}function Zt(e){e&&e.c()}function jt(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),jp(()=>{const l=e.$$.on_mount.map(Fb).filter(pg);e.$$.on_destroy?e.$$.on_destroy.push(...l):No(l),e.$$.on_mount=[]}),r.forEach(jp)}function qt(e,t){const n=e.$$;n.fragment!==null&&(zS(n.after_update),No(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function VS(e,t){e.$$.dirty[0]===-1&&(Mh.push(e),Zb(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=P.length?P[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=O)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](O),S&&VS(e,L)),A}):[],x.update(),S=!0,No(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=AS(t.target);x.fragment&&x.fragment.l(L),L.forEach(It)}else x.fragment&&x.fragment.c();t.intro&&pt(e.$$.fragment),jt(e,t.target,t.anchor),$b()}Op(_)}class nn{constructor(){Zn(this,"$$");Zn(this,"$$set")}$destroy(){qt(this,1),this.$destroy=Ie}$on(t,n){if(!pg(n))return Ie;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!LS(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const US="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(US);const GS="/ltn/assets/logo-7ace0a42.png";let me;const Xb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Xb.decode();let Cp=null;function Dh(){return(Cp===null||Cp.byteLength===0)&&(Cp=new Uint8Array(me.memory.buffer)),Cp}function ea(e,t){return e=e>>>0,Xb.decode(Dh().subarray(e,e+t))}const Ul=new Array(128).fill(void 0);Ul.push(void 0,null,!0,!1);let zp=Ul.length;function ai(e){zp===Ul.length&&Ul.push(Ul.length+1);const t=zp;return zp=Ul[t],Ul[t]=e,t}function cn(e){return Ul[e]}function jS(e){e<132||(Ul[e]=zp,zp=e)}function fs(e){const t=cn(e);return jS(e),t}let Ls=0;const Vm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},qS=typeof Vm.encodeInto=="function"?function(e,t){return Vm.encodeInto(e,t)}:function(e,t){const n=Vm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Vl(e,t,n){if(n===void 0){const a=Vm.encode(e),_=t(a.length,1)>>>0;return Dh().subarray(_,_+a.length).set(a),Ls=a.length,_}let i=e.length,r=t(i,1)>>>0;const l=Dh();let f=0;for(;f127)break;l[r+f]=a}if(f!==i){f!==0&&(e=e.slice(f)),r=n(r,i,i=f+e.length*3,1)>>>0;const a=Dh().subarray(r+f,r+i),_=qS(e,a);f+=_.written}return Ls=f,r}function Ph(e){return e==null}let Tp=null;function Je(){return(Tp===null||Tp.byteLength===0)&&(Tp=new Int32Array(me.memory.buffer)),Tp}let Lp=null;function Hb(){return(Lp===null||Lp.byteLength===0)&&(Lp=new Float64Array(me.memory.buffer)),Lp}let Mp=null;function ZS(){return(Mp===null||Mp.byteLength===0)&&(Mp=new BigInt64Array(me.memory.buffer)),Mp}function ny(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let l="[";r>0&&(l+=ny(e[0]));for(let f=1;f1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} +${e.stack}`:i}function $S(e,t){const n=t(e.length*1,1)>>>0;return Dh().set(e,n/1),Ls=e.length,n}function WS(e,t){return e=e>>>0,Hb().subarray(e/8,e/8+t)}function XS(e,t){return e=e>>>0,Dh().subarray(e/1,e/1+t)}function mc(e,t){try{return e.apply(this,t)}catch(n){me.__wbindgen_exn_store(ai(n))}}class HS{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();me.__wbg_ltn_free(t)}constructor(t,n){try{const _=me.__wbindgen_add_to_stack_pointer(-16),x=$S(t,me.__wbindgen_malloc),S=Ls;var i=Ph(n)?0:Vl(n,me.__wbindgen_malloc,me.__wbindgen_realloc),r=Ls;me.ltn_new(_,x,S,i,r);var l=Je()[_/4+0],f=Je()[_/4+1],a=Je()[_/4+2];if(a)throw fs(f);return this.__wbg_ptr=l>>>0,this}finally{me.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let t,n;try{const x=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_getInvertedBoundary(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],l=Je()[x/4+2],f=Je()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,fs(l);return t=a,n=_,ea(a,_)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(t,n,1)}}getBounds(){try{const r=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_getBounds(r,this.__wbg_ptr);var t=Je()[r/4+0],n=Je()[r/4+1],i=WS(t,n).slice();return me.__wbindgen_free(t,n*8,8),i}finally{me.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const r=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_toRouteSnapper(r,this.__wbg_ptr);var t=Je()[r/4+0],n=Je()[r/4+1],i=XS(t,n).slice();return me.__wbindgen_free(t,n*1,1),i}finally{me.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let t,n;try{const x=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_toRouteSnapperGj(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],l=Je()[x/4+2],f=Je()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,fs(l);return t=a,n=_,ea(a,_)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(t,n,1)}}renderModalFilters(){let t,n;try{const x=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_renderModalFilters(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],l=Je()[x/4+2],f=Je()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,fs(l);return t=a,n=_,ea(a,_)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(t,n,1)}}renderNeighbourhood(){let t,n;try{const x=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_renderNeighbourhood(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],l=Je()[x/4+2],f=Je()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,fs(l);return t=a,n=_,ea(a,_)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(t,n,1)}}setNeighbourhoodBoundary(t,n){try{const l=me.__wbindgen_add_to_stack_pointer(-16),f=Vl(t,me.__wbindgen_malloc,me.__wbindgen_realloc),a=Ls;me.ltn_setNeighbourhoodBoundary(l,this.__wbg_ptr,f,a,ai(n));var i=Je()[l/4+0],r=Je()[l/4+1];if(r)throw fs(i)}finally{me.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(t){const n=Vl(t,me.__wbindgen_malloc,me.__wbindgen_realloc),i=Ls;me.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,n,i)}setCurrentNeighbourhood(t){try{const r=me.__wbindgen_add_to_stack_pointer(-16),l=Vl(t,me.__wbindgen_malloc,me.__wbindgen_realloc),f=Ls;me.ltn_setCurrentNeighbourhood(r,this.__wbg_ptr,l,f);var n=Je()[r/4+0],i=Je()[r/4+1];if(i)throw fs(n)}finally{me.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(t,n){try{const l=me.__wbindgen_add_to_stack_pointer(-16),f=Vl(n,me.__wbindgen_malloc,me.__wbindgen_realloc),a=Ls;me.ltn_addModalFilter(l,this.__wbg_ptr,ai(t),f,a);var i=Je()[l/4+0],r=Je()[l/4+1];if(r)throw fs(i)}finally{me.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(t,n){try{const l=me.__wbindgen_add_to_stack_pointer(-16),f=Vl(n,me.__wbindgen_malloc,me.__wbindgen_realloc),a=Ls;me.ltn_addManyModalFilters(l,this.__wbg_ptr,ai(t),f,a);var i=Je()[l/4+0],r=Je()[l/4+1];if(r)throw fs(i)}finally{me.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(t){me.ltn_deleteModalFilter(this.__wbg_ptr,t)}undo(){me.ltn_undo(this.__wbg_ptr)}redo(){me.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(t){let n,i;try{const S=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,t);var r=Je()[S/4+0],l=Je()[S/4+1],f=Je()[S/4+2],a=Je()[S/4+3],_=r,x=l;if(a)throw _=0,x=0,fs(f);return n=_,i=x,ea(_,x)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(n,i,1)}}toSavefile(){let t,n;try{const x=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_toSavefile(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],l=Je()[x/4+2],f=Je()[x/4+3],a=i,_=r;if(f)throw a=0,_=0,fs(l);return t=a,n=_,ea(a,_)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(t,n,1)}}loadSavefile(t){try{const r=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_loadSavefile(r,this.__wbg_ptr,ai(t));var n=Je()[r/4+0],i=Je()[r/4+1];if(i)throw fs(n)}finally{me.__wbindgen_add_to_stack_pointer(16)}}compareRoute(t,n,i,r){let l,f;try{const P=me.__wbindgen_add_to_stack_pointer(-16);me.ltn_compareRoute(P,this.__wbg_ptr,t,n,i,r);var a=Je()[P/4+0],_=Je()[P/4+1],x=Je()[P/4+2],S=Je()[P/4+3],L=a,A=_;if(S)throw L=0,A=0,fs(x);return l=L,f=A,ea(L,A)}finally{me.__wbindgen_add_to_stack_pointer(16),me.__wbindgen_free(l,f,1)}}}async function YS(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function KS(){const e={};return e.wbg={},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(ea(t,n));return ai(i)},e.wbg.__wbindgen_string_new=function(t,n){const i=ea(t,n);return ai(i)},e.wbg.__wbindgen_object_drop_ref=function(t){fs(t)},e.wbg.__wbindgen_string_get=function(t,n){const i=cn(n),r=typeof i=="string"?i:void 0;var l=Ph(r)?0:Vl(r,me.__wbindgen_malloc,me.__wbindgen_realloc),f=Ls;Je()[t/4+1]=f,Je()[t/4+0]=l},e.wbg.__wbindgen_boolean_get=function(t){const n=cn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_is_bigint=function(t){return typeof cn(t)=="bigint"},e.wbg.__wbindgen_bigint_from_i64=function(t){return ai(t)},e.wbg.__wbindgen_jsval_eq=function(t,n){return cn(t)===cn(n)},e.wbg.__wbindgen_bigint_from_u64=function(t){const n=BigInt.asUintN(64,t);return ai(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=cn(n),r=typeof i=="number"?i:void 0;Hb()[t/8+1]=Ph(r)?0:r,Je()[t/4+0]=!Ph(r)},e.wbg.__wbindgen_is_object=function(t){const n=cn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_in=function(t,n){return cn(t)in cn(n)},e.wbg.__wbindgen_is_undefined=function(t){return cn(t)===void 0},e.wbg.__wbindgen_object_clone_ref=function(t){const n=cn(t);return ai(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return cn(t)==cn(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const i=cn(t)[cn(n)];return ai(i)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(cn(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(cn(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(cn(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(cn(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(cn(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return ai(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=cn(n).stack,r=Vl(i,me.__wbindgen_malloc,me.__wbindgen_realloc),l=Ls;Je()[t/4+1]=l,Je()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(ea(t,n))}finally{me.__wbindgen_free(i,r,1)}},e.wbg.__wbg_performance_3f3012faa4463882=function(t){const n=cn(t).performance;return ai(n)},e.wbg.__wbg_now_2fd65358804c9485=function(t){return cn(t).now()},e.wbg.__wbg_get_f01601b5a68d10e3=function(t,n){const i=cn(t)[n>>>0];return ai(i)},e.wbg.__wbg_length_1009b1af0c481d7b=function(t){return cn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof cn(t)=="function"},e.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(t,n){const i=new Function(ea(t,n));return ai(i)},e.wbg.__wbg_next_9b877f231f476d01=function(t){const n=cn(t).next;return ai(n)},e.wbg.__wbg_next_6529ee0cca8d57ed=function(){return mc(function(t){const n=cn(t).next();return ai(n)},arguments)},e.wbg.__wbg_done_5fe336b092d60cf2=function(t){return cn(t).done},e.wbg.__wbg_value_0c248a78fdc8e19f=function(t){const n=cn(t).value;return ai(n)},e.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return ai(Symbol.iterator)},e.wbg.__wbg_get_7b48513de5dc5ea4=function(){return mc(function(t,n){const i=Reflect.get(cn(t),cn(n));return ai(i)},arguments)},e.wbg.__wbg_call_90c26b09837aba1c=function(){return mc(function(t,n){const i=cn(t).call(cn(n));return ai(i)},arguments)},e.wbg.__wbg_self_f0e34d89f33b99fd=function(){return mc(function(){const t=self.self;return ai(t)},arguments)},e.wbg.__wbg_window_d3b084224f4774d7=function(){return mc(function(){const t=window.window;return ai(t)},arguments)},e.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return mc(function(){const t=globalThis.globalThis;return ai(t)},arguments)},e.wbg.__wbg_global_35dfdd59a4da3e74=function(){return mc(function(){const t=global.global;return ai(t)},arguments)},e.wbg.__wbg_isArray_74fb723e24f76012=function(t){return Array.isArray(cn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=cn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(t){return Number.isSafeInteger(cn(t))},e.wbg.__wbg_entries_9e2e2aa45aa5094a=function(t){const n=Object.entries(cn(t));return ai(n)},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=cn(t).buffer;return ai(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(cn(t));return ai(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,i){cn(t).set(cn(n),i>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return cn(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=cn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_bigint_get_as_i64=function(t,n){const i=cn(n),r=typeof i=="bigint"?i:void 0;ZS()[t/8+1]=Ph(r)?BigInt(0):r,Je()[t/4+0]=!Ph(r)},e.wbg.__wbindgen_debug_string=function(t,n){const i=ny(cn(n)),r=Vl(i,me.__wbindgen_malloc,me.__wbindgen_realloc),l=Ls;Je()[t/4+1]=l,Je()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(ea(t,n))},e.wbg.__wbindgen_memory=function(){const t=me.memory;return ai(t)},e}function JS(e,t){return me=e.exports,Yb.__wbindgen_wasm_module=t,Mp=null,Lp=null,Tp=null,Cp=null,me}async function Yb(e){if(me!==void 0)return me;typeof e>"u"&&(e="/ltn/assets/backend_bg.wasm");const t=KS();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await YS(await e,t);return JS(n,i)}let Xe;const Kb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Kb.decode();let Pp=null;function Fp(){return(Pp===null||Pp.byteLength===0)&&(Pp=new Uint8Array(Xe.memory.buffer)),Pp}function Gl(e,t){return e=e>>>0,Kb.decode(Fp().subarray(e,e+t))}const jl=new Array(128).fill(void 0);jl.push(void 0,null,!0,!1);let Bp=jl.length;function Fr(e){Bp===jl.length&&jl.push(jl.length+1);const t=Bp;return Bp=jl[t],jl[t]=e,t}function Ln(e){return jl[e]}function QS(e){e<132||(jl[e]=Bp,Bp=e)}function Um(e){const t=Ln(e);return QS(e),t}function q_(e){return e==null}let kp=null;function tE(){return(kp===null||kp.byteLength===0)&&(kp=new Float64Array(Xe.memory.buffer)),kp}let Ap=null;function Li(){return(Ap===null||Ap.byteLength===0)&&(Ap=new Int32Array(Xe.memory.buffer)),Ap}let Mu=0;const Gm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},eE=typeof Gm.encodeInto=="function"?function(e,t){return Gm.encodeInto(e,t)}:function(e,t){const n=Gm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Mm(e,t,n){if(n===void 0){const a=Gm.encode(e),_=t(a.length,1)>>>0;return Fp().subarray(_,_+a.length).set(a),Mu=a.length,_}let i=e.length,r=t(i,1)>>>0;const l=Fp();let f=0;for(;f127)break;l[r+f]=a}if(f!==i){f!==0&&(e=e.slice(f)),r=n(r,i,i=f+e.length*3,1)>>>0;const a=Fp().subarray(r+f,r+i),_=eE(e,a);f+=_.written}return Mu=f,r}function iy(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let l="[";r>0&&(l+=iy(e[0]));for(let f=1;f1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} +${e.stack}`:i}function nE(e,t){const n=t(e.length*1,1)>>>0;return Fp().set(e,n/1),Mu=e.length,n}function Z_(e,t){try{return e.apply(this,t)}catch(n){Xe.__wbindgen_exn_store(Fr(n))}}class Wm{static __wrap(t){t=t>>>0;const n=Object.create(Wm.prototype);return n.__wbg_ptr=t,n}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();Xe.__wbg_jsroutesnapper_free(t)}constructor(t){try{const l=Xe.__wbindgen_add_to_stack_pointer(-16),f=nE(t,Xe.__wbindgen_malloc),a=Mu;Xe.jsroutesnapper_new(l,f,a);var n=Li()[l/4+0],i=Li()[l/4+1],r=Li()[l/4+2];if(r)throw Um(i);return Wm.__wrap(n)}finally{Xe.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(t){Xe.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Fr(t))}setAreaMode(){Xe.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let t,n;try{const l=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_getConfig(l,this.__wbg_ptr);var i=Li()[l/4+0],r=Li()[l/4+1];return t=i,n=r,Gl(i,r)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(t,n,1)}}toFinalFeature(){try{const i=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_toFinalFeature(i,this.__wbg_ptr);var t=Li()[i/4+0],n=Li()[i/4+1];let r;return t!==0&&(r=Gl(t,n).slice(),Xe.__wbindgen_free(t,n*1)),r}finally{Xe.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let t,n;try{const l=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_renderGeojson(l,this.__wbg_ptr);var i=Li()[l/4+0],r=Li()[l/4+1];return t=i,n=r,Gl(i,r)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(t,n,1)}}toggleSnapMode(){Xe.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(t,n,i){return Xe.jsroutesnapper_onMouseMove(this.__wbg_ptr,t,n,i)!==0}onClick(){Xe.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return Xe.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return Xe.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){Xe.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(t){try{const r=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_editExisting(r,this.__wbg_ptr,Fr(t));var n=Li()[r/4+0],i=Li()[r/4+1];if(i)throw Um(n)}finally{Xe.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let t,n;try{const l=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_debugRenderGraph(l,this.__wbg_ptr);var i=Li()[l/4+0],r=Li()[l/4+1];return t=i,n=r,Gl(i,r)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(t,n,1)}}routeNameForWaypoints(t){let n,i;try{const S=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Fr(t));var r=Li()[S/4+0],l=Li()[S/4+1],f=Li()[S/4+2],a=Li()[S/4+3],_=r,x=l;if(a)throw _=0,x=0,Um(f);return n=_,i=x,Gl(_,x)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(n,i,1)}}addSnappedWaypoint(t,n){Xe.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,t,n)}undo(){Xe.jsroutesnapper_undo(this.__wbg_ptr)}}async function iE(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function rE(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const i=Gl(t,n);return Fr(i)},e.wbg.__wbindgen_object_drop_ref=function(t){Um(t)},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(Gl(t,n));return Fr(i)},e.wbg.__wbindgen_is_object=function(t){const n=Ln(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return Ln(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return Ln(t)in Ln(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=Ln(n),r=typeof i=="number"?i:void 0;tE()[t/8+1]=q_(r)?0:r,Li()[t/4+0]=!q_(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=Ln(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_object_clone_ref=function(t){const n=Ln(t);return Fr(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return Ln(t)==Ln(n)},e.wbg.__wbindgen_string_get=function(t,n){const i=Ln(n),r=typeof i=="string"?i:void 0;var l=q_(r)?0:Mm(r,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),f=Mu;Li()[t/4+1]=f,Li()[t/4+0]=l},e.wbg.__wbg_String_4370c5505c674d30=function(t,n){const i=String(Ln(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Mu;Li()[t/4+1]=l,Li()[t/4+0]=r},e.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(t,n){const i=Ln(t)[Ln(n)];return Fr(i)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Fr(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=Ln(n).stack,r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Mu;Li()[t/4+1]=l,Li()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(Gl(t,n))}finally{Xe.__wbindgen_free(i,r,1)}},e.wbg.__wbg_debug_9a6b3243fbbebb61=function(t){console.debug(Ln(t))},e.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(Ln(t))},e.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(Ln(t))},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(Ln(t))},e.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(Ln(t))},e.wbg.__wbg_get_44be0491f933a435=function(t,n){const i=Ln(t)[n>>>0];return Fr(i)},e.wbg.__wbg_length_fff51ee6522a1a18=function(t){return Ln(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof Ln(t)=="function"},e.wbg.__wbg_next_526fc47e980da008=function(t){const n=Ln(t).next;return Fr(n)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return Z_(function(t){const n=Ln(t).next();return Fr(n)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Ln(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){const n=Ln(t).value;return Fr(n)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Fr(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return Z_(function(t,n){const i=Reflect.get(Ln(t),Ln(n));return Fr(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return Z_(function(t,n){const i=Ln(t).call(Ln(n));return Fr(i)},arguments)},e.wbg.__wbg_isArray_4c24b343cb13cfb1=function(t){return Array.isArray(Ln(t))},e.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let n;try{n=Ln(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const n=Ln(t).buffer;return Fr(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){const n=new Uint8Array(Ln(t));return Fr(n)},e.wbg.__wbg_set_5cf90238115182c3=function(t,n,i){Ln(t).set(Ln(n),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Ln(t).length},e.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let n;try{n=Ln(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const i=iy(Ln(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Mu;Li()[t/4+1]=l,Li()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(Gl(t,n))},e.wbg.__wbindgen_memory=function(){const t=Xe.memory;return Fr(t)},e}function oE(e,t){return Xe=e.exports,Jb.__wbindgen_wasm_module=t,kp=null,Ap=null,Pp=null,Xe}async function Jb(e){if(Xe!==void 0)return Xe;typeof e>"u"&&(e="/ltn/assets/route_snapper_bg.wasm");const t=rE();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await iE(await e,t);return oE(n,i)}const Ch=[];function $_(e,t){return{subscribe:li(e,t).subscribe}}function li(e,t=Ie){let n;const i=new Set;function r(a){if(He(e,a)&&(e=a,n)){const _=!Ch.length;for(const x of i)x[1](),Ch.push(x,e);if(_){for(let x=0;x{i.delete(x),i.size===0&&n&&(n(),n=null)}}return{set:r,update:l,subscribe:f}}let sE=Date.now();function of(e){return`${e}-${sE++}`}const Ly=Symbol.for("svelte-maplibre");function sf(){return DS(Ly)}function aE(e){let t=new WeakMap;return n=>{var f;let i=t.get(n.originalEvent);if(i!==void 0)return i;let l=(f=n.target.queryRenderedFeatures(n.point).find(a=>{var _;return(_=e.get(a.layer.id))==null?void 0:_.interactive}))==null?void 0:f.layer.id;return t.set(n.originalEvent,l),l}}function lE(){let e=new Map;return jb(Ly,{map:li(null),source:$_(null),layer:$_(null),popupTarget:$_(null),cluster:li(),loadedImages:li(new Set),minzoom:li(0),maxzoom:li(24),layerEvent:li(null),layerInfo:e,eventTopMost:aE(e)})}function Vv(e){return{subscribe:e.subscribe}}function My({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:i=!1}){let r=sf(),l=li(null),f=Vv(l),a={...r,[e]:Vv(l)};if(t&&(a.popupTarget=f),i){let _=li(null);a.layerEvent=_,r.layerEvent=_}return n&&(a.cluster=li()),jb(Ly,a),{...r,self:l}}function uE(){return My({key:"source",setCluster:!0})}function cE(e=!0){return My({key:"layer",setPopupTarget:e,setMouseEvent:e})}function hE(){return My({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function fE(e){return"layerType"in e&&e.layerType==="deckgl"}var Qb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ex(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var nx={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Qb,function(){var n,i,r;function l(a,_){if(!n)n=_;else if(!i)i=_;else{var x="var sharedChunk = {}; ("+n+")(sharedChunk); ("+i+")(sharedChunk);",S={};n(S),r=_(S),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([x],{type:"text/javascript"})))}}l(["exports"],function(a){function _(u,o,c,p){return new(c||(c=Promise))(function(m,v){function w(k){try{T(p.next(k))}catch(D){v(D)}}function E(k){try{T(p.throw(k))}catch(D){v(D)}}function T(k){var D;k.done?m(k.value):(D=k.value,D instanceof c?D:new c(function(F){F(D)})).then(w,E)}T((p=p.apply(u,o||[])).next())})}function x(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}typeof SuppressedError=="function"&&SuppressedError;var S=L;function L(u,o){this.x=u,this.y=o}L.prototype={clone:function(){return new L(this.x,this.y)},add:function(u){return this.clone()._add(u)},sub:function(u){return this.clone()._sub(u)},multByPoint:function(u){return this.clone()._multByPoint(u)},divByPoint:function(u){return this.clone()._divByPoint(u)},mult:function(u){return this.clone()._mult(u)},div:function(u){return this.clone()._div(u)},rotate:function(u){return this.clone()._rotate(u)},rotateAround:function(u,o){return this.clone()._rotateAround(u,o)},matMult:function(u){return this.clone()._matMult(u)},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(u){return this.x===u.x&&this.y===u.y},dist:function(u){return Math.sqrt(this.distSqr(u))},distSqr:function(u){var o=u.x-this.x,c=u.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(u){return Math.atan2(this.y-u.y,this.x-u.x)},angleWith:function(u){return this.angleWithSep(u.x,u.y)},angleWithSep:function(u,o){return Math.atan2(this.x*o-this.y*u,this.x*u+this.y*o)},_matMult:function(u){var o=u[2]*this.x+u[3]*this.y;return this.x=u[0]*this.x+u[1]*this.y,this.y=o,this},_add:function(u){return this.x+=u.x,this.y+=u.y,this},_sub:function(u){return this.x-=u.x,this.y-=u.y,this},_mult:function(u){return this.x*=u,this.y*=u,this},_div:function(u){return this.x/=u,this.y/=u,this},_multByPoint:function(u){return this.x*=u.x,this.y*=u.y,this},_divByPoint:function(u){return this.x/=u.x,this.y/=u.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var u=this.y;return this.y=this.x,this.x=-u,this},_rotate:function(u){var o=Math.cos(u),c=Math.sin(u),p=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=p,this},_rotateAround:function(u,o){var c=Math.cos(u),p=Math.sin(u),m=o.y+p*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-p*(this.y-o.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},L.convert=function(u){return u instanceof L?u:Array.isArray(u)?new L(u[0],u[1]):u};var A=x(S),P=O;function O(u,o,c,p){this.cx=3*u,this.bx=3*(c-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=o,this.p2x=c,this.p2y=p}O.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,o){if(o===void 0&&(o=1e-6),u<0)return 0;if(u>1)return 1;for(var c=u,p=0;p<8;p++){var m=this.sampleCurveX(c)-u;if(Math.abs(m)m?w=c:E=c,c=.5*(E-w)+w;return c},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var B=x(P);let U,Y;function V(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function $(){if(Y==null&&(Y=!1,V())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const m=4*p;o.fillStyle=`rgb(${m},${m+1},${m+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){Y=!0;break}}}return Y||!1}function K(u,o,c,p){const m=new B(u,o,c,p);return function(v){return m.solve(v)}}const nt=K(.25,.1,.25,1);function ht(u,o,c){return Math.min(c,Math.max(o,u))}function dt(u,o,c){const p=c-o,m=((u-o)%p+p)%p+o;return m===o?c:m}function gt(u,...o){for(const c of o)for(const p in c)u[p]=c[p];return u}let ut=1;function Et(u,o,c){const p={};for(const m in u)p[m]=o.call(c||this,u[m],m,u);return p}function yt(u,o,c){const p={};for(const m in u)o.call(c||this,u[m],m,u)&&(p[m]=u[m]);return p}function xt(u){return Array.isArray(u)?u.map(xt):typeof u=="object"&&u?Et(u,xt):u}const fe={};function Nt(u){fe[u]||(typeof console<"u"&&console.warn(u),fe[u]=!0)}function Gt(u,o,c){return(c.y-u.y)*(o.x-u.x)>(o.y-u.y)*(c.x-u.x)}function Qt(u){let o=0;for(let c,p,m=0,v=u.length,w=v-1;m"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(u,{timestamp:0});try{const w=v==null?void 0:v.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const E=w.startsWith("BGR"),T=new Uint8ClampedArray(p*m*4);if(yield v.copyTo(T,function(k,D,F,j,X){const H=4*Math.max(-D,0),tt=(Math.max(0,F)-F)*j*4+H,lt=4*j,ft=Math.max(0,D),kt=Math.max(0,F);return{rect:{x:ft,y:kt,width:Math.min(k.width,D+j)-ft,height:Math.min(k.height,F+X)-kt},layout:[{offset:tt,stride:lt}]}}(u,o,c,p,m)),E)for(let k=0;kcancelAnimationFrame(o)}},getImageData(u,o=0){return this.getImageCanvasContext(u).getImageData(-o,-o,u.width+2*o,u.height+2*o)},getImageCanvasContext(u){const o=window.document.createElement("canvas"),c=o.getContext("2d",{willReadFrequently:!0});if(!c)throw new Error("failed to create canvas 2d context");return o.width=u.width,o.height=u.height,c.drawImage(u,0,0,u.width,u.height),c},resolveURL:u=>(fn||(fn=document.createElement("a")),fn.href=u,fn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Kn==null&&(Kn=matchMedia("(prefers-reduced-motion: reduce)")),Kn.matches)}},ie={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class De extends Error{constructor(o,c,p,m){super(`AJAXError: ${c} (${o}): ${p}`),this.status=o,this.statusText=c,this.url=p,this.body=m}}const hn=oe()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,On=u=>ie.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf("://"))];function _i(u,o){const c=new AbortController,p=new Request(u.url,{method:u.method||"GET",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:hn(),signal:c.signal});let m=!1,v=!1;return u.type==="json"&&p.headers.set("Accept","application/json"),v||fetch(p).then(w=>w.ok?(E=>{(u.type==="arrayBuffer"||u.type==="image"?E.arrayBuffer():u.type==="json"?E.json():E.text()).then(T=>{v||(m=!0,o(null,T,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(T=>{v||o(new Error(T.message))})})(w):w.blob().then(E=>o(new De(w.status,w.statusText,u.url,E)))).catch(w=>{w.code!==20&&o(new Error(w.message))}),{cancel:()=>{v=!0,m||c.abort()}}}const wn=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(oe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,o);if(!oe())return(On(u.url)||_i)(u,o)}if(!(/^file:/.test(c=u.url)||/^file:/.test(hn())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return _i(u,o);if(oe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,o,void 0,!0)}var c;return function(p,m){const v=new XMLHttpRequest;v.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(v.responseType="arraybuffer");for(const w in p.headers)v.setRequestHeader(w,p.headers[w]);return p.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=p.credentials==="include",v.onerror=()=>{m(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let w=v.response;if(p.type==="json")try{w=JSON.parse(v.response)}catch(E){return m(E)}m(null,w,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else{const w=new Blob([v.response],{type:v.getResponseHeader("Content-Type")});m(new De(v.status,v.statusText,p.url,w))}},v.send(p.body),{cancel:()=>v.abort()}}(u,o)},_t=function(u,o){return wn(gt(u,{type:"arrayBuffer"}),o)};function Ee(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function qe(u,o,c){c[u]&&c[u].indexOf(o)!==-1||(c[u]=c[u]||[],c[u].push(o))}function nr(u,o,c){if(c&&c[u]){const p=c[u].indexOf(o);p!==-1&&c[u].splice(p,1)}}class Wn{constructor(o,c={}){gt(this,c),this.type=o}}class pn extends Wn{constructor(o,c={}){super("error",gt({error:o},c))}}class Wi{on(o,c){return this._listeners=this._listeners||{},qe(o,c,this._listeners),this}off(o,c){return nr(o,c,this._listeners),nr(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},qe(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new Wn(o,c||{}));const p=o.type;if(this.listens(p)){o.target=this;const m=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of m)E.call(this,o);const v=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of v)nr(p,E,this._oneTimeListeners),E.call(this,o);const w=this._eventedParent;w&&(gt(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof pn&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var $t={$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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},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 Bi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function fr(u,o){const c={};for(const p in u)p!=="ref"&&(c[p]=u[p]);return Bi.forEach(p=>{p in o&&(c[p]=o[p])}),c}function zn(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let c=0;c`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Mt=[ws,ue,ln,Ke,Ar,st,is,Z(on),G,q,J];function vt(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!vt(u.itemType,o.itemType))&&(typeof u.N!="number"||u.N===o.N))return null}else{if(u.kind===o.kind)return null;if(u.kind==="value"){for(const c of Mt)if(!vt(c,o))return null}}return`Expected ${ot(u)} but found ${ot(o)} instead.`}function rt(u,o){return o.some(c=>c.kind===u.kind)}function Tt(u,o){return o.some(c=>c==="null"?u===null:c==="array"?Array.isArray(u):c==="object"?u&&!Array.isArray(u)&&typeof u=="object":c===typeof u)}function Wt(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const Ht=.96422,Kt=.82521,Ne=4/29,Ye=6/29,Te=3*Ye*Ye,Ve=Ye*Ye*Ye,rn=Math.PI/180,Gn=180/Math.PI;function Jn(u){return(u%=360)<0&&(u+=360),u}function kn([u,o,c,p]){let m,v;const w=qr((.2225045*(u=Pn(u))+.7168786*(o=Pn(o))+.0606169*(c=Pn(c)))/1);u===o&&o===c?m=v=w:(m=qr((.4360747*u+.3850649*o+.1430804*c)/Ht),v=qr((.0139322*u+.0971045*o+.7141733*c)/Kt));const E=116*w-16;return[E<0?0:E,500*(m-w),200*(w-v),p]}function Pn(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function qr(u){return u>Ve?Math.pow(u,1/3):u/Te+Ne}function oi([u,o,c,p]){let m=(u+16)/116,v=isNaN(o)?m:m+o/500,w=isNaN(c)?m:m-c/200;return m=1*Nr(m),v=Ht*Nr(v),w=Kt*Nr(w),[ir(3.1338561*v-1.6168667*m-.4906146*w),ir(-.9787684*v+1.9161415*m+.033454*w),ir(.0719453*v-.2289914*m+1.4052427*w),p]}function ir(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function Nr(u){return u>Ye?u*u*u:Te*(u-Ne)}function rs(u){return parseInt(u.padEnd(2,u),16)/255}function xd(u,o){return ou(o?u/100:u,0,1)}function ou(u,o,c){return Math.min(Math.max(o,u),c)}function su(u){return!u.some(Number.isNaN)}const Og={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 Xn{constructor(o,c,p,m=1,v=!0){this.r=o,this.g=c,this.b=p,this.a=m,v||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[o,c,p,m]))}static parse(o){if(o instanceof Xn)return o;if(typeof o!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=Og[p];if(m){const[w,E,T]=m;return[w/255,E/255,T/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const w=p.length<6?1:2;let E=1;return[rs(p.slice(E,E+=w)),rs(p.slice(E,E+=w)),rs(p.slice(E,E+=w)),rs(p.slice(E,E+w)||"ff")]}if(p.startsWith("rgb")){const w=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[E,T,k,D,F,j,X,H,tt,lt,ft,kt]=w,St=[D||" ",X||" ",lt].join("");if(St===" "||St===" /"||St===",,"||St===",,,"){const At=[k,j,tt].join(""),Ft=At==="%%%"?100:At===""?255:0;if(Ft){const Jt=[ou(+T/Ft,0,1),ou(+F/Ft,0,1),ou(+H/Ft,0,1),ft?xd(+ft,kt):1];if(su(Jt))return Jt}}return}}const v=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[w,E,T,k,D,F,j,X,H]=v,tt=[T||" ",D||" ",j].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const lt=[+E,ou(+k,0,100),ou(+F,0,100),X?xd(+X,H):1];if(su(lt))return function([ft,kt,St,At]){function Ft(Jt){const ye=(Jt+ft/30)%12,Me=kt*Math.min(St,1-St);return St-Me*Math.max(-1,Math.min(ye-3,9-ye,1))}return ft=Jn(ft),kt/=100,St/=100,[Ft(0),Ft(8),Ft(4),At]}(lt)}}}(o);return c?new Xn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:p,a:m}=this,v=m||1/0;return this.overwriteGetter("rgb",[o/v,c/v,p/v,m])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,p,m,v]=kn(o),w=Math.sqrt(p*p+m*m);return[Math.round(1e4*w)?Jn(Math.atan2(m,p)*Gn):NaN,w,c,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",kn(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,p,m]=this.rgb;return`rgba(${[o,c,p].map(v=>Math.round(255*v)).join(",")},${m})`}}Xn.black=new Xn(0,0,0,1),Xn.white=new Xn(1,1,1,1),Xn.transparent=new Xn(0,0,0,0),Xn.red=new Xn(1,0,0,1);class mf{constructor(o,c,p){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Vc{constructor(o,c,p,m,v){this.text=o,this.image=c,this.scale=p,this.fontStack=m,this.textColor=v}}class Zr{constructor(o){this.sections=o}static fromString(o){return new Zr([new Vc(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Zr?o:Zr.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class Do{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Do)return o;if(typeof o=="number")return new Do([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new Do(o)}}toString(){return JSON.stringify(this.values)}}const zg=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class os{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof os)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&u<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,o,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,c,p]:[u,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function au(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof Xn||u instanceof mf||u instanceof Zr||u instanceof Do||u instanceof os||u instanceof Dr)return!0;if(Array.isArray(u)){for(const o of u)if(!au(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!au(u[o]))return!1;return!0}return!1}function Ei(u){if(u===null)return ws;if(typeof u=="string")return ln;if(typeof u=="boolean")return Ke;if(typeof u=="number")return ue;if(u instanceof Xn)return Ar;if(u instanceof mf)return Ss;if(u instanceof Zr)return st;if(u instanceof Do)return G;if(u instanceof os)return J;if(u instanceof Dr)return q;if(Array.isArray(u)){const o=u.length;let c;for(const p of u){const m=Ei(p);if(c){if(c===m)continue;c=on;break}c=m}return Z(c||on,o)}return is}function Fn(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Xn||u instanceof Zr||u instanceof Do||u instanceof os||u instanceof Dr?u.toString():JSON.stringify(u)}class Sl{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!au(o[1]))return c.error("invalid value");const p=o[1];let m=Ei(p);const v=c.expectedType;return m.kind!=="array"||m.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(m=v),new Sl(m,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Ai{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Gc={string:ln,number:ue,boolean:Ke,object:is};class ss{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let p,m=1;const v=o[0];if(v==="array"){let E,T;if(o.length>2){const k=o[1];if(typeof k!="string"||!(k in Gc)||k==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Gc[k],m++}else E=on;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);T=o[2],m++}p=Z(E,T)}else{if(!Gc[v])throw new Error(`Types doesn't contain name = ${v}`);p=Gc[v]}const w=[];for(;mo.outputDefined())}}const gf={"to-boolean":Ke,"to-color":Ar,"to-number":ue,"to-string":ln};class Ya{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[0];if(!gf[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return c.error("Expected one argument.");const m=gf[p],v=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Uc(c[0],c[1],c[2],c[3]),!p))return new Xn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new Ai(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(o);const m=Do.parse(c);if(m)return m}throw new Ai(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(o);const m=os.parse(c);if(m)return m}throw new Ai(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(o),c===null)return 0;const m=Number(c);if(!isNaN(m))return m}throw new Ai(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Zr.fromString(Fn(this.args[0].evaluate(o)));case"resolvedImage":return Dr.fromString(Fn(this.args[0].evaluate(o)));default:return Fn(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const wd=["Unknown","Point","LineString","Polygon"];class _f{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"?wd[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(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=Xn.parse(o)),c}}class jc{constructor(o,c,p=[],m,v=new Ea,w=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=v,this.errors=w,this.expectedType=m,this._isConstant=c}parse(o,c,p,m,v={}){return c?this.concat(c,p,m)._parse(o,v):this._parse(o,v)}_parse(o,c){function p(m,v,w){return w==="assert"?new ss(v,[m]):w==="coerce"?new Ya(v,[m]):m}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=o[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[m];if(v){let w=v.parse(o,this);if(!w)return null;if(this.expectedType){const E=this.expectedType,T=w.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||T.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||T.kind!=="value"&&T.kind!=="string")if(E.kind!=="padding"||T.kind!=="value"&&T.kind!=="number"&&T.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||T.kind!=="value"&&T.kind!=="array"){if(this.checkSubtype(E,T))return null}else w=p(w,E,c.typeAnnotation||"coerce");else w=p(w,E,c.typeAnnotation||"coerce");else w=p(w,E,c.typeAnnotation||"coerce");else w=p(w,E,c.typeAnnotation||"assert")}if(!(w instanceof Sl)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const E=new _f;try{w=new Sl(w.type,w.evaluate(E))}catch(T){return this.error(T.message),null}}return w}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,p){const m=typeof o=="number"?this.path.concat(o):this.path,v=p?this.scope.concat(p):this.scope;return new jc(this.registry,this._isConstant,m,c||null,v,this.errors)}error(o,...c){const p=`${this.key}${c.map(m=>`[${m}]`).join("")}`;this.errors.push(new ri(p,o))}checkSubtype(o,c){const p=vt(o,c);return p&&this.error(p),p}}class qc{constructor(o,c,p){this.type=Ss,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const m=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Ke);if(!m)return null;const v=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Ke);if(!v)return null;let w=null;return p.locale&&(w=c.parse(p.locale,1,ln),!w)?null:new qc(m,v,w)}evaluate(o){return new mf(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ka=8192;function yf(u,o){u[0]=Math.min(u[0],o[0]),u[1]=Math.min(u[1],o[1]),u[2]=Math.max(u[2],o[0]),u[3]=Math.max(u[3],o[1])}function Xu(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function Sd(u,o){const c=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,m=Math.pow(2,o.z);return[Math.round(c*m*Ka),Math.round(p*m*Ka)]}function Fg(u,o,c){const p=u[0]-o[0],m=u[1]-o[1],v=u[0]-c[0],w=u[1]-c[1];return p*w-v*m==0&&p*v<=0&&m*w<=0}function vf(u,o){let c=!1;for(let w=0,E=o.length;w(p=u)[1]!=(v=T[k+1])[1]>p[1]&&p[0]<(v[0]-m[0])*(p[1]-m[1])/(v[1]-m[1])+m[0]&&(c=!c)}}var p,m,v;return c}function bf(u,o){for(let c=0;c0&&E<0||w<0&&E>0}function Bg(u,o,c){for(const k of c)for(let D=0;Dc[2]){const m=.5*p;let v=u[0]-c[0]>m?-p:c[0]-u[0]>m?p:0;v===0&&(v=u[0]-c[2]>m?-p:c[2]-u[0]>m?p:0),u[0]+=v}yf(o,u)}function xf(u,o,c,p){const m=Math.pow(2,p.z)*Ka,v=[p.x*Ka,p.y*Ka],w=[];for(const E of u)for(const T of E){const k=[T.x+v[0],T.y+v[1]];Ld(k,o,c,m),w.push(k)}return w}function wf(u,o,c,p){const m=Math.pow(2,p.z)*Ka,v=[p.x*Ka,p.y*Ka],w=[];for(const T of u){const k=[];for(const D of T){const F=[D.x+v[0],D.y+v[1]];yf(o,F),k.push(F)}w.push(k)}if(o[2]-o[0]<=m/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const T of w)for(const k of T)Ld(k,o,c,m)}var E;return w}class El{constructor(o,c){this.type=Ke,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(au(o[1])){const p=o[1];if(p.type==="FeatureCollection")for(let m=0;m!Array.isArray(k)||k.length===o.length-1);let T=null;for(const[k,D]of E){T=new jc(c.registry,Wc,c.path,null,c.scope);const F=[];let j=!1;for(let X=1;X{return j=F,Array.isArray(j)?`(${j.map(ot).join(", ")})`:`(${ot(j.type)}...)`;var j}).join(" | "),D=[];for(let F=1;F{c=o?c&&Wc(p):c&&p instanceof Sl}),!!c&&Xc(u)&&Hc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xc(u){if(u instanceof as&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof El)return!1;let o=!0;return u.eachChild(c=>{o&&!Xc(c)&&(o=!1)}),o}function Hu(u){if(u instanceof as&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(c=>{o&&!Hu(c)&&(o=!1)}),o}function Hc(u,o){if(u instanceof as&&o.indexOf(u.name)>=0)return!1;let c=!0;return u.eachChild(p=>{c&&!Hc(p,o)&&(c=!1)}),c}function lu(u,o){const c=u.length-1;let p,m,v=0,w=c,E=0;for(;v<=w;)if(E=Math.floor((v+w)/2),p=u[E],m=u[E+1],p<=o){if(E===c||oo))throw new Ai("Input is not a number.");w=E-1}return 0}class Ja{constructor(o,c,p){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[m,v]of p)this.labels.push(m),this.outputs.push(v)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const p=c.parse(o[1],1,ue);if(!p)return null;const m=[];let v=null;c.expectedType&&c.expectedType.kind!=="value"&&(v=c.expectedType);for(let w=1;w=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',k);const F=c.parse(T,D,v);if(!F)return null;v=v||F.type,m.push([E,F])}return new Ja(v,p,m)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return p[0].evaluate(o);const v=c.length;return m>=c[v-1]?p[v-1].evaluate(o):p[lu(c,m)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Cn(u,o,c){return u+c*(o-u)}function Yc(u,o,c){return u.map((p,m)=>Cn(p,o[m],c))}const Ro={number:Cn,color:function(u,o,c,p="rgb"){switch(p){case"rgb":{const[m,v,w,E]=Yc(u.rgb,o.rgb,c);return new Xn(m,v,w,E,!1)}case"hcl":{const[m,v,w,E]=u.hcl,[T,k,D,F]=o.hcl;let j,X;if(isNaN(m)||isNaN(T))isNaN(m)?isNaN(T)?j=NaN:(j=T,w!==1&&w!==0||(X=k)):(j=m,D!==1&&D!==0||(X=v));else{let kt=T-m;T>m&&kt>180?kt-=360:T180&&(kt+=360),j=m+c*kt}const[H,tt,lt,ft]=function([kt,St,At,Ft]){return kt=isNaN(kt)?0:kt*rn,oi([At,Math.cos(kt)*St,Math.sin(kt)*St,Ft])}([j,X??Cn(v,k,c),Cn(w,D,c),Cn(E,F,c)]);return new Xn(H,tt,lt,ft,!1)}case"lab":{const[m,v,w,E]=oi(Yc(u.lab,o.lab,c));return new Xn(m,v,w,E,!1)}}},array:Yc,padding:function(u,o,c){return new Do(Yc(u.values,o.values,c))},variableAnchorOffsetCollection:function(u,o,c){const p=u.values,m=o.values;if(p.length!==m.length)throw new Ai(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:k}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(v=c.parse(v,2,ue),!v)return null;const E=[];let T=null;p==="interpolate-hcl"||p==="interpolate-lab"?T=Ar:c.expectedType&&c.expectedType.kind!=="value"&&(T=c.expectedType);for(let k=0;k=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const H=c.parse(F,X,T);if(!H)return null;T=T||H.type,E.push([D,H])}return Wt(T,ue)||Wt(T,Ar)||Wt(T,G)||Wt(T,J)||Wt(T,Z(ue))?new Oo(T,p,m,v,E):c.error(`Type ${ot(T)} is not interpolatable.`)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return p[0].evaluate(o);const v=c.length;if(m>=c[v-1])return p[v-1].evaluate(o);const w=lu(c,m),E=Oo.interpolationFactor(this.interpolation,m,c[w],c[w+1]),T=p[w].evaluate(o),k=p[w+1].evaluate(o);switch(this.operator){case"interpolate":return Ro[this.type.kind](T,k,E);case"interpolate-hcl":return Ro.color(T,k,E,"hcl");case"interpolate-lab":return Ro.color(T,k,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Sf(u,o,c,p){const m=p-c,v=u-c;return m===0?0:o===1?v/m:(Math.pow(o,v)-1)/(Math.pow(o,m)-1)}class Kc{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let p=null;const m=c.expectedType;m&&m.kind!=="value"&&(p=m);const v=[];for(const E of o.slice(1)){const T=c.parse(E,1+v.length,p,void 0,{typeAnnotation:"omit"});if(!T)return null;p=p||T.type,v.push(T)}if(!p)throw new Error("No output type");const w=m&&v.some(E=>vt(m,E.type));return new Kc(w?on:p,v)}evaluate(o){let c,p=null,m=0;for(const v of this.args)if(m++,p=v.evaluate(o),p&&p instanceof Dr&&!p.available&&(c||(c=p.name),p=null,m===this.args.length&&(p=c)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class Jc{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let v=1;v=p.length)throw new Ai(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new Ai(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class If{constructor(o,c){this.type=Ke,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,on),m=c.parse(o[2],2,on);return p&&m?rt(p.type,[Ke,ln,ue,ws,on])?new If(p,m):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(p.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!Tt(c,["boolean","string","number","null"]))throw new Ai(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Ei(c))} instead.`);if(!Tt(p,["string","array"]))throw new Ai(`Expected second argument to be of type array or string, but found ${ot(Ei(p))} instead.`);return p.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Qc{constructor(o,c,p){this.type=ue,this.needle=o,this.haystack=c,this.fromIndex=p}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,on),m=c.parse(o[2],2,on);if(!p||!m)return null;if(!rt(p.type,[Ke,ln,ue,ws,on]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(p.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,ue);return v?new Qc(p,m,v):null}return new Qc(p,m)}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!Tt(c,["boolean","string","number","null"]))throw new Ai(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Ei(c))} instead.`);if(!Tt(p,["string","array"]))throw new Ai(`Expected second argument to be of type array or string, but found ${ot(Ei(p))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(o);return p.indexOf(c,m)}return p.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Cf{constructor(o,c,p,m,v,w){this.inputType=o,this.type=c,this.input=p,this.cases=m,this.outputs=v,this.otherwise=w}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let p,m;c.expectedType&&c.expectedType.kind!=="value"&&(m=c.expectedType);const v={},w=[];for(let k=2;kNumber.MAX_SAFE_INTEGER)return j.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof H=="number"&&Math.floor(H)!==H)return j.error("Numeric branch labels must be integer values.");if(p){if(j.checkSubtype(p,Ei(H)))return null}else p=Ei(H);if(v[String(H)]!==void 0)return j.error("Branch labels must be unique.");v[String(H)]=w.length}const X=c.parse(F,k,m);if(!X)return null;m=m||X.type,w.push(X)}const E=c.parse(o[1],1,on);if(!E)return null;const T=c.parse(o[o.length-1],o.length-1,m);return T?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new Cf(p,m,E,v,w,T):null}evaluate(o){const c=this.input.evaluate(o);return(Ei(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Tf{constructor(o,c,p){this.type=o,this.branches=c,this.otherwise=p}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const m=[];for(let w=1;wc.outputDefined())&&this.otherwise.outputDefined()}}class th{constructor(o,c,p,m){this.type=o,this.input=c,this.beginIndex=p,this.endIndex=m}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,on),m=c.parse(o[2],2,ue);if(!p||!m)return null;if(!rt(p.type,[Z(on),ln,on]))return c.error(`Expected first argument to be of type array or string, but found ${ot(p.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,ue);return v?new th(p.type,p,m,v):null}return new th(p.type,p,m)}evaluate(o){const c=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!Tt(c,["string","array"]))throw new Ai(`Expected first argument to be of type array or string, but found ${ot(Ei(c))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(o);return c.slice(p,m)}return c.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Md(u,o){return u==="=="||u==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Pd(u,o,c,p){return p.compare(o,c)===0}function uu(u,o,c){const p=u!=="=="&&u!=="!=";return class ix{constructor(v,w,E){this.type=Ke,this.lhs=v,this.rhs=w,this.collator=E,this.hasUntypedArgument=v.type.kind==="value"||w.type.kind==="value"}static parse(v,w){if(v.length!==3&&v.length!==4)return w.error("Expected two or three arguments.");const E=v[0];let T=w.parse(v[1],1,on);if(!T)return null;if(!Md(E,T.type))return w.concat(1).error(`"${E}" comparisons are not supported for type '${ot(T.type)}'.`);let k=w.parse(v[2],2,on);if(!k)return null;if(!Md(E,k.type))return w.concat(2).error(`"${E}" comparisons are not supported for type '${ot(k.type)}'.`);if(T.type.kind!==k.type.kind&&T.type.kind!=="value"&&k.type.kind!=="value")return w.error(`Cannot compare types '${ot(T.type)}' and '${ot(k.type)}'.`);p&&(T.type.kind==="value"&&k.type.kind!=="value"?T=new ss(k.type,[T]):T.type.kind!=="value"&&k.type.kind==="value"&&(k=new ss(T.type,[k])));let D=null;if(v.length===4){if(T.type.kind!=="string"&&k.type.kind!=="string"&&T.type.kind!=="value"&&k.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(v[3],3,Ss),!D)return null}return new ix(T,k,D)}evaluate(v){const w=this.lhs.evaluate(v),E=this.rhs.evaluate(v);if(p&&this.hasUntypedArgument){const T=Ei(w),k=Ei(E);if(T.kind!==k.kind||T.kind!=="string"&&T.kind!=="number")throw new Ai(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${T.kind}, ${k.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const T=Ei(w),k=Ei(E);if(T.kind!=="string"||k.kind!=="string")return o(v,w,E)}return this.collator?c(v,w,E,this.collator.evaluate(v)):o(v,w,E)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Vg=uu("==",function(u,o,c){return o===c},Pd),Ug=uu("!=",function(u,o,c){return o!==c},function(u,o,c,p){return!Pd(0,o,c,p)}),Gg=uu("<",function(u,o,c){return o",function(u,o,c){return o>c},function(u,o,c,p){return p.compare(o,c)>0}),qg=uu("<=",function(u,o,c){return o<=c},function(u,o,c,p){return p.compare(o,c)<=0}),Zg=uu(">=",function(u,o,c){return o>=c},function(u,o,c,p){return p.compare(o,c)>=0});class Lf{constructor(o,c,p,m,v){this.type=ln,this.number=o,this.locale=c,this.currency=p,this.minFractionDigits=m,this.maxFractionDigits=v}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ue);if(!p)return null;const m=o[2];if(typeof m!="object"||Array.isArray(m))return c.error("NumberFormat options argument must be an object.");let v=null;if(m.locale&&(v=c.parse(m.locale,1,ln),!v))return null;let w=null;if(m.currency&&(w=c.parse(m.currency,1,ln),!w))return null;let E=null;if(m["min-fraction-digits"]&&(E=c.parse(m["min-fraction-digits"],1,ue),!E))return null;let T=null;return m["max-fraction-digits"]&&(T=c.parse(m["max-fraction-digits"],1,ue),!T)?null:new Lf(p,v,w,E,T)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class eh{constructor(o){this.type=st,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const m=[];let v=!1;for(let w=1;w<=o.length-1;++w){const E=o[w];if(v&&typeof E=="object"&&!Array.isArray(E)){v=!1;let T=null;if(E["font-scale"]&&(T=c.parse(E["font-scale"],1,ue),!T))return null;let k=null;if(E["text-font"]&&(k=c.parse(E["text-font"],1,Z(ln)),!k))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,Ar),!D))return null;const F=m[m.length-1];F.scale=T,F.font=k,F.textColor=D}else{const T=c.parse(o[w],1,on);if(!T)return null;const k=T.type.kind;if(k!=="string"&&k!=="value"&&k!=="null"&&k!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,m.push({content:T,scale:null,font:null,textColor:null})}}return new eh(m)}evaluate(o){return new Zr(this.sections.map(c=>{const p=c.content.evaluate(o);return Ei(p)===q?new Vc("",p,null,null,null):new Vc(Fn(p),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class Mf{constructor(o){this.type=q,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const p=c.parse(o[1],1,ln);return p?new Mf(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=Dr.fromString(c);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(c)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class Pf{constructor(o){this.type=ue,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=c.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${ot(p.type)} instead.`):new Pf(p):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new Ai(`Expected value to be of type string or array, but found ${ot(Ei(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const cu={"==":Vg,"!=":Ug,">":jg,"<":Gg,">=":Zg,"<=":qg,array:ss,at:Ef,boolean:ss,case:Tf,coalesce:Kc,collator:qc,format:eh,image:Mf,in:If,"index-of":Qc,interpolate:Oo,"interpolate-hcl":Oo,"interpolate-lab":Oo,length:Pf,let:Jc,literal:Sl,match:Cf,number:ss,"number-format":Lf,object:ss,slice:th,step:Ja,string:ss,"to-boolean":Ya,"to-color":Ya,"to-number":Ya,"to-string":Ya,var:$c,within:El};function kd(u,[o,c,p,m]){o=o.evaluate(u),c=c.evaluate(u),p=p.evaluate(u);const v=m?m.evaluate(u):1,w=Uc(o,c,p,v);if(w)throw new Ai(w);return new Xn(o/255,c/255,p/255,v,!1)}function Ad(u,o){return u in o}function kf(u,o){const c=o[u];return c===void 0?null:c}function Il(u){return{type:u}}function Nd(u){return{result:"success",value:u}}function Qa(u){return{result:"error",value:u}}function hu(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function Dd(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function Af(u){return!!u.expression&&u.expression.interpolated}function Bn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function Ii(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function $g(u){return u}function Tn(u,o){const c=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",m=p||!(p||u.property!==void 0),v=u.type||(Af(o)?"exponential":"interval");if(c||o.type==="padding"){const D=c?Xn.parse:Do.parse;(u=yo({},u)).stops&&(u.stops=u.stops.map(F=>[F[0],D(F[1])])),u.default=D(u.default?u.default:o.default)}if(u.colorSpace&&(w=u.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var w;let E,T,k;if(v==="exponential")E=Yu;else if(v==="interval")E=yi;else if(v==="categorical"){E=Ci,T=Object.create(null);for(const D of u.stops)T[D[0]]=D[1];k=typeof u.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Rd}if(p){const D={},F=[];for(let H=0;HH[0]),evaluate:({zoom:H},tt)=>Yu({stops:j,base:u.base},o,H).evaluate(H,tt)}}if(m){const D=v==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Oo.interpolationFactor.bind(void 0,D),zoomStops:u.stops.map(F=>F[0]),evaluate:({zoom:F})=>E(u,o,F,T,k)}}return{kind:"source",evaluate(D,F){const j=F&&F.properties?F.properties[u.property]:void 0;return j===void 0?Cl(u.default,o.default):E(u,o,j,T,k)}}}function Cl(u,o,c){return u!==void 0?u:o!==void 0?o:c!==void 0?c:void 0}function Ci(u,o,c,p,m){return Cl(typeof c===m?p[c]:void 0,u.default,o.default)}function yi(u,o,c){if(Bn(c)!=="number")return Cl(u.default,o.default);const p=u.stops.length;if(p===1||c<=u.stops[0][0])return u.stops[0][1];if(c>=u.stops[p-1][0])return u.stops[p-1][1];const m=lu(u.stops.map(v=>v[0]),c);return u.stops[m][1]}function Yu(u,o,c){const p=u.base!==void 0?u.base:1;if(Bn(c)!=="number")return Cl(u.default,o.default);const m=u.stops.length;if(m===1||c<=u.stops[0][0])return u.stops[0][1];if(c>=u.stops[m-1][0])return u.stops[m-1][1];const v=lu(u.stops.map(D=>D[0]),c),w=function(D,F,j,X){const H=X-j,tt=D-j;return H===0?0:F===1?tt/H:(Math.pow(F,tt)-1)/(Math.pow(F,H)-1)}(c,p,u.stops[v][0],u.stops[v+1][0]),E=u.stops[v][1],T=u.stops[v+1][1],k=Ro[o.type]||$g;return typeof E.evaluate=="function"?{evaluate(...D){const F=E.evaluate.apply(void 0,D),j=T.evaluate.apply(void 0,D);if(F!==void 0&&j!==void 0)return k(F,j,w,u.colorSpace)}}:k(E,T,w,u.colorSpace)}function Rd(u,o,c){switch(o.type){case"color":c=Xn.parse(c);break;case"formatted":c=Zr.fromString(c.toString());break;case"resolvedImage":c=Dr.fromString(c.toString());break;case"padding":c=Do.parse(c);break;default:Bn(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return Cl(c,u.default,o.default)}as.register(cu,{error:[{kind:"error"},[ln],(u,[o])=>{throw new Ai(o.evaluate(u))}],typeof:[ln,[on],(u,[o])=>ot(Ei(o.evaluate(u)))],"to-rgba":[Z(ue,4),[Ar],(u,[o])=>{const[c,p,m,v]=o.evaluate(u).rgb;return[255*c,255*p,255*m,v]}],rgb:[Ar,[ue,ue,ue],kd],rgba:[Ar,[ue,ue,ue,ue],kd],has:{type:Ke,overloads:[[[ln],(u,[o])=>Ad(o.evaluate(u),u.properties())],[[ln,is],(u,[o,c])=>Ad(o.evaluate(u),c.evaluate(u))]]},get:{type:on,overloads:[[[ln],(u,[o])=>kf(o.evaluate(u),u.properties())],[[ln,is],(u,[o,c])=>kf(o.evaluate(u),c.evaluate(u))]]},"feature-state":[on,[ln],(u,[o])=>kf(o.evaluate(u),u.featureState||{})],properties:[is,[],u=>u.properties()],"geometry-type":[ln,[],u=>u.geometryType()],id:[on,[],u=>u.id()],zoom:[ue,[],u=>u.globals.zoom],"heatmap-density":[ue,[],u=>u.globals.heatmapDensity||0],"line-progress":[ue,[],u=>u.globals.lineProgress||0],accumulated:[on,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ue,Il(ue),(u,o)=>{let c=0;for(const p of o)c+=p.evaluate(u);return c}],"*":[ue,Il(ue),(u,o)=>{let c=1;for(const p of o)c*=p.evaluate(u);return c}],"-":{type:ue,overloads:[[[ue,ue],(u,[o,c])=>o.evaluate(u)-c.evaluate(u)],[[ue],(u,[o])=>-o.evaluate(u)]]},"/":[ue,[ue,ue],(u,[o,c])=>o.evaluate(u)/c.evaluate(u)],"%":[ue,[ue,ue],(u,[o,c])=>o.evaluate(u)%c.evaluate(u)],ln2:[ue,[],()=>Math.LN2],pi:[ue,[],()=>Math.PI],e:[ue,[],()=>Math.E],"^":[ue,[ue,ue],(u,[o,c])=>Math.pow(o.evaluate(u),c.evaluate(u))],sqrt:[ue,[ue],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ue,[ue],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ue,[ue],(u,[o])=>Math.log(o.evaluate(u))],log2:[ue,[ue],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ue,[ue],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ue,[ue],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ue,[ue],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ue,[ue],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ue,[ue],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ue,[ue],(u,[o])=>Math.atan(o.evaluate(u))],min:[ue,Il(ue),(u,o)=>Math.min(...o.map(c=>c.evaluate(u)))],max:[ue,Il(ue),(u,o)=>Math.max(...o.map(c=>c.evaluate(u)))],abs:[ue,[ue],(u,[o])=>Math.abs(o.evaluate(u))],round:[ue,[ue],(u,[o])=>{const c=o.evaluate(u);return c<0?-Math.round(-c):Math.round(c)}],floor:[ue,[ue],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ue,[ue],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[Ke,[ln,on],(u,[o,c])=>u.properties()[o.value]===c.value],"filter-id-==":[Ke,[on],(u,[o])=>u.id()===o.value],"filter-type-==":[Ke,[ln],(u,[o])=>u.geometryType()===o.value],"filter-<":[Ke,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p{const c=u.id(),p=o.value;return typeof c==typeof p&&c":[Ke,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>m}],"filter-id->":[Ke,[on],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ke,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p<=m}],"filter-id-<=":[Ke,[on],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ke,[ln,on],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>=m}],"filter-id->=":[Ke,[on],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ke,[on],(u,[o])=>o.value in u.properties()],"filter-has-id":[Ke,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[Ke,[Z(ln)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[Ke,[Z(on)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[Ke,[ln,Z(on)],(u,[o,c])=>c.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[Ke,[ln,Z(on)],(u,[o,c])=>function(p,m,v,w){for(;v<=w;){const E=v+w>>1;if(m[E]===p)return!0;m[E]>p?w=E-1:v=E+1}return!1}(u.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Ke,overloads:[[[Ke,Ke],(u,[o,c])=>o.evaluate(u)&&c.evaluate(u)],[Il(Ke),(u,o)=>{for(const c of o)if(!c.evaluate(u))return!1;return!0}]]},any:{type:Ke,overloads:[[[Ke,Ke],(u,[o,c])=>o.evaluate(u)||c.evaluate(u)],[Il(Ke),(u,o)=>{for(const c of o)if(c.evaluate(u))return!0;return!1}]]},"!":[Ke,[Ke],(u,[o])=>!o.evaluate(u)],"is-supported-script":[Ke,[ln],(u,[o])=>{const c=u.globals&&u.globals.isSupportedScript;return!c||c(o.evaluate(u))}],upcase:[ln,[ln],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[ln,[ln],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[ln,Il(on),(u,o)=>o.map(c=>Fn(c.evaluate(u))).join("")],"resolved-locale":[ln,[Ss],(u,[o])=>o.evaluate(u).resolvedLocale()]});class Nf{constructor(o,c){var p;this.expression=o,this._warningHistory={},this._evaluator=new _f,this._defaultValue=c?(p=c).type==="color"&&Ii(p.default)?new Xn(0,0,0,0):p.type==="color"?Xn.parse(p.default)||null:p.type==="padding"?Do.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?os.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,p,m,v,w){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,c,p,m,v,w){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new Ai(`Expected value to be one of ${Object.keys(this._enumValues).map(T=>JSON.stringify(T)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function nh(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in cu}function ih(u,o){const c=new jc(cu,Wc,[],o?function(m){const v={color:Ar,string:ln,number:ue,enum:ln,boolean:Ke,formatted:st,padding:G,resolvedImage:q,variableAnchorOffsetCollection:J};return m.type==="array"?Z(v[m.value]||on,m.length):v[m.type]}(o):void 0),p=c.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?Nd(new Nf(p,o)):Qa(c.errors)}class Df{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Hu(c.expression)}evaluateWithoutErrorHandling(o,c,p,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,m,v,w)}evaluate(o,c,p,m,v,w){return this._styleExpression.evaluate(o,c,p,m,v,w)}}class rh{constructor(o,c,p,m){this.kind=o,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Hu(c.expression),this.interpolationType=m}evaluateWithoutErrorHandling(o,c,p,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,m,v,w)}evaluate(o,c,p,m,v,w){return this._styleExpression.evaluate(o,c,p,m,v,w)}interpolationFactor(o,c,p){return this.interpolationType?Oo.interpolationFactor(this.interpolationType,o,c,p):0}}function Rf(u,o){const c=ih(u,o);if(c.result==="error")return c;const p=c.value.expression,m=Xc(p);if(!m&&!hu(o))return Qa([new ri("","data expressions not supported")]);const v=Hc(p,["zoom"]);if(!v&&!Dd(o))return Qa([new ri("","zoom expressions not supported")]);const w=Ju(p);return w||v?w instanceof ri?Qa([w]):w instanceof Oo&&!Af(o)?Qa([new ri("",'"interpolate" expressions cannot be used with this property')]):Nd(w?new rh(m?"camera":"composite",c.value,w.labels,w instanceof Oo?w.interpolation:void 0):new Df(m?"constant":"source",c.value)):Qa([new ri("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ku{constructor(o,c){this._parameters=o,this._specification=c,yo(this,Tn(this._parameters,this._specification))}static deserialize(o){return new Ku(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Ju(u){let o=null;if(u instanceof Jc)o=Ju(u.result);else if(u instanceof Kc){for(const c of u.args)if(o=Ju(c),o)break}else(u instanceof Ja||u instanceof Oo)&&u.input instanceof as&&u.input.name==="zoom"&&(o=u);return o instanceof ri||u.eachChild(c=>{const p=Ju(c);p instanceof ri?o=p:!o&&p?o=new ri("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new ri("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function Qu(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const o of u.slice(1))if(!Qu(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Wg={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Of(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Qu(u)||(u=oh(u));const o=ih(u,Wg);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,m)=>o.value.evaluate(c,p,{},m),needGeometry:Od(u)}}function Xg(u,o){return uo?1:0}function Od(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?zf(u[1],u[2],o):o==="any"?(c=u.slice(1),["any"].concat(c.map(oh))):o==="all"?["all"].concat(u.slice(1).map(oh)):o==="none"?["all"].concat(u.slice(1).map(oh).map(tc)):o==="in"?zd(u[1],u.slice(2)):o==="!in"?tc(zd(u[1],u.slice(2))):o==="has"?Fd(u[1]):o==="!has"?tc(Fd(u[1])):o!=="within"||u;var c}function zf(u,o,c){switch(u){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,u,o]}}function zd(u,o){if(o.length===0)return!1;switch(u){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",u,["literal",o.sort(Xg)]]:["filter-in-small",u,["literal",o]]}}function Fd(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function tc(u){return["!",u]}function sh(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let m="[";for(const v of u)m+=`${sh(v)},`;return`${m}]`}const c=Object.keys(u).sort();let p="{";for(let m=0;mp.maximum?[new ae(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function lh(u){const o=u.valueSpec,c=Ni(u.value.type);let p,m,v,w={};const E=c!=="categorical"&&u.value.property===void 0,T=!E,k=Bn(u.value.stops)==="array"&&Bn(u.value.stops[0])==="array"&&Bn(u.value.stops[0][0])==="object",D=vo({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(X){if(c==="identity")return[new ae(X.key,X.value,'identity function may not have a "stops" property')];let H=[];const tt=X.value;return H=H.concat(fu({key:X.key,value:tt,valueSpec:X.valueSpec,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,arrayElementValidator:F})),Bn(tt)==="array"&&tt.length===0&&H.push(new ae(X.key,tt,"array must have at least one stop")),H},default:function(X){return X.validateSpec({key:X.key,value:X.value,valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec})}}});return c==="identity"&&E&&D.push(new ae(u.key,u.value,'missing required property "property"')),c==="identity"||u.value.stops||D.push(new ae(u.key,u.value,'missing required property "stops"')),c==="exponential"&&u.valueSpec.expression&&!Af(u.valueSpec)&&D.push(new ae(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(T&&!hu(u.valueSpec)?D.push(new ae(u.key,u.value,"property functions not supported")):E&&!Dd(u.valueSpec)&&D.push(new ae(u.key,u.value,"zoom functions not supported"))),c!=="categorical"&&!k||u.value.property!==void 0||D.push(new ae(u.key,u.value,'"property" property is required')),D;function F(X){let H=[];const tt=X.value,lt=X.key;if(Bn(tt)!=="array")return[new ae(lt,tt,`array expected, ${Bn(tt)} found`)];if(tt.length!==2)return[new ae(lt,tt,`array length 2 expected, length ${tt.length} found`)];if(k){if(Bn(tt[0])!=="object")return[new ae(lt,tt,`object expected, ${Bn(tt[0])} found`)];if(tt[0].zoom===void 0)return[new ae(lt,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new ae(lt,tt,"object stop key must have value")];if(v&&v>Ni(tt[0].zoom))return[new ae(lt,tt[0].zoom,"stop zoom values must appear in ascending order")];Ni(tt[0].zoom)!==v&&(v=Ni(tt[0].zoom),m=void 0,w={}),H=H.concat(vo({key:`${lt}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,objectElementValidators:{zoom:ec,value:j}}))}else H=H.concat(j({key:`${lt}[0]`,value:tt[0],valueSpec:{},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec},tt));return nh(Tl(tt[1]))?H.concat([new ae(`${lt}[1]`,tt[1],"expressions are not allowed in function stops.")]):H.concat(X.validateSpec({key:`${lt}[1]`,value:tt[1],valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec}))}function j(X,H){const tt=Bn(X.value),lt=Ni(X.value),ft=X.value!==null?X.value:H;if(p){if(tt!==p)return[new ae(X.key,ft,`${tt} stop domain type must match previous stop domain type ${p}`)]}else p=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new ae(X.key,ft,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let kt=`number expected, ${tt} found`;return hu(o)&&c===void 0&&(kt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ae(X.key,ft,kt)]}return c!=="categorical"||tt!=="number"||isFinite(lt)&&Math.floor(lt)===lt?c!=="categorical"&&tt==="number"&&m!==void 0&<new ae(`${u.key}${p.key}`,u.value,p.message));const c=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!c.outputDefined())return[new ae(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!Hu(c))return[new ae(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!Hu(c))return[new ae(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!Hc(c,["zoom","feature-state"]))return[new ae(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Xc(c))return[new ae(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function nc(u){const o=u.key,c=u.value,p=u.valueSpec,m=[];return Array.isArray(p.values)?p.values.indexOf(Ni(c))===-1&&m.push(new ae(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(Ni(c))===-1&&m.push(new ae(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),m}function pu(u){return Qu(Tl(u.value))?Ll(yo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Vd(u)}function Vd(u){const o=u.value,c=u.key;if(Bn(o)!=="array")return[new ae(c,o,`array expected, ${Bn(o)} found`)];const p=u.styleSpec;let m,v=[];if(o.length<1)return[new ae(c,o,"filter array must have at least 1 element")];switch(v=v.concat(nc({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Ni(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Ni(o[1])==="$type"&&v.push(new ae(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new ae(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(m=Bn(o[1]),m!=="string"&&v.push(new ae(`${c}[1]`,o[1],`string expected, ${m} found`)));for(let w=2;w{k in c&&o.push(new ae(p,c[k],`"${k}" is prohibited for ref layers`))}),m.layers.forEach(k=>{Ni(k.id)===E&&(T=k)}),T?T.ref?o.push(new ae(p,c.ref,"ref cannot reference another ref layer")):w=Ni(T.type):o.push(new ae(p,c.ref,`ref layer "${E}" not found`))}else if(w!=="background")if(c.source){const T=m.sources&&m.sources[c.source],k=T&&Ni(T.type);T?k==="vector"&&w==="raster"?o.push(new ae(p,c.source,`layer "${c.id}" requires a raster source`)):k!=="raster-dem"&&w==="hillshade"?o.push(new ae(p,c.source,`layer "${c.id}" requires a raster-dem source`)):k==="raster"&&w!=="raster"?o.push(new ae(p,c.source,`layer "${c.id}" requires a vector source`)):k!=="vector"||c["source-layer"]?k==="raster-dem"&&w!=="hillshade"?o.push(new ae(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!c.paint||!c.paint["line-gradient"]||k==="geojson"&&T.lineMetrics||o.push(new ae(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new ae(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new ae(p,c.source,`source "${c.source}" not found`))}else o.push(new ae(p,c,'missing required property "source"'));return o=o.concat(vo({key:p,value:c,valueSpec:v.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:c.type,valueSpec:v.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:c,objectKey:"type"}),filter:pu,layout:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":k=>jd(yo({layerType:w},k))}}),paint:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":k=>Gd(yo({layerType:w},k))}})}})),o}function qs(u){const o=u.value,c=u.key,p=Bn(o);return p!=="string"?[new ae(c,o,`string expected, ${p} found`)]:[]}const ic={promoteId:function({key:u,value:o}){if(Bn(o)==="string")return qs({key:u,value:o});{const c=[];for(const p in o)c.push(...qs({key:`${u}.${p}`,value:o[p]}));return c}}};function zo(u){const o=u.value,c=u.key,p=u.styleSpec,m=u.style,v=u.validateSpec;if(!o.type)return[new ae(c,o,'"type" is required')];const w=Ni(o.type);let E;switch(w){case"vector":case"raster":return E=vo({key:c,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:ic,validateSpec:v}),E;case"raster-dem":return E=function(T){var k;const D=(k=T.sourceName)!==null&&k!==void 0?k:"",F=T.value,j=T.styleSpec,X=j.source_raster_dem,H=T.style;let tt=[];const lt=Bn(F);if(F===void 0)return tt;if(lt!=="object")return tt.push(new ae("source_raster_dem",F,`object expected, ${lt} found`)),tt;const ft=Ni(F.encoding)==="custom",kt=["redFactor","greenFactor","blueFactor","baseShift"],St=T.value.encoding?`"${T.value.encoding}"`:"Default";for(const At in F)!ft&&kt.includes(At)?tt.push(new ae(At,F[At],`In "${D}": "${At}" is only valid when "encoding" is set to "custom". ${St} encoding found`)):X[At]?tt=tt.concat(T.validateSpec({key:At,value:F[At],valueSpec:X[At],validateSpec:T.validateSpec,style:H,styleSpec:j})):tt.push(new ae(At,F[At],`unknown property "${At}"`));return tt}({sourceName:c,value:o,style:u.style,styleSpec:p,validateSpec:v}),E;case"geojson":if(E=vo({key:c,value:o,valueSpec:p.source_geojson,style:m,styleSpec:p,validateSpec:v,objectElementValidators:ic}),o.cluster)for(const T in o.clusterProperties){const[k,D]=o.clusterProperties[T],F=typeof k=="string"?[k,["accumulated"],["get",T]]:k;E.push(...Ll({key:`${c}.${T}.map`,value:D,validateSpec:v,expressionContext:"cluster-map"})),E.push(...Ll({key:`${c}.${T}.reduce`,value:F,validateSpec:v,expressionContext:"cluster-reduce"}))}return E;case"video":return vo({key:c,value:o,valueSpec:p.source_video,style:m,validateSpec:v,styleSpec:p});case"image":return vo({key:c,value:o,valueSpec:p.source_image,style:m,validateSpec:v,styleSpec:p});case"canvas":return[new ae(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return nc({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:p})}}function rc(u){const o=u.value,c=u.styleSpec,p=c.light,m=u.style;let v=[];const w=Bn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new ae("light",o,`object expected, ${w} found`)]),v;for(const E in o){const T=E.match(/^(.*)-transition$/);v=v.concat(T&&p[T[1]]&&p[T[1]].transition?u.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:u.validateSpec,style:m,styleSpec:c}):p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:m,styleSpec:c}):[new ae(E,o[E],`unknown property "${E}"`)])}return v}function Zd(u){const o=u.value,c=u.styleSpec,p=c.terrain,m=u.style;let v=[];const w=Bn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new ae("terrain",o,`object expected, ${w} found`)]),v;for(const E in o)v=v.concat(p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:m,styleSpec:c}):[new ae(E,o[E],`unknown property "${E}"`)]);return v}function $d(u){let o=[];const c=u.value,p=u.key;if(Array.isArray(c)){const m=[],v=[];for(const w in c)c[w].id&&m.includes(c[w].id)&&o.push(new ae(p,c,`all the sprites' ids must be unique, but ${c[w].id} is duplicated`)),m.push(c[w].id),c[w].url&&v.includes(c[w].url)&&o.push(new ae(p,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),v.push(c[w].url),o=o.concat(vo({key:`${p}[${w}]`,value:c[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return qs({key:p,value:c})}const Wd={"*":()=>[],array:fu,boolean:function(u){const o=u.value,c=u.key,p=Bn(o);return p!=="boolean"?[new ae(c,o,`boolean expected, ${p} found`)]:[]},number:ec,color:function(u){const o=u.key,c=u.value,p=Bn(c);return p!=="string"?[new ae(o,c,`color expected, ${p} found`)]:Xn.parse(String(c))?[]:[new ae(o,c,`color expected, "${c}" found`)]},constants:Bd,enum:nc,filter:pu,function:lh,layer:qd,object:vo,source:zo,light:rc,terrain:Zd,string:qs,formatted:function(u){return qs(u).length===0?[]:Ll(u)},resolvedImage:function(u){return qs(u).length===0?[]:Ll(u)},padding:function(u){const o=u.key,c=u.value;if(Bn(c)==="array"){if(c.length<1||c.length>4)return[new ae(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let m=[];for(let v=0;v[]}})),u.constants&&(c=c.concat(Bd({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:Ia}))),uh(c)}function Ca(u){return function(o){return u({...o,validateSpec:Ia})}}function uh(u){return[].concat(u).sort((o,c)=>o.line-c.line)}function Ta(u){return function(...o){return uh(u.apply(this,o))}}ls.source=Ta(Ca(zo)),ls.sprite=Ta(Ca($d)),ls.glyphs=Ta(Ca(Xd)),ls.light=Ta(Ca(rc)),ls.terrain=Ta(Ca(Zd)),ls.layer=Ta(Ca(qd)),ls.filter=Ta(Ca(pu)),ls.paintProperty=Ta(Ca(Gd)),ls.layoutProperty=Ta(Ca(jd));const La=ls,Hg=La.light,Ff=La.paintProperty,Hd=La.layoutProperty;function ch(u,o){let c=!1;if(o&&o.length)for(const p of o)u.fire(new pn(new Error(p.message))),c=!0;return c}class du{constructor(o,c,p){const m=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(c=w[1])+2*(p=w[2]);for(let T=0;T=F[H+0]&&m>=F[H+1])?(E[X]=!0,w.push(D[X])):E[X]=!1}}}}_forEachCell(o,c,p,m,v,w,E,T){const k=this._convertToCellCoord(o),D=this._convertToCellCoord(c),F=this._convertToCellCoord(p),j=this._convertToCellCoord(m);for(let X=k;X<=F;X++)for(let H=D;H<=j;H++){const tt=this.d*H+X;if((!T||T(this._convertFromCellCoord(X),this._convertFromCellCoord(H),this._convertFromCellCoord(X+1),this._convertFromCellCoord(H+1)))&&v.call(this,o,c,p,m,tt,w,E,T))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let p=0;for(let w=0;w=0)continue;const w=u[v];m[v]=Ma[p].shallow.indexOf(v)>=0?w:tl(w,o)}u instanceof Error&&(m.message=u.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(m.$name=p),m}throw new Error("can't serialize object of type "+typeof u)}function mu(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||hh(u)||yn(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(mu);if(typeof u=="object"){const o=u.$name||"Object";if(!Ma[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=Ma[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(u);const p=Object.create(c.prototype);for(const m of Object.keys(u)){if(m==="$name")continue;const v=u[m];p[m]=Ma[o].shallow.indexOf(m)>=0?v:mu(v)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Yd{constructor(){this.first=!0}update(o,c){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519};function Bf(u){for(const o of u)if(Uf(o.charCodeAt(0)))return!0;return!1}function Vf(u){for(const o of u)if(!Yg(o.charCodeAt(0)))return!1;return!0}function Yg(u){return!(_e.Arabic(u)||_e["Arabic Supplement"](u)||_e["Arabic Extended-A"](u)||_e["Arabic Presentation Forms-A"](u)||_e["Arabic Presentation Forms-B"](u))}function Uf(u){return!(u!==746&&u!==747&&(u<4352||!(_e["Bopomofo Extended"](u)||_e.Bopomofo(u)||_e["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||_e["CJK Compatibility Ideographs"](u)||_e["CJK Compatibility"](u)||_e["CJK Radicals Supplement"](u)||_e["CJK Strokes"](u)||!(!_e["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||_e["CJK Unified Ideographs Extension A"](u)||_e["CJK Unified Ideographs"](u)||_e["Enclosed CJK Letters and Months"](u)||_e["Hangul Compatibility Jamo"](u)||_e["Hangul Jamo Extended-A"](u)||_e["Hangul Jamo Extended-B"](u)||_e["Hangul Jamo"](u)||_e["Hangul Syllables"](u)||_e.Hiragana(u)||_e["Ideographic Description Characters"](u)||_e.Kanbun(u)||_e["Kangxi Radicals"](u)||_e["Katakana Phonetic Extensions"](u)||_e.Katakana(u)&&u!==12540||!(!_e["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!_e["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||_e["Unified Canadian Aboriginal Syllabics"](u)||_e["Unified Canadian Aboriginal Syllabics Extended"](u)||_e["Vertical Forms"](u)||_e["Yijing Hexagram Symbols"](u)||_e["Yi Syllables"](u)||_e["Yi Radicals"](u))))}function Kd(u){return!(Uf(u)||function(o){return!!(_e["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_e["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||_e["Letterlike Symbols"](o)||_e["Number Forms"](o)||_e["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||_e["Control Pictures"](o)&&o!==9251||_e["Optical Character Recognition"](o)||_e["Enclosed Alphanumerics"](o)||_e["Geometric Shapes"](o)||_e["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_e["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_e["CJK Symbols and Punctuation"](o)||_e.Katakana(o)||_e["Private Use Area"](o)||_e["CJK Compatibility Forms"](o)||_e["Small Form Variants"](o)||_e["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function Jd(u){return u>=1424&&u<=2303||_e["Arabic Presentation Forms-A"](u)||_e["Arabic Presentation Forms-B"](u)}function Qd(u,o){return!(!o&&Jd(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||_e.Khmer(u))}function Kg(u){for(const o of u)if(Jd(o.charCodeAt(0)))return!0;return!1}const Gf="deferred",jf="loading",qf="loaded";let Zf=null,bo="unavailable",el=null;const oc=function(u){u&&typeof u=="string"&&u.indexOf("NetworkError")>-1&&(bo="error"),Zf&&Zf(u)};function $f(){sc.fire(new Wn("pluginStateChange",{pluginStatus:bo,pluginURL:el}))}const sc=new Wi,Wf=function(){return bo},tm=function(){if(bo!==Gf||!el)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");bo=jf,$f(),el&&_t({url:el},u=>{u?oc(u):(bo=qf,$f())})},Fo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>bo===qf||Fo.applyArabicShaping!=null,isLoading:()=>bo===jf,setState(u){if(!oe())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");bo=u.pluginStatus,el=u.pluginURL},isParsed(){if(!oe())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Fo.applyArabicShaping!=null&&Fo.processBidirectionalText!=null&&Fo.processStyledBidirectionalText!=null},getPluginURL(){if(!oe())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return el}};class fi{constructor(o,c){this.zoom=o,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Yd,this.transition={})}isSupportedScript(o){return function(c,p){for(const m of c)if(!Qd(m.charCodeAt(0),p))return!1;return!0}(o,Fo.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class fh{constructor(o,c){this.property=o,this.value=c,this.expression=function(p,m){if(Ii(p))return new Ku(p,m);if(nh(p)){const v=Rf(p,m);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=p;return m.type==="color"&&typeof p=="string"?v=Xn.parse(p):m.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(v=os.parse(p)):v=Do.parse(p),{kind:"constant",evaluate:()=>v}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,p){return this.property.possiblyEvaluate(this,o,c,p)}}class Xf{constructor(o){this.property=o,this.value=new fh(o,void 0)}transitioned(o,c){return new nm(this.property,this.value,c,gt({},o.transition,this.transition),o.now)}untransitioned(){return new nm(this.property,this.value,null,{},0)}}class em{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return xt(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Xf(this._values[o].property)),this._values[o].value=new fh(this._values[o].property,c===null?void 0:xt(c))}getTransition(o){return xt(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Xf(this._values[o].property)),this._values[o].transition=xt(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p);const m=this.getTransition(c);m!==void 0&&(o[`${c}-transition`]=m)}return o}transitioned(o,c){const p=new im(this._properties);for(const m of Object.keys(this._values))p._values[m]=this._values[m].transitioned(o,c._values[m]);return p}untransitioned(){const o=new im(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class nm{constructor(o,c,p,m,v){this.property=o,this.value=c,this.begin=v+m.delay||0,this.end=this.begin+m.duration||0,o.specification.transition&&(m.delay||m.duration)&&(this.prior=p)}possiblyEvaluate(o,c,p){const m=o.now||0,v=this.value.possiblyEvaluate(o,c,p),w=this.prior;if(w){if(m>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(m=1)return 1;const k=T*T,D=k*T;return 4*(T<.5?D:3*(T-k)+D-.75)}(E))}}return v}}class im{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,p){const m=new ph(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,p);return m}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Jg{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return xt(this._values[o].value)}setValue(o,c){this._values[o]=new fh(this._values[o].property,c===null?void 0:xt(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p)}return o}possiblyEvaluate(o,c,p){const m=new ph(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,p);return m}}class so{constructor(o,c,p){this.property=o,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,p,m){return this.property.evaluate(this.value,this.parameters,o,c,p,m)}}class ph{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Re{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,p){const m=Ro[this.specification.type];return m?m(o,c,p):o}}class Ue{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,p,m){return new so(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},p,m)}:o.expression,c)}interpolate(o,c,p){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new so(this,{kind:"constant",value:void 0},o.parameters);const m=Ro[this.specification.type];if(m){const v=m(o.value.value,c.value.value,p);return new so(this,{kind:"constant",value:v},o.parameters)}return o}evaluate(o,c,p,m,v,w){return o.kind==="constant"?o.value:o.evaluate(c,p,m,v,w)}}class ac extends Ue{possiblyEvaluate(o,c,p,m){if(o.value===void 0)return new so(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},p,m),w=o.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,E=this._calculate(w,w,w,c);return new so(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const v=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new so(this,{kind:"constant",value:v},c)}return new so(this,o.expression,c)}evaluate(o,c,p,m,v,w){if(o.kind==="source"){const E=o.evaluate(c,p,m,v,w);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},p,m),o.evaluate({zoom:Math.floor(c.zoom)},p,m),o.evaluate({zoom:Math.floor(c.zoom)+1},p,m),c):o.value}_calculate(o,c,p,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class Hf{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,m){if(o.value!==void 0){if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},p,m);return this._calculate(v,v,v,c)}return this._calculate(o.expression.evaluate(new fi(Math.floor(c.zoom-1),c)),o.expression.evaluate(new fi(Math.floor(c.zoom),c)),o.expression.evaluate(new fi(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,p,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class Yf{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,m){return!!o.expression.evaluate(c,null,{},p,m)}interpolate(){return!1}}class Xi{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const p=o[c];p.specification.overridable&&this.overridableProperties.push(c);const m=this.defaultPropertyValues[c]=new fh(p,void 0),v=this.defaultTransitionablePropertyValues[c]=new Xf(p);this.defaultTransitioningPropertyValues[c]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate({})}}}xe("DataDrivenProperty",Ue),xe("DataConstantProperty",Re),xe("CrossFadedDataDrivenProperty",ac),xe("CrossFadedProperty",Hf),xe("ColorRampProperty",Yf);const Kf="-transition";class us extends Wi{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new Jg(c.layout)),c.paint)){this._transitionablePaint=new em(c.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ph(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,p={}){c!=null&&this._validate(Hd,`layers.${this.id}.layout.${o}`,o,c,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(Kf)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,p={}){if(c!=null&&this._validate(Ff,`layers.${this.id}.paint.${o}`,o,c,p))return!1;if(o.endsWith(Kf))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const m=this._transitionablePaint._values[o],v=m.property.specification["property-type"]==="cross-faded-data-driven",w=m.value.isDataDriven(),E=m.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const T=this._transitionablePaint._values[o].value;return T.isDataDriven()||w||v||this._handleOverridablePaintPropertyUpdate(o,E,T)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={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&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),yt(o,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(o,c,p,m,v={}){return(!v||v.validate!==!1)&&ch(this,o.call(La,{key:c,layerType:this.type,objectKey:p,value:m,styleSpec:$t,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof so&&hu(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const rm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ml{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Di{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_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(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ti(u,o=1){let c=0,p=0;return{members:u.map(m=>{const v=rm[m.type].BYTES_PER_ELEMENT,w=c=gu(c,Math.max(o,v)),E=m.components||1;return p=Math.max(p,v),c+=v*E,{name:m.name,type:m.type,components:E,offset:w}}),size:gu(c,Math.max(p,o)),alignment:o}}function gu(u,o){return Math.ceil(u/o)*o}class lc extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const m=2*o;return this.int16[m+0]=c,this.int16[m+1]=p,o}}lc.prototype.bytesPerElement=4,xe("StructArrayLayout2i4",lc);class uc extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.int16[v+0]=c,this.int16[v+1]=p,this.int16[v+2]=m,o}}uc.prototype.bytesPerElement=6,xe("StructArrayLayout3i6",uc);class Pl extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,p,m)}emplace(o,c,p,m,v){const w=4*o;return this.int16[w+0]=c,this.int16[w+1]=p,this.int16[w+2]=m,this.int16[w+3]=v,o}}Pl.prototype.bytesPerElement=8,xe("StructArrayLayout4i8",Pl);class Jf extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,m,v,w)}emplace(o,c,p,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=p,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}Jf.prototype.bytesPerElement=12,xe("StructArrayLayout2i4i12",Jf);class Qf extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,m,v,w)}emplace(o,c,p,m,v,w,E){const T=4*o,k=8*o;return this.int16[T+0]=c,this.int16[T+1]=p,this.uint8[k+4]=m,this.uint8[k+5]=v,this.uint8[k+6]=w,this.uint8[k+7]=E,o}}Qf.prototype.bytesPerElement=8,xe("StructArrayLayout2i4ub8",Qf);class _u extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const m=2*o;return this.float32[m+0]=c,this.float32[m+1]=p,o}}_u.prototype.bytesPerElement=8,xe("StructArrayLayout2f8",_u);class tp extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w,E,T,k,D){const F=this.length;return this.resize(F+1),this.emplace(F,o,c,p,m,v,w,E,T,k,D)}emplace(o,c,p,m,v,w,E,T,k,D,F){const j=10*o;return this.uint16[j+0]=c,this.uint16[j+1]=p,this.uint16[j+2]=m,this.uint16[j+3]=v,this.uint16[j+4]=w,this.uint16[j+5]=E,this.uint16[j+6]=T,this.uint16[j+7]=k,this.uint16[j+8]=D,this.uint16[j+9]=F,o}}tp.prototype.bytesPerElement=20,xe("StructArrayLayout10ui20",tp);class ep extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w,E,T,k,D,F,j){const X=this.length;return this.resize(X+1),this.emplace(X,o,c,p,m,v,w,E,T,k,D,F,j)}emplace(o,c,p,m,v,w,E,T,k,D,F,j,X){const H=12*o;return this.int16[H+0]=c,this.int16[H+1]=p,this.int16[H+2]=m,this.int16[H+3]=v,this.uint16[H+4]=w,this.uint16[H+5]=E,this.uint16[H+6]=T,this.uint16[H+7]=k,this.int16[H+8]=D,this.int16[H+9]=F,this.int16[H+10]=j,this.int16[H+11]=X,o}}ep.prototype.bytesPerElement=24,xe("StructArrayLayout4i4ui4i24",ep);class Vn extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.float32[v+0]=c,this.float32[v+1]=p,this.float32[v+2]=m,o}}Vn.prototype.bytesPerElement=12,xe("StructArrayLayout3f12",Vn);class y extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}y.prototype.bytesPerElement=4,xe("StructArrayLayout1ul4",y);class s extends Di{_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(o,c,p,m,v,w,E,T,k){const D=this.length;return this.resize(D+1),this.emplace(D,o,c,p,m,v,w,E,T,k)}emplace(o,c,p,m,v,w,E,T,k,D){const F=10*o,j=5*o;return this.int16[F+0]=c,this.int16[F+1]=p,this.int16[F+2]=m,this.int16[F+3]=v,this.int16[F+4]=w,this.int16[F+5]=E,this.uint32[j+3]=T,this.uint16[F+8]=k,this.uint16[F+9]=D,o}}s.prototype.bytesPerElement=20,xe("StructArrayLayout6i1ul2ui20",s);class h extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,m,v,w)}emplace(o,c,p,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=p,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}h.prototype.bytesPerElement=12,xe("StructArrayLayout2i2i2i12",h);class d extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v){const w=this.length;return this.resize(w+1),this.emplace(w,o,c,p,m,v)}emplace(o,c,p,m,v,w){const E=4*o,T=8*o;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=m,this.int16[T+6]=v,this.int16[T+7]=w,o}}d.prototype.bytesPerElement=16,xe("StructArrayLayout2f1f2i16",d);class g extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,p,m)}emplace(o,c,p,m,v){const w=12*o,E=3*o;return this.uint8[w+0]=c,this.uint8[w+1]=p,this.float32[E+1]=m,this.float32[E+2]=v,o}}g.prototype.bytesPerElement=12,xe("StructArrayLayout2ub2f12",g);class b extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.uint16[v+0]=c,this.uint16[v+1]=p,this.uint16[v+2]=m,o}}b.prototype.bytesPerElement=6,xe("StructArrayLayout3ui6",b);class I extends Di{_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(o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt,lt,ft){const kt=this.length;return this.resize(kt+1),this.emplace(kt,o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt,lt,ft)}emplace(o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt,lt,ft,kt){const St=24*o,At=12*o,Ft=48*o;return this.int16[St+0]=c,this.int16[St+1]=p,this.uint16[St+2]=m,this.uint16[St+3]=v,this.uint32[At+2]=w,this.uint32[At+3]=E,this.uint32[At+4]=T,this.uint16[St+10]=k,this.uint16[St+11]=D,this.uint16[St+12]=F,this.float32[At+7]=j,this.float32[At+8]=X,this.uint8[Ft+36]=H,this.uint8[Ft+37]=tt,this.uint8[Ft+38]=lt,this.uint32[At+10]=ft,this.int16[St+22]=kt,o}}I.prototype.bytesPerElement=48,xe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",I);class C extends Di{_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(o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt,lt,ft,kt,St,At,Ft,Jt,ye,Me,ge,de,le,we){const ce=this.length;return this.resize(ce+1),this.emplace(ce,o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt,lt,ft,kt,St,At,Ft,Jt,ye,Me,ge,de,le,we)}emplace(o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt,lt,ft,kt,St,At,Ft,Jt,ye,Me,ge,de,le,we,ce){const ne=32*o,Be=16*o;return this.int16[ne+0]=c,this.int16[ne+1]=p,this.int16[ne+2]=m,this.int16[ne+3]=v,this.int16[ne+4]=w,this.int16[ne+5]=E,this.int16[ne+6]=T,this.int16[ne+7]=k,this.uint16[ne+8]=D,this.uint16[ne+9]=F,this.uint16[ne+10]=j,this.uint16[ne+11]=X,this.uint16[ne+12]=H,this.uint16[ne+13]=tt,this.uint16[ne+14]=lt,this.uint16[ne+15]=ft,this.uint16[ne+16]=kt,this.uint16[ne+17]=St,this.uint16[ne+18]=At,this.uint16[ne+19]=Ft,this.uint16[ne+20]=Jt,this.uint16[ne+21]=ye,this.uint16[ne+22]=Me,this.uint32[Be+12]=ge,this.float32[Be+13]=de,this.float32[Be+14]=le,this.uint16[ne+30]=we,this.uint16[ne+31]=ce,o}}C.prototype.bytesPerElement=64,xe("StructArrayLayout8i15ui1ul2f2ui64",C);class M extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}M.prototype.bytesPerElement=4,xe("StructArrayLayout1f4",M);class N extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=3*o;return this.uint16[6*o+0]=c,this.float32[v+1]=p,this.float32[v+2]=m,o}}N.prototype.bytesPerElement=12,xe("StructArrayLayout1ui2f12",N);class R extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,p)}emplace(o,c,p,m){const v=4*o;return this.uint32[2*o+0]=c,this.uint16[v+2]=p,this.uint16[v+3]=m,o}}R.prototype.bytesPerElement=8,xe("StructArrayLayout1ul2ui8",R);class z extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const m=2*o;return this.uint16[m+0]=c,this.uint16[m+1]=p,o}}z.prototype.bytesPerElement=4,xe("StructArrayLayout2ui4",z);class W extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}W.prototype.bytesPerElement=2,xe("StructArrayLayout1ui2",W);class it extends Di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,p,m)}emplace(o,c,p,m,v){const w=4*o;return this.float32[w+0]=c,this.float32[w+1]=p,this.float32[w+2]=m,this.float32[w+3]=v,o}}it.prototype.bytesPerElement=16,xe("StructArrayLayout4f16",it);class et extends Ml{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 A(this.anchorPointX,this.anchorPointY)}}et.prototype.size=20;class at extends s{get(o){return new et(this,o)}}xe("CollisionBoxArray",at);class Q extends Ml{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(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Q.prototype.size=48;class Lt extends I{get(o){return new Q(this,o)}}xe("PlacedSymbolArray",Lt);class Ot extends Ml{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(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ot.prototype.size=64;class ct extends C{get(o){return new Ot(this,o)}}xe("SymbolInstanceArray",ct);class Pt extends M{getoffsetX(o){return this.float32[1*o+0]}}xe("GlyphOffsetArray",Pt);class Bt extends uc{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}xe("SymbolLineVertexArray",Bt);class Vt extends Ml{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Vt.prototype.size=12;class Yt extends N{get(o){return new Vt(this,o)}}xe("TextAnchorOffsetArray",Yt);class ee extends Ml{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]}}ee.prototype.size=8;class te extends R{get(o){return new ee(this,o)}}xe("FeatureIndexArray",te);class se extends lc{}class Le extends lc{}class vn extends lc{}class pe extends Jf{}class Ge extends Qf{}class Pe extends _u{}class Hn extends tp{}class _n extends ep{}class un extends Vn{}class bn extends y{}class Vi extends h{}class si extends g{}class Rr extends b{}class pr extends z{}const Hi=Ti([{name:"a_pos",components:2,type:"Int16"}],4),{members:Bo}=Hi;class pi{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,m){let v=this.segments[this.segments.length-1];return o>pi.MAX_VERTEX_ARRAY_LENGTH&&Nt(`Max vertices per segment is ${pi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>pi.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==m)&&(v={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},m!==void 0&&(v.sortKey=m),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,p,m){return new pi([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:m,vaos:{},sortKey:0}])}}function Zs(u,o){return 256*(u=ht(Math.floor(u),0,255))+ht(Math.floor(o),0,255)}pi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,xe("SegmentVector",pi);const $s=Ti([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var nl={exports:{}},kl={exports:{}};kl.exports=function(u,o){var c,p,m,v,w,E,T,k;for(p=u.length-(c=3&u.length),m=o,w=3432918353,E=461845907,k=0;k>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(T=0,c){case 3:T^=(255&u.charCodeAt(k+2))<<16;case 2:T^=(255&u.charCodeAt(k+1))<<8;case 1:m^=T=(65535&(T=(T=(65535&(T^=255&u.charCodeAt(k)))*w+(((T>>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295}return m^=u.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var yu=kl.exports,$r={exports:{}};$r.exports=function(u,o){for(var c,p=u.length,m=o^p,v=0;p>=4;)c=1540483477*(65535&(c=255&u.charCodeAt(v)|(255&u.charCodeAt(++v))<<8|(255&u.charCodeAt(++v))<<16|(255&u.charCodeAt(++v))<<24))+((1540483477*(c>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++v;switch(p){case 3:m^=(255&u.charCodeAt(v+2))<<16;case 2:m^=(255&u.charCodeAt(v+1))<<8;case 1:m=1540483477*(65535&(m^=255&u.charCodeAt(v)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var Or=yu,ao=$r.exports;nl.exports=Or,nl.exports.murmur3=Or,nl.exports.murmur2=ao;var Al=x(nl.exports);class Ui{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,p,m){this.ids.push(dr(o)),this.positions.push(c,p,m)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=dr(o);let p=0,m=this.ids.length-1;for(;p>1;this.ids[w]>=c?m=w:p=w+1}const v=[];for(;this.ids[p]===c;)v.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return v}static serialize(o,c){const p=new Float64Array(o.ids),m=new Uint32Array(o.positions);return xo(p,m,0,p.length-1),c&&c.push(p.buffer,m.buffer),{ids:p,positions:m}}static deserialize(o){const c=new Ui;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function dr(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Al(String(u))}function xo(u,o,c,p){for(;c>1];let v=c-1,w=p+1;for(;;){do v++;while(u[v]m);if(v>=w)break;Gi(u,v,w),Gi(o,3*v,3*w),Gi(o,3*v+1,3*w+1),Gi(o,3*v+2,3*w+2)}w-c`u_${m}`),this.type=p}setUniform(o,c,p){o.set(p.constantOr(this.value))}getBinding(o,c,p){return this.type==="color"?new sm(o,c):new dh(o,c)}}class Dl{constructor(o,c){this.uniformNames=c.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,p,m){const v=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&o.set(v)}getBinding(o,c,p){return p.substr(0,9)==="u_pattern"?new om(o,c):new dh(o,c)}}class Xs{constructor(o,c,p,m){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(v=>({name:`a_${v}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(o,c,p,m,v){const w=this.paintVertexArray.length,E=this.expression.evaluate(new fi(0),c,{},m,[],v);this.paintVertexArray.resize(o),this._setPaintValue(w,o,E)}updatePaintArray(o,c,p,m){const v=this.expression.evaluate({zoom:0},p,m);this._setPaintValue(o,c,v)}_setPaintValue(o,c,p){if(this.type==="color"){const m=np(p);for(let v=o;v`u_${E}_t`),this.type=p,this.useIntegerZoom=m,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,c,p,m,v){const w=this.expression.evaluate(new fi(this.zoom),c,{},m,[],v),E=this.expression.evaluate(new fi(this.zoom+1),c,{},m,[],v),T=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(T,o,w,E)}updatePaintArray(o,c,p,m){const v=this.expression.evaluate({zoom:this.zoom},p,m),w=this.expression.evaluate({zoom:this.zoom+1},p,m);this._setPaintValue(o,c,v,w)}_setPaintValue(o,c,p,m){if(this.type==="color"){const v=np(p),w=np(m);for(let E=o;E`#define HAS_UNIFORM_${m}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof Xs||p instanceof cs)for(let m=0;m!0){this.programConfigurations={};for(const m of o)this.programConfigurations[m.id]=new ip(m,c,p);this.needsUpload=!1,this._featureMap=new Ui,this._bufferOffset=0}populatePaintArrays(o,c,p,m,v,w){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,m,v,w);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,p,m){for(const v of p)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(o,this._featureMap,c,v,m)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function Aw(u,o){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"]}[u]||[u.replace(`${o}-`,"").replace(/-/g,"_")]}function o0(u,o,c){const p={color:{source:_u,composite:it},number:{source:M,composite:_u}},m=function(v){return{"line-pattern":{source:Hn,composite:Hn},"fill-pattern":{source:Hn,composite:Hn},"fill-extrusion-pattern":{source:Hn,composite:Hn}}[v]}(u);return m&&m[c]||p[o][c]}xe("ConstantBinder",Ws),xe("CrossFadedConstantBinder",Dl),xe("SourceExpressionBinder",Xs),xe("CrossFadedCompositeBinder",Hs),xe("CompositeExpressionBinder",cs),xe("ProgramConfiguration",ip,{omit:["_buffers"]}),xe("ProgramConfigurationSet",Pa);const rr=8192,t_=Math.pow(2,14)-1,s0=-t_-1;function cc(u){const o=rr/u.extent,c=u.loadGeometry();for(let p=0;pw.x+1||Tw.y+1)&&Nt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function hc(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?cc(u):[]}}function am(u,o,c,p,m){u.emplaceBack(2*o+(p+1)/2,2*c+(m+1)/2)}class e_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Le,this.indexArray=new Rr,this.segments=new pi,this.programConfigurations=new Pa(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){const m=this.layers[0],v=[];let w=null,E=!1;m.type==="circle"&&(w=m.layout.get("circle-sort-key"),E=!w.isConstant());for(const{feature:T,id:k,index:D,sourceLayerIndex:F}of o){const j=this.layers[0]._featureFilter.needGeometry,X=hc(T,j);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),X,p))continue;const H=E?w.evaluate(X,{},p):void 0,tt={id:k,properties:T.properties,type:T.type,sourceLayerIndex:F,index:D,geometry:j?X.geometry:cc(T),patterns:{},sortKey:H};v.push(tt)}E&&v.sort((T,k)=>T.sortKey-k.sortKey);for(const T of v){const{geometry:k,index:D,sourceLayerIndex:F}=T,j=o[D].feature;this.addFeature(T,k,D,p),c.featureIndex.insert(j,k,D,F,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Bo),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,p,m){for(const v of c)for(const w of v){const E=w.x,T=w.y;if(E<0||E>=rr||T<0||T>=rr)continue;const k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),D=k.vertexLength;am(this.layoutVertexArray,E,T,-1,-1),am(this.layoutVertexArray,E,T,1,-1),am(this.layoutVertexArray,E,T,1,1),am(this.layoutVertexArray,E,T,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),k.vertexLength+=4,k.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},m)}}function a0(u,o){for(let c=0;c1){if(n_(u,o))return!0;for(let p=0;p1?c:c.sub(o)._mult(m)._add(o))}function c0(u,o){let c,p,m,v=!1;for(let w=0;wo.y!=m.y>o.y&&o.x<(m.x-p.x)*(o.y-p.y)/(m.y-p.y)+p.x&&(v=!v)}return v}function mh(u,o){let c=!1;for(let p=0,m=u.length-1;po.y!=w.y>o.y&&o.x<(w.x-v.x)*(o.y-v.y)/(w.y-v.y)+v.x&&(c=!c)}return c}function Ow(u,o,c){const p=c[0],m=c[2];if(u.xm.x&&o.x>m.x||u.ym.y&&o.y>m.y)return!1;const v=Gt(u,o,c[0]);return v!==Gt(u,o,c[1])||v!==Gt(u,o,c[2])||v!==Gt(u,o,c[3])}function rp(u,o,c){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:c.programConfigurations.get(o.id).getMaxValue(u)}function lm(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function um(u,o,c,p,m){if(!o[0]&&!o[1])return u;const v=A.convert(o)._mult(m);c==="viewport"&&v._rotate(-p);const w=[];for(let E=0;Ed0(lt,tt))}(k,T),X=F?D*E:D;for(const H of m)for(const tt of H){const lt=F?tt:d0(tt,T);let ft=X;const kt=cm([],[tt.x,tt.y,0,1],T);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ft*=kt[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ft*=w.cameraToCenterDistance/kt[3]),Nw(j,lt,ft))return!0}return!1}}function d0(u,o){const c=cm([],[u.x,u.y,0,1],o);return new A(c[0]/c[3],c[1]/c[3])}class m0 extends e_{}let g0;xe("HeatmapBucket",m0,{omit:["layers"]});var Vw={get paint(){return g0=g0||new Xi({"heatmap-radius":new Ue($t.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ue($t.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Re($t.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yf($t.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Re($t.paint_heatmap["heatmap-opacity"])})}};function o_(u,{width:o,height:c},p,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==o*c*p)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${o*c*p}`)}else m=new Uint8Array(o*c*p);return u.width=o,u.height=c,u.data=m,u}function _0(u,{width:o,height:c},p){if(o===u.width&&c===u.height)return;const m=o_({},{width:o,height:c},p);s_(u,m,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,c)},p),u.width=o,u.height=c,u.data=m.data}function s_(u,o,c,p,m,v){if(m.width===0||m.height===0)return o;if(m.width>u.width||m.height>u.height||c.x>u.width-m.width||c.y>u.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>o.width||m.height>o.height||p.x>o.width-m.width||p.y>o.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const w=u.data,E=o.data;if(w===E)throw new Error("srcData equals dstData, so image is already copied");for(let T=0;T{o[u.evaluationKey]=T;const k=u.expression.evaluate(o);m.data[w+E+0]=Math.floor(255*k.r/k.a),m.data[w+E+1]=Math.floor(255*k.g/k.a),m.data[w+E+2]=Math.floor(255*k.b/k.a),m.data[w+E+3]=Math.floor(255*k.a)};if(u.clips)for(let w=0,E=0;w80*c){p=v=u[0],m=w=u[1];for(var H=c;Hv&&(v=E),T>w&&(w=T);k=(k=Math.max(v-p,w-m))!==0?32767/k:0}return ap(j,X,c,p,m,k,0),X}function b0(u,o,c,p,m){var v,w;if(m===c_(u,o,c,p)>0)for(v=o;v=o;v-=p)w=S0(v,u[v],u[v+1],w);return w&&fm(w,w.next)&&(up(w),w=w.next),w}function fc(u,o){if(!u)return u;o||(o=u);var c,p=u;do if(c=!1,p.steiner||!fm(p,p.next)&&Yi(p.prev,p,p.next)!==0)p=p.next;else{if(up(p),(p=o=p.prev)===p.next)break;c=!0}while(c||p!==o);return o}function ap(u,o,c,p,m,v,w){if(u){!w&&v&&function(D,F,j,X){var H=D;do H.z===0&&(H.z=l_(H.x,H.y,F,j,X)),H.prevZ=H.prev,H.nextZ=H.next,H=H.next;while(H!==D);H.prevZ.nextZ=null,H.prevZ=null,function(tt){var lt,ft,kt,St,At,Ft,Jt,ye,Me=1;do{for(ft=tt,tt=null,At=null,Ft=0;ft;){for(Ft++,kt=ft,Jt=0,lt=0;lt0||ye>0&&kt;)Jt!==0&&(ye===0||!kt||ft.z<=kt.z)?(St=ft,ft=ft.nextZ,Jt--):(St=kt,kt=kt.nextZ,ye--),At?At.nextZ=St:tt=St,St.prevZ=At,At=St;ft=kt}At.nextZ=null,Me*=2}while(Ft>1)}(H)}(u,p,m,v);for(var E,T,k=u;u.prev!==u.next;)if(E=u.prev,T=u.next,v?Ww(u,p,m,v):$w(u))o.push(E.i/c|0),o.push(u.i/c|0),o.push(T.i/c|0),up(u),u=T.next,k=T.next;else if((u=T)===k){w?w===1?ap(u=Xw(fc(u),o,c),o,c,p,m,v,2):w===2&&Hw(u,o,c,p,m,v):ap(fc(u),o,c,p,m,v,1);break}}}function $w(u){var o=u.prev,c=u,p=u.next;if(Yi(o,c,p)>=0)return!1;for(var m=o.x,v=c.x,w=p.x,E=o.y,T=c.y,k=p.y,D=mv?m>w?m:w:v>w?v:w,X=E>T?E>k?E:k:T>k?T:k,H=p.next;H!==o;){if(H.x>=D&&H.x<=j&&H.y>=F&&H.y<=X&&_h(m,E,v,T,w,k,H.x,H.y)&&Yi(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function Ww(u,o,c,p){var m=u.prev,v=u,w=u.next;if(Yi(m,v,w)>=0)return!1;for(var E=m.x,T=v.x,k=w.x,D=m.y,F=v.y,j=w.y,X=ET?E>k?E:k:T>k?T:k,lt=D>F?D>j?D:j:F>j?F:j,ft=l_(X,H,o,c,p),kt=l_(tt,lt,o,c,p),St=u.prevZ,At=u.nextZ;St&&St.z>=ft&&At&&At.z<=kt;){if(St.x>=X&&St.x<=tt&&St.y>=H&&St.y<=lt&&St!==m&&St!==w&&_h(E,D,T,F,k,j,St.x,St.y)&&Yi(St.prev,St,St.next)>=0||(St=St.prevZ,At.x>=X&&At.x<=tt&&At.y>=H&&At.y<=lt&&At!==m&&At!==w&&_h(E,D,T,F,k,j,At.x,At.y)&&Yi(At.prev,At,At.next)>=0))return!1;At=At.nextZ}for(;St&&St.z>=ft;){if(St.x>=X&&St.x<=tt&&St.y>=H&&St.y<=lt&&St!==m&&St!==w&&_h(E,D,T,F,k,j,St.x,St.y)&&Yi(St.prev,St,St.next)>=0)return!1;St=St.prevZ}for(;At&&At.z<=kt;){if(At.x>=X&&At.x<=tt&&At.y>=H&&At.y<=lt&&At!==m&&At!==w&&_h(E,D,T,F,k,j,At.x,At.y)&&Yi(At.prev,At,At.next)>=0)return!1;At=At.nextZ}return!0}function Xw(u,o,c){var p=u;do{var m=p.prev,v=p.next.next;!fm(m,v)&&x0(m,p,p.next,v)&&lp(m,v)&&lp(v,m)&&(o.push(m.i/c|0),o.push(p.i/c|0),o.push(v.i/c|0),up(p),up(p.next),p=u=v),p=p.next}while(p!==u);return fc(p)}function Hw(u,o,c,p,m,v){var w=u;do{for(var E=w.next.next;E!==w.prev;){if(w.i!==E.i&&t2(w,E)){var T=w0(w,E);return w=fc(w,w.next),T=fc(T,T.next),ap(w,o,c,p,m,v,0),void ap(T,o,c,p,m,v,0)}E=E.next}w=w.next}while(w!==u)}function Yw(u,o){return u.x-o.x}function Kw(u,o){var c=function(m,v){var w,E=v,T=m.x,k=m.y,D=-1/0;do{if(k<=E.y&&k>=E.next.y&&E.next.y!==E.y){var F=E.x+(k-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(F<=T&&F>D&&(D=F,w=E.x=E.x&&E.x>=H&&T!==E.x&&_h(kw.x||E.x===w.x&&Jw(w,E)))&&(w=E,lt=j)),E=E.next;while(E!==X);return w}(u,o);if(!c)return o;var p=w0(c,u);return fc(p,p.next),fc(c,c.next)}function Jw(u,o){return Yi(u.prev,u,o.prev)<0&&Yi(o.next,u,u.next)<0}function l_(u,o,c,p,m){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-c)*m|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*m|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function Qw(u){var o=u,c=u;do(o.x=(u-w)*(v-E)&&(u-w)*(p-E)>=(c-w)*(o-E)&&(c-w)*(v-E)>=(m-w)*(p-E)}function t2(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(c,p){var m=c;do{if(m.i!==c.i&&m.next.i!==c.i&&m.i!==p.i&&m.next.i!==p.i&&x0(m,m.next,c,p))return!0;m=m.next}while(m!==c);return!1}(u,o)&&(lp(u,o)&&lp(o,u)&&function(c,p){var m=c,v=!1,w=(c.x+p.x)/2,E=(c.y+p.y)/2;do m.y>E!=m.next.y>E&&m.next.y!==m.y&&w<(m.next.x-m.x)*(E-m.y)/(m.next.y-m.y)+m.x&&(v=!v),m=m.next;while(m!==c);return v}(u,o)&&(Yi(u.prev,u,o.prev)||Yi(u,o.prev,o))||fm(u,o)&&Yi(u.prev,u,u.next)>0&&Yi(o.prev,o,o.next)>0)}function Yi(u,o,c){return(o.y-u.y)*(c.x-o.x)-(o.x-u.x)*(c.y-o.y)}function fm(u,o){return u.x===o.x&&u.y===o.y}function x0(u,o,c,p){var m=dm(Yi(u,o,c)),v=dm(Yi(u,o,p)),w=dm(Yi(c,p,u)),E=dm(Yi(c,p,o));return m!==v&&w!==E||!(m!==0||!pm(u,c,o))||!(v!==0||!pm(u,p,o))||!(w!==0||!pm(c,u,p))||!(E!==0||!pm(c,o,p))}function pm(u,o,c){return o.x<=Math.max(u.x,c.x)&&o.x>=Math.min(u.x,c.x)&&o.y<=Math.max(u.y,c.y)&&o.y>=Math.min(u.y,c.y)}function dm(u){return u>0?1:u<0?-1:0}function lp(u,o){return Yi(u.prev,u,u.next)<0?Yi(u,o,u.next)>=0&&Yi(u,u.prev,o)>=0:Yi(u,o,u.prev)<0||Yi(u,u.next,o)<0}function w0(u,o){var c=new u_(u.i,u.x,u.y),p=new u_(o.i,o.x,o.y),m=u.next,v=o.prev;return u.next=o,o.prev=u,c.next=m,m.prev=c,p.next=c,c.prev=p,v.next=p,p.prev=v,p}function S0(u,o,c,p){var m=new u_(u,o,c);return p?(m.next=p.next,m.prev=p,p.next.prev=m,p.next=m):(m.prev=m,m.next=m),m}function up(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function u_(u,o,c){this.i=u,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function c_(u,o,c,p){for(var m=0,v=o,w=c-p;v0&&c.holes.push(p+=u[m-1].length)}return c};var E0=x(a_.exports);function e2(u,o,c,p,m){I0(u,o,c||0,p||u.length-1,m||n2)}function I0(u,o,c,p,m){for(;p>c;){if(p-c>600){var v=p-c+1,w=o-c+1,E=Math.log(v),T=.5*Math.exp(2*E/3),k=.5*Math.sqrt(E*T*(v-T)/v)*(w-v/2<0?-1:1);I0(u,o,Math.max(c,Math.floor(o-w*T/v+k)),Math.min(p,Math.floor(o+(v-w)*T/v+k)),m)}var D=u[o],F=c,j=p;for(cp(u,c,o),m(u[p],D)>0&&cp(u,c,p);F0;)j--}m(u[c],D)===0?cp(u,c,j):cp(u,++j,p),j<=o&&(c=j+1),o<=j&&(p=j-1)}}function cp(u,o,c){var p=u[o];u[o]=u[c],u[c]=p}function n2(u,o){return uo?1:0}function h_(u,o){const c=u.length;if(c<=1)return[u];const p=[];let m,v;for(let w=0;w1)for(let w=0;wc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new vn,this.indexArray=new Rr,this.indexArray2=new pr,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new pi,this.segments2=new pi,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=f_("fill",this.layers,c);const m=this.layers[0].layout.get("fill-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:k,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,j=hc(E,F);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),j,p))continue;const X=v?m.evaluate(j,{},p,c.availableImages):void 0,H={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:k,geometry:F?j.geometry:cc(E),patterns:{},sortKey:X};w.push(H)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:k,sourceLayerIndex:D}=E;if(this.hasPattern){const F=p_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,k,p,{});c.featureIndex.insert(o[k].feature,T,k,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Zw),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),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(o,c,p,m,v){for(const w of h_(c,500)){let E=0;for(const X of w)E+=X.length;const T=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),k=T.vertexLength,D=[],F=[];for(const X of w){if(X.length===0)continue;X!==w[0]&&F.push(D.length/2);const H=this.segments2.prepareSegment(X.length,this.layoutVertexArray,this.indexArray2),tt=H.vertexLength;this.layoutVertexArray.emplaceBack(X[0].x,X[0].y),this.indexArray2.emplaceBack(tt+X.length-1,tt),D.push(X[0].x),D.push(X[0].y);for(let lt=1;lt>3}if(m--,p===1||p===2)v+=u.readSVarint(),w+=u.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new u2(v,w));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},yh.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,c=1,p=0,m=0,v=0,w=1/0,E=-1/0,T=1/0,k=-1/0;u.pos>3}if(p--,c===1||c===2)(m+=u.readSVarint())E&&(E=m),(v+=u.readSVarint())k&&(k=v);else if(c!==7)throw new Error("unknown command "+c)}return[w,T,E,k]},yh.prototype.toGeoJSON=function(u,o,c){var p,m,v=this.extent*Math.pow(2,c),w=this.extent*u,E=this.extent*o,T=this.loadGeometry(),k=yh.types[this.type];function D(X){for(var H=0;H>3;m=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return m}(c))}P0.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var o=this._pbf.readVarint()+this._pbf.pos;return new f2(this._pbf,o,this.extent,this._keys,this._values)};var d2=M0;function m2(u,o,c){if(u===3){var p=new d2(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}vu.VectorTile=function(u,o){this.layers=u.readFields(m2,{},o)},vu.VectorTileFeature=L0,vu.VectorTileLayer=M0;const g2=vu.VectorTileFeature.types,m_=Math.pow(2,13);function hp(u,o,c,p,m,v,w,E){u.emplaceBack(o,c,2*Math.floor(p*m_)+w,m*m_*2,v*m_*2,Math.round(E))}class g_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new pe,this.centroidVertexArray=new se,this.indexArray=new Rr,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new pi,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.features=[],this.hasPattern=f_("fill-extrusion",this.layers,c);for(const{feature:m,id:v,index:w,sourceLayerIndex:E}of o){const T=this.layers[0]._featureFilter.needGeometry,k=hc(m,T);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),k,p))continue;const D={id:v,sourceLayerIndex:E,index:w,geometry:T?k.geometry:cc(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(p_("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,w,p,{}),c.featureIndex.insert(m,D.geometry,w,E,this.index,!0)}}addFeatures(o,c,p){for(const m of this.features){const{geometry:v}=m;this.addFeature(m,v,m.index,c,p)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,l2),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,a2.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,p,m,v){const w={x:0,y:0,vertexCount:0};for(const E of h_(c,500)){let T=0;for(const H of E)T+=H.length;let k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const H of E){if(H.length===0||y2(H))continue;let tt=0;for(let lt=0;lt=1){const kt=H[lt-1];if(!_2(ft,kt)){k.vertexLength+4>pi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const St=ft.sub(kt)._perp()._unit(),At=kt.dist(ft);tt+At>32768&&(tt=0),hp(this.layoutVertexArray,ft.x,ft.y,St.x,St.y,0,0,tt),hp(this.layoutVertexArray,ft.x,ft.y,St.x,St.y,0,1,tt),w.x+=2*ft.x,w.y+=2*ft.y,w.vertexCount+=2,tt+=At,hp(this.layoutVertexArray,kt.x,kt.y,St.x,St.y,0,0,tt),hp(this.layoutVertexArray,kt.x,kt.y,St.x,St.y,0,1,tt),w.x+=2*kt.x,w.y+=2*kt.y,w.vertexCount+=2;const Ft=k.vertexLength;this.indexArray.emplaceBack(Ft,Ft+2,Ft+1),this.indexArray.emplaceBack(Ft+1,Ft+2,Ft+3),k.vertexLength+=4,k.primitiveLength+=2}}}}if(k.vertexLength+T>pi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),g2[o.type]!=="Polygon")continue;const D=[],F=[],j=k.vertexLength;for(const H of E)if(H.length!==0){H!==E[0]&&F.push(D.length/2);for(let tt=0;ttrr)||u.y===o.y&&(u.y<0||u.y>rr)}function y2(u){return u.every(o=>o.x<0)||u.every(o=>o.x>rr)||u.every(o=>o.y<0)||u.every(o=>o.y>rr)}let k0;xe("FillExtrusionBucket",g_,{omit:["layers","features"]});var v2={get paint(){return k0=k0||new Xi({"fill-extrusion-opacity":new Re($t["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ue($t["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Re($t["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Re($t["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ac($t["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ue($t["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ue($t["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Re($t["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class b2 extends us{constructor(o){super(o,v2)}createBucket(o){return new g_(o)}queryRadius(){return lm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,p,m,v,w,E,T){const k=um(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,p),F=this.paint.get("fill-extrusion-base").evaluate(c,p),j=function(H,tt,lt,ft){const kt=[];for(const St of H){const At=[St.x,St.y,0,1];cm(At,At,tt),kt.push(new A(At[0]/At[3],At[1]/At[3]))}return kt}(k,T),X=function(H,tt,lt,ft){const kt=[],St=[],At=ft[8]*tt,Ft=ft[9]*tt,Jt=ft[10]*tt,ye=ft[11]*tt,Me=ft[8]*lt,ge=ft[9]*lt,de=ft[10]*lt,le=ft[11]*lt;for(const we of H){const ce=[],ne=[];for(const Be of we){const Ae=Be.x,dn=Be.y,di=ft[0]*Ae+ft[4]*dn+ft[12],vi=ft[1]*Ae+ft[5]*dn+ft[13],gr=ft[2]*Ae+ft[6]*dn+ft[14],hs=ft[3]*Ae+ft[7]*dn+ft[15],So=gr+Jt,or=hs+ye,zr=di+Me,Xr=vi+ge,Eo=gr+de,Io=hs+le,_r=new A((di+At)/or,(vi+Ft)/or);_r.z=So/or,ce.push(_r);const yr=new A(zr/Io,Xr/Io);yr.z=Eo/Io,ne.push(yr)}kt.push(ce),St.push(ne)}return[kt,St]}(m,F,D,T);return function(H,tt,lt){let ft=1/0;l0(lt,tt)&&(ft=A0(lt,tt[0]));for(let kt=0;ktc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new Ge,this.layoutVertexArray2=new Pe,this.indexArray=new Rr,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new pi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=f_("line",this.layers,c);const m=this.layers[0].layout.get("line-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:k,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,j=hc(E,F);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),j,p))continue;const X=v?m.evaluate(j,{},p):void 0,H={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:k,geometry:F?j.geometry:cc(E),patterns:{},sortKey:X};w.push(H)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:k,sourceLayerIndex:D}=E;if(this.hasPattern){const F=p_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,k,p,{});c.featureIndex.insert(o[k].feature,T,k,D,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,E2)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,w2),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,p,m,v){const w=this.layers[0].layout,E=w.get("line-join").evaluate(o,{}),T=w.get("line-cap"),k=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const F of c)this.addLine(F,o,E,T,k,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,m)}addLine(o,c,p,m,v,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ft=0;ft=2&&o[T-1].equals(o[T-2]);)T--;let k=0;for(;k0;if(ye&&ft>k){const le=j.dist(X);if(le>2*D){const we=j.sub(j.sub(X)._mult(D/le)._round());this.updateDistance(X,we),this.addCurrentVertex(we,tt,0,0,F),X=we}}const ge=X&&H;let de=ge?p:E?"butt":m;if(ge&&de==="round"&&(Ftv&&(de="bevel"),de==="bevel"&&(Ft>2&&(de="flipbevel"),Ft100)kt=lt.mult(-1);else{const le=Ft*tt.add(lt).mag()/tt.sub(lt).mag();kt._perp()._mult(le*(Me?-1:1))}this.addCurrentVertex(j,kt,0,0,F),this.addCurrentVertex(j,kt.mult(-1),0,0,F)}else if(de==="bevel"||de==="fakeround"){const le=-Math.sqrt(Ft*Ft-1),we=Me?le:0,ce=Me?0:le;if(X&&this.addCurrentVertex(j,tt,we,ce,F),de==="fakeround"){const ne=Math.round(180*Jt/Math.PI/20);for(let Be=1;Be2*D){const we=j.add(H.sub(j)._mult(D/le)._round());this.updateDistance(j,we),this.addCurrentVertex(we,lt,0,0,F),j=we}}}}addCurrentVertex(o,c,p,m,v,w=!1){const E=c.y*m-c.x,T=-c.y-c.x*m;this.addHalfVertex(o,c.x+c.y*p,c.y-c.x*p,w,!1,p,v),this.addHalfVertex(o,E,T,w,!0,-m,v),this.distance>N0/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,p,m,v,w))}addHalfVertex({x:o,y:c},p,m,v,w,E,T){const k=.5*(this.lineClips?this.scaledDistance*(N0-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(v?1:0),(c<<1)+(w?1:0),Math.round(63*p)+128,Math.round(63*m)+128,1+(E===0?0:E<0?-1:1)|(63&k)<<2,k>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=T.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),T.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let D0,R0;xe("LineBucket",__,{omit:["layers","patternFeatures"]});var O0={get paint(){return R0=R0||new Xi({"line-opacity":new Ue($t.paint_line["line-opacity"]),"line-color":new Ue($t.paint_line["line-color"]),"line-translate":new Re($t.paint_line["line-translate"]),"line-translate-anchor":new Re($t.paint_line["line-translate-anchor"]),"line-width":new Ue($t.paint_line["line-width"]),"line-gap-width":new Ue($t.paint_line["line-gap-width"]),"line-offset":new Ue($t.paint_line["line-offset"]),"line-blur":new Ue($t.paint_line["line-blur"]),"line-dasharray":new Hf($t.paint_line["line-dasharray"]),"line-pattern":new ac($t.paint_line["line-pattern"]),"line-gradient":new Yf($t.paint_line["line-gradient"])})},get layout(){return D0=D0||new Xi({"line-cap":new Re($t.layout_line["line-cap"]),"line-join":new Ue($t.layout_line["line-join"]),"line-miter-limit":new Re($t.layout_line["line-miter-limit"]),"line-round-limit":new Re($t.layout_line["line-round-limit"]),"line-sort-key":new Ue($t.layout_line["line-sort-key"])})}};class T2 extends Ue{possiblyEvaluate(o,c){return c=new fi(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,p,m){return c=gt({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,p,m)}}let mm;class L2 extends us{constructor(o){super(o,O0),this.gradientVersion=0,mm||(mm=new T2(O0.paint.properties["line-width"].specification),mm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Ja,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=mm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new __(o)}queryRadius(o){const c=o,p=z0(rp("line-width",this,c),rp("line-gap-width",this,c)),m=rp("line-offset",this,c);return p/2+Math.abs(m)+lm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,p,m,v,w,E){const T=um(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,E),k=E/2*z0(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),D=this.paint.get("line-offset").evaluate(c,p);return D&&(m=function(F,j){const X=[];for(let H=0;H=3){for(let lt=0;lt0?o+2*u:u}const M2=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),P2=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const k2=Ti([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ti([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const F0=Ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),A2=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function N2(u,o,c){return u.sections.forEach(p=>{p.text=function(m,v,w){const E=v.layout.get("text-transform").evaluate(w,{});return E==="uppercase"?m=m.toLocaleUpperCase():E==="lowercase"&&(m=m.toLocaleLowerCase()),Fo.applyArabicShaping&&(m=Fo.applyArabicShaping(m)),m}(p.text,o,c)}),u}Ti([{name:"triangle",components:3,type:"Uint16"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ti([{type:"Float32",name:"offsetX"}]),Ti([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ti([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const pp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var mr=24,B0=Qn,V0=function(u,o,c,p,m){var v,w,E=8*m-p-1,T=(1<>1,D=-7,F=c?m-1:0,j=c?-1:1,X=u[o+F];for(F+=j,v=X&(1<<-D)-1,X>>=-D,D+=E;D>0;v=256*v+u[o+F],F+=j,D-=8);for(w=v&(1<<-D)-1,v>>=-D,D+=p;D>0;w=256*w+u[o+F],F+=j,D-=8);if(v===0)v=1-k;else{if(v===T)return w?NaN:1/0*(X?-1:1);w+=Math.pow(2,p),v-=k}return(X?-1:1)*w*Math.pow(2,v-p)},U0=function(u,o,c,p,m,v){var w,E,T,k=8*v-m-1,D=(1<>1,j=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,X=p?0:v-1,H=p?1:-1,tt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,w=D):(w=Math.floor(Math.log(o)/Math.LN2),o*(T=Math.pow(2,-w))<1&&(w--,T*=2),(o+=w+F>=1?j/T:j*Math.pow(2,1-F))*T>=2&&(w++,T/=2),w+F>=D?(E=0,w=D):w+F>=1?(E=(o*T-1)*Math.pow(2,m),w+=F):(E=o*Math.pow(2,F-1)*Math.pow(2,m),w=0));m>=8;u[c+X]=255&E,X+=H,E/=256,m-=8);for(w=w<0;u[c+X]=255&w,X+=H,w/=256,k-=8);u[c+X-H]|=128*tt};function Qn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}Qn.Varint=0,Qn.Fixed64=1,Qn.Bytes=2,Qn.Fixed32=5;var y_=4294967296,G0=1/y_,j0=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Rl(u){return u.type===Qn.Bytes?u.readVarint()+u.pos:u.pos+1}function vh(u,o,c){return c?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function q0(u,o,c){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(p);for(var m=c.pos-1;m>=u;m--)c.buf[m+p]=c.buf[m]}function D2(u,o){for(var c=0;c>>8,u[c+2]=o>>>16,u[c+3]=o>>>24}function Z0(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}Qn.prototype={destroy:function(){this.buf=null},readFields:function(u,o,c){for(c=c||this.length;this.pos>3,v=this.pos;this.type=7&p,u(m,o,this),this.pos===v&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=gm(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=Z0(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=gm(this.buf,this.pos)+gm(this.buf,this.pos+4)*y_;return this.pos+=8,u},readSFixed64:function(){var u=gm(this.buf,this.pos)+Z0(this.buf,this.pos+4)*y_;return this.pos+=8,u},readFloat:function(){var u=V0(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=V0(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var o,c,p=this.buf;return o=127&(c=p[this.pos++]),c<128?o:(o|=(127&(c=p[this.pos++]))<<7,c<128?o:(o|=(127&(c=p[this.pos++]))<<14,c<128?o:(o|=(127&(c=p[this.pos++]))<<21,c<128?o:function(m,v,w){var E,T,k=w.buf;if(E=(112&(T=k[w.pos++]))>>4,T<128||(E|=(127&(T=k[w.pos++]))<<3,T<128)||(E|=(127&(T=k[w.pos++]))<<10,T<128)||(E|=(127&(T=k[w.pos++]))<<17,T<128)||(E|=(127&(T=k[w.pos++]))<<24,T<128)||(E|=(1&(T=k[w.pos++]))<<31,T<128))return vh(m,E,v);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=p[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,o=this.pos;return this.pos=u,u-o>=12&&j0?function(c,p,m){return j0.decode(c.subarray(p,m))}(this.buf,o,u):function(c,p,m){for(var v="",w=p;w239?4:D>223?3:D>191?2:1;if(w+j>m)break;j===1?D<128&&(F=D):j===2?(192&(E=c[w+1]))==128&&(F=(31&D)<<6|63&E)<=127&&(F=null):j===3?(T=c[w+2],(192&(E=c[w+1]))==128&&(192&T)==128&&((F=(15&D)<<12|(63&E)<<6|63&T)<=2047||F>=55296&&F<=57343)&&(F=null)):j===4&&(T=c[w+2],k=c[w+3],(192&(E=c[w+1]))==128&&(192&T)==128&&(192&k)==128&&((F=(15&D)<<18|(63&E)<<12|(63&T)<<6|63&k)<=65535||F>=1114112)&&(F=null)),F===null?(F=65533,j=1):F>65535&&(F-=65536,v+=String.fromCharCode(F>>>10&1023|55296),F=56320|1023&F),v+=String.fromCharCode(F),w+=j}return v}(this.buf,o,u)},readBytes:function(){var u=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,u);return this.pos=u,o},readPackedVarint:function(u,o){if(this.type!==Qn.Bytes)return u.push(this.readVarint(o));var c=Rl(this);for(u=u||[];this.pos127;);else if(o===Qn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Qn.Fixed32)this.pos+=4;else{if(o!==Qn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(u,o){this.writeVarint(u<<3|o)},realloc:function(u){for(var o=this.length||16;o268435455||u<0?function(o,c){var p,m;if(o>=0?(p=o%4294967296|0,m=o/4294967296|0):(m=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,m=m+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(v,w,E){E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,E.buf[E.pos]=127&(v>>>=7)}(p,0,c),function(v,w){var E=(7&v)<<4;w.buf[w.pos++]|=E|((v>>>=3)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v)))))}(m,c)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var o=this.pos;this.pos=function(p,m,v){for(var w,E,T=0;T55295&&w<57344){if(!E){w>56319||T+1===m.length?(p[v++]=239,p[v++]=191,p[v++]=189):E=w;continue}if(w<56320){p[v++]=239,p[v++]=191,p[v++]=189,E=w;continue}w=E-55296<<10|w-56320|65536,E=null}else E&&(p[v++]=239,p[v++]=191,p[v++]=189,E=null);w<128?p[v++]=w:(w<2048?p[v++]=w>>6|192:(w<65536?p[v++]=w>>12|224:(p[v++]=w>>18|240,p[v++]=w>>12&63|128),p[v++]=w>>6&63|128),p[v++]=63&w|128)}return v}(this.buf,u,this.pos);var c=this.pos-o;c>=128&&q0(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(u){this.realloc(4),U0(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),U0(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var o=u.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&q0(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,c){this.writeTag(u,Qn.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,D2,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,R2,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,F2,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,O2,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,z2,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,B2,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,V2,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,U2,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,G2,o)},writeBytesField:function(u,o){this.writeTag(u,Qn.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,Qn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,Qn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,Qn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,Qn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,Qn.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,Qn.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,Qn.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,Qn.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,Qn.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var v_=x(B0);const b_=3;function j2(u,o,c){u===1&&c.readMessage(q2,o)}function q2(u,o,c){if(u===3){const{id:p,bitmap:m,width:v,height:w,left:E,top:T,advance:k}=c.readMessage(Z2,{});o.push({id:p,bitmap:new sp({width:v+2*b_,height:w+2*b_},m),metrics:{width:v,height:w,left:E,top:T,advance:k}})}}function Z2(u,o,c){u===1?o.id=c.readVarint():u===2?o.bitmap=c.readBytes():u===3?o.width=c.readVarint():u===4?o.height=c.readVarint():u===5?o.left=c.readSVarint():u===6?o.top=c.readSVarint():u===7&&(o.advance=c.readVarint())}const $0=b_;function W0(u){let o=0,c=0;for(const w of u)o+=w.w*w.h,c=Math.max(c,w.w);u.sort((w,E)=>E.h-w.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let m=0,v=0;for(const w of u)for(let E=p.length-1;E>=0;E--){const T=p[E];if(!(w.w>T.w||w.h>T.h)){if(w.x=T.x,w.y=T.y,v=Math.max(v,w.y+w.h),m=Math.max(m,w.x+w.w),w.w===T.w&&w.h===T.h){const k=p.pop();E=0&&p>=o&&ym[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const p=new xh;return p.text=this.text.substring(o,c),p.sectionIndex=this.sectionIndex.slice(o,c),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(mp.forText(o.scale,o.fontStack||c));const p=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function _m(u,o,c,p,m,v,w,E,T,k,D,F,j,X,H,tt){const lt=xh.fromFeature(u,m);let ft;F===a.ai.vertical&<.verticalizePunctuation();const{processBidirectionalText:kt,processStyledBidirectionalText:St}=Fo;if(kt&<.sections.length===1){ft=[];const Jt=kt(lt.toString(),w_(lt,k,v,o,p,X,H));for(const ye of Jt){const Me=new xh;Me.text=ye,Me.sections=lt.sections;for(let ge=0;ge0&&zl>Uo&&(Uo=zl)}else{const Cs=Me[Sn.fontStack],jo=Cs&&Cs[Hr];if(jo&&jo.rect)ka=jo.rect,Ys=jo.metrics;else{const zl=ye[Sn.fontStack],bp=zl&&zl[Hr];if(!bp)continue;Ys=bp.metrics}br=(yr-Sn.scale)*mr}Ks?(Jt.verticalizable=!0,uo.push({glyph:Hr,imageName:Aa,x:di,y:vi+br,vertical:Ks,scale:Sn.scale,fontStack:Sn.fontStack,sectionIndex:co,metrics:Ys,rect:ka}),di+=Ol*Sn.scale+Be):(uo.push({glyph:Hr,imageName:Aa,x:di,y:vi+br,vertical:Ks,scale:Sn.scale,fontStack:Sn.fontStack,sectionIndex:co,metrics:Ys,rect:ka}),di+=Ys.advance*Sn.scale+Be)}uo.length!==0&&(gr=Math.max(di-Be,gr),X2(uo,0,uo.length-1,So,Uo)),di=0;const Go=le*yr+Uo;Co.lineOffset=Math.max(Uo,lo),vi+=Go,hs=Math.max(Go,hs),++or}var zr;const Xr=vi-dp,{horizontalAlign:Eo,verticalAlign:Io}=S_(we);(function(_r,yr,lo,Co,uo,Uo,Go,vr,Sn){const co=(yr-lo)*uo;let Hr=0;Hr=Uo!==Go?-vr*Co-dp:(-Co*Sn+.5)*Go;for(const br of _r)for(const Ys of br.positionedGlyphs)Ys.x+=co,Ys.y+=Hr})(Jt.positionedLines,So,Eo,Io,gr,hs,le,Xr,de.length),Jt.top+=-Io*Xr,Jt.bottom=Jt.top+Xr,Jt.left+=-Eo*gr,Jt.right=Jt.left+gr}(Ft,o,c,p,ft,w,E,T,F,k,j,tt),!function(Jt){for(const ye of Jt)if(ye.positionedGlyphs.length!==0)return!1;return!0}(At)&&Ft}const ym={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$2={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 H0(u,o,c,p,m,v){if(o.imageName){const w=p[o.imageName];return w?w.displaySize[0]*o.scale*mr/v+m:0}{const w=c[o.fontStack],E=w&&w[u];return E?E.metrics.advance*o.scale+m:0}}function Y0(u,o,c,p){const m=Math.pow(u-o,2);return p?u=0;let D=0;for(let j=0;jw.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=r_([]),this.placementViewportMatrix=r_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=tv(this.zoom,c["text-size"]),this.iconSizeData=tv(this.zoom,c["icon-size"]);const p=this.layers[0].layout,m=p.get("symbol-sort-key"),v=p.get("symbol-z-order");this.canOverlap=E_(p,"text-overlap","text-allow-overlap")!=="never"||E_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(w=>a.ai[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new C_(new Pa(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new C_(new Pa(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new Pt,this.lineVertexArray=new Bt,this.symbolInstances=new ct,this.textAnchorOffsets=new Yt}calculateGlyphDependencies(o,c,p,m,v){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,F=v.get("symbol-sort-key");if(this.features=[],!k&&!D)return;const j=c.iconDependencies,X=c.glyphDependencies,H=c.availableImages,tt=new fi(this.zoom);for(const{feature:lt,id:ft,index:kt,sourceLayerIndex:St}of o){const At=m._featureFilter.needGeometry,Ft=hc(lt,At);if(!m._featureFilter.filter(tt,Ft,p))continue;let Jt,ye;if(At||(Ft.geometry=cc(lt)),k){const ge=m.getValueAndResolveTokens("text-field",Ft,p,H),de=Zr.factory(ge);J2(de)&&(this.hasRTLText=!0),(!this.hasRTLText||Wf()==="unavailable"||this.hasRTLText&&Fo.isParsed())&&(Jt=N2(de,m,Ft))}if(D){const ge=m.getValueAndResolveTokens("icon-image",Ft,p,H);ye=ge instanceof Dr?ge:Dr.fromString(ge)}if(!Jt&&!ye)continue;const Me=this.sortFeaturesByKey?F.evaluate(Ft,{},p):void 0;if(this.features.push({id:ft,text:Jt,icon:ye,index:kt,sourceLayerIndex:St,geometry:Ft.geometry,properties:lt.properties,type:Y2[lt.type],sortKey:Me}),ye&&(j[ye.name]=!0),Jt){const ge=w.evaluate(Ft,{},p).join(","),de=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ai.vertical)>=0;for(const le of Jt.sections)if(le.image)j[le.image.name]=!0;else{const we=Bf(Jt.toString()),ce=le.fontStack||ge,ne=X[ce]=X[ce]||{};this.calculateGlyphDependencies(le.text,ne,de,this.allowVerticalPlacement,we)}}}v.get("symbol-placement")==="line"&&(this.features=function(lt){const ft={},kt={},St=[];let At=0;function Ft(ge){St.push(lt[ge]),At++}function Jt(ge,de,le){const we=kt[ge];return delete kt[ge],kt[de]=we,St[we].geometry[0].pop(),St[we].geometry[0]=St[we].geometry[0].concat(le[0]),we}function ye(ge,de,le){const we=ft[de];return delete ft[de],ft[ge]=we,St[we].geometry[0].shift(),St[we].geometry[0]=le[0].concat(St[we].geometry[0]),we}function Me(ge,de,le){const we=le?de[0][de[0].length-1]:de[0][0];return`${ge}:${we.x}:${we.y}`}for(let ge=0;gege.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((lt,ft)=>lt.sortKey-ft.sortKey)}update(o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,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(o,c){const p=this.lineVertexArray.length;if(o.segment!==void 0){let m=o.dist(c[o.segment+1]),v=o.dist(c[o.segment]);const w={};for(let E=o.segment+1;E=0;E--)w[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:v},E>0&&(v+=c[E-1].dist(c[E]));for(let E=0;E0}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(o,c){const p=o.placedSymbolArray.get(c),m=p.vertexStartIndex+4*p.numGlyphs;for(let v=p.vertexStartIndex;vm[E]-m[T]||v[T]-v[E]),w}addToSortKeyRanges(o,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((m,v,w)=>{m>=0&&w.indexOf(m)===v&&this.addIndicesForPlacedSymbol(this.text,m)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let ev,nv;xe("SymbolBucket",wh,{omit:["layers","collisionBoxArray","features","compareText"]}),wh.MAX_GLYPHS=65535,wh.addDynamicAttributes=I_;var L_={get paint(){return nv=nv||new Xi({"icon-opacity":new Ue($t.paint_symbol["icon-opacity"]),"icon-color":new Ue($t.paint_symbol["icon-color"]),"icon-halo-color":new Ue($t.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ue($t.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ue($t.paint_symbol["icon-halo-blur"]),"icon-translate":new Re($t.paint_symbol["icon-translate"]),"icon-translate-anchor":new Re($t.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ue($t.paint_symbol["text-opacity"]),"text-color":new Ue($t.paint_symbol["text-color"],{runtimeType:Ar,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Ue($t.paint_symbol["text-halo-color"]),"text-halo-width":new Ue($t.paint_symbol["text-halo-width"]),"text-halo-blur":new Ue($t.paint_symbol["text-halo-blur"]),"text-translate":new Re($t.paint_symbol["text-translate"]),"text-translate-anchor":new Re($t.paint_symbol["text-translate-anchor"])})},get layout(){return ev=ev||new Xi({"symbol-placement":new Re($t.layout_symbol["symbol-placement"]),"symbol-spacing":new Re($t.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Re($t.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ue($t.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Re($t.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Re($t.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Re($t.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Re($t.layout_symbol["icon-ignore-placement"]),"icon-optional":new Re($t.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Re($t.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ue($t.layout_symbol["icon-size"]),"icon-text-fit":new Re($t.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Re($t.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ue($t.layout_symbol["icon-image"]),"icon-rotate":new Ue($t.layout_symbol["icon-rotate"]),"icon-padding":new Ue($t.layout_symbol["icon-padding"]),"icon-keep-upright":new Re($t.layout_symbol["icon-keep-upright"]),"icon-offset":new Ue($t.layout_symbol["icon-offset"]),"icon-anchor":new Ue($t.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Re($t.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Re($t.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Re($t.layout_symbol["text-rotation-alignment"]),"text-field":new Ue($t.layout_symbol["text-field"]),"text-font":new Ue($t.layout_symbol["text-font"]),"text-size":new Ue($t.layout_symbol["text-size"]),"text-max-width":new Ue($t.layout_symbol["text-max-width"]),"text-line-height":new Re($t.layout_symbol["text-line-height"]),"text-letter-spacing":new Ue($t.layout_symbol["text-letter-spacing"]),"text-justify":new Ue($t.layout_symbol["text-justify"]),"text-radial-offset":new Ue($t.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Re($t.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ue($t.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ue($t.layout_symbol["text-anchor"]),"text-max-angle":new Re($t.layout_symbol["text-max-angle"]),"text-writing-mode":new Re($t.layout_symbol["text-writing-mode"]),"text-rotate":new Ue($t.layout_symbol["text-rotate"]),"text-padding":new Re($t.layout_symbol["text-padding"]),"text-keep-upright":new Re($t.layout_symbol["text-keep-upright"]),"text-transform":new Ue($t.layout_symbol["text-transform"]),"text-offset":new Ue($t.layout_symbol["text-offset"]),"text-allow-overlap":new Re($t.layout_symbol["text-allow-overlap"]),"text-overlap":new Re($t.layout_symbol["text-overlap"]),"text-ignore-placement":new Re($t.layout_symbol["text-ignore-placement"]),"text-optional":new Re($t.layout_symbol["text-optional"])})}};class iv{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:ws,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}xe("FormatSectionOverride",iv,{omit:["defaultValue"]});class bm extends us{constructor(o){super(o,L_)}recalculate(o,c){if(super.recalculate(o,c),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 p=this.layout.get("text-writing-mode");if(p){const m=[];for(const v of p)m.indexOf(v)<0&&m.push(v);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,p,m){const v=this.layout.get(o).evaluate(c,{},p,m),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||nh(w.value)||!v?v:function(E,T){return T.replace(/{([^{}]+)}/g,(k,D)=>E&&D in E?String(E[D]):"")}(c.properties,v)}createBucket(o){return new wh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of L_.paint.overridableProperties){if(!bm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),p=new iv(c),m=new Nf(p,c.property.specification);let v=null;v=c.value.kind==="constant"||c.value.kind==="source"?new Df("source",m):new rh("composite",m,c.value.zoomStops),this.paint._values[o]=new so(c.property,v,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&bm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const p=o.get("text-field"),m=L_.paint.properties[c];let v=!1;const w=E=>{for(const T of E)if(m.overrides&&m.overrides.hasOverride(T))return void(v=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Zr)w(p.value.value.sections);else if(p.value.kind==="source"){const E=k=>{v||(k instanceof Sl&&Ei(k.value)===st?w(k.value.sections):k instanceof eh?w(k.sections):k.eachChild(E))},T=p.value;T._styleExpression&&E(T._styleExpression.expression)}return v}}let rv;var Q2={get paint(){return rv=rv||new Xi({"background-color":new Re($t.paint_background["background-color"]),"background-pattern":new Hf($t.paint_background["background-pattern"]),"background-opacity":new Re($t.paint_background["background-opacity"])})}};class tS extends us{constructor(o){super(o,Q2)}}let ov;var eS={get paint(){return ov=ov||new Xi({"raster-opacity":new Re($t.paint_raster["raster-opacity"]),"raster-hue-rotate":new Re($t.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Re($t.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Re($t.paint_raster["raster-brightness-max"]),"raster-saturation":new Re($t.paint_raster["raster-saturation"]),"raster-contrast":new Re($t.paint_raster["raster-contrast"]),"raster-resampling":new Re($t.paint_raster["raster-resampling"]),"raster-fade-duration":new Re($t.paint_raster["raster-fade-duration"])})}};class nS extends us{constructor(o){super(o,eS)}}class iS extends us{constructor(o){super(o,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class rS{constructor(o){this._callback=o,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 M_=63710088e-1;class wu{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new wu(dt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,p=this.lat*c,m=o.lat*c,v=Math.sin(p)*Math.sin(m)+Math.cos(p)*Math.cos(m)*Math.cos((o.lng-this.lng)*c);return M_*Math.acos(Math.min(v,1))}static convert(o){if(o instanceof wu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new wu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new wu(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const sv=2*Math.PI*M_;function av(u){return sv*Math.cos(u*Math.PI/180)}function lv(u){return(180+u)/360}function uv(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function cv(u,o){return u/av(o)}function hv(u){return 360*u-180}function P_(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class xm{constructor(o,c,p=0){this.x=+o,this.y=+c,this.z=+p}static fromLngLat(o,c=0){const p=wu.convert(o);return new xm(lv(p.lng),uv(p.lat),cv(c,p.lat))}toLngLat(){return new wu(hv(this.x),P_(this.y))}toAltitude(){return this.z*av(P_(this.y))}meterInMercatorCoordinateUnits(){return 1/sv*(o=P_(this.y),1/Math.cos(o*Math.PI/180));var o}}function fv(u,o,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class k_{constructor(o,c,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=p,this.key=_p(0,o,o,c,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,p){const m=(w=this.y,E=this.z,T=fv(256*(v=this.x),256*(w=Math.pow(2,E)-w-1),E),k=fv(256*(v+1),256*(w+1),E),T[0]+","+T[1]+","+k[0]+","+k[1]);var v,w,E,T,k;const D=function(F,j,X){let H,tt="";for(let lt=F;lt>0;lt--)H=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,m)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new A((o.x*c-this.x)*rr,(o.y*c-this.y)*rr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class pv{constructor(o,c){this.wrap=o,this.canonical=c,this.key=_p(o,c.z,c.z,c.x,c.y)}}class Is{constructor(o,c,p,m,v){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=c,this.canonical=new k_(p,+m,+v),this.key=_p(c,o,p,m,v)}clone(){return new Is(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new Is(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Is(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?_p(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):_p(this.wrap*+c,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new Is(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,m=2*this.canonical.y;return[new Is(c,this.wrap,c,p,m),new Is(c,this.wrap,c,p+1,m),new Is(c,this.wrap,c,p,m+1),new Is(c,this.wrap,c,p+1,m+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=F),F=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(o+1)}unpack(o,c,p){return o*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new Es({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let m=c*this.dim,v=c*this.dim+this.dim,w=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:m=v-1;break;case 1:v=m+1}switch(p){case-1:w=E-1;break;case 1:E=w+1}const T=-c*this.dim,k=-p*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class gv{constructor(o,c,p,m,v){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=p,o._y=m,this.properties=o.properties,this.id=v}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(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class _v{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new du(rr,16,0),this.grid3D=new du(rr,16,0),this.featureIndexArray=new te,this.promoteId=c}insert(o,c,p,m,v,w){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,m,v);const T=w?this.grid3D:this.grid;for(let k=0;k=0&&F[3]>=0&&T.insert(E,F[0],F[1],F[2],F[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new vu.VectorTile(new v_(this.rawTileData)).layers,this.sourceLayerCoder=new mv(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,p,m){this.loadVTLayers();const v=o.params||{},w=rr/o.tileSize/o.scale,E=Of(v.filter),T=o.queryGeometry,k=o.queryPadding*w,D=vv(T),F=this.grid.query(D.minX-k,D.minY-k,D.maxX+k,D.maxY+k),j=vv(o.cameraQueryGeometry),X=this.grid3D.query(j.minX-k,j.minY-k,j.maxX+k,j.maxY+k,(lt,ft,kt,St)=>function(At,Ft,Jt,ye,Me){for(const de of At)if(Ft<=de.x&&Jt<=de.y&&ye>=de.x&&Me>=de.y)return!0;const ge=[new A(Ft,Jt),new A(Ft,Me),new A(ye,Me),new A(ye,Jt)];if(At.length>2){for(const de of ge)if(mh(At,de))return!0}for(let de=0;de(St||(St=cc(At)),Ft.queryIntersectsFeature(T,At,Jt,St,this.z,o.transform,w,o.pixelPosMatrix)))}return H}loadMatchingFeature(o,c,p,m,v,w,E,T,k,D,F){const j=this.bucketLayerIDs[c];if(w&&!function(lt,ft){for(let kt=0;kt=0)return!0;return!1}(w,j))return;const X=this.sourceLayerCoder.decode(p),H=this.vtLayers[X].feature(m);if(v.needGeometry){const lt=hc(H,!0);if(!v.filter(new fi(this.tileID.overscaledZ),lt,this.tileID.canonical))return}else if(!v.filter(new fi(this.tileID.overscaledZ),H))return;const tt=this.getId(H,X);for(let lt=0;lt{const E=o instanceof ph?o.get(w):null;return E&&E.evaluate?E.evaluate(c,p,m):E})}function vv(u){let o=1/0,c=1/0,p=-1/0,m=-1/0;for(const v of u)o=Math.min(o,v.x),c=Math.min(c,v.y),p=Math.max(p,v.x),m=Math.max(m,v.y);return{minX:o,minY:c,maxX:p,maxY:m}}function oS(u,o){return o-u}function bv(u,o,c,p,m){const v=[];for(let w=0;w=p&&F.x>=p||(D.x>=p?D=new A(p,D.y+(p-D.x)/(F.x-D.x)*(F.y-D.y))._round():F.x>=p&&(F=new A(p,D.y+(p-D.x)/(F.x-D.x)*(F.y-D.y))._round()),D.y>=m&&F.y>=m||(D.y>=m?D=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round():F.y>=m&&(F=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round()),T&&D.equals(T[T.length-1])||(T=[D],v.push(T)),T.push(F)))))}}return v}xe("FeatureIndex",_v,{omit:["rawTileData","sourceLayerCoder"]});class Su extends A{constructor(o,c,p,m){super(o,c),this.angle=p,m!==void 0&&(this.segment=m)}clone(){return new Su(this.x,this.y,this.angle,this.segment)}}function xv(u,o,c,p,m){if(o.segment===void 0||c===0)return!0;let v=o,w=o.segment+1,E=0;for(;E>-c/2;){if(w--,w<0)return!1;E-=u[w].dist(v),v=u[w]}E+=u[w].dist(u[w+1]),w++;const T=[];let k=0;for(;Ep;)k-=T.shift().angleDelta;if(k>m)return!1;w++,E+=D.dist(F)}return!0}function wv(u){let o=0;for(let c=0;ck){const H=(k-T)/X,tt=Ro.number(F.x,j.x,H),lt=Ro.number(F.y,j.y,H),ft=new Su(tt,lt,j.angleTo(F),D);return ft._round(),!w||xv(u,ft,E,w,o)?ft:void 0}T+=X}}function aS(u,o,c,p,m,v,w,E,T){const k=Sv(p,v,w),D=Ev(p,m),F=D*w,j=u[0].x===0||u[0].x===T||u[0].y===0||u[0].y===T;return o-F=0&&At=0&&Ft=0&&j+k<=D){const Jt=new Su(At,Ft,kt,H);Jt._round(),p&&!xv(u,Jt,v,p,m)||X.push(Jt)}}F+=ft}return E||X.length||w||(X=Iv(u,F/2,c,p,m,v,w,!0,T)),X}xe("Anchor",Su);const Sh=Vo;function Cv(u,o,c,p){const m=[],v=u.image,w=v.pixelRatio,E=v.paddedRect.w-2*Sh,T=v.paddedRect.h-2*Sh,k=u.right-u.left,D=u.bottom-u.top,F=v.stretchX||[[0,E]],j=v.stretchY||[[0,T]],X=(le,we)=>le+we[1]-we[0],H=F.reduce(X,0),tt=j.reduce(X,0),lt=E-H,ft=T-tt;let kt=0,St=H,At=0,Ft=tt,Jt=0,ye=lt,Me=0,ge=ft;if(v.content&&p){const le=v.content;kt=wm(F,0,le[0]),At=wm(j,0,le[1]),St=wm(F,le[0],le[2]),Ft=wm(j,le[1],le[3]),Jt=le[0]-kt,Me=le[1]-At,ye=le[2]-le[0]-St,ge=le[3]-le[1]-Ft}const de=(le,we,ce,ne)=>{const Be=Sm(le.stretch-kt,St,k,u.left),Ae=Em(le.fixed-Jt,ye,le.stretch,H),dn=Sm(we.stretch-At,Ft,D,u.top),di=Em(we.fixed-Me,ge,we.stretch,tt),vi=Sm(ce.stretch-kt,St,k,u.left),gr=Em(ce.fixed-Jt,ye,ce.stretch,H),hs=Sm(ne.stretch-At,Ft,D,u.top),So=Em(ne.fixed-Me,ge,ne.stretch,tt),or=new A(Be,dn),zr=new A(vi,dn),Xr=new A(vi,hs),Eo=new A(Be,hs),Io=new A(Ae/w,di/w),_r=new A(gr/w,So/w),yr=o*Math.PI/180;if(yr){const uo=Math.sin(yr),Uo=Math.cos(yr),Go=[Uo,-uo,uo,Uo];or._matMult(Go),zr._matMult(Go),Eo._matMult(Go),Xr._matMult(Go)}const lo=le.stretch+le.fixed,Co=we.stretch+we.fixed;return{tl:or,tr:zr,bl:Eo,br:Xr,tex:{x:v.paddedRect.x+Sh+lo,y:v.paddedRect.y+Sh+Co,w:ce.stretch+ce.fixed-lo,h:ne.stretch+ne.fixed-Co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Io,pixelOffsetBR:_r,minFontScaleX:ye/w/k,minFontScaleY:ge/w/D,isSDF:c}};if(p&&(v.stretchX||v.stretchY)){const le=Tv(F,lt,H),we=Tv(j,ft,tt);for(let ce=0;ce0&&(H=Math.max(10,H),this.circleDiameter=H)}else{let F=w.top*E-T[0],j=w.bottom*E+T[2],X=w.left*E-T[3],H=w.right*E+T[1];const tt=w.collisionPadding;if(tt&&(X-=tt[0]*E,F-=tt[1]*E,H+=tt[2]*E,j+=tt[3]*E),D){const lt=new A(X,F),ft=new A(H,F),kt=new A(X,j),St=new A(H,j),At=D*Math.PI/180;lt._rotate(At),ft._rotate(At),kt._rotate(At),St._rotate(At),X=Math.min(lt.x,ft.x,kt.x,St.x),H=Math.max(lt.x,ft.x,kt.x,St.x),F=Math.min(lt.y,ft.y,kt.y,St.y),j=Math.max(lt.y,ft.y,kt.y,St.y)}o.emplaceBack(c.x,c.y,X,F,H,j,p,m,v)}this.boxEndIndex=o.length}}class lS{constructor(o=[],c=uS){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:p}=this,m=c[o];for(;o>0;){const v=o-1>>1,w=c[v];if(p(m,w)>=0)break;c[o]=w,o=v}c[o]=m}_down(o){const{data:c,compare:p}=this,m=this.length>>1,v=c[o];for(;o=0)break;c[o]=E,o=w}c[o]=v}}function uS(u,o){return uo?1:0}function cS(u,o=1,c=!1){let p=1/0,m=1/0,v=-1/0,w=-1/0;const E=u[0];for(let X=0;Xv)&&(v=H.x),(!X||H.y>w)&&(w=H.y)}const T=Math.min(v-p,w-m);let k=T/2;const D=new lS([],hS);if(T===0)return new A(p,m);for(let X=p;XF.d||!F.d)&&(F=X,c&&console.log("found best %d after %d probes",Math.round(1e4*X.d)/1e4,j)),X.max-F.d<=o||(k=X.h/2,D.push(new Eh(X.p.x-k,X.p.y-k,k,u)),D.push(new Eh(X.p.x+k,X.p.y-k,k,u)),D.push(new Eh(X.p.x-k,X.p.y+k,k,u)),D.push(new Eh(X.p.x+k,X.p.y+k,k,u)),j+=4)}return c&&(console.log(`num probes: ${j}`),console.log(`best distance: ${F.d}`)),F.p}function hS(u,o){return o.max-u.max}function Eh(u,o,c,p){this.p=new A(u,o),this.h=c,this.d=function(m,v){let w=!1,E=1/0;for(let T=0;Tm.y!=H.y>m.y&&m.x<(H.x-X.x)*(m.y-X.y)/(H.y-X.y)+X.x&&(w=!w),E=Math.min(E,u0(m,X,H))}}return(w?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Wr;a.aq=void 0,(Wr=a.aq||(a.aq={}))[Wr.center=1]="center",Wr[Wr.left=2]="left",Wr[Wr.right=3]="right",Wr[Wr.top=4]="top",Wr[Wr.bottom=5]="bottom",Wr[Wr["top-left"]=6]="top-left",Wr[Wr["top-right"]=7]="top-right",Wr[Wr["bottom-left"]=8]="bottom-left",Wr[Wr["bottom-right"]=9]="bottom-right";const Eu=7,A_=Number.POSITIVE_INFINITY;function Lv(u,o){return o[1]!==A_?function(c,p,m){let v=0,w=0;switch(p=Math.abs(p),m=Math.abs(m),c){case"top-right":case"top-left":case"top":w=m-Eu;break;case"bottom-right":case"bottom-left":case"bottom":w=-m+Eu}switch(c){case"top-right":case"bottom-right":case"right":v=-p;break;case"top-left":case"bottom-left":case"left":v=p}return[v,w]}(u,o[0],o[1]):function(c,p){let m=0,v=0;p<0&&(p=0);const w=p/Math.SQRT2;switch(c){case"top-right":case"top-left":v=w-Eu;break;case"bottom-right":case"bottom-left":v=-w+Eu;break;case"bottom":v=-p+Eu;break;case"top":v=p-Eu}switch(c){case"top-right":case"bottom-right":m=-w;break;case"top-left":case"bottom-left":m=w;break;case"left":m=p;break;case"right":m=-p}return[m,v]}(u,o[0])}function Mv(u,o,c){var p;const m=u.layout,v=(p=m.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},c);if(v){const E=v.values,T=[];for(let k=0;kj*mr);D.startsWith("top")?F[1]-=Eu:D.startsWith("bottom")&&(F[1]+=Eu),T[k+1]=F}return new os(T)}const w=m.get("text-variable-anchor");if(w){let E;E=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(o,{},c)*mr,A_]:m.get("text-offset").evaluate(o,{},c).map(k=>k*mr);const T=[];for(const k of w)T.push(k,Lv(k,E));return new os(T)}return null}function N_(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function fS(u,o,c,p,m,v,w,E,T,k,D){let F=v.textMaxSize.evaluate(o,{});F===void 0&&(F=w);const j=u.layers[0].layout,X=j.get("icon-offset").evaluate(o,{},D),H=kv(c.horizontal),tt=w/24,lt=u.tilePixelRatio*tt,ft=u.tilePixelRatio*F/24,kt=u.tilePixelRatio*E,St=u.tilePixelRatio*j.get("symbol-spacing"),At=j.get("text-padding")*u.tilePixelRatio,Ft=function(ne,Be,Ae,dn=1){const di=ne.get("icon-padding").evaluate(Be,{},Ae),vi=di&&di.values;return[vi[0]*dn,vi[1]*dn,vi[2]*dn,vi[3]*dn]}(j,o,D,u.tilePixelRatio),Jt=j.get("text-max-angle")/180*Math.PI,ye=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",Me=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",ge=j.get("symbol-placement"),de=St/2,le=j.get("icon-text-fit");let we;p&&le!=="none"&&(u.allowVerticalPlacement&&c.vertical&&(we=Q0(p,c.vertical,le,j.get("icon-text-fit-padding"),X,tt)),H&&(p=Q0(p,H,le,j.get("icon-text-fit-padding"),X,tt)));const ce=(ne,Be)=>{Be.x<0||Be.x>=rr||Be.y<0||Be.y>=rr||function(Ae,dn,di,vi,gr,hs,So,or,zr,Xr,Eo,Io,_r,yr,lo,Co,uo,Uo,Go,vr,Sn,co,Hr,br,Ys){const ka=Ae.addToLineVertexArray(dn,di);let Aa,Ol,Ks,Cs,jo=0,zl=0,bp=0,Rv=0,U_=-1,G_=-1;const Fl={};let Ov=Al("");if(Ae.allowVerticalPlacement&&vi.vertical){const ho=or.layout.get("text-rotate").evaluate(Sn,{},br)+90;Ks=new Im(zr,dn,Xr,Eo,Io,vi.vertical,_r,yr,lo,ho),So&&(Cs=new Im(zr,dn,Xr,Eo,Io,So,uo,Uo,lo,ho))}if(gr){const ho=or.layout.get("icon-rotate").evaluate(Sn,{}),Ts=or.layout.get("icon-text-fit")!=="none",pc=Cv(gr,ho,Hr,Ts),Da=So?Cv(So,ho,Hr,Ts):void 0;Ol=new Im(zr,dn,Xr,Eo,Io,gr,uo,Uo,!1,ho),jo=4*pc.length;const dc=Ae.iconSizeData;let rl=null;dc.kind==="source"?(rl=[il*or.layout.get("icon-size").evaluate(Sn,{})],rl[0]>xu&&Nt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${gp}. Reduce your "icon-size".`)):dc.kind==="composite"&&(rl=[il*co.compositeIconSizes[0].evaluate(Sn,{},br),il*co.compositeIconSizes[1].evaluate(Sn,{},br)],(rl[0]>xu||rl[1]>xu)&&Nt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${gp}. Reduce your "icon-size".`)),Ae.addSymbols(Ae.icon,pc,rl,vr,Go,Sn,a.ai.none,dn,ka.lineStartIndex,ka.lineLength,-1,br),U_=Ae.icon.placedSymbolArray.length-1,Da&&(zl=4*Da.length,Ae.addSymbols(Ae.icon,Da,rl,vr,Go,Sn,a.ai.vertical,dn,ka.lineStartIndex,ka.lineLength,-1,br),G_=Ae.icon.placedSymbolArray.length-1)}const zv=Object.keys(vi.horizontal);for(const ho of zv){const Ts=vi.horizontal[ho];if(!Aa){Ov=Al(Ts.text);const Da=or.layout.get("text-rotate").evaluate(Sn,{},br);Aa=new Im(zr,dn,Xr,Eo,Io,Ts,_r,yr,lo,Da)}const pc=Ts.positionedLines.length===1;if(bp+=Pv(Ae,dn,Ts,hs,or,lo,Sn,Co,ka,vi.vertical?a.ai.horizontal:a.ai.horizontalOnly,pc?zv:[ho],Fl,U_,co,br),pc)break}vi.vertical&&(Rv+=Pv(Ae,dn,vi.vertical,hs,or,lo,Sn,Co,ka,a.ai.vertical,["vertical"],Fl,G_,co,br));const mS=Aa?Aa.boxStartIndex:Ae.collisionBoxArray.length,gS=Aa?Aa.boxEndIndex:Ae.collisionBoxArray.length,_S=Ks?Ks.boxStartIndex:Ae.collisionBoxArray.length,yS=Ks?Ks.boxEndIndex:Ae.collisionBoxArray.length,vS=Ol?Ol.boxStartIndex:Ae.collisionBoxArray.length,bS=Ol?Ol.boxEndIndex:Ae.collisionBoxArray.length,xS=Cs?Cs.boxStartIndex:Ae.collisionBoxArray.length,wS=Cs?Cs.boxEndIndex:Ae.collisionBoxArray.length;let Na=-1;const Tm=(ho,Ts)=>ho&&ho.circleDiameter?Math.max(ho.circleDiameter,Ts):Ts;Na=Tm(Aa,Na),Na=Tm(Ks,Na),Na=Tm(Ol,Na),Na=Tm(Cs,Na);const Fv=Na>-1?1:0;Fv&&(Na*=Ys/mr),Ae.glyphOffsetArray.length>=wh.MAX_GLYPHS&&Nt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Sn.sortKey!==void 0&&Ae.addToSortKeyRanges(Ae.symbolInstances.length,Sn.sortKey);const SS=Mv(or,Sn,br),[ES,IS]=function(ho,Ts){const pc=ho.length,Da=Ts==null?void 0:Ts.values;if((Da==null?void 0:Da.length)>0)for(let dc=0;dc=0?Fl.right:-1,Fl.center>=0?Fl.center:-1,Fl.left>=0?Fl.left:-1,Fl.vertical||-1,U_,G_,Ov,mS,gS,_S,yS,vS,bS,xS,wS,Xr,bp,Rv,jo,zl,Fv,0,_r,Na,ES,IS)}(u,Be,ne,c,p,m,we,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,lt,[At,At,At,At],ye,T,kt,Ft,Me,X,o,v,k,D,w)};if(ge==="line")for(const ne of bv(o.geometry,0,0,rr,rr)){const Be=aS(ne,St,Jt,c.vertical||H,p,24,ft,u.overscaling,rr);for(const Ae of Be)H&&pS(u,H.text,de,Ae)||ce(ne,Ae)}else if(ge==="line-center"){for(const ne of o.geometry)if(ne.length>1){const Be=sS(ne,Jt,c.vertical||H,p,24,ft);Be&&ce(ne,Be)}}else if(o.type==="Polygon")for(const ne of h_(o.geometry,0)){const Be=cS(ne,16);ce(ne[0],new Su(Be.x,Be.y,0))}else if(o.type==="LineString")for(const ne of o.geometry)ce(ne,new Su(ne[0].x,ne[0].y,0));else if(o.type==="Point")for(const ne of o.geometry)for(const Be of ne)ce([Be],new Su(Be.x,Be.y,0))}function Pv(u,o,c,p,m,v,w,E,T,k,D,F,j,X,H){const tt=function(kt,St,At,Ft,Jt,ye,Me,ge){const de=Ft.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,le=[];for(const we of St.positionedLines)for(const ce of we.positionedGlyphs){if(!ce.rect)continue;const ne=ce.rect||{};let Be=$0+1,Ae=!0,dn=1,di=0;const vi=(Jt||ge)&&ce.vertical,gr=ce.metrics.advance*ce.scale/2;if(ge&&St.verticalizable&&(di=we.lineOffset/2-(ce.imageName?-(mr-ce.metrics.width*ce.scale)/2:(ce.scale-1)*mr)),ce.imageName){const vr=Me[ce.imageName];Ae=vr.sdf,dn=vr.pixelRatio,Be=Vo/dn}const hs=Jt?[ce.x+gr,ce.y]:[0,0];let So=Jt?[0,0]:[ce.x+gr+At[0],ce.y+At[1]-di],or=[0,0];vi&&(or=So,So=[0,0]);const zr=ce.metrics.isDoubleResolution?2:1,Xr=(ce.metrics.left-Be)*ce.scale-gr+So[0],Eo=(-ce.metrics.top-Be)*ce.scale+So[1],Io=Xr+ne.w/zr*ce.scale/dn,_r=Eo+ne.h/zr*ce.scale/dn,yr=new A(Xr,Eo),lo=new A(Io,Eo),Co=new A(Xr,_r),uo=new A(Io,_r);if(vi){const vr=new A(-gr,gr-dp),Sn=-Math.PI/2,co=mr/2-gr,Hr=new A(5-dp-co,-(ce.imageName?co:0)),br=new A(...or);yr._rotateAround(Sn,vr)._add(Hr)._add(br),lo._rotateAround(Sn,vr)._add(Hr)._add(br),Co._rotateAround(Sn,vr)._add(Hr)._add(br),uo._rotateAround(Sn,vr)._add(Hr)._add(br)}if(de){const vr=Math.sin(de),Sn=Math.cos(de),co=[Sn,-vr,vr,Sn];yr._matMult(co),lo._matMult(co),Co._matMult(co),uo._matMult(co)}const Uo=new A(0,0),Go=new A(0,0);le.push({tl:yr,tr:lo,bl:Co,br:uo,tex:ne,writingMode:St.writingMode,glyphOffset:hs,sectionIndex:ce.sectionIndex,isSDF:Ae,pixelOffsetTL:Uo,pixelOffsetBR:Go,minFontScaleX:0,minFontScaleY:0})}return le}(0,c,E,m,v,w,p,u.allowVerticalPlacement),lt=u.textSizeData;let ft=null;lt.kind==="source"?(ft=[il*m.layout.get("text-size").evaluate(w,{})],ft[0]>xu&&Nt(`${u.layerIds[0]}: Value for "text-size" is >= ${gp}. Reduce your "text-size".`)):lt.kind==="composite"&&(ft=[il*X.compositeTextSizes[0].evaluate(w,{},H),il*X.compositeTextSizes[1].evaluate(w,{},H)],(ft[0]>xu||ft[1]>xu)&&Nt(`${u.layerIds[0]}: Value for "text-size" is >= ${gp}. Reduce your "text-size".`)),u.addSymbols(u.text,tt,ft,E,v,w,k,o,T.lineStartIndex,T.lineLength,j,H);for(const kt of D)F[kt]=u.text.placedSymbolArray.length-1;return 4*tt.length}function kv(u){for(const o in u)return u[o];return null}function pS(u,o,c,p){const m=u.compareText;if(o in m){const v=m[o];for(let w=v.length-1;w>=0;w--)if(p.dist(v[w])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const v=Av[15&p];if(!v)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new D_(E,w,v,o)}constructor(o,c=64,p=Float64Array,m){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const v=Av.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,T=(8-E%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${p}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+E+T),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=c,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return R_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,p,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:w,nodeSize:E}=this,T=[0,v.length-1,0],k=[];for(;T.length;){const D=T.pop()||0,F=T.pop()||0,j=T.pop()||0;if(F-j<=E){for(let lt=j;lt<=F;lt++){const ft=w[2*lt],kt=w[2*lt+1];ft>=o&&ft<=p&&kt>=c&&kt<=m&&k.push(v[lt])}continue}const X=j+F>>1,H=w[2*X],tt=w[2*X+1];H>=o&&H<=p&&tt>=c&&tt<=m&&k.push(v[X]),(D===0?o<=H:c<=tt)&&(T.push(j),T.push(X-1),T.push(1-D)),(D===0?p>=H:m>=tt)&&(T.push(X+1),T.push(F),T.push(1-D))}return k}within(o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:v,nodeSize:w}=this,E=[0,m.length-1,0],T=[],k=p*p;for(;E.length;){const D=E.pop()||0,F=E.pop()||0,j=E.pop()||0;if(F-j<=w){for(let lt=j;lt<=F;lt++)Dv(v[2*lt],v[2*lt+1],o,c)<=k&&T.push(m[lt]);continue}const X=j+F>>1,H=v[2*X],tt=v[2*X+1];Dv(H,tt,o,c)<=k&&T.push(m[X]),(D===0?o-p<=H:c-p<=tt)&&(E.push(j),E.push(X-1),E.push(1-D)),(D===0?o+p>=H:c+p>=tt)&&(E.push(X+1),E.push(F),E.push(1-D))}return T}}function R_(u,o,c,p,m,v){if(m-p<=c)return;const w=p+m>>1;Nv(u,o,w,p,m,v),R_(u,o,c,p,w-1,1-v),R_(u,o,c,w+1,m,1-v)}function Nv(u,o,c,p,m,v){for(;m>p;){if(m-p>600){const k=m-p+1,D=c-p+1,F=Math.log(k),j=.5*Math.exp(2*F/3),X=.5*Math.sqrt(F*j*(k-j)/k)*(D-k/2<0?-1:1);Nv(u,o,c,Math.max(p,Math.floor(c-D*j/k+X)),Math.min(m,Math.floor(c+(k-D)*j/k+X)),v)}const w=o[2*c+v];let E=p,T=m;for(yp(u,o,p,c),o[2*m+v]>w&&yp(u,o,p,m);Ew;)T--}o[2*p+v]===w?yp(u,o,p,T):(T++,yp(u,o,T,m)),T<=c&&(p=T+1),c<=T&&(m=T-1)}}function yp(u,o,c,p){O_(u,c,p),O_(o,2*c,2*p),O_(o,2*c+1,2*p+1)}function O_(u,o,c){const p=u[o];u[o]=u[c],u[c]=p}function Dv(u,o,c,p){const m=u-c,v=o-p;return m*m+v*v}var z_;a.bh=void 0,(z_=a.bh||(a.bh={})).create="create",z_.load="load",z_.fullLoad="fullLoad";let Cm=null,vp=[];const F_=1e3/60,B_="loadTime",V_="fullLoadTime",dS={mark(u){performance.mark(u)},frame(u){const o=u;Cm!=null&&vp.push(o-Cm),Cm=o},clearMetrics(){Cm=null,vp=[],performance.clearMeasures(B_),performance.clearMeasures(V_);for(const u in a.bh)performance.clearMarks(a.bh[u])},getPerformanceMetrics(){performance.measure(B_,a.bh.create,a.bh.load),performance.measure(V_,a.bh.create,a.bh.fullLoad);const u=performance.getEntriesByName(B_)[0].duration,o=performance.getEntriesByName(V_)[0].duration,c=vp.length,p=1/(vp.reduce((v,w)=>v+w,0)/c/1e3),m=vp.filter(v=>v>F_).reduce((v,w)=>v+(w-F_)/F_,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:m/(c+m)*100,totalFrames:c}}};a.$=function(u,o,c){var p,m,v,w,E,T,k,D,F,j,X,H,tt=c[0],lt=c[1],ft=c[2];return o===u?(u[12]=o[0]*tt+o[4]*lt+o[8]*ft+o[12],u[13]=o[1]*tt+o[5]*lt+o[9]*ft+o[13],u[14]=o[2]*tt+o[6]*lt+o[10]*ft+o[14],u[15]=o[3]*tt+o[7]*lt+o[11]*ft+o[15]):(m=o[1],v=o[2],w=o[3],E=o[4],T=o[5],k=o[6],D=o[7],F=o[8],j=o[9],X=o[10],H=o[11],u[0]=p=o[0],u[1]=m,u[2]=v,u[3]=w,u[4]=E,u[5]=T,u[6]=k,u[7]=D,u[8]=F,u[9]=j,u[10]=X,u[11]=H,u[12]=p*tt+E*lt+F*ft+o[12],u[13]=m*tt+T*lt+j*ft+o[13],u[14]=v*tt+k*lt+X*ft+o[14],u[15]=w*tt+D*lt+H*ft+o[15]),u},a.A=gh,a.B=Ro,a.C=class{constructor(u,o,c){this.receive=p=>{const m=p.data,v=m.id;if(v&&(!m.targetMapId||this.mapId===m.targetMapId))if(m.type===""){delete this.tasks[v];const w=this.cancelCallbacks[v];delete this.cancelCallbacks[v],w&&w()}else oe()||m.mustQueue?(this.tasks[v]=m,this.taskQueue.push(v),this.invoker.trigger()):this.processTask(v,m)},this.process=()=>{if(!this.taskQueue.length)return;const p=this.taskQueue.shift(),m=this.tasks[p];delete this.tasks[p],this.taskQueue.length&&this.invoker.trigger(),m&&this.processTask(p,m)},this.target=u,this.parent=o,this.mapId=c,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new rS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=oe()?u:window}send(u,o,c,p,m=!1){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);c&&(this.callbacks[v]=c);const w=[],E={id:v,type:u,hasCallback:!!c,targetMapId:p,mustQueue:m,sourceMapId:this.mapId,data:tl(o,w)};return this.target.postMessage(E,{transfer:w}),{cancel:()=>{c&&delete this.callbacks[v],this.target.postMessage({id:v,type:"",targetMapId:p,sourceMapId:this.mapId})}}}processTask(u,o){if(o.type===""){const c=this.callbacks[u];delete this.callbacks[u],c&&(o.error?c(mu(o.error)):c(null,mu(o.data)))}else{let c=!1;const p=[],m=o.hasCallback?(E,T)=>{c=!0,delete this.cancelCallbacks[u];const k={id:u,type:"",sourceMapId:this.mapId,error:E?tl(E):null,data:tl(T,p)};this.target.postMessage(k,{transfer:p})}:E=>{c=!0};let v=null;const w=mu(o.data);if(this.parent[o.type])v=this.parent[o.type](o.sourceMapId,w,m);else if("getWorkerSource"in this.parent){const E=o.type.split(".");v=this.parent.getWorkerSource(o.sourceMapId,E[0],w.source)[E[1]](w,m)}else m(new Error(`Could not find function ${o.type}`));!c&&v&&v.cancel&&(this.cancelCallbacks[u]=v.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.D=Re,a.E=Wi,a.F=function(u,o){const c={};for(let p=0;p{}}},a.Y=ae,a.Z=function(){var u=new gh(16);return gh!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},a._=_,a.a=yn,a.a$=class extends W{},a.a0=function(u,o,c){var p=c[0],m=c[1],v=c[2];return u[0]=o[0]*p,u[1]=o[1]*p,u[2]=o[2]*p,u[3]=o[3]*p,u[4]=o[4]*m,u[5]=o[5]*m,u[6]=o[6]*m,u[7]=o[7]*m,u[8]=o[8]*v,u[9]=o[9]*v,u[10]=o[10]*v,u[11]=o[11]*v,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},a.a1=p0,a.a2=function(){return ut++},a.a3=at,a.a4=wh,a.a5=function(){Fo.isLoading()||Fo.isLoaded()||Wf()!=="deferred"||tm()},a.a6=Of,a.a7=hc,a.a8=fi,a.a9=gv,a.aA=oc,a.aB=function(u){u=u.slice();const o=Object.create(null);for(let c=0;c{p[w.source]?c.push({command:In.removeLayer,args:[w.id]}):v.push(w)}),c=c.concat(m),function(w,E,T){E=E||[];const k=(w=w||[]).map(js),D=E.map(js),F=w.reduce(Sa,{}),j=E.reduce(Sa,{}),X=k.slice(),H=Object.create(null);let tt,lt,ft,kt,St,At,Ft;for(tt=0,lt=0;tt@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,m,v)=>{const w=m||v;return o[p]=!w||w.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},a.ab=function(u,o){const c=[];for(const p in u)p in o||c.push(p);return c},a.ac=function(u){if(Ce==null){const o=u.navigator?u.navigator.userAgent:null;Ce=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Ce},a.ad=ht,a.ae=function(u,o,c){var p=Math.sin(c),m=Math.cos(c),v=o[0],w=o[1],E=o[2],T=o[3],k=o[4],D=o[5],F=o[6],j=o[7];return o!==u&&(u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[0]=v*m+k*p,u[1]=w*m+D*p,u[2]=E*m+F*p,u[3]=T*m+j*p,u[4]=k*m-v*p,u[5]=D*m-w*p,u[6]=F*m-E*p,u[7]=j*m-T*p,u},a.af=function(u){var o=new gh(16);return o[0]=u[0],o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=u[6],o[7]=u[7],o[8]=u[8],o[9]=u[9],o[10]=u[10],o[11]=u[11],o[12]=u[12],o[13]=u[13],o[14]=u[14],o[15]=u[15],o},a.ag=cm,a.ah=function(u,o){let c=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:m,minZoom:v,maxZoom:w}=u,E=m?ht(Oo.interpolationFactor(m,o,v,w),0,1):0;u.kind==="camera"?p=Ro.number(u.minSize,u.maxSize,E):c=E}return{uSizeT:c,uSize:p}},a.aj=function(u,{uSize:o,uSizeT:c},{lowerSize:p,upperSize:m}){return u.kind==="source"?p/il:u.kind==="composite"?Ro.number(p/il,m/il,c):o},a.ak=I_,a.al=function(u,o,c,p){const m=o.y-u.y,v=o.x-u.x,w=p.y-c.y,E=p.x-c.x,T=w*v-E*m;if(T===0)return null;const k=(E*(u.y-c.y)-w*(u.x-c.x))/T;return new A(u.x+k*v,u.y+k*m)},a.am=bv,a.an=a0,a.ao=r_,a.ap=mr,a.ar=E_,a.as=function(u,o){var c=o[0],p=o[1],m=o[2],v=o[3],w=o[4],E=o[5],T=o[6],k=o[7],D=o[8],F=o[9],j=o[10],X=o[11],H=o[12],tt=o[13],lt=o[14],ft=o[15],kt=c*E-p*w,St=c*T-m*w,At=c*k-v*w,Ft=p*T-m*E,Jt=p*k-v*E,ye=m*k-v*T,Me=D*tt-F*H,ge=D*lt-j*H,de=D*ft-X*H,le=F*lt-j*tt,we=F*ft-X*tt,ce=j*ft-X*lt,ne=kt*ce-St*we+At*le+Ft*de-Jt*ge+ye*Me;return ne?(u[0]=(E*ce-T*we+k*le)*(ne=1/ne),u[1]=(m*we-p*ce-v*le)*ne,u[2]=(tt*ye-lt*Jt+ft*Ft)*ne,u[3]=(j*Jt-F*ye-X*Ft)*ne,u[4]=(T*de-w*ce-k*ge)*ne,u[5]=(c*ce-m*de+v*ge)*ne,u[6]=(lt*At-H*ye-ft*St)*ne,u[7]=(D*ye-j*At+X*St)*ne,u[8]=(w*we-E*de+k*Me)*ne,u[9]=(p*de-c*we-v*Me)*ne,u[10]=(H*Jt-tt*At+ft*kt)*ne,u[11]=(F*At-D*Jt-X*kt)*ne,u[12]=(E*ge-w*le-T*Me)*ne,u[13]=(c*le-p*ge+m*Me)*ne,u[14]=(tt*St-H*Ft-lt*kt)*ne,u[15]=(D*Ft-F*St+j*kt)*ne,u):null},a.at=N_,a.au=S_,a.av=D_,a.aw=function(){const u={},o=$t.$version;for(const c in $t.$root){const p=$t.$root[c];if(p.required){let m=null;m=c==="version"?o:p.type==="array"?[]:{},m!=null&&(u[c]=m)}}return u},a.ax=In,a.ay=Yd,a.az=hn,a.b=function(u,o){const c=new Blob([new Uint8Array(u)],{type:"image/png"});createImageBitmap(c).then(p=>{o(null,p)}).catch(p=>{o(new Error(`Could not load image because of ${p.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},a.b0=Rr,a.b1=function(u,o){var c=u[0],p=u[1],m=u[2],v=u[3],w=u[4],E=u[5],T=u[6],k=u[7],D=u[8],F=u[9],j=u[10],X=u[11],H=u[12],tt=u[13],lt=u[14],ft=u[15],kt=o[0],St=o[1],At=o[2],Ft=o[3],Jt=o[4],ye=o[5],Me=o[6],ge=o[7],de=o[8],le=o[9],we=o[10],ce=o[11],ne=o[12],Be=o[13],Ae=o[14],dn=o[15];return Math.abs(c-kt)<=wo*Math.max(1,Math.abs(c),Math.abs(kt))&&Math.abs(p-St)<=wo*Math.max(1,Math.abs(p),Math.abs(St))&&Math.abs(m-At)<=wo*Math.max(1,Math.abs(m),Math.abs(At))&&Math.abs(v-Ft)<=wo*Math.max(1,Math.abs(v),Math.abs(Ft))&&Math.abs(w-Jt)<=wo*Math.max(1,Math.abs(w),Math.abs(Jt))&&Math.abs(E-ye)<=wo*Math.max(1,Math.abs(E),Math.abs(ye))&&Math.abs(T-Me)<=wo*Math.max(1,Math.abs(T),Math.abs(Me))&&Math.abs(k-ge)<=wo*Math.max(1,Math.abs(k),Math.abs(ge))&&Math.abs(D-de)<=wo*Math.max(1,Math.abs(D),Math.abs(de))&&Math.abs(F-le)<=wo*Math.max(1,Math.abs(F),Math.abs(le))&&Math.abs(j-we)<=wo*Math.max(1,Math.abs(j),Math.abs(we))&&Math.abs(X-ce)<=wo*Math.max(1,Math.abs(X),Math.abs(ce))&&Math.abs(H-ne)<=wo*Math.max(1,Math.abs(H),Math.abs(ne))&&Math.abs(tt-Be)<=wo*Math.max(1,Math.abs(tt),Math.abs(Be))&&Math.abs(lt-Ae)<=wo*Math.max(1,Math.abs(lt),Math.abs(Ae))&&Math.abs(ft-dn)<=wo*Math.max(1,Math.abs(ft),Math.abs(dn))},a.b2=function(u,o){return u[0]=o[0],u[1]=o[1],u[2]=o[2],u[3]=o[3],u[4]=o[4],u[5]=o[5],u[6]=o[6],u[7]=o[7],u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},a.b3=function(u,o,c){return u[0]=o[0]*c[0],u[1]=o[1]*c[1],u[2]=o[2]*c[2],u[3]=o[3]*c[3],u},a.b4=function(u,o){return u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]*o[3]},a.b5=dt,a.b6=pv,a.b7=cv,a.b8=function(u,o,c,p,m){var v,w=1/Math.tan(o/2);return u[0]=w/c,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=w,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,m!=null&&m!==1/0?(u[10]=(m+p)*(v=1/(p-m)),u[14]=2*m*p*v):(u[10]=-1,u[14]=-2*p),u},a.b9=function(u,o,c){var p=Math.sin(c),m=Math.cos(c),v=o[4],w=o[5],E=o[6],T=o[7],k=o[8],D=o[9],F=o[10],j=o[11];return o!==u&&(u[0]=o[0],u[1]=o[1],u[2]=o[2],u[3]=o[3],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[4]=v*m+k*p,u[5]=w*m+D*p,u[6]=E*m+F*p,u[7]=T*m+j*p,u[8]=k*m-v*p,u[9]=D*m-w*p,u[10]=F*m-E*p,u[11]=j*m-T*p,u},a.bA=S,a.bB=B0,a.bC=ih,a.bD=Fo,a.ba=K,a.bb=nt,a.bc=function(u,o){return u[0]=o[0],u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=o[1],u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=o[2],u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u},a.bd=class extends uc{},a.be=M_,a.bf=hv,a.bg=dS,a.bi=De,a.bj=function(u,o,c=!1){if(bo===Gf||bo===jf||bo===qf)throw new Error("setRTLTextPlugin cannot be called multiple times.");el=qn.resolveURL(u),bo=Gf,Zf=o,$f(),c||tm()},a.bk=Wf,a.bl=function(u,o){const c={};for(let m=0;mne*mr)}let ge=w?"center":c.get("text-justify").evaluate(k,{},u.canonical);const de=c.get("symbol-placement"),le=de==="point"?c.get("text-max-width").evaluate(k,{},u.canonical)*mr:0,we=()=>{u.bucket.allowVerticalPlacement&&Bf(At)&&(H.vertical=_m(tt,u.glyphMap,u.glyphPositions,u.imagePositions,D,le,v,ye,"left",Jt,ft,a.ai.vertical,!0,de,j,F))};if(!w&&Me){const ce=new Set;if(ge==="auto")for(let Be=0;Be{o(null,c),URL.revokeObjectURL(c.src),c.onload=null,window.requestAnimationFrame(()=>{c.src=jn})},c.onerror=()=>o(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 p=new Blob([new Uint8Array(u)],{type:"image/png"});c.src=u.byteLength?URL.createObjectURL(p):jn},a.e=gt,a.f=function(u,o){return wn(gt(u,{type:"json"}),o)},a.g=On,a.h=qn,a.i=oe,a.j=pn,a.k=Wn,a.l=_t,a.m=wn,a.n=function(u){return new v_(u).readFields(j2,[])},a.o=function(u,o,c){if(!u.length)return c(null,[]);let p=u.length;const m=new Array(u.length);let v=null;u.forEach((w,E)=>{o(w,(T,k)=>{T&&(v=T),m[E]=k,--p==0&&c(v,m)})})},a.p=W0,a.q=sp,a.r=Xi,a.s=Ee,a.t=Hg,a.u=_e,a.v=$t,a.w=Nt,a.x=ch,a.y=La,a.z=function([u,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(c),y:u*Math.sin(o)*Math.sin(c),z:u*Math.cos(c)}}}),l(["./shared"],function(a){class _{constructor(G){this.keyCache={},G&&this.replace(G)}replace(G){this._layerConfigs={},this._layers={},this.update(G,[])}update(G,q){for(const Z of G){this._layerConfigs[Z.id]=Z;const ot=this._layers[Z.id]=a.aC(Z);ot._featureFilter=a.a6(ot.filter),this.keyCache[Z.id]&&delete this.keyCache[Z.id]}for(const Z of q)delete this.keyCache[Z],delete this._layerConfigs[Z],delete this._layers[Z];this.familiesBySource={};const J=a.bl(Object.values(this._layerConfigs),this.keyCache);for(const Z of J){const ot=Z.map(Ht=>this._layers[Ht.id]),Mt=ot[0];if(Mt.visibility==="none")continue;const vt=Mt.source||"";let rt=this.familiesBySource[vt];rt||(rt=this.familiesBySource[vt]={});const Tt=Mt.sourceLayer||"_geojsonTileLayer";let Wt=rt[Tt];Wt||(Wt=rt[Tt]=[]),Wt.push(ot)}}}class x{constructor(G){const q={},J=[];for(const vt in G){const rt=G[vt],Tt=q[vt]={};for(const Wt in rt){const Ht=rt[+Wt];if(!Ht||Ht.bitmap.width===0||Ht.bitmap.height===0)continue;const Kt={x:0,y:0,w:Ht.bitmap.width+2,h:Ht.bitmap.height+2};J.push(Kt),Tt[Wt]={rect:Kt,metrics:Ht.metrics}}}const{w:Z,h:ot}=a.p(J),Mt=new a.q({width:Z||1,height:ot||1});for(const vt in G){const rt=G[vt];for(const Tt in rt){const Wt=rt[+Tt];if(!Wt||Wt.bitmap.width===0||Wt.bitmap.height===0)continue;const Ht=q[vt][Tt].rect;a.q.copy(Wt.bitmap,Mt,{x:0,y:0},{x:Ht.x+1,y:Ht.y+1},Wt.bitmap)}}this.image=Mt,this.positions=q}}a.bm("GlyphAtlas",x);class S{constructor(G){this.tileID=new a.O(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(G,q,J,Z,ot){this.status="parsing",this.data=G,this.collisionBoxArray=new a.a3;const Mt=new a.bn(Object.keys(G.layers).sort()),vt=new a.bo(this.tileID,this.promoteId);vt.bucketLayerIDs=[];const rt={},Tt={featureIndex:vt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Wt=q.familiesBySource[this.source];for(const kn in Wt){const Pn=G.layers[kn];if(!Pn)continue;Pn.version===1&&a.w(`Vector tile source "${this.source}" layer "${kn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qr=Mt.encode(kn),oi=[];for(let ir=0;ir=Nr.maxzoom||Nr.visibility!=="none"&&(L(ir,this.zoom,J),(rt[Nr.id]=Nr.createBucket({index:vt.bucketLayerIDs.length,layers:ir,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qr,sourceID:this.source})).populate(oi,Tt,this.tileID.canonical),vt.bucketLayerIDs.push(ir.map(rs=>rs.id)))}}let Ht,Kt,Ne,Ye;const Te=a.aH(Tt.glyphDependencies,kn=>Object.keys(kn).map(Number));this.inFlightDependencies.forEach(kn=>kn==null?void 0:kn.cancel()),this.inFlightDependencies=[];const Ve=++this.dependencySentinel;Object.keys(Te).length?this.inFlightDependencies.push(Z.send("getGlyphs",{uid:this.uid,stacks:Te,source:this.source,tileID:this.tileID,type:"glyphs"},(kn,Pn)=>{Ve===this.dependencySentinel&&(Ht||(Ht=kn,Kt=Pn,Jn.call(this)))})):Kt={};const rn=Object.keys(Tt.iconDependencies);rn.length?this.inFlightDependencies.push(Z.send("getImages",{icons:rn,source:this.source,tileID:this.tileID,type:"icons"},(kn,Pn)=>{Ve===this.dependencySentinel&&(Ht||(Ht=kn,Ne=Pn,Jn.call(this)))})):Ne={};const Gn=Object.keys(Tt.patternDependencies);function Jn(){if(Ht)return ot(Ht);if(Kt&&Ne&&Ye){const kn=new x(Kt),Pn=new a.bp(Ne,Ye);for(const qr in rt){const oi=rt[qr];oi instanceof a.a4?(L(oi.layers,this.zoom,J),a.bq({bucket:oi,glyphMap:Kt,glyphPositions:kn.positions,imageMap:Ne,imagePositions:Pn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):oi.hasPattern&&(oi instanceof a.br||oi instanceof a.bs||oi instanceof a.bt)&&(L(oi.layers,this.zoom,J),oi.addFeatures(Tt,this.tileID.canonical,Pn.patternPositions))}this.status="done",ot(null,{buckets:Object.values(rt).filter(qr=>!qr.isEmpty()),featureIndex:vt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:kn.image,imageAtlas:Pn,glyphMap:this.returnDependencies?Kt:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?kn.positions:null})}}Gn.length?this.inFlightDependencies.push(Z.send("getImages",{icons:Gn,source:this.source,tileID:this.tileID,type:"patterns"},(kn,Pn)=>{Ve===this.dependencySentinel&&(Ht||(Ht=kn,Ye=Pn,Jn.call(this)))})):Ye={},Jn.call(this)}}function L(st,G,q){const J=new a.a8(G);for(const Z of st)Z.recalculate(J,q)}function A(st,G){const q=a.l(st.request,(J,Z,ot,Mt)=>{if(J)G(J);else if(Z)try{const vt=new a.bw.VectorTile(new a.bv(Z));G(null,{vectorTile:vt,rawData:Z,cacheControl:ot,expires:Mt})}catch(vt){const rt=new Uint8Array(Z);let Tt=`Unable to parse the tile at ${st.request.url}, `;Tt+=rt[0]===31&&rt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${vt.messge}`,G(new Error(Tt))}});return()=>{q.cancel(),G()}}class P{constructor(G,q,J,Z){this.actor=G,this.layerIndex=q,this.availableImages=J,this.loadVectorData=Z||A,this.fetching={},this.loading={},this.loaded={}}loadTile(G,q){const J=G.uid;this.loading||(this.loading={});const Z=!!(G&&G.request&&G.request.collectResourceTiming)&&new a.bu(G.request),ot=this.loading[J]=new S(G);ot.abort=this.loadVectorData(G,(Mt,vt)=>{if(delete this.loading[J],Mt||!vt)return ot.status="done",this.loaded[J]=ot,q(Mt);const rt=vt.rawData,Tt={};vt.expires&&(Tt.expires=vt.expires),vt.cacheControl&&(Tt.cacheControl=vt.cacheControl);const Wt={};if(Z){const Ht=Z.finish();Ht&&(Wt.resourceTiming=JSON.parse(JSON.stringify(Ht)))}ot.vectorTile=vt.vectorTile,ot.parse(vt.vectorTile,this.layerIndex,this.availableImages,this.actor,(Ht,Kt)=>{if(delete this.fetching[J],Ht||!Kt)return q(Ht);q(null,a.e({rawTileData:rt.slice(0)},Kt,Tt,Wt))}),this.loaded=this.loaded||{},this.loaded[J]=ot,this.fetching[J]={rawTileData:rt,cacheControl:Tt,resourceTiming:Wt}})}reloadTile(G,q){const J=this.loaded,Z=G.uid;if(J&&J[Z]){const ot=J[Z];ot.showCollisionBoxes=G.showCollisionBoxes,ot.status==="parsing"?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,(Mt,vt)=>{if(Mt||!vt)return q(Mt,vt);let rt;if(this.fetching[Z]){const{rawTileData:Tt,cacheControl:Wt,resourceTiming:Ht}=this.fetching[Z];delete this.fetching[Z],rt=a.e({rawTileData:Tt.slice(0)},vt,Wt,Ht)}else rt=vt;q(null,rt)}):ot.status==="done"&&(ot.vectorTile?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,q):q())}}abortTile(G,q){const J=this.loading,Z=G.uid;J&&J[Z]&&J[Z].abort&&(J[Z].abort(),delete J[Z]),q()}removeTile(G,q){const J=this.loaded,Z=G.uid;J&&J[Z]&&delete J[Z],q()}}class O{constructor(){this.loaded={}}loadTile(G,q){return a._(this,void 0,void 0,function*(){const{uid:J,encoding:Z,rawImageData:ot,redFactor:Mt,greenFactor:vt,blueFactor:rt,baseShift:Tt}=G,Wt=ot.width+2,Ht=ot.height+2,Kt=a.a(ot)?new a.R({width:Wt,height:Ht},yield a.bx(ot,-1,-1,Wt,Ht)):ot,Ne=new a.by(J,Kt,Z,Mt,vt,rt,Tt);this.loaded=this.loaded||{},this.loaded[J]=Ne,q(null,Ne)})}removeTile(G){const q=this.loaded,J=G.uid;q&&q[J]&&delete q[J]}}function B(st,G){if(st.length!==0){U(st[0],G);for(var q=1;q=Math.abs(vt)?q-rt+vt:vt-rt+q,q=rt}q+J>=0!=!!G&&st.reverse()}var Y=a.bz(function st(G,q){var J,Z=G&&G.type;if(Z==="FeatureCollection")for(J=0;J>31}function oe(st,G){for(var q=st.loadGeometry(),J=st.type,Z=0,ot=0,Mt=q.length,vt=0;vtst},Qe=Math.fround||(Fe=new Float32Array(1),st=>(Fe[0]=+st,Fe[0]));var Fe;const ke=3,fn=5,Kn=6;class qn{constructor(G){this.options=Object.assign(Object.create(jn),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:q,minZoom:J,maxZoom:Z}=this.options;q&&console.time("total time");const ot=`prepare ${G.length} points`;q&&console.time(ot),this.points=G;const Mt=[];for(let rt=0;rt=J;rt--){const Tt=+Date.now();vt=this.trees[rt]=this._createTree(this._cluster(vt,rt)),q&&console.log("z%d: %d clusters in %dms",rt,vt.numItems,+Date.now()-Tt)}return q&&console.timeEnd("total time"),this}getClusters(G,q){let J=((G[0]+180)%360+360)%360-180;const Z=Math.max(-90,Math.min(90,G[1]));let ot=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Mt=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)J=-180,ot=180;else if(J>ot){const Ht=this.getClusters([J,Z,180,Mt],q),Kt=this.getClusters([-180,Z,ot,Mt],q);return Ht.concat(Kt)}const vt=this.trees[this._limitZoom(q)],rt=vt.range(hn(J),On(Mt),hn(ot),On(Z)),Tt=vt.data,Wt=[];for(const Ht of rt){const Kt=this.stride*Ht;Wt.push(Tt[Kt+fn]>1?ie(Tt,Kt,this.clusterProps):this.points[Tt[Kt+ke]])}return Wt}getChildren(G){const q=this._getOriginId(G),J=this._getOriginZoom(G),Z="No cluster with the specified id.",ot=this.trees[J];if(!ot)throw new Error(Z);const Mt=ot.data;if(q*this.stride>=Mt.length)throw new Error(Z);const vt=this.options.radius/(this.options.extent*Math.pow(2,J-1)),rt=ot.within(Mt[q*this.stride],Mt[q*this.stride+1],vt),Tt=[];for(const Wt of rt){const Ht=Wt*this.stride;Mt[Ht+4]===G&&Tt.push(Mt[Ht+fn]>1?ie(Mt,Ht,this.clusterProps):this.points[Mt[Ht+ke]])}if(Tt.length===0)throw new Error(Z);return Tt}getLeaves(G,q,J){const Z=[];return this._appendLeaves(Z,G,q=q||10,J=J||0,0),Z}getTile(G,q,J){const Z=this.trees[this._limitZoom(G)],ot=Math.pow(2,G),{extent:Mt,radius:vt}=this.options,rt=vt/Mt,Tt=(J-rt)/ot,Wt=(J+1+rt)/ot,Ht={features:[]};return this._addTileFeatures(Z.range((q-rt)/ot,Tt,(q+1+rt)/ot,Wt),Z.data,q,J,ot,Ht),q===0&&this._addTileFeatures(Z.range(1-rt/ot,Tt,1,Wt),Z.data,ot,J,ot,Ht),q===ot-1&&this._addTileFeatures(Z.range(0,Tt,rt/ot,Wt),Z.data,-1,J,ot,Ht),Ht.features.length?Ht:null}getClusterExpansionZoom(G){let q=this._getOriginZoom(G)-1;for(;q<=this.options.maxZoom;){const J=this.getChildren(G);if(q++,J.length!==1)break;G=J[0].properties.cluster_id}return q}_appendLeaves(G,q,J,Z,ot){const Mt=this.getChildren(q);for(const vt of Mt){const rt=vt.properties;if(rt&&rt.cluster?ot+rt.point_count<=Z?ot+=rt.point_count:ot=this._appendLeaves(G,rt.cluster_id,J,Z,ot):ot1;let Wt,Ht,Kt;if(Tt)Wt=De(q,rt,this.clusterProps),Ht=q[rt],Kt=q[rt+1];else{const Te=this.points[q[rt+ke]];Wt=Te.properties;const[Ve,rn]=Te.geometry.coordinates;Ht=hn(Ve),Kt=On(rn)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(Ht*ot-J)),Math.round(this.options.extent*(Kt*ot-Z))]],tags:Wt};let Ye;Ye=Tt||this.options.generateId?q[rt+ke]:this.points[q[rt+ke]].id,Ye!==void 0&&(Ne.id=Ye),Mt.features.push(Ne)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,q){const{radius:J,extent:Z,reduce:ot,minPoints:Mt}=this.options,vt=J/(Z*Math.pow(2,q)),rt=G.data,Tt=[],Wt=this.stride;for(let Ht=0;Htq&&(Ve+=rt[Gn+fn])}if(Ve>Te&&Ve>=Mt){let rn,Gn=Kt*Te,Jn=Ne*Te,kn=-1;const Pn=((Ht/Wt|0)<<5)+(q+1)+this.points.length;for(const qr of Ye){const oi=qr*Wt;if(rt[oi+2]<=q)continue;rt[oi+2]=q;const ir=rt[oi+fn];Gn+=rt[oi]*ir,Jn+=rt[oi+1]*ir,rt[oi+4]=Pn,ot&&(rn||(rn=this._map(rt,Ht,!0),kn=this.clusterProps.length,this.clusterProps.push(rn)),ot(rn,this._map(rt,oi)))}rt[Ht+4]=Pn,Tt.push(Gn/Ve,Jn/Ve,1/0,Pn,-1,Ve),ot&&Tt.push(kn)}else{for(let rn=0;rn1)for(const rn of Ye){const Gn=rn*Wt;if(!(rt[Gn+2]<=q)){rt[Gn+2]=q;for(let Jn=0;Jn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,q,J){if(G[q+fn]>1){const Mt=this.clusterProps[G[q+Kn]];return J?Object.assign({},Mt):Mt}const Z=this.points[G[q+ke]].properties,ot=this.options.map(Z);return J&&ot===Z?Object.assign({},ot):ot}}function ie(st,G,q){return{type:"Feature",id:st[G+ke],properties:De(st,G,q),geometry:{type:"Point",coordinates:[(J=st[G],360*(J-.5)),_i(st[G+1])]}};var J}function De(st,G,q){const J=st[G+fn],Z=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,ot=st[G+Kn],Mt=ot===-1?{}:Object.assign({},q[ot]);return Object.assign(Mt,{cluster:!0,cluster_id:st[G+ke],point_count:J,point_count_abbreviated:Z})}function hn(st){return st/360+.5}function On(st){const G=Math.sin(st*Math.PI/180),q=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return q<0?0:q>1?1:q}function _i(st){const G=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function wn(st,G,q,J){for(var Z,ot=J,Mt=q-G>>1,vt=q-G,rt=st[G],Tt=st[G+1],Wt=st[q],Ht=st[q+1],Kt=G+3;Ktot)Z=Kt,ot=Ne;else if(Ne===ot){var Ye=Math.abs(Kt-Mt);YeJ&&(Z-G>3&&wn(st,G,Z,J),st[Z+2]=ot,q-Z>3&&wn(st,Z,q,J))}function _t(st,G,q,J,Z,ot){var Mt=Z-q,vt=ot-J;if(Mt!==0||vt!==0){var rt=((st-q)*Mt+(G-J)*vt)/(Mt*Mt+vt*vt);rt>1?(q=Z,J=ot):rt>0&&(q+=Mt*rt,J+=vt*rt)}return(Mt=st-q)*Mt+(vt=G-J)*vt}function Ee(st,G,q,J){var Z={id:st===void 0?null:st,type:G,geometry:q,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(ot){var Mt=ot.geometry,vt=ot.type;if(vt==="Point"||vt==="MultiPoint"||vt==="LineString")qe(ot,Mt);else if(vt==="Polygon"||vt==="MultiLineString")for(var rt=0;rt0&&(Mt+=J?(Z*Tt-rt*ot)/2:Math.sqrt(Math.pow(rt-Z,2)+Math.pow(Tt-ot,2))),Z=rt,ot=Tt}var Wt=G.length-3;G[2]=1,wn(G,0,Wt,q),G[Wt+2]=1,G.size=Math.abs(Mt),G.start=0,G.end=G.size}function Wi(st,G,q,J){for(var Z=0;Z1?1:q}function fr(st,G,q,J,Z,ot,Mt,vt){if(J/=G,ot>=(q/=G)&&Mt=J)return null;for(var rt=[],Tt=0;Tt=q&&Ye=J)){var Te=[];if(Kt==="Point"||Kt==="MultiPoint")zn(Ht,Te,q,J,Z);else if(Kt==="LineString")In(Ht,Te,q,J,Z,!1,vt.lineMetrics);else if(Kt==="MultiLineString")oo(Ht,Te,q,J,Z,!1);else if(Kt==="Polygon")oo(Ht,Te,q,J,Z,!0);else if(Kt==="MultiPolygon")for(var Ve=0;Ve=q&&Mt<=J&&(G.push(st[ot]),G.push(st[ot+1]),G.push(st[ot+2]))}}function In(st,G,q,J,Z,ot,Mt){for(var vt,rt,Tt=es(st),Wt=Z===0?Ha:Gs,Ht=st.start,Kt=0;Ktq&&(rt=Wt(Tt,Ne,Ye,Ve,rn,q),Mt&&(Tt.start=Ht+vt*rt)):Gn>J?Jn=q&&(rt=Wt(Tt,Ne,Ye,Ve,rn,q),kn=!0),Jn>J&&Gn<=J&&(rt=Wt(Tt,Ne,Ye,Ve,rn,J),kn=!0),!ot&&kn&&(Mt&&(Tt.end=Ht+vt*rt),G.push(Tt),Tt=es(st)),Mt&&(Ht+=vt)}var Pn=st.length-3;Ne=st[Pn],Ye=st[Pn+1],Te=st[Pn+2],(Gn=Z===0?Ne:Ye)>=q&&Gn<=J&&ns(Tt,Ne,Ye,Te),Pn=Tt.length-3,ot&&Pn>=3&&(Tt[Pn]!==Tt[0]||Tt[Pn+1]!==Tt[1])&&ns(Tt,Tt[0],Tt[1],Tt[2]),Tt.length&&G.push(Tt)}function es(st){var G=[];return G.size=st.size,G.start=st.start,G.end=st.end,G}function oo(st,G,q,J,Z,ot){for(var Mt=0;MtMt.maxX&&(Mt.maxX=Wt),Ht>Mt.maxY&&(Mt.maxY=Ht)}return Mt}function Ea(st,G,q,J){var Z=G.geometry,ot=G.type,Mt=[];if(ot==="Point"||ot==="MultiPoint")for(var vt=0;vt0&&G.size<(Z?Mt:J))q.numPoints+=G.length/3;else{for(var vt=[],rt=0;rtMt)&&(q.numSimplified++,vt.push(G[rt]),vt.push(G[rt+1])),q.numPoints++;Z&&function(Tt,Wt){for(var Ht=0,Kt=0,Ne=Tt.length,Ye=Ne-2;Kt0===Wt)for(Kt=0,Ne=Tt.length;Kt24)throw new Error("maxZoom should be in the 0-24 range");if(G.promoteId&&G.generateId)throw new Error("promoteId and generateId cannot be used together.");var J=function(Z,ot){var Mt=[];if(Z.type==="FeatureCollection")for(var vt=0;vt1&&console.time("creation"),Kt=this.tiles[Ht]=ri(st,G,q,J,rt),this.tileCoords.push({z:G,x:q,y:J}),Tt)){Tt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",G,q,J,Kt.numFeatures,Kt.numPoints,Kt.numSimplified),console.timeEnd("creation"));var Ne="z"+G;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(Kt.source=st,Z){if(G===rt.maxZoom||G===Z)continue;var Ye=1<1&&console.time("clipping");var Te,Ve,rn,Gn,Jn,kn,Pn=.5*rt.buffer/rt.extent,qr=.5-Pn,oi=.5+Pn,ir=1+Pn;Te=Ve=rn=Gn=null,Jn=fr(st,Wt,q-Pn,q+oi,0,Kt.minX,Kt.maxX,rt),kn=fr(st,Wt,q+qr,q+ir,0,Kt.minX,Kt.maxX,rt),st=null,Jn&&(Te=fr(Jn,Wt,J-Pn,J+oi,1,Kt.minY,Kt.maxY,rt),Ve=fr(Jn,Wt,J+qr,J+ir,1,Kt.minY,Kt.maxY,rt),Jn=null),kn&&(rn=fr(kn,Wt,J-Pn,J+oi,1,Kt.minY,Kt.maxY,rt),Gn=fr(kn,Wt,J+qr,J+ir,1,Kt.minY,Kt.maxY,rt),kn=null),Tt>1&&console.timeEnd("clipping"),vt.push(Te||[],G+1,2*q,2*J),vt.push(Ve||[],G+1,2*q,2*J+1),vt.push(rn||[],G+1,2*q+1,2*J),vt.push(Gn||[],G+1,2*q+1,2*J+1)}}},ue.prototype.getTile=function(st,G,q){var J=this.options,Z=J.extent,ot=J.debug;if(st<0||st>24)return null;var Mt=1<1&&console.log("drilling down to z%d-%d-%d",st,G,q);for(var rt,Tt=st,Wt=G,Ht=q;!rt&&Tt>0;)Tt--,Wt=Math.floor(Wt/2),Ht=Math.floor(Ht/2),rt=this.tiles[ln(Tt,Wt,Ht)];return rt&&rt.source?(ot>1&&console.log("found parent tile z%d-%d-%d",Tt,Wt,Ht),ot>1&&console.time("drilling down"),this.splitTile(rt.source,Tt,Wt,Ht,st,G,q),ot>1&&console.timeEnd("drilling down"),this.tiles[vt]?ae(this.tiles[vt],Z):null):null};class on extends P{constructor(G,q,J,Z){super(G,q,J),this._dataUpdateable=new Map,this.loadGeoJSON=(ot,Mt)=>{const{promoteId:vt}=ot;if(ot.request)return a.f(ot.request,(rt,Tt,Wt,Ht)=>{this._dataUpdateable=Ar(Tt,vt)?is(Tt,vt):void 0,Mt(rt,Tt,Wt,Ht)});if(typeof ot.data=="string")try{const rt=JSON.parse(ot.data);this._dataUpdateable=Ar(rt,vt)?is(rt,vt):void 0,Mt(null,rt)}catch{Mt(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`))}else ot.dataDiff?this._dataUpdateable?(function(rt,Tt,Wt){var Ht,Kt,Ne,Ye;if(Tt.removeAll&&rt.clear(),Tt.remove)for(const Te of Tt.remove)rt.delete(Te);if(Tt.add)for(const Te of Tt.add){const Ve=Ke(Te,Wt);Ve!=null&&rt.set(Ve,Te)}if(Tt.update)for(const Te of Tt.update){let Ve=rt.get(Te.id);if(Ve==null)continue;const rn=!Te.removeAllProperties&&(((Ht=Te.removeProperties)===null||Ht===void 0?void 0:Ht.length)>0||((Kt=Te.addOrUpdateProperties)===null||Kt===void 0?void 0:Kt.length)>0);if((Te.newGeometry||Te.removeAllProperties||rn)&&(Ve=Object.assign({},Ve),rt.set(Te.id,Ve),rn&&(Ve.properties=Object.assign({},Ve.properties))),Te.newGeometry&&(Ve.geometry=Te.newGeometry),Te.removeAllProperties)Ve.properties={};else if(((Ne=Te.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const Gn of Te.removeProperties)Object.prototype.hasOwnProperty.call(Ve.properties,Gn)&&delete Ve.properties[Gn];if(((Ye=Te.addOrUpdateProperties)===null||Ye===void 0?void 0:Ye.length)>0)for(const{key:Gn,value:Jn}of Te.addOrUpdateProperties)Ve.properties[Gn]=Jn}}(this._dataUpdateable,ot.dataDiff,vt),Mt(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):Mt(new Error(`Cannot update existing geojson data in ${ot.source}`)):Mt(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,Z&&(this.loadGeoJSON=Z)}loadGeoJSONTile(G,q){const J=G.tileID.canonical;if(!this._geoJSONIndex)return q(null,null);const Z=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!Z)return q(null,null);const ot=new class{constructor(vt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.N,this.length=vt.length,this._features=vt}feature(vt){return new class{constructor(rt){this._feature=rt,this.extent=a.N,this.type=rt.type,this.properties=rt.tags,"id"in rt&&!isNaN(rt.id)&&(this.id=parseInt(rt.id,10))}loadGeometry(){if(this._feature.type===1){const rt=[];for(const Tt of this._feature.geometry)rt.push([new a.P(Tt[0],Tt[1])]);return rt}{const rt=[];for(const Tt of this._feature.geometry){const Wt=[];for(const Ht of Tt)Wt.push(new a.P(Ht[0],Ht[1]));rt.push(Wt)}return rt}}toGeoJSON(rt,Tt,Wt){return V.call(this,rt,Tt,Wt)}}(this._features[vt])}}(Z.features);let Mt=yn(ot);Mt.byteOffset===0&&Mt.byteLength===Mt.buffer.byteLength||(Mt=new Uint8Array(Mt)),q(null,{vectorTile:ot,rawData:Mt.buffer})}loadData(G,q){var J;(J=this._pendingRequest)===null||J===void 0||J.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Z=!!(G&&G.request&&G.request.collectResourceTiming)&&new a.bu(G.request);this._pendingCallback=q,this._pendingRequest=this.loadGeoJSON(G,(ot,Mt)=>{if(delete this._pendingCallback,delete this._pendingRequest,ot||!Mt)return q(ot);if(typeof Mt!="object")return q(new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`));{Y(Mt,!0);try{if(G.filter){const rt=a.bC(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(Wt=>`${Wt.key}: ${Wt.message}`).join(", "));Mt={type:"FeatureCollection",features:Mt.features.filter(Wt=>rt.value.evaluate({zoom:0},Wt))}}this._geoJSONIndex=G.cluster?new qn(function({superclusterOptions:rt,clusterProperties:Tt}){if(!Tt||!rt)return rt;const Wt={},Ht={},Kt={accumulated:null,zoom:0},Ne={properties:null},Ye=Object.keys(Tt);for(const Te of Ye){const[Ve,rn]=Tt[Te],Gn=a.bC(rn),Jn=a.bC(typeof Ve=="string"?[Ve,["accumulated"],["get",Te]]:Ve);Wt[Te]=Gn.value,Ht[Te]=Jn.value}return rt.map=Te=>{Ne.properties=Te;const Ve={};for(const rn of Ye)Ve[rn]=Wt[rn].evaluate(Kt,Ne);return Ve},rt.reduce=(Te,Ve)=>{Ne.properties=Ve;for(const rn of Ye)Kt.accumulated=Te[rn],Te[rn]=Ht[rn].evaluate(Kt,Ne)},rt}(G)).load(Mt.features):function(rt,Tt){return new ue(rt,Tt)}(Mt,G.geojsonVtOptions)}catch(rt){return q(rt)}this.loaded={};const vt={};if(Z){const rt=Z.finish();rt&&(vt.resourceTiming={},vt.resourceTiming[G.source]=JSON.parse(JSON.stringify(rt)))}q(null,vt)}})}reloadTile(G,q){const J=this.loaded;return J&&J[G.uid]?super.reloadTile(G,q):this.loadTile(G,q)}removeSource(G,q){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),q()}getClusterExpansionZoom(G,q){try{q(null,this._geoJSONIndex.getClusterExpansionZoom(G.clusterId))}catch(J){q(J)}}getClusterChildren(G,q){try{q(null,this._geoJSONIndex.getChildren(G.clusterId))}catch(J){q(J)}}getClusterLeaves(G,q){try{q(null,this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset))}catch(J){q(J)}}}class Ss{constructor(G){this.self=G,this.actor=new a.C(G,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:P,geojson:on},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(q,J)=>{if(this.workerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.workerSourceTypes[q]=J},this.self.registerRTLTextPlugin=q=>{if(a.bD.isParsed())throw new Error("RTL text plugin already registered.");a.bD.applyArabicShaping=q.applyArabicShaping,a.bD.processBidirectionalText=q.processBidirectionalText,a.bD.processStyledBidirectionalText=q.processStyledBidirectionalText}}setReferrer(G,q){this.referrer=q}setImages(G,q,J){this.availableImages[G]=q;for(const Z in this.workerSources[G]){const ot=this.workerSources[G][Z];for(const Mt in ot)ot[Mt].availableImages=q}J()}setLayers(G,q,J){this.getLayerIndex(G).replace(q),J()}updateLayers(G,q,J){this.getLayerIndex(G).update(q.layers,q.removedIds),J()}loadTile(G,q,J){this.getWorkerSource(G,q.type,q.source).loadTile(q,J)}loadDEMTile(G,q,J){this.getDEMWorkerSource(G,q.source).loadTile(q,J)}reloadTile(G,q,J){this.getWorkerSource(G,q.type,q.source).reloadTile(q,J)}abortTile(G,q,J){this.getWorkerSource(G,q.type,q.source).abortTile(q,J)}removeTile(G,q,J){this.getWorkerSource(G,q.type,q.source).removeTile(q,J)}removeDEMTile(G,q){this.getDEMWorkerSource(G,q.source).removeTile(q)}removeSource(G,q,J){if(!this.workerSources[G]||!this.workerSources[G][q.type]||!this.workerSources[G][q.type][q.source])return;const Z=this.workerSources[G][q.type][q.source];delete this.workerSources[G][q.type][q.source],Z.removeSource!==void 0?Z.removeSource(q,J):J()}loadWorkerSource(G,q,J){try{this.self.importScripts(q.url),J()}catch(Z){J(Z.toString())}}syncRTLPluginState(G,q,J){try{a.bD.setState(q);const Z=a.bD.getPluginURL();if(a.bD.isLoaded()&&!a.bD.isParsed()&&Z!=null){this.self.importScripts(Z);const ot=a.bD.isParsed();J(ot?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Z}`),ot)}}catch(Z){J(Z.toString())}}getAvailableImages(G){let q=this.availableImages[G];return q||(q=[]),q}getLayerIndex(G){let q=this.layerIndexes[G];return q||(q=this.layerIndexes[G]=new _),q}getWorkerSource(G,q,J){return this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][q]||(this.workerSources[G][q]={}),this.workerSources[G][q][J]||(this.workerSources[G][q][J]=new this.workerSourceTypes[q]({send:(Z,ot,Mt)=>{this.actor.send(Z,ot,Mt,G)}},this.getLayerIndex(G),this.getAvailableImages(G))),this.workerSources[G][q][J]}getDEMWorkerSource(G,q){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][q]||(this.demWorkerSources[G][q]=new O),this.demWorkerSources[G][q]}}return a.i()&&(self.worker=new Ss(self)),Ss}),l(["./shared"],function(a){var _="3.6.2";class x{static testProp(s){if(!x.docStyle)return s[0];for(let h=0;h{window.removeEventListener("click",x.suppressClickInternal,!0)},0)}static mousePos(s,h){const d=s.getBoundingClientRect();return new a.P(h.clientX-d.left-s.clientLeft,h.clientY-d.top-s.clientTop)}static touchPos(s,h){const d=s.getBoundingClientRect(),g=[];for(let b=0;b{s=[],h=0,d=0,g={}},y.addThrottleControl=N=>{const R=d++;return g[R]=N,R},y.removeThrottleControl=N=>{delete g[N],C()},y.getImage=(N,R,z=!0)=>{S.supported&&(N.headers||(N.headers={}),N.headers.accept="image/webp,*/*");const W={requestParameters:N,supportImageRefresh:z,callback:R,cancelled:!1,completed:!1,cancel:()=>{W.completed||W.cancelled||(W.cancelled=!0,W.innerRequest&&(W.innerRequest.cancel(),h--),C())}};return s.push(W),C(),W};const b=N=>{const{requestParameters:R,supportImageRefresh:z,callback:W}=N;return a.e(R,{type:"image"}),(z!==!1||a.i()||a.g(R.url)||R.headers&&!Object.keys(R.headers).reduce((it,et)=>it&&et==="accept",!0)?a.m:M)(R,(it,et,at,Q)=>{I(N,W,it,et,at,Q)})},I=(N,R,z,W,it,et)=>{z?R(z):W instanceof HTMLImageElement||a.a(W)?R(null,W):W&&((at,Q)=>{typeof createImageBitmap=="function"?a.b(at,Q):a.d(at,Q)})(W,(at,Q)=>{at!=null?R(at):Q!=null&&R(null,Q,{cacheControl:it,expires:et})}),N.cancelled||(N.completed=!0,h--,C())},C=()=>{const N=(()=>{const R=Object.keys(g);let z=!1;if(R.length>0){for(const W of R)if(z=g[W](),z)break}return z})()?a.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=h;R0;R++){const z=s.shift();if(z.cancelled){R--;continue}const W=b(z);h++,z.innerRequest=W}},M=(N,R)=>{const z=new Image,W=N.url;let it=!1;const et=N.credentials;return et&&et==="include"?z.crossOrigin="use-credentials":(et&&et==="same-origin"||!a.s(W))&&(z.crossOrigin="anonymous"),z.fetchPriority="high",z.onload=()=>{R(null,z),z.onerror=z.onload=null},z.onerror=()=>{it||R(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.")),z.onerror=z.onload=null},z.src=W,{cancel:()=>{it=!0,z.src=""}}}}(U||(U={})),U.resetRequestQueue(),function(y){y.Glyphs="Glyphs",y.Image="Image",y.Source="Source",y.SpriteImage="SpriteImage",y.SpriteJSON="SpriteJSON",y.Style="Style",y.Tile="Tile",y.Unknown="Unknown"}(Y||(Y={}));class V{constructor(s){this._transformRequestFn=s}transformRequest(s,h){return this._transformRequestFn&&this._transformRequestFn(s,h)||{url:s}}normalizeSpriteURL(s,h,d){const g=function(b){const I=b.match($);if(!I)throw new Error(`Unable to parse URL "${b}"`);return{protocol:I[1],authority:I[2],path:I[3]||"/",params:I[4]?I[4].split("&"):[]}}(s);return g.path+=`${h}${d}`,function(b){const I=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${I}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const $=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function K(y){var s=new a.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var nt,ht=function(y,s,h){return y[0]=s[0]-h[0],y[1]=s[1]-h[1],y[2]=s[2]-h[2],y};nt=new a.A(3),a.A!=Float32Array&&(nt[0]=0,nt[1]=0,nt[2]=0);var dt=function(y){var s=y[0],h=y[1];return s*s+h*h};function gt(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const h=[];for(const{id:d,url:g}of y){const b=`${d}${g}`;h.indexOf(b)===-1&&(h.push(b),s.push({id:d,url:g}))}}return s}function ut(y,s,h,d,g){if(d)return void y(d);if(g!==Object.values(s).length||g!==Object.values(h).length)return;const b={};for(const I in s){b[I]={};const C=a.h.getImageCanvasContext(h[I]),M=s[I];for(const N in M){const{width:R,height:z,x:W,y:it,sdf:et,pixelRatio:at,stretchX:Q,stretchY:Lt,content:Ot}=M[N];b[I][N]={data:null,pixelRatio:at,sdf:et,stretchX:Q,stretchY:Lt,content:Ot,spriteData:{width:R,height:z,x:W,y:it,context:C}}}}y(null,b)}(function(){var y=new a.A(2);a.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Et{constructor(s,h,d,g){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(h,g)}update(s,h,d){const{width:g,height:b}=s,I=!(this.size&&this.size[0]===g&&this.size[1]===b||d),{context:C}=this,{gl:M}=C;if(this.useMipmap=!!(h&&h.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!h||h.premultiply!==!1)),I)this.size=[g,b],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,b,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:N,y:R}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texSubImage2D(M.TEXTURE_2D,0,N,R,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,N,R,g,b,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,h,d){const{context:g}=this,{gl:b}=g;b.bindTexture(b.TEXTURE_2D,this.texture),d!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=b.LINEAR),s!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,s),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,d||s),this.filter=s),h!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h),this.wrap=h)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function yt(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class xt extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:h,callback:d}of this.requestors)this._notify(h,d);this.requestors=[]}}getImage(s){const h=this.images[s];if(h&&!h.data&&h.spriteData){const d=h.spriteData;h.data=new a.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),h.spriteData=null}return h}addImage(s,h){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,h)&&(this.images[s]=h)}_validate(s,h){let d=!0;const g=h.data||h.spriteData;return this._validateStretch(h.stretchX,g&&g.width)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(h.stretchY,g&&g.height)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(h.content,h)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,h){if(!s)return!0;let d=0;for(const g of s){if(g[0]-1);M++,b[M]=C,I[M]=N,I[M+1]=fe}for(let C=0,M=0;C{let C=this.entries[g];C||(C=this.entries[g]={glyphs:{},requests:{},ranges:{}});let M=C.glyphs[b];if(M!==void 0)return void I(null,{stack:g,id:b,glyph:M});if(M=this._tinySDF(C,g,b),M)return C.glyphs[b]=M,void I(null,{stack:g,id:b,glyph:M});const N=Math.floor(b/256);if(256*N>65535)return void I(new Error("glyphs > 65535 not supported"));if(C.ranges[N])return void I(null,{stack:g,id:b,glyph:M});if(!this.url)return void I(new Error("glyphsUrl is not set"));let R=C.requests[N];R||(R=C.requests[N]=[],Qt.loadGlyphRange(g,N,this.url,this.requestManager,(z,W)=>{if(W){for(const it in W)this._doesCharSupportLocalGlyph(+it)||(C.glyphs[+it]=W[+it]);C.ranges[N]=!0}for(const it of R)it(z,W);delete C.requests[N]})),R.push((z,W)=>{z?I(z):W&&I(null,{stack:g,id:b,glyph:W[b]||null})})},(g,b)=>{if(g)h(g);else if(b){const I={};for(const{stack:C,id:M,glyph:N}of b)(I[C]||(I[C]={}))[M]=N&&{id:N.id,bitmap:N.bitmap.clone(),metrics:N.metrics};h(null,I)}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(a.u["CJK Unified Ideographs"](s)||a.u["Hangul Syllables"](s)||a.u.Hiragana(s)||a.u.Katakana(s))}_tinySDF(s,h,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let b=s.tinySDF;if(!b){let C="400";/bold/i.test(h)?C="900":/medium/i.test(h)?C="500":/light/i.test(h)&&(C="200"),b=s.tinySDF=new Qt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:C})}const I=b.draw(String.fromCharCode(d));return{id:d,bitmap:new a.q({width:I.width||60,height:I.height||60},I.data),metrics:{width:I.glyphWidth/2||24,height:I.glyphHeight/2||24,left:I.glyphLeft/2+.5||0,top:I.glyphTop/2-27.5||-8,advance:I.glyphAdvance/2||24,isDoubleResolution:!0}}}}Qt.loadGlyphRange=function(y,s,h,d,g){const b=256*s,I=b+255,C=d.transformRequest(h.replace("{fontstack}",y).replace("{range}",`${b}-${I}`),Y.Glyphs);a.l(C,(M,N)=>{if(M)g(M);else if(N){const R={};for(const z of a.n(N))R[z.id]=z;g(null,R)}})},Qt.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:h=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:b="normal",fontStyle:I="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=h;const C=this.size=y+4*s,M=this._createCanvas(C),N=this.ctx=M.getContext("2d",{willReadFrequently:!0});N.font=`${I} ${b} ${y}px ${g}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:h,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:b}=this.ctx.measureText(y),I=Math.ceil(h),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-g))),M=Math.min(this.size-this.buffer,I+Math.ceil(d)),N=C+2*this.buffer,R=M+2*this.buffer,z=Math.max(N*R,0),W=new Uint8ClampedArray(z),it={data:W,width:N,height:R,glyphWidth:C,glyphHeight:M,glyphTop:I,glyphLeft:0,glyphAdvance:s};if(C===0||M===0)return it;const{ctx:et,buffer:at,gridInner:Q,gridOuter:Lt}=this;et.clearRect(at,at,C,M),et.fillText(y,at,at+I);const Ot=et.getImageData(at,at,C,M);Lt.fill(fe,0,z),Q.fill(0,0,z);for(let ct=0;ct0?Yt*Yt:0,Q[Vt]=Yt<0?Yt*Yt:0}}Nt(Lt,0,0,N,R,N,this.f,this.v,this.z),Nt(Q,at,at,C,M,N,this.f,this.v,this.z);for(let ct=0;ct1&&(M=s[++C]);const R=Math.abs(N-M.left),z=Math.abs(N-M.right),W=Math.min(R,z);let it;const et=b/d*(g+1);if(M.isDash){const at=g-Math.abs(et);it=Math.sqrt(W*W+at*at)}else it=g-Math.sqrt(W*W+et*et);this.data[I+N]=Math.max(0,Math.min(255,it+128))}}}addRegularDash(s){for(let C=s.length-1;C>=0;--C){const M=s[C],N=s[C+1];M.zeroLength?s.splice(C,1):N&&N.isDash===M.isDash&&(N.left=M.left,s.splice(C,1))}const h=s[0],d=s[s.length-1];h.isDash===d.isDash&&(h.left=d.left-this.width,d.right=h.right+this.width);const g=this.width*this.nextRow;let b=0,I=s[b];for(let C=0;C1&&(I=s[++b]);const M=Math.abs(C-I.left),N=Math.abs(C-I.right),R=Math.min(M,N);this.data[g+C]=Math.max(0,Math.min(255,(I.isDash?R:-R)+128))}}addDash(s,h){const d=h?7:0,g=2*d+1;if(this.nextRow+g>this.height)return a.w("LineAtlas out of space"),null;let b=0;for(let C=0;C{g.send(s,h,b)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(h=>{h.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}}function Fe(y,s,h){const d=function(g,b){if(g)return h(g);if(b){const I=a.F(a.e(b,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);b.vector_layers&&(I.vectorLayers=b.vector_layers,I.vectorLayerIds=I.vectorLayers.map(C=>C.id)),h(null,I)}};return y.url?a.f(s.transformRequest(y.url,Y.Source),d):a.h.frame(()=>d(null,y))}class ke{constructor(s,h){s&&(h?this.setSouthWest(s).setNorthEast(h):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}setSouthWest(s){return this._sw=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}extend(s){const h=this._sw,d=this._ne;let g,b;if(s instanceof a.L)g=s,b=s;else{if(!(s instanceof ke))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(ke.convert(s)):this.extend(a.L.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(a.L.convert(s)):this;if(g=s._sw,b=s._ne,!g||!b)return this}return h||d?(h.lng=Math.min(g.lng,h.lng),h.lat=Math.min(g.lat,h.lat),d.lng=Math.max(b.lng,d.lng),d.lat=Math.max(b.lat,d.lat)):(this._sw=new a.L(g.lng,g.lat),this._ne=new a.L(b.lng,b.lat)),this}getCenter(){return new a.L((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 a.L(this.getWest(),this.getNorth())}getSouthEast(){return new a.L(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(s){const{lng:h,lat:d}=a.L.convert(s);let g=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(s){return s instanceof ke?s:s&&new ke(s)}static fromLngLat(s,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new ke(new a.L(s.lng-g,s.lat-d),new a.L(s.lng+g,s.lat+d))}}class fn{constructor(s,h,d){this.bounds=ke.convert(this.validateBounds(s)),this.minzoom=h||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const h=Math.pow(2,s.z),d=Math.floor(a.G(this.bounds.getWest())*h),g=Math.floor(a.H(this.bounds.getNorth())*h),b=Math.ceil(a.G(this.bounds.getEast())*h),I=Math.ceil(a.H(this.bounds.getSouth())*h);return s.x>=d&&s.x=g&&s.y{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Fe(this._options,this.map._requestManager,(b,I)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),b?this.fire(new a.j(b)):I&&(a.e(this,I),I.bounds&&(this.tileBounds=new fn(I.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>a.e({},this._options),this.id=s,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.e(this,a.F(h,["url","scheme","tileSize","promoteId"])),this._options=a.e({type:"vector"},h),this._collectResourceTiming=h.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g={request:this.map._requestManager.transformRequest(d,Y.Tile),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function b(I,C){return delete s.request,s.aborted?h(null):I&&I.status!==404?h(I):(C&&C.resourceTiming&&(s.resourceTiming=C.resourceTiming),this.map._refreshExpiredTiles&&C&&s.setExpiryData(C),s.loadVectorData(C,this.map.painter),h(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null)))}g.request.collectResourceTiming=this._collectResourceTiming,s.actor&&s.state!=="expired"?s.state==="loading"?s.reloadCallback=h:s.request=s.actor.send("reloadTile",g,b.bind(this)):(s.actor=this.dispatcher.getActor(),s.request=s.actor.send("loadTile",g,b.bind(this)))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.actor&&s.actor.send("abortTile",{uid:s.uid,type:this.type,source:this.id},void 0)}unloadTile(s){s.unloadVectorData(),s.actor&&s.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class qn extends a.E{constructor(s,h,d,g){super(),this.id=s,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},h),a.e(this,a.F(h,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Fe(this._options,this.map._requestManager,(s,h)=>{this._tileJSONRequest=null,this._loaded=!0,s?this.fire(new a.j(s)):h&&(a.e(this,h),h.bounds&&(this.tileBounds=new fn(h.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}serialize(){return a.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.request=U.getImage(this.map._requestManager.transformRequest(d,Y.Tile),(g,b,I)=>{if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(g)s.state="errored",h(g);else if(b){this.map._refreshExpiredTiles&&I&&s.setExpiryData(I);const C=this.map.painter.context,M=C.gl;s.texture=this.map.painter.getTileTexture(b.width),s.texture?s.texture.update(b,{useMipmap:!0}):(s.texture=new Et(C,b,M.RGBA,{useMipmap:!0}),s.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),C.extTextureFilterAnisotropic&&M.texParameterf(M.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax)),s.state="loaded",h(null)}},this.map._refreshExpiredTiles)}abortTile(s,h){s.request&&(s.request.cancel(),delete s.request),h()}unloadTile(s,h){s.texture&&this.map.painter.saveTileTexture(s.texture),h()}hasTransition(){return!1}}class ie extends qn{constructor(s,h,d,g){super(s,h,d,g),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},h),this.encoding=h.encoding||"mapbox",this.redFactor=h.redFactor,this.greenFactor=h.greenFactor,this.blueFactor=h.blueFactor,this.baseShift=h.baseShift}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g=this.map._requestManager.transformRequest(d,Y.Tile);function b(I,C){I&&(s.state="errored",h(I)),C&&(s.dem=C,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded",h(null))}s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.request=U.getImage(g,(I,C,M)=>a._(this,void 0,void 0,function*(){if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(I)s.state="errored",h(I);else if(C){this.map._refreshExpiredTiles&&s.setExpiryData(M);const N=a.a(C)&&a.J()?C:yield function(z){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.K()){const W=z.width+2,it=z.height+2;try{return new a.R({width:W,height:it},yield a.M(z,-1,-1,W,it))}catch{}}return a.h.getImageData(z,1)})}(C),R={uid:s.uid,coord:s.tileID,source:this.id,rawImageData:N,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};s.actor&&s.state!=="expired"||(s.actor=this.dispatcher.getActor(),s.actor.send("loadDEMTile",R,b))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(s){const h=s.canonical,d=Math.pow(2,h.z),g=(h.x-1+d)%d,b=h.x===0?s.wrap-1:s.wrap,I=(h.x+1+d)%d,C=h.x+1===d?s.wrap+1:s.wrap,M={};return M[new a.O(s.overscaledZ,b,h.z,g,h.y).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y).key]={backfilled:!1},h.y>0&&(M[new a.O(s.overscaledZ,b,h.z,g,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,s.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y-1).key]={backfilled:!1}),h.y+1{this._updateWorkerData()},this.serialize=()=>a.e({},this._options,{type:this.type,data:this._data}),this.id=s,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=d.getActor(),this.setEventedParent(g),this._data=h.data,this._options=a.e({},h),this._collectResourceTiming=h.collectResourceTiming,h.maxzoom!==void 0&&(this.maxzoom=h.maxzoom),h.type&&(this.type=h.type),h.attribution&&(this.attribution=h.attribution),this.promoteId=h.promoteId;const b=a.N/this.tileSize;this.workerOptions=a.e({source:this.id,cluster:h.cluster||!1,geojsonVtOptions:{buffer:(h.buffer!==void 0?h.buffer:128)*b,tolerance:(h.tolerance!==void 0?h.tolerance:.375)*b,extent:a.N,maxZoom:this.maxzoom,lineMetrics:h.lineMetrics||!1,generateId:h.generateId||!1},superclusterOptions:{maxZoom:h.clusterMaxZoom!==void 0?h.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,h.clusterMinPoints||2),extent:a.N,radius:(h.clusterRadius||50)*b,log:!1,generateId:h.generateId||!1},clusterProperties:h.clusterProperties,filter:h.filter},h.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s,h){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:s,source:this.id},h),this}getClusterChildren(s,h){return this.actor.send("geojson.getClusterChildren",{clusterId:s,source:this.id},h),this}getClusterLeaves(s,h,d,g){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:s,limit:h,offset:d},g),this}_updateWorkerData(s){const h=a.e({},this.workerOptions);s?h.dataDiff=s:typeof this._data=="string"?(h.request=this.map._requestManager.transformRequest(a.h.resolveURL(this._data),Y.Source),h.request.collectResourceTiming=this._collectResourceTiming):h.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new a.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,h,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return void this.fire(new a.k("dataabort",{dataType:"source"}));let b=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(b=g.resourceTiming[this.id].slice(0)),d)return void this.fire(new a.j(d));const I={dataType:"source"};this._collectResourceTiming&&b&&b.length>0&&a.e(I,{resourceTiming:b}),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(s,h){const d=s.actor?"reloadTile":"loadTile";s.actor=this.actor;const g={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request=this.actor.send(d,g,(b,I)=>(delete s.request,s.unloadVectorData(),s.aborted?h(null):b?h(b):(s.loadVectorData(I,this.map.painter,d==="reloadTile"),h(null))))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.aborted=!0}unloadTile(s){s.unloadVectorData(),this.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var hn=a.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class On extends a.E{constructor(s,h,d,g){super(),this.load=(b,I)=>{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=U.getImage(this.map._requestManager.transformRequest(this.url,Y.Image),(C,M)=>{this._request=null,this._loaded=!0,C?this.fire(new a.j(C)):M&&(this.image=M,b&&(this.coordinates=b),I&&I(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,hn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Et(b,this.image,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const N=this.tiles[M];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=s,this.dispatcher=d,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=h}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=s.url,this.load(s.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(s){this.coordinates=s;const h=s.map(a.U.fromLngLat);this.tileID=function(g){let b=1/0,I=1/0,C=-1/0,M=-1/0;for(const W of g)b=Math.min(b,W.x),I=Math.min(I,W.y),C=Math.max(C,W.x),M=Math.max(M,W.y);const N=Math.max(C-b,M-I),R=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),z=Math.pow(2,R);return new a.W(R,Math.floor((b+C)/2*z),Math.floor((I+M)/2*z))}(h),this.minzoom=this.maxzoom=this.tileID.z;const d=h.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new a.V,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,a.N,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,a.N),this._boundsArray.emplaceBack(d[2].x,d[2].y,a.N,a.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(s,h){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},h(null)):(s.state="errored",h(null))}hasTransition(){return!1}}class _i extends On{constructor(s,h,d,g){super(s,h,d,g),this.load=()=>{this._loaded=!1;const b=this.options;this.urls=[];for(const I of b.urls)this.urls.push(this.map._requestManager.transformRequest(I,Y.Source).url);a.X(this.urls,(I,C)=>{this._loaded=!0,I?this.fire(new a.j(I)):C&&(this.video=C,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,hn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.texSubImage2D(I.TEXTURE_2D,0,0,0,I.RGBA,I.UNSIGNED_BYTE,this.video)):(this.texture=new Et(b,this.video,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const N=this.tiles[M];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=h}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const h=this.video.seekable;sh.end(0)?this.fire(new a.j(new a.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${h.start(0)} and ${h.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class wn extends On{constructor(s,h,d,g){super(s,h,d,g),this.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 a.j(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())},this.prepare=()=>{let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const I=this.map.painter.context,C=I.gl;this.boundsBuffer||(this.boundsBuffer=I.createVertexBuffer(this._boundsArray,hn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Et(I,this.canvas,C.RGBA,{premultiply:!0});let M=!1;for(const N in this.tiles){const R=this.tiles[N];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture,M=!0)}M&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(I=>typeof I!="number"))||this.fire(new a.j(new a.Y(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.Y(`sources.${s}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new a.j(new a.Y(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),h.canvas?typeof h.canvas=="string"||h.canvas instanceof HTMLCanvasElement||this.fire(new a.j(new a.Y(`sources.${s}`,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 a.j(new a.Y(`sources.${s}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.animate}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const _t={},Ee=y=>{switch(y){case"geojson":return De;case"image":return On;case"raster":return qn;case"raster-dem":return ie;case"vector":return Kn;case"video":return _i;case"canvas":return wn}return _t[y]};function qe(y,s){const h=a.Z();return a.$(h,h,[1,1,0]),a.a0(h,h,[.5*y.width,.5*y.height,1]),a.a1(h,h,y.calculatePosMatrix(s.toUnwrapped()))}function nr(y,s,h,d,g,b){const I=function(z,W,it){if(z)for(const et of z){const at=W[et];if(at&&at.source===it&&at.type==="fill-extrusion")return!0}else for(const et in W){const at=W[et];if(at.source===it&&at.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),C=b.maxPitchScaleFactor(),M=y.tilesIn(d,C,I);M.sort(Wn);const N=[];for(const z of M)N.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(s,h,y._state,z.queryGeometry,z.cameraQueryGeometry,z.scale,g,b,C,qe(y.transform,z.tileID))});const R=function(z){const W={},it={};for(const et of z){const at=et.queryResults,Q=et.wrappedTileID,Lt=it[Q]=it[Q]||{};for(const Ot in at){const ct=at[Ot],Pt=Lt[Ot]=Lt[Ot]||{},Bt=W[Ot]=W[Ot]||[];for(const Vt of ct)Pt[Vt.featureIndex]||(Pt[Vt.featureIndex]=!0,Bt.push(Vt))}}return W}(N);for(const z in R)R[z].forEach(W=>{const it=W.feature,et=y.getFeatureState(it.layer["source-layer"],it.id);it.source=it.layer.source,it.layer["source-layer"]&&(it.sourceLayer=it.layer["source-layer"]),it.state=et});return R}function Wn(y,s){const h=y.tileID,d=s.tileID;return h.overscaledZ-d.overscaledZ||h.canonical.y-d.canonical.y||h.wrap-d.wrap||h.canonical.x-d.canonical.x}class pn{constructor(s,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=a.a2(),this.uses=0,this.tileSize=h,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(s){const h=s+this.timeAdded;hb.getLayer(N)).filter(Boolean);if(M.length!==0){C.layers=M,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(N=>M.filter(R=>R.id===N)[0]));for(const N of M)I[N.id]=C}}return I}(s.buckets,h.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4){if(this.hasSymbolBuckets=!0,!d)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4&&b.hasRTLText){this.hasRTLText=!0,a.a5();break}}this.queryPadding=0;for(const g in this.buckets){const b=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(g).queryRadius(b))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new a.a3}unloadVectorData(){for(const s in this.buckets)this.buckets[s].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(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(s)}const h=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Et(s,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Et(s,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,h,d,g,b,I,C,M,N,R){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:b,scale:I,tileSize:this.tileSize,pixelPosMatrix:R,transform:M,params:C,queryPadding:this.queryPadding*N},s,h,d):{}}querySourceFeatures(s,h){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),b=h&&h.sourceLayer?h.sourceLayer:"",I=g._geojsonTileLayer||g[b];if(!I)return;const C=a.a6(h&&h.filter),{z:M,x:N,y:R}=this.tileID.canonical,z={z:M,x:N,y:R};for(let W=0;Wd)g=!1;else if(h)if(this.expirationTime{this.remove(s,b)},d)),this.data[g].push(b),this.order.push(g),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const h=this.data[s].shift();return h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),h.value}getByKey(s){const h=this.data[s];return h?h[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,h){if(!this.has(s))return this;const d=s.wrapped().key,g=h===void 0?0:this.data[d].indexOf(h),b=this.data[d][g];return this.data[d].splice(g,1),b.timeout&&clearTimeout(b.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(b.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(s){const h=[];for(const d in this.data)for(const g of this.data[d])s(g.value)||h.push(g);for(const d of h)this.remove(d.value.tileID,d)}}class $t{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,h,d){const g=String(h);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},a.e(this.stateChanges[s][g],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const b in this.state[s])b!==g&&(this.deletedStates[s][b]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const b in this.state[s][g])d[b]||(this.deletedStates[s][g][b]=null)}else for(const b in d)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][b]===null&&delete this.deletedStates[s][g][b]}removeFeatureState(s,h,d){if(this.deletedStates[s]===null)return;const g=String(h);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&h!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][d]=null);else if(h!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(d in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][d]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,h){const d=String(h),g=a.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const b=this.deletedStates[s][h];if(b===null)return{};for(const I in b)delete g[I]}return g}initializeTileState(s,h){s.setFeatureState(this.state,h)}coalesceChanges(s,h){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const b={};for(const I in this.stateChanges[g])this.state[g][I]||(this.state[g][I]={}),a.e(this.state[g][I],this.stateChanges[g][I]),b[I]=this.state[g][I];d[g]=b}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const b={};if(this.deletedStates[g]===null)for(const I in this.state[g])b[I]={},this.state[g][I]={};else for(const I in this.deletedStates[g]){if(this.deletedStates[g][I]===null)this.state[g][I]={};else for(const C of Object.keys(this.deletedStates[g][I]))delete this.state[g][I][C];b[I]=this.state[g][I]}d[g]=d[g]||{},a.e(d[g],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in s)s[g].setFeatureState(d,h)}}class Bi extends a.E{constructor(s,h,d){super(),this.id=s,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.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=((g,b,I,C)=>{const M=new(Ee(b.type))(g,b,I,C);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,h,d,this),this._tiles={},this._cache=new Wi(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new $t,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}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 s in this._tiles){const h=this._tiles[s];if(h.state!=="loaded"&&h.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,h){return this._source.loadTile(s,h)}_unloadTile(s){if(this._source.unloadTile)return this._source.unloadTile(s,()=>{})}_abortTile(s){this._source.abortTile&&this._source.abortTile(s,()=>{}),this._source.fire(new a.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const d=this._tiles[h];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(fr).map(s=>s.key)}getRenderableIds(s){const h=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&h.push(this._tiles[d]);return s?h.sort((d,g)=>{const b=d.tileID,I=g.tileID,C=new a.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),M=new a.P(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-I.overscaledZ||M.y-C.y||M.x-C.x}).map(d=>d.tileID.key):h.map(d=>d.tileID).sort(fr).map(d=>d.key)}hasRenderableParent(s){const h=this.findLoadedParent(s,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(s,h){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(h||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,h){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=h),this._loadTile(d,this._tileLoaded.bind(this,d,s,h)))}_tileLoaded(s,h,d,g){if(g)return s.state="errored",void(g.status!==404?this._source.fire(new a.j(g,{tile:s})):this.update(this.transform,this.terrain));s.timeAdded=a.h.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(h,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const h=this.getRenderableIds();for(let g=0;g1||(Math.abs(I)>1&&(Math.abs(I+M)===1?I+=M:Math.abs(I-M)===1&&(I-=M)),b.dem&&g.dem&&(g.dem.backfillBorder(b.dem,I,C),g.neighboringTiles&&g.neighboringTiles[N]&&(g.neighboringTiles[N].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,h,d,g){for(const b in this._tiles){let I=this._tiles[b];if(g[b]||!I.hasData()||I.tileID.overscaledZ<=h||I.tileID.overscaledZ>d)continue;let C=I.tileID;for(;I&&I.tileID.overscaledZ>h+1;){const N=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[N.key],I&&I.hasData()&&(C=N)}let M=C;for(;M.overscaledZ>h;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[C.key]=C;break}}}findLoadedParent(s,h){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=h?d:null}for(let d=s.overscaledZ-1;d>=h;d--){const g=s.scaledTo(d),b=this._getLoadedTile(g);if(b)return b}}_getLoadedTile(s){const h=this._tiles[s.key];return h&&h.hasData()?h:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const h=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(h*d*(this._maxTileCacheZoomLevels===null?a.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(b)}handleWrapJump(s){const h=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,h){const d={};for(const g in this._tiles){const b=this._tiles[g];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+h),d[b.tileID.key]=b}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,h){if(this.transform=s,this.terrain=h,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new a.O(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y)):(d=s.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:h}),this._source.hasTile&&(d=d.filter(R=>this._source.hasTile(R)))):d=[];const g=s.coveringZoomLevel(this._source),b=Math.max(g-Bi.maxOverzooming,this._source.minzoom),I=Math.max(g+Bi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const R={};for(const z of d)if(z.canonical.z>this._source.minzoom){const W=z.scaledTo(z.canonical.z-1);R[W.key]=W;const it=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));R[it.key]=it}d=d.concat(Object.values(R))}const C=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(zn(this._source.type)){const R={},z={},W=Object.keys(M),it=a.h.now();for(const et of W){const at=M[et],Q=this._tiles[et];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=it)continue;const Lt=this.findLoadedParent(at,b);Lt&&(this._addTile(Lt.tileID),R[Lt.tileID.key]=Lt.tileID),z[et]=at}this._retainLoadedChildren(z,g,I,M);for(const et in R)M[et]||(this._coveredTiles[et]=!0,M[et]=R[et]);if(h){const et={},at={};for(const Q of d)this._tiles[Q.key].hasData()?et[Q.key]=Q:at[Q.key]=Q;for(const Q in at){const Lt=at[Q].children(this._source.maxzoom);this._tiles[Lt[0].key]&&this._tiles[Lt[1].key]&&this._tiles[Lt[2].key]&&this._tiles[Lt[3].key]&&(et[Lt[0].key]=M[Lt[0].key]=Lt[0],et[Lt[1].key]=M[Lt[1].key]=Lt[1],et[Lt[2].key]=M[Lt[2].key]=Lt[2],et[Lt[3].key]=M[Lt[3].key]=Lt[3],delete at[Q])}for(const Q in at){const Lt=this.findLoadedParent(at[Q],this._source.minzoom);if(Lt){et[Lt.tileID.key]=M[Lt.tileID.key]=Lt.tileID;for(const Ot in et)et[Ot].isChildOf(Lt.tileID)&&delete et[Ot]}}for(const Q in this._tiles)et[Q]||(this._coveredTiles[Q]=!0)}}for(const R in M)this._tiles[R].clearFadeHold();const N=a.ab(this._tiles,M);for(const R of N){const z=this._tiles[R];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(R)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,h){const d={},g={},b=Math.max(h-Bi.maxOverzooming,this._source.minzoom),I=Math.max(h+Bi.maxUnderzooming,this._source.minzoom),C={};for(const M of s){const N=this._addTile(M);d[M.key]=M,N.hasData()||hthis._source.maxzoom){const z=M.children(this._source.maxzoom)[0],W=this.getTile(z);if(W&&W.hasData()){d[z.key]=z;continue}}else{const z=M.children(this._source.maxzoom);if(d[z[0].key]&&d[z[1].key]&&d[z[2].key]&&d[z[3].key])continue}let R=N.wasRequested();for(let z=M.overscaledZ-1;z>=b;--z){const W=M.scaledTo(z);if(g[W.key])break;if(g[W.key]=!0,N=this.getTile(W),!N&&R&&(N=this._addTile(W)),N){const it=N.hasData();if((R||it)&&(d[W.key]=W),R=N.wasRequested(),it)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const h=[];let d,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}h.push(g.key);const b=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(b),d)break;g=b}for(const b of h)this._loadedParentTiles[b]=d}}_addTile(s){let h=this._tiles[s.key];if(h)return h;h=this._cache.getAndRemove(s),h&&(this._setTileReloadTimer(s.key,h),h.tileID=s,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,h)));const d=h;return h||(h=new pn(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(h,this._tileLoaded.bind(this,h,s.key,h.state))),h.uses++,this._tiles[s.key]=h,d||this._source.fire(new a.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(s,h){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=h.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const h=this._tiles[s];h&&(h.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),h.uses>0||(h.hasData()&&h.state!=="reloading"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,h,d){const g=[],b=this.transform;if(!b)return g;const I=d?b.getCameraQueryGeometry(s):s,C=s.map(et=>b.pointCoordinate(et,this.terrain)),M=I.map(et=>b.pointCoordinate(et,this.terrain)),N=this.getIds();let R=1/0,z=1/0,W=-1/0,it=-1/0;for(const et of M)R=Math.min(R,et.x),z=Math.min(z,et.y),W=Math.max(W,et.x),it=Math.max(it,et.y);for(let et=0;et=0&&ct[1].y+Ot>=0){const Pt=C.map(Vt=>Q.getTilePoint(Vt)),Bt=M.map(Vt=>Q.getTilePoint(Vt));g.push({tile:at,tileID:Q,queryGeometry:Pt,cameraQueryGeometry:Bt,scale:Lt})}}return g}getVisibleCoordinates(s){const h=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of h)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(zn(this._source.type)){const s=a.h.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=s)return!0}return!1}setFeatureState(s,h,d){this._state.updateState(s=s||"_geojsonTileLayer",h,d)}removeFeatureState(s,h,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",h,d)}getFeatureState(s,h){return this._state.getState(s=s||"_geojsonTileLayer",h)}setDependencies(s,h,d){const g=this._tiles[s];g&&g.setDependencies(h,d)}reloadTilesForDependencies(s,h){for(const d in this._tiles)this._tiles[d].hasDependency(s,h)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,h))}}function fr(y,s){const h=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||d-h||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function zn(y){return y==="raster"||y==="image"||y==="video"}Bi.maxOverzooming=10,Bi.maxUnderzooming=3;const In="mapboxgl_preloaded_worker_pool";class es{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[In]}numActive(){return Object.keys(this.active).length}}const oo=Math.floor(a.h.hardwareConcurrency/2);let ns;function Ha(){return ns||(ns=new es),ns}es.workerCount=a.ac(globalThis)?Math.max(Math.min(oo,3),1):1;class Gs{constructor(s,h){this.reset(s,h)}reset(s,h){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-I)/C:0;return this.points[b].mult(1-M).add(this.points[h].mult(M))}}function js(y,s){let h=!0;return y==="always"||y!=="never"&&s!=="never"||(h=!1),h}class Sa{constructor(s,h,d){const g=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(h/d);for(let I=0;Ithis.width||g<0||h>this.height)return[];const M=[];if(s<=0&&h<=0&&this.width<=d&&this.height<=g){if(b)return[{key:null,x1:s,y1:h,x2:d,y2:g}];for(let N=0;N0}hitTestCircle(s,h,d,g,b){const I=s-d,C=s+d,M=h-d,N=h+d;if(C<0||I>this.width||N<0||M>this.height)return!1;const R=[];return this._forEachCell(I,M,C,N,this._queryCellCircle,R,{hitTest:!0,overlapMode:g,circle:{x:s,y:h,radius:d},seenUids:{box:{},circle:{}}},b),R.length>0}_queryCell(s,h,d,g,b,I,C,M){const{seenUids:N,hitTest:R,overlapMode:z}=C,W=this.boxCells[b];if(W!==null){const et=this.bboxes;for(const at of W)if(!N.box[at]){N.box[at]=!0;const Q=4*at,Lt=this.boxKeys[at];if(s<=et[Q+2]&&h<=et[Q+3]&&d>=et[Q+0]&&g>=et[Q+1]&&(!M||M(Lt))&&(!R||!js(z,Lt.overlapMode))&&(I.push({key:Lt,x1:et[Q],y1:et[Q+1],x2:et[Q+2],y2:et[Q+3]}),R))return!0}}const it=this.circleCells[b];if(it!==null){const et=this.circles;for(const at of it)if(!N.circle[at]){N.circle[at]=!0;const Q=3*at,Lt=this.circleKeys[at];if(this._circleAndRectCollide(et[Q],et[Q+1],et[Q+2],s,h,d,g)&&(!M||M(Lt))&&(!R||!js(z,Lt.overlapMode))){const Ot=et[Q],ct=et[Q+1],Pt=et[Q+2];if(I.push({key:Lt,x1:Ot-Pt,y1:ct-Pt,x2:Ot+Pt,y2:ct+Pt}),R)return!0}}}return!1}_queryCellCircle(s,h,d,g,b,I,C,M){const{circle:N,seenUids:R,overlapMode:z}=C,W=this.boxCells[b];if(W!==null){const et=this.bboxes;for(const at of W)if(!R.box[at]){R.box[at]=!0;const Q=4*at,Lt=this.boxKeys[at];if(this._circleAndRectCollide(N.x,N.y,N.radius,et[Q+0],et[Q+1],et[Q+2],et[Q+3])&&(!M||M(Lt))&&!js(z,Lt.overlapMode))return I.push(!0),!0}}const it=this.circleCells[b];if(it!==null){const et=this.circles;for(const at of it)if(!R.circle[at]){R.circle[at]=!0;const Q=3*at,Lt=this.circleKeys[at];if(this._circlesCollide(et[Q],et[Q+1],et[Q+2],N.x,N.y,N.radius)&&(!M||M(Lt))&&!js(z,Lt.overlapMode))return I.push(!0),!0}}}_forEachCell(s,h,d,g,b,I,C,M){const N=this._convertToXCellCoord(s),R=this._convertToYCellCoord(h),z=this._convertToXCellCoord(d),W=this._convertToYCellCoord(g);for(let it=N;it<=z;it++)for(let et=R;et<=W;et++)if(b.call(this,s,h,d,g,this.xCellCount*et+it,I,C,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,h,d,g,b,I){const C=g-s,M=b-h,N=d+I;return N*N>C*C+M*M}_circleAndRectCollide(s,h,d,g,b,I,C){const M=(I-g)/2,N=Math.abs(s-(g+M));if(N>M+d)return!1;const R=(C-b)/2,z=Math.abs(h-(b+R));if(z>R+d)return!1;if(N<=M||z<=R)return!0;const W=N-M,it=z-R;return W*W+it*it<=d*d}}function ae(y,s,h,d,g){const b=a.Z();return s?(a.a0(b,b,[1/g,1/g,1]),h||a.ae(b,b,d.angle)):a.a1(b,d.labelPlaneMatrix,y),b}function yo(y,s,h,d,g){if(s){const b=a.af(y);return a.a0(b,b,[g,g,1]),h||a.ae(b,b,-d.angle),b}return d.glCoordMatrix}function ri(y,s,h){let d;h?(d=[y.x,y.y,h(y.x,y.y),1],a.ag(d,d,s)):(d=[y.x,y.y,0,1],Z(d,d,s));const g=d[3];return{point:new a.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function Ea(y,s){return .5+y/s*.5}function ws(y,s){const h=y[0]/y[3],d=y[1]/y[3];return h>=-s[0]&&h<=s[0]&&d>=-s[1]&&d<=s[1]}function ue(y,s,h,d,g,b,I,C,M,N){const R=d?y.textSizeData:y.iconSizeData,z=a.ah(R,h.transform.zoom),W=[256/h.width*2+1,256/h.height*2+1],it=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;it.clear();const et=y.lineVertexArray,at=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,Q=h.transform.width/h.transform.height;let Lt=!1;for(let Ot=0;OtMath.abs(h.x-s.x)*d?{useVertical:!0}:(y===a.ai.vertical?s.yh.x)?{needsFlipping:!0}:null}function Ar(y,s,h,d,g,b,I,C,M,N,R,z,W,it,et,at){const Q=s/24,Lt=y.lineOffsetX*Q,Ot=y.lineOffsetY*Q;let ct;if(y.numGlyphs>1){const Pt=y.glyphStartIndex+y.numGlyphs,Bt=y.lineStartIndex,Vt=y.lineStartIndex+y.lineLength,Yt=ln(Q,C,Lt,Ot,h,R,z,y,M,b,W,et,at);if(!Yt)return{notEnoughRoom:!0};const ee=ri(Yt.first.point,I,at).point,te=ri(Yt.last.point,I,at).point;if(d&&!h){const se=Ke(y.writingMode,ee,te,it);if(se)return se}ct=[Yt.first];for(let se=y.glyphStartIndex+1;se0?ee.point:is(z,Yt,Bt,1,g,at),se=Ke(y.writingMode,Bt,te,it);if(se)return se}const Pt=G(Q*C.getoffsetX(y.glyphStartIndex),Lt,Ot,h,R,z,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,b,W,et,at);if(!Pt)return{notEnoughRoom:!0};ct=[Pt]}for(const Pt of ct)a.ak(N,Pt.point,Pt.angle);return{}}function is(y,s,h,d,g,b){const I=ri(y.add(y.sub(s)._unit()),g,b).point,C=h.sub(I);return h.add(C._mult(d/C.mag()))}function on(y,s){const{projectionCache:h,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:b,distanceFromAnchor:I,getElevation:C,previousVertex:M,direction:N,absOffsetX:R}=s;if(h.projections[y])return h.projections[y];const z=new a.P(d.getx(y),d.gety(y)),W=ri(z,g,C);if(W.signedDistanceFromCamera>0)return h.projections[y]=W.point,W.point;const it=y-N;return is(I===0?b:new a.P(d.getx(it),d.gety(it)),z,M,R-I+1,g,C)}function Ss(y,s,h){return y._unit()._perp()._mult(s*h)}function st(y,s,h,d,g,b,I,C){const{projectionCache:M,direction:N}=C;if(M.offsets[y])return M.offsets[y];const R=h.add(s);if(y+N=g)return M.offsets[y]=R,R;const z=on(y+N,C),W=Ss(z.sub(h),I,N),it=h.add(W),et=z.add(W);return M.offsets[y]=a.al(b,R,it,et)||R,M.offsets[y]}function G(y,s,h,d,g,b,I,C,M,N,R,z,W,it){const et=d?y-s:y+s;let at=et>0?1:-1,Q=0;d&&(at*=-1,Q=Math.PI),at<0&&(Q+=Math.PI);let Lt,Ot,ct=at>0?C+I:C+I+1,Pt=g,Bt=g,Vt=0,Yt=0;const ee=Math.abs(et),te=[];let se;for(;Vt+Yt<=ee;){if(ct+=at,ct=M)return null;Vt+=Yt,Bt=Pt,Ot=Lt;const pe={projectionCache:z,lineVertexArray:N,labelPlaneMatrix:R,tileAnchorPoint:b,distanceFromAnchor:Vt,getElevation:it,previousVertex:Bt,direction:at,absOffsetX:ee};if(Pt=on(ct,pe),h===0)te.push(Bt),se=Pt.sub(Bt);else{let Ge;const Pe=Pt.sub(Bt);Ge=Pe.mag()===0?Ss(on(ct+at,pe).sub(Pt),h,at):Ss(Pe,h,at),Ot||(Ot=Bt.add(Ge)),Lt=st(ct,Ge,Pt,C,M,Ot,h,pe),te.push(Ot),se=Lt.sub(Ot)}Yt=se.mag()}const Le=se._mult((ee-Vt)/Yt)._add(Ot||Bt),vn=Q+Math.atan2(Pt.y-Bt.y,Pt.x-Bt.x);return te.push(Le),{point:Le,angle:W?vn:0,path:te}}const q=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function J(y,s){for(let h=0;h=1;un--)Pe.push(pe.path[un]);for(let un=1;unri(bn,M,et));Pe=un.some(bn=>bn.signedDistanceFromCamera<=0)?[]:un.map(bn=>bn.point)}let _n=[];if(Pe.length>0){const un=Pe[0].clone(),bn=Pe[0].clone();for(let Vi=1;Vi=se.x&&bn.x<=Le.x&&un.y>=se.y&&bn.y<=Le.y?[Pe]:bn.xLe.x||bn.yLe.y?[]:a.am([Pe],se.x,se.y,Le.x,Le.y)}for(const un of _n){vn.reset(un,.25*te);let bn=0;bn=vn.length<=.5*te?1:Math.ceil(vn.paddedLength/Hn)+1;for(let Vi=0;Vi=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,h,d,g){return d>=0&&s=0&&hd.collisionGroupID===h}}return this.collisionGroups[s]}}function Ye(y,s,h,d,g){const{horizontalAlign:b,verticalAlign:I}=a.au(y);return new a.P(-(b-.5)*s+d[0]*g,-(I-.5)*h+d[1]*g)}function Te(y,s,h,d,g,b){const{x1:I,x2:C,y1:M,y2:N,anchorPointX:R,anchorPointY:z}=y,W=new a.P(s,h);return d&&W._rotate(g?b:-b),{x1:I+W.x,y1:M+W.y,x2:C+W.x,y2:N+W.y,anchorPointX:R,anchorPointY:z}}class Ve{constructor(s,h,d,g,b){this.transform=s.clone(),this.terrain=h,this.collisionIndex=new Mt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Ne(g),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,h,d,g){const b=d.getBucket(h),I=d.latestFeatureIndex;if(!b||!I||h.id!==b.layerIds[0])return;const C=d.collisionBoxArray,M=b.layers[0].layout,N=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),R=d.tileSize/a.N,z=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),W=M.get("text-pitch-alignment")==="map",it=M.get("text-rotation-alignment")==="map",et=vt(d,1,this.transform.zoom),at=ae(z,W,it,this.transform,et);let Q=null;if(W){const Ot=yo(z,W,it,this.transform,et);Q=a.a1([],this.transform.labelPlaneMatrix,Ot)}this.retainedQueryData[b.bucketInstanceId]=new Kt(b.bucketInstanceId,I,b.sourceLayerIndex,b.index,d.tileID);const Lt={bucket:b,layout:M,posMatrix:z,textLabelPlaneMatrix:at,labelToScreenMatrix:Q,scale:N,textPixelRatio:R,holdingForFade:d.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:a.ah(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(g)for(const Ot of b.sortKeyRanges){const{sortKey:ct,symbolInstanceStart:Pt,symbolInstanceEnd:Bt}=Ot;s.push({sortKey:ct,symbolInstanceStart:Pt,symbolInstanceEnd:Bt,parameters:Lt})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Lt})}attemptAnchorPlacement(s,h,d,g,b,I,C,M,N,R,z,W,it,et,at,Q){const Lt=a.aq[s.textAnchor],Ot=[s.textOffset0,s.textOffset1],ct=Ye(Lt,d,g,Ot,b),Pt=this.collisionIndex.placeCollisionBox(Te(h,ct.x,ct.y,I,C,this.transform.angle),z,M,N,R.predicate,Q);if((!at||this.collisionIndex.placeCollisionBox(Te(at,ct.x,ct.y,I,C,this.transform.angle),z,M,N,R.predicate,Q).box.length!==0)&&Pt.box.length>0){let Bt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID].text&&(Bt=this.prevPlacement.variableOffsets[W.crossTileID].anchor),W.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[W.crossTileID]={textOffset:Ot,width:d,height:g,anchor:Lt,textBoxScale:b,prevAnchor:Bt},this.markUsedJustification(it,Lt,W,et),it.allowVerticalPlacement&&(this.markUsedOrientation(it,et,W),this.placedOrientations[W.crossTileID]=et),{shift:ct,placedGlyphBoxes:Pt}}}placeLayerBucketPart(s,h,d){const{bucket:g,layout:b,posMatrix:I,textLabelPlaneMatrix:C,labelToScreenMatrix:M,textPixelRatio:N,holdingForFade:R,collisionBoxArray:z,partiallyEvaluatedTextSize:W,collisionGroup:it}=s.parameters,et=b.get("text-optional"),at=b.get("icon-optional"),Q=a.ar(b,"text-overlap","text-allow-overlap"),Lt=Q==="always",Ot=a.ar(b,"icon-overlap","icon-allow-overlap"),ct=Ot==="always",Pt=b.get("text-rotation-alignment")==="map",Bt=b.get("text-pitch-alignment")==="map",Vt=b.get("icon-text-fit")!=="none",Yt=b.get("symbol-z-order")==="viewport-y",ee=Lt&&(ct||!g.hasIconData()||at),te=ct&&(Lt||!g.hasTextData()||et);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const se=this.retainedQueryData[g.bucketInstanceId].tileID,Le=this.terrain?(pe,Ge)=>this.terrain.getElevation(se,pe,Ge):null,vn=(pe,Ge)=>{var Pe,Hn;if(h[pe.crossTileID])return;if(R)return void(this.placements[pe.crossTileID]=new Wt(!1,!1,!1));let _n=!1,un=!1,bn=!0,Vi=null,si={box:null,offscreen:null},Rr={box:null,offscreen:null},pr=null,Hi=null,Bo=null,pi=0,Zs=0,$s=0;Ge.textFeatureIndex?pi=Ge.textFeatureIndex:pe.useRuntimeCollisionCircles&&(pi=pe.featureIndex),Ge.verticalTextFeatureIndex&&(Zs=Ge.verticalTextFeatureIndex);const nl=Ge.textBox;if(nl){const $r=Ui=>{let dr=a.ai.horizontal;if(g.allowVerticalPlacement&&!Ui&&this.prevPlacement){const xo=this.prevPlacement.placedOrientations[pe.crossTileID];xo&&(this.placedOrientations[pe.crossTileID]=xo,dr=xo,this.markUsedOrientation(g,dr,pe))}return dr},Or=(Ui,dr)=>{if(g.allowVerticalPlacement&&pe.numVerticalGlyphVertices>0&&Ge.verticalTextBox){for(const xo of g.writingModes)if(xo===a.ai.vertical?(si=dr(),Rr=si):si=Ui(),si&&si.box&&si.box.length)break}else si=Ui()},ao=pe.textAnchorOffsetStartIndex,Al=pe.textAnchorOffsetEndIndex;if(Al===ao){const Ui=(dr,xo)=>{const Gi=this.collisionIndex.placeCollisionBox(dr,Q,N,I,it.predicate,Le);return Gi&&Gi.box&&Gi.box.length&&(this.markUsedOrientation(g,xo,pe),this.placedOrientations[pe.crossTileID]=xo),Gi};Or(()=>Ui(nl,a.ai.horizontal),()=>{const dr=Ge.verticalTextBox;return g.allowVerticalPlacement&&pe.numVerticalGlyphVertices>0&&dr?Ui(dr,a.ai.vertical):{box:null,offscreen:null}}),$r(si&&si.box&&si.box.length)}else{let Ui=a.aq[(Hn=(Pe=this.prevPlacement)===null||Pe===void 0?void 0:Pe.variableOffsets[pe.crossTileID])===null||Hn===void 0?void 0:Hn.anchor];const dr=(Gi,Nl,dh)=>{const om=Gi.x2-Gi.x1,sm=Gi.y2-Gi.y1,Qg=pe.textBoxScale,np=Vt&&Ot==="never"?Nl:null;let Ws={box:[],offscreen:!1},Dl=Q==="never"?1:2,Xs="never";Ui&&Dl++;for(let cs=0;csdr(nl,Ge.iconBox,a.ai.horizontal),()=>{const Gi=Ge.verticalTextBox;return g.allowVerticalPlacement&&!(si&&si.box&&si.box.length)&&pe.numVerticalGlyphVertices>0&&Gi?dr(Gi,Ge.verticalIconBox,a.ai.vertical):{box:null,offscreen:null}}),si&&(_n=si.box,bn=si.offscreen);const xo=$r(si&&si.box);if(!_n&&this.prevPlacement){const Gi=this.prevPlacement.variableOffsets[pe.crossTileID];Gi&&(this.variableOffsets[pe.crossTileID]=Gi,this.markUsedJustification(g,Gi.anchor,pe,xo))}}}if(pr=si,_n=pr&&pr.box&&pr.box.length>0,bn=pr&&pr.offscreen,pe.useRuntimeCollisionCircles){const $r=g.text.placedSymbolArray.get(pe.centerJustifiedTextSymbolIndex),Or=a.aj(g.textSizeData,W,$r),ao=b.get("text-padding");Hi=this.collisionIndex.placeCollisionCircles(Q,$r,g.lineVertexArray,g.glyphOffsetArray,Or,I,C,M,d,Bt,it.predicate,pe.collisionCircleDiameter,ao,Le),Hi.circles.length&&Hi.collisionDetected&&!d&&a.w("Collisions detected, but collision boxes are not shown"),_n=Lt||Hi.circles.length>0&&!Hi.collisionDetected,bn=bn&&Hi.offscreen}if(Ge.iconFeatureIndex&&($s=Ge.iconFeatureIndex),Ge.iconBox){const $r=Or=>{const ao=Vt&&Vi?Te(Or,Vi.x,Vi.y,Pt,Bt,this.transform.angle):Or;return this.collisionIndex.placeCollisionBox(ao,Ot,N,I,it.predicate,Le)};Rr&&Rr.box&&Rr.box.length&&Ge.verticalIconBox?(Bo=$r(Ge.verticalIconBox),un=Bo.box.length>0):(Bo=$r(Ge.iconBox),un=Bo.box.length>0),bn=bn&&Bo.offscreen}const kl=et||pe.numHorizontalGlyphVertices===0&&pe.numVerticalGlyphVertices===0,yu=at||pe.numIconVertices===0;if(kl||yu?yu?kl||(un=un&&_n):_n=un&&_n:un=_n=un&&_n,_n&&pr&&pr.box&&this.collisionIndex.insertCollisionBox(pr.box,Q,b.get("text-ignore-placement"),g.bucketInstanceId,Rr&&Rr.box&&Zs?Zs:pi,it.ID),un&&Bo&&this.collisionIndex.insertCollisionBox(Bo.box,Ot,b.get("icon-ignore-placement"),g.bucketInstanceId,$s,it.ID),Hi&&(_n&&this.collisionIndex.insertCollisionCircles(Hi.circles,Q,b.get("text-ignore-placement"),g.bucketInstanceId,pi,it.ID),d)){const $r=g.bucketInstanceId;let Or=this.collisionCircleArrays[$r];Or===void 0&&(Or=this.collisionCircleArrays[$r]=new Ht);for(let ao=0;ao=0;--Ge){const Pe=pe[Ge];vn(g.symbolInstances.get(Pe),g.collisionArrays[Pe])}}else for(let pe=s.symbolInstanceStart;pe=0&&(s.text.placedSymbolArray.get(C).crossTileID=b>=0&&C!==b?0:d.crossTileID)}markUsedOrientation(s,h,d){const g=h===a.ai.horizontal||h===a.ai.horizontalOnly?h:0,b=h===a.ai.vertical?h:0,I=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const C of I)s.text.placedSymbolArray.get(C).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let d=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const g=h?h.symbolFadeChange(s):1,b=h?h.opacities:{},I=h?h.variableOffsets:{},C=h?h.placedOrientations:{};for(const M in this.placements){const N=this.placements[M],R=b[M];R?(this.opacities[M]=new Tt(R,g,N.text,N.icon),d=d||N.text!==R.text.placed||N.icon!==R.icon.placed):(this.opacities[M]=new Tt(null,g,N.text,N.icon,N.skipFade),d=d||N.text||N.icon)}for(const M in b){const N=b[M];if(!this.opacities[M]){const R=new Tt(N,g,!1,!1);R.isHidden()||(this.opacities[M]=R,d=d||N.text.placed||N.icon.placed)}}for(const M in I)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=I[M]);for(const M in C)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=C[M]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:s)}updateLayerOpacities(s,h){const d={};for(const g of h){const b=g.getBucket(s);b&&g.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,d,g.collisionBoxArray)}}updateBucketOpacities(s,h,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],b=g.layout,I=new Tt(null,0,!1,!1,!0),C=b.get("text-allow-overlap"),M=b.get("icon-allow-overlap"),N=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),R=b.get("text-rotation-alignment")==="map",z=b.get("text-pitch-alignment")==="map",W=b.get("icon-text-fit")!=="none",it=new Tt(null,0,C&&(M||!s.hasIconData()||b.get("icon-optional")),M&&(C||!s.hasTextData()||b.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const et=(at,Q,Lt)=>{for(let Ot=0;Ot0,Vt=this.placedOrientations[Q.crossTileID],Yt=Vt===a.ai.vertical,ee=Vt===a.ai.horizontal||Vt===a.ai.horizontalOnly;if(Lt>0||Ot>0){const te=Nr(Pt.text);et(s.text,Lt,Yt?rs:te),et(s.text,Ot,ee?rs:te);const se=Pt.text.isHidden();[Q.rightJustifiedTextSymbolIndex,Q.centerJustifiedTextSymbolIndex,Q.leftJustifiedTextSymbolIndex].forEach(pe=>{pe>=0&&(s.text.placedSymbolArray.get(pe).hidden=se||Yt?1:0)}),Q.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(Q.verticalPlacedTextSymbolIndex).hidden=se||ee?1:0);const Le=this.variableOffsets[Q.crossTileID];Le&&this.markUsedJustification(s,Le.anchor,Q,Vt);const vn=this.placedOrientations[Q.crossTileID];vn&&(this.markUsedJustification(s,"left",Q,vn),this.markUsedOrientation(s,vn,Q))}if(Bt){const te=Nr(Pt.icon),se=!(W&&Q.verticalPlacedIconSymbolIndex&&Yt);Q.placedIconSymbolIndex>=0&&(et(s.icon,Q.numIconVertices,se?te:rs),s.icon.placedSymbolArray.get(Q.placedIconSymbolIndex).hidden=Pt.icon.isHidden()),Q.verticalPlacedIconSymbolIndex>=0&&(et(s.icon,Q.numVerticalIconVertices,se?rs:te),s.icon.placedSymbolArray.get(Q.verticalPlacedIconSymbolIndex).hidden=Pt.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const te=s.collisionArrays[at];if(te){let se=new a.P(0,0);if(te.textBox||te.verticalTextBox){let vn=!0;if(N){const pe=this.variableOffsets[ct];pe?(se=Ye(pe.anchor,pe.width,pe.height,pe.textOffset,pe.textBoxScale),R&&se._rotate(z?this.transform.angle:-this.transform.angle)):vn=!1}te.textBox&&rn(s.textCollisionBox.collisionVertexArray,Pt.text.placed,!vn||Yt,se.x,se.y),te.verticalTextBox&&rn(s.textCollisionBox.collisionVertexArray,Pt.text.placed,!vn||ee,se.x,se.y)}const Le=!!(!ee&&te.verticalIconBox);te.iconBox&&rn(s.iconCollisionBox.collisionVertexArray,Pt.icon.placed,Le,W?se.x:0,W?se.y:0),te.verticalIconBox&&rn(s.iconCollisionBox.collisionVertexArray,Pt.icon.placed,!Le,W?se.x:0,W?se.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const at=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=at.invProjMatrix,s.placementViewportMatrix=at.viewportMatrix,s.collisionCircleArray=at.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function rn(y,s,h,d,g){y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0)}const Gn=Math.pow(2,25),Jn=Math.pow(2,24),kn=Math.pow(2,17),Pn=Math.pow(2,16),qr=Math.pow(2,9),oi=Math.pow(2,8),ir=Math.pow(2,1);function Nr(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,h=Math.floor(127*y.opacity);return h*Gn+s*Jn+h*kn+s*Pn+h*qr+s*oi+h*ir+s}const rs=0;class xd{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,h,d,g,b){const I=this._bucketParts;for(;this._currentTileIndexC.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&a.h.now()-g>2;for(;this._currentPlacementIndex>=0;){const I=h[s[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=C)&&(!I.maxzoom||I.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new xd(I)),this._inProgressLayer.continuePlacement(d[I.source],this.placement,this._showCollisionBoxes,I,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const su=512/a.N/2;class Og{constructor(s,h,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let b=0;b({x:Math.floor(M.anchorX*su),y:Math.floor(M.anchorY*su)})),crossTileIDs:I.map(M=>M.crossTileID)};if(C.positions.length>128){const M=new a.av(C.positions.length,16,Uint16Array);for(const{x:N,y:R}of C.positions)M.add(N,R);M.finish(),delete C.positions,C.index=M}this._symbolsByKey[b]=C}}getScaledCoordinates(s,h){const{x:d,y:g,z:b}=this.tileID.canonical,{x:I,y:C,z:M}=h.canonical,N=su/Math.pow(2,M-b),R=(C*a.N+s.anchorY)*N,z=g*a.N*su;return{x:Math.floor((I*a.N+s.anchorX)*N-d*a.N*su),y:Math.floor(R-z)}}findMatches(s,h,d){const g=this.tileID.canonical.zs)}}class Xn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class mf{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const h=Math.round((s-this.lng)/360);if(h!==0)for(const d in this.indexes){const g=this.indexes[d],b={};for(const I in g){const C=g[I];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+h),b[C.tileID.key]=C}this.indexes[d]=b}this.lng=s}addBucket(s,h,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let b=0;bs.overscaledZ)for(const C in I){const M=I[C];M.tileID.isChildOf(s)&&M.findMatches(h.symbolInstances,s,g)}else{const C=I[s.scaledTo(Number(b)).key];C&&C.findMatches(h.symbolInstances,s,g)}}for(let b=0;b{h[d]=!0});for(const d in this.layerIndexes)h[d]||delete this.layerIndexes[d]}}const Zr=(y,s)=>a.x(y,s&&s.filter(h=>h.identifier!=="source.canvas")),Do=a.F(a.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),zg=a.F(a.ax,["setCenter","setZoom","setBearing","setPitch"]),os=a.aw();class Dr extends a.E{constructor(s,h={}){super(),this.map=s,this.dispatcher=new Qe(Ha(),this,s._getMapId()),this.imageManager=new xt,this.imageManager.setEventedParent(this),this.glyphManager=new Qt(s._requestManager,h.localIdeographFontFamily),this.lineAtlas=new jn(256,512),this.crossTileSymbolIndex=new Vc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.az());const d=this;this._rtlTextPluginCallback=Dr.registerForPluginStateChange(g=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:g.pluginStatus,pluginURL:g.pluginURL},(b,I)=>{if(a.aA(b),I&&I.every(C=>C))for(const C in d.sourceCaches){const M=d.sourceCaches[C].getSource().type;M!=="vector"&&M!=="geojson"||d.sourceCaches[C].reload()}})}),this.on("data",g=>{if(g.dataType!=="source"||g.sourceDataType!=="metadata")return;const b=this.sourceCaches[g.sourceId];if(!b)return;const I=b.getSource();if(I&&I.vectorLayerIds)for(const C in this._layers){const M=this._layers[C];M.source===I.id&&this._validateLayer(M)}})}loadURL(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const g=this.map._requestManager.transformRequest(s,Y.Style);this._request=a.f(g,(b,I)=>{this._request=null,b?this.fire(new a.j(b)):I&&this._load(I,h,d)})}loadJSON(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),this._request=a.h.frame(()=>{this._request=null,h.validate=h.validate!==!1,this._load(s,h,d)})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(os,{validate:!1})}_load(s,h,d){var g;const b=h.transformStyle?h.transformStyle(d,s):s;if(!h.validate||!Zr(this,a.y(b))){this._loaded=!0,this.stylesheet=b;for(const I in b.sources)this.addSource(I,b.sources[I],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new yn(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){const s=a.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",s),this._order=s.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of s){const d=a.aC(h);d.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=d}}_loadSprite(s,h=!1,d=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(g,b,I,C){const M=gt(g),N=M.length,R=I>1?"@2x":"",z={},W={},it={};for(const{id:et,url:at}of M){const Q=b.transformRequest(b.normalizeSpriteURL(at,R,".json"),Y.SpriteJSON),Lt=`${et}_${Q.url}`;z[Lt]=a.f(Q,(Pt,Bt)=>{delete z[Lt],W[et]=Bt,ut(C,W,it,Pt,N)});const Ot=b.transformRequest(b.normalizeSpriteURL(at,R,".png"),Y.SpriteImage),ct=`${et}_${Ot.url}`;z[ct]=U.getImage(Ot,(Pt,Bt)=>{delete z[ct],it[et]=Bt,ut(C,W,it,Pt,N)})}return{cancel(){for(const et of Object.values(z))et.cancel()}}}(s,this.map._requestManager,this.map.getPixelRatio(),(g,b)=>{if(this._spriteRequest=null,g)this.fire(new a.j(g));else if(b)for(const I in b){this._spritesImagesIds[I]=[];const C=this._spritesImagesIds[I]?this._spritesImagesIds[I].filter(M=>!(M in b)):[];for(const M of C)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in b[I]){const N=I==="default"?M:`${I}:${M}`;this._spritesImagesIds[I].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,b[I][M],!1):this.imageManager.addImage(N,b[I][M]),h&&(this._changedImages[N]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(s){const h=this.sourceCaches[s.source];if(!h)return;const d=s.sourceLayer;if(!d)return;const g=h.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new a.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const h=this._serializedAllLayers();if(!s||s.length===0)return Object.values(h);const d=[];for(const g of s)h[g]&&d.push(h[g]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const h=Object.keys(this._layers);for(const d of h){const g=this._layers[d];g.type!=="custom"&&(s[d]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const h=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(g.length||b.length)&&this._updateWorkerLayers(g,b);for(const I in this._updatedSources){const C=this._updatedSources[I];if(C==="reload")this._reloadSource(I);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(I)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const b=this.sourceCaches[g];d[g]=b.used,b.used=!1}for(const g of this._order){const b=this._layers[g];b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const g in d){const b=this.sourceCaches[g];d[g]!==b.used&&b.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,h&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(s),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,h={}){this._checkLoaded();const d=this.serialize();if(s=h.transformStyle?h.transformStyle(d,s):s,Zr(this,a.y(s)))return!1;(s=a.aD(s)).layers=a.aB(s.layers);const g=a.aE(d,s).filter(I=>!(I.command in zg));if(g.length===0)return!1;const b=g.filter(I=>!(I.command in Do));if(b.length>0)throw new Error(`Unimplemented: ${b.map(I=>I.command).join(", ")}.`);for(const I of g)I.command!=="setTransition"&&this[I.command].apply(this,I.args);return this.stylesheet=s,this._serializedLayers=null,!0}addImage(s,h){if(this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,h),this._afterImageUpdated(s)}updateImage(s,h){this.imageManager.updateImage(s,h)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,h,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(a.y.source,`sources.${s}`,h,null,d))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const g=this.sourceCaches[s]=new Bi(s,h,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new a.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const h=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],h.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,h){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(h),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,h,d={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new a.j(new Error(`Layer "${g}" already exists on this map.`)));let b;if(s.type==="custom"){if(Zr(this,a.aF(s)))return;b=a.aC(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=a.aD(s),s=a.e(s,{source:g})),this._validate(a.y.layer,`layers.${g}`,s,{arrayIndex:-1},d))return;b=a.aC(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:g}})}const I=h?this._order.indexOf(h):this._order.length;if(h&&I===-1)this.fire(new a.j(new Error(`Cannot add layer "${g}" before non-existing layer "${h}".`)));else{if(this._order.splice(I,0,g),this._layerOrderChanged=!0,this._layers[g]=b,this._removedLayers[g]&&b.source&&b.type!=="custom"){const C=this._removedLayers[g];delete this._removedLayers[g],C.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(s,h){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new a.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===h)return;const d=this._order.indexOf(s);this._order.splice(d,1);const g=h?this._order.indexOf(h):this._order.length;h&&g===-1?this.fire(new a.j(new Error(`Cannot move layer "${s}" before non-existing layer "${h}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const h=this._layers[s];if(!h)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${s}".`)));h.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=h,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],h.onRemove&&h.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,h,d){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===h&&g.maxzoom===d||(h!=null&&(g.minzoom=h),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,h,d={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!a.aG(g.filter,h))return h==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(a.y.filter,`layers.${g.id}.filter`,h,null,d)||(g.filter=a.aD(h),this._updateLayer(g)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return a.aD(this.getLayer(s).filter)}setLayoutProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getLayoutProperty(h),d)||(b.setLayoutProperty(h,d,g),this._updateLayer(b)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,h){const d=this.getLayer(s);if(d)return d.getLayoutProperty(h);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getPaintProperty(h),d)||(b.setPaintProperty(h,d,g)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,h){return this.getLayer(s).getPaintProperty(h)}setFeatureState(s,h){this._checkLoaded();const d=s.source,g=s.sourceLayer,b=this.sourceCaches[d];if(b===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const I=b.getSource().type;I==="geojson"&&g?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||g?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(g,s.id,h)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,h){this._checkLoaded();const d=s.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const b=g.getSource().type,I=b==="vector"?s.sourceLayer:void 0;b!=="vector"||I?h&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(I,s.id,h):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const h=s.source,d=s.sourceLayer,g=this.sourceCaches[h];if(g!==void 0)return g.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,s.id)):void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.j(new Error(`The source '${h}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=a.aH(this.sourceCaches,b=>b.serialize()),h=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return a.aI({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:h,terrain:d},b=>b!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const h=I=>this._layers[I].type==="fill-extrusion",d={},g=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C)){d[C]=I;for(const M of s){const N=M[C];if(N)for(const R of N)g.push(R)}}}g.sort((I,C)=>C.intersectionZ-I.intersectionZ);const b=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C))for(let M=g.length-1;M>=0;M--){const N=g[M].feature;if(d[N.layer.id]{const ee=Lt.featureSortOrder;if(ee){const te=ee.indexOf(Vt.featureIndex);return ee.indexOf(Yt.featureIndex)-te}return Yt.featureIndex-Vt.featureIndex});for(const Vt of Bt)Pt.push(Vt)}}for(const Lt in et)et[Lt].forEach(Ot=>{const ct=Ot.feature,Pt=N[C[Lt].source].getFeatureState(ct.layer["source-layer"],ct.id);ct.source=ct.layer.source,ct.layer["source-layer"]&&(ct.sourceLayer=ct.layer["source-layer"]),ct.state=Pt});return et}(this._layers,I,this.sourceCaches,s,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,h){h&&h.filter&&this._validate(a.y.filter,"querySourceFeatures.filter",h.filter,null,h);const d=this.sourceCaches[s];return d?function(g,b){const I=g.getRenderableIds().map(N=>g.getTileByID(N)),C=[],M={};for(let N=0;N{_t[g]=b})(s,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:s,url:h.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(s,h={}){this._checkLoaded();const d=this.light.getLight();let g=!1;for(const I in s)if(!a.aG(s[I],d[I])){g=!0;break}if(!g)return;const b={now:a.h.now(),transition:a.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,h),this.light.updateTransitions(b)}_validate(s,h,d,g,b={}){return(!b||b.validate!==!1)&&Zr(this,s.call(a.y,a.e({key:h,style:this.serialize(),value:d,styleSpec:a.v},g)))}_remove(s=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const h in this._layers)this._layers[h].setEventedParent(null);for(const h in this.sourceCaches){const d=this.sourceCaches[h];d.setEventedParent(null),d.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(const h in this.sourceCaches)this.sourceCaches[h].update(s,this.map.terrain)}_generateCollisionBoxes(){for(const s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,h,d,g,b=!1){let I=!1,C=!1;const M={};for(const N of this._order){const R=this._layers[N];if(R.type!=="symbol")continue;if(!M[R.source]){const W=this.sourceCaches[R.source];M[R.source]=W.getRenderableIds(!0).map(it=>W.getTileByID(it)).sort((it,et)=>et.tileID.overscaledZ-it.tileID.overscaledZ||(it.tileID.isLessThan(et.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(R,M[R.source],s.center.lng);I=I||z}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.h.now(),s.zoom))&&(this.pauseablePlacement=new ou(s,this.map.terrain,this._order,b,h,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.h.now()),C=!0),I&&this.pauseablePlacement.placement.setStale()),C||I)for(const N of this._order){const R=this._layers[N];R.type==="symbol"&&this.placement.updateLayerOpacities(R,M[R.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.h.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,h,d){this.imageManager.getImages(h.icons,d),this._updateTilesForChangedImages();const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,h.icons)}getGlyphs(s,h,d){this.glyphManager.getGlyphs(h.stacks,d);const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,[""])}getResource(s,h,d){return a.m(h,d)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,h={}){this._checkLoaded(),s&&this._validate(a.y.glyphs,"glyphs",s,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,h,d={},g){this._checkLoaded();const b=[{id:s,url:h}],I=[...gt(this.stylesheet.sprite),...b];this._validate(a.y.sprite,"sprite",I,null,d)||(this.stylesheet.sprite=I,this._loadSprite(b,!0,g))}removeSprite(s){this._checkLoaded();const h=gt(this.stylesheet.sprite);if(h.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;h.splice(h.findIndex(d=>d.id===s),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return gt(this.stylesheet.sprite)}setSprite(s,h={},d){this._checkLoaded(),s&&this._validate(a.y.sprite,"sprite",s,null,h)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}Dr.registerForPluginStateChange=a.aK;var Uc=a.Q([{name:"a_pos",type:"Int16",components:2}]),au="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 Ei={prelude:Fn(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -525,62 +525,62 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Fn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",su),terrainDepth:Fn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",su),terrainCoords:Fn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",su)};function Fn(y,s){const h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),I=b?b.concat(g):g,C={};return{fragmentSource:y=y.replace(h,(M,N,O,z,W)=>(C[W]=!0,N==="define"?` +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Fn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",au),terrainDepth:Fn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",au),terrainCoords:Fn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",au)};function Fn(y,s){const h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),I=b?b.concat(g):g,C={};return{fragmentSource:y=y.replace(h,(M,N,R,z,W)=>(C[W]=!0,N==="define"?` #ifndef HAS_UNIFORM_u_${W} -varying ${O} ${z} ${W}; +varying ${R} ${z} ${W}; #else -uniform ${O} ${z} u_${W}; +uniform ${R} ${z} u_${W}; #endif `:` #ifdef HAS_UNIFORM_u_${W} - ${O} ${z} ${W} = u_${W}; + ${R} ${z} ${W} = u_${W}; #endif -`)),vertexSource:s=s.replace(h,(M,N,O,z,W)=>{const nt=z==="float"?"vec2":"vec4",et=W.match(/color/)?"color":nt;return C[W]?N==="define"?` +`)),vertexSource:s=s.replace(h,(M,N,R,z,W)=>{const it=z==="float"?"vec2":"vec4",et=W.match(/color/)?"color":it;return C[W]?N==="define"?` #ifndef HAS_UNIFORM_u_${W} uniform lowp float u_${W}_t; -attribute ${O} ${nt} a_${W}; -varying ${O} ${z} ${W}; +attribute ${R} ${it} a_${W}; +varying ${R} ${z} ${W}; #else -uniform ${O} ${z} u_${W}; +uniform ${R} ${z} u_${W}; #endif `:et==="vec4"?` #ifndef HAS_UNIFORM_u_${W} ${W} = a_${W}; #else - ${O} ${z} ${W} = u_${W}; + ${R} ${z} ${W} = u_${W}; #endif `:` #ifndef HAS_UNIFORM_u_${W} ${W} = unpack_mix_${et}(a_${W}, u_${W}_t); #else - ${O} ${z} ${W} = u_${W}; + ${R} ${z} ${W} = u_${W}; #endif `:N==="define"?` #ifndef HAS_UNIFORM_u_${W} uniform lowp float u_${W}_t; -attribute ${O} ${nt} a_${W}; +attribute ${R} ${it} a_${W}; #else -uniform ${O} ${z} u_${W}; +uniform ${R} ${z} u_${W}; #endif `:et==="vec4"?` #ifndef HAS_UNIFORM_u_${W} - ${O} ${z} ${W} = a_${W}; + ${R} ${z} ${W} = a_${W}; #else - ${O} ${z} ${W} = u_${W}; + ${R} ${z} ${W} = u_${W}; #endif `:` #ifndef HAS_UNIFORM_u_${W} - ${O} ${z} ${W} = unpack_mix_${et}(a_${W}, u_${W}_t); + ${R} ${z} ${W} = unpack_mix_${et}(a_${W}, u_${W}_t); #else - ${O} ${z} ${W} = u_${W}; + ${R} ${z} ${W} = u_${W}; #endif -`}),staticAttributes:d,staticUniforms:I}}class wl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,h,d,g,b,I,C,M,N){this.context=s;let O=this.boundPaintVertexBuffers.length!==g.length;for(let z=0;!O&&z({u_depth:new a.aL(Vt,Xt.u_depth),u_terrain:new a.aL(Vt,Xt.u_terrain),u_terrain_dim:new a.aM(Vt,Xt.u_terrain_dim),u_terrain_matrix:new a.aN(Vt,Xt.u_terrain_matrix),u_terrain_unpack:new a.aO(Vt,Xt.u_terrain_unpack),u_terrain_exaggeration:new a.aM(Vt,Xt.u_terrain_exaggeration)}))(s,Bt),this.binderUniforms=d?d.getUniforms(s,Bt):[]}draw(s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at,$,Et,Ot){const ht=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(g),s.setColorMode(b),s.setCullFace(I),M){s.activeTexture.set(ht.TEXTURE2),ht.bindTexture(ht.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ht.TEXTURE3),ht.bindTexture(ht.TEXTURE_2D,M.texture);for(const Bt in this.terrainUniforms)this.terrainUniforms[Bt].set(M[Bt])}for(const Bt in this.fixedUniforms)this.fixedUniforms[Bt].set(C[Bt]);at&&at.setUniforms(s,this.binderUniforms,nt,{zoom:et});let Tt=0;switch(h){case ht.LINES:Tt=2;break;case ht.TRIANGLES:Tt=3;break;case ht.LINE_STRIP:Tt=1}for(const Bt of W.get()){const Vt=Bt.vaos||(Bt.vaos={});(Vt[N]||(Vt[N]=new wl)).bind(s,this,O,at?at.getPaintVertexBuffers():[],z,Bt.vertexOffset,$,Et,Ot),ht.drawElements(h,Bt.primitiveLength*Tt,ht.UNSIGNED_SHORT,Bt.primitiveOffset*Tt*2)}}}function os(y,s,h){const d=1/yt(h,1,s.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),b=h.tileSize*Math.pow(2,s.transform.tileZoom)/g,I=b*(h.tileID.canonical.x+h.tileID.wrap*g),C=b*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[I>>16,C>>16],u_pixel_coord_lower:[65535&I,65535&C]}}const mf=(y,s,h,d)=>{const g=s.style.light,b=g.properties.get("position"),I=[b.x,b.y,b.z],C=function(){var N=new a.A(9);return a.A!=Float32Array&&(N[1]=0,N[2]=0,N[3]=0,N[5]=0,N[6]=0,N[7]=0),N[0]=1,N[4]=1,N[8]=1,N}();g.properties.get("anchor")==="viewport"&&function(N,O){var z=Math.sin(O),W=Math.cos(O);N[0]=W,N[1]=z,N[2]=0,N[3]=-z,N[4]=W,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(C,-s.transform.angle),function(N,O,z){var W=O[0],nt=O[1],et=O[2];N[0]=W*z[0]+nt*z[3]+et*z[6],N[1]=W*z[1]+nt*z[4]+et*z[7],N[2]=W*z[2]+nt*z[5]+et*z[8]}(I,I,C);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:I,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+h,u_opacity:d}},Ya=(y,s,h,d,g,b,I)=>a.e(mf(y,s,h,d),os(b,s,I),{u_height_factor:-Math.pow(2,g.overscaledZ)/I.tileSize/8}),xd=y=>({u_matrix:y}),gf=(y,s,h,d)=>a.e(xd(y),os(h,s,d)),Gc=(y,s)=>({u_matrix:y,u_world:s}),jc=(y,s,h,d,g)=>a.e(gf(y,s,h,d),{u_world:g}),Ka=(y,s,h,d)=>{const g=y.transform;let b,I;if(d.paint.get("circle-pitch-alignment")==="map"){const C=yt(h,1,g.zoom);b=!0,I=[C,C]}else b=!1,I=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,h,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:I}},_f=(y,s,h)=>{const d=yt(h,1,s.zoom),g=Math.pow(2,s.zoom-h.tileID.overscaledZ),b=h.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:b}},Xu=(y,s,h=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:h}),wd=y=>({u_matrix:y}),zg=(y,s,h,d)=>({u_matrix:y,u_extrude_scale:yt(s,1,h),u_intensity:d});function yf(y,s){const h=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new a.U(0,d/h).toLngLat().lat,new a.U(0,(d+1)/h).toLngLat().lat]}const vf=(y,s,h,d)=>{const g=y.transform;return{u_matrix:qc(y,s,h,d),u_ratio:1/yt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Sd=(y,s,h,d,g)=>a.e(vf(y,s,h,g),{u_image:0,u_image_height:d}),Fg=(y,s,h,d,g)=>{const b=y.transform,I=Id(s,b);return{u_matrix:qc(y,s,h,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/yt(s,1,b.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[I,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Ed=(y,s,h,d,g,b)=>{const I=y.lineAtlas,C=Id(s,y.transform),M=h.layout.get("line-cap")==="round",N=I.getDash(d.from,M),O=I.getDash(d.to,M),z=N.width*g.fromScale,W=O.width*g.toScale;return a.e(vf(y,s,h,b),{u_patternscale_a:[C/z,-N.height/2],u_patternscale_b:[C/W,-O.height/2],u_sdfgamma:I.width/(256*Math.min(z,W)*y.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:O.y,u_mix:g.t})};function Id(y,s){return 1/yt(y,1,s.tileZoom)}function qc(y,s,h,d){return y.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Cd=(y,s,h,d,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:h,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(I=g.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(b=g.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:Td(g.paint.get("raster-hue-rotate"))};var b,I};function Td(y){y*=Math.PI/180;const s=Math.sin(y),h=Math.cos(y);return[(2*h+1)/3,(-Math.sqrt(3)*s-h+1)/3,(Math.sqrt(3)*s-h+1)/3]}const bf=(y,s,h,d,g,b,I,C,M,N)=>{const O=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:O.width/O.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:I,u_coord_matrix:C,u_is_text:+M,u_pitch_with_map:+d,u_texsize:N,u_texture:0}},xf=(y,s,h,d,g,b,I,C,M,N,O)=>{const z=g.transform;return a.e(bf(y,s,h,d,g,b,I,C,M,N),{u_gamma_scale:d?Math.cos(z._pitch)*z.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+O})},Sl=(y,s,h,d,g,b,I,C,M,N)=>a.e(xf(y,s,h,d,g,b,I,C,!0,M,!0),{u_texsize_icon:N,u_texture_icon:1}),Zc=(y,s,h)=>({u_matrix:y,u_opacity:s,u_color:h}),ss=(y,s,h,d,g,b)=>a.e(function(I,C,M,N){const O=M.imageManager.getPattern(I.from.toString()),z=M.imageManager.getPattern(I.to.toString()),{width:W,height:nt}=M.imageManager.getPixelSize(),et=Math.pow(2,N.tileID.overscaledZ),at=N.tileSize*Math.pow(2,M.transform.tileZoom)/et,$=at*(N.tileID.canonical.x+N.tileID.wrap*et),Et=at*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:z.tl,u_pattern_br_b:z.br,u_texsize:[W,nt],u_mix:C.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:z.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/yt(N,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,Et>>16],u_pixel_coord_lower:[65535&$,65535&Et]}}(d,b,h,g),{u_matrix:y,u_opacity:s}),Wc={fillExtrusion:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_opacity:new a.aM(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_height_factor:new a.aM(y,s.u_height_factor),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade),u_opacity:new a.aM(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_scale_with_map:new a.aL(y,s.u_scale_with_map),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_matrix:new a.aN(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new a.aM(y,s.u_pixels_to_tile_units),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_overscale_factor:new a.aM(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_inv_matrix:new a.aN(y,s.u_inv_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_viewport_size:new a.aQ(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new a.aR(y,s.u_color),u_matrix:new a.aN(y,s.u_matrix),u_overlay:new a.aL(y,s.u_overlay),u_overlay_scale:new a.aM(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new a.aM(y,s.u_extrude_scale),u_intensity:new a.aM(y,s.u_intensity),u_matrix:new a.aN(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_color_ramp:new a.aL(y,s.u_color_ramp),u_opacity:new a.aM(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_latrange:new a.aQ(y,s.u_latrange),u_light:new a.aQ(y,s.u_light),u_shadow:new a.aR(y,s.u_shadow),u_highlight:new a.aR(y,s.u_highlight),u_accent:new a.aR(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_dimension:new a.aQ(y,s.u_dimension),u_zoom:new a.aM(y,s.u_zoom),u_unpack:new a.aO(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_image:new a.aL(y,s.u_image),u_image_height:new a.aM(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texsize:new a.aQ(y,s.u_texsize),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_image:new a.aL(y,s.u_image),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_patternscale_a:new a.aQ(y,s.u_patternscale_a),u_patternscale_b:new a.aQ(y,s.u_patternscale_b),u_sdfgamma:new a.aM(y,s.u_sdfgamma),u_image:new a.aL(y,s.u_image),u_tex_y_a:new a.aM(y,s.u_tex_y_a),u_tex_y_b:new a.aM(y,s.u_tex_y_b),u_mix:new a.aM(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_tl_parent:new a.aQ(y,s.u_tl_parent),u_scale_parent:new a.aM(y,s.u_scale_parent),u_buffer_scale:new a.aM(y,s.u_buffer_scale),u_fade_t:new a.aM(y,s.u_fade_t),u_opacity:new a.aM(y,s.u_opacity),u_image0:new a.aL(y,s.u_image0),u_image1:new a.aL(y,s.u_image1),u_brightness_low:new a.aM(y,s.u_brightness_low),u_brightness_high:new a.aM(y,s.u_brightness_high),u_saturation_factor:new a.aM(y,s.u_saturation_factor),u_contrast_factor:new a.aM(y,s.u_contrast_factor),u_spin_weights:new a.aP(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texsize_icon:new a.aQ(y,s.u_texsize_icon),u_texture:new a.aL(y,s.u_texture),u_texture_icon:new a.aL(y,s.u_texture_icon),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_color:new a.aR(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_image:new a.aL(y,s.u_image),u_pattern_tl_a:new a.aQ(y,s.u_pattern_tl_a),u_pattern_br_a:new a.aQ(y,s.u_pattern_br_a),u_pattern_tl_b:new a.aQ(y,s.u_pattern_tl_b),u_pattern_br_b:new a.aQ(y,s.u_pattern_br_b),u_texsize:new a.aQ(y,s.u_texsize),u_mix:new a.aM(y,s.u_mix),u_pattern_size_a:new a.aQ(y,s.u_pattern_size_a),u_pattern_size_b:new a.aQ(y,s.u_pattern_size_b),u_scale_a:new a.aM(y,s.u_scale_a),u_scale_b:new a.aM(y,s.u_scale_b),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new a.aM(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_terrain_coords_id:new a.aM(y,s.u_terrain_coords_id),u_ele_delta:new a.aM(y,s.u_ele_delta)})};class Xc{constructor(s,h,d){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Hu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Hc{constructor(s,h,d,g){this.length=h.length,this.attributes=d,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=s;const b=s.gl;this.buffer=b.createBuffer(),s.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,h){for(let d=0;d0){const oe=a.Z(),Le=Xt;a.aU(oe,Vt.placementInvProjMatrix,y.transform.glCoordMatrix),a.aU(oe,oe,Vt.placementViewportMatrix),O.push({circleArray:$t,circleOffset:W,transform:Le,invTransform:oe,coord:Tt}),z+=$t.length/4,W=z}ee&&N.draw(C,M.LINES,Tn.disabled,Si.disabled,y.colorModeForRenderPass(),gi.disabled,_f(Xt,y.transform,Bt),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Tt),h.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,y.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!I||!O.length)return;const nt=y.useProgram("collisionCircle"),et=new a.aV;et.resize(4*z),et._trim();let at=0;for(const ht of O)for(let Tt=0;Tt=0&&(et[$.associatedIconIndex]={shiftedAnchor:vn,angle:fe})}else K($.numGlyphs,W)}if(N){nt.clear();const at=y.icon.placedSymbolArray;for(let $=0;$y.style.map.terrain.getElevation(ee,xo,Ui):null,dr=h.layout.get("text-rotation-alignment")==="map";ue(oe,ee.posMatrix,y,g,hi,qs,$,N,dr,Vi)}const Pl=y.translatePosMatrix(ee.posMatrix,$t,b,I),_u=Et||g&&Vt||el?Af:hi,Wr=y.translatePosMatrix(qs,$t,b,I,!0),Or=fe&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ao;ao=fe?oe.iconsInText?Sl(Ge.kind,_n,Ot,$,y,Pl,_u,Wr,bn,pr):xf(Ge.kind,_n,Ot,$,y,Pl,_u,Wr,g,bn,!0):bf(Ge.kind,_n,Ot,$,y,Pl,_u,Wr,g,bn);const kl={program:Yn,buffers:Le,uniformValues:ao,atlasTexture:Bi,atlasTextureIcon:Yi,atlasInterpolation:si,atlasInterpolationIcon:Rr,isSDF:fe,hasHalo:Or};if(ht&&oe.canOverlap){Tt=!0;const Vi=Le.segments.get();for(const dr of Vi)Xt.push({segments:new a.S([dr]),sortKey:dr.sortKey,state:kl,terrainData:un})}else Xt.push({segments:Le.segments,sortKey:0,state:kl,terrainData:un})}Tt&&Xt.sort((ee,$t)=>ee.sortKey-$t.sortKey);for(const ee of Xt){const $t=ee.state;if(W.activeTexture.set(nt.TEXTURE0),$t.atlasTexture.bind($t.atlasInterpolation,nt.CLAMP_TO_EDGE),$t.atlasTextureIcon&&(W.activeTexture.set(nt.TEXTURE1),$t.atlasTextureIcon&&$t.atlasTextureIcon.bind($t.atlasInterpolationIcon,nt.CLAMP_TO_EDGE)),$t.isSDF){const oe=$t.uniformValues;$t.hasHalo&&(oe.u_is_halo=1,Df($t.buffers,ee.segments,h,y,$t.program,Bt,O,z,oe,ee.terrainData)),oe.u_is_halo=0}Df($t.buffers,ee.segments,h,y,$t.program,Bt,O,z,$t.uniformValues,ee.terrainData)}}function Df(y,s,h,d,g,b,I,C,M,N){const O=d.context;g.draw(O,O.gl.TRIANGLES,b,I,C,gi.disabled,M,N,h.id,y.layoutVertexBuffer,y.indexBuffer,s,h.paint,d.transform.zoom,y.programConfigurations.get(h.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Ku(y,s,h,d,g){if(!h||!d||!d.imageAtlas)return;const b=d.imageAtlas.patternPositions;let I=b[h.to.toString()],C=b[h.from.toString()];if(!I&&C&&(I=C),!C&&I&&(C=I),!I||!C){const M=g.getPaintProperty(s);I=b[M],C=b[M]}I&&C&&y.setConstantPatternPositions(I,C)}function Ju(y,s,h,d,g,b,I){const C=y.context.gl,M="fill-pattern",N=h.paint.get(M),O=N&&N.constantOr(1),z=h.getCrossfadeParameters();let W,nt,et,at,$;I?(nt=O&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=C.LINES):(nt=O?"fillPattern":"fill",W=C.TRIANGLES);const Et=N.constantOr(null);for(const Ot of d){const ht=s.getTile(Ot);if(O&&!ht.patternsLoaded())continue;const Tt=ht.getBucket(h);if(!Tt)continue;const Bt=Tt.programConfigurations.get(h.id),Vt=y.useProgram(nt,Bt),Xt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ot);O&&(y.context.activeTexture.set(C.TEXTURE0),ht.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Bt.updatePaintBuffers(z)),Ku(Bt,M,Et,ht,h);const ee=Xt?Ot:null,$t=y.translatePosMatrix(ee?ee.posMatrix:Ot.posMatrix,ht,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(I){at=Tt.indexBuffer2,$=Tt.segments2;const oe=[C.drawingBufferWidth,C.drawingBufferHeight];et=nt==="fillOutlinePattern"&&O?jc($t,y,z,ht,oe):Gc($t,oe)}else at=Tt.indexBuffer,$=Tt.segments,et=O?gf($t,y,z,ht):xd($t);Vt.draw(y.context,W,g,y.stencilModeForClipping(Ot),b,gi.disabled,et,Xt,h.id,Tt.layoutVertexBuffer,at,$,h.paint,y.transform.zoom,Bt)}}function Qu(y,s,h,d,g,b,I){const C=y.context,M=C.gl,N="fill-extrusion-pattern",O=h.paint.get(N),z=O.constantOr(1),W=h.getCrossfadeParameters(),nt=h.paint.get("fill-extrusion-opacity"),et=O.constantOr(null);for(const at of d){const $=s.getTile(at),Et=$.getBucket(h);if(!Et)continue;const Ot=y.style.map.terrain&&y.style.map.terrain.getTerrainData(at),ht=Et.programConfigurations.get(h.id),Tt=y.useProgram(z?"fillExtrusionPattern":"fillExtrusion",ht);z&&(y.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ht.updatePaintBuffers(W)),Ku(ht,N,et,$,h);const Bt=y.translatePosMatrix(at.posMatrix,$,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Vt=h.paint.get("fill-extrusion-vertical-gradient"),Xt=z?Ya(Bt,y,Vt,nt,at,W,$):mf(Bt,y,Vt,nt);Tt.draw(C,C.gl.TRIANGLES,g,b,I,gi.backCCW,Xt,Ot,h.id,Et.layoutVertexBuffer,Et.indexBuffer,Et.segments,h.paint,y.transform.zoom,ht,y.style.map.terrain&&Et.centroidVertexBuffer)}}function Wg(y,s,h,d,g,b,I){const C=y.context,M=C.gl,N=h.fbo;if(!N)return;const O=y.useProgram("hillshade"),z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);C.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,N.colorAttachment.get()),O.draw(C,M.TRIANGLES,g,b,I,gi.disabled,((W,nt,et,at)=>{const $=et.paint.get("hillshade-shadow-color"),Et=et.paint.get("hillshade-highlight-color"),Ot=et.paint.get("hillshade-accent-color");let ht=et.paint.get("hillshade-illumination-direction")*(Math.PI/180);et.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=W.transform.angle);const Tt=!W.options.moving;return{u_matrix:at?at.posMatrix:W.transform.calculatePosMatrix(nt.tileID.toUnwrapped(),Tt),u_image:0,u_latrange:yf(0,nt.tileID),u_light:[et.paint.get("hillshade-exaggeration"),ht],u_shadow:$,u_highlight:Et,u_accent:Ot}})(y,h,d,z?s:null),z,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Rf(y,s,h,d,g,b){const I=y.context,C=I.gl,M=s.dem;if(M&&M.data){const N=M.dim,O=M.stride,z=M.getPixels();if(I.activeTexture.set(C.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(O),s.demTexture){const nt=s.demTexture;nt.update(z,{premultiply:!1}),nt.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else s.demTexture=new Mt(I,z,C.RGBA,{premultiply:!1}),s.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);I.activeTexture.set(C.TEXTURE0);let W=s.fbo;if(!W){const nt=new Mt(I,{width:N,height:N,data:null},C.RGBA);nt.bind(C.LINEAR,C.CLAMP_TO_EDGE),W=s.fbo=I.createFramebuffer(N,N,!0,!1),W.colorAttachment.set(nt.texture)}I.bindFramebuffer.set(W.framebuffer),I.viewport.set([0,0,N,N]),y.useProgram("hillshadePrepare").draw(I,C.TRIANGLES,d,g,b,gi.disabled,((nt,et)=>{const at=et.stride,$=a.Z();return a.aS($,0,a.N,-a.N,0,0,1),a.$($,$,[0,-a.N,0]),{u_matrix:$,u_image:1,u_dimension:[at,at],u_zoom:nt.overscaledZ,u_unpack:et.getUnpackVector()}})(s.tileID,M),null,h.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Xg(y,s,h,d,g,b){const I=d.paint.get("raster-fade-duration");if(!b&&I>0){const C=a.h.now(),M=(C-y.timeAdded)/I,N=s?(C-s.timeAdded)/I:-1,O=h.getSource(),z=g.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-z)>Math.abs(y.tileID.overscaledZ-z),nt=W&&y.refreshedUponExpiration?1:a.ad(W?M:1-N,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-nt}:{opacity:nt,mix:0}}return{opacity:1,mix:0}}const Rd=new a.aT(1,0,0,1),rh=new a.aT(0,1,0,1),Of=new a.aT(0,0,1,1),Od=new a.aT(1,0,1,1),zd=new a.aT(0,1,1,1);function $u(y,s,h,d){sh(y,0,s+h/2,y.transform.width,h,d)}function oh(y,s,h,d){sh(y,s-h/2,0,h,y.transform.height,d)}function sh(y,s,h,d,g,b){const I=y.context,C=I.gl;C.enable(C.SCISSOR_TEST),C.scissor(s*y.pixelRatio,h*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),I.clear({color:b}),C.disable(C.SCISSOR_TEST)}function Fd(y,s,h){const d=y.context,g=d.gl,b=h.posMatrix,I=y.useProgram("debug"),C=Tn.disabled,M=Si.disabled,N=y.colorModeForRenderPass(),O="$debug",z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(h);d.activeTexture.set(g.TEXTURE0);const W=s.getTileByID(h.key).latestRawTileData,nt=Math.floor((W&&W.byteLength||0)/1024),et=s.getTile(h).tileSize,at=512/Math.min(et,512)*(h.overscaledZ/y.transform.zoom)*.5;let $=h.canonical.toString();h.overscaledZ!==h.canonical.z&&($+=` => ${h.overscaledZ}`),function(Et,Ot){Et.initDebugOverlayCanvas();const ht=Et.debugOverlayCanvas,Tt=Et.context.gl,Bt=Et.debugOverlayCanvas.getContext("2d");Bt.clearRect(0,0,ht.width,ht.height),Bt.shadowColor="white",Bt.shadowBlur=2,Bt.lineWidth=1.5,Bt.strokeStyle="white",Bt.textBaseline="top",Bt.font="bold 36px Open Sans, sans-serif",Bt.fillText(Ot,5,5),Bt.strokeText(Ot,5,5),Et.debugOverlayTexture.update(ht),Et.debugOverlayTexture.bind(Tt.LINEAR,Tt.CLAMP_TO_EDGE)}(y,`${$} ${nt}kB`),I.draw(d,g.TRIANGLES,C,M,wi.alphaBlended,gi.disabled,Xu(b,a.aT.transparent,at),null,O,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),I.draw(d,g.LINE_STRIP,C,M,N,gi.disabled,Xu(b,a.aT.red),z,O,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Ai(y,s,h){const d=y.context,g=d.gl,b=y.colorModeForRenderPass(),I=new Tn(g.LEQUAL,Tn.ReadWrite,y.depthRangeFor3D),C=y.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const N of h){const O=y.renderToTexture.getTexture(N),z=s.getTerrainData(N.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,O.texture);const W={u_matrix:y.transform.calculatePosMatrix(N.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};C.draw(d,g.TRIANGLES,I,Si.disabled,b,gi.backCCW,W,z,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Cl{constructor(s,h){this.context=new Zg(s),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.Z(),renderTime:0},this.setup(),this.numSublayers=Fi.maxUnderzooming+Fi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Bc}resize(s,h,d){if(this.width=Math.floor(s*d),this.height=Math.floor(h*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,h=new a.a_;h.emplaceBack(0,0),h.emplaceBack(a.N,0),h.emplaceBack(0,a.N),h.emplaceBack(a.N,a.N),this.tileExtentBuffer=s.createVertexBuffer(h,Vc.members),this.tileExtentSegments=a.S.simpleSegment(0,0,4,2);const d=new a.a_;d.emplaceBack(0,0),d.emplaceBack(a.N,0),d.emplaceBack(0,a.N),d.emplaceBack(a.N,a.N),this.debugBuffer=s.createVertexBuffer(d,Vc.members),this.debugSegments=a.S.simpleSegment(0,0,4,5);const g=new a.V;g.emplaceBack(0,0,0,0),g.emplaceBack(a.N,0,a.N,0),g.emplaceBack(0,a.N,0,a.N),g.emplaceBack(a.N,a.N,a.N,a.N),this.rasterBoundsBuffer=s.createVertexBuffer(g,hn.members),this.rasterBoundsSegments=a.S.simpleSegment(0,0,4,2);const b=new a.a_;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(b,Vc.members),this.viewportSegments=a.S.simpleSegment(0,0,4,2);const I=new a.a$;I.emplaceBack(0),I.emplaceBack(1),I.emplaceBack(3),I.emplaceBack(2),I.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(I);const C=new a.b0;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(C);const M=this.context.gl;this.stencilClearMode=new Si({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,h=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=a.Z();a.aS(d,0,this.width,this.height,0,0,1),a.a0(d,d,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,h.TRIANGLES,Tn.disabled,this.stencilClearMode,wi.disabled,gi.disabled,wd(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,h){if(this.currentStencilSource===s.source||!s.isTileClipped()||!h||!h.length)return;this.currentStencilSource=s.source;const d=this.context,g=d.gl;this.nextStencilID+h.length>256&&this.clearStencil(),d.setColorMode(wi.disabled),d.setDepthMode(Tn.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of h){const C=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I);b.draw(d,g.TRIANGLES,Tn.disabled,new Si({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),wi.disabled,gi.disabled,wd(I.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,h=this.context.gl;return new Si({func:h.NOTEQUAL,mask:255},s,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(s){const h=this.context.gl;return new Si({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(s){const h=this.context.gl,d=s.sort((I,C)=>C.overscaledZ-I.overscaledZ),g=d[d.length-1].overscaledZ,b=d[0].overscaledZ-g+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const I={};for(let C=0;C=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],N=g[M.source],O=b[M.source];this._renderTileClippingMasks(M,O),this.renderLayer(this,N,M,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(O)?[N.sourceCaches[$.source]]:[]),nt=W.filter($=>$.getSource().type==="vector"),et=W.filter($=>$.getSource().type!=="vector"),at=$=>{(!z||z.getSource().maxzoom<$.getSource().maxzoom)&&(z=$)};return nt.forEach($=>at($)),z||et.forEach($=>at($)),z}(this.style,this.transform.zoom);M&&function(N,O,z){for(let W=0;Wnt.style.map.terrain.getElevation(Vt,Ge,Pe):null)}}}(M,b,C,I,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),N),C.paint.get("icon-opacity").constantOr(1)!==0&&ih(b,I,C,M,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),O,z),C.paint.get("text-opacity").constantOr(1)!==0&&ih(b,I,C,M,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),O,z),I.map.showCollisionBoxes&&(Dd(b,I,C,M,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),!0),Dd(b,I,C,M,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),!1))})(s,h,d,g,this.style.placement.variableOffsets);break;case"circle":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const N=C.paint.get("circle-opacity"),O=C.paint.get("circle-stroke-width"),z=C.paint.get("circle-stroke-opacity"),W=!C.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(O.constantOr(1)===0||z.constantOr(1)===0))return;const nt=b.context,et=nt.gl,at=b.depthModeForSublayer(0,Tn.ReadOnly),$=Si.disabled,Et=b.colorModeForRenderPass(),Ot=[];for(let ht=0;htht.sortKey-Tt.sortKey);for(const ht of Ot){const{programConfiguration:Tt,program:Bt,layoutVertexBuffer:Vt,indexBuffer:Xt,uniformValues:ee,terrainData:$t}=ht.state;Bt.draw(nt,et.TRIANGLES,at,$,Et,gi.disabled,ee,$t,C.id,Vt,Xt,ht.segments,C.paint,b.transform.zoom,Tt)}})(s,h,d,g);break;case"heatmap":(function(b,I,C,M){if(C.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const N=b.context,O=N.gl,z=Si.disabled,W=new wi([O.ONE,O.ONE],a.aT.transparent,[!0,!0,!0,!0]);(function(nt,et,at){const $=nt.gl;nt.activeTexture.set($.TEXTURE1),nt.viewport.set([0,0,et.width/4,et.height/4]);let Et=at.heatmapFbo;if(Et)$.bindTexture($.TEXTURE_2D,Et.colorAttachment.get()),nt.bindFramebuffer.set(Et.framebuffer);else{const Ot=$.createTexture();$.bindTexture($.TEXTURE_2D,Ot),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_S,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_T,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MIN_FILTER,$.LINEAR),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MAG_FILTER,$.LINEAR),Et=at.heatmapFbo=nt.createFramebuffer(et.width/4,et.height/4,!1,!1),function(ht,Tt,Bt,Vt){var Xt,ee;const $t=ht.gl,oe=(Xt=ht.HALF_FLOAT)!==null&&Xt!==void 0?Xt:$t.UNSIGNED_BYTE,Le=(ee=ht.RGBA16F)!==null&&ee!==void 0?ee:$t.RGBA;$t.texImage2D($t.TEXTURE_2D,0,Le,Tt.width/4,Tt.height/4,0,$t.RGBA,oe,null),Vt.colorAttachment.set(Bt)}(nt,et,Ot,Et)}})(N,b,C),N.clear({color:a.aT.transparent});for(let nt=0;nt{const ht=a.Z();a.aS(ht,0,at.width,at.height,0,0,1);const Tt=at.context.gl;return{u_matrix:ht,u_world:[Tt.drawingBufferWidth,Tt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(N,O),null,O.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments,O.paint,N.transform.zoom)}(b,C))})(s,h,d,g);break;case"line":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const N=C.paint.get("line-opacity"),O=C.paint.get("line-width");if(N.constantOr(1)===0||O.constantOr(1)===0)return;const z=b.depthModeForSublayer(0,Tn.ReadOnly),W=b.colorModeForRenderPass(),nt=C.paint.get("line-dasharray"),et=C.paint.get("line-pattern"),at=et.constantOr(1),$=C.paint.get("line-gradient"),Et=C.getCrossfadeParameters(),Ot=at?"linePattern":nt?"lineSDF":$?"lineGradient":"line",ht=b.context,Tt=ht.gl;let Bt=!0;for(const Vt of M){const Xt=I.getTile(Vt);if(at&&!Xt.patternsLoaded())continue;const ee=Xt.getBucket(C);if(!ee)continue;const $t=ee.programConfigurations.get(C.id),oe=b.context.program.get(),Le=b.useProgram(Ot,$t),vn=Bt||Le.program!==oe,fe=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Vt),Ge=et.constantOr(null);if(Ge&&Xt.imageAtlas){const _n=Xt.imageAtlas,un=_n.patternPositions[Ge.to.toString()],bn=_n.patternPositions[Ge.from.toString()];un&&bn&&$t.setConstantPatternPositions(un,bn)}const Pe=fe?Vt:null,Yn=at?Fg(b,Xt,C,Et,Pe):nt?Ed(b,Xt,C,nt,Et,Pe):$?Sd(b,Xt,C,ee.lineClipsArray.length,Pe):vf(b,Xt,C,Pe);if(at)ht.activeTexture.set(Tt.TEXTURE0),Xt.imageAtlasTexture.bind(Tt.LINEAR,Tt.CLAMP_TO_EDGE),$t.updatePaintBuffers(Et);else if(nt&&(vn||b.lineAtlas.dirty))ht.activeTexture.set(Tt.TEXTURE0),b.lineAtlas.bind(ht);else if($){const _n=ee.gradients[C.id];let un=_n.texture;if(C.gradientVersion!==_n.version){let bn=256;if(C.stepInterpolant){const Bi=I.getSource().maxzoom,si=Vt.canonical.z===Bi?Math.ceil(1<0?h.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const h=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!h||!d}useProgram(s,h){this.cache=this.cache||{};const d=s+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Uc(this.context,xi[s],h,Wc[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Mt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:h}=this.context.gl;return this.width!==s||this.height!==h}}class vo{constructor(s,h){this.points=s,this.planes=h}static fromInvProjectionMatrix(s,h,d){const g=Math.pow(2,d),b=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(C=>{const M=1/(C=a.ag([],C,s))[3]/h*g;return a.b3(C,C,[M,M,1/C[3],M])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const M=function(W,nt){var et=nt[0],at=nt[1],$=nt[2],Et=et*et+at*at+$*$;return Et>0&&(Et=1/Math.sqrt(Et)),W[0]=nt[0]*Et,W[1]=nt[1]*Et,W[2]=nt[2]*Et,W}([],function(W,nt,et){var at=nt[0],$=nt[1],Et=nt[2],Ot=et[0],ht=et[1],Tt=et[2];return W[0]=$*Tt-Et*ht,W[1]=Et*Ot-at*Tt,W[2]=at*ht-$*Ot,W}([],ft([],b[C[0]],b[C[1]]),ft([],b[C[2]],b[C[1]]))),N=-((O=M)[0]*(z=b[C[1]])[0]+O[1]*z[1]+O[2]*z[2]);var O,z;return M.concat(N)});return new vo(b,I)}}class hu{constructor(s,h){this.min=s,this.max=h,this.center=function(d,g,b){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,b){return d[0]=g[0]+b[0],d[1]=g[1]+b[1],d[2]=g[2]+b[2],d}([],this.min,this.max))}quadrant(s){const h=[s%2==0,s<2],d=J(this.min),g=J(this.max);for(let b=0;b=0&&I++;if(I===0)return 0;I!==h.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let b=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let C=0;Cthis.max[g]-this.min[g])return 0}return 1}}class tc{constructor(s=0,h=0,d=0,g=0){if(isNaN(s)||s<0||isNaN(h)||h<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=h,this.left=d,this.right=g}interpolate(s,h,d){return h.top!=null&&s.top!=null&&(this.top=a.B.number(s.top,h.top,d)),h.bottom!=null&&s.bottom!=null&&(this.bottom=a.B.number(s.bottom,h.bottom,d)),h.left!=null&&s.left!=null&&(this.left=a.B.number(s.left,h.left,d)),h.right!=null&&s.right!=null&&(this.right=a.B.number(s.right,h.right,d)),this}getCenter(s,h){const d=a.ad((this.left+s-this.right)/2,0,s),g=a.ad((this.top+h-this.bottom)/2,0,h);return new a.P(d,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new tc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ah{constructor(s,h,d,g,b){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=b===void 0||!!b,this._minZoom=s||0,this._maxZoom=h||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new tc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const s=new ah(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this._minEleveationForCurrentTile=s._minEleveationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const h=-a.b5(s,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var d=new a.A(4);return a.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,b){var I=g[0],C=g[1],M=g[2],N=g[3],O=Math.sin(b),z=Math.cos(b);d[0]=I*z+M*O,d[1]=C*z+N*O,d[2]=I*-O+M*z,d[3]=C*-O+N*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const h=a.ad(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const h=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,h,d){this._unmodified=!1,this._edgeInsets.interpolate(s,h,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const h=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(s){const h=[new a.b6(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new a.P(0,0)),g=this.pointCoordinate(new a.P(this.width,0)),b=this.pointCoordinate(new a.P(this.width,this.height)),I=this.pointCoordinate(new a.P(0,this.height)),C=Math.floor(Math.min(d.x,g.x,b.x,I.x)),M=Math.floor(Math.max(d.x,g.x,b.x,I.x)),N=1;for(let O=C-N;O<=M+N;O++)O!==0&&h.push(new a.b6(O,s))}return h}coveringTiles(s){var h,d;let g=this.coveringZoomLevel(s);const b=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),C=a.U.fromLngLat(this.center),M=Math.pow(2,g),N=[M*I.x,M*I.y,0],O=[M*C.x,M*C.y,0],z=vo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=g);const nt=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,et=ht=>({aabb:new hu([ht*M,0,0],[(ht+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ht,fullyVisible:!1}),at=[],$=[],Et=g,Ot=s.reparseOverscaled?b:g;if(this._renderWorldCopies)for(let ht=1;ht<=3;ht++)at.push(et(-ht)),at.push(et(ht));for(at.push(et(0));at.length>0;){const ht=at.pop(),Tt=ht.x,Bt=ht.y;let Vt=ht.fullyVisible;if(!Vt){const Le=ht.aabb.intersects(z);if(Le===0)continue;Vt=Le===2}const Xt=s.terrain?N:O,ee=ht.aabb.distanceX(Xt),$t=ht.aabb.distanceY(Xt),oe=Math.max(Math.abs(ee),Math.abs($t));if(ht.zoom===Et||oe>nt+(1<=W){const Le=Et-ht.zoom,vn=N[0]-.5-(Tt<>1),Ge=ht.zoom+1;let Pe=ht.aabb.quadrant(Le);if(s.terrain){const Yn=new a.O(Ge,ht.wrap,Ge,vn,fe),_n=s.terrain.getMinMaxElevation(Yn),un=(h=_n.minElevation)!==null&&h!==void 0?h:this.elevation,bn=(d=_n.maxElevation)!==null&&d!==void 0?d:this.elevation;Pe=new hu([Pe.min[0],Pe.min[1],un],[Pe.max[0],Pe.max[1],bn])}at.push({aabb:Pe,zoom:Ge,x:vn,y:fe,wrap:ht.wrap,fullyVisible:Vt})}}return $.sort((ht,Tt)=>ht.distanceSq-Tt.distanceSq).map(ht=>ht.tileID)}resize(s,h){this.width=s,this.height=h,this.pixelsToGLUnits=[2/s,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const h=a.ad(s.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.P(a.G(s.lng)*this.worldSize,a.H(h)*this.worldSize)}unproject(s){return new a.U(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const h=this.pointLocation(this.centerPoint,s),d=s.getElevationForLngLatZoom(h,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),b=a.U.fromLngLat(g.lngLat,g.altitude),I=a.U.fromLngLat(h,d),C=b.x-I.x,M=b.y-I.y,N=b.z-I.z,O=Math.sqrt(C*C+M*M+N*N),z=this.scaleZoom(this.cameraToCenterDistance/O/this.tileSize);this._elevation=d,this._center=h,this.zoom=z}setLocationAtPoint(s,h){const d=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(s),I=new a.U(b.x-(d.x-g.x),b.y-(d.y-g.y));this.center=this.coordinateLocation(I),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,h){return h?this.coordinatePoint(this.locationCoordinate(s),h.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,h){return this.coordinateLocation(this.pointCoordinate(s,h))}locationCoordinate(s){return a.U.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,h){if(h){const W=h.pointCoordinate(s);if(W!=null)return W}const d=[s.x,s.y,0,1],g=[s.x,s.y,1,1];a.ag(d,d,this.pixelMatrixInverse),a.ag(g,g,this.pixelMatrixInverse);const b=d[3],I=g[3],C=d[1]/b,M=g[1]/I,N=d[2]/b,O=g[2]/I,z=N===O?0:(0-N)/(O-N);return new a.U(a.B.number(d[0]/b,g[0]/I,z)/this.worldSize,a.B.number(C,M,z)/this.worldSize)}coordinatePoint(s,h=0,d=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,h,1];return a.ag(g,g,d),new a.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new ke().extend(this.pointLocation(new a.P(0,s))).extend(this.pointLocation(new a.P(this.width,s))).extend(this.pointLocation(new a.P(this.width,this.height))).extend(this.pointLocation(new a.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ke([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(s,h=!1){const d=s.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const b=s.canonical,I=this.worldSize/this.zoomScale(b.z),C=b.x+Math.pow(2,b.z)*s.wrap,M=a.ao(new Float64Array(16));return a.$(M,M,[C*I,b.y*I,0]),a.a0(M,M,[I/a.N,I/a.N,1]),a.a1(M,h?this.alignedProjMatrix:this.projMatrix,M),g[d]=new Float32Array(M),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let s,h,d,g,b=-90,I=90,C=-180,M=180;const N=this.size,O=this._unmodified;if(this.latRange){const nt=this.latRange;b=a.H(nt[1])*this.worldSize,I=a.H(nt[0])*this.worldSize,s=I-bI&&(g=I-et)}if(this.lngRange){const nt=(C+M)/2,et=a.b5(z.x,nt-this.worldSize/2,nt+this.worldSize/2),at=N.x/2;et-atM&&(d=M-at)}d===void 0&&g===void 0||(this.center=this.unproject(new a.P(d!==void 0?d:z.x,g!==void 0?g:z.y)).wrap()),this._unmodified=O,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,h=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.b7(1,this.center.lat)*this.worldSize;let g=a.ao(new Float64Array(16));a.a0(g,g,[this.width/2,-this.height/2,1]),a.$(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=a.ao(new Float64Array(16)),a.a0(g,g,[1,-1,1]),a.$(g,g,[-1,-1,0]),a.a0(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),I=Math.min(this.elevation,this._minEleveationForCurrentTile),C=b-I*this._pixelPerMeter/Math.cos(this._pitch),M=I<0?C:b,N=Math.PI/2+this._pitch,O=this._fov*(.5+s.y/this.height),z=Math.sin(O)*M/Math.sin(a.ad(Math.PI-N-O,.01,Math.PI-.01)),W=this.getHorizon(),nt=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),et=Math.sin(nt)*M/Math.sin(a.ad(Math.PI-N-nt,.01,Math.PI-.01)),at=Math.min(z,et),$=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),Et=this.height/50;g=new Float64Array(16),a.b8(g,this._fov,this.width/this.height,Et,$),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,a.a0(g,g,[1,-1,1]),a.$(g,g,[0,0,-this.cameraToCenterDistance]),a.b9(g,g,this._pitch),a.ae(g,g,this.angle),a.$(g,g,[-h,-d,0]),this.mercatorMatrix=a.a0([],g,[this.worldSize,this.worldSize,this.worldSize]),a.a0(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.a1(new Float64Array(16),this.labelPlaneMatrix,g),a.$(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=a.as([],g),this.pixelMatrix3D=a.a1(new Float64Array(16),this.labelPlaneMatrix,g);const Ot=this.width%2/2,ht=this.height%2/2,Tt=Math.cos(this.angle),Bt=Math.sin(this.angle),Vt=h-Math.round(h)+Tt*Ot+Bt*ht,Xt=d-Math.round(d)+Tt*ht+Bt*Ot,ee=new Float64Array(g);if(a.$(ee,ee,[Vt>.5?Vt-1:Vt,Xt>.5?Xt-1:Xt,0]),this.alignedProjMatrix=ee,g=a.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new a.P(0,0)),h=[s.x*this.worldSize,s.y*this.worldSize,0,1];return a.ag(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,s))}getCameraQueryGeometry(s){const h=this.getCameraPoint();if(s.length===1)return[s[0],h];{let d=h.x,g=h.y,b=h.x,I=h.y;for(const C of s)d=Math.min(d,C.x),g=Math.min(g,C.y),b=Math.max(b,C.x),I=Math.max(I,C.y);return[new a.P(d,g),new a.P(b,g),new a.P(b,I),new a.P(d,I),new a.P(d,g)]}}}function Tl(y,s){let h,d=!1,g=null,b=null;const I=()=>{g=null,d&&(y.apply(b,h),g=setTimeout(I,s),d=!1)};return(...C)=>(d=!0,b=this,h=C,g||I(),g)}class ec{constructor(s){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let d;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:d,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}},this._updateHash=Tl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const h=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,g),I=Math.round(h.lng*b)/b,C=Math.round(h.lat*b)/b,M=this._map.getBearing(),N=this._map.getPitch();let O="";if(O+=s?`/${I}/${C}/${d}`:`${d}/${C}/${I}`,(M||N)&&(O+="/"+Math.round(10*M)/10),N&&(O+=`/${Math.round(N)}`),this._hashName){const z=this._hashName;let W=!1;const nt=window.location.hash.slice(1).split("&").map(et=>{const at=et.split("=")[0];return at===z?(W=!0,`${at}=${O}`):et}).filter(et=>et);return W||nt.push(`${z}=${O}`),`#${nt.join("&")}`}return`#${O}`}}const fu={linearity:.3,easing:a.ba(0,0,.3,1)},Bd=a.e({deceleration:2500,maxSpeed:1400},fu),Vd=a.e({deceleration:20,maxSpeed:1400},fu),Ud=a.e({deceleration:1e3,maxSpeed:360},fu),Gd=a.e({deceleration:1e3,maxSpeed:90},fu);class jd{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.h.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,h=a.h.now();for(;s.length>0&&h-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)h.zoom+=b.zoomDelta||0,h.bearing+=b.bearingDelta||0,h.pitch+=b.pitchDelta||0,b.panDelta&&h.pan._add(b.panDelta),b.around&&(h.around=b.around),b.pinchAround&&(h.pinchAround=b.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const b=nc(h.pan.mag(),d,a.e({},Bd,s||{}));g.offset=h.pan.mult(b.amount/h.pan.mag()),g.center=this._map.transform.center,js(g,b)}if(h.zoom){const b=nc(h.zoom,d,Vd);g.zoom=this._map.transform.zoom+b.amount,js(g,b)}if(h.bearing){const b=nc(h.bearing,d,Ud);g.bearing=this._map.transform.bearing+a.ad(b.amount,-179,179),js(g,b)}if(h.pitch){const b=nc(h.pitch,d,Gd);g.pitch=this._map.transform.pitch+b.amount,js(g,b)}if(g.zoom||g.bearing){const b=h.pinchAround===void 0?h.around:h.pinchAround;g.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),a.e(g,{noMoveStart:!0})}}function js(y,s){(!y.duration||y.durationh.unproject(M)),C=b.reduce((M,N,O,z)=>M.add(N.div(z.length)),new a.P(0,0));super(s,{points:b,point:C,lngLats:I,lngLat:h.unproject(C),originalEvent:d}),this._defaultPrevented=!1}}class qd extends a.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,h,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class Zd{constructor(s,h){this._map=s,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new qd(s.type,this._map,s))}mousedown(s,h){return this._mousedownPos=h,this._firePreventable(new Oo(s.type,this._map,s))}mouseup(s){this._map.fire(new Oo(s.type,this._map,s))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Oo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Oo(s.type,this._map,s))}mouseover(s){this._map.fire(new Oo(s.type,this._map,s))}mouseout(s){this._map.fire(new Oo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new ic(s.type,this._map,s))}touchmove(s){this._map.fire(new ic(s.type,this._map,s))}touchend(s){this._map.fire(new ic(s.type,this._map,s))}touchcancel(s){this._map.fire(new ic(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wd{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Oo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Oo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Oo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ea{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(a.P.convert(s),this._map.terrain)}}class Xd{constructor(s,h){this._map=s,this._tr=new Ea(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,h){this.isEnabled()&&s.shiftKey&&s.button===0&&(x.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(s,h){if(!this._active)return;const d=h;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)b.fitScreenCoordinates(d,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(x.remove(this._box),this._box=null),x.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,h){return this._map.fire(new a.k(s,{originalEvent:h}))}}function as(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const h={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const b=new a.P(0,0);for(const I of g)b._add(I);return b.div(g.length)}(h),this.touches=as(d,h)))}touchmove(s,h,d){if(this.aborted||!this.centroid)return;const g=as(d,h);for(const b in this.touches){const I=g[b];(!I||I.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(s,h,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class lh{constructor(s){this.singleTap=new Ia(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,h,d){this.singleTap.touchstart(s,h,d)}touchmove(s,h,d){this.singleTap.touchmove(s,h,d)}touchend(s,h,d){const g=this.singleTap.touchend(s,h,d);if(g){const b=s.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(g)<30;if(b&&I||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class Ca{constructor(s){this._tr=new Ea(s),this._zoomIn=new lh({numTouches:1,numTaps:2}),this._zoomOut=new lh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,h,d){this._zoomIn.touchstart(s,h,d),this._zoomOut.touchstart(s,h,d)}touchmove(s,h,d){this._zoomIn.touchmove(s,h,d),this._zoomOut.touchmove(s,h,d)}touchend(s,h,d){const g=this._zoomIn.touchend(s,h,d),b=this._zoomOut.touchend(s,h,d),I=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom+1,around:I.unproject(g)},{originalEvent:s})}):b?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom-1,around:I.unproject(b)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const h=this._moveFunction(...s);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(s,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,h){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=h.length?h[0]:h;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},pu=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:h=.8})=>{const d=new zf({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new Ta({clickTolerance:s,move:(g,b)=>({bearingDelta:(b.x-g.x)*h}),moveStateManager:d,enable:y,assignEvents:uh})},La=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:h=-.5})=>{const d=new zf({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new Ta({clickTolerance:s,move:(g,b)=>({pitchDelta:(b.y-g.y)*h}),moveStateManager:d,enable:y,assignEvents:uh})};class xe{constructor(s,h){this._minTouches=s.cooperativeGestures?2:1,this._clickTolerance=s.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(s,h,d){return this._calculateTransform(s,h,d)}touchmove(s,h,d){if(this._map._cooperativeGestures&&(this._minTouches===2&&d.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(s,!1,d.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(d.length0&&(this._active=!0);const g=as(d,h),b=new a.P(0,0),I=new a.P(0,0);let C=0;for(const N in g){const O=g[N],z=this._touches[N];z&&(b._add(O),I._add(O.sub(z)),C++,g[N]=O)}if(this._touches=g,CMath.abs(y.x)}class Yg extends ch{constructor(s){super(),this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,h,d){super.touchstart(s,h,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Bf(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,h,d){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),b=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,b,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(s,h,d){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,b=h.mag()>=2;if(!g&&!b)return;if(!g||!b)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const I=s.y>0==h.y>0;return Bf(s)&&Bf(h)&&I}}const Vf={panStep:100,bearingStep:15,pitchStep:10};class Kd{constructor(s){this._tr=new Ea(s);const h=Vf;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let h=0,d=0,g=0,b=0,I=0;switch(s.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),b=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),b=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),I=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:C=>{const M=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:Jd,zoom:h?Math.round(M.zoom)+h*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+g*this._pitchStep,offset:[-b*this._panStep,-I*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Jd(y){return y*(2-y)}const Qd=4.000244140625;class Kg{constructor(s,h){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new Ea(s),this._el=s.getCanvasContainer(),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!s[this._map._metaKey])return;s.preventDefault()}let h=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=a.h.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,h!==0&&h%Qd==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),s.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=s,this._delta-=h,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const h=x.mousePos(this._el,s),d=this._tr;this._around=a.L.convert(this._aroundCenter?d.center:d.unproject(h)),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Qd?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&M!==0&&(M=1/M);const N=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(N*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,g=this._easing;let b,I=!1;if(this._type==="wheel"&&d&&g){const C=Math.min((a.h.now()-this._lastWheelEventTime)/200,1),M=g(C);b=a.B.number(d,h,M),C<1?this._frameId||(this._frameId=!0):I=!0}else b=h,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:b-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let h=a.bb;if(this._prevEase){const d=this._prevEase,g=(a.h.now()-d.start)/d.duration,b=d.easing(g+.01)-d.easing(g),I=.27/Math.sqrt(b*b+1e-4)*.01,C=Math.sqrt(.0729-I*I);h=a.ba(I,C,.25,1)}return this._prevEase={start:a.h.now(),duration:s,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Uf{constructor(s,h){this._clickZoom=s,this._tapZoom=h}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Gf{constructor(s){this._tr=new Ea(s),this.reset()}reset(){this._active=!1}dblclick(s,h){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jf{constructor(){this._tap=new lh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,h,d){if(!this._swipePoint)if(this._tapTime){const g=h[0],b=s.timeStamp-this._tapTime<500,I=this._tapPoint.dist(g)<30;b&&I?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,h,d)}touchmove(s,h,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=h[0],b=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(s,h,d)}touchend(s,h,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(s,h,d);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qf{constructor(s,h,d){this._el=s,this._mousePan=h,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class bo{constructor(s,h,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=h,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class tl{constructor(s,h,d,g){this._el=s,this._touchZoom=h,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const rc=y=>y.zoom||y.drag||y.pitch||y.rotate;class Zf extends a.k{}function oc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Wf{constructor(s,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,b)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const I=g.type==="renderFrame"?void 0:g,C={needsRenderFrame:!1},M={},N={},O=g.touches,z=O?this._getMapTouches(O):void 0,W=z?x.touchPos(this._el,z):x.mousePos(this._el,g);for(const{handlerName:at,handler:$,allowed:Et}of this._handlers){if(!$.isEnabled())continue;let Ot;this._blockedByActive(N,Et,at)?$.reset():$[b||g.type]&&(Ot=$[b||g.type](g,W,z),this.mergeHandlerResult(C,M,Ot,at,I),Ot&&Ot.needsRenderFrame&&this._triggerRenderFrame()),(Ot||$.isActive())&&(N[at]=$)}const nt={};for(const at in this._previousActiveHandlers)N[at]||(nt[at]=I);this._previousActiveHandlers=N,(Object.keys(nt).length||oc(C))&&(this._changes.push([C,M,nt]),this._triggerRenderFrame()),(Object.keys(N).length||oc(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:et}=C;et&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],et(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new jd(s),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,b,I]of this._listeners)x.addEventListener(g,b,g===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[s,h,d]of this._listeners)x.removeEventListener(s,h,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const h=this._map,d=h.getCanvasContainer();this._add("mapEvent",new Zd(h,s));const g=h.boxZoom=new Xd(h,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const b=new Ca(h),I=new Gf(h);h.doubleClickZoom=new Uf(I,b),this._add("tapZoom",b),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&h.doubleClickZoom.enable();const C=new jf;this._add("tapDragZoom",C);const M=h.touchPitch=new Yg(h);this._add("touchPitch",M),s.interactive&&s.touchPitch&&h.touchPitch.enable(s.touchPitch);const N=pu(s),O=La(s);h.dragRotate=new bo(s,N,O),this._add("mouseRotate",N,["mousePitch"]),this._add("mousePitch",O,["mouseRotate"]),s.interactive&&s.dragRotate&&h.dragRotate.enable();const z=(({enable:Et,clickTolerance:Ot})=>{const ht=new zf({checkCorrectEvent:Tt=>x.mouseButton(Tt)===0&&!Tt.ctrlKey});return new Ta({clickTolerance:Ot,move:(Tt,Bt)=>({around:Bt,panDelta:Bt.sub(Tt)}),activateOnStart:!0,moveStateManager:ht,enable:Et,assignEvents:uh})})(s),W=new xe(s,h);h.dragPan=new qf(d,z,W),this._add("mousePan",z),this._add("touchPan",W,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&h.dragPan.enable(s.dragPan);const nt=new Ff,et=new Yd;h.touchZoomRotate=new tl(d,et,nt,C),this._add("touchRotate",nt,["touchPan","touchZoom"]),this._add("touchZoom",et,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&h.touchZoomRotate.enable(s.touchZoomRotate);const at=h.scrollZoom=new Kg(h,()=>this._triggerRenderFrame());this._add("scrollZoom",at,["mousePan"]),s.interactive&&s.scrollZoom&&h.scrollZoom.enable(s.scrollZoom);const $=h.keyboard=new Kd(h);this._add("keyboard",$),s.interactive&&s.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new Wd(h))}_add(s,h,d){this._handlers.push({handlerName:s,handler:h,allowed:d}),this._handlersById[s]=h}stop(s){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!rc(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,h,d){for(const g in s)if(g!==d&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const h=[];for(const d of s)this._el.contains(d.target)&&h.push(d);return h}mergeHandlerResult(s,h,d,g,b){if(!d)return;a.e(s,d);const I={handlerName:g,originalEvent:d.originalEvent||b};d.zoomDelta!==void 0&&(h.zoom=I),d.panDelta!==void 0&&(h.drag=I),d.pitchDelta!==void 0&&(h.pitch=I),d.bearingDelta!==void 0&&(h.rotate=I)}_applyChanges(){const s={},h={},d={};for(const[g,b,I]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new a.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),a.e(h,b),a.e(d,I);this._updateMapTransform(s,h,d),this._changes=[]}_updateMapTransform(s,h,d){const g=this._map,b=g._getTransformForUpdate(),I=g.terrain;if(!(oc(s)||I&&this._terrainMovement))return this._fireEvents(h,d,!0);let{panDelta:C,zoomDelta:M,bearingDelta:N,pitchDelta:O,around:z,pinchAround:W}=s;W!==void 0&&(z=W),g._stop(!0),z=z||g.transform.centerPoint;const nt=b.pointLocation(C?z.sub(C):z);N&&(b.bearing+=N),O&&(b.pitch+=O),M&&(b.zoom+=M),I?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(C)):b.setLocationAtPoint(nt,z):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(nt,z),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,b.recalculateZoom(g.terrain)})):b.setLocationAtPoint(nt,z),g._applyUpdatedTransform(b),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(h,d,!0)}_fireEvents(s,h,d){const g=rc(this._eventsInProgress),b=rc(s),I={};for(const O in s){const{originalEvent:z}=s[O];this._eventsInProgress[O]||(I[`${O}start`]=z),this._eventsInProgress[O]=s[O]}!g&&b&&this._fireEvent("movestart",b.originalEvent);for(const O in I)this._fireEvent(O,I[O]);b&&this._fireEvent("move",b.originalEvent);for(const O in s){const{originalEvent:z}=s[O];this._fireEvent(O,z)}const C={};let M;for(const O in this._eventsInProgress){const{handlerName:z,originalEvent:W}=this._eventsInProgress[O];this._handlersById[z].isActive()||(delete this._eventsInProgress[O],M=h[z]||W,C[`${O}end`]=M)}for(const O in C)this._fireEvent(O,C[O]);const N=rc(this._eventsInProgress);if(d&&(g||b)&&!N){this._updatingCamera=!0;const O=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=W=>W!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Zf("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class $d extends a.E{constructor(s,h){super(),this._renderFrameCallback=()=>{const d=Math.min((a.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new a.L(this.transform.center.lng,this.transform.center.lat)}setCenter(s,h){return this.jumpTo({center:s},h)}panBy(s,h,d){return s=a.P.convert(s).mult(-1),this.panTo(this.transform.center,a.e({offset:s},h),d)}panTo(s,h,d){return this.easeTo(a.e({center:s},h),d)}getZoom(){return this.transform.zoom}setZoom(s,h){return this.jumpTo({zoom:s},h),this}zoomTo(s,h,d){return this.easeTo(a.e({zoom:s},h),d)}zoomIn(s,h){return this.zoomTo(this.getZoom()+1,s,h),this}zoomOut(s,h){return this.zoomTo(this.getZoom()-1,s,h),this}getBearing(){return this.transform.bearing}setBearing(s,h){return this.jumpTo({bearing:s},h),this}getPadding(){return this.transform.padding}setPadding(s,h){return this.jumpTo({padding:s},h),this}rotateTo(s,h,d){return this.easeTo(a.e({bearing:s},h),d)}resetNorth(s,h){return this.rotateTo(0,a.e({duration:1e3},s),h),this}resetNorthPitch(s,h){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},s),h),this}snapToNorth(s,h){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=a.B.number(g,M,Vt)),this._rotating&&(d.bearing=a.B.number(b,N,Vt)),this._pitching&&(d.pitch=a.B.number(I,O,Vt)),this._padding&&(d.interpolatePadding(C,z,Vt),nt=d.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Vt),ht)d.setLocationAtPoint(ht,Tt);else{const Xt=d.zoomScale(d.zoom-g),ee=M>g?Math.min(2,Ot):Math.max(.5,Ot),$t=Math.pow(ee,1-Vt),oe=d.unproject($.add(Et.mult(Vt*$t)).mult(Xt));d.setLocationAtPoint(d.renderWorldCopies?oe.wrap():oe,nt)}this._applyUpdatedTransform(d),this._fireMoveEvents(h)},Vt=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,Vt)},s),this}_prepareEase(s,h,d={}){this._moving=!0,h||d.moving||this.fire(new a.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new a.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new a.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new a.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&h!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(h-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=h}this.transform.elevation=a.B.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const h=s.clone(),{center:d,zoom:g,pitch:b,bearing:I,elevation:C}=this.transformCameraUpdate(h);d&&(h.center=d),g!==void 0&&(h.zoom=g),b!==void 0&&(h.pitch=b),I!==void 0&&(h.bearing=I),C!==void 0&&(h.elevation=C),this.transform.apply(h)}_fireMoveEvents(s){this.fire(new a.k("move",s)),this._zooming&&this.fire(new a.k("zoom",s)),this._rotating&&this.fire(new a.k("rotate",s)),this._pitching&&this.fire(new a.k("pitch",s))}_afterEase(s,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const d=this._zooming,g=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.k("zoomend",s)),g&&this.fire(new a.k("rotateend",s)),b&&this.fire(new a.k("pitchend",s)),this.fire(new a.k("moveend",s))}flyTo(s,h){if(!s.essential&&a.h.prefersReducedMotion){const Pe=a.F(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pe,h)}this.stop(),s=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.bb},s);const d=this._getTransformForUpdate(),g=this.getZoom(),b=this.getBearing(),I=this.getPitch(),C=this.getPadding(),M="zoom"in s?a.ad(+s.zoom,d.minZoom,d.maxZoom):g,N="bearing"in s?this._normalizeBearing(s.bearing,b):b,O="pitch"in s?+s.pitch:I,z="padding"in s?s.padding:d.padding,W=d.zoomScale(M-g),nt=a.P.convert(s.offset);let et=d.centerPoint.add(nt);const at=d.pointLocation(et),$=a.L.convert(s.center||at);this._normalizeCenter($);const Et=d.project(at),Ot=d.project($).sub(Et);let ht=s.curve;const Tt=Math.max(d.width,d.height),Bt=Tt/W,Vt=Ot.mag();if("minZoom"in s){const Pe=a.ad(Math.min(s.minZoom,g,M),d.minZoom,d.maxZoom),Yn=Tt/d.zoomScale(Pe-g);ht=Math.sqrt(Yn/Vt*2)}const Xt=ht*ht;function ee(Pe){const Yn=(Bt*Bt-Tt*Tt+(Pe?-1:1)*Xt*Xt*Vt*Vt)/(2*(Pe?Bt:Tt)*Xt*Vt);return Math.log(Math.sqrt(Yn*Yn+1)-Yn)}function $t(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function oe(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}const Le=ee(!1);let vn=function(Pe){return oe(Le)/oe(Le+ht*Pe)},fe=function(Pe){return Tt*((oe(Le)*($t(Yn=Le+ht*Pe)/oe(Yn))-$t(Le))/Xt)/Vt;var Yn},Ge=(ee(!0)-Le)/ht;if(Math.abs(Vt)<1e-6||!isFinite(Ge)){if(Math.abs(Tt-Bt)<1e-6)return this.easeTo(s,h);const Pe=Bts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=b!==N,this._pitching=O!==I,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation($),this._ease(Pe=>{const Yn=Pe*Ge,_n=1/vn(Yn);d.zoom=Pe===1?M:g+d.scaleZoom(_n),this._rotating&&(d.bearing=a.B.number(b,N,Pe)),this._pitching&&(d.pitch=a.B.number(I,O,Pe)),this._padding&&(d.interpolatePadding(C,z,Pe),et=d.centerPoint.add(nt)),this.terrain&&!s.freezeElevation&&this._updateElevation(Pe);const un=Pe===1?$:d.unproject(Et.add(Ot.mult(fe(Yn))).mult(_n));d.setLocationAtPoint(d.renderWorldCopies?un.wrap():un,et),this._applyUpdatedTransform(d),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,h)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,h,d){d.animate===!1||d.duration===0?(s(1),h()):(this._easeStart=a.h.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,h){s=a.b5(s,-180,180);const d=Math.abs(s-h);return Math.abs(s-360-h)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(a.L.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}class zo{constructor(s={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=x.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=x.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){x.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,h){const d=this._map._getUIString(`AttributionControl.${h}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const b=h[g];if(b.used||b.usedForTerrain){const I=b.getSource();I.attribution&&s.indexOf(I.attribution)<0&&s.push(I.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,b)=>g.length-b.length),s=s.filter((g,b)=>{for(let I=b+1;I=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ci{constructor(s={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const d=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("div","maplibregl-ctrl");const h=x.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){x.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class hh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const h=++this._id;return this._queue.push({callback:s,id:h,cancelled:!1}),h}remove(s){const h=this._currentlyRunning,d=h?this._queue.concat(h):this._queue;for(const g of d)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const d of h)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Xf={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var tm=a.Q([{name:"a_pos3d",type:"Int16",components:3}]);class em extends a.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,h){this.sourceCache.update(s,h),this._renderableTilesKeys=[];const d={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),a.aS(g.posMatrix,0,a.N,0,a.N,0,1),this._tiles[g.key]=new pn(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(s){for(const h in this._tiles){const d=this._tiles[h];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const h={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16),a.aS(b.posMatrix,0,a.N,0,a.N,0,1),h[d]=b}else if(g.canonical.isChildOf(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=g.canonical.z-s.canonical.z,C=g.canonical.x-(g.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,N,0,N,0,1),a.$(b.posMatrix,b.posMatrix,[-C*N,-M*N,0]),h[d]=b}else if(s.canonical.isChildOf(g.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=s.canonical.z-g.canonical.z,C=s.canonical.x-(s.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,a.N,0,a.N,0,1),a.$(b.posMatrix,b.posMatrix,[C*N,M*N,0]),a.a0(b.posMatrix,b.posMatrix,[1/2**I,1/2**I,0]),h[d]=b}}return h}getSourceTile(s,h){const d=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(s.scaledTo(g--).key);return b}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=s)}}class nm{constructor(s,h,d){this.painter=s,this.sourceCache=new em(h),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,h,d,g=a.N){var b;if(!(h>=0&&h=0&&ds.canonical.z&&(s.canonical.z>=g?b=s.canonical.z-g:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=s.canonical.x-(s.canonical.x>>b<>b<>8<<4|b>>8,h[I+3]=0;const d=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new Mt(s,d,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){const h=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),d.bindFramebuffer.set(null);const b=h[0]+(h[2]>>4<<8),I=h[1]+((15&h[2])<<8),C=this.coordsIndex[255-h[3]],M=C&&this.sourceCache.getTileByID(C);if(!M)return null;const N=this._coordsTextureSize,O=(1<0&&Math.sign(b)<0||!d&&Math.sign(g)<0&&Math.sign(b)>0?(g=360*Math.sign(b)+g,a.G(g)):h}}class Jg{constructor(s,h,d){this._context=s,this._size=h,this._tileSize=d,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const h=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),d=new Mt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return d.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),h.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),h.colorAttachment.set(d.texture),{id:s,fbo:h,texture:d,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(h=>s.id!==h),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const so={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class fh{constructor(s,h){this.painter=s,this.terrain=h,this.pool=new Jg(s.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(h)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const g=s.sourceCaches[d].getVisibleCoordinates();for(const b of g){const I=this.terrain.sourceCache.getTerrainCoords(b);for(const C in I)this._coordsDescendingInv[d][C]||(this._coordsDescendingInv[d][C]=[]),this._coordsDescendingInv[d][C].push(I[C])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],b=g.source;if(so[g.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const I in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][I]=this._coordsDescendingInv[b][I].map(C=>C.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[g][d.tileID.key];b&&b!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const h=s.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(so[h]&&(this._prevType&&so[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(so[this._prevType]||so[h]&&g){this._prevType=h;const b=this._stacks.length-1,I=this._stacks[b]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Ai(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[b]){const N=this.pool.getObjectForId(C.rtt[b].id);if(N.stamp===C.rtt[b].stamp){this.pool.useObject(N);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),C.rtt[b]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:a.aT.transparent,stencil:0}),d.currentStencilSource=void 0;for(let N=0;N{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Hf={showCompass:!0,showZoom:!0,visualizePitch:!1};class Yf{constructor(s,h,d=!1){this.mousedown=I=>{this.startMouse(a.e({},I,{ctrlKey:!0,preventDefault:()=>I.preventDefault()}),x.mousePos(this.element,I)),x.addEventListener(window,"mousemove",this.mousemove),x.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=I=>{this.moveMouse(I,x.mousePos(this.element,I))},this.mouseup=I=>{this.mouseRotate.dragEnd(I),this.mousePitch&&this.mousePitch.dragEnd(I),this.offTemp()},this.touchstart=I=>{I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.startTouch(I,this._startPos),x.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.addEventListener(window,"touchend",this.touchend))},this.touchmove=I=>{I.targetTouches.length!==1?this.reset():(this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.moveTouch(I,this._lastPos))},this.touchend=I=>{I.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=s.dragRotate._mouseRotate.getClickTolerance(),b=s.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=pu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:I,clickTolerance:C,bearingDegreesPerPixelMoved:M=.8})=>{const N=new Hd;return new Ta({clickTolerance:C,move:(O,z)=>({bearingDelta:(z.x-O.x)*M}),moveStateManager:N,enable:I,assignEvents:sc})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=La({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:I,clickTolerance:C,pitchDegreesPerPixelMoved:M=-.5})=>{const N=new Hd;return new Ta({clickTolerance:C,move:(O,z)=>({pitchDelta:(z.y-O.y)*M}),moveStateManager:N,enable:I,assignEvents:sc})})({clickTolerance:b,enable:!0})),x.addEventListener(h,"mousedown",this.mousedown),x.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),x.addEventListener(h,"touchcancel",this.reset)}startMouse(s,h){this.mouseRotate.dragStart(s,h),this.mousePitch&&this.mousePitch.dragStart(s,h),x.disableDrag()}startTouch(s,h){this.touchRotate.dragStart(s,h),this.touchPitch&&this.touchPitch.dragStart(s,h),x.disableDrag()}moveMouse(s,h){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}moveTouch(s,h){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}off(){const s=this.element;x.removeEventListener(s,"mousedown",this.mousedown),x.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend),x.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){x.enableDrag(),x.removeEventListener(window,"mousemove",this.mousemove),x.removeEventListener(window,"mouseup",this.mouseup),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend)}}let Hi;function Kf(y,s,h){if(y=new a.L(y.lng,y.lat),s){const d=new a.L(y.lng-360,y.lat),g=new a.L(y.lng+360,y.lat),b=h.locationPoint(y).distSqr(s);h.locationPoint(d).distSqr(s)180;){const d=h.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=h.width&&d.y<=h.height)break;y.lng>h.center.lng?y.lng-=360:y.lng+=360}return y}const ls={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function im(y,s,h){const d=y.classList;for(const g in ls)d.remove(`maplibregl-${h}-anchor-${g}`);d.add(`maplibregl-${h}-anchor-${s}`)}class Ll extends a.E{constructor(s){if(super(),this._onKeyPress=h=>{const d=h.code,g=h.charCode||h.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const d=h.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=h=>{if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!d)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Kf(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let b="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?b="rotateX(0deg)":this._pitchAlignment==="map"&&(b=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),x.setTransform(this._element,`${ls[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${b} ${g}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const I=this._map.unproject(this._pos),C=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=I.distanceTo(this._lngLat)>20*C?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=h=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=h.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.k("dragstart"))),this.fire(new a.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a.k("dragend")),this._state="inactive"},this._addDragHandler=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,s&&s.element)this._element=s.element,this._offset=a.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=x.create("div"),this._element.setAttribute("aria-label","Map marker");const h=x.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const b=x.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"stroke","none"),b.setAttributeNS(null,"stroke-width","1"),b.setAttributeNS(null,"fill","none"),b.setAttributeNS(null,"fill-rule","evenodd");const I=x.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill-rule","nonzero");const C=x.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Et of M){const Ot=x.createNS("http://www.w3.org/2000/svg","ellipse");Ot.setAttributeNS(null,"opacity","0.04"),Ot.setAttributeNS(null,"cx","10.5"),Ot.setAttributeNS(null,"cy","5.80029008"),Ot.setAttributeNS(null,"rx",Et.rx),Ot.setAttributeNS(null,"ry",Et.ry),C.appendChild(Ot)}const N=x.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const O=x.createNS("http://www.w3.org/2000/svg","path");O.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),N.appendChild(O);const z=x.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const W=x.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),z.appendChild(W);const nt=x.createNS("http://www.w3.org/2000/svg","g");nt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),nt.setAttributeNS(null,"fill","#FFFFFF");const et=x.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"transform","translate(8.0, 8.0)");const at=x.createNS("http://www.w3.org/2000/svg","circle");at.setAttributeNS(null,"fill","#000000"),at.setAttributeNS(null,"opacity","0.25"),at.setAttributeNS(null,"cx","5.5"),at.setAttributeNS(null,"cy","5.5"),at.setAttributeNS(null,"r","5.4999962");const $=x.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),et.appendChild(at),et.appendChild($),I.appendChild(C),I.appendChild(N),I.appendChild(z),I.appendChild(nt),I.appendChild(et),h.appendChild(I),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=a.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),im(this._element,this._anchor,"marker"),s&&s.className)for(const h of s.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),x.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=a.L.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return s?(s.isOpen()?s.remove():s.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(s){return this._offset=a.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ni={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ei=0,mu=!1;const ac={maxWidth:100,unit:"metric"};function lc(y,s,h){const d=h&&h.maxWidth||100,g=y._container.clientHeight/2,b=y.unproject([0,g]),I=y.unproject([d,g]),C=b.distanceTo(I);if(h&&h.unit==="imperial"){const M=3.2808*C;M>5280?Ml(s,d,M/5280,y._getUIString("ScaleControl.Miles")):Ml(s,d,M,y._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?Ml(s,d,C/1852,y._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ml(s,d,C/1e3,y._getUIString("ScaleControl.Kilometers")):Ml(s,d,C,y._getUIString("ScaleControl.Meters"))}function Ml(y,s,h,d){const g=function(b){const I=Math.pow(10,`${Math.floor(b)}`.length-1);let C=b/I;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(M){const N=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*N)/N}(C),I*C}(h);y.style.width=s*(g/h)+"px",y.innerHTML=`${g} ${d}`}const Jf={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Qf=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function gu(y){if(y){if(typeof y=="number"){const s=Math.round(Math.abs(y)/Math.SQRT2);return{center:new a.P(0,0),top:new a.P(0,y),"top-left":new a.P(s,s),"top-right":new a.P(-s,s),bottom:new a.P(0,-y),"bottom-left":new a.P(s,-s),"bottom-right":new a.P(-s,-s),left:new a.P(y,0),right:new a.P(-y,0)}}if(y instanceof a.P||Array.isArray(y)){const s=a.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:a.P.convert(y.center||[0,0]),top:a.P.convert(y.top||[0,0]),"top-left":a.P.convert(y["top-left"]||[0,0]),"top-right":a.P.convert(y["top-right"]||[0,0]),bottom:a.P.convert(y.bottom||[0,0]),"bottom-left":a.P.convert(y["bottom-left"]||[0,0]),"bottom-right":a.P.convert(y["bottom-right"]||[0,0]),left:a.P.convert(y.left||[0,0]),right:a.P.convert(y.right||[0,0])}}return gu(new a.P(0,0))}const $f={extend:(y,...s)=>a.e(y,...s),run(y){y()},logToElement(y,s=!1,h="log"){const d=window.document.getElementById(h);d&&(s&&(d.innerHTML=""),d.innerHTML+=`
${y}`)}},tp=_;class Vn{static get version(){return tp}static get workerCount(){return ts.workerCount}static set workerCount(s){ts.workerCount=s}static get maxParallelImageRequests(){return a.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(s){a.c.MAX_PARALLEL_IMAGE_REQUESTS=s}static get workerUrl(){return a.c.WORKER_URL}static set workerUrl(s){a.c.WORKER_URL=s}static addProtocol(s,h){a.c.REGISTERED_PROTOCOLS[s]=h}static removeProtocol(s){delete a.c.REGISTERED_PROTOCOLS[s]}}return Vn.Map=class extends $d{constructor(y){if(a.bg.mark(a.bh.create),(y=a.e({},Ue,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ah(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._cooperativeGesturesOnWheel=s=>{this._onCooperativeGesture(s,s[this._metaKey],1)},this._contextLost=s=>{s.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._cooperativeGestures=y.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new hh,this._controls=[],this._mapId=a.a2(),this._locale=a.e({},Xf,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new B(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const h=Tl(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?h(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Wf(this,y),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=y.hash&&new ec(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,a.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new zo({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new ci,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new a.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new a.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new a.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new a.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=y.onAdd(this);this._controls.push(y);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(h,d.firstChild):d.appendChild(h),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new a.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,h,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,h,d)}resize(y){var s;const h=this._containerDimensions(),d=h[0],g=h[1],b=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,b),this.painter.resize(d,g,b),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const M=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,M),this.painter.resize(d,g,M)}this.transform.resize(d,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,g);const I=!this._moving;return I&&(this.stop(),this.fire(new a.k("movestart",y)).fire(new a.k("move",y))),this.fire(new a.k("resize",y)),I&&this.fire(new a.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:h,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),b=y*g,I=s*g;return Math.min(b>h?h/b:1,I>d?d/I:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(ke.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(y){return this._cooperativeGestures=y,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(y){return this.transform.locationPoint(a.L.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(a.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,s,h){if(y==="mouseenter"||y==="mouseover"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:b=>{const I=this.getLayer(s)?this.queryRenderedFeatures(b.point,{layers:[s]}):[];I.length?d||(d=!0,h.call(this,new Oo(y,this,b.originalEvent,{features:I}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="mouseout"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:I=>{(this.getLayer(s)?this.queryRenderedFeatures(I.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,h.call(this,new Oo(y,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,h.call(this,new Oo(y,this,I.originalEvent)))}}}}{const d=g=>{const b=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];b.length&&(g.features=b,h.call(this,g),delete g.features)};return{layer:s,listener:h,delegates:{[y]:d}}}}on(y,s,h){if(h===void 0)return super.on(y,s);const d=this._createDelegatedListener(y,s,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,s,h){if(h===void 0)return super.once(y,s);const d=this._createDelegatedListener(y,s,h);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,s,h){return h===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let b=0;bthis._updateStyle(y,s));const h=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Dr(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,h):this.style.loadJSON(y,s,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Dr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const h=this._requestManager.transformRequest(y,Q.Style);a.f(h,(d,g)=>{d?this.fire(new a.j(d)):g&&this._updateDiff(g,s)})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&this._update(!0)}catch(h){a.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(y,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.w("There is no style added to the map.")}addSource(y,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.loaded();this.fire(new a.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);for(const h in this.style._layers){const d=this.style._layers[h];d.type==="hillshade"&&d.source===y.source&&a.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new nm(this.painter,s,y),this.painter.renderToTexture=new fh(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.sourceId!==y.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(h.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new a.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const h=y[s]._tiles;for(const d in h){const g=h[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}addSourceType(y,s,h){return this._lazyInitEmptyStyle(),this.style.addSourceType(y,s,h)}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,h={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:b,stretchY:I,content:C}=h;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||a.a(s))){if(s.width===void 0||s.height===void 0)return this.fire(new a.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:N,data:O}=s,z=s;return this.style.addImage(y,{data:new a.R({width:M,height:N},new Uint8Array(O)),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0,userImage:z}),z.onAdd&&z.onAdd(this,y),this}}{const{width:M,height:N,data:O}=a.h.getImageData(s);this.style.addImage(y,{data:new a.R({width:M,height:N},O),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0})}}updateImage(y,s){const h=this.style.getImage(y);if(!h)return this.fire(new a.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||a.a(s)?a.h.getImageData(s):s,{width:g,height:b,data:I}=d;if(g===void 0||b===void 0)return this.fire(new a.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==h.data.width||b!==h.data.height)return this.fire(new a.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const C=!(s instanceof HTMLImageElement||a.a(s));return h.data.replace(I,C),this.style.updateImage(y,h),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new a.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y,s){j.getImage(this._requestManager.transformRequest(y,Q.Image),s)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,s,h){return this.style.setLayerZoomRange(y,s,h),this._update(!0)}setFilter(y,s,h={}){return this.style.setFilter(y,s,h),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,h,d={}){return this.style.setPaintProperty(y,s,h,d),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,h,d={}){return this.style.setLayoutProperty(y,s,h,d),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,h,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,h=>{h||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=x.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=x.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const h=this._containerDimensions(),d=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],d);const g=this._controlContainer=x.create("div","maplibregl-control-container",y),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(I=>{b[I]=x.create("div",`maplibregl-ctrl-${I} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=x.create("div","maplibregl-cooperative-gesture-screen",this._container);let y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +`}),staticAttributes:d,staticUniforms:I}}class Sl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,h,d,g,b,I,C,M,N){this.context=s;let R=this.boundPaintVertexBuffers.length!==g.length;for(let z=0;!R&&z({u_depth:new a.aL(Vt,Yt.u_depth),u_terrain:new a.aL(Vt,Yt.u_terrain),u_terrain_dim:new a.aM(Vt,Yt.u_terrain_dim),u_terrain_matrix:new a.aN(Vt,Yt.u_terrain_matrix),u_terrain_unpack:new a.aO(Vt,Yt.u_terrain_unpack),u_terrain_exaggeration:new a.aM(Vt,Yt.u_terrain_exaggeration)}))(s,Bt),this.binderUniforms=d?d.getUniforms(s,Bt):[]}draw(s,h,d,g,b,I,C,M,N,R,z,W,it,et,at,Q,Lt,Ot){const ct=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(g),s.setColorMode(b),s.setCullFace(I),M){s.activeTexture.set(ct.TEXTURE2),ct.bindTexture(ct.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ct.TEXTURE3),ct.bindTexture(ct.TEXTURE_2D,M.texture);for(const Bt in this.terrainUniforms)this.terrainUniforms[Bt].set(M[Bt])}for(const Bt in this.fixedUniforms)this.fixedUniforms[Bt].set(C[Bt]);at&&at.setUniforms(s,this.binderUniforms,it,{zoom:et});let Pt=0;switch(h){case ct.LINES:Pt=2;break;case ct.TRIANGLES:Pt=3;break;case ct.LINE_STRIP:Pt=1}for(const Bt of W.get()){const Vt=Bt.vaos||(Bt.vaos={});(Vt[N]||(Vt[N]=new Sl)).bind(s,this,R,at?at.getPaintVertexBuffers():[],z,Bt.vertexOffset,Q,Lt,Ot),ct.drawElements(h,Bt.primitiveLength*Pt,ct.UNSIGNED_SHORT,Bt.primitiveOffset*Pt*2)}}}function ss(y,s,h){const d=1/vt(h,1,s.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),b=h.tileSize*Math.pow(2,s.transform.tileZoom)/g,I=b*(h.tileID.canonical.x+h.tileID.wrap*g),C=b*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[I>>16,C>>16],u_pixel_coord_lower:[65535&I,65535&C]}}const gf=(y,s,h,d)=>{const g=s.style.light,b=g.properties.get("position"),I=[b.x,b.y,b.z],C=function(){var N=new a.A(9);return a.A!=Float32Array&&(N[1]=0,N[2]=0,N[3]=0,N[5]=0,N[6]=0,N[7]=0),N[0]=1,N[4]=1,N[8]=1,N}();g.properties.get("anchor")==="viewport"&&function(N,R){var z=Math.sin(R),W=Math.cos(R);N[0]=W,N[1]=z,N[2]=0,N[3]=-z,N[4]=W,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(C,-s.transform.angle),function(N,R,z){var W=R[0],it=R[1],et=R[2];N[0]=W*z[0]+it*z[3]+et*z[6],N[1]=W*z[1]+it*z[4]+et*z[7],N[2]=W*z[2]+it*z[5]+et*z[8]}(I,I,C);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:I,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+h,u_opacity:d}},Ya=(y,s,h,d,g,b,I)=>a.e(gf(y,s,h,d),ss(b,s,I),{u_height_factor:-Math.pow(2,g.overscaledZ)/I.tileSize/8}),wd=y=>({u_matrix:y}),_f=(y,s,h,d)=>a.e(wd(y),ss(h,s,d)),jc=(y,s)=>({u_matrix:y,u_world:s}),qc=(y,s,h,d,g)=>a.e(_f(y,s,h,d),{u_world:g}),Ka=(y,s,h,d)=>{const g=y.transform;let b,I;if(d.paint.get("circle-pitch-alignment")==="map"){const C=vt(h,1,g.zoom);b=!0,I=[C,C]}else b=!1,I=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,h,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:I}},yf=(y,s,h)=>{const d=vt(h,1,s.zoom),g=Math.pow(2,s.zoom-h.tileID.overscaledZ),b=h.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:b}},Xu=(y,s,h=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:h}),Sd=y=>({u_matrix:y}),Fg=(y,s,h,d)=>({u_matrix:y,u_extrude_scale:vt(s,1,h),u_intensity:d});function vf(y,s){const h=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new a.U(0,d/h).toLngLat().lat,new a.U(0,(d+1)/h).toLngLat().lat]}const bf=(y,s,h,d)=>{const g=y.transform;return{u_matrix:Zc(y,s,h,d),u_ratio:1/vt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Ed=(y,s,h,d,g)=>a.e(bf(y,s,h,g),{u_image:0,u_image_height:d}),Bg=(y,s,h,d,g)=>{const b=y.transform,I=Cd(s,b);return{u_matrix:Zc(y,s,h,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/vt(s,1,b.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[I,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Id=(y,s,h,d,g,b)=>{const I=y.lineAtlas,C=Cd(s,y.transform),M=h.layout.get("line-cap")==="round",N=I.getDash(d.from,M),R=I.getDash(d.to,M),z=N.width*g.fromScale,W=R.width*g.toScale;return a.e(bf(y,s,h,b),{u_patternscale_a:[C/z,-N.height/2],u_patternscale_b:[C/W,-R.height/2],u_sdfgamma:I.width/(256*Math.min(z,W)*y.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:R.y,u_mix:g.t})};function Cd(y,s){return 1/vt(y,1,s.tileZoom)}function Zc(y,s,h,d){return y.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Td=(y,s,h,d,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:h,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(I=g.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(b=g.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:Ld(g.paint.get("raster-hue-rotate"))};var b,I};function Ld(y){y*=Math.PI/180;const s=Math.sin(y),h=Math.cos(y);return[(2*h+1)/3,(-Math.sqrt(3)*s-h+1)/3,(Math.sqrt(3)*s-h+1)/3]}const xf=(y,s,h,d,g,b,I,C,M,N)=>{const R=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:R.width/R.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:I,u_coord_matrix:C,u_is_text:+M,u_pitch_with_map:+d,u_texsize:N,u_texture:0}},wf=(y,s,h,d,g,b,I,C,M,N,R)=>{const z=g.transform;return a.e(xf(y,s,h,d,g,b,I,C,M,N),{u_gamma_scale:d?Math.cos(z._pitch)*z.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+R})},El=(y,s,h,d,g,b,I,C,M,N)=>a.e(wf(y,s,h,d,g,b,I,C,!0,M,!0),{u_texsize_icon:N,u_texture_icon:1}),$c=(y,s,h)=>({u_matrix:y,u_opacity:s,u_color:h}),as=(y,s,h,d,g,b)=>a.e(function(I,C,M,N){const R=M.imageManager.getPattern(I.from.toString()),z=M.imageManager.getPattern(I.to.toString()),{width:W,height:it}=M.imageManager.getPixelSize(),et=Math.pow(2,N.tileID.overscaledZ),at=N.tileSize*Math.pow(2,M.transform.tileZoom)/et,Q=at*(N.tileID.canonical.x+N.tileID.wrap*et),Lt=at*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:R.tl,u_pattern_br_a:R.br,u_pattern_tl_b:z.tl,u_pattern_br_b:z.br,u_texsize:[W,it],u_mix:C.t,u_pattern_size_a:R.displaySize,u_pattern_size_b:z.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/vt(N,1,M.transform.tileZoom),u_pixel_coord_upper:[Q>>16,Lt>>16],u_pixel_coord_lower:[65535&Q,65535&Lt]}}(d,b,h,g),{u_matrix:y,u_opacity:s}),Wc={fillExtrusion:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_opacity:new a.aM(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_height_factor:new a.aM(y,s.u_height_factor),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade),u_opacity:new a.aM(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_scale_with_map:new a.aL(y,s.u_scale_with_map),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_matrix:new a.aN(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new a.aM(y,s.u_pixels_to_tile_units),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_overscale_factor:new a.aM(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_inv_matrix:new a.aN(y,s.u_inv_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_viewport_size:new a.aQ(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new a.aR(y,s.u_color),u_matrix:new a.aN(y,s.u_matrix),u_overlay:new a.aL(y,s.u_overlay),u_overlay_scale:new a.aM(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new a.aM(y,s.u_extrude_scale),u_intensity:new a.aM(y,s.u_intensity),u_matrix:new a.aN(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_color_ramp:new a.aL(y,s.u_color_ramp),u_opacity:new a.aM(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_latrange:new a.aQ(y,s.u_latrange),u_light:new a.aQ(y,s.u_light),u_shadow:new a.aR(y,s.u_shadow),u_highlight:new a.aR(y,s.u_highlight),u_accent:new a.aR(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_dimension:new a.aQ(y,s.u_dimension),u_zoom:new a.aM(y,s.u_zoom),u_unpack:new a.aO(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_image:new a.aL(y,s.u_image),u_image_height:new a.aM(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texsize:new a.aQ(y,s.u_texsize),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_image:new a.aL(y,s.u_image),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_patternscale_a:new a.aQ(y,s.u_patternscale_a),u_patternscale_b:new a.aQ(y,s.u_patternscale_b),u_sdfgamma:new a.aM(y,s.u_sdfgamma),u_image:new a.aL(y,s.u_image),u_tex_y_a:new a.aM(y,s.u_tex_y_a),u_tex_y_b:new a.aM(y,s.u_tex_y_b),u_mix:new a.aM(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_tl_parent:new a.aQ(y,s.u_tl_parent),u_scale_parent:new a.aM(y,s.u_scale_parent),u_buffer_scale:new a.aM(y,s.u_buffer_scale),u_fade_t:new a.aM(y,s.u_fade_t),u_opacity:new a.aM(y,s.u_opacity),u_image0:new a.aL(y,s.u_image0),u_image1:new a.aL(y,s.u_image1),u_brightness_low:new a.aM(y,s.u_brightness_low),u_brightness_high:new a.aM(y,s.u_brightness_high),u_saturation_factor:new a.aM(y,s.u_saturation_factor),u_contrast_factor:new a.aM(y,s.u_contrast_factor),u_spin_weights:new a.aP(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texsize_icon:new a.aQ(y,s.u_texsize_icon),u_texture:new a.aL(y,s.u_texture),u_texture_icon:new a.aL(y,s.u_texture_icon),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_color:new a.aR(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_image:new a.aL(y,s.u_image),u_pattern_tl_a:new a.aQ(y,s.u_pattern_tl_a),u_pattern_br_a:new a.aQ(y,s.u_pattern_br_a),u_pattern_tl_b:new a.aQ(y,s.u_pattern_tl_b),u_pattern_br_b:new a.aQ(y,s.u_pattern_br_b),u_texsize:new a.aQ(y,s.u_texsize),u_mix:new a.aM(y,s.u_mix),u_pattern_size_a:new a.aQ(y,s.u_pattern_size_a),u_pattern_size_b:new a.aQ(y,s.u_pattern_size_b),u_scale_a:new a.aM(y,s.u_scale_a),u_scale_b:new a.aM(y,s.u_scale_b),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new a.aM(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_terrain_coords_id:new a.aM(y,s.u_terrain_coords_id),u_ele_delta:new a.aM(y,s.u_ele_delta)})};class Xc{constructor(s,h,d){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Hu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Hc{constructor(s,h,d,g){this.length=h.length,this.attributes=d,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=s;const b=s.gl;this.buffer=b.createBuffer(),s.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,h){for(let d=0;d0){const se=a.Z(),Le=Yt;a.aU(se,Vt.placementInvProjMatrix,y.transform.glCoordMatrix),a.aU(se,se,Vt.placementViewportMatrix),R.push({circleArray:te,circleOffset:W,transform:Le,invTransform:se,coord:Pt}),z+=te.length/4,W=z}ee&&N.draw(C,M.LINES,Tn.disabled,Ci.disabled,y.colorModeForRenderPass(),yi.disabled,yf(Yt,y.transform,Bt),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pt),h.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,y.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!I||!R.length)return;const it=y.useProgram("collisionCircle"),et=new a.aV;et.resize(4*z),et._trim();let at=0;for(const ct of R)for(let Pt=0;Pt=0&&(et[Q.associatedIconIndex]={shiftedAnchor:vn,angle:pe})}else J(Q.numGlyphs,W)}if(N){it.clear();const at=y.icon.placedSymbolArray;for(let Q=0;Qy.style.map.terrain.getElevation(ee,xo,Gi):null,dr=h.layout.get("text-rotation-alignment")==="map";ue(se,ee.posMatrix,y,g,pi,Zs,Q,N,dr,Ui)}const kl=y.translatePosMatrix(ee.posMatrix,te,b,I),yu=Lt||g&&Vt||nl?Nf:pi,$r=y.translatePosMatrix(Zs,te,b,I,!0),Or=pe&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ao;ao=pe?se.iconsInText?El(Ge.kind,_n,Ot,Q,y,kl,yu,$r,bn,pr):wf(Ge.kind,_n,Ot,Q,y,kl,yu,$r,g,bn,!0):xf(Ge.kind,_n,Ot,Q,y,kl,yu,$r,g,bn);const Al={program:Hn,buffers:Le,uniformValues:ao,atlasTexture:Vi,atlasTextureIcon:Hi,atlasInterpolation:si,atlasInterpolationIcon:Rr,isSDF:pe,hasHalo:Or};if(ct&&se.canOverlap){Pt=!0;const Ui=Le.segments.get();for(const dr of Ui)Yt.push({segments:new a.S([dr]),sortKey:dr.sortKey,state:Al,terrainData:un})}else Yt.push({segments:Le.segments,sortKey:0,state:Al,terrainData:un})}Pt&&Yt.sort((ee,te)=>ee.sortKey-te.sortKey);for(const ee of Yt){const te=ee.state;if(W.activeTexture.set(it.TEXTURE0),te.atlasTexture.bind(te.atlasInterpolation,it.CLAMP_TO_EDGE),te.atlasTextureIcon&&(W.activeTexture.set(it.TEXTURE1),te.atlasTextureIcon&&te.atlasTextureIcon.bind(te.atlasInterpolationIcon,it.CLAMP_TO_EDGE)),te.isSDF){const se=te.uniformValues;te.hasHalo&&(se.u_is_halo=1,Rf(te.buffers,ee.segments,h,y,te.program,Bt,R,z,se,ee.terrainData)),se.u_is_halo=0}Rf(te.buffers,ee.segments,h,y,te.program,Bt,R,z,te.uniformValues,ee.terrainData)}}function Rf(y,s,h,d,g,b,I,C,M,N){const R=d.context;g.draw(R,R.gl.TRIANGLES,b,I,C,yi.disabled,M,N,h.id,y.layoutVertexBuffer,y.indexBuffer,s,h.paint,d.transform.zoom,y.programConfigurations.get(h.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Ku(y,s,h,d,g){if(!h||!d||!d.imageAtlas)return;const b=d.imageAtlas.patternPositions;let I=b[h.to.toString()],C=b[h.from.toString()];if(!I&&C&&(I=C),!C&&I&&(C=I),!I||!C){const M=g.getPaintProperty(s);I=b[M],C=b[M]}I&&C&&y.setConstantPatternPositions(I,C)}function Ju(y,s,h,d,g,b,I){const C=y.context.gl,M="fill-pattern",N=h.paint.get(M),R=N&&N.constantOr(1),z=h.getCrossfadeParameters();let W,it,et,at,Q;I?(it=R&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=C.LINES):(it=R?"fillPattern":"fill",W=C.TRIANGLES);const Lt=N.constantOr(null);for(const Ot of d){const ct=s.getTile(Ot);if(R&&!ct.patternsLoaded())continue;const Pt=ct.getBucket(h);if(!Pt)continue;const Bt=Pt.programConfigurations.get(h.id),Vt=y.useProgram(it,Bt),Yt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ot);R&&(y.context.activeTexture.set(C.TEXTURE0),ct.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Bt.updatePaintBuffers(z)),Ku(Bt,M,Lt,ct,h);const ee=Yt?Ot:null,te=y.translatePosMatrix(ee?ee.posMatrix:Ot.posMatrix,ct,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(I){at=Pt.indexBuffer2,Q=Pt.segments2;const se=[C.drawingBufferWidth,C.drawingBufferHeight];et=it==="fillOutlinePattern"&&R?qc(te,y,z,ct,se):jc(te,se)}else at=Pt.indexBuffer,Q=Pt.segments,et=R?_f(te,y,z,ct):wd(te);Vt.draw(y.context,W,g,y.stencilModeForClipping(Ot),b,yi.disabled,et,Yt,h.id,Pt.layoutVertexBuffer,at,Q,h.paint,y.transform.zoom,Bt)}}function Qu(y,s,h,d,g,b,I){const C=y.context,M=C.gl,N="fill-extrusion-pattern",R=h.paint.get(N),z=R.constantOr(1),W=h.getCrossfadeParameters(),it=h.paint.get("fill-extrusion-opacity"),et=R.constantOr(null);for(const at of d){const Q=s.getTile(at),Lt=Q.getBucket(h);if(!Lt)continue;const Ot=y.style.map.terrain&&y.style.map.terrain.getTerrainData(at),ct=Lt.programConfigurations.get(h.id),Pt=y.useProgram(z?"fillExtrusionPattern":"fillExtrusion",ct);z&&(y.context.activeTexture.set(M.TEXTURE0),Q.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ct.updatePaintBuffers(W)),Ku(ct,N,et,Q,h);const Bt=y.translatePosMatrix(at.posMatrix,Q,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Vt=h.paint.get("fill-extrusion-vertical-gradient"),Yt=z?Ya(Bt,y,Vt,it,at,W,Q):gf(Bt,y,Vt,it);Pt.draw(C,C.gl.TRIANGLES,g,b,I,yi.backCCW,Yt,Ot,h.id,Lt.layoutVertexBuffer,Lt.indexBuffer,Lt.segments,h.paint,y.transform.zoom,ct,y.style.map.terrain&&Lt.centroidVertexBuffer)}}function Wg(y,s,h,d,g,b,I){const C=y.context,M=C.gl,N=h.fbo;if(!N)return;const R=y.useProgram("hillshade"),z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);C.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,N.colorAttachment.get()),R.draw(C,M.TRIANGLES,g,b,I,yi.disabled,((W,it,et,at)=>{const Q=et.paint.get("hillshade-shadow-color"),Lt=et.paint.get("hillshade-highlight-color"),Ot=et.paint.get("hillshade-accent-color");let ct=et.paint.get("hillshade-illumination-direction")*(Math.PI/180);et.paint.get("hillshade-illumination-anchor")==="viewport"&&(ct-=W.transform.angle);const Pt=!W.options.moving;return{u_matrix:at?at.posMatrix:W.transform.calculatePosMatrix(it.tileID.toUnwrapped(),Pt),u_image:0,u_latrange:vf(0,it.tileID),u_light:[et.paint.get("hillshade-exaggeration"),ct],u_shadow:Q,u_highlight:Lt,u_accent:Ot}})(y,h,d,z?s:null),z,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Of(y,s,h,d,g,b){const I=y.context,C=I.gl,M=s.dem;if(M&&M.data){const N=M.dim,R=M.stride,z=M.getPixels();if(I.activeTexture.set(C.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(R),s.demTexture){const it=s.demTexture;it.update(z,{premultiply:!1}),it.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else s.demTexture=new Et(I,z,C.RGBA,{premultiply:!1}),s.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);I.activeTexture.set(C.TEXTURE0);let W=s.fbo;if(!W){const it=new Et(I,{width:N,height:N,data:null},C.RGBA);it.bind(C.LINEAR,C.CLAMP_TO_EDGE),W=s.fbo=I.createFramebuffer(N,N,!0,!1),W.colorAttachment.set(it.texture)}I.bindFramebuffer.set(W.framebuffer),I.viewport.set([0,0,N,N]),y.useProgram("hillshadePrepare").draw(I,C.TRIANGLES,d,g,b,yi.disabled,((it,et)=>{const at=et.stride,Q=a.Z();return a.aS(Q,0,a.N,-a.N,0,0,1),a.$(Q,Q,[0,-a.N,0]),{u_matrix:Q,u_image:1,u_dimension:[at,at],u_zoom:it.overscaledZ,u_unpack:et.getUnpackVector()}})(s.tileID,M),null,h.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Xg(y,s,h,d,g,b){const I=d.paint.get("raster-fade-duration");if(!b&&I>0){const C=a.h.now(),M=(C-y.timeAdded)/I,N=s?(C-s.timeAdded)/I:-1,R=h.getSource(),z=g.coveringZoomLevel({tileSize:R.tileSize,roundZoom:R.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-z)>Math.abs(y.tileID.overscaledZ-z),it=W&&y.refreshedUponExpiration?1:a.ad(W?M:1-N,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-it}:{opacity:it,mix:0}}return{opacity:1,mix:0}}const Od=new a.aT(1,0,0,1),oh=new a.aT(0,1,0,1),zf=new a.aT(0,0,1,1),zd=new a.aT(1,0,1,1),Fd=new a.aT(0,1,1,1);function tc(y,s,h,d){ah(y,0,s+h/2,y.transform.width,h,d)}function sh(y,s,h,d){ah(y,s-h/2,0,h,y.transform.height,d)}function ah(y,s,h,d,g,b){const I=y.context,C=I.gl;C.enable(C.SCISSOR_TEST),C.scissor(s*y.pixelRatio,h*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),I.clear({color:b}),C.disable(C.SCISSOR_TEST)}function Bd(y,s,h){const d=y.context,g=d.gl,b=h.posMatrix,I=y.useProgram("debug"),C=Tn.disabled,M=Ci.disabled,N=y.colorModeForRenderPass(),R="$debug",z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(h);d.activeTexture.set(g.TEXTURE0);const W=s.getTileByID(h.key).latestRawTileData,it=Math.floor((W&&W.byteLength||0)/1024),et=s.getTile(h).tileSize,at=512/Math.min(et,512)*(h.overscaledZ/y.transform.zoom)*.5;let Q=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(Q+=` => ${h.overscaledZ}`),function(Lt,Ot){Lt.initDebugOverlayCanvas();const ct=Lt.debugOverlayCanvas,Pt=Lt.context.gl,Bt=Lt.debugOverlayCanvas.getContext("2d");Bt.clearRect(0,0,ct.width,ct.height),Bt.shadowColor="white",Bt.shadowBlur=2,Bt.lineWidth=1.5,Bt.strokeStyle="white",Bt.textBaseline="top",Bt.font="bold 36px Open Sans, sans-serif",Bt.fillText(Ot,5,5),Bt.strokeText(Ot,5,5),Lt.debugOverlayTexture.update(ct),Lt.debugOverlayTexture.bind(Pt.LINEAR,Pt.CLAMP_TO_EDGE)}(y,`${Q} ${it}kB`),I.draw(d,g.TRIANGLES,C,M,Ii.alphaBlended,yi.disabled,Xu(b,a.aT.transparent,at),null,R,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),I.draw(d,g.LINE_STRIP,C,M,N,yi.disabled,Xu(b,a.aT.red),z,R,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Ni(y,s,h){const d=y.context,g=d.gl,b=y.colorModeForRenderPass(),I=new Tn(g.LEQUAL,Tn.ReadWrite,y.depthRangeFor3D),C=y.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const N of h){const R=y.renderToTexture.getTexture(N),z=s.getTerrainData(N.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,R.texture);const W={u_matrix:y.transform.calculatePosMatrix(N.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};C.draw(d,g.TRIANGLES,I,Ci.disabled,b,yi.backCCW,W,z,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Tl{constructor(s,h){this.context=new $g(s),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.Z(),renderTime:0},this.setup(),this.numSublayers=Bi.maxUnderzooming+Bi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Vc}resize(s,h,d){if(this.width=Math.floor(s*d),this.height=Math.floor(h*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,h=new a.a_;h.emplaceBack(0,0),h.emplaceBack(a.N,0),h.emplaceBack(0,a.N),h.emplaceBack(a.N,a.N),this.tileExtentBuffer=s.createVertexBuffer(h,Uc.members),this.tileExtentSegments=a.S.simpleSegment(0,0,4,2);const d=new a.a_;d.emplaceBack(0,0),d.emplaceBack(a.N,0),d.emplaceBack(0,a.N),d.emplaceBack(a.N,a.N),this.debugBuffer=s.createVertexBuffer(d,Uc.members),this.debugSegments=a.S.simpleSegment(0,0,4,5);const g=new a.V;g.emplaceBack(0,0,0,0),g.emplaceBack(a.N,0,a.N,0),g.emplaceBack(0,a.N,0,a.N),g.emplaceBack(a.N,a.N,a.N,a.N),this.rasterBoundsBuffer=s.createVertexBuffer(g,hn.members),this.rasterBoundsSegments=a.S.simpleSegment(0,0,4,2);const b=new a.a_;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(b,Uc.members),this.viewportSegments=a.S.simpleSegment(0,0,4,2);const I=new a.a$;I.emplaceBack(0),I.emplaceBack(1),I.emplaceBack(3),I.emplaceBack(2),I.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(I);const C=new a.b0;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(C);const M=this.context.gl;this.stencilClearMode=new Ci({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,h=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=a.Z();a.aS(d,0,this.width,this.height,0,0,1),a.a0(d,d,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,h.TRIANGLES,Tn.disabled,this.stencilClearMode,Ii.disabled,yi.disabled,Sd(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,h){if(this.currentStencilSource===s.source||!s.isTileClipped()||!h||!h.length)return;this.currentStencilSource=s.source;const d=this.context,g=d.gl;this.nextStencilID+h.length>256&&this.clearStencil(),d.setColorMode(Ii.disabled),d.setDepthMode(Tn.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of h){const C=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I);b.draw(d,g.TRIANGLES,Tn.disabled,new Ci({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),Ii.disabled,yi.disabled,Sd(I.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,h=this.context.gl;return new Ci({func:h.NOTEQUAL,mask:255},s,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(s){const h=this.context.gl;return new Ci({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(s){const h=this.context.gl,d=s.sort((I,C)=>C.overscaledZ-I.overscaledZ),g=d[d.length-1].overscaledZ,b=d[0].overscaledZ-g+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const I={};for(let C=0;C=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],N=g[M.source],R=b[M.source];this._renderTileClippingMasks(M,R),this.renderLayer(this,N,M,R)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerQ.source&&!Q.isHidden(R)?[N.sourceCaches[Q.source]]:[]),it=W.filter(Q=>Q.getSource().type==="vector"),et=W.filter(Q=>Q.getSource().type!=="vector"),at=Q=>{(!z||z.getSource().maxzoomat(Q)),z||et.forEach(Q=>at(Q)),z}(this.style,this.transform.zoom);M&&function(N,R,z){for(let W=0;Wit.style.map.terrain.getElevation(Vt,Ge,Pe):null)}}}(M,b,C,I,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),N),C.paint.get("icon-opacity").constantOr(1)!==0&&rh(b,I,C,M,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),R,z),C.paint.get("text-opacity").constantOr(1)!==0&&rh(b,I,C,M,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),R,z),I.map.showCollisionBoxes&&(Rd(b,I,C,M,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),!0),Rd(b,I,C,M,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),!1))})(s,h,d,g,this.style.placement.variableOffsets);break;case"circle":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const N=C.paint.get("circle-opacity"),R=C.paint.get("circle-stroke-width"),z=C.paint.get("circle-stroke-opacity"),W=!C.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(R.constantOr(1)===0||z.constantOr(1)===0))return;const it=b.context,et=it.gl,at=b.depthModeForSublayer(0,Tn.ReadOnly),Q=Ci.disabled,Lt=b.colorModeForRenderPass(),Ot=[];for(let ct=0;ctct.sortKey-Pt.sortKey);for(const ct of Ot){const{programConfiguration:Pt,program:Bt,layoutVertexBuffer:Vt,indexBuffer:Yt,uniformValues:ee,terrainData:te}=ct.state;Bt.draw(it,et.TRIANGLES,at,Q,Lt,yi.disabled,ee,te,C.id,Vt,Yt,ct.segments,C.paint,b.transform.zoom,Pt)}})(s,h,d,g);break;case"heatmap":(function(b,I,C,M){if(C.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const N=b.context,R=N.gl,z=Ci.disabled,W=new Ii([R.ONE,R.ONE],a.aT.transparent,[!0,!0,!0,!0]);(function(it,et,at){const Q=it.gl;it.activeTexture.set(Q.TEXTURE1),it.viewport.set([0,0,et.width/4,et.height/4]);let Lt=at.heatmapFbo;if(Lt)Q.bindTexture(Q.TEXTURE_2D,Lt.colorAttachment.get()),it.bindFramebuffer.set(Lt.framebuffer);else{const Ot=Q.createTexture();Q.bindTexture(Q.TEXTURE_2D,Ot),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_S,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_T,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MIN_FILTER,Q.LINEAR),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MAG_FILTER,Q.LINEAR),Lt=at.heatmapFbo=it.createFramebuffer(et.width/4,et.height/4,!1,!1),function(ct,Pt,Bt,Vt){var Yt,ee;const te=ct.gl,se=(Yt=ct.HALF_FLOAT)!==null&&Yt!==void 0?Yt:te.UNSIGNED_BYTE,Le=(ee=ct.RGBA16F)!==null&&ee!==void 0?ee:te.RGBA;te.texImage2D(te.TEXTURE_2D,0,Le,Pt.width/4,Pt.height/4,0,te.RGBA,se,null),Vt.colorAttachment.set(Bt)}(it,et,Ot,Lt)}})(N,b,C),N.clear({color:a.aT.transparent});for(let it=0;it{const ct=a.Z();a.aS(ct,0,at.width,at.height,0,0,1);const Pt=at.context.gl;return{u_matrix:ct,u_world:[Pt.drawingBufferWidth,Pt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:Q.paint.get("heatmap-opacity")}})(N,R),null,R.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments,R.paint,N.transform.zoom)}(b,C))})(s,h,d,g);break;case"line":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const N=C.paint.get("line-opacity"),R=C.paint.get("line-width");if(N.constantOr(1)===0||R.constantOr(1)===0)return;const z=b.depthModeForSublayer(0,Tn.ReadOnly),W=b.colorModeForRenderPass(),it=C.paint.get("line-dasharray"),et=C.paint.get("line-pattern"),at=et.constantOr(1),Q=C.paint.get("line-gradient"),Lt=C.getCrossfadeParameters(),Ot=at?"linePattern":it?"lineSDF":Q?"lineGradient":"line",ct=b.context,Pt=ct.gl;let Bt=!0;for(const Vt of M){const Yt=I.getTile(Vt);if(at&&!Yt.patternsLoaded())continue;const ee=Yt.getBucket(C);if(!ee)continue;const te=ee.programConfigurations.get(C.id),se=b.context.program.get(),Le=b.useProgram(Ot,te),vn=Bt||Le.program!==se,pe=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Vt),Ge=et.constantOr(null);if(Ge&&Yt.imageAtlas){const _n=Yt.imageAtlas,un=_n.patternPositions[Ge.to.toString()],bn=_n.patternPositions[Ge.from.toString()];un&&bn&&te.setConstantPatternPositions(un,bn)}const Pe=pe?Vt:null,Hn=at?Bg(b,Yt,C,Lt,Pe):it?Id(b,Yt,C,it,Lt,Pe):Q?Ed(b,Yt,C,ee.lineClipsArray.length,Pe):bf(b,Yt,C,Pe);if(at)ct.activeTexture.set(Pt.TEXTURE0),Yt.imageAtlasTexture.bind(Pt.LINEAR,Pt.CLAMP_TO_EDGE),te.updatePaintBuffers(Lt);else if(it&&(vn||b.lineAtlas.dirty))ct.activeTexture.set(Pt.TEXTURE0),b.lineAtlas.bind(ct);else if(Q){const _n=ee.gradients[C.id];let un=_n.texture;if(C.gradientVersion!==_n.version){let bn=256;if(C.stepInterpolant){const Vi=I.getSource().maxzoom,si=Vt.canonical.z===Vi?Math.ceil(1<0?h.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const h=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!h||!d}useProgram(s,h){this.cache=this.cache||{};const d=s+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Gc(this.context,Ei[s],h,Wc[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Et(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:h}=this.context.gl;return this.width!==s||this.height!==h}}class vo{constructor(s,h){this.points=s,this.planes=h}static fromInvProjectionMatrix(s,h,d){const g=Math.pow(2,d),b=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(C=>{const M=1/(C=a.ag([],C,s))[3]/h*g;return a.b3(C,C,[M,M,1/C[3],M])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const M=function(W,it){var et=it[0],at=it[1],Q=it[2],Lt=et*et+at*at+Q*Q;return Lt>0&&(Lt=1/Math.sqrt(Lt)),W[0]=it[0]*Lt,W[1]=it[1]*Lt,W[2]=it[2]*Lt,W}([],function(W,it,et){var at=it[0],Q=it[1],Lt=it[2],Ot=et[0],ct=et[1],Pt=et[2];return W[0]=Q*Pt-Lt*ct,W[1]=Lt*Ot-at*Pt,W[2]=at*ct-Q*Ot,W}([],ht([],b[C[0]],b[C[1]]),ht([],b[C[2]],b[C[1]]))),N=-((R=M)[0]*(z=b[C[1]])[0]+R[1]*z[1]+R[2]*z[2]);var R,z;return M.concat(N)});return new vo(b,I)}}class fu{constructor(s,h){this.min=s,this.max=h,this.center=function(d,g,b){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,b){return d[0]=g[0]+b[0],d[1]=g[1]+b[1],d[2]=g[2]+b[2],d}([],this.min,this.max))}quadrant(s){const h=[s%2==0,s<2],d=K(this.min),g=K(this.max);for(let b=0;b=0&&I++;if(I===0)return 0;I!==h.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let b=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let C=0;Cthis.max[g]-this.min[g])return 0}return 1}}class ec{constructor(s=0,h=0,d=0,g=0){if(isNaN(s)||s<0||isNaN(h)||h<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=h,this.left=d,this.right=g}interpolate(s,h,d){return h.top!=null&&s.top!=null&&(this.top=a.B.number(s.top,h.top,d)),h.bottom!=null&&s.bottom!=null&&(this.bottom=a.B.number(s.bottom,h.bottom,d)),h.left!=null&&s.left!=null&&(this.left=a.B.number(s.left,h.left,d)),h.right!=null&&s.right!=null&&(this.right=a.B.number(s.right,h.right,d)),this}getCenter(s,h){const d=a.ad((this.left+s-this.right)/2,0,s),g=a.ad((this.top+h-this.bottom)/2,0,h);return new a.P(d,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new ec(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class lh{constructor(s,h,d,g,b){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=b===void 0||!!b,this._minZoom=s||0,this._maxZoom=h||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ec,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const s=new lh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this._minEleveationForCurrentTile=s._minEleveationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const h=-a.b5(s,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var d=new a.A(4);return a.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,b){var I=g[0],C=g[1],M=g[2],N=g[3],R=Math.sin(b),z=Math.cos(b);d[0]=I*z+M*R,d[1]=C*z+N*R,d[2]=I*-R+M*z,d[3]=C*-R+N*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const h=a.ad(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const h=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,h,d){this._unmodified=!1,this._edgeInsets.interpolate(s,h,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const h=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(s){const h=[new a.b6(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new a.P(0,0)),g=this.pointCoordinate(new a.P(this.width,0)),b=this.pointCoordinate(new a.P(this.width,this.height)),I=this.pointCoordinate(new a.P(0,this.height)),C=Math.floor(Math.min(d.x,g.x,b.x,I.x)),M=Math.floor(Math.max(d.x,g.x,b.x,I.x)),N=1;for(let R=C-N;R<=M+N;R++)R!==0&&h.push(new a.b6(R,s))}return h}coveringTiles(s){var h,d;let g=this.coveringZoomLevel(s);const b=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),C=a.U.fromLngLat(this.center),M=Math.pow(2,g),N=[M*I.x,M*I.y,0],R=[M*C.x,M*C.y,0],z=vo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=g);const it=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,et=ct=>({aabb:new fu([ct*M,0,0],[(ct+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ct,fullyVisible:!1}),at=[],Q=[],Lt=g,Ot=s.reparseOverscaled?b:g;if(this._renderWorldCopies)for(let ct=1;ct<=3;ct++)at.push(et(-ct)),at.push(et(ct));for(at.push(et(0));at.length>0;){const ct=at.pop(),Pt=ct.x,Bt=ct.y;let Vt=ct.fullyVisible;if(!Vt){const Le=ct.aabb.intersects(z);if(Le===0)continue;Vt=Le===2}const Yt=s.terrain?N:R,ee=ct.aabb.distanceX(Yt),te=ct.aabb.distanceY(Yt),se=Math.max(Math.abs(ee),Math.abs(te));if(ct.zoom===Lt||se>it+(1<=W){const Le=Lt-ct.zoom,vn=N[0]-.5-(Pt<>1),Ge=ct.zoom+1;let Pe=ct.aabb.quadrant(Le);if(s.terrain){const Hn=new a.O(Ge,ct.wrap,Ge,vn,pe),_n=s.terrain.getMinMaxElevation(Hn),un=(h=_n.minElevation)!==null&&h!==void 0?h:this.elevation,bn=(d=_n.maxElevation)!==null&&d!==void 0?d:this.elevation;Pe=new fu([Pe.min[0],Pe.min[1],un],[Pe.max[0],Pe.max[1],bn])}at.push({aabb:Pe,zoom:Ge,x:vn,y:pe,wrap:ct.wrap,fullyVisible:Vt})}}return Q.sort((ct,Pt)=>ct.distanceSq-Pt.distanceSq).map(ct=>ct.tileID)}resize(s,h){this.width=s,this.height=h,this.pixelsToGLUnits=[2/s,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const h=a.ad(s.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.P(a.G(s.lng)*this.worldSize,a.H(h)*this.worldSize)}unproject(s){return new a.U(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const h=this.pointLocation(this.centerPoint,s),d=s.getElevationForLngLatZoom(h,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),b=a.U.fromLngLat(g.lngLat,g.altitude),I=a.U.fromLngLat(h,d),C=b.x-I.x,M=b.y-I.y,N=b.z-I.z,R=Math.sqrt(C*C+M*M+N*N),z=this.scaleZoom(this.cameraToCenterDistance/R/this.tileSize);this._elevation=d,this._center=h,this.zoom=z}setLocationAtPoint(s,h){const d=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(s),I=new a.U(b.x-(d.x-g.x),b.y-(d.y-g.y));this.center=this.coordinateLocation(I),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,h){return h?this.coordinatePoint(this.locationCoordinate(s),h.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,h){return this.coordinateLocation(this.pointCoordinate(s,h))}locationCoordinate(s){return a.U.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,h){if(h){const W=h.pointCoordinate(s);if(W!=null)return W}const d=[s.x,s.y,0,1],g=[s.x,s.y,1,1];a.ag(d,d,this.pixelMatrixInverse),a.ag(g,g,this.pixelMatrixInverse);const b=d[3],I=g[3],C=d[1]/b,M=g[1]/I,N=d[2]/b,R=g[2]/I,z=N===R?0:(0-N)/(R-N);return new a.U(a.B.number(d[0]/b,g[0]/I,z)/this.worldSize,a.B.number(C,M,z)/this.worldSize)}coordinatePoint(s,h=0,d=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,h,1];return a.ag(g,g,d),new a.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new ke().extend(this.pointLocation(new a.P(0,s))).extend(this.pointLocation(new a.P(this.width,s))).extend(this.pointLocation(new a.P(this.width,this.height))).extend(this.pointLocation(new a.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ke([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(s,h=!1){const d=s.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const b=s.canonical,I=this.worldSize/this.zoomScale(b.z),C=b.x+Math.pow(2,b.z)*s.wrap,M=a.ao(new Float64Array(16));return a.$(M,M,[C*I,b.y*I,0]),a.a0(M,M,[I/a.N,I/a.N,1]),a.a1(M,h?this.alignedProjMatrix:this.projMatrix,M),g[d]=new Float32Array(M),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let s,h,d,g,b=-90,I=90,C=-180,M=180;const N=this.size,R=this._unmodified;if(this.latRange){const it=this.latRange;b=a.H(it[1])*this.worldSize,I=a.H(it[0])*this.worldSize,s=I-bI&&(g=I-et)}if(this.lngRange){const it=(C+M)/2,et=a.b5(z.x,it-this.worldSize/2,it+this.worldSize/2),at=N.x/2;et-atM&&(d=M-at)}d===void 0&&g===void 0||(this.center=this.unproject(new a.P(d!==void 0?d:z.x,g!==void 0?g:z.y)).wrap()),this._unmodified=R,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,h=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.b7(1,this.center.lat)*this.worldSize;let g=a.ao(new Float64Array(16));a.a0(g,g,[this.width/2,-this.height/2,1]),a.$(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=a.ao(new Float64Array(16)),a.a0(g,g,[1,-1,1]),a.$(g,g,[-1,-1,0]),a.a0(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),I=Math.min(this.elevation,this._minEleveationForCurrentTile),C=b-I*this._pixelPerMeter/Math.cos(this._pitch),M=I<0?C:b,N=Math.PI/2+this._pitch,R=this._fov*(.5+s.y/this.height),z=Math.sin(R)*M/Math.sin(a.ad(Math.PI-N-R,.01,Math.PI-.01)),W=this.getHorizon(),it=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),et=Math.sin(it)*M/Math.sin(a.ad(Math.PI-N-it,.01,Math.PI-.01)),at=Math.min(z,et),Q=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),Lt=this.height/50;g=new Float64Array(16),a.b8(g,this._fov,this.width/this.height,Lt,Q),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,a.a0(g,g,[1,-1,1]),a.$(g,g,[0,0,-this.cameraToCenterDistance]),a.b9(g,g,this._pitch),a.ae(g,g,this.angle),a.$(g,g,[-h,-d,0]),this.mercatorMatrix=a.a0([],g,[this.worldSize,this.worldSize,this.worldSize]),a.a0(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.a1(new Float64Array(16),this.labelPlaneMatrix,g),a.$(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=a.as([],g),this.pixelMatrix3D=a.a1(new Float64Array(16),this.labelPlaneMatrix,g);const Ot=this.width%2/2,ct=this.height%2/2,Pt=Math.cos(this.angle),Bt=Math.sin(this.angle),Vt=h-Math.round(h)+Pt*Ot+Bt*ct,Yt=d-Math.round(d)+Pt*ct+Bt*Ot,ee=new Float64Array(g);if(a.$(ee,ee,[Vt>.5?Vt-1:Vt,Yt>.5?Yt-1:Yt,0]),this.alignedProjMatrix=ee,g=a.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new a.P(0,0)),h=[s.x*this.worldSize,s.y*this.worldSize,0,1];return a.ag(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,s))}getCameraQueryGeometry(s){const h=this.getCameraPoint();if(s.length===1)return[s[0],h];{let d=h.x,g=h.y,b=h.x,I=h.y;for(const C of s)d=Math.min(d,C.x),g=Math.min(g,C.y),b=Math.max(b,C.x),I=Math.max(I,C.y);return[new a.P(d,g),new a.P(b,g),new a.P(b,I),new a.P(d,I),new a.P(d,g)]}}}function Ll(y,s){let h,d=!1,g=null,b=null;const I=()=>{g=null,d&&(y.apply(b,h),g=setTimeout(I,s),d=!1)};return(...C)=>(d=!0,b=this,h=C,g||I(),g)}class nc{constructor(s){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let d;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:d,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}},this._updateHash=Ll(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const h=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,g),I=Math.round(h.lng*b)/b,C=Math.round(h.lat*b)/b,M=this._map.getBearing(),N=this._map.getPitch();let R="";if(R+=s?`/${I}/${C}/${d}`:`${d}/${C}/${I}`,(M||N)&&(R+="/"+Math.round(10*M)/10),N&&(R+=`/${Math.round(N)}`),this._hashName){const z=this._hashName;let W=!1;const it=window.location.hash.slice(1).split("&").map(et=>{const at=et.split("=")[0];return at===z?(W=!0,`${at}=${R}`):et}).filter(et=>et);return W||it.push(`${z}=${R}`),`#${it.join("&")}`}return`#${R}`}}const pu={linearity:.3,easing:a.ba(0,0,.3,1)},Vd=a.e({deceleration:2500,maxSpeed:1400},pu),Ud=a.e({deceleration:20,maxSpeed:1400},pu),Gd=a.e({deceleration:1e3,maxSpeed:360},pu),jd=a.e({deceleration:1e3,maxSpeed:90},pu);class qd{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.h.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,h=a.h.now();for(;s.length>0&&h-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)h.zoom+=b.zoomDelta||0,h.bearing+=b.bearingDelta||0,h.pitch+=b.pitchDelta||0,b.panDelta&&h.pan._add(b.panDelta),b.around&&(h.around=b.around),b.pinchAround&&(h.pinchAround=b.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const b=ic(h.pan.mag(),d,a.e({},Vd,s||{}));g.offset=h.pan.mult(b.amount/h.pan.mag()),g.center=this._map.transform.center,qs(g,b)}if(h.zoom){const b=ic(h.zoom,d,Ud);g.zoom=this._map.transform.zoom+b.amount,qs(g,b)}if(h.bearing){const b=ic(h.bearing,d,Gd);g.bearing=this._map.transform.bearing+a.ad(b.amount,-179,179),qs(g,b)}if(h.pitch){const b=ic(h.pitch,d,jd);g.pitch=this._map.transform.pitch+b.amount,qs(g,b)}if(g.zoom||g.bearing){const b=h.pinchAround===void 0?h.around:h.pinchAround;g.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),a.e(g,{noMoveStart:!0})}}function qs(y,s){(!y.duration||y.durationh.unproject(M)),C=b.reduce((M,N,R,z)=>M.add(N.div(z.length)),new a.P(0,0));super(s,{points:b,point:C,lngLats:I,lngLat:h.unproject(C),originalEvent:d}),this._defaultPrevented=!1}}class Zd extends a.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,h,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class $d{constructor(s,h){this._map=s,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Zd(s.type,this._map,s))}mousedown(s,h){return this._mousedownPos=h,this._firePreventable(new zo(s.type,this._map,s))}mouseup(s){this._map.fire(new zo(s.type,this._map,s))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new zo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new zo(s.type,this._map,s))}mouseover(s){this._map.fire(new zo(s.type,this._map,s))}mouseout(s){this._map.fire(new zo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new rc(s.type,this._map,s))}touchmove(s){this._map.fire(new rc(s.type,this._map,s))}touchend(s){this._map.fire(new rc(s.type,this._map,s))}touchcancel(s){this._map.fire(new rc(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wd{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new zo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new zo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ia{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(a.P.convert(s),this._map.terrain)}}class Xd{constructor(s,h){this._map=s,this._tr=new Ia(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,h){this.isEnabled()&&s.shiftKey&&s.button===0&&(x.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(s,h){if(!this._active)return;const d=h;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)b.fitScreenCoordinates(d,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(x.remove(this._box),this._box=null),x.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,h){return this._map.fire(new a.k(s,{originalEvent:h}))}}function ls(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const h={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const b=new a.P(0,0);for(const I of g)b._add(I);return b.div(g.length)}(h),this.touches=ls(d,h)))}touchmove(s,h,d){if(this.aborted||!this.centroid)return;const g=ls(d,h);for(const b in this.touches){const I=g[b];(!I||I.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(s,h,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class uh{constructor(s){this.singleTap=new Ca(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,h,d){this.singleTap.touchstart(s,h,d)}touchmove(s,h,d){this.singleTap.touchmove(s,h,d)}touchend(s,h,d){const g=this.singleTap.touchend(s,h,d);if(g){const b=s.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(g)<30;if(b&&I||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class Ta{constructor(s){this._tr=new Ia(s),this._zoomIn=new uh({numTouches:1,numTaps:2}),this._zoomOut=new uh({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,h,d){this._zoomIn.touchstart(s,h,d),this._zoomOut.touchstart(s,h,d)}touchmove(s,h,d){this._zoomIn.touchmove(s,h,d),this._zoomOut.touchmove(s,h,d)}touchend(s,h,d){const g=this._zoomIn.touchend(s,h,d),b=this._zoomOut.touchend(s,h,d),I=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom+1,around:I.unproject(g)},{originalEvent:s})}):b?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom-1,around:I.unproject(b)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class La{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const h=this._moveFunction(...s);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(s,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,h){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=h.length?h[0]:h;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},du=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:h=.8})=>{const d=new Ff({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new La({clickTolerance:s,move:(g,b)=>({bearingDelta:(b.x-g.x)*h}),moveStateManager:d,enable:y,assignEvents:ch})},Ma=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:h=-.5})=>{const d=new Ff({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new La({clickTolerance:s,move:(g,b)=>({pitchDelta:(b.y-g.y)*h}),moveStateManager:d,enable:y,assignEvents:ch})};class xe{constructor(s,h){this._minTouches=s.cooperativeGestures?2:1,this._clickTolerance=s.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(s,h,d){return this._calculateTransform(s,h,d)}touchmove(s,h,d){if(this._map._cooperativeGestures&&(this._minTouches===2&&d.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(s,!1,d.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(d.length0&&(this._active=!0);const g=ls(d,h),b=new a.P(0,0),I=new a.P(0,0);let C=0;for(const N in g){const R=g[N],z=this._touches[N];z&&(b._add(R),I._add(R.sub(z)),C++,g[N]=R)}if(this._touches=g,CMath.abs(y.x)}class Yg extends hh{constructor(s){super(),this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,h,d){super.touchstart(s,h,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Vf(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,h,d){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),b=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,b,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(s,h,d){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,b=h.mag()>=2;if(!g&&!b)return;if(!g||!b)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const I=s.y>0==h.y>0;return Vf(s)&&Vf(h)&&I}}const Uf={panStep:100,bearingStep:15,pitchStep:10};class Kd{constructor(s){this._tr=new Ia(s);const h=Uf;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let h=0,d=0,g=0,b=0,I=0;switch(s.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),b=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),b=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),I=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:C=>{const M=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:Jd,zoom:h?Math.round(M.zoom)+h*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+g*this._pitchStep,offset:[-b*this._panStep,-I*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Jd(y){return y*(2-y)}const Qd=4.000244140625;class Kg{constructor(s,h){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new Ia(s),this._el=s.getCanvasContainer(),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!s[this._map._metaKey])return;s.preventDefault()}let h=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=a.h.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,h!==0&&h%Qd==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),s.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=s,this._delta-=h,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const h=x.mousePos(this._el,s),d=this._tr;this._around=a.L.convert(this._aroundCenter?d.center:d.unproject(h)),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Qd?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&M!==0&&(M=1/M);const N=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(N*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,g=this._easing;let b,I=!1;if(this._type==="wheel"&&d&&g){const C=Math.min((a.h.now()-this._lastWheelEventTime)/200,1),M=g(C);b=a.B.number(d,h,M),C<1?this._frameId||(this._frameId=!0):I=!0}else b=h,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:b-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let h=a.bb;if(this._prevEase){const d=this._prevEase,g=(a.h.now()-d.start)/d.duration,b=d.easing(g+.01)-d.easing(g),I=.27/Math.sqrt(b*b+1e-4)*.01,C=Math.sqrt(.0729-I*I);h=a.ba(I,C,.25,1)}return this._prevEase={start:a.h.now(),duration:s,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Gf{constructor(s,h){this._clickZoom=s,this._tapZoom=h}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class jf{constructor(s){this._tr=new Ia(s),this.reset()}reset(){this._active=!1}dblclick(s,h){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qf{constructor(){this._tap=new uh({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,h,d){if(!this._swipePoint)if(this._tapTime){const g=h[0],b=s.timeStamp-this._tapTime<500,I=this._tapPoint.dist(g)<30;b&&I?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,h,d)}touchmove(s,h,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=h[0],b=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(s,h,d)}touchend(s,h,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(s,h,d);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zf{constructor(s,h,d){this._el=s,this._mousePan=h,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class bo{constructor(s,h,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=h,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class el{constructor(s,h,d,g){this._el=s,this._touchZoom=h,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const oc=y=>y.zoom||y.drag||y.pitch||y.rotate;class $f extends a.k{}function sc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Wf{constructor(s,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,b)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const I=g.type==="renderFrame"?void 0:g,C={needsRenderFrame:!1},M={},N={},R=g.touches,z=R?this._getMapTouches(R):void 0,W=z?x.touchPos(this._el,z):x.mousePos(this._el,g);for(const{handlerName:at,handler:Q,allowed:Lt}of this._handlers){if(!Q.isEnabled())continue;let Ot;this._blockedByActive(N,Lt,at)?Q.reset():Q[b||g.type]&&(Ot=Q[b||g.type](g,W,z),this.mergeHandlerResult(C,M,Ot,at,I),Ot&&Ot.needsRenderFrame&&this._triggerRenderFrame()),(Ot||Q.isActive())&&(N[at]=Q)}const it={};for(const at in this._previousActiveHandlers)N[at]||(it[at]=I);this._previousActiveHandlers=N,(Object.keys(it).length||sc(C))&&(this._changes.push([C,M,it]),this._triggerRenderFrame()),(Object.keys(N).length||sc(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:et}=C;et&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],et(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new qd(s),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,b,I]of this._listeners)x.addEventListener(g,b,g===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[s,h,d]of this._listeners)x.removeEventListener(s,h,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const h=this._map,d=h.getCanvasContainer();this._add("mapEvent",new $d(h,s));const g=h.boxZoom=new Xd(h,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const b=new Ta(h),I=new jf(h);h.doubleClickZoom=new Gf(I,b),this._add("tapZoom",b),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&h.doubleClickZoom.enable();const C=new qf;this._add("tapDragZoom",C);const M=h.touchPitch=new Yg(h);this._add("touchPitch",M),s.interactive&&s.touchPitch&&h.touchPitch.enable(s.touchPitch);const N=du(s),R=Ma(s);h.dragRotate=new bo(s,N,R),this._add("mouseRotate",N,["mousePitch"]),this._add("mousePitch",R,["mouseRotate"]),s.interactive&&s.dragRotate&&h.dragRotate.enable();const z=(({enable:Lt,clickTolerance:Ot})=>{const ct=new Ff({checkCorrectEvent:Pt=>x.mouseButton(Pt)===0&&!Pt.ctrlKey});return new La({clickTolerance:Ot,move:(Pt,Bt)=>({around:Bt,panDelta:Bt.sub(Pt)}),activateOnStart:!0,moveStateManager:ct,enable:Lt,assignEvents:ch})})(s),W=new xe(s,h);h.dragPan=new Zf(d,z,W),this._add("mousePan",z),this._add("touchPan",W,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&h.dragPan.enable(s.dragPan);const it=new Bf,et=new Yd;h.touchZoomRotate=new el(d,et,it,C),this._add("touchRotate",it,["touchPan","touchZoom"]),this._add("touchZoom",et,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&h.touchZoomRotate.enable(s.touchZoomRotate);const at=h.scrollZoom=new Kg(h,()=>this._triggerRenderFrame());this._add("scrollZoom",at,["mousePan"]),s.interactive&&s.scrollZoom&&h.scrollZoom.enable(s.scrollZoom);const Q=h.keyboard=new Kd(h);this._add("keyboard",Q),s.interactive&&s.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new Wd(h))}_add(s,h,d){this._handlers.push({handlerName:s,handler:h,allowed:d}),this._handlersById[s]=h}stop(s){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!oc(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,h,d){for(const g in s)if(g!==d&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const h=[];for(const d of s)this._el.contains(d.target)&&h.push(d);return h}mergeHandlerResult(s,h,d,g,b){if(!d)return;a.e(s,d);const I={handlerName:g,originalEvent:d.originalEvent||b};d.zoomDelta!==void 0&&(h.zoom=I),d.panDelta!==void 0&&(h.drag=I),d.pitchDelta!==void 0&&(h.pitch=I),d.bearingDelta!==void 0&&(h.rotate=I)}_applyChanges(){const s={},h={},d={};for(const[g,b,I]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new a.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),a.e(h,b),a.e(d,I);this._updateMapTransform(s,h,d),this._changes=[]}_updateMapTransform(s,h,d){const g=this._map,b=g._getTransformForUpdate(),I=g.terrain;if(!(sc(s)||I&&this._terrainMovement))return this._fireEvents(h,d,!0);let{panDelta:C,zoomDelta:M,bearingDelta:N,pitchDelta:R,around:z,pinchAround:W}=s;W!==void 0&&(z=W),g._stop(!0),z=z||g.transform.centerPoint;const it=b.pointLocation(C?z.sub(C):z);N&&(b.bearing+=N),R&&(b.pitch+=R),M&&(b.zoom+=M),I?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(C)):b.setLocationAtPoint(it,z):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(it,z),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,b.recalculateZoom(g.terrain)})):b.setLocationAtPoint(it,z),g._applyUpdatedTransform(b),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(h,d,!0)}_fireEvents(s,h,d){const g=oc(this._eventsInProgress),b=oc(s),I={};for(const R in s){const{originalEvent:z}=s[R];this._eventsInProgress[R]||(I[`${R}start`]=z),this._eventsInProgress[R]=s[R]}!g&&b&&this._fireEvent("movestart",b.originalEvent);for(const R in I)this._fireEvent(R,I[R]);b&&this._fireEvent("move",b.originalEvent);for(const R in s){const{originalEvent:z}=s[R];this._fireEvent(R,z)}const C={};let M;for(const R in this._eventsInProgress){const{handlerName:z,originalEvent:W}=this._eventsInProgress[R];this._handlersById[z].isActive()||(delete this._eventsInProgress[R],M=h[z]||W,C[`${R}end`]=M)}for(const R in C)this._fireEvent(R,C[R]);const N=oc(this._eventsInProgress);if(d&&(g||b)&&!N){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=W=>W!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new $f("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class tm extends a.E{constructor(s,h){super(),this._renderFrameCallback=()=>{const d=Math.min((a.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new a.L(this.transform.center.lng,this.transform.center.lat)}setCenter(s,h){return this.jumpTo({center:s},h)}panBy(s,h,d){return s=a.P.convert(s).mult(-1),this.panTo(this.transform.center,a.e({offset:s},h),d)}panTo(s,h,d){return this.easeTo(a.e({center:s},h),d)}getZoom(){return this.transform.zoom}setZoom(s,h){return this.jumpTo({zoom:s},h),this}zoomTo(s,h,d){return this.easeTo(a.e({zoom:s},h),d)}zoomIn(s,h){return this.zoomTo(this.getZoom()+1,s,h),this}zoomOut(s,h){return this.zoomTo(this.getZoom()-1,s,h),this}getBearing(){return this.transform.bearing}setBearing(s,h){return this.jumpTo({bearing:s},h),this}getPadding(){return this.transform.padding}setPadding(s,h){return this.jumpTo({padding:s},h),this}rotateTo(s,h,d){return this.easeTo(a.e({bearing:s},h),d)}resetNorth(s,h){return this.rotateTo(0,a.e({duration:1e3},s),h),this}resetNorthPitch(s,h){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},s),h),this}snapToNorth(s,h){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=a.B.number(g,M,Vt)),this._rotating&&(d.bearing=a.B.number(b,N,Vt)),this._pitching&&(d.pitch=a.B.number(I,R,Vt)),this._padding&&(d.interpolatePadding(C,z,Vt),it=d.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Vt),ct)d.setLocationAtPoint(ct,Pt);else{const Yt=d.zoomScale(d.zoom-g),ee=M>g?Math.min(2,Ot):Math.max(.5,Ot),te=Math.pow(ee,1-Vt),se=d.unproject(Q.add(Lt.mult(Vt*te)).mult(Yt));d.setLocationAtPoint(d.renderWorldCopies?se.wrap():se,it)}this._applyUpdatedTransform(d),this._fireMoveEvents(h)},Vt=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,Vt)},s),this}_prepareEase(s,h,d={}){this._moving=!0,h||d.moving||this.fire(new a.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new a.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new a.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new a.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&h!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(h-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=h}this.transform.elevation=a.B.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const h=s.clone(),{center:d,zoom:g,pitch:b,bearing:I,elevation:C}=this.transformCameraUpdate(h);d&&(h.center=d),g!==void 0&&(h.zoom=g),b!==void 0&&(h.pitch=b),I!==void 0&&(h.bearing=I),C!==void 0&&(h.elevation=C),this.transform.apply(h)}_fireMoveEvents(s){this.fire(new a.k("move",s)),this._zooming&&this.fire(new a.k("zoom",s)),this._rotating&&this.fire(new a.k("rotate",s)),this._pitching&&this.fire(new a.k("pitch",s))}_afterEase(s,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const d=this._zooming,g=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.k("zoomend",s)),g&&this.fire(new a.k("rotateend",s)),b&&this.fire(new a.k("pitchend",s)),this.fire(new a.k("moveend",s))}flyTo(s,h){if(!s.essential&&a.h.prefersReducedMotion){const Pe=a.F(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pe,h)}this.stop(),s=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.bb},s);const d=this._getTransformForUpdate(),g=this.getZoom(),b=this.getBearing(),I=this.getPitch(),C=this.getPadding(),M="zoom"in s?a.ad(+s.zoom,d.minZoom,d.maxZoom):g,N="bearing"in s?this._normalizeBearing(s.bearing,b):b,R="pitch"in s?+s.pitch:I,z="padding"in s?s.padding:d.padding,W=d.zoomScale(M-g),it=a.P.convert(s.offset);let et=d.centerPoint.add(it);const at=d.pointLocation(et),Q=a.L.convert(s.center||at);this._normalizeCenter(Q);const Lt=d.project(at),Ot=d.project(Q).sub(Lt);let ct=s.curve;const Pt=Math.max(d.width,d.height),Bt=Pt/W,Vt=Ot.mag();if("minZoom"in s){const Pe=a.ad(Math.min(s.minZoom,g,M),d.minZoom,d.maxZoom),Hn=Pt/d.zoomScale(Pe-g);ct=Math.sqrt(Hn/Vt*2)}const Yt=ct*ct;function ee(Pe){const Hn=(Bt*Bt-Pt*Pt+(Pe?-1:1)*Yt*Yt*Vt*Vt)/(2*(Pe?Bt:Pt)*Yt*Vt);return Math.log(Math.sqrt(Hn*Hn+1)-Hn)}function te(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function se(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}const Le=ee(!1);let vn=function(Pe){return se(Le)/se(Le+ct*Pe)},pe=function(Pe){return Pt*((se(Le)*(te(Hn=Le+ct*Pe)/se(Hn))-te(Le))/Yt)/Vt;var Hn},Ge=(ee(!0)-Le)/ct;if(Math.abs(Vt)<1e-6||!isFinite(Ge)){if(Math.abs(Pt-Bt)<1e-6)return this.easeTo(s,h);const Pe=Bts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=b!==N,this._pitching=R!==I,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(Q),this._ease(Pe=>{const Hn=Pe*Ge,_n=1/vn(Hn);d.zoom=Pe===1?M:g+d.scaleZoom(_n),this._rotating&&(d.bearing=a.B.number(b,N,Pe)),this._pitching&&(d.pitch=a.B.number(I,R,Pe)),this._padding&&(d.interpolatePadding(C,z,Pe),et=d.centerPoint.add(it)),this.terrain&&!s.freezeElevation&&this._updateElevation(Pe);const un=Pe===1?Q:d.unproject(Lt.add(Ot.mult(pe(Hn))).mult(_n));d.setLocationAtPoint(d.renderWorldCopies?un.wrap():un,et),this._applyUpdatedTransform(d),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,h)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,h,d){d.animate===!1||d.duration===0?(s(1),h()):(this._easeStart=a.h.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,h){s=a.b5(s,-180,180);const d=Math.abs(s-h);return Math.abs(s-360-h)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(a.L.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}class Fo{constructor(s={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=x.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=x.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){x.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,h){const d=this._map._getUIString(`AttributionControl.${h}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const b=h[g];if(b.used||b.usedForTerrain){const I=b.getSource();I.attribution&&s.indexOf(I.attribution)<0&&s.push(I.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,b)=>g.length-b.length),s=s.filter((g,b)=>{for(let I=b+1;I=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class fi{constructor(s={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const d=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("div","maplibregl-ctrl");const h=x.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){x.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class fh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const h=++this._id;return this._queue.push({callback:s,id:h,cancelled:!1}),h}remove(s){const h=this._currentlyRunning,d=h?this._queue.concat(h):this._queue;for(const g of d)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const d of h)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Xf={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var em=a.Q([{name:"a_pos3d",type:"Int16",components:3}]);class nm extends a.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,h){this.sourceCache.update(s,h),this._renderableTilesKeys=[];const d={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),a.aS(g.posMatrix,0,a.N,0,a.N,0,1),this._tiles[g.key]=new pn(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(s){for(const h in this._tiles){const d=this._tiles[h];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const h={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16),a.aS(b.posMatrix,0,a.N,0,a.N,0,1),h[d]=b}else if(g.canonical.isChildOf(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=g.canonical.z-s.canonical.z,C=g.canonical.x-(g.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,N,0,N,0,1),a.$(b.posMatrix,b.posMatrix,[-C*N,-M*N,0]),h[d]=b}else if(s.canonical.isChildOf(g.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=s.canonical.z-g.canonical.z,C=s.canonical.x-(s.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,a.N,0,a.N,0,1),a.$(b.posMatrix,b.posMatrix,[C*N,M*N,0]),a.a0(b.posMatrix,b.posMatrix,[1/2**I,1/2**I,0]),h[d]=b}}return h}getSourceTile(s,h){const d=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(s.scaledTo(g--).key);return b}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=s)}}class im{constructor(s,h,d){this.painter=s,this.sourceCache=new nm(h),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,h,d,g=a.N){var b;if(!(h>=0&&h=0&&ds.canonical.z&&(s.canonical.z>=g?b=s.canonical.z-g:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=s.canonical.x-(s.canonical.x>>b<>b<>8<<4|b>>8,h[I+3]=0;const d=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new Et(s,d,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){const h=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),d.bindFramebuffer.set(null);const b=h[0]+(h[2]>>4<<8),I=h[1]+((15&h[2])<<8),C=this.coordsIndex[255-h[3]],M=C&&this.sourceCache.getTileByID(C);if(!M)return null;const N=this._coordsTextureSize,R=(1<0&&Math.sign(b)<0||!d&&Math.sign(g)<0&&Math.sign(b)>0?(g=360*Math.sign(b)+g,a.G(g)):h}}class Jg{constructor(s,h,d){this._context=s,this._size=h,this._tileSize=d,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const h=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),d=new Et(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return d.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),h.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),h.colorAttachment.set(d.texture),{id:s,fbo:h,texture:d,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(h=>s.id!==h),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const so={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ph{constructor(s,h){this.painter=s,this.terrain=h,this.pool=new Jg(s.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(h)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const g=s.sourceCaches[d].getVisibleCoordinates();for(const b of g){const I=this.terrain.sourceCache.getTerrainCoords(b);for(const C in I)this._coordsDescendingInv[d][C]||(this._coordsDescendingInv[d][C]=[]),this._coordsDescendingInv[d][C].push(I[C])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],b=g.source;if(so[g.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const I in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][I]=this._coordsDescendingInv[b][I].map(C=>C.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[g][d.tileID.key];b&&b!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const h=s.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(so[h]&&(this._prevType&&so[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(so[this._prevType]||so[h]&&g){this._prevType=h;const b=this._stacks.length-1,I=this._stacks[b]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Ni(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[b]){const N=this.pool.getObjectForId(C.rtt[b].id);if(N.stamp===C.rtt[b].stamp){this.pool.useObject(N);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),C.rtt[b]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:a.aT.transparent,stencil:0}),d.currentStencilSource=void 0;for(let N=0;N{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Hf={showCompass:!0,showZoom:!0,visualizePitch:!1};class Yf{constructor(s,h,d=!1){this.mousedown=I=>{this.startMouse(a.e({},I,{ctrlKey:!0,preventDefault:()=>I.preventDefault()}),x.mousePos(this.element,I)),x.addEventListener(window,"mousemove",this.mousemove),x.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=I=>{this.moveMouse(I,x.mousePos(this.element,I))},this.mouseup=I=>{this.mouseRotate.dragEnd(I),this.mousePitch&&this.mousePitch.dragEnd(I),this.offTemp()},this.touchstart=I=>{I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.startTouch(I,this._startPos),x.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.addEventListener(window,"touchend",this.touchend))},this.touchmove=I=>{I.targetTouches.length!==1?this.reset():(this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.moveTouch(I,this._lastPos))},this.touchend=I=>{I.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=s.dragRotate._mouseRotate.getClickTolerance(),b=s.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=du({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:I,clickTolerance:C,bearingDegreesPerPixelMoved:M=.8})=>{const N=new Hd;return new La({clickTolerance:C,move:(R,z)=>({bearingDelta:(z.x-R.x)*M}),moveStateManager:N,enable:I,assignEvents:ac})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=Ma({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:I,clickTolerance:C,pitchDegreesPerPixelMoved:M=-.5})=>{const N=new Hd;return new La({clickTolerance:C,move:(R,z)=>({pitchDelta:(z.y-R.y)*M}),moveStateManager:N,enable:I,assignEvents:ac})})({clickTolerance:b,enable:!0})),x.addEventListener(h,"mousedown",this.mousedown),x.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),x.addEventListener(h,"touchcancel",this.reset)}startMouse(s,h){this.mouseRotate.dragStart(s,h),this.mousePitch&&this.mousePitch.dragStart(s,h),x.disableDrag()}startTouch(s,h){this.touchRotate.dragStart(s,h),this.touchPitch&&this.touchPitch.dragStart(s,h),x.disableDrag()}moveMouse(s,h){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}moveTouch(s,h){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}off(){const s=this.element;x.removeEventListener(s,"mousedown",this.mousedown),x.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend),x.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){x.enableDrag(),x.removeEventListener(window,"mousemove",this.mousemove),x.removeEventListener(window,"mouseup",this.mouseup),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend)}}let Xi;function Kf(y,s,h){if(y=new a.L(y.lng,y.lat),s){const d=new a.L(y.lng-360,y.lat),g=new a.L(y.lng+360,y.lat),b=h.locationPoint(y).distSqr(s);h.locationPoint(d).distSqr(s)180;){const d=h.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=h.width&&d.y<=h.height)break;y.lng>h.center.lng?y.lng-=360:y.lng+=360}return y}const us={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function rm(y,s,h){const d=y.classList;for(const g in us)d.remove(`maplibregl-${h}-anchor-${g}`);d.add(`maplibregl-${h}-anchor-${s}`)}class Ml extends a.E{constructor(s){if(super(),this._onKeyPress=h=>{const d=h.code,g=h.charCode||h.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const d=h.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=h=>{if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!d)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Kf(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let b="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?b="rotateX(0deg)":this._pitchAlignment==="map"&&(b=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),x.setTransform(this._element,`${us[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${b} ${g}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const I=this._map.unproject(this._pos),C=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=I.distanceTo(this._lngLat)>20*C?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=h=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=h.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.k("dragstart"))),this.fire(new a.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a.k("dragend")),this._state="inactive"},this._addDragHandler=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,s&&s.element)this._element=s.element,this._offset=a.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=x.create("div"),this._element.setAttribute("aria-label","Map marker");const h=x.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const b=x.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"stroke","none"),b.setAttributeNS(null,"stroke-width","1"),b.setAttributeNS(null,"fill","none"),b.setAttributeNS(null,"fill-rule","evenodd");const I=x.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill-rule","nonzero");const C=x.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Lt of M){const Ot=x.createNS("http://www.w3.org/2000/svg","ellipse");Ot.setAttributeNS(null,"opacity","0.04"),Ot.setAttributeNS(null,"cx","10.5"),Ot.setAttributeNS(null,"cy","5.80029008"),Ot.setAttributeNS(null,"rx",Lt.rx),Ot.setAttributeNS(null,"ry",Lt.ry),C.appendChild(Ot)}const N=x.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const R=x.createNS("http://www.w3.org/2000/svg","path");R.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),N.appendChild(R);const z=x.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const W=x.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),z.appendChild(W);const it=x.createNS("http://www.w3.org/2000/svg","g");it.setAttributeNS(null,"transform","translate(6.0, 7.0)"),it.setAttributeNS(null,"fill","#FFFFFF");const et=x.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"transform","translate(8.0, 8.0)");const at=x.createNS("http://www.w3.org/2000/svg","circle");at.setAttributeNS(null,"fill","#000000"),at.setAttributeNS(null,"opacity","0.25"),at.setAttributeNS(null,"cx","5.5"),at.setAttributeNS(null,"cy","5.5"),at.setAttributeNS(null,"r","5.4999962");const Q=x.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#FFFFFF"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962"),et.appendChild(at),et.appendChild(Q),I.appendChild(C),I.appendChild(N),I.appendChild(z),I.appendChild(it),I.appendChild(et),h.appendChild(I),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=a.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),rm(this._element,this._anchor,"marker"),s&&s.className)for(const h of s.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),x.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=a.L.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return s?(s.isOpen()?s.remove():s.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(s){return this._offset=a.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Di={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ti=0,gu=!1;const lc={maxWidth:100,unit:"metric"};function uc(y,s,h){const d=h&&h.maxWidth||100,g=y._container.clientHeight/2,b=y.unproject([0,g]),I=y.unproject([d,g]),C=b.distanceTo(I);if(h&&h.unit==="imperial"){const M=3.2808*C;M>5280?Pl(s,d,M/5280,y._getUIString("ScaleControl.Miles")):Pl(s,d,M,y._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?Pl(s,d,C/1852,y._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Pl(s,d,C/1e3,y._getUIString("ScaleControl.Kilometers")):Pl(s,d,C,y._getUIString("ScaleControl.Meters"))}function Pl(y,s,h,d){const g=function(b){const I=Math.pow(10,`${Math.floor(b)}`.length-1);let C=b/I;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(M){const N=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*N)/N}(C),I*C}(h);y.style.width=s*(g/h)+"px",y.innerHTML=`${g} ${d}`}const Jf={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Qf=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _u(y){if(y){if(typeof y=="number"){const s=Math.round(Math.abs(y)/Math.SQRT2);return{center:new a.P(0,0),top:new a.P(0,y),"top-left":new a.P(s,s),"top-right":new a.P(-s,s),bottom:new a.P(0,-y),"bottom-left":new a.P(s,-s),"bottom-right":new a.P(-s,-s),left:new a.P(y,0),right:new a.P(-y,0)}}if(y instanceof a.P||Array.isArray(y)){const s=a.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:a.P.convert(y.center||[0,0]),top:a.P.convert(y.top||[0,0]),"top-left":a.P.convert(y["top-left"]||[0,0]),"top-right":a.P.convert(y["top-right"]||[0,0]),bottom:a.P.convert(y.bottom||[0,0]),"bottom-left":a.P.convert(y["bottom-left"]||[0,0]),"bottom-right":a.P.convert(y["bottom-right"]||[0,0]),left:a.P.convert(y.left||[0,0]),right:a.P.convert(y.right||[0,0])}}return _u(new a.P(0,0))}const tp={extend:(y,...s)=>a.e(y,...s),run(y){y()},logToElement(y,s=!1,h="log"){const d=window.document.getElementById(h);d&&(s&&(d.innerHTML=""),d.innerHTML+=`
${y}`)}},ep=_;class Vn{static get version(){return ep}static get workerCount(){return es.workerCount}static set workerCount(s){es.workerCount=s}static get maxParallelImageRequests(){return a.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(s){a.c.MAX_PARALLEL_IMAGE_REQUESTS=s}static get workerUrl(){return a.c.WORKER_URL}static set workerUrl(s){a.c.WORKER_URL=s}static addProtocol(s,h){a.c.REGISTERED_PROTOCOLS[s]=h}static removeProtocol(s){delete a.c.REGISTERED_PROTOCOLS[s]}}return Vn.Map=class extends tm{constructor(y){if(a.bg.mark(a.bh.create),(y=a.e({},Ue,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new lh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._cooperativeGesturesOnWheel=s=>{this._onCooperativeGesture(s,s[this._metaKey],1)},this._contextLost=s=>{s.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._cooperativeGestures=y.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new fh,this._controls=[],this._mapId=a.a2(),this._locale=a.e({},Xf,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=U.addThrottleControl(()=>this.isMoving()),this._requestManager=new V(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const h=Ll(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?h(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Wf(this,y),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=y.hash&&new nc(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,a.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new Fo({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new fi,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new a.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new a.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new a.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new a.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=y.onAdd(this);this._controls.push(y);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(h,d.firstChild):d.appendChild(h),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new a.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,h,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,h,d)}resize(y){var s;const h=this._containerDimensions(),d=h[0],g=h[1],b=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,b),this.painter.resize(d,g,b),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const M=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,M),this.painter.resize(d,g,M)}this.transform.resize(d,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,g);const I=!this._moving;return I&&(this.stop(),this.fire(new a.k("movestart",y)).fire(new a.k("move",y))),this.fire(new a.k("resize",y)),I&&this.fire(new a.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:h,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),b=y*g,I=s*g;return Math.min(b>h?h/b:1,I>d?d/I:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(ke.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(y){return this._cooperativeGestures=y,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(y){return this.transform.locationPoint(a.L.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(a.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,s,h){if(y==="mouseenter"||y==="mouseover"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:b=>{const I=this.getLayer(s)?this.queryRenderedFeatures(b.point,{layers:[s]}):[];I.length?d||(d=!0,h.call(this,new zo(y,this,b.originalEvent,{features:I}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="mouseout"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:I=>{(this.getLayer(s)?this.queryRenderedFeatures(I.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,h.call(this,new zo(y,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,h.call(this,new zo(y,this,I.originalEvent)))}}}}{const d=g=>{const b=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];b.length&&(g.features=b,h.call(this,g),delete g.features)};return{layer:s,listener:h,delegates:{[y]:d}}}}on(y,s,h){if(h===void 0)return super.on(y,s);const d=this._createDelegatedListener(y,s,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,s,h){if(h===void 0)return super.once(y,s);const d=this._createDelegatedListener(y,s,h);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,s,h){return h===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let b=0;bthis._updateStyle(y,s));const h=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Dr(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,h):this.style.loadJSON(y,s,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Dr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const h=this._requestManager.transformRequest(y,Y.Style);a.f(h,(d,g)=>{d?this.fire(new a.j(d)):g&&this._updateDiff(g,s)})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&this._update(!0)}catch(h){a.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(y,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.w("There is no style added to the map.")}addSource(y,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.loaded();this.fire(new a.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);for(const h in this.style._layers){const d=this.style._layers[h];d.type==="hillshade"&&d.source===y.source&&a.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new im(this.painter,s,y),this.painter.renderToTexture=new ph(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.sourceId!==y.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(h.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new a.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const h=y[s]._tiles;for(const d in h){const g=h[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}addSourceType(y,s,h){return this._lazyInitEmptyStyle(),this.style.addSourceType(y,s,h)}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,h={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:b,stretchY:I,content:C}=h;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||a.a(s))){if(s.width===void 0||s.height===void 0)return this.fire(new a.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:N,data:R}=s,z=s;return this.style.addImage(y,{data:new a.R({width:M,height:N},new Uint8Array(R)),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0,userImage:z}),z.onAdd&&z.onAdd(this,y),this}}{const{width:M,height:N,data:R}=a.h.getImageData(s);this.style.addImage(y,{data:new a.R({width:M,height:N},R),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0})}}updateImage(y,s){const h=this.style.getImage(y);if(!h)return this.fire(new a.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||a.a(s)?a.h.getImageData(s):s,{width:g,height:b,data:I}=d;if(g===void 0||b===void 0)return this.fire(new a.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==h.data.width||b!==h.data.height)return this.fire(new a.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const C=!(s instanceof HTMLImageElement||a.a(s));return h.data.replace(I,C),this.style.updateImage(y,h),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new a.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y,s){U.getImage(this._requestManager.transformRequest(y,Y.Image),s)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,s,h){return this.style.setLayerZoomRange(y,s,h),this._update(!0)}setFilter(y,s,h={}){return this.style.setFilter(y,s,h),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,h,d={}){return this.style.setPaintProperty(y,s,h,d),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,h,d={}){return this.style.setLayoutProperty(y,s,h,d),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,h,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,h=>{h||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=x.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=x.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const h=this._containerDimensions(),d=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],d);const g=this._controlContainer=x.create("div","maplibregl-control-container",y),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(I=>{b[I]=x.create("div",`maplibregl-ctrl-${I} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=x.create("div","maplibregl-cooperative-gesture-screen",this._container);let y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
${y}
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
- `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){x.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(y,s,h){this._canvas.width=Math.floor(h*y),this._canvas.height=Math.floor(h*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:y},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const h=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!h){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Cl(h,this.transform),S.testSupport(h)}_onCooperativeGesture(y,s,h){return!s&&h<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,b=a.h.now();this.style.zoomHistory.update(g,b);const I=new a.a8(g,{now:b,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=I.crossFadingFactor();C===1&&C===this._crossFadingFactor||(h=!0,this._crossFadingFactor=C),this.style.update(I)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new a.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.bg.mark(a.bh.load),this.fire(new a.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,a.bg.mark(a.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const h of this._controls)h.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),x.remove(this._canvasContainer),x.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),a.bg.clearMetrics(),this._removed=!0,this.fire(new a.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.h.frame(y=>{a.bg.frame(y),this._frame=null,this._render(y)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return Re}getCameraTargetElevation(){return this.transform.elevation}},Vn.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),h=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,h)=>{const d=this._map._getUIString(`NavigationControl.${h}`);s.title=d,s.setAttribute("aria-label",d)},this.options=a.e({},Hf,y),this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=x.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Yf(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){x.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,s){const h=x.create("button",y,this._container);return h.type="button",h.addEventListener("click",s),h}},Vn.GeolocateControl=class extends a.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new a.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const h=new a.L(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,g=this._map.getBearing(),b=a.e({bearing:g},this.options.fitBoundsOptions),I=ke.fromLngLat(h,d);this._map.fitBounds(I,b,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const h=new a.L(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&mu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=x.create("button","maplibregl-ctrl-geolocate",this._container),x.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=x.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ll({element:this._dotElement}),this._circleElement=x.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ll({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new a.k("trackuserlocationend")))})}},this.options=a.e({},Ni,y)}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(s,h=!1){Hi===void 0||h?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Hi=d.state!=="denied",s(Hi)}).catch(()=>{Hi=!!window.navigator.geolocation,s(Hi)}):(Hi=!!window.navigator.geolocation,s(Hi)):s(Hi)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),x.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ei=0,mu=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),h=y.coords;return s&&(h.longitudes.getEast()||h.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const y=this._map.getBounds(),s=y.getSouthEast(),h=y.getNorthEast(),d=s.distanceTo(h),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ei--,mu=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new a.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ei++,Ei>1?(y={maximumAge:6e5,timeout:0},mu=!0):(y=this.options.positionOptions,mu=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Vn.AttributionControl=zo,Vn.LogoControl=ci,Vn.ScaleControl=class{constructor(y){this._onMove=()=>{lc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,lc(this._map,this._container,this.options)},this.options=a.e({},ac,y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){x.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Vn.FullscreenControl=class extends a.E{constructor(y={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:a.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){x.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=x.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);x.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new a.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new a.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},Vn.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=y}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=x.create("button","maplibregl-ctrl-terrain",this._container),x.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){x.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Vn.Popup=class extends a.E{constructor(y){super(),this.remove=()=>(this._content&&x.remove(this._content),this._container&&(x.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.k("close")),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=x.create("div","maplibregl-popup",this._map.getContainer()),this._tip=x.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Kf(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!s)return;const h=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);let d=this.options.anchor;const g=gu(this.options.offset);if(!d){const I=this._container.offsetWidth,C=this._container.offsetHeight;let M;M=h.y+g.bottom.ythis._map.transform.height-C?["bottom"]:[],h.xthis._map.transform.width-I/2&&M.push("right"),d=M.length===0?"bottom":M.join("-")}const b=h.add(g[d]).round();x.setTransform(this._container,`${ls[d]} translate(${b.x}px,${b.y}px)`),im(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(Jf),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new a.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=a.L.convert(y),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const s=document.createDocumentFragment(),h=document.createElement("body");let d;for(h.innerHTML=y;d=h.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=x.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}_createCloseButton(){this.options.closeButton&&(this._closeButton=x.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Qf);y&&y.focus()}},Vn.Marker=Ll,Vn.Style=Dr,Vn.LngLat=a.L,Vn.LngLatBounds=ke,Vn.Point=a.P,Vn.MercatorCoordinate=a.U,Vn.Evented=a.E,Vn.AJAXError=a.bi,Vn.config=a.c,Vn.CanvasSource=wn,Vn.GeoJSONSource=De,Vn.ImageSource=On,Vn.RasterDEMTileSource=ie,Vn.RasterTileSource=qn,Vn.VectorTileSource=Jn,Vn.VideoSource=mi,Vn.setRTLTextPlugin=a.bj,Vn.getRTLTextPluginStatus=a.bk,Vn.prewarm=function(){Ha().acquire(In)},Vn.clearPrewarmedResources=function(){const y=es;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(In),es=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},$f.extend(Vn,{isSafari:a.ac,getPerformanceMetrics:a.bg.getPerformanceMetrics}),Vn});var f=r;return f})})(ex);var dg=ex.exports;const Ls=$b(dg);function Vv(e){let t;return n=>{if(n)for(let i in n){let r=t==null?void 0:t[i],l=n[i];r!==l&&e(i,l,r)}else if(t)for(let i in t)e(i,void 0,t[i]);t=n}}function fE(e,...t){let n=[e];for(let i of t)if(i)Array.isArray(i)&&i[0]===e?n.push(...i.slice(1)):n.push(i);else continue;if(n.length!==1)return n.length===2?n[1]:n}function pE(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function iy(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}var Xm=dE;function dE(e){var t,n,i;if(e){if(Array.isArray(e)){for(t=[],n=e.length,i=0;i{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function gE(e,t,n){let i,r,l,f,a,_,x,S,L,A,k,R,{$$slots:U={},$$scope:j}=t,{id:Q=rf("layer")}=t,{source:B=void 0}=t,{sourceLayer:X=void 0}=t,{beforeId:J=void 0}=t,{beforeLayerType:it=void 0}=t,{type:ft}=t,{paint:mt=void 0}=t,{layout:_t=void 0}=t,{filter:ct=void 0}=t,{applyToClusters:Mt=void 0}=t,{minzoom:xt=void 0}=t,{maxzoom:vt=void 0}=t,{manageHoverState:me=!1}=t,{hovered:Rt=null}=t,{interactive:Gt=!0}=t,{hoverCursor:te=void 0}=t,{eventsIfTopMost:se=!1}=t;const Ce=Nc(),{map:yn,source:jn,self:$e,minzoom:Fe,maxzoom:ke,eventTopMost:fn,layerInfo:Jn}=uE();Ee(e,yn,gt=>n(31,L=gt)),Ee(e,jn,gt=>n(32,A=gt)),Ee(e,$e,gt=>n(0,S=gt)),Ee(e,Fe,gt=>n(34,R=gt)),Ee(e,ke,gt=>n(33,k=gt)),sa(()=>{S&&L&&(Jn.delete(S),L==null||L.removeLayer(S))});let qn;function ie(gt){var Xn,pn;if(!Gt||!S||!L||se&&fn(gt)!==S)return;let Ie=gt.features??[],qe=(pn=(Xn=Ie[0])==null?void 0:Xn.properties)==null?void 0:pn.cluster_id,nr={event:gt,map:L,clusterId:qe,layer:S,source:a,features:Ie};Ce(gt.type,nr)}function De(gt){var Xn,pn;if(!Gt||!S||!L||se&&fn(gt)!==S)return;te&&(L.getCanvas().style.cursor=te);let Ie=gt.features??[];n(6,Rt=Ie[0]??null);let qe=(pn=(Xn=Ie[0])==null?void 0:Xn.properties)==null?void 0:pn.cluster_id;Ce("mouseenter",{event:gt,map:L,clusterId:qe,layer:S,source:a,features:Ie})}function hn(gt){var Xn,pn,Xi;if(!Gt||!L)return;if(se&&fn(gt)!==S){n(6,Rt=null),me&&qn!==void 0&&(L==null||L.setFeatureState({source:a,sourceLayer:X,id:qn},{hover:!1}),qn=void 0);return}L.getCanvas().style.cursor=te;let Ie=gt.features??[],qe=(pn=(Xn=Ie[0])==null?void 0:Xn.properties)==null?void 0:pn.cluster_id,nr=(Xi=Ie[0])==null?void 0:Xi.id;nr!==qn&&(me&&(qn!==void 0&&(L==null||L.setFeatureState({source:a,id:qn,sourceLayer:X},{hover:!1})),L==null||L.setFeatureState({source:a,id:nr,sourceLayer:X},{hover:!0})),qn=nr,n(6,Rt=Ie[0]??null)),Ce("mousemove",{event:gt,map:L,clusterId:qe,layer:S,source:a,features:Ie})}function On(gt){if(!(!Gt||!S||!L)){if(te&&(L.getCanvas().style.cursor=""),n(6,Rt=null),me&&qn!==void 0){const Ie={source:a,id:qn,sourceLayer:X};L==null||L.setFeatureState(Ie,{hover:!1}),qn=void 0}Ce("mouseleave",{map:L,layer:S,source:a})}}let mi=!0;function wn(gt){L&&(L.off("click",gt,ie),L.off("dblclick",gt,ie),L.off("contextmenu",gt,ie),L.off("mouseenter",gt,De),L.off("mousemove",gt,hn),L.off("mouseleave",gt,On))}return sa(()=>{L&&S&&wn(S)}),e.$$set=gt=>{"id"in gt&&n(7,Q=gt.id),"source"in gt&&n(8,B=gt.source),"sourceLayer"in gt&&n(9,X=gt.sourceLayer),"beforeId"in gt&&n(10,J=gt.beforeId),"beforeLayerType"in gt&&n(11,it=gt.beforeLayerType),"type"in gt&&n(12,ft=gt.type),"paint"in gt&&n(13,mt=gt.paint),"layout"in gt&&n(14,_t=gt.layout),"filter"in gt&&n(15,ct=gt.filter),"applyToClusters"in gt&&n(16,Mt=gt.applyToClusters),"minzoom"in gt&&n(17,xt=gt.minzoom),"maxzoom"in gt&&n(18,vt=gt.maxzoom),"manageHoverState"in gt&&n(19,me=gt.manageHoverState),"hovered"in gt&&n(6,Rt=gt.hovered),"interactive"in gt&&n(20,Gt=gt.interactive),"hoverCursor"in gt&&n(21,te=gt.hoverCursor),"eventsIfTopMost"in gt&&n(22,se=gt.eventsIfTopMost),"$$scope"in gt&&n(35,j=gt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,i=pE(Mt)),e.$$.dirty[0]&1073774592&&n(24,r=fE("all",i,ct)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=xt??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,f=vt??k),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,a=B||A),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&L&&S!==Q&&a){S&&(wn(S),Jn.delete(S));let gt=J;if(!J&&it){let Ie=L.getStyle().layers,qe=typeof it=="function"?it:Xn=>Xn.type===it,nr=Ie==null?void 0:Ie.find(qe);nr&&(gt=nr.id)}je($e,S=Q,S),L.addLayer(Xm({id:S,type:ft,source:a,"source-layer":X,filter:r,paint:mt,layout:_t,minzoom:l,maxzoom:f}),gt),n(23,mi=!0),L.on("click",S,ie),L.on("dblclick",S,ie),L.on("contextmenu",S,ie),L.on("mouseenter",S,De),L.on("mousemove",S,hn),L.on("mouseleave",S,On)}e.$$.dirty[0]&1048577&&S&&Jn.set(S,{interactive:Gt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,_=S?Vv((gt,Ie)=>L==null?void 0:L.setPaintProperty(S,gt,Ie)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,x=S?Vv((gt,Ie)=>L==null?void 0:L.setLayoutProperty(S,gt,Ie)):void 0),e.$$.dirty[0]&268443648&&(_==null||_(mt)),e.$$.dirty[0]&134234112&&(x==null||x(_t)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(L==null||L.setLayerZoomRange(S,l,f)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(mi?n(23,mi=!1):L==null||L.setFilter(S,r))},[S,yn,jn,$e,Fe,ke,Rt,Q,B,X,J,it,ft,mt,_t,ct,Mt,xt,vt,me,Gt,te,se,mi,r,f,l,x,_,a,i,L,A,k,R,j,U]}class mg extends nn{constructor(t){super(),en(this,t,gE,mE,Ye,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function _E(e){let t;const n=e[16].default,i=sr(n,e,e[24],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&16777216)&&lr(i,n,r,r[24],t?ar(n,r[24],l,null):ur(r[24]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function yE(e){let t,n,i;function r(f){e[17](f)}let l={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[_E]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new mg({props:l}),cr.push(()=>yc(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){Qt(t.$$.fragment)},m(f,a){Kt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.applyToClusters=f[9]),a&1024&&(_.minzoom=f[10]),a&2048&&(_.maxzoom=f[11]),a&4096&&(_.hoverCursor=f[12]),a&8192&&(_.manageHoverState=f[13]),a&16384&&(_.eventsIfTopMost=f[14]),a&32768&&(_.interactive=f[15]),a&16777216&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],_c(()=>n=!1)),t.$set(_)},i(f){i||(wt(t.$$.fragment,f),i=!0)},o(f){Pt(t.$$.fragment,f),i=!1},d(f){Jt(t,f)}}}function vE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=rf("circle")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:k=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:U=void 0}=t,{hoverCursor:j=void 0}=t,{manageHoverState:Q=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:X=!1}=t,{interactive:J=!0}=t;function it(vt){B=vt,n(0,B)}function ft(vt){ii.call(this,e,vt)}function mt(vt){ii.call(this,e,vt)}function _t(vt){ii.call(this,e,vt)}function ct(vt){ii.call(this,e,vt)}function Mt(vt){ii.call(this,e,vt)}function xt(vt){ii.call(this,e,vt)}return e.$$set=vt=>{"id"in vt&&n(1,l=vt.id),"source"in vt&&n(2,f=vt.source),"sourceLayer"in vt&&n(3,a=vt.sourceLayer),"beforeId"in vt&&n(4,_=vt.beforeId),"beforeLayerType"in vt&&n(5,x=vt.beforeLayerType),"paint"in vt&&n(6,S=vt.paint),"layout"in vt&&n(7,L=vt.layout),"filter"in vt&&n(8,A=vt.filter),"applyToClusters"in vt&&n(9,k=vt.applyToClusters),"minzoom"in vt&&n(10,R=vt.minzoom),"maxzoom"in vt&&n(11,U=vt.maxzoom),"hoverCursor"in vt&&n(12,j=vt.hoverCursor),"manageHoverState"in vt&&n(13,Q=vt.manageHoverState),"hovered"in vt&&n(0,B=vt.hovered),"eventsIfTopMost"in vt&&n(14,X=vt.eventsIfTopMost),"interactive"in vt&&n(15,J=vt.interactive),"$$scope"in vt&&n(24,r=vt.$$scope)},[B,l,f,a,_,x,S,L,A,k,R,U,j,Q,X,J,i,it,ft,mt,_t,ct,Mt,xt,r]}class cd extends nn{constructor(t){super(),en(this,t,vE,yE,Ye,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function bE(e){let t;const n=e[15].default,i=sr(n,e,e[23],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&8388608)&&lr(i,n,r,r[23],t?ar(n,r[23],l,null):ur(r[23]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function xE(e){let t,n,i;function r(f){e[16](f)}let l={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[bE]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new mg({props:l}),cr.push(()=>yc(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Qt(t.$$.fragment)},m(f,a){Kt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.minzoom=f[9]),a&1024&&(_.maxzoom=f[10]),a&2048&&(_.hoverCursor=f[11]),a&4096&&(_.manageHoverState=f[12]),a&8192&&(_.eventsIfTopMost=f[13]),a&16384&&(_.interactive=f[14]),a&8388608&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],_c(()=>n=!1)),t.$set(_)},i(f){i||(wt(t.$$.fragment,f),i=!0)},o(f){Pt(t.$$.fragment,f),i=!1},d(f){Jt(t,f)}}}function wE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=rf("fill")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:j=!1}=t,{hovered:Q=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:X=!0}=t;function J(xt){Q=xt,n(0,Q)}function it(xt){ii.call(this,e,xt)}function ft(xt){ii.call(this,e,xt)}function mt(xt){ii.call(this,e,xt)}function _t(xt){ii.call(this,e,xt)}function ct(xt){ii.call(this,e,xt)}function Mt(xt){ii.call(this,e,xt)}return e.$$set=xt=>{"id"in xt&&n(1,l=xt.id),"source"in xt&&n(2,f=xt.source),"sourceLayer"in xt&&n(3,a=xt.sourceLayer),"beforeId"in xt&&n(4,_=xt.beforeId),"beforeLayerType"in xt&&n(5,x=xt.beforeLayerType),"paint"in xt&&n(6,S=xt.paint),"layout"in xt&&n(7,L=xt.layout),"filter"in xt&&n(8,A=xt.filter),"minzoom"in xt&&n(9,k=xt.minzoom),"maxzoom"in xt&&n(10,R=xt.maxzoom),"hoverCursor"in xt&&n(11,U=xt.hoverCursor),"manageHoverState"in xt&&n(12,j=xt.manageHoverState),"hovered"in xt&&n(0,Q=xt.hovered),"eventsIfTopMost"in xt&&n(13,B=xt.eventsIfTopMost),"interactive"in xt&&n(14,X=xt.interactive),"$$scope"in xt&&n(23,r=xt.$$scope)},[Q,l,f,a,_,x,S,L,A,k,R,U,j,B,X,i,J,it,ft,mt,_t,ct,Mt,r]}class sf extends nn{constructor(t){super(),en(this,t,wE,xE,Ye,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function SE(e,t,n){let i;const{map:r}=of();Ee(e,r,_=>n(4,i=_));let{position:l="top-left"}=t,{container:f=void 0}=t,a=null;return sa(()=>{i!=null&&i.loaded()&&a&&i.removeControl(a)}),e.$$set=_=>{"position"in _&&n(1,l=_.position),"container"in _&&n(2,f=_.container)},e.$$.update=()=>{if(e.$$.dirty&30&&i&&!a){let _;typeof f=="string"?_=document.querySelector(f)??void 0:_=f,n(3,a=new Ls.FullscreenControl({container:_})),i.addControl(a,l)}},[r,l,f,a,i]}class EE extends nn{constructor(t){super(),en(this,t,SE,null,Ye,{position:1,container:2})}}function IE(e,t,n,i,r){let l=!1;e.getSource(t)&&(l=!0,e.removeSource(t));const f=()=>{i(t)&&(e.addSource(t,n),r())};if(l){const a=()=>{t&&(e.getSource(t)?setTimeout(a,1):f())};a()}else f()}function CE(e,t,n){DS().then(()=>{let i=Bb(e);if(!i)return;i.getSource(t)===n&&i.removeSource(t)})}function jv(e){let t=e[0],n,i,r=qv(e);return{c(){r.c(),n=$o()},m(l,f){r.m(l,f),At(l,n,f),i=!0},p(l,f){f&1&&Ye(t,t=l[0])?(Ti(),Pt(r,1,1,we),Li(),r=qv(l),r.c(),wt(r,1),r.m(n.parentNode,n)):r.p(l,f)},i(l){i||(wt(r),i=!0)},o(l){Pt(r),i=!1},d(l){l&&kt(n),r.d(l)}}}function qv(e){let t;const n=e[15].default,i=sr(n,e,e[14],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&16384)&&lr(i,n,r,r[14],t?ar(n,r[14],l,null):ur(r[14]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function TE(e){let t,n,i=e[0]&&jv(e);return{c(){i&&i.c(),t=$o()},m(r,l){i&&i.m(r,l),At(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&wt(i,1)):(i=jv(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function LE(e,t,n){let i,r,l,{$$slots:f={},$$scope:a}=t,{id:_=rf("geojson")}=t,{data:x}=t,{generateId:S=!1}=t,{promoteId:L=void 0}=t,{filter:A=void 0}=t,{lineMetrics:k=void 0}=t,{cluster:R=void 0}=t;const{map:U,cluster:j,self:Q}=lE();Ee(e,U,J=>n(13,r=J)),Ee(e,j,J=>n(16,l=J)),Ee(e,Q,J=>n(0,i=J));let B,X=!0;return sa(()=>{i&&B&&r&&(CE(U,i,B),je(Q,i=null,i),n(11,B=void 0))}),e.$$set=J=>{"id"in J&&n(4,_=J.id),"data"in J&&n(5,x=J.data),"generateId"in J&&n(6,S=J.generateId),"promoteId"in J&&n(7,L=J.promoteId),"filter"in J&&n(8,A=J.filter),"lineMetrics"in J&&n(9,k=J.lineMetrics),"cluster"in J&&n(10,R=J.cluster),"$$scope"in J&&n(14,a=J.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&je(j,l=R,l),e.$$.dirty&12273&&r&&i!==_&&(je(Q,i=_,i),IE(r,i,Xm({type:"geojson",data:x,filter:A,lineMetrics:k,generateId:S,promoteId:L,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties}),J=>r&&J===i,()=>{i&&(n(11,B=r==null?void 0:r.getSource(i)),n(12,X=!0))})),e.$$.dirty&8208&&(r==null||r.on("style.load",()=>{n(11,B=r==null?void 0:r.getSource(_))})),e.$$.dirty&6176&&B&&(X?n(12,X=!1):B.setData(x)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Xm({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[i,U,j,Q,_,x,S,L,A,k,R,B,X,r,a,f]}class Ms extends nn{constructor(t){super(),en(this,t,LE,TE,Ye,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function ME(e,t,n){let i;const{map:r}=of();Ee(e,r,A=>n(8,i=A));let{position:l="top-left"}=t,{positionOptions:f=void 0}=t,{fitBoundsOptions:a=void 0}=t,{trackUserLocation:_=!1}=t,{showAccuracyCircle:x=!0}=t,{showUserLocation:S=!0}=t,L=null;return sa(()=>{i!=null&&i.loaded()&&L&&i.removeControl(L)}),e.$$set=A=>{"position"in A&&n(1,l=A.position),"positionOptions"in A&&n(2,f=A.positionOptions),"fitBoundsOptions"in A&&n(3,a=A.fitBoundsOptions),"trackUserLocation"in A&&n(4,_=A.trackUserLocation),"showAccuracyCircle"in A&&n(5,x=A.showAccuracyCircle),"showUserLocation"in A&&n(6,S=A.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&i&&!L&&(n(7,L=new Ls.GeolocateControl({positionOptions:f,fitBoundsOptions:a,trackUserLocation:_,showAccuracyCircle:x,showUserLocation:S})),i.addControl(L,l))},[r,l,f,a,_,x,S,L,i]}class PE extends nn{constructor(t){super(),en(this,t,ME,null,Ye,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function kE(e){let t;const n=e[15].default,i=sr(n,e,e[23],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&8388608)&&lr(i,n,r,r[23],t?ar(n,r[23],l,null):ur(r[23]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function AE(e){let t,n,i;function r(f){e[16](f)}let l={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[kE]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new mg({props:l}),cr.push(()=>yc(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Qt(t.$$.fragment)},m(f,a){Kt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.minzoom=f[9]),a&1024&&(_.maxzoom=f[10]),a&2048&&(_.hoverCursor=f[11]),a&4096&&(_.manageHoverState=f[12]),a&8192&&(_.eventsIfTopMost=f[13]),a&16384&&(_.interactive=f[14]),a&8388608&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],_c(()=>n=!1)),t.$set(_)},i(f){i||(wt(t.$$.fragment,f),i=!0)},o(f){Pt(t.$$.fragment,f),i=!1},d(f){Jt(t,f)}}}function NE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=rf("line")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:k=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:j=!1}=t,{hovered:Q=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:X=!0}=t;function J(xt){Q=xt,n(0,Q)}function it(xt){ii.call(this,e,xt)}function ft(xt){ii.call(this,e,xt)}function mt(xt){ii.call(this,e,xt)}function _t(xt){ii.call(this,e,xt)}function ct(xt){ii.call(this,e,xt)}function Mt(xt){ii.call(this,e,xt)}return e.$$set=xt=>{"id"in xt&&n(1,l=xt.id),"source"in xt&&n(2,f=xt.source),"sourceLayer"in xt&&n(3,a=xt.sourceLayer),"beforeId"in xt&&n(4,_=xt.beforeId),"beforeLayerType"in xt&&n(5,x=xt.beforeLayerType),"paint"in xt&&n(6,S=xt.paint),"layout"in xt&&n(7,L=xt.layout),"filter"in xt&&n(8,A=xt.filter),"minzoom"in xt&&n(9,k=xt.minzoom),"maxzoom"in xt&&n(10,R=xt.maxzoom),"hoverCursor"in xt&&n(11,U=xt.hoverCursor),"manageHoverState"in xt&&n(12,j=xt.manageHoverState),"hovered"in xt&&n(0,Q=xt.hovered),"eventsIfTopMost"in xt&&n(13,B=xt.eventsIfTopMost),"interactive"in xt&&n(14,X=xt.interactive),"$$scope"in xt&&n(23,r=xt.$$scope)},[Q,l,f,a,_,x,S,L,A,k,R,U,j,B,X,i,J,it,ft,mt,_t,ct,Mt,r]}class iu extends nn{constructor(t){super(),en(this,t,NE,AE,Ye,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function DE(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,i),l=Math.round(t.lat*r)/r,f=Math.round(t.lng*r)/r,a=`${n}/${l}/${f}`,_=e.getBearing(),x=e.getPitch();return(_||x)&&(a+=`/${Math.round(_*10)/10}`),x&&(a+=`/${Math.round(x)}`),`#${a}`}function RE(e){return e.replace("#","").split("/").map(parseFloat)}var Mm=My;function My(e,t){return e===t||e!==e&&t!==t?!0:typeof e!=typeof t||{}.toString.call(e)!={}.toString.call(t)||e!==Object(e)||!e?!1:Array.isArray(e)?Zv(e,t):{}.toString.call(e)=="[object Set]"?Zv(Array.from(e),Array.from(t)):{}.toString.call(e)=="[object Object]"?zE(e,t):OE(e,t)}function OE(e,t){return e.toString()===t.toString()}function Zv(e,t){var n=e.length;if(n!=t.length)return!1;for(var i=0;in(6,i=S));let{position:l="top-left"}=t,{showCompass:f=!0}=t,{showZoom:a=!0}=t,{visualizePitch:_=!1}=t,x=null;return sa(()=>{i!=null&&i.loaded()&&x&&i.removeControl(x)}),e.$$set=S=>{"position"in S&&n(1,l=S.position),"showCompass"in S&&n(2,f=S.showCompass),"showZoom"in S&&n(3,a=S.showZoom),"visualizePitch"in S&&n(4,_=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&i&&!x&&(n(5,x=new Ls.NavigationControl({showCompass:f,showZoom:a,visualizePitch:_})),i.addControl(x,l))},[r,l,f,a,_,x,i]}class BE extends nn{constructor(t){super(),en(this,t,FE,null,Ye,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function VE(e,t,n){let i;const{map:r}=of();Ee(e,r,x=>n(5,i=x));let{position:l="bottom-left"}=t,{maxWidth:f=void 0}=t,{unit:a="metric"}=t,_=null;return sa(()=>{i!=null&&i.loaded()&&_&&i.removeControl(_)}),e.$$set=x=>{"position"in x&&n(1,l=x.position),"maxWidth"in x&&n(2,f=x.maxWidth),"unit"in x&&n(3,a=x.unit)},e.$$.update=()=>{e.$$.dirty&62&&i&&!_&&(n(4,_=new Ls.ScaleControl({maxWidth:f,unit:a})),i.addControl(_,l))},[r,l,f,a,_,i]}class UE extends nn{constructor(t){super(),en(this,t,VE,null,Ye,{position:1,maxWidth:2,unit:3})}}const GE=e=>({map:e[0]&8,loadedImages:e[0]&16,allImagesLoaded:e[0]&32}),Wv=e=>({map:e[3],loadedImages:e[4],allImagesLoaded:e[5]});function Xv(e){let t,n,i=e[2]&&Hv(e);const r=e[34].default,l=sr(r,e,e[33],Wv);return{c(){i&&i.c(),t=Zt(),l&&l.c()},m(f,a){i&&i.m(f,a),At(f,t,a),l&&l.m(f,a),n=!0},p(f,a){f[2]?i?(i.p(f,a),a[0]&4&&wt(i,1)):(i=Hv(f),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li()),l&&l.p&&(!n||a[0]&56|a[1]&4)&&lr(l,r,f,f[33],n?ar(r,f[33],a,GE):ur(f[33]),Wv)},i(f){n||(wt(i),wt(l,f),n=!0)},o(f){Pt(i),Pt(l,f),n=!1},d(f){f&&kt(t),i&&i.d(f),l&&l.d(f)}}}function Hv(e){let t,n,i,r,l,f,a,_;return t=new BE({props:{position:e[6]}}),i=new PE({props:{position:e[6],fitBoundsOptions:{maxZoom:12}}}),l=new EE({props:{position:e[6]}}),a=new UE({props:{position:e[6]}}),{c(){Qt(t.$$.fragment),n=Zt(),Qt(i.$$.fragment),r=Zt(),Qt(l.$$.fragment),f=Zt(),Qt(a.$$.fragment)},m(x,S){Kt(t,x,S),At(x,n,S),Kt(i,x,S),At(x,r,S),Kt(l,x,S),At(x,f,S),Kt(a,x,S),_=!0},p(x,S){const L={};S[0]&64&&(L.position=x[6]),t.$set(L);const A={};S[0]&64&&(A.position=x[6]),i.$set(A);const k={};S[0]&64&&(k.position=x[6]),l.$set(k);const R={};S[0]&64&&(R.position=x[6]),a.$set(R)},i(x){_||(wt(t.$$.fragment,x),wt(i.$$.fragment,x),wt(l.$$.fragment,x),wt(a.$$.fragment,x),_=!0)},o(x){Pt(t.$$.fragment,x),Pt(i.$$.fragment,x),Pt(l.$$.fragment,x),Pt(a.$$.fragment,x),_=!1},d(x){x&&(kt(n),kt(r),kt(f)),Jt(t,x),Jt(i,x),Jt(l,x),Jt(a,x)}}}function jE(e){let t,n,i,r,l,f=e[3]&&e[0]&&Xv(e);return{c(){t=dt("div"),f&&f.c(),It(t,"class",n=qm(e[1])+" svelte-p00lfq"),cl(t,"expand-map",!e[1])},m(a,_){At(a,t,_),f&&f.m(t,null),i=!0,r||(l=Q_(e[9].call(null,t)),r=!0)},p(a,_){a[3]&&a[0]?f?(f.p(a,_),_[0]&9&&wt(f,1)):(f=Xv(a),f.c(),wt(f,1),f.m(t,null)):f&&(Ti(),Pt(f,1,1,()=>{f=null}),Li()),(!i||_[0]&2&&n!==(n=qm(a[1])+" svelte-p00lfq"))&&It(t,"class",n),(!i||_[0]&2)&&cl(t,"expand-map",!a[1])},i(a){i||(wt(f),i=!0)},o(a){Pt(f),i=!1},d(a){a&&kt(t),f&&f.d(),r=!1,l()}}}function qE(e,t,n){let i,r,l,f,{$$slots:a={},$$scope:_}=t,{map:x=null}=t,{class:S=void 0}=t,{style:L}=t,{diffStyleUpdates:A=!1}=t,{center:k=void 0}=t,{zoom:R=void 0}=t,{pitch:U=0}=t,{bearing:j=0}=t,{bounds:Q=void 0}=t,{hash:B=!1}=t,{loaded:X=!1}=t,{minZoom:J=0}=t,{maxZoom:it=22}=t,{zoomOnDoubleClick:ft=!0}=t,{interactive:mt=!0}=t,{attributionControl:_t=!0}=t,{cooperativeGestures:ct=!1}=t,{preserveDrawingBuffer:Mt=!1}=t,{maxBounds:xt=void 0}=t,{images:vt=[]}=t,{standardControls:me=!1}=t,{filterLayers:Rt=void 0}=t,{transformRequest:Gt=void 0}=t;const te=Nc(),{map:se,loadedImages:Ce}=aE();Ee(e,se,ie=>n(3,l=ie)),Ee(e,Ce,ie=>n(4,f=ie));let yn=new Set;function jn(ie){l!=null&&l.loaded()&&("url"in ie?(yn.add(ie.id),l.loadImage(ie.url,(De,hn)=>{yn.delete(ie.id),De?te("error",De):hn&&(l==null||l.addImage(ie.id,hn,ie.options),f.add(ie.id),Ce.set(f))})):(l.addImage(ie.id,ie.data,ie.options),f.add(ie.id),Ce.set(f)))}let $e,Fe,ke,fn;function Jn(ie){if(B){let De=RE(window.location.hash);De.length>=3&&(n(11,R=De[0]),n(10,k=[De[2],De[1]])),De.length==5&&(n(15,j=De[3]),n(14,U=De[4]))}return je(se,l=new Ls.Map(Xm({container:ie,style:L,center:k,zoom:R,pitch:U,bearing:j,minZoom:J,maxZoom:it,interactive:mt,preserveDrawingBuffer:Mt,maxBounds:xt,bounds:Q,attributionControl:_t,transformRequest:Gt,cooperativeGestures:ct})),l),l.on("load",De=>{n(0,X=!0),te("load",l)}),l.on("error",De=>te("error",{...De,map:l})),l.on("movestart",De=>te("movestart",{...De,map:l})),l.on("moveend",De=>{if(n(10,k=De.target.getCenter()),n(11,R=De.target.getZoom()),n(12,Q=De.target.getBounds()),te("moveend",{...De,map:l}),B){let hn=window.location.href.replace(/(#.+)?$/,DE(l));window.history.replaceState(window.history.state,"",hn)}}),l.on("zoomstart",De=>te("zoomstart",{...De,map:l})),l.on("zoom",De=>{n(11,R=De.target.getZoom()),te("zoom",{...De,map:l})}),l.on("zoomend",De=>{n(11,R=De.target.getZoom()),te("zoomend",{...De,map:l})}),l.on("style.load",()=>{if(l){const De=l.getStyle();if(n(30,$e=De.layers.map(hn=>hn.id)),n(31,Fe=Object.keys(De.sources)),fn)for(const[hn,On]of Object.entries(fn))l.addSource(hn,On);if(ke)for(const hn of ke)l.addLayer(hn)}}),l.on("styledata",De=>{if(l&&Rt){const hn=l.getStyle().layers;if(hn)for(let On of hn)Rt(On)||l.setLayoutProperty(On.id,"visibility","none")}te("styledata",{...De,map:l})}),{destroy(){n(0,X=!1),l==null||l.remove(),je(se,l=null,l)}}}let qn=L;return e.$$set=ie=>{"map"in ie&&n(13,x=ie.map),"class"in ie&&n(1,S=ie.class),"style"in ie&&n(16,L=ie.style),"diffStyleUpdates"in ie&&n(17,A=ie.diffStyleUpdates),"center"in ie&&n(10,k=ie.center),"zoom"in ie&&n(11,R=ie.zoom),"pitch"in ie&&n(14,U=ie.pitch),"bearing"in ie&&n(15,j=ie.bearing),"bounds"in ie&&n(12,Q=ie.bounds),"hash"in ie&&n(18,B=ie.hash),"loaded"in ie&&n(0,X=ie.loaded),"minZoom"in ie&&n(19,J=ie.minZoom),"maxZoom"in ie&&n(20,it=ie.maxZoom),"zoomOnDoubleClick"in ie&&n(21,ft=ie.zoomOnDoubleClick),"interactive"in ie&&n(22,mt=ie.interactive),"attributionControl"in ie&&n(23,_t=ie.attributionControl),"cooperativeGestures"in ie&&n(24,ct=ie.cooperativeGestures),"preserveDrawingBuffer"in ie&&n(25,Mt=ie.preserveDrawingBuffer),"maxBounds"in ie&&n(26,xt=ie.maxBounds),"images"in ie&&n(27,vt=ie.images),"standardControls"in ie&&n(2,me=ie.standardControls),"filterLayers"in ie&&n(28,Rt=ie.filterLayers),"transformRequest"in ie&&n(29,Gt=ie.transformRequest),"$$scope"in ie&&n(33,_=ie.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&4&&n(6,i=typeof me=="boolean"?void 0:me),e.$$.dirty[0]&8&&n(13,x=l),e.$$.dirty[0]&134217737&&X&&l!=null&&l.loaded())for(let ie of vt)!yn.has(ie.id)&&!l.hasImage(ie.id)&&jn(ie);if(e.$$.dirty[0]&134217744&&n(5,r=vt.every(ie=>f.has(ie.id))),e.$$.dirty[0]&1073938440|e.$$.dirty[1]&3&&l&&!Mm(L,qn)){const ie=l.getStyle();if($e&&(ke=ie.layers.filter(De=>!$e.includes(De.id))),Fe){const De=Object.keys(ie.sources).filter(hn=>!Fe.includes(hn));fn={};for(const hn of De)fn[hn]=ie.sources[hn]}n(32,qn=L),l.setStyle(L,{diff:A})}e.$$.dirty[0]&1032&&k&&!Mm(k,l==null?void 0:l.getCenter())&&(l==null||l.panTo(k)),e.$$.dirty[0]&2056&&R&&!Mm(R,l==null?void 0:l.getZoom())&&(l==null||l.zoomTo(R)),e.$$.dirty[0]&4104&&Q&&!Mm(Q,l==null?void 0:l.getBounds())&&(l==null||l.fitBounds(Q)),e.$$.dirty[0]&2097160&&(ft?l==null||l.doubleClickZoom.enable():l==null||l.doubleClickZoom.disable())},[X,S,me,l,f,r,i,se,Ce,Jn,k,R,Q,x,U,j,L,A,B,J,it,ft,mt,_t,ct,Mt,xt,vt,Rt,Gt,$e,Fe,qn,_,a]}class ZE extends nn{constructor(t){super(),en(this,t,qE,jE,Ye,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,interactive:22,attributionControl:23,cooperativeGestures:24,preserveDrawingBuffer:25,maxBounds:26,images:27,standardControls:2,filterLayers:28,transformRequest:29},null,[-1,-1])}}function WE(e){let t,n,i,r,l,f,a;const _=e[17].default,x=sr(_,e,e[16],null);return{c(){t=dt("div"),x&&x.c(),It(t,"tabindex",n=e[1]?0:void 0),It(t,"role",i=e[1]?"button":void 0),pi(t,"z-index",e[2])},m(S,L){At(S,t,L),x&&x.m(t,null),l=!0,f||(a=[Q_(e[6].call(null,t)),Q_(r=XE.call(null,t,e[0])),be(t,"click",e[18]),be(t,"dblclick",e[19]),be(t,"contextmenu",e[20]),be(t,"mouseenter",e[21]),be(t,"mouseleave",e[22]),be(t,"mousemove",e[23]),be(t,"keydown",e[7])],f=!0)},p(S,[L]){x&&x.p&&(!l||L&65536)&&lr(x,_,S,S[16],l?ar(_,S[16],L,null):ur(S[16]),null),(!l||L&2&&n!==(n=S[1]?0:void 0))&&It(t,"tabindex",n),(!l||L&2&&i!==(i=S[1]?"button":void 0))&&It(t,"role",i),r&&fg(r.update)&&L&1&&r.update.call(null,S[0]),L&4&&pi(t,"z-index",S[2])},i(S){l||(wt(x,S),l=!0)},o(S){Pt(x,S),l=!1},d(S){S&&kt(t),x&&x.d(S),f=!1,Wi(a)}}}function XE(e,t){const n=e.className;function i(r){r?e.className=`${n} ${r}`:e.className=n}return i(t),{update:i}}function HE(e,t,n){let i,r,l,{$$slots:f={},$$scope:a}=t,{lngLat:_}=t,{class:x=void 0}=t,{interactive:S=!0}=t,{asButton:L=!1}=t,{draggable:A=!1}=t,{feature:k=null}=t,{offset:R=void 0}=t,{zIndex:U=void 0}=t,{rotation:j=0}=t;const Q=Nc(),{map:B,layerEvent:X,self:J}=cE();Ee(e,B,Gt=>n(25,l=Gt)),Ee(e,X,Gt=>n(24,i=Gt)),Ee(e,J,Gt=>n(15,r=Gt));function it(Gt){je(J,r=new Ls.Marker({element:Gt,rotation:j,draggable:A,offset:R}).setLngLat(_).addTo(l),r);const te=()=>_t("dragstart"),se=()=>{ft(),_t("drag")},Ce=()=>{ft(),_t("dragend")};return A&&(r.on("dragstart",te),r.on("drag",se),r.on("dragend",Ce)),{destroy(){A&&(r==null||r.off("dragstart",te),r==null||r.off("drag",se),r==null||r.off("dragend",Ce)),r==null||r.remove()}}}function ft(){let Gt=r==null?void 0:r.getLngLat();Gt&&(Array.isArray(_)?n(9,_=[Gt.lng,Gt.lat]):_&&"lon"in _?n(9,_={lon:Gt.lng,lat:Gt.lat}):n(9,_=Gt))}function mt(Gt){Gt.key===" "&&(Gt.preventDefault(),Gt.stopPropagation(),_t("click"))}function _t(Gt){if(!S)return;let te=r==null?void 0:r.getLngLat();if(!te)return;const se=[te.lng,te.lat];let Ce={map:l,marker:r,lngLat:se,features:[{type:"Feature",properties:(k==null?void 0:k.properties)??{},geometry:{type:"Point",coordinates:se}}]};je(X,i={...Ce,layerType:"marker",type:Gt},i),Q(Gt,Ce)}const ct=()=>_t("click"),Mt=()=>_t("dblclick"),xt=()=>_t("contextmenu"),vt=Gt=>{_t("mouseenter")},me=()=>{_t("mouseleave")},Rt=()=>_t("mousemove");return e.$$set=Gt=>{"lngLat"in Gt&&n(9,_=Gt.lngLat),"class"in Gt&&n(0,x=Gt.class),"interactive"in Gt&&n(10,S=Gt.interactive),"asButton"in Gt&&n(1,L=Gt.asButton),"draggable"in Gt&&n(11,A=Gt.draggable),"feature"in Gt&&n(12,k=Gt.feature),"offset"in Gt&&n(13,R=Gt.offset),"zIndex"in Gt&&n(2,U=Gt.zIndex),"rotation"in Gt&&n(14,j=Gt.rotation),"$$scope"in Gt&&n(16,a=Gt.$$scope)},e.$$.update=()=>{e.$$.dirty&33280&&(r==null||r.setLngLat(_)),e.$$.dirty&40960&&(r==null||r.setOffset(R??[0,0])),e.$$.dirty&49152&&(r==null||r.setRotation(j))},[x,L,U,B,X,J,it,mt,_t,_,S,A,k,R,j,r,a,f,ct,Mt,xt,vt,me,Rt]}class Yv extends nn{constructor(t){super(),en(this,t,HE,WE,Ye,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14})}}const YE=e=>({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),Kv=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function Jv(e){let t,n,i=(e[4]||e[3]instanceof Ls.Marker)&&Qv(e);return{c(){t=dt("div"),i&&i.c()},m(r,l){At(r,t,l),i&&i.m(t,null),e[32](t),n=!0},p(r,l){r[4]||r[3]instanceof Ls.Marker?i?(i.p(r,l),l[0]&24&&wt(i,1)):(i=Qv(r),i.c(),wt(i,1),i.m(t,null)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(),e[32](null)}}}function Qv(e){let t;const n=e[30].default,i=sr(n,e,e[29],Kv);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l[0]&536870933)&&lr(i,n,r,r[29],t?ar(n,r[29],l,YE):ur(r[29]),Kv)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function KE(e){let t,n,i=e[9].default&&Jv(e);return{c(){i&&i.c(),t=$o()},m(r,l){i&&i.m(r,l),At(r,t,l),n=!0},p(r,l){r[9].default?i?(i.p(r,l),l[0]&512&&wt(i,1)):(i=Jv(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function JE(e,t,n){let i,r,l,f,a,_,{$$slots:x={},$$scope:S}=t;const L=LS(x);let{closeButton:A=void 0}=t,{closeOnClickOutside:k=!0}=t,{closeOnClickInside:R=!1}=t,{closeOnMove:U=!1}=t,{openOn:j="click"}=t,{openIfTopMost:Q=!0}=t,{focusAfterOpen:B=!0}=t,{anchor:X=void 0}=t,{offset:J=void 0}=t,{popupClass:it=void 0}=t,{maxWidth:ft=void 0}=t,{lngLat:mt=void 0}=t,{html:_t=void 0}=t,{open:ct=!1}=t;const{map:Mt,popupTarget:xt,layerEvent:vt,layer:me,eventTopMost:Rt}=of();Ee(e,Mt,gt=>n(2,l=gt)),Ee(e,xt,gt=>n(3,a=gt)),Ee(e,vt,gt=>n(28,f=gt)),Ee(e,me,gt=>n(35,_=gt));const Gt=["click","dblclick","contextmenu"];let te,se=!1,Ce;function yn(){if(!te)return;let gt=te.getElement();!gt||gt===Ce||(Ce=gt,j==="hover"&&(Ce.style.pointerEvents="none"),Ce.addEventListener("mouseenter",()=>{n(24,se=!0)},{passive:!0}),Ce.addEventListener("mouseleave",()=>{n(24,se=!1)},{passive:!0}),Ce.addEventListener("click",()=>{R&&n(0,ct=!1)},{passive:!0}))}pg(()=>{if(l)return l.on("click",hn),l.on("contextmenu",hn),typeof a=="string"&&(l.on("click",a,ke),l.on("dblclick",a,ke),l.on("contextmenu",a,ke),l.on("mousemove",a,De),l.on("mouseleave",a,ie),l.on("touchstart",a,Jn),l.on("touchend",a,qn)),()=>{l!=null&&l.loaded()&&(te==null||te.remove(),l.off("click",hn),l.off("contextmenu",hn),a instanceof Ls.Marker?a.getPopup()===te&&a.setPopup(void 0):typeof a=="string"&&(l.off("click",a,ke),l.off("dblclick",a,ke),l.off("contextmenu",a,ke),l.off("mousemove",a,De),l.off("mouseleave",a,ie),l.off("touchstart",a,Jn),l.off("touchend",a,qn)))}});function jn(gt){return Q?!("marker"in gt)&&!hE(gt)&&Rt(gt)!==_:!1}let $e=null,Fe="normal";function ke(gt){gt.type===j&&(jn(gt)||("layerType"in gt?gt.layerType==="deckgl"?(n(10,mt=gt.coordinate),n(4,$e=gt.object?[gt.object]:null)):(n(10,mt=gt.lngLat),n(4,$e=gt.features??[])):(n(10,mt=gt.lngLat),n(4,$e=gt.features??[])),setTimeout(()=>n(0,ct=!0))))}let fn=null;function Jn(gt){fn=gt.point}function qn(gt){if(!fn||j!=="hover")return;let Ie=fn.dist(gt.point);fn=null,Ie<3&&(n(10,mt=gt.lngLat),n(4,$e=gt.features??[]),te.isOpen()?n(25,Fe="justOpened"):(n(25,Fe="opening"),n(0,ct=!0)))}function ie(gt){j!=="hover"||fn||Fe!=="normal"||(n(0,ct=!1),n(4,$e=null))}function De(gt){if(!(j!=="hover"||fn||Fe!=="normal")){if(jn(gt)){n(0,ct=!1),n(4,$e=null);return}n(0,ct=!0),n(4,$e=gt.features??[]),n(10,mt=gt.lngLat)}}function hn(gt){if(Fe==="justOpened"){n(25,Fe="normal");return}if(!k)return;let Ie=[Ce,a instanceof Ls.Marker?a==null?void 0:a.getElement():null];ct&&te.isOpen()&&!Ie.some(qe=>qe==null?void 0:qe.contains(gt.originalEvent.target))&&(gt.type==="contextmenu"&&j==="contextmenu"||gt.type!=="contextmenu")&&n(0,ct=!1)}sa(()=>{l&&(te!=null&&te.isOpen())&&te.remove()});let On;const mi=()=>n(0,ct=!1);function wn(gt){cr[gt?"unshift":"push"](()=>{On=gt,n(1,On)})}return e.$$set=gt=>{"closeButton"in gt&&n(11,A=gt.closeButton),"closeOnClickOutside"in gt&&n(12,k=gt.closeOnClickOutside),"closeOnClickInside"in gt&&n(13,R=gt.closeOnClickInside),"closeOnMove"in gt&&n(14,U=gt.closeOnMove),"openOn"in gt&&n(15,j=gt.openOn),"openIfTopMost"in gt&&n(16,Q=gt.openIfTopMost),"focusAfterOpen"in gt&&n(17,B=gt.focusAfterOpen),"anchor"in gt&&n(18,X=gt.anchor),"offset"in gt&&n(19,J=gt.offset),"popupClass"in gt&&n(20,it=gt.popupClass),"maxWidth"in gt&&n(21,ft=gt.maxWidth),"lngLat"in gt&&n(10,mt=gt.lngLat),"html"in gt&&n(22,_t=gt.html),"open"in gt&&n(0,ct=gt.open),"$$scope"in gt&&n(29,S=gt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,i=A??(!k&&!R)),e.$$.dirty[0]&146685952&&(te||(n(23,te=new Ls.Popup({closeButton:i,closeOnClick:!1,closeOnMove:U,focusAfterOpen:B,maxWidth:ft,className:it,anchor:X,offset:J})),Ce=te.getElement(),te.on("open",()=>{n(0,ct=!0),yn()}),te.on("close",gt=>{n(0,ct=!1)}))),e.$$.dirty[0]&8421384&&te&&a instanceof Ls.Marker&&(j==="click"?a.setPopup(te):a.getPopup()===te&&a.setPopup(void 0)),e.$$.dirty[0]&268468224&&Gt.includes(j)&&(f==null?void 0:f.type)===j&&(ke(f),je(vt,f=null,f)),e.$$.dirty[0]&268468224&&n(26,r=j==="hover"&&((f==null?void 0:f.type)==="mousemove"||(f==null?void 0:f.type)==="mouseenter")),e.$$.dirty[0]&352354304&&j==="hover"&&vt&&(r&&f&&(f.layerType==="deckgl"?(n(10,mt=f.coordinate),n(4,$e=f.object?[f.object]:null)):(n(10,mt=f.lngLat),n(4,$e=f.features??[]))),n(0,ct=(r||se)??!1)),e.$$.dirty[0]&12582914&&(On?te.setDOMContent(On):_t&&te.setHTML(_t)),e.$$.dirty[0]&8389632&&mt&&te.setLngLat(mt),e.$$.dirty[0]&41943045&&l){let gt=te.isOpen();ct&&!gt?(te.addTo(l),Fe==="opening"&&n(25,Fe="justOpened")):!ct&>&&te.remove()}},[ct,On,l,a,$e,Mt,xt,vt,me,L,mt,A,k,R,U,j,Q,B,X,J,it,ft,_t,te,se,Fe,r,i,f,S,x,mi,wn]}class QE extends nn{constructor(t){super(),en(this,t,JE,KE,Ye,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}function $E(e){let t;const n=e[16].default,i=sr(n,e,e[24],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&16777216)&&lr(i,n,r,r[24],t?ar(n,r[24],l,null):ur(r[24]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function tI(e){let t,n,i;function r(f){e[17](f)}let l={id:e[1],type:"symbol",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[$E]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new mg({props:l}),cr.push(()=>yc(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){Qt(t.$$.fragment)},m(f,a){Kt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.applyToClusters=f[9]),a&1024&&(_.minzoom=f[10]),a&2048&&(_.maxzoom=f[11]),a&4096&&(_.hoverCursor=f[12]),a&8192&&(_.manageHoverState=f[13]),a&16384&&(_.eventsIfTopMost=f[14]),a&32768&&(_.interactive=f[15]),a&16777216&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],_c(()=>n=!1)),t.$set(_)},i(f){i||(wt(t.$$.fragment,f),i=!0)},o(f){Pt(t.$$.fragment,f),i=!1},d(f){Jt(t,f)}}}function eI(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=rf("symbol")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S=void 0}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:k=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:U=void 0}=t,{hoverCursor:j=void 0}=t,{manageHoverState:Q=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:X=!1}=t,{interactive:J=!0}=t;function it(vt){B=vt,n(0,B)}function ft(vt){ii.call(this,e,vt)}function mt(vt){ii.call(this,e,vt)}function _t(vt){ii.call(this,e,vt)}function ct(vt){ii.call(this,e,vt)}function Mt(vt){ii.call(this,e,vt)}function xt(vt){ii.call(this,e,vt)}return e.$$set=vt=>{"id"in vt&&n(1,l=vt.id),"source"in vt&&n(2,f=vt.source),"sourceLayer"in vt&&n(3,a=vt.sourceLayer),"beforeId"in vt&&n(4,_=vt.beforeId),"beforeLayerType"in vt&&n(5,x=vt.beforeLayerType),"paint"in vt&&n(6,S=vt.paint),"layout"in vt&&n(7,L=vt.layout),"filter"in vt&&n(8,A=vt.filter),"applyToClusters"in vt&&n(9,k=vt.applyToClusters),"minzoom"in vt&&n(10,R=vt.minzoom),"maxzoom"in vt&&n(11,U=vt.maxzoom),"hoverCursor"in vt&&n(12,j=vt.hoverCursor),"manageHoverState"in vt&&n(13,Q=vt.manageHoverState),"hovered"in vt&&n(0,B=vt.hovered),"eventsIfTopMost"in vt&&n(14,X=vt.eventsIfTopMost),"interactive"in vt&&n(15,J=vt.interactive),"$$scope"in vt&&n(24,r=vt.$$scope)},[B,l,f,a,_,x,S,L,A,k,R,U,j,Q,X,J,i,it,ft,mt,_t,ct,Mt,xt,r]}class nI extends nn{constructor(t){super(),en(this,t,eI,tI,Ye,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}var hd=Uint8Array,ix=Uint16Array,iI=Int32Array,rI=new hd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),oI=new hd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rx=function(e,t){for(var n=new ix(31),i=0;i<31;++i)n[i]=t+=1<>1|(ni&21845)<<1,Fl=(Fl&52428)>>2|(Fl&13107)<<2,Fl=(Fl&61680)>>4|(Fl&3855)<<4,lI[ni]=((Fl&65280)>>8|(Fl&255)<<8)>>1;var Fl,ni,gg=new hd(288);for(ni=0;ni<144;++ni)gg[ni]=8;var ni;for(ni=144;ni<256;++ni)gg[ni]=9;var ni;for(ni=256;ni<280;++ni)gg[ni]=7;var ni;for(ni=280;ni<288;++ni)gg[ni]=8;var ni,uI=new hd(32);for(ni=0;ni<32;++ni)uI[ni]=5;var ni,cI=new hd(0),hI=typeof TextDecoder<"u"&&new TextDecoder,fI=0;try{hI.decode(cI,{stream:!0}),fI=1}catch{}const sx=li({type:"FeatureCollection",features:[]}),pI=li(!0),ax=li(0),dI=30;class mI{constructor(t,n){Zn(this,"map");Zn(this,"inner");Zn(this,"active");Zn(this,"eventListenersSuccess");Zn(this,"eventListenersUpdated");Zn(this,"eventListenersFailure");Zn(this,"onMouseMove",t=>{if(!this.active)return;const n=[t.point.x-dI,t.point.y],i=this.map.unproject(t.point).distanceTo(this.map.unproject(n));this.inner.onMouseMove(t.lngLat.lng,t.lngLat.lat,i)&&(this.redraw(),this.dataUpdated())});Zn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});Zn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.inner.onClick(),this.finish())});Zn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});Zn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});Zn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});Zn(this,"onKeyPress",t=>{this.active&&t.target.tagName!="INPUT"&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="s"?(t.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):t.key=="z"&&t.ctrlKey&&this.undo())});this.map=t,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new Wm(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),t.properties.waypoints||(t.properties.waypoints=[{lon:t.geometry.coordinates[0][0],lat:t.geometry.coordinates[0][1],snapped:!0},{lon:t.geometry.coordinates[t.geometry.coordinates.length-1][0],lat:t.geometry.coordinates[t.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(t.properties.waypoints),this.redraw()}editExistingArea(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingArea called when tool is already active"),t.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(t.properties.waypoints),this.redraw()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersSuccess)n(JSON.parse(t));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(t){this.inner.setRouteConfig(t),this.redraw()}addSnappedWaypoint(t){this.inner.addSnappedWaypoint(t[0],t[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}redraw(){let t=JSON.parse(this.inner.renderGeojson());sx.set(t),this.map.getCanvas().style.cursor=t.cursor,pI.set(t.snap_mode),ax.set(t.undo_length)}dataUpdated(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersUpdated)n(JSON.parse(t))}}const Py="MZEJTanw3WpxRvt7qDfo";let Nu=li(null),lx=li(`https://api.maptiler.com/maps/dataviz/style.json?key=${Py}`),Mu=li(""),Hm=li(!0),ry=li(null),oy=li(null),sy=li(null),Wo=li(null),jp=li(null),Ym=li(new dg.LngLat(0,0)),Km=li(new dg.LngLat(0,0)),mc=li(1),xn=li({mode:"title"}),ay=li("walk_cycle_only");function gI(e){let t,n,i,r,l,f,a,_,x;return{c(){t=dt("label"),n=Xe(`Basemap: - `),i=dt("select"),r=dt("option"),r.textContent="MapTiler Dataviz",l=dt("option"),l.textContent="MapTiler Streets",f=dt("option"),f.textContent="MapTiler Satellite",a=dt("option"),a.textContent="OS Open Zoomstack",r.__value="dataviz",jl(r,r.__value),l.__value="streets",jl(l,l.__value),f.__value="hybrid",jl(f,f.__value),a.__value="uk-openzoomstack-light",jl(a,a.__value),e[0]===void 0&&Gp(()=>e[1].call(i))},m(S,L){At(S,t,L),lt(t,n),lt(t,i),lt(i,r),lt(i,l),lt(i,f),lt(i,a),Zm(i,e[0],!0),_||(x=be(i,"change",e[1]),_=!0)},p(S,[L]){L&1&&Zm(i,S[0])},i:we,o:we,d(S){S&&kt(t),_=!1,x()}}}function _I(e,t,n){let i="dataviz";function r(){i=Ub(this),n(0,i)}return e.$$.update=()=>{e.$$.dirty&1&&lx.set(`https://api.maptiler.com/maps/${i}/style.json?key=${Py}`)},[i,r]}class yI extends nn{constructor(t){super(),en(this,t,_I,gI,Ye,{})}}var vI=Object.defineProperty,bI=(e,t,n)=>t in e?vI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$v=(e,t,n)=>(bI(e,typeof t!="symbol"?t+"":t,n),n);function qp(){}function ux(e){return e()}function t1(){return Object.create(null)}function _g(e){e.forEach(ux)}function cx(e){return typeof e=="function"}function xI(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function wI(e){return Object.keys(e).length===0}function SI(e,t){e.appendChild(t)}function EI(e,t,n){e.insertBefore(t,n||null)}function hx(e){e.parentNode&&e.parentNode.removeChild(e)}function e1(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Eu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function II(e){return Array.from(e.childNodes)}function Pm(e,t,n){e.classList.toggle(t,!!n)}let ky;function Bp(e){ky=e}const Ph=[],n1=[];let Dh=[];const i1=[],CI=Promise.resolve();let ly=!1;function TI(){ly||(ly=!0,CI.then(fx))}function uy(e){Dh.push(e)}const W_=new Set;let Ch=0;function fx(){if(Ch!==0)return;const e=ky;do{try{for(;Che.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Dh=t}const PI=new Set;function kI(e,t){e&&e.i&&(PI.delete(e),e.i(t))}function AI(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),uy(()=>{const l=e.$$.on_mount.map(ux).filter(cx);e.$$.on_destroy?e.$$.on_destroy.push(...l):_g(l),e.$$.on_mount=[]}),r.forEach(uy)}function NI(e,t){const n=e.$$;n.fragment!==null&&(MI(n.after_update),_g(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function DI(e,t){e.$$.dirty[0]===-1&&(Ph.push(e),TI(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=k.length?k[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=R)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](R),S&&DI(e,L)),A}):[],x.update(),S=!0,_g(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=II(t.target);x.fragment&&x.fragment.l(L),L.forEach(hx)}else x.fragment&&x.fragment.c();t.intro&&kI(e.$$.fragment),AI(e,t.target,t.anchor),fx()}Bp(_)}class OI{constructor(){$v(this,"$$"),$v(this,"$$set")}$destroy(){NI(this,1),this.$destroy=qp}$on(t,n){if(!cx(n))return qp;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!wI(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const zI="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(zI);function FI(e){let t,n,i;return{c(){t=e1("svg"),n=e1("path"),Eu(n,"stroke-width","4"),Eu(n,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),Eu(n,"class","svelte-gzo3ar"),Eu(t,"width",i=e[0]==="list"?20:void 0),Eu(t,"viewBox","0 0 70 85"),Eu(t,"fill","none"),Eu(t,"class","svelte-gzo3ar"),Pm(t,"in-map",e[0]!=="list"),Pm(t,"list-icon",e[0]==="list")},m(r,l){EI(r,t,l),SI(t,n)},p(r,[l]){l&1&&i!==(i=r[0]==="list"?20:void 0)&&Eu(t,"width",i),l&1&&Pm(t,"in-map",r[0]!=="list"),l&1&&Pm(t,"list-icon",r[0]==="list")},i:qp,o:qp,d(r){r&&hx(t)}}}function BI(e,t,n){let{displayIn:i}=t;return e.$$set=r=>{"displayIn"in r&&n(0,i=r.displayIn)},[i]}class VI extends OI{constructor(t){super(),RI(this,t,BI,FI,xI,{displayIn:0})}}const UI=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],GI={decimalLatitude:40.123,decimalLongitude:-74.123},jI=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],qI=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function ZI(){const e=[];return UI.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...GI})}),[...e,...jI,...qI]}const WI=ZI();WI.map(e=>e.verbatimCoordinates);/** + `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){x.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(y,s,h){this._canvas.width=Math.floor(h*y),this._canvas.height=Math.floor(h*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:y},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const h=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!h){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Tl(h,this.transform),S.testSupport(h)}_onCooperativeGesture(y,s,h){return!s&&h<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,b=a.h.now();this.style.zoomHistory.update(g,b);const I=new a.a8(g,{now:b,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=I.crossFadingFactor();C===1&&C===this._crossFadingFactor||(h=!0,this._crossFadingFactor=C),this.style.update(I)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new a.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.bg.mark(a.bh.load),this.fire(new a.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,a.bg.mark(a.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const h of this._controls)h.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),U.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),x.remove(this._canvasContainer),x.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),a.bg.clearMetrics(),this._removed=!0,this.fire(new a.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.h.frame(y=>{a.bg.frame(y),this._frame=null,this._render(y)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return Re}getCameraTargetElevation(){return this.transform.elevation}},Vn.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),h=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,h)=>{const d=this._map._getUIString(`NavigationControl.${h}`);s.title=d,s.setAttribute("aria-label",d)},this.options=a.e({},Hf,y),this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=x.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Yf(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){x.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,s){const h=x.create("button",y,this._container);return h.type="button",h.addEventListener("click",s),h}},Vn.GeolocateControl=class extends a.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new a.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const h=new a.L(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,g=this._map.getBearing(),b=a.e({bearing:g},this.options.fitBoundsOptions),I=ke.fromLngLat(h,d);this._map.fitBounds(I,b,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const h=new a.L(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&gu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=x.create("button","maplibregl-ctrl-geolocate",this._container),x.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=x.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ml({element:this._dotElement}),this._circleElement=x.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ml({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new a.k("trackuserlocationend")))})}},this.options=a.e({},Di,y)}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(s,h=!1){Xi===void 0||h?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Xi=d.state!=="denied",s(Xi)}).catch(()=>{Xi=!!window.navigator.geolocation,s(Xi)}):(Xi=!!window.navigator.geolocation,s(Xi)):s(Xi)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),x.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ti=0,gu=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),h=y.coords;return s&&(h.longitudes.getEast()||h.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const y=this._map.getBounds(),s=y.getSouthEast(),h=y.getNorthEast(),d=s.distanceTo(h),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ti--,gu=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new a.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ti++,Ti>1?(y={maximumAge:6e5,timeout:0},gu=!0):(y=this.options.positionOptions,gu=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Vn.AttributionControl=Fo,Vn.LogoControl=fi,Vn.ScaleControl=class{constructor(y){this._onMove=()=>{uc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,uc(this._map,this._container,this.options)},this.options=a.e({},lc,y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){x.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Vn.FullscreenControl=class extends a.E{constructor(y={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:a.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){x.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=x.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);x.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new a.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new a.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},Vn.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=y}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=x.create("button","maplibregl-ctrl-terrain",this._container),x.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){x.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Vn.Popup=class extends a.E{constructor(y){super(),this.remove=()=>(this._content&&x.remove(this._content),this._container&&(x.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.k("close")),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=x.create("div","maplibregl-popup",this._map.getContainer()),this._tip=x.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Kf(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!s)return;const h=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);let d=this.options.anchor;const g=_u(this.options.offset);if(!d){const I=this._container.offsetWidth,C=this._container.offsetHeight;let M;M=h.y+g.bottom.ythis._map.transform.height-C?["bottom"]:[],h.xthis._map.transform.width-I/2&&M.push("right"),d=M.length===0?"bottom":M.join("-")}const b=h.add(g[d]).round();x.setTransform(this._container,`${us[d]} translate(${b.x}px,${b.y}px)`),rm(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(Jf),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new a.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=a.L.convert(y),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const s=document.createDocumentFragment(),h=document.createElement("body");let d;for(h.innerHTML=y;d=h.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=x.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}_createCloseButton(){this.options.closeButton&&(this._closeButton=x.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Qf);y&&y.focus()}},Vn.Marker=Ml,Vn.Style=Dr,Vn.LngLat=a.L,Vn.LngLatBounds=ke,Vn.Point=a.P,Vn.MercatorCoordinate=a.U,Vn.Evented=a.E,Vn.AJAXError=a.bi,Vn.config=a.c,Vn.CanvasSource=wn,Vn.GeoJSONSource=De,Vn.ImageSource=On,Vn.RasterDEMTileSource=ie,Vn.RasterTileSource=qn,Vn.VectorTileSource=Kn,Vn.VideoSource=_i,Vn.setRTLTextPlugin=a.bj,Vn.getRTLTextPluginStatus=a.bk,Vn.prewarm=function(){Ha().acquire(In)},Vn.clearPrewarmedResources=function(){const y=ns;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(In),ns=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},tp.extend(Vn,{isSafari:a.ac,getPerformanceMetrics:a.bg.getPerformanceMetrics}),Vn});var f=r;return f})})(nx);var mg=nx.exports;const Ms=tx(mg);function Uv(e){let t;return n=>{if(n)for(let i in n){let r=t==null?void 0:t[i],l=n[i];r!==l&&e(i,l,r)}else if(t)for(let i in t)e(i,void 0,t[i]);t=n}}function pE(e,...t){let n=[e];for(let i of t)if(i)Array.isArray(i)&&i[0]===e?n.push(...i.slice(1)):n.push(i);else continue;if(n.length!==1)return n.length===2?n[1]:n}function dE(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function ry(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}var Xm=mE;function mE(e){var t,n,i;if(e){if(Array.isArray(e)){for(t=[],n=e.length,i=0;i{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function _E(e,t,n){let i,r,l,f,a,_,x,S,L,A,P,O,{$$slots:B={},$$scope:U}=t,{id:Y=of("layer")}=t,{source:V=void 0}=t,{sourceLayer:$=void 0}=t,{beforeId:K=void 0}=t,{beforeLayerType:nt=void 0}=t,{type:ht}=t,{paint:dt=void 0}=t,{layout:gt=void 0}=t,{filter:ut=void 0}=t,{applyToClusters:Et=void 0}=t,{minzoom:yt=void 0}=t,{maxzoom:xt=void 0}=t,{manageHoverState:fe=!1}=t,{hovered:Nt=null}=t,{interactive:Gt=!0}=t,{hoverCursor:Qt=void 0}=t,{eventsIfTopMost:oe=!1}=t;const Ce=Dc(),{map:yn,source:jn,self:Qe,minzoom:Fe,maxzoom:ke,eventTopMost:fn,layerInfo:Kn}=cE();Se(e,yn,_t=>n(31,L=_t)),Se(e,jn,_t=>n(32,A=_t)),Se(e,Qe,_t=>n(0,S=_t)),Se(e,Fe,_t=>n(34,O=_t)),Se(e,ke,_t=>n(33,P=_t)),aa(()=>{S&&L&&(Kn.delete(S),L==null||L.removeLayer(S))});let qn;function ie(_t){var Wn,pn;if(!Gt||!S||!L||oe&&fn(_t)!==S)return;let Ee=_t.features??[],qe=(pn=(Wn=Ee[0])==null?void 0:Wn.properties)==null?void 0:pn.cluster_id,nr={event:_t,map:L,clusterId:qe,layer:S,source:a,features:Ee};Ce(_t.type,nr)}function De(_t){var Wn,pn;if(!Gt||!S||!L||oe&&fn(_t)!==S)return;Qt&&(L.getCanvas().style.cursor=Qt);let Ee=_t.features??[];n(6,Nt=Ee[0]??null);let qe=(pn=(Wn=Ee[0])==null?void 0:Wn.properties)==null?void 0:pn.cluster_id;Ce("mouseenter",{event:_t,map:L,clusterId:qe,layer:S,source:a,features:Ee})}function hn(_t){var Wn,pn,Wi;if(!Gt||!L)return;if(oe&&fn(_t)!==S){n(6,Nt=null),fe&&qn!==void 0&&(L==null||L.setFeatureState({source:a,sourceLayer:$,id:qn},{hover:!1}),qn=void 0);return}L.getCanvas().style.cursor=Qt;let Ee=_t.features??[],qe=(pn=(Wn=Ee[0])==null?void 0:Wn.properties)==null?void 0:pn.cluster_id,nr=(Wi=Ee[0])==null?void 0:Wi.id;nr!==qn&&(fe&&(qn!==void 0&&(L==null||L.setFeatureState({source:a,id:qn,sourceLayer:$},{hover:!1})),L==null||L.setFeatureState({source:a,id:nr,sourceLayer:$},{hover:!0})),qn=nr,n(6,Nt=Ee[0]??null)),Ce("mousemove",{event:_t,map:L,clusterId:qe,layer:S,source:a,features:Ee})}function On(_t){if(!(!Gt||!S||!L)){if(Qt&&(L.getCanvas().style.cursor=""),n(6,Nt=null),fe&&qn!==void 0){const Ee={source:a,id:qn,sourceLayer:$};L==null||L.setFeatureState(Ee,{hover:!1}),qn=void 0}Ce("mouseleave",{map:L,layer:S,source:a})}}let _i=!0;function wn(_t){L&&(L.off("click",_t,ie),L.off("dblclick",_t,ie),L.off("contextmenu",_t,ie),L.off("mouseenter",_t,De),L.off("mousemove",_t,hn),L.off("mouseleave",_t,On))}return aa(()=>{L&&S&&wn(S)}),e.$$set=_t=>{"id"in _t&&n(7,Y=_t.id),"source"in _t&&n(8,V=_t.source),"sourceLayer"in _t&&n(9,$=_t.sourceLayer),"beforeId"in _t&&n(10,K=_t.beforeId),"beforeLayerType"in _t&&n(11,nt=_t.beforeLayerType),"type"in _t&&n(12,ht=_t.type),"paint"in _t&&n(13,dt=_t.paint),"layout"in _t&&n(14,gt=_t.layout),"filter"in _t&&n(15,ut=_t.filter),"applyToClusters"in _t&&n(16,Et=_t.applyToClusters),"minzoom"in _t&&n(17,yt=_t.minzoom),"maxzoom"in _t&&n(18,xt=_t.maxzoom),"manageHoverState"in _t&&n(19,fe=_t.manageHoverState),"hovered"in _t&&n(6,Nt=_t.hovered),"interactive"in _t&&n(20,Gt=_t.interactive),"hoverCursor"in _t&&n(21,Qt=_t.hoverCursor),"eventsIfTopMost"in _t&&n(22,oe=_t.eventsIfTopMost),"$$scope"in _t&&n(35,U=_t.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,i=dE(Et)),e.$$.dirty[0]&1073774592&&n(24,r=pE("all",i,ut)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=yt??O),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,f=xt??P),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,a=V||A),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&L&&S!==Y&&a){S&&(wn(S),Kn.delete(S));let _t=K;if(!K&&nt){let Ee=L.getStyle().layers,qe=typeof nt=="function"?nt:Wn=>Wn.type===nt,nr=Ee==null?void 0:Ee.find(qe);nr&&(_t=nr.id)}je(Qe,S=Y,S),L.addLayer(Xm({id:S,type:ht,source:a,"source-layer":$,filter:r,paint:dt,layout:gt,minzoom:l,maxzoom:f}),_t),n(23,_i=!0),L.on("click",S,ie),L.on("dblclick",S,ie),L.on("contextmenu",S,ie),L.on("mouseenter",S,De),L.on("mousemove",S,hn),L.on("mouseleave",S,On)}e.$$.dirty[0]&1048577&&S&&Kn.set(S,{interactive:Gt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,_=S?Uv((_t,Ee)=>L==null?void 0:L.setPaintProperty(S,_t,Ee)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,x=S?Uv((_t,Ee)=>L==null?void 0:L.setLayoutProperty(S,_t,Ee)):void 0),e.$$.dirty[0]&268443648&&(_==null||_(dt)),e.$$.dirty[0]&134234112&&(x==null||x(gt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(L==null||L.setLayerZoomRange(S,l,f)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(_i?n(23,_i=!1):L==null||L.setFilter(S,r))},[S,yn,jn,Qe,Fe,ke,Nt,Y,V,$,K,nt,ht,dt,gt,ut,Et,yt,xt,fe,Gt,Qt,oe,_i,r,f,l,x,_,a,i,L,A,P,O,U,B]}class gg extends nn{constructor(t){super(),en(this,t,_E,gE,He,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function yE(e){let t;const n=e[16].default,i=sr(n,e,e[24],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&16777216)&&lr(i,n,r,r[24],t?ar(n,r[24],l,null):ur(r[24]),null)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function vE(e){let t,n,i;function r(f){e[17](f)}let l={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[yE]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new gg({props:l}),cr.push(()=>vc(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){Zt(t.$$.fragment)},m(f,a){jt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.applyToClusters=f[9]),a&1024&&(_.minzoom=f[10]),a&2048&&(_.maxzoom=f[11]),a&4096&&(_.hoverCursor=f[12]),a&8192&&(_.manageHoverState=f[13]),a&16384&&(_.eventsIfTopMost=f[14]),a&32768&&(_.interactive=f[15]),a&16777216&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],yc(()=>n=!1)),t.$set(_)},i(f){i||(pt(t.$$.fragment,f),i=!0)},o(f){bt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function bE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=of("circle")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:P=void 0}=t,{minzoom:O=void 0}=t,{maxzoom:B=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:$=!1}=t,{interactive:K=!0}=t;function nt(xt){V=xt,n(0,V)}function ht(xt){ii.call(this,e,xt)}function dt(xt){ii.call(this,e,xt)}function gt(xt){ii.call(this,e,xt)}function ut(xt){ii.call(this,e,xt)}function Et(xt){ii.call(this,e,xt)}function yt(xt){ii.call(this,e,xt)}return e.$$set=xt=>{"id"in xt&&n(1,l=xt.id),"source"in xt&&n(2,f=xt.source),"sourceLayer"in xt&&n(3,a=xt.sourceLayer),"beforeId"in xt&&n(4,_=xt.beforeId),"beforeLayerType"in xt&&n(5,x=xt.beforeLayerType),"paint"in xt&&n(6,S=xt.paint),"layout"in xt&&n(7,L=xt.layout),"filter"in xt&&n(8,A=xt.filter),"applyToClusters"in xt&&n(9,P=xt.applyToClusters),"minzoom"in xt&&n(10,O=xt.minzoom),"maxzoom"in xt&&n(11,B=xt.maxzoom),"hoverCursor"in xt&&n(12,U=xt.hoverCursor),"manageHoverState"in xt&&n(13,Y=xt.manageHoverState),"hovered"in xt&&n(0,V=xt.hovered),"eventsIfTopMost"in xt&&n(14,$=xt.eventsIfTopMost),"interactive"in xt&&n(15,K=xt.interactive),"$$scope"in xt&&n(24,r=xt.$$scope)},[V,l,f,a,_,x,S,L,A,P,O,B,U,Y,$,K,i,nt,ht,dt,gt,ut,Et,yt,r]}class hd extends nn{constructor(t){super(),en(this,t,bE,vE,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function xE(e){let t;const n=e[15].default,i=sr(n,e,e[23],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&8388608)&&lr(i,n,r,r[23],t?ar(n,r[23],l,null):ur(r[23]),null)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function wE(e){let t,n,i;function r(f){e[16](f)}let l={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[xE]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new gg({props:l}),cr.push(()=>vc(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Zt(t.$$.fragment)},m(f,a){jt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.minzoom=f[9]),a&1024&&(_.maxzoom=f[10]),a&2048&&(_.hoverCursor=f[11]),a&4096&&(_.manageHoverState=f[12]),a&8192&&(_.eventsIfTopMost=f[13]),a&16384&&(_.interactive=f[14]),a&8388608&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],yc(()=>n=!1)),t.$set(_)},i(f){i||(pt(t.$$.fragment,f),i=!0)},o(f){bt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function SE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=of("fill")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:P=void 0}=t,{maxzoom:O=void 0}=t,{hoverCursor:B=void 0}=t,{manageHoverState:U=!1}=t,{hovered:Y=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:$=!0}=t;function K(yt){Y=yt,n(0,Y)}function nt(yt){ii.call(this,e,yt)}function ht(yt){ii.call(this,e,yt)}function dt(yt){ii.call(this,e,yt)}function gt(yt){ii.call(this,e,yt)}function ut(yt){ii.call(this,e,yt)}function Et(yt){ii.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,l=yt.id),"source"in yt&&n(2,f=yt.source),"sourceLayer"in yt&&n(3,a=yt.sourceLayer),"beforeId"in yt&&n(4,_=yt.beforeId),"beforeLayerType"in yt&&n(5,x=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,L=yt.layout),"filter"in yt&&n(8,A=yt.filter),"minzoom"in yt&&n(9,P=yt.minzoom),"maxzoom"in yt&&n(10,O=yt.maxzoom),"hoverCursor"in yt&&n(11,B=yt.hoverCursor),"manageHoverState"in yt&&n(12,U=yt.manageHoverState),"hovered"in yt&&n(0,Y=yt.hovered),"eventsIfTopMost"in yt&&n(13,V=yt.eventsIfTopMost),"interactive"in yt&&n(14,$=yt.interactive),"$$scope"in yt&&n(23,r=yt.$$scope)},[Y,l,f,a,_,x,S,L,A,P,O,B,U,V,$,i,K,nt,ht,dt,gt,ut,Et,r]}class af extends nn{constructor(t){super(),en(this,t,SE,wE,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function EE(e,t,n){let i;const{map:r}=sf();Se(e,r,_=>n(4,i=_));let{position:l="top-left"}=t,{container:f=void 0}=t,a=null;return aa(()=>{i!=null&&i.loaded()&&a&&i.removeControl(a)}),e.$$set=_=>{"position"in _&&n(1,l=_.position),"container"in _&&n(2,f=_.container)},e.$$.update=()=>{if(e.$$.dirty&30&&i&&!a){let _;typeof f=="string"?_=document.querySelector(f)??void 0:_=f,n(3,a=new Ms.FullscreenControl({container:_})),i.addControl(a,l)}},[r,l,f,a,i]}class IE extends nn{constructor(t){super(),en(this,t,EE,null,He,{position:1,container:2})}}function CE(e,t,n,i,r){let l=!1;e.getSource(t)&&(l=!0,e.removeSource(t));const f=()=>{i(t)&&(e.addSource(t,n),r())};if(l){const a=()=>{t&&(e.getSource(t)?setTimeout(a,1):f())};a()}else f()}function TE(e,t,n){RS().then(()=>{let i=Vb(e);if(!i)return;i.getSource(t)===n&&i.removeSource(t)})}function qv(e){let t=e[0],n,i,r=Zv(e);return{c(){r.c(),n=ts()},m(l,f){r.m(l,f),Ct(l,n,f),i=!0},p(l,f){f&1&&He(t,t=l[0])?(ui(),bt(r,1,1,Ie),ci(),r=Zv(l),r.c(),pt(r,1),r.m(n.parentNode,n)):r.p(l,f)},i(l){i||(pt(r),i=!0)},o(l){bt(r),i=!1},d(l){l&&It(n),r.d(l)}}}function Zv(e){let t;const n=e[15].default,i=sr(n,e,e[14],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&16384)&&lr(i,n,r,r[14],t?ar(n,r[14],l,null):ur(r[14]),null)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function LE(e){let t,n,i=e[0]&&qv(e);return{c(){i&&i.c(),t=ts()},m(r,l){i&&i.m(r,l),Ct(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&pt(i,1)):(i=qv(r),i.c(),pt(i,1),i.m(t.parentNode,t)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function ME(e,t,n){let i,r,l,{$$slots:f={},$$scope:a}=t,{id:_=of("geojson")}=t,{data:x}=t,{generateId:S=!1}=t,{promoteId:L=void 0}=t,{filter:A=void 0}=t,{lineMetrics:P=void 0}=t,{cluster:O=void 0}=t;const{map:B,cluster:U,self:Y}=uE();Se(e,B,K=>n(13,r=K)),Se(e,U,K=>n(16,l=K)),Se(e,Y,K=>n(0,i=K));let V,$=!0;return aa(()=>{i&&V&&r&&(TE(B,i,V),je(Y,i=null,i),n(11,V=void 0))}),e.$$set=K=>{"id"in K&&n(4,_=K.id),"data"in K&&n(5,x=K.data),"generateId"in K&&n(6,S=K.generateId),"promoteId"in K&&n(7,L=K.promoteId),"filter"in K&&n(8,A=K.filter),"lineMetrics"in K&&n(9,P=K.lineMetrics),"cluster"in K&&n(10,O=K.cluster),"$$scope"in K&&n(14,a=K.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&je(U,l=O,l),e.$$.dirty&12273&&r&&i!==_&&(je(Y,i=_,i),CE(r,i,Xm({type:"geojson",data:x,filter:A,lineMetrics:P,generateId:S,promoteId:L,cluster:!!O,clusterMinPoints:O==null?void 0:O.minPoints,clusterMaxZoom:O==null?void 0:O.maxZoom,clusterRadius:O==null?void 0:O.radius,clusterProperties:O==null?void 0:O.properties}),K=>r&&K===i,()=>{i&&(n(11,V=r==null?void 0:r.getSource(i)),n(12,$=!0))})),e.$$.dirty&8208&&(r==null||r.on("style.load",()=>{n(11,V=r==null?void 0:r.getSource(_))})),e.$$.dirty&6176&&V&&($?n(12,$=!1):V.setData(x)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Xm({cluster:!!O,clusterMaxZoom:O==null?void 0:O.maxZoom,clusterRadius:O==null?void 0:O.radius})))},[i,B,U,Y,_,x,S,L,A,P,O,V,$,r,a,f]}class Ps extends nn{constructor(t){super(),en(this,t,ME,LE,He,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function PE(e,t,n){let i;const{map:r}=sf();Se(e,r,A=>n(8,i=A));let{position:l="top-left"}=t,{positionOptions:f=void 0}=t,{fitBoundsOptions:a=void 0}=t,{trackUserLocation:_=!1}=t,{showAccuracyCircle:x=!0}=t,{showUserLocation:S=!0}=t,L=null;return aa(()=>{i!=null&&i.loaded()&&L&&i.removeControl(L)}),e.$$set=A=>{"position"in A&&n(1,l=A.position),"positionOptions"in A&&n(2,f=A.positionOptions),"fitBoundsOptions"in A&&n(3,a=A.fitBoundsOptions),"trackUserLocation"in A&&n(4,_=A.trackUserLocation),"showAccuracyCircle"in A&&n(5,x=A.showAccuracyCircle),"showUserLocation"in A&&n(6,S=A.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&i&&!L&&(n(7,L=new Ms.GeolocateControl({positionOptions:f,fitBoundsOptions:a,trackUserLocation:_,showAccuracyCircle:x,showUserLocation:S})),i.addControl(L,l))},[r,l,f,a,_,x,S,L,i]}class kE extends nn{constructor(t){super(),en(this,t,PE,null,He,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function AE(e){let t;const n=e[15].default,i=sr(n,e,e[23],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&8388608)&&lr(i,n,r,r[23],t?ar(n,r[23],l,null):ur(r[23]),null)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function NE(e){let t,n,i;function r(f){e[16](f)}let l={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[AE]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new gg({props:l}),cr.push(()=>vc(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Zt(t.$$.fragment)},m(f,a){jt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.minzoom=f[9]),a&1024&&(_.maxzoom=f[10]),a&2048&&(_.hoverCursor=f[11]),a&4096&&(_.manageHoverState=f[12]),a&8192&&(_.eventsIfTopMost=f[13]),a&16384&&(_.interactive=f[14]),a&8388608&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],yc(()=>n=!1)),t.$set(_)},i(f){i||(pt(t.$$.fragment,f),i=!0)},o(f){bt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function DE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=of("line")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:P=void 0}=t,{maxzoom:O=void 0}=t,{hoverCursor:B=void 0}=t,{manageHoverState:U=!1}=t,{hovered:Y=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:$=!0}=t;function K(yt){Y=yt,n(0,Y)}function nt(yt){ii.call(this,e,yt)}function ht(yt){ii.call(this,e,yt)}function dt(yt){ii.call(this,e,yt)}function gt(yt){ii.call(this,e,yt)}function ut(yt){ii.call(this,e,yt)}function Et(yt){ii.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,l=yt.id),"source"in yt&&n(2,f=yt.source),"sourceLayer"in yt&&n(3,a=yt.sourceLayer),"beforeId"in yt&&n(4,_=yt.beforeId),"beforeLayerType"in yt&&n(5,x=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,L=yt.layout),"filter"in yt&&n(8,A=yt.filter),"minzoom"in yt&&n(9,P=yt.minzoom),"maxzoom"in yt&&n(10,O=yt.maxzoom),"hoverCursor"in yt&&n(11,B=yt.hoverCursor),"manageHoverState"in yt&&n(12,U=yt.manageHoverState),"hovered"in yt&&n(0,Y=yt.hovered),"eventsIfTopMost"in yt&&n(13,V=yt.eventsIfTopMost),"interactive"in yt&&n(14,$=yt.interactive),"$$scope"in yt&&n(23,r=yt.$$scope)},[Y,l,f,a,_,x,S,L,A,P,O,B,U,V,$,i,K,nt,ht,dt,gt,ut,Et,r]}class ru extends nn{constructor(t){super(),en(this,t,DE,NE,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function RE(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,i),l=Math.round(t.lat*r)/r,f=Math.round(t.lng*r)/r,a=`${n}/${l}/${f}`,_=e.getBearing(),x=e.getPitch();return(_||x)&&(a+=`/${Math.round(_*10)/10}`),x&&(a+=`/${Math.round(x)}`),`#${a}`}function OE(e){return e.replace("#","").split("/").map(parseFloat)}var Pm=Py;function Py(e,t){return e===t||e!==e&&t!==t?!0:typeof e!=typeof t||{}.toString.call(e)!={}.toString.call(t)||e!==Object(e)||!e?!1:Array.isArray(e)?$v(e,t):{}.toString.call(e)=="[object Set]"?$v(Array.from(e),Array.from(t)):{}.toString.call(e)=="[object Object]"?FE(e,t):zE(e,t)}function zE(e,t){return e.toString()===t.toString()}function $v(e,t){var n=e.length;if(n!=t.length)return!1;for(var i=0;in(6,i=S));let{position:l="top-left"}=t,{showCompass:f=!0}=t,{showZoom:a=!0}=t,{visualizePitch:_=!1}=t,x=null;return aa(()=>{i!=null&&i.loaded()&&x&&i.removeControl(x)}),e.$$set=S=>{"position"in S&&n(1,l=S.position),"showCompass"in S&&n(2,f=S.showCompass),"showZoom"in S&&n(3,a=S.showZoom),"visualizePitch"in S&&n(4,_=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&i&&!x&&(n(5,x=new Ms.NavigationControl({showCompass:f,showZoom:a,visualizePitch:_})),i.addControl(x,l))},[r,l,f,a,_,x,i]}class VE extends nn{constructor(t){super(),en(this,t,BE,null,He,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function UE(e,t,n){let i;const{map:r}=sf();Se(e,r,x=>n(5,i=x));let{position:l="bottom-left"}=t,{maxWidth:f=void 0}=t,{unit:a="metric"}=t,_=null;return aa(()=>{i!=null&&i.loaded()&&_&&i.removeControl(_)}),e.$$set=x=>{"position"in x&&n(1,l=x.position),"maxWidth"in x&&n(2,f=x.maxWidth),"unit"in x&&n(3,a=x.unit)},e.$$.update=()=>{e.$$.dirty&62&&i&&!_&&(n(4,_=new Ms.ScaleControl({maxWidth:f,unit:a})),i.addControl(_,l))},[r,l,f,a,_,i]}class GE extends nn{constructor(t){super(),en(this,t,UE,null,He,{position:1,maxWidth:2,unit:3})}}const jE=e=>({map:e[0]&8,loadedImages:e[0]&16,allImagesLoaded:e[0]&32}),Wv=e=>({map:e[3],loadedImages:e[4],allImagesLoaded:e[5]});function Xv(e){let t,n,i=e[2]&&Hv(e);const r=e[34].default,l=sr(r,e,e[33],Wv);return{c(){i&&i.c(),t=Xt(),l&&l.c()},m(f,a){i&&i.m(f,a),Ct(f,t,a),l&&l.m(f,a),n=!0},p(f,a){f[2]?i?(i.p(f,a),a[0]&4&&pt(i,1)):(i=Hv(f),i.c(),pt(i,1),i.m(t.parentNode,t)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci()),l&&l.p&&(!n||a[0]&56|a[1]&4)&&lr(l,r,f,f[33],n?ar(r,f[33],a,jE):ur(f[33]),Wv)},i(f){n||(pt(i),pt(l,f),n=!0)},o(f){bt(i),bt(l,f),n=!1},d(f){f&&It(t),i&&i.d(f),l&&l.d(f)}}}function Hv(e){let t,n,i,r,l,f,a,_;return t=new VE({props:{position:e[6]}}),i=new kE({props:{position:e[6],fitBoundsOptions:{maxZoom:12}}}),l=new IE({props:{position:e[6]}}),a=new GE({props:{position:e[6]}}),{c(){Zt(t.$$.fragment),n=Xt(),Zt(i.$$.fragment),r=Xt(),Zt(l.$$.fragment),f=Xt(),Zt(a.$$.fragment)},m(x,S){jt(t,x,S),Ct(x,n,S),jt(i,x,S),Ct(x,r,S),jt(l,x,S),Ct(x,f,S),jt(a,x,S),_=!0},p(x,S){const L={};S[0]&64&&(L.position=x[6]),t.$set(L);const A={};S[0]&64&&(A.position=x[6]),i.$set(A);const P={};S[0]&64&&(P.position=x[6]),l.$set(P);const O={};S[0]&64&&(O.position=x[6]),a.$set(O)},i(x){_||(pt(t.$$.fragment,x),pt(i.$$.fragment,x),pt(l.$$.fragment,x),pt(a.$$.fragment,x),_=!0)},o(x){bt(t.$$.fragment,x),bt(i.$$.fragment,x),bt(l.$$.fragment,x),bt(a.$$.fragment,x),_=!1},d(x){x&&(It(n),It(r),It(f)),qt(t,x),qt(i,x),qt(l,x),qt(a,x)}}}function qE(e){let t,n,i,r,l,f=e[3]&&e[0]&&Xv(e);return{c(){t=wt("div"),f&&f.c(),Rt(t,"class",n=Zm(e[1])+" svelte-p00lfq"),hl(t,"expand-map",!e[1])},m(a,_){Ct(a,t,_),f&&f.m(t,null),i=!0,r||(l=Q_(e[9].call(null,t)),r=!0)},p(a,_){a[3]&&a[0]?f?(f.p(a,_),_[0]&9&&pt(f,1)):(f=Xv(a),f.c(),pt(f,1),f.m(t,null)):f&&(ui(),bt(f,1,1,()=>{f=null}),ci()),(!i||_[0]&2&&n!==(n=Zm(a[1])+" svelte-p00lfq"))&&Rt(t,"class",n),(!i||_[0]&2)&&hl(t,"expand-map",!a[1])},i(a){i||(pt(f),i=!0)},o(a){bt(f),i=!1},d(a){a&&It(t),f&&f.d(),r=!1,l()}}}function ZE(e,t,n){let i,r,l,f,{$$slots:a={},$$scope:_}=t,{map:x=null}=t,{class:S=void 0}=t,{style:L}=t,{diffStyleUpdates:A=!1}=t,{center:P=void 0}=t,{zoom:O=void 0}=t,{pitch:B=0}=t,{bearing:U=0}=t,{bounds:Y=void 0}=t,{hash:V=!1}=t,{loaded:$=!1}=t,{minZoom:K=0}=t,{maxZoom:nt=22}=t,{zoomOnDoubleClick:ht=!0}=t,{interactive:dt=!0}=t,{attributionControl:gt=!0}=t,{cooperativeGestures:ut=!1}=t,{preserveDrawingBuffer:Et=!1}=t,{maxBounds:yt=void 0}=t,{images:xt=[]}=t,{standardControls:fe=!1}=t,{filterLayers:Nt=void 0}=t,{transformRequest:Gt=void 0}=t;const Qt=Dc(),{map:oe,loadedImages:Ce}=lE();Se(e,oe,ie=>n(3,l=ie)),Se(e,Ce,ie=>n(4,f=ie));let yn=new Set;function jn(ie){l!=null&&l.loaded()&&("url"in ie?(yn.add(ie.id),l.loadImage(ie.url,(De,hn)=>{yn.delete(ie.id),De?Qt("error",De):hn&&(l==null||l.addImage(ie.id,hn,ie.options),f.add(ie.id),Ce.set(f))})):(l.addImage(ie.id,ie.data,ie.options),f.add(ie.id),Ce.set(f)))}let Qe,Fe,ke,fn;function Kn(ie){if(V){let De=OE(window.location.hash);De.length>=3&&(n(11,O=De[0]),n(10,P=[De[2],De[1]])),De.length==5&&(n(15,U=De[3]),n(14,B=De[4]))}return je(oe,l=new Ms.Map(Xm({container:ie,style:L,center:P,zoom:O,pitch:B,bearing:U,minZoom:K,maxZoom:nt,interactive:dt,preserveDrawingBuffer:Et,maxBounds:yt,bounds:Y,attributionControl:gt,transformRequest:Gt,cooperativeGestures:ut})),l),l.on("load",De=>{n(0,$=!0),Qt("load",l)}),l.on("error",De=>Qt("error",{...De,map:l})),l.on("movestart",De=>Qt("movestart",{...De,map:l})),l.on("moveend",De=>{if(n(10,P=De.target.getCenter()),n(11,O=De.target.getZoom()),n(12,Y=De.target.getBounds()),Qt("moveend",{...De,map:l}),V){let hn=window.location.href.replace(/(#.+)?$/,RE(l));window.history.replaceState(window.history.state,"",hn)}}),l.on("zoomstart",De=>Qt("zoomstart",{...De,map:l})),l.on("zoom",De=>{n(11,O=De.target.getZoom()),Qt("zoom",{...De,map:l})}),l.on("zoomend",De=>{n(11,O=De.target.getZoom()),Qt("zoomend",{...De,map:l})}),l.on("style.load",()=>{if(l){const De=l.getStyle();if(n(30,Qe=De.layers.map(hn=>hn.id)),n(31,Fe=Object.keys(De.sources)),fn)for(const[hn,On]of Object.entries(fn))l.addSource(hn,On);if(ke)for(const hn of ke)l.addLayer(hn)}}),l.on("styledata",De=>{if(l&&Nt){const hn=l.getStyle().layers;if(hn)for(let On of hn)Nt(On)||l.setLayoutProperty(On.id,"visibility","none")}Qt("styledata",{...De,map:l})}),{destroy(){n(0,$=!1),l==null||l.remove(),je(oe,l=null,l)}}}let qn=L;return e.$$set=ie=>{"map"in ie&&n(13,x=ie.map),"class"in ie&&n(1,S=ie.class),"style"in ie&&n(16,L=ie.style),"diffStyleUpdates"in ie&&n(17,A=ie.diffStyleUpdates),"center"in ie&&n(10,P=ie.center),"zoom"in ie&&n(11,O=ie.zoom),"pitch"in ie&&n(14,B=ie.pitch),"bearing"in ie&&n(15,U=ie.bearing),"bounds"in ie&&n(12,Y=ie.bounds),"hash"in ie&&n(18,V=ie.hash),"loaded"in ie&&n(0,$=ie.loaded),"minZoom"in ie&&n(19,K=ie.minZoom),"maxZoom"in ie&&n(20,nt=ie.maxZoom),"zoomOnDoubleClick"in ie&&n(21,ht=ie.zoomOnDoubleClick),"interactive"in ie&&n(22,dt=ie.interactive),"attributionControl"in ie&&n(23,gt=ie.attributionControl),"cooperativeGestures"in ie&&n(24,ut=ie.cooperativeGestures),"preserveDrawingBuffer"in ie&&n(25,Et=ie.preserveDrawingBuffer),"maxBounds"in ie&&n(26,yt=ie.maxBounds),"images"in ie&&n(27,xt=ie.images),"standardControls"in ie&&n(2,fe=ie.standardControls),"filterLayers"in ie&&n(28,Nt=ie.filterLayers),"transformRequest"in ie&&n(29,Gt=ie.transformRequest),"$$scope"in ie&&n(33,_=ie.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&4&&n(6,i=typeof fe=="boolean"?void 0:fe),e.$$.dirty[0]&8&&n(13,x=l),e.$$.dirty[0]&134217737&&$&&l!=null&&l.loaded())for(let ie of xt)!yn.has(ie.id)&&!l.hasImage(ie.id)&&jn(ie);if(e.$$.dirty[0]&134217744&&n(5,r=xt.every(ie=>f.has(ie.id))),e.$$.dirty[0]&1073938440|e.$$.dirty[1]&3&&l&&!Pm(L,qn)){const ie=l.getStyle();if(Qe&&(ke=ie.layers.filter(De=>!Qe.includes(De.id))),Fe){const De=Object.keys(ie.sources).filter(hn=>!Fe.includes(hn));fn={};for(const hn of De)fn[hn]=ie.sources[hn]}n(32,qn=L),l.setStyle(L,{diff:A})}e.$$.dirty[0]&1032&&P&&!Pm(P,l==null?void 0:l.getCenter())&&(l==null||l.panTo(P)),e.$$.dirty[0]&2056&&O&&!Pm(O,l==null?void 0:l.getZoom())&&(l==null||l.zoomTo(O)),e.$$.dirty[0]&4104&&Y&&!Pm(Y,l==null?void 0:l.getBounds())&&(l==null||l.fitBounds(Y)),e.$$.dirty[0]&2097160&&(ht?l==null||l.doubleClickZoom.enable():l==null||l.doubleClickZoom.disable())},[$,S,fe,l,f,r,i,oe,Ce,Kn,P,O,Y,x,B,U,L,A,V,K,nt,ht,dt,gt,ut,Et,yt,xt,Nt,Gt,Qe,Fe,qn,_,a]}class $E extends nn{constructor(t){super(),en(this,t,ZE,qE,He,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,interactive:22,attributionControl:23,cooperativeGestures:24,preserveDrawingBuffer:25,maxBounds:26,images:27,standardControls:2,filterLayers:28,transformRequest:29},null,[-1,-1])}}function WE(e){let t,n,i,r,l,f,a;const _=e[17].default,x=sr(_,e,e[16],null);return{c(){t=wt("div"),x&&x.c(),Rt(t,"tabindex",n=e[1]?0:void 0),Rt(t,"role",i=e[1]?"button":void 0),mi(t,"z-index",e[2])},m(S,L){Ct(S,t,L),x&&x.m(t,null),l=!0,f||(a=[Q_(e[6].call(null,t)),Q_(r=XE.call(null,t,e[0])),Ze(t,"click",e[18]),Ze(t,"dblclick",e[19]),Ze(t,"contextmenu",e[20]),Ze(t,"mouseenter",e[21]),Ze(t,"mouseleave",e[22]),Ze(t,"mousemove",e[23]),Ze(t,"keydown",e[7])],f=!0)},p(S,[L]){x&&x.p&&(!l||L&65536)&&lr(x,_,S,S[16],l?ar(_,S[16],L,null):ur(S[16]),null),(!l||L&2&&n!==(n=S[1]?0:void 0))&&Rt(t,"tabindex",n),(!l||L&2&&i!==(i=S[1]?"button":void 0))&&Rt(t,"role",i),r&&pg(r.update)&&L&1&&r.update.call(null,S[0]),L&4&&mi(t,"z-index",S[2])},i(S){l||(pt(x,S),l=!0)},o(S){bt(x,S),l=!1},d(S){S&&It(t),x&&x.d(S),f=!1,No(a)}}}function XE(e,t){const n=e.className;function i(r){r?e.className=`${n} ${r}`:e.className=n}return i(t),{update:i}}function HE(e,t,n){let i,r,l,{$$slots:f={},$$scope:a}=t,{lngLat:_}=t,{class:x=void 0}=t,{interactive:S=!0}=t,{asButton:L=!1}=t,{draggable:A=!1}=t,{feature:P=null}=t,{offset:O=void 0}=t,{zIndex:B=void 0}=t,{rotation:U=0}=t;const Y=Dc(),{map:V,layerEvent:$,self:K}=hE();Se(e,V,Gt=>n(25,l=Gt)),Se(e,$,Gt=>n(24,i=Gt)),Se(e,K,Gt=>n(15,r=Gt));function nt(Gt){je(K,r=new Ms.Marker({element:Gt,rotation:U,draggable:A,offset:O}).setLngLat(_).addTo(l),r);const Qt=()=>gt("dragstart"),oe=()=>{ht(),gt("drag")},Ce=()=>{ht(),gt("dragend")};return A&&(r.on("dragstart",Qt),r.on("drag",oe),r.on("dragend",Ce)),{destroy(){A&&(r==null||r.off("dragstart",Qt),r==null||r.off("drag",oe),r==null||r.off("dragend",Ce)),r==null||r.remove()}}}function ht(){let Gt=r==null?void 0:r.getLngLat();Gt&&(Array.isArray(_)?n(9,_=[Gt.lng,Gt.lat]):_&&"lon"in _?n(9,_={lon:Gt.lng,lat:Gt.lat}):n(9,_=Gt))}function dt(Gt){Gt.key===" "&&(Gt.preventDefault(),Gt.stopPropagation(),gt("click"))}function gt(Gt){if(!S)return;let Qt=r==null?void 0:r.getLngLat();if(!Qt)return;const oe=[Qt.lng,Qt.lat];let Ce={map:l,marker:r,lngLat:oe,features:[{type:"Feature",properties:(P==null?void 0:P.properties)??{},geometry:{type:"Point",coordinates:oe}}]};je($,i={...Ce,layerType:"marker",type:Gt},i),Y(Gt,Ce)}const ut=()=>gt("click"),Et=()=>gt("dblclick"),yt=()=>gt("contextmenu"),xt=Gt=>{gt("mouseenter")},fe=()=>{gt("mouseleave")},Nt=()=>gt("mousemove");return e.$$set=Gt=>{"lngLat"in Gt&&n(9,_=Gt.lngLat),"class"in Gt&&n(0,x=Gt.class),"interactive"in Gt&&n(10,S=Gt.interactive),"asButton"in Gt&&n(1,L=Gt.asButton),"draggable"in Gt&&n(11,A=Gt.draggable),"feature"in Gt&&n(12,P=Gt.feature),"offset"in Gt&&n(13,O=Gt.offset),"zIndex"in Gt&&n(2,B=Gt.zIndex),"rotation"in Gt&&n(14,U=Gt.rotation),"$$scope"in Gt&&n(16,a=Gt.$$scope)},e.$$.update=()=>{e.$$.dirty&33280&&(r==null||r.setLngLat(_)),e.$$.dirty&40960&&(r==null||r.setOffset(O??[0,0])),e.$$.dirty&49152&&(r==null||r.setRotation(U))},[x,L,B,V,$,K,nt,dt,gt,_,S,A,P,O,U,r,a,f,ut,Et,yt,xt,fe,Nt]}class Yv extends nn{constructor(t){super(),en(this,t,HE,WE,He,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14})}}const YE=e=>({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),Kv=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function Jv(e){let t,n,i=(e[4]||e[3]instanceof Ms.Marker)&&Qv(e);return{c(){t=wt("div"),i&&i.c()},m(r,l){Ct(r,t,l),i&&i.m(t,null),e[32](t),n=!0},p(r,l){r[4]||r[3]instanceof Ms.Marker?i?(i.p(r,l),l[0]&24&&pt(i,1)):(i=Qv(r),i.c(),pt(i,1),i.m(t,null)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(),e[32](null)}}}function Qv(e){let t;const n=e[30].default,i=sr(n,e,e[29],Kv);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l[0]&536870933)&&lr(i,n,r,r[29],t?ar(n,r[29],l,YE):ur(r[29]),Kv)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function KE(e){let t,n,i=e[9].default&&Jv(e);return{c(){i&&i.c(),t=ts()},m(r,l){i&&i.m(r,l),Ct(r,t,l),n=!0},p(r,l){r[9].default?i?(i.p(r,l),l[0]&512&&pt(i,1)):(i=Jv(r),i.c(),pt(i,1),i.m(t.parentNode,t)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function JE(e,t,n){let i,r,l,f,a,_,{$$slots:x={},$$scope:S}=t;const L=MS(x);let{closeButton:A=void 0}=t,{closeOnClickOutside:P=!0}=t,{closeOnClickInside:O=!1}=t,{closeOnMove:B=!1}=t,{openOn:U="click"}=t,{openIfTopMost:Y=!0}=t,{focusAfterOpen:V=!0}=t,{anchor:$=void 0}=t,{offset:K=void 0}=t,{popupClass:nt=void 0}=t,{maxWidth:ht=void 0}=t,{lngLat:dt=void 0}=t,{html:gt=void 0}=t,{open:ut=!1}=t;const{map:Et,popupTarget:yt,layerEvent:xt,layer:fe,eventTopMost:Nt}=sf();Se(e,Et,_t=>n(2,l=_t)),Se(e,yt,_t=>n(3,a=_t)),Se(e,xt,_t=>n(28,f=_t)),Se(e,fe,_t=>n(35,_=_t));const Gt=["click","dblclick","contextmenu"];let Qt,oe=!1,Ce;function yn(){if(!Qt)return;let _t=Qt.getElement();!_t||_t===Ce||(Ce=_t,U==="hover"&&(Ce.style.pointerEvents="none"),Ce.addEventListener("mouseenter",()=>{n(24,oe=!0)},{passive:!0}),Ce.addEventListener("mouseleave",()=>{n(24,oe=!1)},{passive:!0}),Ce.addEventListener("click",()=>{O&&n(0,ut=!1)},{passive:!0}))}dg(()=>{if(l)return l.on("click",hn),l.on("contextmenu",hn),typeof a=="string"&&(l.on("click",a,ke),l.on("dblclick",a,ke),l.on("contextmenu",a,ke),l.on("mousemove",a,De),l.on("mouseleave",a,ie),l.on("touchstart",a,Kn),l.on("touchend",a,qn)),()=>{l!=null&&l.loaded()&&(Qt==null||Qt.remove(),l.off("click",hn),l.off("contextmenu",hn),a instanceof Ms.Marker?a.getPopup()===Qt&&a.setPopup(void 0):typeof a=="string"&&(l.off("click",a,ke),l.off("dblclick",a,ke),l.off("contextmenu",a,ke),l.off("mousemove",a,De),l.off("mouseleave",a,ie),l.off("touchstart",a,Kn),l.off("touchend",a,qn)))}});function jn(_t){return Y?!("marker"in _t)&&!fE(_t)&&Nt(_t)!==_:!1}let Qe=null,Fe="normal";function ke(_t){_t.type===U&&(jn(_t)||("layerType"in _t?_t.layerType==="deckgl"?(n(10,dt=_t.coordinate),n(4,Qe=_t.object?[_t.object]:null)):(n(10,dt=_t.lngLat),n(4,Qe=_t.features??[])):(n(10,dt=_t.lngLat),n(4,Qe=_t.features??[])),setTimeout(()=>n(0,ut=!0))))}let fn=null;function Kn(_t){fn=_t.point}function qn(_t){if(!fn||U!=="hover")return;let Ee=fn.dist(_t.point);fn=null,Ee<3&&(n(10,dt=_t.lngLat),n(4,Qe=_t.features??[]),Qt.isOpen()?n(25,Fe="justOpened"):(n(25,Fe="opening"),n(0,ut=!0)))}function ie(_t){U!=="hover"||fn||Fe!=="normal"||(n(0,ut=!1),n(4,Qe=null))}function De(_t){if(!(U!=="hover"||fn||Fe!=="normal")){if(jn(_t)){n(0,ut=!1),n(4,Qe=null);return}n(0,ut=!0),n(4,Qe=_t.features??[]),n(10,dt=_t.lngLat)}}function hn(_t){if(Fe==="justOpened"){n(25,Fe="normal");return}if(!P)return;let Ee=[Ce,a instanceof Ms.Marker?a==null?void 0:a.getElement():null];ut&&Qt.isOpen()&&!Ee.some(qe=>qe==null?void 0:qe.contains(_t.originalEvent.target))&&(_t.type==="contextmenu"&&U==="contextmenu"||_t.type!=="contextmenu")&&n(0,ut=!1)}aa(()=>{l&&(Qt!=null&&Qt.isOpen())&&Qt.remove()});let On;const _i=()=>n(0,ut=!1);function wn(_t){cr[_t?"unshift":"push"](()=>{On=_t,n(1,On)})}return e.$$set=_t=>{"closeButton"in _t&&n(11,A=_t.closeButton),"closeOnClickOutside"in _t&&n(12,P=_t.closeOnClickOutside),"closeOnClickInside"in _t&&n(13,O=_t.closeOnClickInside),"closeOnMove"in _t&&n(14,B=_t.closeOnMove),"openOn"in _t&&n(15,U=_t.openOn),"openIfTopMost"in _t&&n(16,Y=_t.openIfTopMost),"focusAfterOpen"in _t&&n(17,V=_t.focusAfterOpen),"anchor"in _t&&n(18,$=_t.anchor),"offset"in _t&&n(19,K=_t.offset),"popupClass"in _t&&n(20,nt=_t.popupClass),"maxWidth"in _t&&n(21,ht=_t.maxWidth),"lngLat"in _t&&n(10,dt=_t.lngLat),"html"in _t&&n(22,gt=_t.html),"open"in _t&&n(0,ut=_t.open),"$$scope"in _t&&n(29,S=_t.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,i=A??(!P&&!O)),e.$$.dirty[0]&146685952&&(Qt||(n(23,Qt=new Ms.Popup({closeButton:i,closeOnClick:!1,closeOnMove:B,focusAfterOpen:V,maxWidth:ht,className:nt,anchor:$,offset:K})),Ce=Qt.getElement(),Qt.on("open",()=>{n(0,ut=!0),yn()}),Qt.on("close",_t=>{n(0,ut=!1)}))),e.$$.dirty[0]&8421384&&Qt&&a instanceof Ms.Marker&&(U==="click"?a.setPopup(Qt):a.getPopup()===Qt&&a.setPopup(void 0)),e.$$.dirty[0]&268468224&&Gt.includes(U)&&(f==null?void 0:f.type)===U&&(ke(f),je(xt,f=null,f)),e.$$.dirty[0]&268468224&&n(26,r=U==="hover"&&((f==null?void 0:f.type)==="mousemove"||(f==null?void 0:f.type)==="mouseenter")),e.$$.dirty[0]&352354304&&U==="hover"&&xt&&(r&&f&&(f.layerType==="deckgl"?(n(10,dt=f.coordinate),n(4,Qe=f.object?[f.object]:null)):(n(10,dt=f.lngLat),n(4,Qe=f.features??[]))),n(0,ut=(r||oe)??!1)),e.$$.dirty[0]&12582914&&(On?Qt.setDOMContent(On):gt&&Qt.setHTML(gt)),e.$$.dirty[0]&8389632&&dt&&Qt.setLngLat(dt),e.$$.dirty[0]&41943045&&l){let _t=Qt.isOpen();ut&&!_t?(Qt.addTo(l),Fe==="opening"&&n(25,Fe="justOpened")):!ut&&_t&&Qt.remove()}},[ut,On,l,a,Qe,Et,yt,xt,fe,L,dt,A,P,O,B,U,Y,V,$,K,nt,ht,gt,Qt,oe,Fe,r,i,f,S,x,_i,wn]}class QE extends nn{constructor(t){super(),en(this,t,JE,KE,He,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}function tI(e){let t;const n=e[16].default,i=sr(n,e,e[24],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&16777216)&&lr(i,n,r,r[24],t?ar(n,r[24],l,null):ur(r[24]),null)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function eI(e){let t,n,i;function r(f){e[17](f)}let l={id:e[1],type:"symbol",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[tI]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new gg({props:l}),cr.push(()=>vc(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){Zt(t.$$.fragment)},m(f,a){jt(t,f,a),i=!0},p(f,[a]){const _={};a&2&&(_.id=f[1]),a&4&&(_.source=f[2]),a&8&&(_.sourceLayer=f[3]),a&16&&(_.beforeId=f[4]),a&32&&(_.beforeLayerType=f[5]),a&64&&(_.paint=f[6]),a&128&&(_.layout=f[7]),a&256&&(_.filter=f[8]),a&512&&(_.applyToClusters=f[9]),a&1024&&(_.minzoom=f[10]),a&2048&&(_.maxzoom=f[11]),a&4096&&(_.hoverCursor=f[12]),a&8192&&(_.manageHoverState=f[13]),a&16384&&(_.eventsIfTopMost=f[14]),a&32768&&(_.interactive=f[15]),a&16777216&&(_.$$scope={dirty:a,ctx:f}),!n&&a&1&&(n=!0,_.hovered=f[0],yc(()=>n=!1)),t.$set(_)},i(f){i||(pt(t.$$.fragment,f),i=!0)},o(f){bt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function nI(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:l=of("symbol")}=t,{source:f=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S=void 0}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:P=void 0}=t,{minzoom:O=void 0}=t,{maxzoom:B=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:$=!1}=t,{interactive:K=!0}=t;function nt(xt){V=xt,n(0,V)}function ht(xt){ii.call(this,e,xt)}function dt(xt){ii.call(this,e,xt)}function gt(xt){ii.call(this,e,xt)}function ut(xt){ii.call(this,e,xt)}function Et(xt){ii.call(this,e,xt)}function yt(xt){ii.call(this,e,xt)}return e.$$set=xt=>{"id"in xt&&n(1,l=xt.id),"source"in xt&&n(2,f=xt.source),"sourceLayer"in xt&&n(3,a=xt.sourceLayer),"beforeId"in xt&&n(4,_=xt.beforeId),"beforeLayerType"in xt&&n(5,x=xt.beforeLayerType),"paint"in xt&&n(6,S=xt.paint),"layout"in xt&&n(7,L=xt.layout),"filter"in xt&&n(8,A=xt.filter),"applyToClusters"in xt&&n(9,P=xt.applyToClusters),"minzoom"in xt&&n(10,O=xt.minzoom),"maxzoom"in xt&&n(11,B=xt.maxzoom),"hoverCursor"in xt&&n(12,U=xt.hoverCursor),"manageHoverState"in xt&&n(13,Y=xt.manageHoverState),"hovered"in xt&&n(0,V=xt.hovered),"eventsIfTopMost"in xt&&n(14,$=xt.eventsIfTopMost),"interactive"in xt&&n(15,K=xt.interactive),"$$scope"in xt&&n(24,r=xt.$$scope)},[V,l,f,a,_,x,S,L,A,P,O,B,U,Y,$,K,i,nt,ht,dt,gt,ut,Et,yt,r]}class iI extends nn{constructor(t){super(),en(this,t,nI,eI,He,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}var fd=Uint8Array,rx=Uint16Array,rI=Int32Array,oI=new fd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sI=new fd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ox=function(e,t){for(var n=new rx(31),i=0;i<31;++i)n[i]=t+=1<>1|(ni&21845)<<1,Bl=(Bl&52428)>>2|(Bl&13107)<<2,Bl=(Bl&61680)>>4|(Bl&3855)<<4,uI[ni]=((Bl&65280)>>8|(Bl&255)<<8)>>1;var Bl,ni,_g=new fd(288);for(ni=0;ni<144;++ni)_g[ni]=8;var ni;for(ni=144;ni<256;++ni)_g[ni]=9;var ni;for(ni=256;ni<280;++ni)_g[ni]=7;var ni;for(ni=280;ni<288;++ni)_g[ni]=8;var ni,cI=new fd(32);for(ni=0;ni<32;++ni)cI[ni]=5;var ni,hI=new fd(0),fI=typeof TextDecoder<"u"&&new TextDecoder,pI=0;try{fI.decode(hI,{stream:!0}),pI=1}catch{}const ax=li({type:"FeatureCollection",features:[]}),dI=li(!0),lx=li(0),mI=30;class gI{constructor(t,n){Zn(this,"map");Zn(this,"inner");Zn(this,"active");Zn(this,"eventListenersSuccess");Zn(this,"eventListenersUpdated");Zn(this,"eventListenersFailure");Zn(this,"onMouseMove",t=>{if(!this.active)return;const n=[t.point.x-mI,t.point.y],i=this.map.unproject(t.point).distanceTo(this.map.unproject(n));this.inner.onMouseMove(t.lngLat.lng,t.lngLat.lat,i)&&(this.redraw(),this.dataUpdated())});Zn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});Zn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.inner.onClick(),this.finish())});Zn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});Zn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});Zn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});Zn(this,"onKeyPress",t=>{this.active&&t.target.tagName!="INPUT"&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="s"?(t.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):t.key=="z"&&t.ctrlKey&&this.undo())});this.map=t,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new Wm(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),t.properties.waypoints||(t.properties.waypoints=[{lon:t.geometry.coordinates[0][0],lat:t.geometry.coordinates[0][1],snapped:!0},{lon:t.geometry.coordinates[t.geometry.coordinates.length-1][0],lat:t.geometry.coordinates[t.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(t.properties.waypoints),this.redraw()}editExistingArea(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingArea called when tool is already active"),t.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(t.properties.waypoints),this.redraw()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersSuccess)n(JSON.parse(t));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(t){this.inner.setRouteConfig(t),this.redraw()}addSnappedWaypoint(t){this.inner.addSnappedWaypoint(t[0],t[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}redraw(){let t=JSON.parse(this.inner.renderGeojson());ax.set(t),this.map.getCanvas().style.cursor=t.cursor,dI.set(t.snap_mode),lx.set(t.undo_length)}dataUpdated(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersUpdated)n(JSON.parse(t))}}const ky="MZEJTanw3WpxRvt7qDfo";let Du=li(null),ux=li(`https://api.maptiler.com/maps/dataviz/style.json?key=${ky}`),Pu=li(""),Hm=li(!0),oy=li(null),sy=li(null),ay=li(null),Wo=li(null),qp=li(null),Ym=li(new mg.LngLat(0,0)),Km=li(new mg.LngLat(0,0)),gc=li(1),xn=li({mode:"title"}),ly=li("walk_cycle_only");function _I(e){let t,n,i,r,l,f,a,_,x;return{c(){t=wt("label"),n=be(`Basemap: + `),i=wt("select"),r=wt("option"),r.textContent="MapTiler Dataviz",l=wt("option"),l.textContent="MapTiler Streets",f=wt("option"),f.textContent="MapTiler Satellite",a=wt("option"),a.textContent="OS Open Zoomstack",r.__value="dataviz",ql(r,r.__value),l.__value="streets",ql(l,l.__value),f.__value="hybrid",ql(f,f.__value),a.__value="uk-openzoomstack-light",ql(a,a.__value),e[0]===void 0&&jp(()=>e[1].call(i))},m(S,L){Ct(S,t,L),mt(t,n),mt(t,i),mt(i,r),mt(i,l),mt(i,f),mt(i,a),$m(i,e[0],!0),_||(x=Ze(i,"change",e[1]),_=!0)},p(S,[L]){L&1&&$m(i,S[0])},i:Ie,o:Ie,d(S){S&&It(t),_=!1,x()}}}function yI(e,t,n){let i="dataviz";function r(){i=Gb(this),n(0,i)}return e.$$.update=()=>{e.$$.dirty&1&&ux.set(`https://api.maptiler.com/maps/${i}/style.json?key=${ky}`)},[i,r]}class vI extends nn{constructor(t){super(),en(this,t,yI,_I,He,{})}}var bI=Object.defineProperty,xI=(e,t,n)=>t in e?bI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t1=(e,t,n)=>(xI(e,typeof t!="symbol"?t+"":t,n),n);function Zp(){}function cx(e){return e()}function e1(){return Object.create(null)}function yg(e){e.forEach(cx)}function hx(e){return typeof e=="function"}function wI(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function SI(e){return Object.keys(e).length===0}function EI(e,t){e.appendChild(t)}function II(e,t,n){e.insertBefore(t,n||null)}function fx(e){e.parentNode&&e.parentNode.removeChild(e)}function n1(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Iu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function CI(e){return Array.from(e.childNodes)}function km(e,t,n){e.classList.toggle(t,!!n)}let Ay;function Vp(e){Ay=e}const kh=[],i1=[];let Rh=[];const r1=[],TI=Promise.resolve();let uy=!1;function LI(){uy||(uy=!0,TI.then(px))}function cy(e){Rh.push(e)}const W_=new Set;let Th=0;function px(){if(Th!==0)return;const e=Ay;do{try{for(;The.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Rh=t}const kI=new Set;function AI(e,t){e&&e.i&&(kI.delete(e),e.i(t))}function NI(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),cy(()=>{const l=e.$$.on_mount.map(cx).filter(hx);e.$$.on_destroy?e.$$.on_destroy.push(...l):yg(l),e.$$.on_mount=[]}),r.forEach(cy)}function DI(e,t){const n=e.$$;n.fragment!==null&&(PI(n.after_update),yg(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function RI(e,t){e.$$.dirty[0]===-1&&(kh.push(e),LI(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=P.length?P[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=O)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](O),S&&RI(e,L)),A}):[],x.update(),S=!0,yg(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=CI(t.target);x.fragment&&x.fragment.l(L),L.forEach(fx)}else x.fragment&&x.fragment.c();t.intro&&AI(e.$$.fragment),NI(e,t.target,t.anchor),px()}Vp(_)}class zI{constructor(){t1(this,"$$"),t1(this,"$$set")}$destroy(){DI(this,1),this.$destroy=Zp}$on(t,n){if(!hx(n))return Zp;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!SI(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const FI="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(FI);function BI(e){let t,n,i;return{c(){t=n1("svg"),n=n1("path"),Iu(n,"stroke-width","4"),Iu(n,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),Iu(n,"class","svelte-gzo3ar"),Iu(t,"width",i=e[0]==="list"?20:void 0),Iu(t,"viewBox","0 0 70 85"),Iu(t,"fill","none"),Iu(t,"class","svelte-gzo3ar"),km(t,"in-map",e[0]!=="list"),km(t,"list-icon",e[0]==="list")},m(r,l){II(r,t,l),EI(t,n)},p(r,[l]){l&1&&i!==(i=r[0]==="list"?20:void 0)&&Iu(t,"width",i),l&1&&km(t,"in-map",r[0]!=="list"),l&1&&km(t,"list-icon",r[0]==="list")},i:Zp,o:Zp,d(r){r&&fx(t)}}}function VI(e,t,n){let{displayIn:i}=t;return e.$$set=r=>{"displayIn"in r&&n(0,i=r.displayIn)},[i]}class UI extends zI{constructor(t){super(),OI(this,t,VI,BI,wI,{displayIn:0})}}const GI=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],jI={decimalLatitude:40.123,decimalLongitude:-74.123},qI=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],ZI=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function $I(){const e=[];return GI.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...jI})}),[...e,...qI,...ZI]}const WI=$I();WI.map(e=>e.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -600,11 +600,11 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. -***************************************************************************** */function XI(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},i,r,l,f;return f={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function a(x){return function(S){return _([x,S])}}function _(x){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,r&&(l=x[0]&2?r.return:x[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,x[1])).done)return l;switch(r=0,l&&(x=[x[0]&2,l.value]),x[0]){case 0:case 1:l=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,r=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!l||x[1]>l[0]&&x[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var a=t.right;if(t.right=a.left,a.left=t,t=a,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,l.left=t.right,t.left=i.right,t.right=i.left,t}function X_(e,t,n,i){var r=new Du(e,t);if(n===null)return r.left=r.right=null,r;n=Tu(e,n,i);var l=i(e,n.key);return l<0?(r.left=n.left,r.right=n,n.left=null):l>=0&&(r.right=n.right,r.left=n,n.right=null),r}function r1(e,t,n){var i=null,r=null;if(t){t=Tu(e,t,n);var l=n(t.key,e);l===0?(i=t.left,r=t.right):l<0?(r=t.right,t.right=null,i=t):(i=t.left,t.left=null,r=t)}return{left:i,right:r}}function YI(e,t,n){return t===null?e:(e===null||(t=Tu(e.key,t,n),t.left=e),t)}function cy(e,t,n,i,r){if(e){i(""+t+(n?"└── ":"├── ")+r(e)+` -`);var l=t+(n?" ":"│ ");e.left&&cy(e.left,l,!1,i,r),e.right&&cy(e.right,l,!0,i,r)}}var Ay=function(){function e(t){t===void 0&&(t=HI),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=X_(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var i=new Du(t,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,l=Tu(t,this._root,r),f=r(t,l.key);return f===0?this._root=l:(f<0?(i.left=l.left,i.right=l,l.left=null):f>0&&(i.right=l.right,i.left=l,l.right=null),this._size++,this._root=i),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,i){var r;if(n===null)return null;n=Tu(t,n,i);var l=i(t,n.key);return l===0?(n.left===null?r=n.right:(r=Tu(t,n.left,i),r.right=n.right),this._size--,r):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Tu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return n;r<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Tu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return!0;r<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var i=this._root,r=[],l=!1;!l;)i!==null?(r.push(i),i=i.left):r.length!==0?(i=r.pop(),t.call(n,i),i=i.right):l=!0;return this},e.prototype.range=function(t,n,i,r){for(var l=[],f=this._comparator,a=this._root,_;l.length!==0||a;)if(a)l.push(a),a=a.left;else{if(a=l.pop(),_=f(a.key,n),_>0)break;if(f(a.key,t)>=0&&i.call(r,a))return this;a=a.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var i=n.key;return t.push(i)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var i=n.data;return t.push(i)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,i=!1,r=0,l=[];!i;)if(n)l.push(n),n=n.left;else if(l.length>0){if(n=l.pop(),r===t)return n;r++,n=n.right}else i=!0;return null},e.prototype.next=function(t){var n=this._root,i=null;if(t.right){for(i=t.right;i.left;)i=i.left;return i}for(var r=this._comparator;n;){var l=r(t.key,n.key);if(l===0)break;l<0?(i=n,n=n.left):n=n.right}return i},e.prototype.prev=function(t){var n=this._root,i=null;if(t.left!==null){for(i=t.left;i.right;)i=i.right;return i}for(var r=this._comparator;n;){var l=r(t.key,n.key);if(l===0)break;l<0?n=n.left:(i=n,n=n.right)}return i},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return JI(this._root)},e.prototype.load=function(t,n,i){n===void 0&&(n=[]),i===void 0&&(i=!1);var r=t.length,l=this._comparator;if(i&&py(t,n,0,r-1,l),this._root===null)this._root=hy(t,n,0,r),this._size=r;else{var f=QI(this.toList(),KI(t,n),l);r=this._size+r,this._root=fy({head:f},0,r)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(i){return String(i.key)});var n=[];return cy(this._root,"",!0,function(i){return n.push(i)},t),n.join("")},e.prototype.update=function(t,n,i){var r=this._comparator,l=r1(t,this._root,r),f=l.left,a=l.right;r(t,n)<0?a=X_(n,i,a,r):f=X_(n,i,f,r),this._root=YI(f,a,r)},e.prototype.split=function(t){return r1(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,i;return XI(this,function(r){switch(r.label){case 0:t=this._root,n=[],i=!1,r.label=1;case 1:return i?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return r.sent(),t=t.right,[3,5];case 4:i=!0,r.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function hy(e,t,n,i){var r=i-n;if(r>0){var l=n+Math.floor(r/2),f=e[l],a=t[l],_=new Du(f,a);return _.left=hy(e,t,n,l),_.right=hy(e,t,l+1,i),_}return null}function KI(e,t){for(var n=new Du(null,null),i=n,r=0;r0?(t=l=l.next=n.pop(),t=t.right):i=!0;return l.next=null,r.next}function fy(e,t,n){var i=n-t;if(i>0){var r=t+Math.floor(i/2),l=fy(e,t,r),f=e.head;return f.left=l,e.head=e.head.next,f.right=fy(e,r+1,n),f}return null}function QI(e,t,n){for(var i=new Du(null,null),r=i,l=e,f=t;l!==null&&f!==null;)n(l.key,f.key)<0?(r.next=l,l=l.next):(r.next=f,f=f.next),r=r.next;return l!==null?r.next=l:f!==null&&(r.next=f),i.next}function py(e,t,n,i,r){if(!(n>=i)){for(var l=e[n+i>>1],f=n-1,a=i+1;;){do f++;while(r(e[f],l)<0);do a--;while(r(e[a],l)>0);if(f>=a)break;var _=e[f];e[f]=e[a],e[a]=_,_=t[f],t[f]=t[a],t[a]=_}py(e,t,n,a,r),py(e,t,a+1,i,r)}}function va(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o1(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){va(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Xo(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,i=0,r=n.length;i=0&&L>=0?xA?-1:0:_<0&&L<0?xA?1:0:L<_?-1:L>_?1:0}}}]),e}(),rC=0,Qm=function(){Xo(e,null,[{key:"compare",value:function(t,n){var i=t.leftSE.point.x,r=n.leftSE.point.x,l=t.rightSE.point.x,f=n.rightSE.point.x;if(fa&&_>x)return-1;var L=t.comparePoint(n.leftSE.point);if(L<0)return 1;if(L>0)return-1;var A=n.comparePoint(t.rightSE.point);return A!==0?A:-1}if(i>r){if(a<_&&a_&&a>S)return 1;var k=n.comparePoint(t.leftSE.point);if(k!==0)return k;var R=t.comparePoint(n.rightSE.point);return R<0?1:R>0?-1:1}if(a<_)return-1;if(a>_)return 1;if(lf){var j=t.comparePoint(n.rightSE.point);if(j<0)return 1;if(j>0)return-1}if(l!==f){var Q=x-a,B=l-i,X=S-_,J=f-r;if(Q>B&&XJ)return-1}return l>f?1:lS?1:t.idn.id?1:0}}]);function e(t,n,i,r){va(this,e),this.id=++rC,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=i,this.windings=r}return Xo(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,i=this.rightSE.point,r=this.vector();if(n.x===i.x)return t.x===n.x?0:t.x0&&a.swapEvents(),ll.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(r.checkForConsuming(),l.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n0){var l=n;n=i,i=l}if(n.prev===i){var f=n;n=i,i=f}for(var a=0,_=i.rings.length;a<_;a++){var x=i.rings[a],S=i.windings[a],L=n.rings.indexOf(x);L===-1?(n.rings.push(x),n.windings.push(S)):n.windings[L]+=S}i.rings=null,i.windings=null,i.consumedBy=n,i.leftSE.consumedBy=n.leftSE,i.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var n=this._afterState.rings,i=this._afterState.windings,r=this._afterState.multiPolys,l=0,f=this.rings.length;l0)r=n,l=t,f=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var _=new ll(r,!0),x=new ll(l,!1);return new e(_,x,[i],[f])}}]),e}(),c1=function(){function e(t,n,i){if(va(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var r=Zp.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};for(var l=r,f=1,a=t.length;fthis.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),l=_)}(r.x!==l.x||r.y!==l.y)&&this.segments.push(Qm.fromRing(l,r,this))}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.interiorRings.push(l)}this.multiPoly=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.polys.push(l)}this.isSubject=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.polys.length;n0&&(t=r)}for(var l=t.segment.prevInResult(),f=l?l.prevInResult():null;;){if(!l)return null;if(!f)return l.ringOut;if(f.ringOut!==l.ringOut)return f.ringOut.enclosingRing()!==l.ringOut?l.ringOut:l.ringOut.enclosingRing();l=f.prevInResult(),f=l?l.prevInResult():null}}}]),e}(),f1=function(){function e(t){va(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Xo(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,i=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Qm.compare;va(this,e),this.queue=t,this.tree=new Ay(n),this.segments=[]}return Xo(e,[{key:"process",value:function(t){var n=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),i;var r=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!r)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var l=r,f=r,a=void 0,_=void 0;a===void 0;)l=this.tree.prev(l),l===null?a=null:l.key.consumedBy===void 0&&(a=l.key);for(;_===void 0;)f=this.tree.next(f),f===null?_=null:f.key.consumedBy===void 0&&(_=f.key);if(t.isLeft){var x=null;if(a){var S=a.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(x=S),!a.isAnEndpoint(S)))for(var L=this._splitSafely(a,S),A=0,k=L.length;A0?(this.tree.remove(n),i.push(t)):(this.segments.push(n),n.prev=a)}else{if(a&&_){var _t=a.getIntersection(_);if(_t!==null){if(!a.isAnEndpoint(_t))for(var ct=this._splitSafely(a,_t),Mt=0,xt=ct.length;Mtp1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var J=new lC(R),it=R.size,ft=R.pop();ft;){var mt=ft.key;if(R.size===it){var _t=mt.segment;throw new Error("Unable to pop() ".concat(mt.isLeft?"left":"right"," SweepEvent ")+"[".concat(mt.point.x,", ").concat(mt.point.y,"] from segment #").concat(_t.id," ")+"[".concat(_t.leftSE.point.x,", ").concat(_t.leftSE.point.y,"] -> ")+"[".concat(_t.rightSE.point.x,", ").concat(_t.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(R.size>p1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(J.segments.length>uC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ct=J.process(mt),Mt=0,xt=ct.length;Mt1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;in[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Dt.prototype.clone=function(){};Dt.prototype.copy=function(){return new Dt(this)};Dt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Dt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return Math.sqrt(t*t+n*n+i*i)};Dt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Dt.prototype.hashCode=function(){var e=17;return e=37*e+Dt.hashCode(this.x),e=37*e+Dt.hashCode(this.y),e};Dt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Dt.prototype.interfaces_=function(){return[vs,vg,bs]};Dt.prototype.getClass=function(){return Dt};Dt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=tn.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Dc.DimensionalComparator.get=function(){return ql};Dc.serialVersionUID.get=function(){return 6683108902428367e3};Dc.NULL_ORDINATE.get=function(){return tn.NaN};Dc.X.get=function(){return 0};Dc.Y.get=function(){return 1};Dc.Z.get=function(){return 2};Object.defineProperties(Dt,Dc);var ql=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new di("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};ql.prototype.compare=function(e,t){var n=e,i=t,r=ql.compare(n.x,i.x);if(r!==0)return r;var l=ql.compare(n.y,i.y);if(l!==0)return l;if(this._dimensionsToTest<=2)return 0;var f=ql.compare(n.z,i.z);return f};ql.prototype.interfaces_=function(){return[Rh]};ql.prototype.getClass=function(){return ql};ql.compare=function(e,t){return et?1:tn.isNaN(e)?tn.isNaN(t)?0:-1:tn.isNaN(t)?1:0};var Oh=function(){};Oh.prototype.create=function(){};Oh.prototype.interfaces_=function(){return[]};Oh.prototype.getClass=function(){return Oh};var zt=function(){},fd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};zt.prototype.interfaces_=function(){return[]};zt.prototype.getClass=function(){return zt};zt.toLocationSymbol=function(e){switch(e){case zt.EXTERIOR:return"e";case zt.BOUNDARY:return"b";case zt.INTERIOR:return"i";case zt.NONE:return"-"}throw new di("Unknown location value: "+e)};fd.INTERIOR.get=function(){return 0};fd.BOUNDARY.get=function(){return 1};fd.EXTERIOR.get=function(){return 2};fd.NONE.get=function(){return-1};Object.defineProperties(zt,fd);var We=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Ho=function(){},xx={LOG_10:{configurable:!0}};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};Ho.log10=function(e){var t=Math.log(e);return tn.isInfinite(t)||tn.isNaN(t)?t:t/Ho.LOG_10};Ho.min=function(e,t,n,i){var r=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],l=arguments[2];return il?l:i}};Ho.wrap=function(e,t){return e<0?t- -e%t:e%t};Ho.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),n>i&&(i=n),i}else if(arguments.length===4){var r=arguments[0],l=arguments[1],f=arguments[2],a=arguments[3],_=r;return l>_&&(_=l),f>_&&(_=f),a>_&&(_=a),_}};Ho.average=function(e,t){return(e+t)/2};xx.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Ho,xx);var ba=function(e){this.str=e};ba.prototype.append=function(e){this.str+=e};ba.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};ba.prototype.toString=function(e){return this.str};var la=function(e){this.value=e};la.prototype.intValue=function(){return this.value};la.prototype.compareTo=function(e){return this.valuee?1:0};la.isNaN=function(e){return Number.isNaN(e)};var Wp=function(){};Wp.isWhitespace=function(e){return e<=32&&e>=0||e===127};Wp.toUpperCase=function(e){return e.toUpperCase()};var Ut=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var i=arguments[0];e.call(this,e.parse(i))}}else if(arguments.length===2){var r=arguments[0],l=arguments[1];this.init(r,l)}},Bs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Ut.prototype.le=function(e){return(this._hi9?(S=!0,L="9"):L="0"+x,f.append(L),n=n.subtract(Ut.valueOf(x)).multiply(Ut.TEN),S&&n.selfAdd(Ut.TEN);var A=!0,k=Ut.magnitude(n._hi);if(k<0&&Math.abs(k)>=a-_&&(A=!1),!A)break}return t[0]=i,f.toString()};Ut.prototype.sqr=function(){return this.multiply(this)};Ut.prototype.doubleValue=function(){return this._hi+this._lo};Ut.prototype.subtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};Ut.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};Ut.prototype.isZero=function(){return this._hi===0&&this._lo===0};Ut.prototype.selfSubtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};Ut.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Ut.prototype.min=function(e){return this.le(e)?this:e};Ut.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,l=null,f=null,a=null,_=null,x=null,S=null,L=null;return _=this._hi/n,x=Ut.SPLIT*_,r=x-_,L=Ut.SPLIT*n,r=x-r,l=_-r,f=L-n,S=_*n,f=L-f,a=n-f,L=r*f-S+r*a+l*f+l*a,x=(this._hi-S-L+this._lo-_*i)/n,L=_+x,this._hi=L,this._lo=_-L+x,this}};Ut.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Ut.prototype.divide=function(){if(arguments[0]instanceof Ut){var e=arguments[0],t=null,n=null,i=null,r=null,l=null,f=null,a=null,_=null;l=this._hi/e._hi,f=Ut.SPLIT*l,t=f-l,_=Ut.SPLIT*e._hi,t=f-t,n=l-t,i=_-e._hi,a=l*e._hi,i=_-i,r=e._hi-i,_=t*i-a+t*r+n*i+n*r,f=(this._hi-a-_+this._lo-l*e._lo)/e._hi,_=l+f;var x=_,S=l-_+f;return new Ut(x,S)}else if(typeof arguments[0]=="number"){var L=arguments[0];return tn.isNaN(L)?Ut.createNaN():Ut.copy(this).selfDivide(L,0)}};Ut.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};Ut.prototype.pow=function(e){if(e===0)return Ut.valueOf(1);var t=new Ut(this),n=Ut.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(t),i/=2,i>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};Ut.prototype.ceil=function(){if(this.isNaN())return Ut.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new Ut(e,t)};Ut.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};Ut.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};Ut.prototype.setValue=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};Ut.prototype.max=function(e){return this.ge(e)?this:e};Ut.prototype.sqrt=function(){if(this.isZero())return Ut.valueOf(0);if(this.isNegative())return Ut.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=Ut.valueOf(t),i=this.subtract(n.sqr()),r=i._hi*(e*.5);return n.add(r)};Ut.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,r=null,l=null,f=null,a=null;return r=this._hi+t,f=r-this._hi,l=r-f,l=t-f+(this._hi-l),a=l+this._lo,n=r+a,i=a+(r-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var _=arguments[0],x=arguments[1],S=null,L=null,A=null,k=null,R=null,U=null,j=null,Q=null;R=this._hi+_,A=this._lo+x,j=R-this._hi,Q=A-this._lo,U=R-j,k=A-Q,U=_-j+(this._hi-U),k=x-Q+(this._lo-k),j=U+A,S=R+j,L=j+(R-S),j=k+L;var B=S+j,X=j+(S-B);return this._hi=B,this._lo=X,this}};Ut.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,l=null,f=null,a=null,_=null,x=null;_=Ut.SPLIT*this._hi,r=_-this._hi,x=Ut.SPLIT*n,r=_-r,l=this._hi-r,f=x-n,_=this._hi*n,f=x-f,a=n-f,x=r*f-_+r*a+l*f+l*a+(this._hi*i+this._lo*n);var S=_+x;r=_-S;var L=x+r;return this._hi=S,this._lo=L,this}};Ut.prototype.selfSqr=function(){return this.selfMultiply(this)};Ut.prototype.floor=function(){if(this.isNaN())return Ut.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new Ut(e,t)};Ut.prototype.negate=function(){return this.isNaN()?this:new Ut(-this._hi,-this._lo)};Ut.prototype.clone=function(){};Ut.prototype.multiply=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return e.isNaN()?Ut.createNaN():Ut.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return tn.isNaN(t)?Ut.createNaN():Ut.copy(this).selfMultiply(t,0)}};Ut.prototype.isNaN=function(){return tn.isNaN(this._hi)};Ut.prototype.intValue=function(){return Math.trunc(this._hi)};Ut.prototype.toString=function(){var e=Ut.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};Ut.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[0]+1,r=n;if(n.charAt(0)===".")r="0"+n;else if(i<0)r="0."+Ut.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var l=i-n.length,f=Ut.stringOfChar("0",l);r=n+f+".0"}return this.isNegative()?"-"+r:r};Ut.prototype.reciprocal=function(){var e=null,t=null,n=null,i=null,r=null,l=null,f=null,a=null;r=1/this._hi,l=Ut.SPLIT*r,e=l-r,a=Ut.SPLIT*this._hi,e=l-e,t=r-e,n=a-this._hi,f=r*this._hi,n=a-n,i=this._hi-n,a=e*n-f+e*i+t*n+t*i,l=(1-f-a-r*this._lo)/this._hi;var _=r+l,x=r-_+l;return new Ut(_,x)};Ut.prototype.toSciNotation=function(){if(this.isZero())return Ut.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=Ut.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var l=n.charAt(0)+"."+r;return this.isNegative()?"-"+l+i:l+i};Ut.prototype.abs=function(){return this.isNaN()?Ut.NaN:this.isNegative()?this.negate():new Ut(this)};Ut.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Ut.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};Ut.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Ut.prototype.trunc=function(){return this.isNaN()?Ut.NaN:this.isPositive()?this.floor():this.ceil()};Ut.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Ut.prototype.interfaces_=function(){return[bs,vs,vg]};Ut.prototype.getClass=function(){return Ut};Ut.sqr=function(e){return Ut.valueOf(e).selfMultiply(e)};Ut.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return Ut.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new Ut(t)}};Ut.sqrt=function(e){return Ut.valueOf(e).sqrt()};Ut.parse=function(e){for(var t=0,n=e.length;Wp.isWhitespace(e.charAt(t));)t++;var i=!1;if(t=n);){var x=e.charAt(t);if(t++,Wp.isDigit(x)){var S=x-"0";l.selfMultiply(Ut.TEN),l.selfAdd(S),f++;continue}if(x==="."){a=f;continue}if(x==="e"||x==="E"){var L=e.substring(t);try{_=la.parseInt(L)}catch(j){throw j instanceof Error?new Error("Invalid exponent "+L+" in string "+e):j}finally{}break}throw new Error("Unexpected character '"+x+"' at position "+t+" in string "+e)}var A=l,k=f-a-_;if(k===0)A=l;else if(k>0){var R=Ut.TEN.pow(k);A=l.divide(R)}else if(k<0){var U=Ut.TEN.pow(-k);A=l.multiply(U)}return i?A.negate():A};Ut.createNaN=function(){return new Ut(tn.NaN,tn.NaN)};Ut.copy=function(e){return new Ut(e)};Ut.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n)),r=Math.pow(10,i);return r*10<=t&&(i+=1),i};Ut.stringOfChar=function(e,t){for(var n=new ba,i=0;i0){if(l<=0)return po.signum(f);i=r+l}else if(r<0){if(l>=0)return po.signum(f);i=-r-l}else return po.signum(f);var a=po.DP_SAFE_EPSILON*i;return f>=a||-f>=a?po.signum(f):2};po.signum=function(e){return e>0?1:e<0?-1:0};wx.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(po,wx);var Mn=function(){},pd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};pd.X.get=function(){return 0};pd.Y.get=function(){return 1};pd.Z.get=function(){return 2};pd.M.get=function(){return 3};Mn.prototype.setOrdinate=function(e,t,n){};Mn.prototype.size=function(){};Mn.prototype.getOrdinate=function(e,t){};Mn.prototype.getCoordinate=function(){};Mn.prototype.getCoordinateCopy=function(e){};Mn.prototype.getDimension=function(){};Mn.prototype.getX=function(e){};Mn.prototype.clone=function(){};Mn.prototype.expandEnvelope=function(e){};Mn.prototype.copy=function(){};Mn.prototype.getY=function(e){};Mn.prototype.toCoordinateArray=function(){};Mn.prototype.interfaces_=function(){return[vg]};Mn.prototype.getClass=function(){return Mn};Object.defineProperties(Mn,pd);var Sx=function(){},af=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Sx),Lr=function(){};Lr.arraycopy=function(e,t,n,i,r){for(var l=0,f=t;fe._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,i=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}};Oe.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Oe){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}};Oe.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};Oe.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Oe.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Oe.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Oe.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Oe.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Oe.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Oe.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Oe){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Dt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}};Oe.prototype.centre=function(){return this.isNull()?null:new Dt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Oe.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Dt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Oe){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var r=arguments[0],l=arguments[1],f=arguments[2],a=arguments[3];re._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};Oe.prototype.hashCode=function(){var e=17;return e=37*e+Dt.hashCode(this._minx),e=37*e+Dt.hashCode(this._maxx),e=37*e+Dt.hashCode(this._miny),e=37*e+Dt.hashCode(this._maxy),e};Oe.prototype.interfaces_=function(){return[vs,bs]};Oe.prototype.getClass=function(){return Oe};Oe.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var i=arguments[0],r=arguments[1],l=arguments[2],f=arguments[3],a=Math.min(l.x,f.x),_=Math.max(l.x,f.x),x=Math.min(i.x,r.x),S=Math.max(i.x,r.x);return!(x>_||S_)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};vi.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};vi.prototype.setPrecisionModel=function(e){this._precisionModel=e};vi.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;nr?l=i:l=r;else{var f=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);i>r?l=f:l=a,l===0&&!e.equals(t)&&(l=Math.max(f,a))}return an.isTrue(!(l===0&&!e.equals(t)),"Bad distance calculation"),l};vi.nonRobustComputeEdgeDistance=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,l=Math.sqrt(i*i+r*r);return an.isTrue(!(l===0&&!e.equals(t)),"Invalid distance calculation"),l};Rc.DONT_INTERSECT.get=function(){return 0};Rc.DO_INTERSECT.get=function(){return 1};Rc.COLLINEAR.get=function(){return 2};Rc.NO_INTERSECTION.get=function(){return 0};Rc.POINT_INTERSECTION.get=function(){return 1};Rc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(vi,Rc);var qu=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var i=new Oe(this._inputLines[0][0],this._inputLines[0][1]),r=new Oe(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&r.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];if(this._isProper=!1,Oe.intersects(i,r,n)&&ve.orientationIndex(i,r,n)===0&&ve.orientationIndex(r,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(r))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,i,r,l,f){f.x=this.smallestInAbsValue(n.x,i.x,r.x,l.x),f.y=this.smallestInAbsValue(n.y,i.y,r.y,l.y),n.x-=f.x,n.y-=f.y,i.x-=f.x,i.y-=f.y,r.x-=f.x,r.y-=f.y,l.x-=f.x,l.y-=f.y},t.prototype.safeHCoordinateIntersection=function(n,i,r,l){var f=null;try{f=Ps.intersection(n,i,r,l)}catch(a){if(a instanceof af)f=t.nearestEndpoint(n,i,r,l);else throw a}finally{}return f},t.prototype.intersection=function(n,i,r,l){var f=this.intersectionWithNormalization(n,i,r,l);return this.isInSegmentEnvelopes(f)||(f=new Dt(t.nearestEndpoint(n,i,r,l))),this._precisionModel!==null&&this._precisionModel.makePrecise(f),f},t.prototype.smallestInAbsValue=function(n,i,r,l){var f=n,a=Math.abs(f);return Math.abs(i)1e-4&&Lr.out.println("Distance = "+f.distance(a))},t.prototype.intersectionWithNormalization=function(n,i,r,l){var f=new Dt(n),a=new Dt(i),_=new Dt(r),x=new Dt(l),S=new Dt;this.normalizeToEnvCentre(f,a,_,x,S);var L=this.safeHCoordinateIntersection(f,a,_,x);return L.x+=S.x,L.y+=S.y,L},t.prototype.computeCollinearIntersection=function(n,i,r,l){var f=Oe.intersects(n,i,r),a=Oe.intersects(n,i,l),_=Oe.intersects(r,l,n),x=Oe.intersects(r,l,i);return f&&a?(this._intPt[0]=r,this._intPt[1]=l,e.COLLINEAR_INTERSECTION):_&&x?(this._intPt[0]=n,this._intPt[1]=i,e.COLLINEAR_INTERSECTION):f&&_?(this._intPt[0]=r,this._intPt[1]=n,r.equals(n)&&!a&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):f&&x?(this._intPt[0]=r,this._intPt[1]=i,r.equals(i)&&!a&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&_?(this._intPt[0]=l,this._intPt[1]=n,l.equals(n)&&!f&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&x?(this._intPt[0]=l,this._intPt[1]=i,l.equals(i)&&!f&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,i,r,l,f){var a=n.xi.x?n.x:i.x,S=n.y>i.y?n.y:i.y,L=r.xl.x?r.x:l.x,R=r.y>l.y?r.y:l.y,U=a>L?a:L,j=xA?_:A,B=S0&&a>0||f<0&&a<0)return e.NO_INTERSECTION;var _=ve.orientationIndex(r,l,n),x=ve.orientationIndex(r,l,i);if(_>0&&x>0||_<0&&x<0)return e.NO_INTERSECTION;var S=f===0&&a===0&&_===0&&x===0;return S?this.computeCollinearIntersection(n,i,r,l):(f===0||a===0||_===0||x===0?(this._isProper=!1,n.equals2D(r)||n.equals2D(l)?this._intPt[0]=n:i.equals2D(r)||i.equals2D(l)?this._intPt[0]=i:f===0?this._intPt[0]=new Dt(r):a===0?this._intPt[0]=new Dt(l):_===0?this._intPt[0]=new Dt(n):x===0&&(this._intPt[0]=new Dt(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,r,l)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,i,r,l){var f=n,a=ve.distancePointLine(n,r,l),_=ve.distancePointLine(i,r,l);return _0?n>0?-r:r:n>0?r:-r;if(t===0||n===0)return i>0?e>0?r:-r:e>0?-r:r;if(t>0?i>0?t<=i||(r=-r,l=e,e=n,n=l,l=t,t=i,i=l):t<=-i?(r=-r,n=-n,i=-i):(l=e,e=-n,n=l,l=t,t=-i,i=l):i>0?-t<=i?(r=-r,e=-e,t=-t):(l=-e,e=n,n=l,l=-t,t=i,i=l):t>=i?(e=-e,t=-t,n=-n,i=-i):(r=-r,l=-e,e=-n,n=l,l=-t,t=-i,i=l),e>0)if(n>0){if(!(e<=n))return r}else return r;else{if(n>0)return-r;if(e>=n)r=-r,e=-e,n=-n;else return-r}for(;;){if(f=Math.floor(n/e),n=n-f*e,i=i-f*t,i<0)return-r;if(i>t)return r;if(e>n+n){if(ti+i)return-r;n=e-n,i=t-i,r=-r}if(i===0)return n===0?0:-r;if(n===0||(f=Math.floor(e/n),e=e-f*n,t=t-f*i,t<0))return r;if(t>i)return-r;if(n>e+e){if(it+t)return r;e=n-e,t=i-t,r=-r}if(t===0)return e===0?0:r;if(e===0)return-r}};var ra=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};ra.prototype.countSegment=function(e,t){if(e.xi&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var r=e.x-this._p.x,l=e.y-this._p.y,f=t.x-this._p.x,a=t.y-this._p.y,_=bc.signOfDet2x2(r,l,f,a);if(_===0)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}};ra.prototype.isPointInPolygon=function(){return this.getLocation()!==zt.EXTERIOR};ra.prototype.getLocation=function(){return this._isPointOnSegment?zt.BOUNDARY:this._crossingCount%2===1?zt.INTERIOR:zt.EXTERIOR};ra.prototype.isOnSegment=function(){return this._isPointOnSegment};ra.prototype.interfaces_=function(){return[]};ra.prototype.getClass=function(){return ra};ra.locatePointInRing=function(){if(arguments[0]instanceof Dt&&We(arguments[1],Mn)){for(var e=arguments[0],t=arguments[1],n=new ra(e),i=new Dt,r=new Dt,l=1;l1||_<0||_>1)&&(r=!0)}}return r?Ho.min(ve.distancePointLine(e,n,i),ve.distancePointLine(t,n,i),ve.distancePointLine(n,e,t),ve.distancePointLine(i,e,t)):0};ve.isPointInRing=function(e,t){return ve.locatePointInRing(e,t)!==zt.EXTERIOR};ve.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new Dt;e.getCoordinate(0,i);for(var r=i.x,l=i.y,f=1;fn.y&&(n=l,i=r)}var f=i;do f=f-1,f<0&&(f=t);while(e[f].equals2D(n)&&f!==i);var a=i;do a=(a+1)%t;while(e[a].equals2D(n)&&a!==i);var _=e[f],x=e[a];if(_.equals2D(n)||x.equals2D(n)||_.equals2D(x))return!1;var S=ve.computeOrientation(_,n,x),L=!1;return S===0?L=_.x>x.x:L=S>0,L};ve.locatePointInRing=function(e,t){return ra.locatePointInRing(e,t)};ve.distancePointLinePerpendicular=function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),r=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(r)*Math.sqrt(i)};ve.computeOrientation=function(e,t,n){return ve.orientationIndex(e,t,n)};ve.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new di("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i=1)return l.distance(a);var S=((f.y-l.y)*(a.x-f.x)-(f.x-l.x)*(a.y-f.y))/_;return Math.abs(S)*Math.sqrt(_)}};ve.isOnLine=function(e,t){for(var n=new qu,i=1;i0};Fh.prototype.interfaces_=function(){return[gs]};Fh.prototype.getClass=function(){return Fh};var Bh=function(){};Bh.prototype.isInBoundary=function(e){return e>1};Bh.prototype.interfaces_=function(){return[gs]};Bh.prototype.getClass=function(){return Bh};var Vh=function(){};Vh.prototype.isInBoundary=function(e){return e===1};Vh.prototype.interfaces_=function(){return[gs]};Vh.prototype.getClass=function(){return Vh};var Ji=function(){};Ji.prototype.add=function(){};Ji.prototype.addAll=function(){};Ji.prototype.isEmpty=function(){};Ji.prototype.iterator=function(){};Ji.prototype.size=function(){};Ji.prototype.toArray=function(){};Ji.prototype.remove=function(){};function Dy(e){this.message=e||""}Dy.prototype=new Error;Dy.prototype.name="IndexOutOfBoundsException";var lf=function(){};lf.prototype.hasNext=function(){};lf.prototype.next=function(){};lf.prototype.remove=function(){};var ks=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Ji);function uf(e){this.message=e||""}uf.prototype=new Error;uf.prototype.name="NoSuchElementException";var he=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Ji&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Ji]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var i=this,r=n.iterator();r.hasNext();)i.add(r.next());return!0},t.prototype.set=function(n,i){var r=this.array_[n];return this.array_[n]=i,r},t.prototype.iterator=function(){return new bC(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Dy;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,i=[],r=0,l=this.array_.length;r=1){var x=this.get(this.size()-1);if(x.equals2D(a))return null}e.prototype.add.call(this,a)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],L=arguments[1];return this.add(S,L),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var A=arguments[0],k=arguments[1],R=arguments[2];if(R)for(var U=0;U=0;j--)i.add(A[j],k);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Dt){var Q=arguments[0],B=arguments[1],X=arguments[2];if(!X){var J=this.size();if(J>0){if(Q>0){var it=this.get(Q-1);if(it.equals2D(B))return null}if(QMt&&(xt=-1);for(var vt=ct;vt!==Mt;vt+=xt)i.add(mt[vt],_t);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Dt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(he),gn=function(){},xg={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};xg.ForwardComparator.get=function(){return Xp};xg.BidirectionalComparator.get=function(){return Uh};xg.coordArrayType.get=function(){return new Array(0).fill(null)};gn.prototype.interfaces_=function(){return[]};gn.prototype.getClass=function(){return gn};gn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};gn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};gn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};gn.extract=function(e,t,n){t=Ho.clamp(t,0,e.length),n=Ho.clamp(n,-1,e.length);var i=n-t+1;n<0&&(i=0),t>=e.length&&(i=0),ni.length)return 1;if(n.length===0)return 0;var r=gn.compare(n,i),l=gn.isEqualReversed(n,i);return l?0:r};Uh.prototype.OLDcompare=function(e,t){var n=e,i=t;if(n.lengthi.length)return 1;if(n.length===0)return 0;for(var r=gn.increasingDirection(n),l=gn.increasingDirection(i),f=r>0?0:n.length-1,a=l>0?0:n.length-1,_=0;_0)t=t.right;else return t.value}return null};Ur.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,i,r;do if(i=n,r=e.compareTo(n.key),r<0)n=n.left;else if(r>0)n=n.right;else{var l=n.value;return n.value=t,l}while(n!==null);var f={key:e,left:null,right:null,value:t,parent:i,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?i.left=f:i.right=f,this.fixAfterInsertion(f),this.size_++,null};Ur.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=Iu;e!=null&&e!==this.root_&&e.parent.color===Iu;)if(ti(e)===H_(ti(ti(e)))){var n=_1(ti(ti(e)));g1(n)===Iu?(rl(ti(e),ul),rl(n,ul),rl(ti(ti(e)),Iu),e=ti(ti(e))):(e===_1(ti(e))&&(e=ti(e),t.rotateLeft(e)),rl(ti(e),ul),rl(ti(ti(e)),Iu),t.rotateRight(ti(ti(e))))}else{var i=H_(ti(ti(e)));g1(i)===Iu?(rl(ti(e),ul),rl(i,ul),rl(ti(ti(e)),Iu),e=ti(ti(e))):(e===H_(ti(e))&&(e=ti(e),t.rotateRight(e)),rl(ti(e),ul),rl(ti(ti(e)),Iu),t.rotateLeft(ti(ti(e))))}this.root_.color=ul};Ur.prototype.values=function(){var e=new he,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Ur.successor(t))!==null;)e.add(t.value);return e};Ur.prototype.entrySet=function(){var e=new Ry,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Ur.successor(t))!==null;)e.add(t);return e};Ur.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Ur.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Ur.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Ur.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,i=e;n!==null&&i===n.right;)i=n,n=n.parent;return n}};Ur.prototype.size=function(){return this.size_};var Hp=function(){};Hp.prototype.interfaces_=function(){return[]};Hp.prototype.getClass=function(){return Hp};function Ix(){}Ix.prototype=new wg;function ua(){this.array_=[],arguments[0]instanceof Ji&&this.addAll(arguments[0])}ua.prototype=new Ix;ua.prototype.contains=function(e){for(var t=this,n=0,i=this.array_.length;n=0;){var f=r.substring(0,l);i.add(f),r=r.substring(l+n),l=r.indexOf(t)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),_=0;_0)for(var l=r;l0&&i.append(" ");for(var l=0;l0&&i.append(","),i.append(ds.toString(e.getOrdinate(r,l)))}return i.append(")"),i.toString()}};Oi.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Oi.createClosedRing(e,t,4);var i=t.getOrdinate(0,Mn.X)===t.getOrdinate(n-1,Mn.X)&&t.getOrdinate(0,Mn.Y)===t.getOrdinate(n-1,Mn.Y);return i?t:Oi.createClosedRing(e,t,n+1)};Oi.createClosedRing=function(e,t,n){var i=e.create(n,t.getDimension()),r=t.size();Oi.copy(t,0,i,0,r);for(var l=r;l0&&Oi.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?An.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return ve.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();Oi.reverse(i);var r=this.getFactory().createLineString(i);return r},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var r=arguments[0],l=r,f=0,a=0;f= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var r=this,l=0;l=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(Mi),Oa=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Ze.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],r=arguments[1];return this.isEquivalentClass(i)?e.prototype.equalsExact.call(this,i,r):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,r=this._geometries.length,l=new Array(r).fill(null),f=0;f0?t.createPoint(n[0]):t.createPoint():e};Jp.prototype.interfaces_=function(){return[_s.GeometryEditorOperation]};Jp.prototype.getClass=function(){return Jp};var Qp=function(){};Qp.prototype.edit=function(e,t){return e instanceof Ba?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof Mi?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Mo?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Qp.prototype.interfaces_=function(){return[_s.GeometryEditorOperation]};Qp.prototype.getClass=function(){return Qp};var Di=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new ba(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(i=3),i<2?new Di(n):new Di(n,i)}};Va.prototype.interfaces_=function(){return[Oh,bs]};Va.prototype.getClass=function(){return Va};Va.instance=function(){return Va.instanceObject};zy.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};zy.instanceObject.get=function(){return new Va};Object.defineProperties(Va,zy);var Tx=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,i){return this.map_.set(n,i),i},t.prototype.values=function(){for(var n=new he,i=this.map_.values(),r=i.next();!r.done;)n.add(r.value),r=i.next();return n},t.prototype.entrySet=function(){var n=new Ry;return this.map_.entries().forEach(function(i){return n.add(i)}),n},t.prototype.size=function(){return this.map_.size()},t}(zc),Dn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ha){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}},Fy={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Dn.prototype.equals=function(e){if(!(e instanceof Dn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Dn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return new la(n).compareTo(new la(i))};Dn.prototype.getScale=function(){return this._scale};Dn.prototype.isFloating=function(){return this._modelType===Dn.FLOATING||this._modelType===Dn.FLOATING_SINGLE};Dn.prototype.getType=function(){return this._modelType};Dn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Dn.FLOATING?e="Floating":this._modelType===Dn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Dn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Dn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(tn.isNaN(e))return e;if(this._modelType===Dn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Dn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Dt){var n=arguments[0];if(this._modelType===Dn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Dn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Dn.FLOATING?e=16:this._modelType===Dn.FLOATING_SINGLE?e=6:this._modelType===Dn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Dn.prototype.setScale=function(e){this._scale=Math.abs(e)};Dn.prototype.interfaces_=function(){return[bs,vs]};Dn.prototype.getClass=function(){return Dn};Dn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};Fy.serialVersionUID.get=function(){return 7777263578777804e3};Fy.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Dn,Fy);var ha=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},By={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ha.prototype.readResolve=function(){return ha.nameToTypeMap.get(this._name)};ha.prototype.toString=function(){return this._name};ha.prototype.interfaces_=function(){return[bs]};ha.prototype.getClass=function(){return ha};By.serialVersionUID.get=function(){return-552860263173159e4};By.nameToTypeMap.get=function(){return new Tx};Object.defineProperties(ha,By);Dn.Type=ha;Dn.FIXED=new ha("FIXED");Dn.FLOATING=new ha("FLOATING");Dn.FLOATING_SINGLE=new ha("FLOATING SINGLE");var mn=function e(){this._precisionModel=new Dn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?We(arguments[0],Oh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Dn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Lx={serialVersionUID:{configurable:!0}};mn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Dt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Dt(e.getMinX(),e.getMinY()),new Dt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Dt(e.getMinX(),e.getMinY()),new Dt(e.getMinX(),e.getMaxY()),new Dt(e.getMaxX(),e.getMaxY()),new Dt(e.getMaxX(),e.getMinY()),new Dt(e.getMinX(),e.getMinY())]),null)};mn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new Mi(this.getCoordinateSequenceFactory().create(e),this);if(We(e,Mn))return new Mi(e,this)}else return new Mi(this.getCoordinateSequenceFactory().create([]),this)};mn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ru(null,this);if(arguments.length===1){var e=arguments[0];return new Ru(e,this)}};mn.prototype.buildGeometry=function(e){for(var t=null,n=!1,i=!1,r=e.iterator();r.hasNext();){var l=r.next(),f=l.getClass();t===null&&(t=f),f!==t&&(n=!0),l.isGeometryCollectionOrDerived()&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(mn.toGeometryArray(e));var a=e.iterator().next(),_=e.size()>1;if(_){if(a instanceof er)return this.createMultiPolygon(mn.toPolygonArray(e));if(a instanceof Mi)return this.createMultiLineString(mn.toLineStringArray(e));if(a instanceof Mo)return this.createMultiPoint(mn.toPointArray(e));an.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a};mn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};mn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Dt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(We(arguments[0],Mn)){var t=arguments[0];return new Mo(t,this)}}};mn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};mn.prototype.createPolygon=function(){if(arguments.length===0)return new er(null,null,this);if(arguments.length===1){if(We(arguments[0],Mn)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ba){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],r=arguments[1];return new er(i,r,this)}};mn.prototype.getSRID=function(){return this._SRID};mn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new eo(null,this);if(arguments.length===1){var e=arguments[0];return new eo(e,this)}};mn.prototype.createGeometry=function(e){var t=new _s(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};mn.prototype.getPrecisionModel=function(){return this._precisionModel};mn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(We(arguments[0],Mn)){var t=arguments[0];return new Ba(t,this)}}};mn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Oa(null,this);if(arguments.length===1){var e=arguments[0];return new Oa(e,this)}};mn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new Gh(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Gh(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(We(arguments[0],Mn)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(i.size()).fill(null),l=0;l=this.size())throw new Error;return this.array_[e]};xa.prototype.push=function(e){return this.array_.push(e),e};xa.prototype.pop=function(e){if(this.array_.length===0)throw new Tg;return this.array_.pop()};xa.prototype.peek=function(){if(this.array_.length===0)throw new Tg;return this.array_[this.array_.length-1]};xa.prototype.empty=function(){return this.array_.length===0};xa.prototype.isEmpty=function(){return this.empty()};xa.prototype.search=function(e){return this.array_.indexOf(e)};xa.prototype.size=function(){return this.array_.length};xa.prototype.toArray=function(){for(var e=this,t=[],n=0,i=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===ve.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)};fa.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),i=n.getCoordinates();if(t<0||t+1>=i.length||i[t].y===i[t+1].y)return-1;var r=re.LEFT;return i[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=i,t._minCoord=n[i])};fa.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};fa.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var i=n.next();i.isForward()&&t.checkForRightmostCoordinate(i)}an.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var r=this.getRightmostSide(this._minDe,this._minIndex);r===re.LEFT&&(this._orientedDe=this._minDe.getSym())};fa.prototype.interfaces_=function(){return[]};fa.prototype.getClass=function(){return fa};var ml=function(e){function t(n,i){e.call(this,t.msgWithCoord(n,i)),this.pt=i?new Dt(i):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},t}(pl),Lg=function(){this.array_=[]};Lg.prototype.addLast=function(e){this.array_.push(e)};Lg.prototype.removeFirst=function(){return this.array_.shift()};Lg.prototype.isEmpty=function(){return this.array_.length===0};var no=function(){this._finder=null,this._dirEdgeList=new he,this._nodes=new he,this._rightMostCoord=null,this._env=null,this._finder=new fa};no.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};no.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};no.prototype.computeNodeDepth=function(e){for(var t=this,n=null,i=e.getEdges().iterator();i.hasNext();){var r=i.next();if(r.isVisited()||r.getSym().isVisited()){n=r;break}}if(n===null)throw new ml("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var l=e.getEdges().iterator();l.hasNext();){var f=l.next();f.setVisited(!0),t.copySymDepths(f)}};no.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(re.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};no.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};no.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(re.RIGHT)>=1&&t.getDepth(re.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};no.prototype.computeDepths=function(e){var t=this,n=new Ry,i=new Lg,r=e.getNode();for(i.addLast(r),n.add(r),e.setVisited(!0);!i.isEmpty();){var l=i.removeFirst();n.add(l),t.computeNodeDepth(l);for(var f=l.getEdges().iterator();f.hasNext();){var a=f.next(),_=a.getSym();if(!_.isVisited()){var x=_.getNode();n.contains(x)||(i.addLast(x),n.add(x))}}}};no.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};no.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Oe,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),i=n.getEdge().getCoordinates(),r=0;rthis.location.length){var n=new Array(3).fill(null);n[re.ON]=this.location[re.ON],n[re.LEFT]=zt.NONE,n[re.RIGHT]=zt.NONE,this.location=n}for(var i=0;i1&&e.append(zt.toLocationSymbol(this.location[re.LEFT])),e.append(zt.toLocationSymbol(this.location[re.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[re.RIGHT])),e.toString()};ei.prototype.setLocations=function(e,t,n){this.location[re.ON]=e,this.location[re.LEFT]=t,this.location[re.RIGHT]=n};ei.prototype.get=function(e){return e1};ei.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=i),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};Zi.prototype.addPoints=function(e,t,n){var i=this,r=e.getCoordinates();if(t){var l=1;n&&(l=0);for(var f=l;f=0;_--)i._pts.add(r[_])}};Zi.prototype.isHole=function(){return this._isHole};Zi.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Zi.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!ve.isPointInRing(e,t.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var r=i.next();if(r.containsPoint(e))return!1}return!0};Zi.prototype.addHole=function(e){this._holes.add(e)};Zi.prototype.isShell=function(){return this._shell===null};Zi.prototype.getLabel=function(){return this._label};Zi.prototype.getEdges=function(){return this._edges};Zi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Zi.prototype.getShell=function(){return this._shell};Zi.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,re.RIGHT);if(i===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,i),null}};Zi.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Zi.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(e)};Yo.prototype.isInResult=function(){return this._isInResult};Yo.prototype.isVisited=function(){return this._isVisited};Yo.prototype.interfaces_=function(){return[]};Yo.prototype.getClass=function(){return Yo};var Mg=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new Un(0,zt.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,i){var r=zt.NONE;if(r=this._label.getLocation(i),!n.isNull(i)){var l=n.getLocation(i);r!==zt.BOUNDARY&&(r=l)}return r},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new Un(n,i):this._label.setLocation(n,i)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Un)for(var r=arguments[0],l=0;l<2;l++){var f=n.computeMergedLocation(r,l),a=n._label.getLocation(l);a===zt.NONE&&n._label.setLocation(l,f)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=zt.NONE;this._label!==null&&(i=this._label.getLocation(n));var r=null;switch(i){case zt.BOUNDARY:r=zt.INTERIOR;break;case zt.INTERIOR:r=zt.BOUNDARY;break;default:r=zt.BOUNDARY;break}this._label.setLocation(n,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Yo),pa=function(){this.nodeMap=new Ur,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};pa.prototype.find=function(e){return this.nodeMap.get(e)};pa.prototype.addNode=function(){if(arguments[0]instanceof Dt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof Mg){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}};pa.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};pa.prototype.iterator=function(){return this.nodeMap.values().iterator()};pa.prototype.values=function(){return this.nodeMap.values()};pa.prototype.getBoundaryNodes=function(e){for(var t=new he,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===zt.BOUNDARY&&t.add(i)}return t};pa.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};pa.prototype.interfaces_=function(){return[]};pa.prototype.getClass=function(){return pa};var Wn=function(){},gd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Wn.prototype.interfaces_=function(){return[]};Wn.prototype.getClass=function(){return Wn};Wn.isNorthern=function(e){return e===Wn.NE||e===Wn.NW};Wn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Wn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var i=et?e:t;return i===0&&r===3?3:i};Wn.isInHalfPlane=function(e,t){return t===Wn.SE?e===Wn.SE||e===Wn.SW:e===t||e===t+1};Wn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new di("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Wn.NE:Wn.SE:t>=0?Wn.NW:Wn.SW}else if(arguments[0]instanceof Dt&&arguments[1]instanceof Dt){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new di("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Wn.NE:Wn.SE:i.y>=n.y?Wn.NW:Wn.SW}};gd.NE.get=function(){return 0};gd.NW.get=function(){return 1};gd.SW.get=function(){return 2};gd.SE.get=function(){return 3};Object.defineProperties(Wn,gd);var Gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=null;this._edge=t,this.init(n,i),this._label=r}else if(arguments.length===4){var l=arguments[0],f=arguments[1],a=arguments[2],_=arguments[3];this._edge=l,this.init(f,a),this._label=_}};Gr.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){f.linkDirectedEdgesForMinimalEdgeRings();var a=f.buildMinimalRings(),_=i.findShell(a);_!==null?(i.placePolygonHoles(_,a),t.add(_)):n.addAll(a)}else r.add(f)}return r};Po.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Po.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new he,i=e.iterator();i.hasNext();){var r=i.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var l=new kC(r,t._geometryFactory);n.add(l),l.setInResult()}}return n};Po.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}};Po.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Po.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),l=null,f=null,a=t.iterator();a.hasNext();){var _=a.next(),x=_.getLinearRing(),S=x.getEnvelopeInternal();l!==null&&(f=l.getLinearRing().getEnvelopeInternal());var L=!1;S.contains(i)&&ve.isPointInRing(r,x.getCoordinates())&&(L=!0),L&&(l===null||f.contains(S))&&(l=_)}return l};Po.prototype.findShell=function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,t++)}return an.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Po.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];bi.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),r=new he,l=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(l,this._shellList,r),this.placeFreeHoles(this._shellList,r)}};Po.prototype.interfaces_=function(){return[]};Po.prototype.getClass=function(){return Po};var qh=function(){};qh.prototype.getBounds=function(){};qh.prototype.interfaces_=function(){return[]};qh.prototype.getClass=function(){return qh};var Ds=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Ds.prototype.getItem=function(){return this._item};Ds.prototype.getBounds=function(){return this._bounds};Ds.prototype.interfaces_=function(){return[qh,bs]};Ds.prototype.getClass=function(){return Ds};var gl=function(){this._size=null,this._items=null,this._size=0,this._items=new he,this._items.add(null)};gl.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};gl.prototype.size=function(){return this._size};gl.prototype.reorder=function(e){for(var t=this,n=null,i=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(i)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,i)};gl.prototype.clear=function(){this._size=0,this._items.clear()};gl.prototype.isEmpty=function(){return this._size===0};gl.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};gl.prototype.interfaces_=function(){return[]};gl.prototype.getClass=function(){return gl};var Yl=function(){};Yl.prototype.visitItem=function(e){};Yl.prototype.interfaces_=function(){return[]};Yl.prototype.getClass=function(){return Yl};var xc=function(){};xc.prototype.insert=function(e,t){};xc.prototype.remove=function(e,t){};xc.prototype.query=function(){};xc.prototype.interfaces_=function(){return[]};xc.prototype.getClass=function(){return xc};var tr=function(){if(this._childBoundables=new he,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},Px={serialVersionUID:{configurable:!0}};tr.prototype.getLevel=function(){return this._level};tr.prototype.size=function(){return this._childBoundables.size()};tr.prototype.getChildBoundables=function(){return this._childBoundables};tr.prototype.addChildBoundable=function(e){an.isTrue(this._bounds===null),this._childBoundables.add(e)};tr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};tr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};tr.prototype.interfaces_=function(){return[qh,bs]};tr.prototype.getClass=function(){return tr};Px.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(tr,Px);var Rs=function(){};Rs.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Rs.min=function(e){return Rs.sort(e),e.get(0)};Rs.sort=function(e,t){var n=e.toArray();t?ku.sort(n,t):ku.sort(n);for(var i=e.iterator(),r=0,l=n.length;rGi.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new di("neither boundable is composite")};Gi.prototype.isLeaves=function(){return!(Gi.isComposite(this._boundable1)||Gi.isComposite(this._boundable2))};Gi.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Gi.prototype.expand=function(e,t,n,i){for(var r=this,l=e.getChildBoundables(),f=l.iterator();f.hasNext();){var a=f.next(),_=new Gi(a,t,r._itemDistance);_.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Pg={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};xr.prototype.getNodeCapacity=function(){return this._nodeCapacity};xr.prototype.lastNode=function(e){return e.get(e.size()-1)};xr.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof tr?n+=e.size(r):r instanceof Ds&&(n+=1)}return n}};xr.prototype.removeItem=function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof Ds&&r.getItem()===t&&(n=r)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};xr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new he:t}else if(arguments.length===1){for(var n=arguments[0],i=new he,r=n.getChildBoundables().iterator();r.hasNext();){var l=r.next();if(l instanceof tr){var f=e.itemsTree(l);f!==null&&i.add(f)}else l instanceof Ds?i.add(l.getItem()):an.shouldNeverReachHere()}return i.size()<=0?null:i}};xr.prototype.insert=function(e,t){an.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ds(e,t))};xr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new he;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];if(an.isTrue(i>-2),r.getLevel()===i)return l.add(r),null;for(var f=r.getChildBoundables().iterator();f.hasNext();){var a=f.next();a instanceof tr?e.boundablesAtLevel(i,a,l):(an.isTrue(a instanceof Ds),i===-1&&l.add(a))}return null}};xr.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new he;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var i=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,r)}else if(arguments.length===3){if(We(arguments[2],Yl)&&arguments[0]instanceof Object&&arguments[1]instanceof tr)for(var l=arguments[0],f=arguments[1],a=arguments[2],_=f.getChildBoundables(),x=0;x<_.size();x++){var S=_.get(x);e.getIntersectsOp().intersects(S.getBounds(),l)&&(S instanceof tr?e.query(l,S,a):S instanceof Ds?a.visitItem(S.getItem()):an.shouldNeverReachHere())}else if(We(arguments[2],ks)&&arguments[0]instanceof Object&&arguments[1]instanceof tr)for(var L=arguments[0],A=arguments[1],k=arguments[2],R=A.getChildBoundables(),U=0;Un&&(n=l)}}return n+1}};xr.prototype.createParentBoundables=function(e,t){var n=this;an.isTrue(!e.isEmpty());var i=new he;i.add(this.createNode(t));var r=new he(e);Rs.sort(r,this.getComparator());for(var l=r.iterator();l.hasNext();){var f=l.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(t)),n.lastNode(i).addChildBoundable(f)}return i};xr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};xr.prototype.interfaces_=function(){return[bs]};xr.prototype.getClass=function(){return xr};xr.compareDoubles=function(e,t){return e>t?1:e0);for(var f=new he,a=0;a0;){var R=k.poll(),U=R.getDistance();if(U>=L)break;R.isLeaves()?(L=U,A=R):R.expandToQueue(k,L)}return[A.getBoundable(0).getItem(),A.getBoundable(1).getItem()]}}else if(arguments.length===3){var j=arguments[0],Q=arguments[1],B=arguments[2],X=new Ds(j,Q),J=new Gi(this.getRoot(),X,B);return this.nearestNeighbour(J)[0]}},t.prototype.interfaces_=function(){return[xc,bs]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,r){return(i+r)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return y1},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Rh]},compare:function(i,r){return e.compareDoubles(t.centreX(i.getBounds()),t.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Rh]},compare:function(i,r){return e.compareDoubles(t.centreY(i.getBounds()),t.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(i,r){return i.intersects(r)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(xr),y1=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var r=i.next();n===null?n=new Oe(r.getBounds()):n.expandToInclude(r.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(tr),fo=function(){};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};fo.relativeSign=function(e,t){return et?1:0};fo.compare=function(e,t,n){if(t.equals2D(n))return 0;var i=fo.relativeSign(t.x,n.x),r=fo.relativeSign(t.y,n.y);switch(e){case 0:return fo.compareValue(i,r);case 1:return fo.compareValue(r,i);case 2:return fo.compareValue(r,-i);case 3:return fo.compareValue(-i,r);case 4:return fo.compareValue(-i,-r);case 5:return fo.compareValue(-r,-i);case 6:return fo.compareValue(-r,i);case 7:return fo.compareValue(i,-r)}return an.shouldNeverReachHere("invalid octant value"),0};fo.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Kl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new Dt(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))};Kl.prototype.getCoordinate=function(){return this.coord};Kl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Kl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:fo.compare(this._segmentOctant,this.coord,t.coord)};Kl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Kl.prototype.isInterior=function(){return this._isInterior};Kl.prototype.interfaces_=function(){return[vs]};Kl.prototype.getClass=function(){return Kl};var io=function(){this._nodeMap=new Ur,this._edge=null;var e=arguments[0];this._edge=e};io.prototype.getSplitCoordinates=function(){var e=this,t=new dd;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();e.addEdgeCoordinates(i,r,t),i=r}return t.toCoordinateArray()};io.prototype.addCollapsedNodes=function(){var e=this,t=new he;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var i=n.next().intValue();e.add(e._edge.getCoordinate(i),i)}};io.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};io.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=i?0:1:n>=i?7:6:t>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof Dt&&arguments[1]instanceof Dt){var r=arguments[0],l=arguments[1],f=l.x-r.x,a=l.y-r.y;if(f===0&&a===0)throw new di("Cannot compute the octant for two identical points "+r);return wc.octant(f,a)}};var Ua=function(){};Ua.prototype.getCoordinates=function(){};Ua.prototype.size=function(){};Ua.prototype.getCoordinate=function(e){};Ua.prototype.isClosed=function(){};Ua.prototype.setData=function(e){};Ua.prototype.getData=function(){};Ua.prototype.interfaces_=function(){return[]};Ua.prototype.getClass=function(){return Ua};var $p=function(){};$p.prototype.addIntersection=function(e,t){};$p.prototype.interfaces_=function(){return[Ua]};$p.prototype.getClass=function(){return $p};var zi=function(){this._nodeList=new io(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};zi.prototype.getCoordinates=function(){return this._pts};zi.prototype.size=function(){return this._pts.length};zi.prototype.getCoordinate=function(e){return this._pts[e]};zi.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};zi.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};zi.prototype.setData=function(e){this._data=e};zi.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:wc.octant(e,t)};zi.prototype.getData=function(){return this._data};zi.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[3],l=new Dt(n.getIntersection(r));this.addIntersection(l,i)}};zi.prototype.toString=function(){return As.toLineString(new Di(this._pts))};zi.prototype.getNodeList=function(){return this._nodeList};zi.prototype.addIntersectionNode=function(e,t){var n=t,i=n+1;if(i=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Dt){var i=arguments[0];return ve.orientationIndex(this.p0,this.p1,i)}};ze.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};ze.prototype.isVertical=function(){return this.p0.x===this.p1.x};ze.prototype.equals=function(e){if(!(e instanceof ze))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};ze.prototype.intersection=function(e){var t=new qu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};ze.prototype.project=function(){if(arguments[0]instanceof Dt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Dt(e);var t=this.projectionFactor(e),n=new Dt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof ze){var i=arguments[0],r=this.projectionFactor(i.p0),l=this.projectionFactor(i.p1);if(r>=1&&l>=1||r<=0&&l<=0)return null;var f=this.project(i.p0);r<0&&(f=this.p0),r>1&&(f=this.p1);var a=this.project(i.p1);return l<0&&(a=this.p0),l>1&&(a=this.p1),new ze(f,a)}};ze.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};ze.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};ze.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};ze.prototype.distancePerpendicular=function(e){return ve.distancePointLinePerpendicular(e,this.p0,this.p1)};ze.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};ze.prototype.midPoint=function(){return ze.midPoint(this.p0,this.p1)};ze.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;if(i<=0)return tn.NaN;var r=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i;return r};ze.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=tn.MAX_VALUE,r=null,l=this.closestPoint(e.p0);i=l.distance(e.p0),n[0]=l,n[1]=e.p0;var f=this.closestPoint(e.p1);r=f.distance(e.p1),r0&&t<1)return this.project(e);var n=this.p0.distance(e),i=this.p1.distance(e);return n1||tn.isNaN(t))&&(t=1),t};ze.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};ze.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};ze.prototype.distance=function(){if(arguments[0]instanceof ze){var e=arguments[0];return ve.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Dt){var t=arguments[0];return ve.distancePointLine(t,this.p0,this.p1)}};ze.prototype.pointAlong=function(e){var t=new Dt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};ze.prototype.hashCode=function(){var e=tn.doubleToLongBits(this.p0.x);e^=tn.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=tn.doubleToLongBits(this.p1.x);n^=tn.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return t^i};ze.prototype.interfaces_=function(){return[vs,bs]};ze.prototype.getClass=function(){return ze};ze.midPoint=function(e,t){return new Dt((e.x+t.x)/2,(e.y+t.y)/2)};Ax.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(ze,Ax);var td=function(){this.tempEnv1=new Oe,this.tempEnv2=new Oe,this._overlapSeg1=new ze,this._overlapSeg2=new ze};td.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};td.prototype.interfaces_=function(){return[]};td.prototype.getClass=function(){return td};var ko=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i};ko.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};ko.prototype.computeSelect=function(e,t,n,i){var r=this._pts[t],l=this._pts[n];if(i.tempEnv1.init(r,l),n-t===1)return i.select(this,t),null;if(!e.intersects(i.tempEnv1))return null;var f=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var i=Wn.quadrant(e[n],e[n+1]),r=t+1;rf.getId()&&(f.computeOverlaps(x,r),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return v1},Object.defineProperties(t,n),t}(ed),v1=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[2],l=arguments[3],f=n.getContext(),a=r.getContext();this._si.processIntersections(f,i,a,l)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(td),Nn=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(arguments.length===4){var r=arguments[0],l=arguments[1],f=arguments[2],a=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(l),this.setJoinStyle(f),this.setMitreLimit(a)}}},bl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Nn.prototype.getEndCapStyle=function(){return this._endCapStyle};Nn.prototype.isSingleSided=function(){return this._isSingleSided};Nn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Nn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Nn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Nn.JOIN_ROUND&&(this._quadrantSegments=Nn.DEFAULT_QUADRANT_SEGMENTS)};Nn.prototype.getJoinStyle=function(){return this._joinStyle};Nn.prototype.setJoinStyle=function(e){this._joinStyle=e};Nn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Nn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Nn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Nn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Nn.prototype.getMitreLimit=function(){return this._mitreLimit};Nn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Nn.prototype.setSingleSided=function(e){this._isSingleSided=e};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};bl.CAP_ROUND.get=function(){return 1};bl.CAP_FLAT.get=function(){return 2};bl.CAP_SQUARE.get=function(){return 3};bl.JOIN_ROUND.get=function(){return 1};bl.JOIN_MITRE.get=function(){return 2};bl.JOIN_BEVEL.get=function(){return 3};bl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};bl.DEFAULT_MITRE_LIMIT.get=function(){return 5};bl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Nn,bl);var Pi=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ve.COUNTERCLOCKWISE,this._inputLine=e||null},_d={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Pi.prototype.isDeletable=function(e,t,n,i){var r=this._inputLine[e],l=this._inputLine[t],f=this._inputLine[n];return!this.isConcave(r,l,f)||!this.isShallow(r,l,f,i)?!1:this.isShallowSampled(r,l,e,n,i)};Pi.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),r=!1;i=0;r--)n.addPt(e[r])};Ko.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=En.PI_TIMES_2;for(;e<=-Math.PI;)e+=En.PI_TIMES_2;return e};En.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)}};En.isAcute=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,l=n.x-t.x,f=n.y-t.y,a=i*l+r*f;return a>0};En.isObtuse=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,l=n.x-t.x,f=n.y-t.y,a=i*l+r*f;return a<0};En.interiorAngle=function(e,t,n){var i=En.angle(t,e),r=En.angle(t,n);return Math.abs(r-i)};En.normalizePositive=function(e){if(e<0){for(;e<0;)e+=En.PI_TIMES_2;e>=En.PI_TIMES_2&&(e=0)}else{for(;e>=En.PI_TIMES_2;)e-=En.PI_TIMES_2;e<0&&(e=0)}return e};En.angleBetween=function(e,t,n){var i=En.angle(t,e),r=En.angle(t,n);return En.diff(i,r)};En.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};En.toRadians=function(e){return e*Math.PI/180};En.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?En.COUNTERCLOCKWISE:n<0?En.CLOCKWISE:En.NONE};En.angleBetweenOriented=function(e,t,n){var i=En.angle(t,e),r=En.angle(t,n),l=r-i;return l<=-Math.PI?l+En.PI_TIMES_2:l>Math.PI?l-En.PI_TIMES_2:l};Fc.PI_TIMES_2.get=function(){return 2*Math.PI};Fc.PI_OVER_2.get=function(){return Math.PI/2};Fc.PI_OVER_4.get=function(){return Math.PI/4};Fc.COUNTERCLOCKWISE.get=function(){return ve.COUNTERCLOCKWISE};Fc.CLOCKWISE.get=function(){return ve.CLOCKWISE};Fc.NONE.get=function(){return ve.COLLINEAR};Object.defineProperties(En,Fc);var ui=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ze,this._seg1=new ze,this._offset0=new ze,this._offset1=new ze,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new qu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Nn.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},yd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};ui.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ve.computeOrientation(this._s0,this._s1,this._s2),i=n===ve.CLOCKWISE&&this._side===re.LEFT||n===ve.COUNTERCLOCKWISE&&this._side===re.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};ui.prototype.addLineEndCap=function(e,t){var n=new ze(e,t),i=new ze;this.computeOffsetSegment(n,re.LEFT,this._distance,i);var r=new ze;this.computeOffsetSegment(n,re.RIGHT,this._distance,r);var l=t.x-e.x,f=t.y-e.y,a=Math.atan2(f,l);switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(t,a+Math.PI/2,a-Math.PI/2,ve.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Nn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Nn.CAP_SQUARE:var _=new Dt;_.x=Math.abs(this._distance)*Math.cos(a),_.y=Math.abs(this._distance)*Math.sin(a);var x=new Dt(i.p1.x+_.x,i.p1.y+_.y),S=new Dt(r.p1.x+_.x,r.p1.y+_.y);this._segList.addPt(x),this._segList.addPt(S);break}};ui.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};ui.prototype.addMitreJoin=function(e,t,n,i){var r=!0,l=null;try{l=Ps.intersection(t.p0,t.p1,n.p0,n.p1);var f=i<=0?1:l.distance(e)/Math.abs(i);f>this._bufParams.getMitreLimit()&&(r=!1)}catch(a){if(a instanceof af)l=new Dt(0,0),r=!1;else throw a}finally{}r?this._segList.addPt(l):this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())};ui.prototype.addFilletCorner=function(e,t,n,i,r){var l=t.x-e.x,f=t.y-e.y,a=Math.atan2(f,l),_=n.x-e.x,x=n.y-e.y,S=Math.atan2(x,_);i===ve.CLOCKWISE?a<=S&&(a+=2*Math.PI):a>=S&&(a-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,a,S,i,r),this._segList.addPt(n)};ui.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Dt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new Dt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};ui.prototype.createCircle=function(e){var t=new Dt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};ui.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};ui.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Ko,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*ui.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};ui.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Nn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Nn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ve.CLOCKWISE,this._distance))};ui.prototype.closeRing=function(){this._segList.closeRing()};ui.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};ui.prototype.interfaces_=function(){return[]};ui.prototype.getClass=function(){return ui};yd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};yd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};yd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};yd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(ui,yd);var mo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};mo.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),r=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],r):this.computeOffsetCurve(e,n,r);var l=r.getCoordinates();return n&&gn.reverse(l),l};mo.prototype.computeSingleSidedBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var r=Pi.simplify(e,-i),l=r.length-1;n.initSideSegments(r[l],r[l-1],re.LEFT),n.addFirstSegment();for(var f=l-2;f>=0;f--)n.addNextSegment(r[f],!0)}else{n.addSegments(e,!1);var a=Pi.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment(),n.closeRing()};mo.prototype.computeRingBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);t===re.RIGHT&&(i=-i);var r=Pi.simplify(e,i),l=r.length-1;n.initSideSegments(r[l-1],r[0],t);for(var f=1;f<=l;f++){var a=f!==1;n.addNextSegment(r[f],a)}n.closeRing()};mo.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),i=Pi.simplify(e,n),r=i.length-1;t.initSideSegments(i[0],i[1],re.LEFT);for(var l=2;l<=r;l++)t.addNextSegment(i[l],!0);t.addLastSegment(),t.addLineEndCap(i[r-1],i[r]);var f=Pi.simplify(e,-n),a=f.length-1;t.initSideSegments(f[a],f[a-1],re.LEFT);for(var _=a-2;_>=0;_--)t.addNextSegment(f[_],!0);t.addLastSegment(),t.addLineEndCap(f[1],f[0]),t.closeRing()};mo.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:t.createCircle(e);break;case Nn.CAP_SQUARE:t.createSquare(e);break}};mo.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var r=t<0;this.computeSingleSidedBufferCurve(e,r,i)}else this.computeLineBufferCurve(e,i);var l=i.getCoordinates();return l};mo.prototype.getBufferParameters=function(){return this._bufParams};mo.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};mo.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return mo.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()};mo.prototype.computeOffsetCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var r=Pi.simplify(e,-i),l=r.length-1;n.initSideSegments(r[l],r[l-1],re.LEFT),n.addFirstSegment();for(var f=l-2;f>=0;f--)n.addNextSegment(r[f],!0)}else{var a=Pi.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment()};mo.prototype.getSegGen=function(e){return new ui(this._precisionModel,this._bufParams,e)};mo.prototype.interfaces_=function(){return[]};mo.prototype.getClass=function(){return mo};mo.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;nl.getMaxY()||e.findStabbedSegments(t,r.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(We(arguments[2],ks)&&arguments[0]instanceof Dt&&arguments[1]instanceof yy)for(var f=arguments[0],a=arguments[1],_=arguments[2],x=a.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var L=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Le._seg.p1.y)&&ve.computeOrientation(e._seg.p0,e._seg.p1,f)!==ve.RIGHT){var A=a.getDepth(re.LEFT);e._seg.p0.equals(x[S])||(A=a.getDepth(re.RIGHT));var k=new zu(e._seg,A);_.add(k)}}else if(We(arguments[2],ks)&&arguments[0]instanceof Dt&&We(arguments[1],ks))for(var R=arguments[0],U=arguments[1],j=arguments[2],Q=U.iterator();Q.hasNext();){var B=Q.next();B.isForward()&&e.findStabbedSegments(R,B,j)}}};Sc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Rs.min(t);return n._leftDepth};Sc.prototype.interfaces_=function(){return[]};Sc.prototype.getClass=function(){return Sc};Dx.DepthSegment.get=function(){return zu};Object.defineProperties(Sc,Dx);var zu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new ze(e),this._leftDepth=t};zu.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};zu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};zu.prototype.toString=function(){return this._upwardSeg.toString()};zu.prototype.interfaces_=function(){return[vs]};zu.prototype.getClass=function(){return zu};var Rn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Rn.prototype.area=function(){return Rn.area(this.p0,this.p1,this.p2)};Rn.prototype.signedArea=function(){return Rn.signedArea(this.p0,this.p1,this.p2)};Rn.prototype.interpolateZ=function(e){if(e===null)throw new di("Supplied point is null.");return Rn.interpolateZ(e,this.p0,this.p1,this.p2)};Rn.prototype.longestSideLength=function(){return Rn.longestSideLength(this.p0,this.p1,this.p2)};Rn.prototype.isAcute=function(){return Rn.isAcute(this.p0,this.p1,this.p2)};Rn.prototype.circumcentre=function(){return Rn.circumcentre(this.p0,this.p1,this.p2)};Rn.prototype.area3D=function(){return Rn.area3D(this.p0,this.p1,this.p2)};Rn.prototype.centroid=function(){return Rn.centroid(this.p0,this.p1,this.p2)};Rn.prototype.inCentre=function(){return Rn.inCentre(this.p0,this.p1,this.p2)};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Rn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Rn.det=function(e,t,n,i){return e*i-t*n};Rn.interpolateZ=function(e,t,n,i){var r=t.x,l=t.y,f=n.x-r,a=i.x-r,_=n.y-l,x=i.y-l,S=f*x-a*_,L=e.x-r,A=e.y-l,k=(x*L-a*A)/S,R=(-_*L+f*A)/S,U=t.z+k*(n.z-t.z)+R*(i.z-t.z);return U};Rn.longestSideLength=function(e,t,n){var i=e.distance(t),r=t.distance(n),l=n.distance(e),f=i;return r>f&&(f=r),l>f&&(f=l),f};Rn.isAcute=function(e,t,n){return!(!En.isAcute(e,t,n)||!En.isAcute(t,n,e)||!En.isAcute(n,e,t))};Rn.circumcentre=function(e,t,n){var i=n.x,r=n.y,l=e.x-i,f=e.y-r,a=t.x-i,_=t.y-r,x=2*Rn.det(l,f,a,_),S=Rn.det(f,l*l+f*f,_,a*a+_*_),L=Rn.det(l,l*l+f*f,a,a*a+_*_),A=i-S/x,k=r+L/x;return new Dt(A,k)};Rn.perpendicularBisector=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=new Ps(e.x+n/2,e.y+i/2,1),l=new Ps(e.x-i+n/2,e.y+n+i/2,1);return new Ps(r,l)};Rn.angleBisector=function(e,t,n){var i=t.distance(e),r=t.distance(n),l=i/(i+r),f=n.x-e.x,a=n.y-e.y,_=new Dt(e.x+l*f,e.y+l*a);return _};Rn.area3D=function(e,t,n){var i=t.x-e.x,r=t.y-e.y,l=t.z-e.z,f=n.x-e.x,a=n.y-e.y,_=n.z-e.z,x=r*_-l*a,S=l*f-i*_,L=i*a-r*f,A=x*x+S*S+L*L,k=Math.sqrt(A)/2;return k};Rn.centroid=function(e,t,n){var i=(e.x+t.x+n.x)/3,r=(e.y+t.y+n.y)/3;return new Dt(i,r)};Rn.inCentre=function(e,t,n){var i=t.distance(n),r=e.distance(n),l=e.distance(t),f=i+r+l,a=(i*e.x+r*t.x+l*n.x)/f,_=(i*e.y+r*t.y+l*n.y)/f;return new Dt(a,_)};var ys=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new he;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};ys.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,zt.EXTERIOR,zt.INTERIOR)};ys.prototype.addPolygon=function(e){var t=this,n=this._distance,i=re.LEFT;this._distance<0&&(n=-this._distance,i=re.RIGHT);var r=e.getExteriorRing(),l=gn.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance)||this._distance<=0&&l.length<3)return null;this.addPolygonRing(l,n,i,zt.EXTERIOR,zt.INTERIOR);for(var f=0;f0&&t.isErodedCompletely(a,-t._distance)||t.addPolygonRing(_,n,re.opposite(i),zt.INTERIOR,zt.EXTERIOR)}};ys.prototype.isTriangleErodedCompletely=function(e,t){var n=new Rn(e[0],e[1],e[2]),i=n.inCentre(),r=ve.distancePointLine(i,n.p0,n.p1);return r=Ba.MINIMUM_VALID_SIZE&&ve.isCCW(e)&&(l=r,f=i,n=re.opposite(n));var a=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(a,l,f)};ys.prototype.add=function(e){if(e.isEmpty())return null;e instanceof er?this.addPolygon(e):e instanceof Mi?this.addLineString(e):e instanceof Mo?this.addPoint(e):e instanceof Gh?this.addCollection(e):e instanceof Ru?this.addCollection(e):e instanceof Oa?this.addCollection(e):e instanceof eo&&this.addCollection(e)};ys.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>r};ys.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new uf;var e=this._parent.getGeometryN(this._index++);return e instanceof eo?(this._subcollectionIterator=new za(e),this._subcollectionIterator.next()):e};za.prototype.remove=function(){throw new Error(this.getClass().getName())};za.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};za.prototype.interfaces_=function(){return[lf]};za.prototype.getClass=function(){return za};za.isAtomic=function(e){return!(e instanceof eo)};var Zo=function(){this._geom=null;var e=arguments[0];this._geom=e};Zo.prototype.locate=function(e){return Zo.locate(e,this._geom)};Zo.prototype.interfaces_=function(){return[Wh]};Zo.prototype.getClass=function(){return Zo};Zo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?ve.isPointInRing(e,t.getCoordinates()):!1};Zo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Zo.isPointInRing(e,n))return!1;for(var i=0;i0&&l[l.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!l||x[1]>l[0]&&x[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var a=t.right;if(t.right=a.left,a.left=t,t=a,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,l.left=t.right,t.left=i.right,t.right=i.left,t}function X_(e,t,n,i){var r=new Ru(e,t);if(n===null)return r.left=r.right=null,r;n=Lu(e,n,i);var l=i(e,n.key);return l<0?(r.left=n.left,r.right=n,n.left=null):l>=0&&(r.right=n.right,r.left=n,n.right=null),r}function o1(e,t,n){var i=null,r=null;if(t){t=Lu(e,t,n);var l=n(t.key,e);l===0?(i=t.left,r=t.right):l<0?(r=t.right,t.right=null,i=t):(i=t.left,t.left=null,r=t)}return{left:i,right:r}}function YI(e,t,n){return t===null?e:(e===null||(t=Lu(e.key,t,n),t.left=e),t)}function hy(e,t,n,i,r){if(e){i(""+t+(n?"└── ":"├── ")+r(e)+` +`);var l=t+(n?" ":"│ ");e.left&&hy(e.left,l,!1,i,r),e.right&&hy(e.right,l,!0,i,r)}}var Ny=function(){function e(t){t===void 0&&(t=HI),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=X_(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var i=new Ru(t,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,l=Lu(t,this._root,r),f=r(t,l.key);return f===0?this._root=l:(f<0?(i.left=l.left,i.right=l,l.left=null):f>0&&(i.right=l.right,i.left=l,l.right=null),this._size++,this._root=i),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,i){var r;if(n===null)return null;n=Lu(t,n,i);var l=i(t,n.key);return l===0?(n.left===null?r=n.right:(r=Lu(t,n.left,i),r.right=n.right),this._size--,r):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Lu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return n;r<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Lu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return!0;r<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var i=this._root,r=[],l=!1;!l;)i!==null?(r.push(i),i=i.left):r.length!==0?(i=r.pop(),t.call(n,i),i=i.right):l=!0;return this},e.prototype.range=function(t,n,i,r){for(var l=[],f=this._comparator,a=this._root,_;l.length!==0||a;)if(a)l.push(a),a=a.left;else{if(a=l.pop(),_=f(a.key,n),_>0)break;if(f(a.key,t)>=0&&i.call(r,a))return this;a=a.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var i=n.key;return t.push(i)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var i=n.data;return t.push(i)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,i=!1,r=0,l=[];!i;)if(n)l.push(n),n=n.left;else if(l.length>0){if(n=l.pop(),r===t)return n;r++,n=n.right}else i=!0;return null},e.prototype.next=function(t){var n=this._root,i=null;if(t.right){for(i=t.right;i.left;)i=i.left;return i}for(var r=this._comparator;n;){var l=r(t.key,n.key);if(l===0)break;l<0?(i=n,n=n.left):n=n.right}return i},e.prototype.prev=function(t){var n=this._root,i=null;if(t.left!==null){for(i=t.left;i.right;)i=i.right;return i}for(var r=this._comparator;n;){var l=r(t.key,n.key);if(l===0)break;l<0?n=n.left:(i=n,n=n.right)}return i},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return JI(this._root)},e.prototype.load=function(t,n,i){n===void 0&&(n=[]),i===void 0&&(i=!1);var r=t.length,l=this._comparator;if(i&&dy(t,n,0,r-1,l),this._root===null)this._root=fy(t,n,0,r),this._size=r;else{var f=QI(this.toList(),KI(t,n),l);r=this._size+r,this._root=py({head:f},0,r)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(i){return String(i.key)});var n=[];return hy(this._root,"",!0,function(i){return n.push(i)},t),n.join("")},e.prototype.update=function(t,n,i){var r=this._comparator,l=o1(t,this._root,r),f=l.left,a=l.right;r(t,n)<0?a=X_(n,i,a,r):f=X_(n,i,f,r),this._root=YI(f,a,r)},e.prototype.split=function(t){return o1(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,i;return XI(this,function(r){switch(r.label){case 0:t=this._root,n=[],i=!1,r.label=1;case 1:return i?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return r.sent(),t=t.right,[3,5];case 4:i=!0,r.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function fy(e,t,n,i){var r=i-n;if(r>0){var l=n+Math.floor(r/2),f=e[l],a=t[l],_=new Ru(f,a);return _.left=fy(e,t,n,l),_.right=fy(e,t,l+1,i),_}return null}function KI(e,t){for(var n=new Ru(null,null),i=n,r=0;r0?(t=l=l.next=n.pop(),t=t.right):i=!0;return l.next=null,r.next}function py(e,t,n){var i=n-t;if(i>0){var r=t+Math.floor(i/2),l=py(e,t,r),f=e.head;return f.left=l,e.head=e.head.next,f.right=py(e,r+1,n),f}return null}function QI(e,t,n){for(var i=new Ru(null,null),r=i,l=e,f=t;l!==null&&f!==null;)n(l.key,f.key)<0?(r.next=l,l=l.next):(r.next=f,f=f.next),r=r.next;return l!==null?r.next=l:f!==null&&(r.next=f),i.next}function dy(e,t,n,i,r){if(!(n>=i)){for(var l=e[n+i>>1],f=n-1,a=i+1;;){do f++;while(r(e[f],l)<0);do a--;while(r(e[a],l)>0);if(f>=a)break;var _=e[f];e[f]=e[a],e[a]=_,_=t[f],t[f]=t[a],t[a]=_}dy(e,t,n,a,r),dy(e,t,a+1,i,r)}}function ba(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s1(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){ba(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Xo(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,i=0,r=n.length;i=0&&L>=0?xA?-1:0:_<0&&L<0?xA?1:0:L<_?-1:L>_?1:0}}}]),e}(),oC=0,Qm=function(){Xo(e,null,[{key:"compare",value:function(t,n){var i=t.leftSE.point.x,r=n.leftSE.point.x,l=t.rightSE.point.x,f=n.rightSE.point.x;if(fa&&_>x)return-1;var L=t.comparePoint(n.leftSE.point);if(L<0)return 1;if(L>0)return-1;var A=n.comparePoint(t.rightSE.point);return A!==0?A:-1}if(i>r){if(a<_&&a_&&a>S)return 1;var P=n.comparePoint(t.leftSE.point);if(P!==0)return P;var O=t.comparePoint(n.rightSE.point);return O<0?1:O>0?-1:1}if(a<_)return-1;if(a>_)return 1;if(lf){var U=t.comparePoint(n.rightSE.point);if(U<0)return 1;if(U>0)return-1}if(l!==f){var Y=x-a,V=l-i,$=S-_,K=f-r;if(Y>V&&$K)return-1}return l>f?1:lS?1:t.idn.id?1:0}}]);function e(t,n,i,r){ba(this,e),this.id=++oC,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=i,this.windings=r}return Xo(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,i=this.rightSE.point,r=this.vector();if(n.x===i.x)return t.x===n.x?0:t.x0&&a.swapEvents(),ul.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(r.checkForConsuming(),l.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n0){var l=n;n=i,i=l}if(n.prev===i){var f=n;n=i,i=f}for(var a=0,_=i.rings.length;a<_;a++){var x=i.rings[a],S=i.windings[a],L=n.rings.indexOf(x);L===-1?(n.rings.push(x),n.windings.push(S)):n.windings[L]+=S}i.rings=null,i.windings=null,i.consumedBy=n,i.leftSE.consumedBy=n.leftSE,i.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var n=this._afterState.rings,i=this._afterState.windings,r=this._afterState.multiPolys,l=0,f=this.rings.length;l0)r=n,l=t,f=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var _=new ul(r,!0),x=new ul(l,!1);return new e(_,x,[i],[f])}}]),e}(),h1=function(){function e(t,n,i){if(ba(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var r=$p.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};for(var l=r,f=1,a=t.length;fthis.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),l=_)}(r.x!==l.x||r.y!==l.y)&&this.segments.push(Qm.fromRing(l,r,this))}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.interiorRings.push(l)}this.multiPoly=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.polys.push(l)}this.isSubject=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.polys.length;n0&&(t=r)}for(var l=t.segment.prevInResult(),f=l?l.prevInResult():null;;){if(!l)return null;if(!f)return l.ringOut;if(f.ringOut!==l.ringOut)return f.ringOut.enclosingRing()!==l.ringOut?l.ringOut:l.ringOut.enclosingRing();l=f.prevInResult(),f=l?l.prevInResult():null}}}]),e}(),p1=function(){function e(t){ba(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Xo(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,i=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Qm.compare;ba(this,e),this.queue=t,this.tree=new Ny(n),this.segments=[]}return Xo(e,[{key:"process",value:function(t){var n=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),i;var r=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!r)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var l=r,f=r,a=void 0,_=void 0;a===void 0;)l=this.tree.prev(l),l===null?a=null:l.key.consumedBy===void 0&&(a=l.key);for(;_===void 0;)f=this.tree.next(f),f===null?_=null:f.key.consumedBy===void 0&&(_=f.key);if(t.isLeft){var x=null;if(a){var S=a.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(x=S),!a.isAnEndpoint(S)))for(var L=this._splitSafely(a,S),A=0,P=L.length;A0?(this.tree.remove(n),i.push(t)):(this.segments.push(n),n.prev=a)}else{if(a&&_){var gt=a.getIntersection(_);if(gt!==null){if(!a.isAnEndpoint(gt))for(var ut=this._splitSafely(a,gt),Et=0,yt=ut.length;Etd1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var K=new uC(O),nt=O.size,ht=O.pop();ht;){var dt=ht.key;if(O.size===nt){var gt=dt.segment;throw new Error("Unable to pop() ".concat(dt.isLeft?"left":"right"," SweepEvent ")+"[".concat(dt.point.x,", ").concat(dt.point.y,"] from segment #").concat(gt.id," ")+"[".concat(gt.leftSE.point.x,", ").concat(gt.leftSE.point.y,"] -> ")+"[".concat(gt.rightSE.point.x,", ").concat(gt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(O.size>d1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(K.segments.length>cC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ut=K.process(dt),Et=0,yt=ut.length;Et1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;in[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Dt.prototype.clone=function(){};Dt.prototype.copy=function(){return new Dt(this)};Dt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Dt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return Math.sqrt(t*t+n*n+i*i)};Dt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Dt.prototype.hashCode=function(){var e=17;return e=37*e+Dt.hashCode(this.x),e=37*e+Dt.hashCode(this.y),e};Dt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Dt.prototype.interfaces_=function(){return[bs,bg,xs]};Dt.prototype.getClass=function(){return Dt};Dt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=tn.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Rc.DimensionalComparator.get=function(){return Zl};Rc.serialVersionUID.get=function(){return 6683108902428367e3};Rc.NULL_ORDINATE.get=function(){return tn.NaN};Rc.X.get=function(){return 0};Rc.Y.get=function(){return 1};Rc.Z.get=function(){return 2};Object.defineProperties(Dt,Rc);var Zl=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new gi("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};Zl.prototype.compare=function(e,t){var n=e,i=t,r=Zl.compare(n.x,i.x);if(r!==0)return r;var l=Zl.compare(n.y,i.y);if(l!==0)return l;if(this._dimensionsToTest<=2)return 0;var f=Zl.compare(n.z,i.z);return f};Zl.prototype.interfaces_=function(){return[Oh]};Zl.prototype.getClass=function(){return Zl};Zl.compare=function(e,t){return et?1:tn.isNaN(e)?tn.isNaN(t)?0:-1:tn.isNaN(t)?1:0};var zh=function(){};zh.prototype.create=function(){};zh.prototype.interfaces_=function(){return[]};zh.prototype.getClass=function(){return zh};var zt=function(){},pd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};zt.prototype.interfaces_=function(){return[]};zt.prototype.getClass=function(){return zt};zt.toLocationSymbol=function(e){switch(e){case zt.EXTERIOR:return"e";case zt.BOUNDARY:return"b";case zt.INTERIOR:return"i";case zt.NONE:return"-"}throw new gi("Unknown location value: "+e)};pd.INTERIOR.get=function(){return 0};pd.BOUNDARY.get=function(){return 1};pd.EXTERIOR.get=function(){return 2};pd.NONE.get=function(){return-1};Object.defineProperties(zt,pd);var We=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Ho=function(){},wx={LOG_10:{configurable:!0}};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};Ho.log10=function(e){var t=Math.log(e);return tn.isInfinite(t)||tn.isNaN(t)?t:t/Ho.LOG_10};Ho.min=function(e,t,n,i){var r=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],l=arguments[2];return il?l:i}};Ho.wrap=function(e,t){return e<0?t- -e%t:e%t};Ho.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),n>i&&(i=n),i}else if(arguments.length===4){var r=arguments[0],l=arguments[1],f=arguments[2],a=arguments[3],_=r;return l>_&&(_=l),f>_&&(_=f),a>_&&(_=a),_}};Ho.average=function(e,t){return(e+t)/2};wx.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Ho,wx);var xa=function(e){this.str=e};xa.prototype.append=function(e){this.str+=e};xa.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};xa.prototype.toString=function(e){return this.str};var ua=function(e){this.value=e};ua.prototype.intValue=function(){return this.value};ua.prototype.compareTo=function(e){return this.valuee?1:0};ua.isNaN=function(e){return Number.isNaN(e)};var Wp=function(){};Wp.isWhitespace=function(e){return e<=32&&e>=0||e===127};Wp.toUpperCase=function(e){return e.toUpperCase()};var Ut=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var i=arguments[0];e.call(this,e.parse(i))}}else if(arguments.length===2){var r=arguments[0],l=arguments[1];this.init(r,l)}},Vs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Ut.prototype.le=function(e){return(this._hi9?(S=!0,L="9"):L="0"+x,f.append(L),n=n.subtract(Ut.valueOf(x)).multiply(Ut.TEN),S&&n.selfAdd(Ut.TEN);var A=!0,P=Ut.magnitude(n._hi);if(P<0&&Math.abs(P)>=a-_&&(A=!1),!A)break}return t[0]=i,f.toString()};Ut.prototype.sqr=function(){return this.multiply(this)};Ut.prototype.doubleValue=function(){return this._hi+this._lo};Ut.prototype.subtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};Ut.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};Ut.prototype.isZero=function(){return this._hi===0&&this._lo===0};Ut.prototype.selfSubtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};Ut.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Ut.prototype.min=function(e){return this.le(e)?this:e};Ut.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,l=null,f=null,a=null,_=null,x=null,S=null,L=null;return _=this._hi/n,x=Ut.SPLIT*_,r=x-_,L=Ut.SPLIT*n,r=x-r,l=_-r,f=L-n,S=_*n,f=L-f,a=n-f,L=r*f-S+r*a+l*f+l*a,x=(this._hi-S-L+this._lo-_*i)/n,L=_+x,this._hi=L,this._lo=_-L+x,this}};Ut.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Ut.prototype.divide=function(){if(arguments[0]instanceof Ut){var e=arguments[0],t=null,n=null,i=null,r=null,l=null,f=null,a=null,_=null;l=this._hi/e._hi,f=Ut.SPLIT*l,t=f-l,_=Ut.SPLIT*e._hi,t=f-t,n=l-t,i=_-e._hi,a=l*e._hi,i=_-i,r=e._hi-i,_=t*i-a+t*r+n*i+n*r,f=(this._hi-a-_+this._lo-l*e._lo)/e._hi,_=l+f;var x=_,S=l-_+f;return new Ut(x,S)}else if(typeof arguments[0]=="number"){var L=arguments[0];return tn.isNaN(L)?Ut.createNaN():Ut.copy(this).selfDivide(L,0)}};Ut.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};Ut.prototype.pow=function(e){if(e===0)return Ut.valueOf(1);var t=new Ut(this),n=Ut.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(t),i/=2,i>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};Ut.prototype.ceil=function(){if(this.isNaN())return Ut.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new Ut(e,t)};Ut.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};Ut.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};Ut.prototype.setValue=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};Ut.prototype.max=function(e){return this.ge(e)?this:e};Ut.prototype.sqrt=function(){if(this.isZero())return Ut.valueOf(0);if(this.isNegative())return Ut.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=Ut.valueOf(t),i=this.subtract(n.sqr()),r=i._hi*(e*.5);return n.add(r)};Ut.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,r=null,l=null,f=null,a=null;return r=this._hi+t,f=r-this._hi,l=r-f,l=t-f+(this._hi-l),a=l+this._lo,n=r+a,i=a+(r-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var _=arguments[0],x=arguments[1],S=null,L=null,A=null,P=null,O=null,B=null,U=null,Y=null;O=this._hi+_,A=this._lo+x,U=O-this._hi,Y=A-this._lo,B=O-U,P=A-Y,B=_-U+(this._hi-B),P=x-Y+(this._lo-P),U=B+A,S=O+U,L=U+(O-S),U=P+L;var V=S+U,$=U+(S-V);return this._hi=V,this._lo=$,this}};Ut.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,l=null,f=null,a=null,_=null,x=null;_=Ut.SPLIT*this._hi,r=_-this._hi,x=Ut.SPLIT*n,r=_-r,l=this._hi-r,f=x-n,_=this._hi*n,f=x-f,a=n-f,x=r*f-_+r*a+l*f+l*a+(this._hi*i+this._lo*n);var S=_+x;r=_-S;var L=x+r;return this._hi=S,this._lo=L,this}};Ut.prototype.selfSqr=function(){return this.selfMultiply(this)};Ut.prototype.floor=function(){if(this.isNaN())return Ut.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new Ut(e,t)};Ut.prototype.negate=function(){return this.isNaN()?this:new Ut(-this._hi,-this._lo)};Ut.prototype.clone=function(){};Ut.prototype.multiply=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return e.isNaN()?Ut.createNaN():Ut.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return tn.isNaN(t)?Ut.createNaN():Ut.copy(this).selfMultiply(t,0)}};Ut.prototype.isNaN=function(){return tn.isNaN(this._hi)};Ut.prototype.intValue=function(){return Math.trunc(this._hi)};Ut.prototype.toString=function(){var e=Ut.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};Ut.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[0]+1,r=n;if(n.charAt(0)===".")r="0"+n;else if(i<0)r="0."+Ut.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var l=i-n.length,f=Ut.stringOfChar("0",l);r=n+f+".0"}return this.isNegative()?"-"+r:r};Ut.prototype.reciprocal=function(){var e=null,t=null,n=null,i=null,r=null,l=null,f=null,a=null;r=1/this._hi,l=Ut.SPLIT*r,e=l-r,a=Ut.SPLIT*this._hi,e=l-e,t=r-e,n=a-this._hi,f=r*this._hi,n=a-n,i=this._hi-n,a=e*n-f+e*i+t*n+t*i,l=(1-f-a-r*this._lo)/this._hi;var _=r+l,x=r-_+l;return new Ut(_,x)};Ut.prototype.toSciNotation=function(){if(this.isZero())return Ut.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=Ut.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var l=n.charAt(0)+"."+r;return this.isNegative()?"-"+l+i:l+i};Ut.prototype.abs=function(){return this.isNaN()?Ut.NaN:this.isNegative()?this.negate():new Ut(this)};Ut.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Ut.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};Ut.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Ut.prototype.trunc=function(){return this.isNaN()?Ut.NaN:this.isPositive()?this.floor():this.ceil()};Ut.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Ut.prototype.interfaces_=function(){return[xs,bs,bg]};Ut.prototype.getClass=function(){return Ut};Ut.sqr=function(e){return Ut.valueOf(e).selfMultiply(e)};Ut.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return Ut.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new Ut(t)}};Ut.sqrt=function(e){return Ut.valueOf(e).sqrt()};Ut.parse=function(e){for(var t=0,n=e.length;Wp.isWhitespace(e.charAt(t));)t++;var i=!1;if(t=n);){var x=e.charAt(t);if(t++,Wp.isDigit(x)){var S=x-"0";l.selfMultiply(Ut.TEN),l.selfAdd(S),f++;continue}if(x==="."){a=f;continue}if(x==="e"||x==="E"){var L=e.substring(t);try{_=ua.parseInt(L)}catch(U){throw U instanceof Error?new Error("Invalid exponent "+L+" in string "+e):U}finally{}break}throw new Error("Unexpected character '"+x+"' at position "+t+" in string "+e)}var A=l,P=f-a-_;if(P===0)A=l;else if(P>0){var O=Ut.TEN.pow(P);A=l.divide(O)}else if(P<0){var B=Ut.TEN.pow(-P);A=l.multiply(B)}return i?A.negate():A};Ut.createNaN=function(){return new Ut(tn.NaN,tn.NaN)};Ut.copy=function(e){return new Ut(e)};Ut.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n)),r=Math.pow(10,i);return r*10<=t&&(i+=1),i};Ut.stringOfChar=function(e,t){for(var n=new xa,i=0;i0){if(l<=0)return po.signum(f);i=r+l}else if(r<0){if(l>=0)return po.signum(f);i=-r-l}else return po.signum(f);var a=po.DP_SAFE_EPSILON*i;return f>=a||-f>=a?po.signum(f):2};po.signum=function(e){return e>0?1:e<0?-1:0};Sx.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(po,Sx);var Mn=function(){},dd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};dd.X.get=function(){return 0};dd.Y.get=function(){return 1};dd.Z.get=function(){return 2};dd.M.get=function(){return 3};Mn.prototype.setOrdinate=function(e,t,n){};Mn.prototype.size=function(){};Mn.prototype.getOrdinate=function(e,t){};Mn.prototype.getCoordinate=function(){};Mn.prototype.getCoordinateCopy=function(e){};Mn.prototype.getDimension=function(){};Mn.prototype.getX=function(e){};Mn.prototype.clone=function(){};Mn.prototype.expandEnvelope=function(e){};Mn.prototype.copy=function(){};Mn.prototype.getY=function(e){};Mn.prototype.toCoordinateArray=function(){};Mn.prototype.interfaces_=function(){return[bg]};Mn.prototype.getClass=function(){return Mn};Object.defineProperties(Mn,dd);var Ex=function(){},lf=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ex),Lr=function(){};Lr.arraycopy=function(e,t,n,i,r){for(var l=0,f=t;fe._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,i=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}};Oe.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Oe){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}};Oe.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};Oe.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Oe.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Oe.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Oe.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Oe.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Oe.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Oe.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Oe){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Dt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}};Oe.prototype.centre=function(){return this.isNull()?null:new Dt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Oe.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Dt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Oe){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var r=arguments[0],l=arguments[1],f=arguments[2],a=arguments[3];re._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};Oe.prototype.hashCode=function(){var e=17;return e=37*e+Dt.hashCode(this._minx),e=37*e+Dt.hashCode(this._maxx),e=37*e+Dt.hashCode(this._miny),e=37*e+Dt.hashCode(this._maxy),e};Oe.prototype.interfaces_=function(){return[bs,xs]};Oe.prototype.getClass=function(){return Oe};Oe.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var i=arguments[0],r=arguments[1],l=arguments[2],f=arguments[3],a=Math.min(l.x,f.x),_=Math.max(l.x,f.x),x=Math.min(i.x,r.x),S=Math.max(i.x,r.x);return!(x>_||S_)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};wi.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};wi.prototype.setPrecisionModel=function(e){this._precisionModel=e};wi.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;nr?l=i:l=r;else{var f=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);i>r?l=f:l=a,l===0&&!e.equals(t)&&(l=Math.max(f,a))}return an.isTrue(!(l===0&&!e.equals(t)),"Bad distance calculation"),l};wi.nonRobustComputeEdgeDistance=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,l=Math.sqrt(i*i+r*r);return an.isTrue(!(l===0&&!e.equals(t)),"Invalid distance calculation"),l};Oc.DONT_INTERSECT.get=function(){return 0};Oc.DO_INTERSECT.get=function(){return 1};Oc.COLLINEAR.get=function(){return 2};Oc.NO_INTERSECTION.get=function(){return 0};Oc.POINT_INTERSECTION.get=function(){return 1};Oc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(wi,Oc);var Zu=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var i=new Oe(this._inputLines[0][0],this._inputLines[0][1]),r=new Oe(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&r.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];if(this._isProper=!1,Oe.intersects(i,r,n)&&ve.orientationIndex(i,r,n)===0&&ve.orientationIndex(r,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(r))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,i,r,l,f){f.x=this.smallestInAbsValue(n.x,i.x,r.x,l.x),f.y=this.smallestInAbsValue(n.y,i.y,r.y,l.y),n.x-=f.x,n.y-=f.y,i.x-=f.x,i.y-=f.y,r.x-=f.x,r.y-=f.y,l.x-=f.x,l.y-=f.y},t.prototype.safeHCoordinateIntersection=function(n,i,r,l){var f=null;try{f=ks.intersection(n,i,r,l)}catch(a){if(a instanceof lf)f=t.nearestEndpoint(n,i,r,l);else throw a}finally{}return f},t.prototype.intersection=function(n,i,r,l){var f=this.intersectionWithNormalization(n,i,r,l);return this.isInSegmentEnvelopes(f)||(f=new Dt(t.nearestEndpoint(n,i,r,l))),this._precisionModel!==null&&this._precisionModel.makePrecise(f),f},t.prototype.smallestInAbsValue=function(n,i,r,l){var f=n,a=Math.abs(f);return Math.abs(i)1e-4&&Lr.out.println("Distance = "+f.distance(a))},t.prototype.intersectionWithNormalization=function(n,i,r,l){var f=new Dt(n),a=new Dt(i),_=new Dt(r),x=new Dt(l),S=new Dt;this.normalizeToEnvCentre(f,a,_,x,S);var L=this.safeHCoordinateIntersection(f,a,_,x);return L.x+=S.x,L.y+=S.y,L},t.prototype.computeCollinearIntersection=function(n,i,r,l){var f=Oe.intersects(n,i,r),a=Oe.intersects(n,i,l),_=Oe.intersects(r,l,n),x=Oe.intersects(r,l,i);return f&&a?(this._intPt[0]=r,this._intPt[1]=l,e.COLLINEAR_INTERSECTION):_&&x?(this._intPt[0]=n,this._intPt[1]=i,e.COLLINEAR_INTERSECTION):f&&_?(this._intPt[0]=r,this._intPt[1]=n,r.equals(n)&&!a&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):f&&x?(this._intPt[0]=r,this._intPt[1]=i,r.equals(i)&&!a&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&_?(this._intPt[0]=l,this._intPt[1]=n,l.equals(n)&&!f&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&x?(this._intPt[0]=l,this._intPt[1]=i,l.equals(i)&&!f&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,i,r,l,f){var a=n.xi.x?n.x:i.x,S=n.y>i.y?n.y:i.y,L=r.xl.x?r.x:l.x,O=r.y>l.y?r.y:l.y,B=a>L?a:L,U=xA?_:A,V=S0&&a>0||f<0&&a<0)return e.NO_INTERSECTION;var _=ve.orientationIndex(r,l,n),x=ve.orientationIndex(r,l,i);if(_>0&&x>0||_<0&&x<0)return e.NO_INTERSECTION;var S=f===0&&a===0&&_===0&&x===0;return S?this.computeCollinearIntersection(n,i,r,l):(f===0||a===0||_===0||x===0?(this._isProper=!1,n.equals2D(r)||n.equals2D(l)?this._intPt[0]=n:i.equals2D(r)||i.equals2D(l)?this._intPt[0]=i:f===0?this._intPt[0]=new Dt(r):a===0?this._intPt[0]=new Dt(l):_===0?this._intPt[0]=new Dt(n):x===0&&(this._intPt[0]=new Dt(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,r,l)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,i,r,l){var f=n,a=ve.distancePointLine(n,r,l),_=ve.distancePointLine(i,r,l);return _0?n>0?-r:r:n>0?r:-r;if(t===0||n===0)return i>0?e>0?r:-r:e>0?-r:r;if(t>0?i>0?t<=i||(r=-r,l=e,e=n,n=l,l=t,t=i,i=l):t<=-i?(r=-r,n=-n,i=-i):(l=e,e=-n,n=l,l=t,t=-i,i=l):i>0?-t<=i?(r=-r,e=-e,t=-t):(l=-e,e=n,n=l,l=-t,t=i,i=l):t>=i?(e=-e,t=-t,n=-n,i=-i):(r=-r,l=-e,e=-n,n=l,l=-t,t=-i,i=l),e>0)if(n>0){if(!(e<=n))return r}else return r;else{if(n>0)return-r;if(e>=n)r=-r,e=-e,n=-n;else return-r}for(;;){if(f=Math.floor(n/e),n=n-f*e,i=i-f*t,i<0)return-r;if(i>t)return r;if(e>n+n){if(ti+i)return-r;n=e-n,i=t-i,r=-r}if(i===0)return n===0?0:-r;if(n===0||(f=Math.floor(e/n),e=e-f*n,t=t-f*i,t<0))return r;if(t>i)return-r;if(n>e+e){if(it+t)return r;e=n-e,t=i-t,r=-r}if(t===0)return e===0?0:r;if(e===0)return-r}};var oa=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};oa.prototype.countSegment=function(e,t){if(e.xi&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var r=e.x-this._p.x,l=e.y-this._p.y,f=t.x-this._p.x,a=t.y-this._p.y,_=xc.signOfDet2x2(r,l,f,a);if(_===0)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}};oa.prototype.isPointInPolygon=function(){return this.getLocation()!==zt.EXTERIOR};oa.prototype.getLocation=function(){return this._isPointOnSegment?zt.BOUNDARY:this._crossingCount%2===1?zt.INTERIOR:zt.EXTERIOR};oa.prototype.isOnSegment=function(){return this._isPointOnSegment};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};oa.locatePointInRing=function(){if(arguments[0]instanceof Dt&&We(arguments[1],Mn)){for(var e=arguments[0],t=arguments[1],n=new oa(e),i=new Dt,r=new Dt,l=1;l1||_<0||_>1)&&(r=!0)}}return r?Ho.min(ve.distancePointLine(e,n,i),ve.distancePointLine(t,n,i),ve.distancePointLine(n,e,t),ve.distancePointLine(i,e,t)):0};ve.isPointInRing=function(e,t){return ve.locatePointInRing(e,t)!==zt.EXTERIOR};ve.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new Dt;e.getCoordinate(0,i);for(var r=i.x,l=i.y,f=1;fn.y&&(n=l,i=r)}var f=i;do f=f-1,f<0&&(f=t);while(e[f].equals2D(n)&&f!==i);var a=i;do a=(a+1)%t;while(e[a].equals2D(n)&&a!==i);var _=e[f],x=e[a];if(_.equals2D(n)||x.equals2D(n)||_.equals2D(x))return!1;var S=ve.computeOrientation(_,n,x),L=!1;return S===0?L=_.x>x.x:L=S>0,L};ve.locatePointInRing=function(e,t){return oa.locatePointInRing(e,t)};ve.distancePointLinePerpendicular=function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),r=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(r)*Math.sqrt(i)};ve.computeOrientation=function(e,t,n){return ve.orientationIndex(e,t,n)};ve.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new gi("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i=1)return l.distance(a);var S=((f.y-l.y)*(a.x-f.x)-(f.x-l.x)*(a.y-f.y))/_;return Math.abs(S)*Math.sqrt(_)}};ve.isOnLine=function(e,t){for(var n=new Zu,i=1;i0};Bh.prototype.interfaces_=function(){return[_s]};Bh.prototype.getClass=function(){return Bh};var Vh=function(){};Vh.prototype.isInBoundary=function(e){return e>1};Vh.prototype.interfaces_=function(){return[_s]};Vh.prototype.getClass=function(){return Vh};var Uh=function(){};Uh.prototype.isInBoundary=function(e){return e===1};Uh.prototype.interfaces_=function(){return[_s]};Uh.prototype.getClass=function(){return Uh};var Ki=function(){};Ki.prototype.add=function(){};Ki.prototype.addAll=function(){};Ki.prototype.isEmpty=function(){};Ki.prototype.iterator=function(){};Ki.prototype.size=function(){};Ki.prototype.toArray=function(){};Ki.prototype.remove=function(){};function Ry(e){this.message=e||""}Ry.prototype=new Error;Ry.prototype.name="IndexOutOfBoundsException";var uf=function(){};uf.prototype.hasNext=function(){};uf.prototype.next=function(){};uf.prototype.remove=function(){};var As=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Ki);function cf(e){this.message=e||""}cf.prototype=new Error;cf.prototype.name="NoSuchElementException";var he=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Ki&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Ki]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var i=this,r=n.iterator();r.hasNext();)i.add(r.next());return!0},t.prototype.set=function(n,i){var r=this.array_[n];return this.array_[n]=i,r},t.prototype.iterator=function(){return new xC(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Ry;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,i=[],r=0,l=this.array_.length;r=1){var x=this.get(this.size()-1);if(x.equals2D(a))return null}e.prototype.add.call(this,a)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],L=arguments[1];return this.add(S,L),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var A=arguments[0],P=arguments[1],O=arguments[2];if(O)for(var B=0;B=0;U--)i.add(A[U],P);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Dt){var Y=arguments[0],V=arguments[1],$=arguments[2];if(!$){var K=this.size();if(K>0){if(Y>0){var nt=this.get(Y-1);if(nt.equals2D(V))return null}if(YEt&&(yt=-1);for(var xt=ut;xt!==Et;xt+=yt)i.add(dt[xt],gt);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Dt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(he),gn=function(){},wg={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};wg.ForwardComparator.get=function(){return Xp};wg.BidirectionalComparator.get=function(){return Gh};wg.coordArrayType.get=function(){return new Array(0).fill(null)};gn.prototype.interfaces_=function(){return[]};gn.prototype.getClass=function(){return gn};gn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};gn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};gn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};gn.extract=function(e,t,n){t=Ho.clamp(t,0,e.length),n=Ho.clamp(n,-1,e.length);var i=n-t+1;n<0&&(i=0),t>=e.length&&(i=0),ni.length)return 1;if(n.length===0)return 0;var r=gn.compare(n,i),l=gn.isEqualReversed(n,i);return l?0:r};Gh.prototype.OLDcompare=function(e,t){var n=e,i=t;if(n.lengthi.length)return 1;if(n.length===0)return 0;for(var r=gn.increasingDirection(n),l=gn.increasingDirection(i),f=r>0?0:n.length-1,a=l>0?0:n.length-1,_=0;_0)t=t.right;else return t.value}return null};Ur.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:cl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,i,r;do if(i=n,r=e.compareTo(n.key),r<0)n=n.left;else if(r>0)n=n.right;else{var l=n.value;return n.value=t,l}while(n!==null);var f={key:e,left:null,right:null,value:t,parent:i,color:cl,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?i.left=f:i.right=f,this.fixAfterInsertion(f),this.size_++,null};Ur.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=Cu;e!=null&&e!==this.root_&&e.parent.color===Cu;)if(ti(e)===H_(ti(ti(e)))){var n=y1(ti(ti(e)));_1(n)===Cu?(ol(ti(e),cl),ol(n,cl),ol(ti(ti(e)),Cu),e=ti(ti(e))):(e===y1(ti(e))&&(e=ti(e),t.rotateLeft(e)),ol(ti(e),cl),ol(ti(ti(e)),Cu),t.rotateRight(ti(ti(e))))}else{var i=H_(ti(ti(e)));_1(i)===Cu?(ol(ti(e),cl),ol(i,cl),ol(ti(ti(e)),Cu),e=ti(ti(e))):(e===H_(ti(e))&&(e=ti(e),t.rotateRight(e)),ol(ti(e),cl),ol(ti(ti(e)),Cu),t.rotateLeft(ti(ti(e))))}this.root_.color=cl};Ur.prototype.values=function(){var e=new he,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Ur.successor(t))!==null;)e.add(t.value);return e};Ur.prototype.entrySet=function(){var e=new Oy,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Ur.successor(t))!==null;)e.add(t);return e};Ur.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Ur.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Ur.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Ur.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,i=e;n!==null&&i===n.right;)i=n,n=n.parent;return n}};Ur.prototype.size=function(){return this.size_};var Hp=function(){};Hp.prototype.interfaces_=function(){return[]};Hp.prototype.getClass=function(){return Hp};function Cx(){}Cx.prototype=new Sg;function ca(){this.array_=[],arguments[0]instanceof Ki&&this.addAll(arguments[0])}ca.prototype=new Cx;ca.prototype.contains=function(e){for(var t=this,n=0,i=this.array_.length;n=0;){var f=r.substring(0,l);i.add(f),r=r.substring(l+n),l=r.indexOf(t)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),_=0;_0)for(var l=r;l0&&i.append(" ");for(var l=0;l0&&i.append(","),i.append(ms.toString(e.getOrdinate(r,l)))}return i.append(")"),i.toString()}};zi.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return zi.createClosedRing(e,t,4);var i=t.getOrdinate(0,Mn.X)===t.getOrdinate(n-1,Mn.X)&&t.getOrdinate(0,Mn.Y)===t.getOrdinate(n-1,Mn.Y);return i?t:zi.createClosedRing(e,t,n+1)};zi.createClosedRing=function(e,t,n){var i=e.create(n,t.getDimension()),r=t.size();zi.copy(t,0,i,0,r);for(var l=r;l0&&zi.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?An.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return ve.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();zi.reverse(i);var r=this.getFactory().createLineString(i);return r},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var r=arguments[0],l=r,f=0,a=0;f= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var r=this,l=0;l=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(Pi),za=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return $e.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],r=arguments[1];return this.isEquivalentClass(i)?e.prototype.equalsExact.call(this,i,r):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,r=this._geometries.length,l=new Array(r).fill(null),f=0;f0?t.createPoint(n[0]):t.createPoint():e};Jp.prototype.interfaces_=function(){return[ys.GeometryEditorOperation]};Jp.prototype.getClass=function(){return Jp};var Qp=function(){};Qp.prototype.edit=function(e,t){return e instanceof Va?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof Pi?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Mo?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Qp.prototype.interfaces_=function(){return[ys.GeometryEditorOperation]};Qp.prototype.getClass=function(){return Qp};var Ri=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new xa(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(i=3),i<2?new Ri(n):new Ri(n,i)}};Ua.prototype.interfaces_=function(){return[zh,xs]};Ua.prototype.getClass=function(){return Ua};Ua.instance=function(){return Ua.instanceObject};Fy.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Fy.instanceObject.get=function(){return new Ua};Object.defineProperties(Ua,Fy);var Lx=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,i){return this.map_.set(n,i),i},t.prototype.values=function(){for(var n=new he,i=this.map_.values(),r=i.next();!r.done;)n.add(r.value),r=i.next();return n},t.prototype.entrySet=function(){var n=new Oy;return this.map_.entries().forEach(function(i){return n.add(i)}),n},t.prototype.size=function(){return this.map_.size()},t}(Fc),Dn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof fa){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}},By={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Dn.prototype.equals=function(e){if(!(e instanceof Dn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Dn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return new ua(n).compareTo(new ua(i))};Dn.prototype.getScale=function(){return this._scale};Dn.prototype.isFloating=function(){return this._modelType===Dn.FLOATING||this._modelType===Dn.FLOATING_SINGLE};Dn.prototype.getType=function(){return this._modelType};Dn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Dn.FLOATING?e="Floating":this._modelType===Dn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Dn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Dn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(tn.isNaN(e))return e;if(this._modelType===Dn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Dn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Dt){var n=arguments[0];if(this._modelType===Dn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Dn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Dn.FLOATING?e=16:this._modelType===Dn.FLOATING_SINGLE?e=6:this._modelType===Dn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Dn.prototype.setScale=function(e){this._scale=Math.abs(e)};Dn.prototype.interfaces_=function(){return[xs,bs]};Dn.prototype.getClass=function(){return Dn};Dn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};By.serialVersionUID.get=function(){return 7777263578777804e3};By.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Dn,By);var fa=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},Vy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};fa.prototype.readResolve=function(){return fa.nameToTypeMap.get(this._name)};fa.prototype.toString=function(){return this._name};fa.prototype.interfaces_=function(){return[xs]};fa.prototype.getClass=function(){return fa};Vy.serialVersionUID.get=function(){return-552860263173159e4};Vy.nameToTypeMap.get=function(){return new Lx};Object.defineProperties(fa,Vy);Dn.Type=fa;Dn.FIXED=new fa("FIXED");Dn.FLOATING=new fa("FLOATING");Dn.FLOATING_SINGLE=new fa("FLOATING SINGLE");var mn=function e(){this._precisionModel=new Dn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?We(arguments[0],zh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Dn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Mx={serialVersionUID:{configurable:!0}};mn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Dt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Dt(e.getMinX(),e.getMinY()),new Dt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Dt(e.getMinX(),e.getMinY()),new Dt(e.getMinX(),e.getMaxY()),new Dt(e.getMaxX(),e.getMaxY()),new Dt(e.getMaxX(),e.getMinY()),new Dt(e.getMinX(),e.getMinY())]),null)};mn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new Pi(this.getCoordinateSequenceFactory().create(e),this);if(We(e,Mn))return new Pi(e,this)}else return new Pi(this.getCoordinateSequenceFactory().create([]),this)};mn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ou(null,this);if(arguments.length===1){var e=arguments[0];return new Ou(e,this)}};mn.prototype.buildGeometry=function(e){for(var t=null,n=!1,i=!1,r=e.iterator();r.hasNext();){var l=r.next(),f=l.getClass();t===null&&(t=f),f!==t&&(n=!0),l.isGeometryCollectionOrDerived()&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(mn.toGeometryArray(e));var a=e.iterator().next(),_=e.size()>1;if(_){if(a instanceof er)return this.createMultiPolygon(mn.toPolygonArray(e));if(a instanceof Pi)return this.createMultiLineString(mn.toLineStringArray(e));if(a instanceof Mo)return this.createMultiPoint(mn.toPointArray(e));an.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a};mn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};mn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Dt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(We(arguments[0],Mn)){var t=arguments[0];return new Mo(t,this)}}};mn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};mn.prototype.createPolygon=function(){if(arguments.length===0)return new er(null,null,this);if(arguments.length===1){if(We(arguments[0],Mn)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Va){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],r=arguments[1];return new er(i,r,this)}};mn.prototype.getSRID=function(){return this._SRID};mn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new eo(null,this);if(arguments.length===1){var e=arguments[0];return new eo(e,this)}};mn.prototype.createGeometry=function(e){var t=new ys(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};mn.prototype.getPrecisionModel=function(){return this._precisionModel};mn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(We(arguments[0],Mn)){var t=arguments[0];return new Va(t,this)}}};mn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new za(null,this);if(arguments.length===1){var e=arguments[0];return new za(e,this)}};mn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new jh(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new jh(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(We(arguments[0],Mn)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(i.size()).fill(null),l=0;l=this.size())throw new Error;return this.array_[e]};wa.prototype.push=function(e){return this.array_.push(e),e};wa.prototype.pop=function(e){if(this.array_.length===0)throw new Lg;return this.array_.pop()};wa.prototype.peek=function(){if(this.array_.length===0)throw new Lg;return this.array_[this.array_.length-1]};wa.prototype.empty=function(){return this.array_.length===0};wa.prototype.isEmpty=function(){return this.empty()};wa.prototype.search=function(e){return this.array_.indexOf(e)};wa.prototype.size=function(){return this.array_.length};wa.prototype.toArray=function(){for(var e=this,t=[],n=0,i=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===ve.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)};pa.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),i=n.getCoordinates();if(t<0||t+1>=i.length||i[t].y===i[t+1].y)return-1;var r=re.LEFT;return i[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=i,t._minCoord=n[i])};pa.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};pa.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var i=n.next();i.isForward()&&t.checkForRightmostCoordinate(i)}an.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var r=this.getRightmostSide(this._minDe,this._minIndex);r===re.LEFT&&(this._orientedDe=this._minDe.getSym())};pa.prototype.interfaces_=function(){return[]};pa.prototype.getClass=function(){return pa};var gl=function(e){function t(n,i){e.call(this,t.msgWithCoord(n,i)),this.pt=i?new Dt(i):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},t}(dl),Mg=function(){this.array_=[]};Mg.prototype.addLast=function(e){this.array_.push(e)};Mg.prototype.removeFirst=function(){return this.array_.shift()};Mg.prototype.isEmpty=function(){return this.array_.length===0};var no=function(){this._finder=null,this._dirEdgeList=new he,this._nodes=new he,this._rightMostCoord=null,this._env=null,this._finder=new pa};no.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};no.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};no.prototype.computeNodeDepth=function(e){for(var t=this,n=null,i=e.getEdges().iterator();i.hasNext();){var r=i.next();if(r.isVisited()||r.getSym().isVisited()){n=r;break}}if(n===null)throw new gl("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var l=e.getEdges().iterator();l.hasNext();){var f=l.next();f.setVisited(!0),t.copySymDepths(f)}};no.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(re.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};no.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};no.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(re.RIGHT)>=1&&t.getDepth(re.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};no.prototype.computeDepths=function(e){var t=this,n=new Oy,i=new Mg,r=e.getNode();for(i.addLast(r),n.add(r),e.setVisited(!0);!i.isEmpty();){var l=i.removeFirst();n.add(l),t.computeNodeDepth(l);for(var f=l.getEdges().iterator();f.hasNext();){var a=f.next(),_=a.getSym();if(!_.isVisited()){var x=_.getNode();n.contains(x)||(i.addLast(x),n.add(x))}}}};no.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};no.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Oe,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),i=n.getEdge().getCoordinates(),r=0;rthis.location.length){var n=new Array(3).fill(null);n[re.ON]=this.location[re.ON],n[re.LEFT]=zt.NONE,n[re.RIGHT]=zt.NONE,this.location=n}for(var i=0;i1&&e.append(zt.toLocationSymbol(this.location[re.LEFT])),e.append(zt.toLocationSymbol(this.location[re.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[re.RIGHT])),e.toString()};ei.prototype.setLocations=function(e,t,n){this.location[re.ON]=e,this.location[re.LEFT]=t,this.location[re.RIGHT]=n};ei.prototype.get=function(e){return e1};ei.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=i),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};$i.prototype.addPoints=function(e,t,n){var i=this,r=e.getCoordinates();if(t){var l=1;n&&(l=0);for(var f=l;f=0;_--)i._pts.add(r[_])}};$i.prototype.isHole=function(){return this._isHole};$i.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};$i.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!ve.isPointInRing(e,t.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var r=i.next();if(r.containsPoint(e))return!1}return!0};$i.prototype.addHole=function(e){this._holes.add(e)};$i.prototype.isShell=function(){return this._shell===null};$i.prototype.getLabel=function(){return this._label};$i.prototype.getEdges=function(){return this._edges};$i.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};$i.prototype.getShell=function(){return this._shell};$i.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,re.RIGHT);if(i===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,i),null}};$i.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};$i.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(e)};Yo.prototype.isInResult=function(){return this._isInResult};Yo.prototype.isVisited=function(){return this._isVisited};Yo.prototype.interfaces_=function(){return[]};Yo.prototype.getClass=function(){return Yo};var Pg=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new Un(0,zt.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,i){var r=zt.NONE;if(r=this._label.getLocation(i),!n.isNull(i)){var l=n.getLocation(i);r!==zt.BOUNDARY&&(r=l)}return r},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new Un(n,i):this._label.setLocation(n,i)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Un)for(var r=arguments[0],l=0;l<2;l++){var f=n.computeMergedLocation(r,l),a=n._label.getLocation(l);a===zt.NONE&&n._label.setLocation(l,f)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=zt.NONE;this._label!==null&&(i=this._label.getLocation(n));var r=null;switch(i){case zt.BOUNDARY:r=zt.INTERIOR;break;case zt.INTERIOR:r=zt.BOUNDARY;break;default:r=zt.BOUNDARY;break}this._label.setLocation(n,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Yo),da=function(){this.nodeMap=new Ur,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};da.prototype.find=function(e){return this.nodeMap.get(e)};da.prototype.addNode=function(){if(arguments[0]instanceof Dt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof Pg){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}};da.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};da.prototype.iterator=function(){return this.nodeMap.values().iterator()};da.prototype.values=function(){return this.nodeMap.values()};da.prototype.getBoundaryNodes=function(e){for(var t=new he,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===zt.BOUNDARY&&t.add(i)}return t};da.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};da.prototype.interfaces_=function(){return[]};da.prototype.getClass=function(){return da};var $n=function(){},_d={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};$n.prototype.interfaces_=function(){return[]};$n.prototype.getClass=function(){return $n};$n.isNorthern=function(e){return e===$n.NE||e===$n.NW};$n.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};$n.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var i=et?e:t;return i===0&&r===3?3:i};$n.isInHalfPlane=function(e,t){return t===$n.SE?e===$n.SE||e===$n.SW:e===t||e===t+1};$n.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new gi("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?$n.NE:$n.SE:t>=0?$n.NW:$n.SW}else if(arguments[0]instanceof Dt&&arguments[1]instanceof Dt){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new gi("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?$n.NE:$n.SE:i.y>=n.y?$n.NW:$n.SW}};_d.NE.get=function(){return 0};_d.NW.get=function(){return 1};_d.SW.get=function(){return 2};_d.SE.get=function(){return 3};Object.defineProperties($n,_d);var Gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=null;this._edge=t,this.init(n,i),this._label=r}else if(arguments.length===4){var l=arguments[0],f=arguments[1],a=arguments[2],_=arguments[3];this._edge=l,this.init(f,a),this._label=_}};Gr.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){f.linkDirectedEdgesForMinimalEdgeRings();var a=f.buildMinimalRings(),_=i.findShell(a);_!==null?(i.placePolygonHoles(_,a),t.add(_)):n.addAll(a)}else r.add(f)}return r};Po.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Po.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new he,i=e.iterator();i.hasNext();){var r=i.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var l=new AC(r,t._geometryFactory);n.add(l),l.setInResult()}}return n};Po.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}};Po.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Po.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),l=null,f=null,a=t.iterator();a.hasNext();){var _=a.next(),x=_.getLinearRing(),S=x.getEnvelopeInternal();l!==null&&(f=l.getLinearRing().getEnvelopeInternal());var L=!1;S.contains(i)&&ve.isPointInRing(r,x.getCoordinates())&&(L=!0),L&&(l===null||f.contains(S))&&(l=_)}return l};Po.prototype.findShell=function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,t++)}return an.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Po.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];Si.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),r=new he,l=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(l,this._shellList,r),this.placeFreeHoles(this._shellList,r)}};Po.prototype.interfaces_=function(){return[]};Po.prototype.getClass=function(){return Po};var Zh=function(){};Zh.prototype.getBounds=function(){};Zh.prototype.interfaces_=function(){return[]};Zh.prototype.getClass=function(){return Zh};var Rs=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Rs.prototype.getItem=function(){return this._item};Rs.prototype.getBounds=function(){return this._bounds};Rs.prototype.interfaces_=function(){return[Zh,xs]};Rs.prototype.getClass=function(){return Rs};var _l=function(){this._size=null,this._items=null,this._size=0,this._items=new he,this._items.add(null)};_l.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};_l.prototype.size=function(){return this._size};_l.prototype.reorder=function(e){for(var t=this,n=null,i=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(i)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,i)};_l.prototype.clear=function(){this._size=0,this._items.clear()};_l.prototype.isEmpty=function(){return this._size===0};_l.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};_l.prototype.interfaces_=function(){return[]};_l.prototype.getClass=function(){return _l};var Yl=function(){};Yl.prototype.visitItem=function(e){};Yl.prototype.interfaces_=function(){return[]};Yl.prototype.getClass=function(){return Yl};var wc=function(){};wc.prototype.insert=function(e,t){};wc.prototype.remove=function(e,t){};wc.prototype.query=function(){};wc.prototype.interfaces_=function(){return[]};wc.prototype.getClass=function(){return wc};var tr=function(){if(this._childBoundables=new he,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},kx={serialVersionUID:{configurable:!0}};tr.prototype.getLevel=function(){return this._level};tr.prototype.size=function(){return this._childBoundables.size()};tr.prototype.getChildBoundables=function(){return this._childBoundables};tr.prototype.addChildBoundable=function(e){an.isTrue(this._bounds===null),this._childBoundables.add(e)};tr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};tr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};tr.prototype.interfaces_=function(){return[Zh,xs]};tr.prototype.getClass=function(){return tr};kx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(tr,kx);var Os=function(){};Os.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Os.min=function(e){return Os.sort(e),e.get(0)};Os.sort=function(e,t){var n=e.toArray();t?Au.sort(n,t):Au.sort(n);for(var i=e.iterator(),r=0,l=n.length;rji.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new gi("neither boundable is composite")};ji.prototype.isLeaves=function(){return!(ji.isComposite(this._boundable1)||ji.isComposite(this._boundable2))};ji.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};ji.prototype.expand=function(e,t,n,i){for(var r=this,l=e.getChildBoundables(),f=l.iterator();f.hasNext();){var a=f.next(),_=new ji(a,t,r._itemDistance);_.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},kg={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};xr.prototype.getNodeCapacity=function(){return this._nodeCapacity};xr.prototype.lastNode=function(e){return e.get(e.size()-1)};xr.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof tr?n+=e.size(r):r instanceof Rs&&(n+=1)}return n}};xr.prototype.removeItem=function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof Rs&&r.getItem()===t&&(n=r)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};xr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new he:t}else if(arguments.length===1){for(var n=arguments[0],i=new he,r=n.getChildBoundables().iterator();r.hasNext();){var l=r.next();if(l instanceof tr){var f=e.itemsTree(l);f!==null&&i.add(f)}else l instanceof Rs?i.add(l.getItem()):an.shouldNeverReachHere()}return i.size()<=0?null:i}};xr.prototype.insert=function(e,t){an.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Rs(e,t))};xr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new he;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];if(an.isTrue(i>-2),r.getLevel()===i)return l.add(r),null;for(var f=r.getChildBoundables().iterator();f.hasNext();){var a=f.next();a instanceof tr?e.boundablesAtLevel(i,a,l):(an.isTrue(a instanceof Rs),i===-1&&l.add(a))}return null}};xr.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new he;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var i=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,r)}else if(arguments.length===3){if(We(arguments[2],Yl)&&arguments[0]instanceof Object&&arguments[1]instanceof tr)for(var l=arguments[0],f=arguments[1],a=arguments[2],_=f.getChildBoundables(),x=0;x<_.size();x++){var S=_.get(x);e.getIntersectsOp().intersects(S.getBounds(),l)&&(S instanceof tr?e.query(l,S,a):S instanceof Rs?a.visitItem(S.getItem()):an.shouldNeverReachHere())}else if(We(arguments[2],As)&&arguments[0]instanceof Object&&arguments[1]instanceof tr)for(var L=arguments[0],A=arguments[1],P=arguments[2],O=A.getChildBoundables(),B=0;Bn&&(n=l)}}return n+1}};xr.prototype.createParentBoundables=function(e,t){var n=this;an.isTrue(!e.isEmpty());var i=new he;i.add(this.createNode(t));var r=new he(e);Os.sort(r,this.getComparator());for(var l=r.iterator();l.hasNext();){var f=l.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(t)),n.lastNode(i).addChildBoundable(f)}return i};xr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};xr.prototype.interfaces_=function(){return[xs]};xr.prototype.getClass=function(){return xr};xr.compareDoubles=function(e,t){return e>t?1:e0);for(var f=new he,a=0;a0;){var O=P.poll(),B=O.getDistance();if(B>=L)break;O.isLeaves()?(L=B,A=O):O.expandToQueue(P,L)}return[A.getBoundable(0).getItem(),A.getBoundable(1).getItem()]}}else if(arguments.length===3){var U=arguments[0],Y=arguments[1],V=arguments[2],$=new Rs(U,Y),K=new ji(this.getRoot(),$,V);return this.nearestNeighbour(K)[0]}},t.prototype.interfaces_=function(){return[wc,xs]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,r){return(i+r)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return v1},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Oh]},compare:function(i,r){return e.compareDoubles(t.centreX(i.getBounds()),t.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Oh]},compare:function(i,r){return e.compareDoubles(t.centreY(i.getBounds()),t.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(i,r){return i.intersects(r)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(xr),v1=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var r=i.next();n===null?n=new Oe(r.getBounds()):n.expandToInclude(r.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(tr),fo=function(){};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};fo.relativeSign=function(e,t){return et?1:0};fo.compare=function(e,t,n){if(t.equals2D(n))return 0;var i=fo.relativeSign(t.x,n.x),r=fo.relativeSign(t.y,n.y);switch(e){case 0:return fo.compareValue(i,r);case 1:return fo.compareValue(r,i);case 2:return fo.compareValue(r,-i);case 3:return fo.compareValue(-i,r);case 4:return fo.compareValue(-i,-r);case 5:return fo.compareValue(-r,-i);case 6:return fo.compareValue(-r,i);case 7:return fo.compareValue(i,-r)}return an.shouldNeverReachHere("invalid octant value"),0};fo.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Kl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new Dt(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))};Kl.prototype.getCoordinate=function(){return this.coord};Kl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Kl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:fo.compare(this._segmentOctant,this.coord,t.coord)};Kl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Kl.prototype.isInterior=function(){return this._isInterior};Kl.prototype.interfaces_=function(){return[bs]};Kl.prototype.getClass=function(){return Kl};var io=function(){this._nodeMap=new Ur,this._edge=null;var e=arguments[0];this._edge=e};io.prototype.getSplitCoordinates=function(){var e=this,t=new md;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();e.addEdgeCoordinates(i,r,t),i=r}return t.toCoordinateArray()};io.prototype.addCollapsedNodes=function(){var e=this,t=new he;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var i=n.next().intValue();e.add(e._edge.getCoordinate(i),i)}};io.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};io.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=i?0:1:n>=i?7:6:t>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof Dt&&arguments[1]instanceof Dt){var r=arguments[0],l=arguments[1],f=l.x-r.x,a=l.y-r.y;if(f===0&&a===0)throw new gi("Cannot compute the octant for two identical points "+r);return Sc.octant(f,a)}};var Ga=function(){};Ga.prototype.getCoordinates=function(){};Ga.prototype.size=function(){};Ga.prototype.getCoordinate=function(e){};Ga.prototype.isClosed=function(){};Ga.prototype.setData=function(e){};Ga.prototype.getData=function(){};Ga.prototype.interfaces_=function(){return[]};Ga.prototype.getClass=function(){return Ga};var td=function(){};td.prototype.addIntersection=function(e,t){};td.prototype.interfaces_=function(){return[Ga]};td.prototype.getClass=function(){return td};var Fi=function(){this._nodeList=new io(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Fi.prototype.getCoordinates=function(){return this._pts};Fi.prototype.size=function(){return this._pts.length};Fi.prototype.getCoordinate=function(e){return this._pts[e]};Fi.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Fi.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Fi.prototype.setData=function(e){this._data=e};Fi.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Sc.octant(e,t)};Fi.prototype.getData=function(){return this._data};Fi.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[3],l=new Dt(n.getIntersection(r));this.addIntersection(l,i)}};Fi.prototype.toString=function(){return Ns.toLineString(new Ri(this._pts))};Fi.prototype.getNodeList=function(){return this._nodeList};Fi.prototype.addIntersectionNode=function(e,t){var n=t,i=n+1;if(i=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Dt){var i=arguments[0];return ve.orientationIndex(this.p0,this.p1,i)}};ze.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};ze.prototype.isVertical=function(){return this.p0.x===this.p1.x};ze.prototype.equals=function(e){if(!(e instanceof ze))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};ze.prototype.intersection=function(e){var t=new Zu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};ze.prototype.project=function(){if(arguments[0]instanceof Dt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Dt(e);var t=this.projectionFactor(e),n=new Dt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof ze){var i=arguments[0],r=this.projectionFactor(i.p0),l=this.projectionFactor(i.p1);if(r>=1&&l>=1||r<=0&&l<=0)return null;var f=this.project(i.p0);r<0&&(f=this.p0),r>1&&(f=this.p1);var a=this.project(i.p1);return l<0&&(a=this.p0),l>1&&(a=this.p1),new ze(f,a)}};ze.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};ze.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};ze.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};ze.prototype.distancePerpendicular=function(e){return ve.distancePointLinePerpendicular(e,this.p0,this.p1)};ze.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};ze.prototype.midPoint=function(){return ze.midPoint(this.p0,this.p1)};ze.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;if(i<=0)return tn.NaN;var r=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i;return r};ze.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=tn.MAX_VALUE,r=null,l=this.closestPoint(e.p0);i=l.distance(e.p0),n[0]=l,n[1]=e.p0;var f=this.closestPoint(e.p1);r=f.distance(e.p1),r0&&t<1)return this.project(e);var n=this.p0.distance(e),i=this.p1.distance(e);return n1||tn.isNaN(t))&&(t=1),t};ze.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};ze.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};ze.prototype.distance=function(){if(arguments[0]instanceof ze){var e=arguments[0];return ve.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Dt){var t=arguments[0];return ve.distancePointLine(t,this.p0,this.p1)}};ze.prototype.pointAlong=function(e){var t=new Dt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};ze.prototype.hashCode=function(){var e=tn.doubleToLongBits(this.p0.x);e^=tn.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=tn.doubleToLongBits(this.p1.x);n^=tn.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return t^i};ze.prototype.interfaces_=function(){return[bs,xs]};ze.prototype.getClass=function(){return ze};ze.midPoint=function(e,t){return new Dt((e.x+t.x)/2,(e.y+t.y)/2)};Nx.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(ze,Nx);var ed=function(){this.tempEnv1=new Oe,this.tempEnv2=new Oe,this._overlapSeg1=new ze,this._overlapSeg2=new ze};ed.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};ed.prototype.interfaces_=function(){return[]};ed.prototype.getClass=function(){return ed};var ko=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i};ko.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};ko.prototype.computeSelect=function(e,t,n,i){var r=this._pts[t],l=this._pts[n];if(i.tempEnv1.init(r,l),n-t===1)return i.select(this,t),null;if(!e.intersects(i.tempEnv1))return null;var f=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var i=$n.quadrant(e[n],e[n+1]),r=t+1;rf.getId()&&(f.computeOverlaps(x,r),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return b1},Object.defineProperties(t,n),t}(nd),b1=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[2],l=arguments[3],f=n.getContext(),a=r.getContext();this._si.processIntersections(f,i,a,l)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(ed),Nn=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(arguments.length===4){var r=arguments[0],l=arguments[1],f=arguments[2],a=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(l),this.setJoinStyle(f),this.setMitreLimit(a)}}},xl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Nn.prototype.getEndCapStyle=function(){return this._endCapStyle};Nn.prototype.isSingleSided=function(){return this._isSingleSided};Nn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Nn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Nn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Nn.JOIN_ROUND&&(this._quadrantSegments=Nn.DEFAULT_QUADRANT_SEGMENTS)};Nn.prototype.getJoinStyle=function(){return this._joinStyle};Nn.prototype.setJoinStyle=function(e){this._joinStyle=e};Nn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Nn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Nn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Nn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Nn.prototype.getMitreLimit=function(){return this._mitreLimit};Nn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Nn.prototype.setSingleSided=function(e){this._isSingleSided=e};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};xl.CAP_ROUND.get=function(){return 1};xl.CAP_FLAT.get=function(){return 2};xl.CAP_SQUARE.get=function(){return 3};xl.JOIN_ROUND.get=function(){return 1};xl.JOIN_MITRE.get=function(){return 2};xl.JOIN_BEVEL.get=function(){return 3};xl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};xl.DEFAULT_MITRE_LIMIT.get=function(){return 5};xl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Nn,xl);var ki=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ve.COUNTERCLOCKWISE,this._inputLine=e||null},yd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};ki.prototype.isDeletable=function(e,t,n,i){var r=this._inputLine[e],l=this._inputLine[t],f=this._inputLine[n];return!this.isConcave(r,l,f)||!this.isShallow(r,l,f,i)?!1:this.isShallowSampled(r,l,e,n,i)};ki.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),r=!1;i=0;r--)n.addPt(e[r])};Ko.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=En.PI_TIMES_2;for(;e<=-Math.PI;)e+=En.PI_TIMES_2;return e};En.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)}};En.isAcute=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,l=n.x-t.x,f=n.y-t.y,a=i*l+r*f;return a>0};En.isObtuse=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,l=n.x-t.x,f=n.y-t.y,a=i*l+r*f;return a<0};En.interiorAngle=function(e,t,n){var i=En.angle(t,e),r=En.angle(t,n);return Math.abs(r-i)};En.normalizePositive=function(e){if(e<0){for(;e<0;)e+=En.PI_TIMES_2;e>=En.PI_TIMES_2&&(e=0)}else{for(;e>=En.PI_TIMES_2;)e-=En.PI_TIMES_2;e<0&&(e=0)}return e};En.angleBetween=function(e,t,n){var i=En.angle(t,e),r=En.angle(t,n);return En.diff(i,r)};En.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};En.toRadians=function(e){return e*Math.PI/180};En.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?En.COUNTERCLOCKWISE:n<0?En.CLOCKWISE:En.NONE};En.angleBetweenOriented=function(e,t,n){var i=En.angle(t,e),r=En.angle(t,n),l=r-i;return l<=-Math.PI?l+En.PI_TIMES_2:l>Math.PI?l-En.PI_TIMES_2:l};Bc.PI_TIMES_2.get=function(){return 2*Math.PI};Bc.PI_OVER_2.get=function(){return Math.PI/2};Bc.PI_OVER_4.get=function(){return Math.PI/4};Bc.COUNTERCLOCKWISE.get=function(){return ve.COUNTERCLOCKWISE};Bc.CLOCKWISE.get=function(){return ve.CLOCKWISE};Bc.NONE.get=function(){return ve.COLLINEAR};Object.defineProperties(En,Bc);var hi=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new ze,this._seg1=new ze,this._offset0=new ze,this._offset1=new ze,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Zu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Nn.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},vd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};hi.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ve.computeOrientation(this._s0,this._s1,this._s2),i=n===ve.CLOCKWISE&&this._side===re.LEFT||n===ve.COUNTERCLOCKWISE&&this._side===re.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};hi.prototype.addLineEndCap=function(e,t){var n=new ze(e,t),i=new ze;this.computeOffsetSegment(n,re.LEFT,this._distance,i);var r=new ze;this.computeOffsetSegment(n,re.RIGHT,this._distance,r);var l=t.x-e.x,f=t.y-e.y,a=Math.atan2(f,l);switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(t,a+Math.PI/2,a-Math.PI/2,ve.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Nn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Nn.CAP_SQUARE:var _=new Dt;_.x=Math.abs(this._distance)*Math.cos(a),_.y=Math.abs(this._distance)*Math.sin(a);var x=new Dt(i.p1.x+_.x,i.p1.y+_.y),S=new Dt(r.p1.x+_.x,r.p1.y+_.y);this._segList.addPt(x),this._segList.addPt(S);break}};hi.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};hi.prototype.addMitreJoin=function(e,t,n,i){var r=!0,l=null;try{l=ks.intersection(t.p0,t.p1,n.p0,n.p1);var f=i<=0?1:l.distance(e)/Math.abs(i);f>this._bufParams.getMitreLimit()&&(r=!1)}catch(a){if(a instanceof lf)l=new Dt(0,0),r=!1;else throw a}finally{}r?this._segList.addPt(l):this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())};hi.prototype.addFilletCorner=function(e,t,n,i,r){var l=t.x-e.x,f=t.y-e.y,a=Math.atan2(f,l),_=n.x-e.x,x=n.y-e.y,S=Math.atan2(x,_);i===ve.CLOCKWISE?a<=S&&(a+=2*Math.PI):a>=S&&(a-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,a,S,i,r),this._segList.addPt(n)};hi.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Dt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new Dt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};hi.prototype.createCircle=function(e){var t=new Dt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};hi.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};hi.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Ko,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*hi.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};hi.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Nn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Nn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ve.CLOCKWISE,this._distance))};hi.prototype.closeRing=function(){this._segList.closeRing()};hi.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};hi.prototype.interfaces_=function(){return[]};hi.prototype.getClass=function(){return hi};vd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};vd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};vd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};vd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(hi,vd);var mo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};mo.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),r=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],r):this.computeOffsetCurve(e,n,r);var l=r.getCoordinates();return n&&gn.reverse(l),l};mo.prototype.computeSingleSidedBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var r=ki.simplify(e,-i),l=r.length-1;n.initSideSegments(r[l],r[l-1],re.LEFT),n.addFirstSegment();for(var f=l-2;f>=0;f--)n.addNextSegment(r[f],!0)}else{n.addSegments(e,!1);var a=ki.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment(),n.closeRing()};mo.prototype.computeRingBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);t===re.RIGHT&&(i=-i);var r=ki.simplify(e,i),l=r.length-1;n.initSideSegments(r[l-1],r[0],t);for(var f=1;f<=l;f++){var a=f!==1;n.addNextSegment(r[f],a)}n.closeRing()};mo.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),i=ki.simplify(e,n),r=i.length-1;t.initSideSegments(i[0],i[1],re.LEFT);for(var l=2;l<=r;l++)t.addNextSegment(i[l],!0);t.addLastSegment(),t.addLineEndCap(i[r-1],i[r]);var f=ki.simplify(e,-n),a=f.length-1;t.initSideSegments(f[a],f[a-1],re.LEFT);for(var _=a-2;_>=0;_--)t.addNextSegment(f[_],!0);t.addLastSegment(),t.addLineEndCap(f[1],f[0]),t.closeRing()};mo.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:t.createCircle(e);break;case Nn.CAP_SQUARE:t.createSquare(e);break}};mo.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var r=t<0;this.computeSingleSidedBufferCurve(e,r,i)}else this.computeLineBufferCurve(e,i);var l=i.getCoordinates();return l};mo.prototype.getBufferParameters=function(){return this._bufParams};mo.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};mo.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return mo.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()};mo.prototype.computeOffsetCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var r=ki.simplify(e,-i),l=r.length-1;n.initSideSegments(r[l],r[l-1],re.LEFT),n.addFirstSegment();for(var f=l-2;f>=0;f--)n.addNextSegment(r[f],!0)}else{var a=ki.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment()};mo.prototype.getSegGen=function(e){return new hi(this._precisionModel,this._bufParams,e)};mo.prototype.interfaces_=function(){return[]};mo.prototype.getClass=function(){return mo};mo.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;nl.getMaxY()||e.findStabbedSegments(t,r.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(We(arguments[2],As)&&arguments[0]instanceof Dt&&arguments[1]instanceof vy)for(var f=arguments[0],a=arguments[1],_=arguments[2],x=a.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var L=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Le._seg.p1.y)&&ve.computeOrientation(e._seg.p0,e._seg.p1,f)!==ve.RIGHT){var A=a.getDepth(re.LEFT);e._seg.p0.equals(x[S])||(A=a.getDepth(re.RIGHT));var P=new Fu(e._seg,A);_.add(P)}}else if(We(arguments[2],As)&&arguments[0]instanceof Dt&&We(arguments[1],As))for(var O=arguments[0],B=arguments[1],U=arguments[2],Y=B.iterator();Y.hasNext();){var V=Y.next();V.isForward()&&e.findStabbedSegments(O,V,U)}}};Ec.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Os.min(t);return n._leftDepth};Ec.prototype.interfaces_=function(){return[]};Ec.prototype.getClass=function(){return Ec};Rx.DepthSegment.get=function(){return Fu};Object.defineProperties(Ec,Rx);var Fu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new ze(e),this._leftDepth=t};Fu.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};Fu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Fu.prototype.toString=function(){return this._upwardSeg.toString()};Fu.prototype.interfaces_=function(){return[bs]};Fu.prototype.getClass=function(){return Fu};var Rn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Rn.prototype.area=function(){return Rn.area(this.p0,this.p1,this.p2)};Rn.prototype.signedArea=function(){return Rn.signedArea(this.p0,this.p1,this.p2)};Rn.prototype.interpolateZ=function(e){if(e===null)throw new gi("Supplied point is null.");return Rn.interpolateZ(e,this.p0,this.p1,this.p2)};Rn.prototype.longestSideLength=function(){return Rn.longestSideLength(this.p0,this.p1,this.p2)};Rn.prototype.isAcute=function(){return Rn.isAcute(this.p0,this.p1,this.p2)};Rn.prototype.circumcentre=function(){return Rn.circumcentre(this.p0,this.p1,this.p2)};Rn.prototype.area3D=function(){return Rn.area3D(this.p0,this.p1,this.p2)};Rn.prototype.centroid=function(){return Rn.centroid(this.p0,this.p1,this.p2)};Rn.prototype.inCentre=function(){return Rn.inCentre(this.p0,this.p1,this.p2)};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Rn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Rn.det=function(e,t,n,i){return e*i-t*n};Rn.interpolateZ=function(e,t,n,i){var r=t.x,l=t.y,f=n.x-r,a=i.x-r,_=n.y-l,x=i.y-l,S=f*x-a*_,L=e.x-r,A=e.y-l,P=(x*L-a*A)/S,O=(-_*L+f*A)/S,B=t.z+P*(n.z-t.z)+O*(i.z-t.z);return B};Rn.longestSideLength=function(e,t,n){var i=e.distance(t),r=t.distance(n),l=n.distance(e),f=i;return r>f&&(f=r),l>f&&(f=l),f};Rn.isAcute=function(e,t,n){return!(!En.isAcute(e,t,n)||!En.isAcute(t,n,e)||!En.isAcute(n,e,t))};Rn.circumcentre=function(e,t,n){var i=n.x,r=n.y,l=e.x-i,f=e.y-r,a=t.x-i,_=t.y-r,x=2*Rn.det(l,f,a,_),S=Rn.det(f,l*l+f*f,_,a*a+_*_),L=Rn.det(l,l*l+f*f,a,a*a+_*_),A=i-S/x,P=r+L/x;return new Dt(A,P)};Rn.perpendicularBisector=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=new ks(e.x+n/2,e.y+i/2,1),l=new ks(e.x-i+n/2,e.y+n+i/2,1);return new ks(r,l)};Rn.angleBisector=function(e,t,n){var i=t.distance(e),r=t.distance(n),l=i/(i+r),f=n.x-e.x,a=n.y-e.y,_=new Dt(e.x+l*f,e.y+l*a);return _};Rn.area3D=function(e,t,n){var i=t.x-e.x,r=t.y-e.y,l=t.z-e.z,f=n.x-e.x,a=n.y-e.y,_=n.z-e.z,x=r*_-l*a,S=l*f-i*_,L=i*a-r*f,A=x*x+S*S+L*L,P=Math.sqrt(A)/2;return P};Rn.centroid=function(e,t,n){var i=(e.x+t.x+n.x)/3,r=(e.y+t.y+n.y)/3;return new Dt(i,r)};Rn.inCentre=function(e,t,n){var i=t.distance(n),r=e.distance(n),l=e.distance(t),f=i+r+l,a=(i*e.x+r*t.x+l*n.x)/f,_=(i*e.y+r*t.y+l*n.y)/f;return new Dt(a,_)};var vs=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new he;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};vs.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,zt.EXTERIOR,zt.INTERIOR)};vs.prototype.addPolygon=function(e){var t=this,n=this._distance,i=re.LEFT;this._distance<0&&(n=-this._distance,i=re.RIGHT);var r=e.getExteriorRing(),l=gn.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance)||this._distance<=0&&l.length<3)return null;this.addPolygonRing(l,n,i,zt.EXTERIOR,zt.INTERIOR);for(var f=0;f0&&t.isErodedCompletely(a,-t._distance)||t.addPolygonRing(_,n,re.opposite(i),zt.INTERIOR,zt.EXTERIOR)}};vs.prototype.isTriangleErodedCompletely=function(e,t){var n=new Rn(e[0],e[1],e[2]),i=n.inCentre(),r=ve.distancePointLine(i,n.p0,n.p1);return r=Va.MINIMUM_VALID_SIZE&&ve.isCCW(e)&&(l=r,f=i,n=re.opposite(n));var a=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(a,l,f)};vs.prototype.add=function(e){if(e.isEmpty())return null;e instanceof er?this.addPolygon(e):e instanceof Pi?this.addLineString(e):e instanceof Mo?this.addPoint(e):e instanceof jh?this.addCollection(e):e instanceof Ou?this.addCollection(e):e instanceof za?this.addCollection(e):e instanceof eo&&this.addCollection(e)};vs.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>r};vs.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new cf;var e=this._parent.getGeometryN(this._index++);return e instanceof eo?(this._subcollectionIterator=new Fa(e),this._subcollectionIterator.next()):e};Fa.prototype.remove=function(){throw new Error(this.getClass().getName())};Fa.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};Fa.prototype.interfaces_=function(){return[uf]};Fa.prototype.getClass=function(){return Fa};Fa.isAtomic=function(e){return!(e instanceof eo)};var $o=function(){this._geom=null;var e=arguments[0];this._geom=e};$o.prototype.locate=function(e){return $o.locate(e,this._geom)};$o.prototype.interfaces_=function(){return[Wh]};$o.prototype.getClass=function(){return $o};$o.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?ve.isPointInRing(e,t.getCoordinates()):!1};$o.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!$o.isPointInRing(e,n))return!1;for(var i=0;i=0;l--){var f=n._edgeList.get(l),a=f.getSym();r===null&&(r=a),i!==null&&a.setNext(i),i=f}r.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],r=this.findIndex(i),l=i.getDepth(re.LEFT),f=i.getDepth(re.RIGHT),a=this.computeDepths(r+1,this._edgeList.size(),l),_=this.computeDepths(0,r,a);if(_!==f)throw new ml("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var x=arguments[0],S=arguments[1],L=arguments[2],A=L,k=x;k=0;a--){var _=i._resultAreaEdgeList.get(a),x=_.getSym();switch(r===null&&_.getEdgeRing()===n&&(r=_),f){case i._SCANNING_FOR_INCOMING:if(x.getEdgeRing()!==n)continue;l=x,f=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==n)continue;l.setNextMin(_),f=i._SCANNING_FOR_INCOMING;break}}f===this._LINKING_TO_OUTGOING&&(an.isTrue(r!==null,"found null for first outgoing dirEdge"),an.isTrue(r.getEdgeRing()===n,"unable to link last incoming dirEdge"),l.setNextMin(r))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var r=i.next();r.isInResult()&&n++}return n}else if(arguments.length===1){for(var l=arguments[0],f=0,a=this.iterator();a.hasNext();){var _=a.next();_.getEdgeRing()===l&&f++}return f}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=zt.NONE,i=this.iterator();i.hasNext();){var r=i.next(),l=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){n=zt.INTERIOR;break}if(l.isInResult()){n=zt.EXTERIOR;break}}}if(n===zt.NONE)return null;for(var f=n,a=this.iterator();a.hasNext();){var _=a.next(),x=_.getSym();_.isLineEdge()?_.getEdge().setCovered(f===zt.INTERIOR):(_.isInResult()&&(f=zt.EXTERIOR),x.isInResult()&&(f=zt.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;e.prototype.computeLabelling.call(this,n),this._label=new Un(zt.NONE);for(var r=this.iterator();r.hasNext();)for(var l=r.next(),f=l.getEdge(),a=f.getLabel(),_=0;_<2;_++){var x=a.getLocation(_);(x===zt.INTERIOR||x===zt.BOUNDARY)&&i._label.setLocation(_,zt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jr),Rx=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new Mg(n,new NC)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jh),Jl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Jl.prototype.compareTo=function(e){var t=e,n=Jl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Jl.prototype.interfaces_=function(){return[vs]};Jl.prototype.getClass=function(){return Jl};Jl.orientation=function(e){return gn.increasingDirection(e)===1};Jl.compareOriented=function(e,t,n,i){for(var r=t?1:-1,l=i?1:-1,f=t?e.length:-1,a=i?n.length:-1,_=t?0:e.length-1,x=i?0:n.length-1;;){var S=e[_].compareTo(n[x]);if(S!==0)return S;_+=r,x+=l;var L=_===f,A=x===a;if(L&&!A)return-1;if(!L&&A)return 1;if(L&&A)return 0}};var Os=function(){this._edges=new he,this._ocaMap=new Ur};Os.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var r=i.getCoordinates(),l=0;l0&&e.print(","),e.print(r[l].x+" "+r[l].y);e.println(")")}e.print(") ")};Os.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};Os.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(r);l||i--;var f=new Array(i).fill(null),a=0;f[a++]=new Dt(e.coord);for(var _=e.segmentIndex+1;_<=t.segmentIndex;_++)f[a++]=n.edge.pts[_];return l&&(f[a]=t.coord),new ng(f,new Un(this.edge._label))};Ga.prototype.add=function(e,t,n){var i=new da(e,t,n),r=this._nodeMap.get(i);return r!==null?r:(this._nodeMap.put(i,i),i)};Ga.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};Ga.prototype.interfaces_=function(){return[]};Ga.prototype.getClass=function(){return Ga};var Bu=function(){};Bu.prototype.getChainStartIndices=function(e){var t=this,n=0,i=new he;i.add(new la(n));do{var r=t.findChainEnd(e,n);i.add(new la(r)),n=r}while(nn?t:n};_l.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(r=1),e._depth[t][i]=r}}};Cr.prototype.getDelta=function(e){return this._depth[e][re.RIGHT]-this._depth[e][re.LEFT]};Cr.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Cr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Cr.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var r=t.getLocation(n,i);(r===zt.EXTERIOR||r===zt.INTERIOR)&&(e.isNull(n,i)?e._depth[n][i]=Cr.depthAtLocation(r):e._depth[n][i]+=Cr.depthAtLocation(r))}else if(arguments.length===3){var l=arguments[0],f=arguments[1],a=arguments[2];a===zt.INTERIOR&&this._depth[l][f]++}};Cr.prototype.interfaces_=function(){return[]};Cr.prototype.getClass=function(){return Cr};Cr.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Cr.NULL_VALUE};Ox.NULL_VALUE.get=function(){return-1};Object.defineProperties(Cr,Ox);var ng=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new Ga(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Cr,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],r=arguments[1];this.pts=i,this._label=r}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,Un.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var r=n;if(this.pts.length!==r.pts.length)return!1;for(var l=!0,f=!0,a=this.pts.length,_=0;_0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var r=0;r0&&n.print(","),n.print(i.pts[r].x+" "+i.pts[r].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var r=this.pts.length-1;r>=0;r--)n.print(i.pts[r]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new _l(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Oe;for(var i=0;i0&&i.append(","),i.append(n.pts[r].x+" "+n.pts[r].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var r=0;ri||this._maxyl;if(f)return!1;var a=this.intersectsToleranceSquare(e,t);return an.isTrue(!(f&&a),"Found bad envelope test"),a};go.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Dt(this._maxx,this._maxy),this._corner[1]=new Dt(this._minx,this._maxy),this._corner[2]=new Dt(this._minx,this._miny),this._corner[3]=new Dt(this._maxx,this._miny)};go.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};go.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};go.prototype.getCoordinate=function(){return this._originalPt};go.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};go.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=go.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Oe(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};go.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};go.prototype.intersectsToleranceSquare=function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||e.equals(this._pt)||t.equals(this._pt))};go.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return this.intersects(n,i)?(e.addIntersection(this.getCoordinate(),t),!0):!1};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};Fx.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(go,Fx);var nd=function(){this.tempEnv1=new Oe,this.selectedSegment=new ze};nd.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};nd.prototype.interfaces_=function(){return[]};nd.prototype.getClass=function(){return nd};var Xh=function(){this._index=null;var e=arguments[0];this._index=e},Bx={HotPixelSnapAction:{configurable:!0}};Xh.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=t.getSafeEnvelope(),l=new Vx(t,n,i);return this._index.query(r,{interfaces_:function(){return[Yl]},visitItem:function(f){var a=f;a.select(r,l)}}),l.isNodeAdded()}};Xh.prototype.interfaces_=function(){return[]};Xh.prototype.getClass=function(){return Xh};Bx.HotPixelSnapAction.get=function(){return Vx};Object.defineProperties(Xh,Bx);var Vx=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],r=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],r=n.getContext();if(this._parentEdge!==null&&r===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,i)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(nd),Ec=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new he};Ec.prototype.processIntersections=function(e,t,n,i){var r=this;if(e===n&&t===i)return null;var l=e.getCoordinates()[t],f=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];if(this._li.computeIntersection(l,f,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var x=0;x=0;t--){try{e.bufferReducedPrecision(t)}catch(l){if(l instanceof ml)e._saveException=l;else throw l}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=Ir.precisionScaleFactor(this._argGeom,this._distance,n),r=new Dn(i);this.bufferFixedPrecision(r)}};Ir.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Dn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};Ir.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};Ir.prototype.bufferOriginalPrecision=function(){try{var e=new to(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof pl)this._saveException=t;else throw t}finally{}};Ir.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};Ir.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};Ir.prototype.interfaces_=function(){return[]};Ir.prototype.getClass=function(){return Ir};Ir.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new Ir(e),i=n.getResultGeometry(t);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ze&&typeof arguments[1]=="number"){var r=arguments[0],l=arguments[1],f=arguments[2],a=new Ir(r);a.setQuadrantSegments(f);var _=a.getResultGeometry(l);return _}else if(arguments[2]instanceof Nn&&arguments[0]instanceof Ze&&typeof arguments[1]=="number"){var x=arguments[0],S=arguments[1],L=arguments[2],A=new Ir(x,L),k=A.getResultGeometry(S);return k}}else if(arguments.length===4){var R=arguments[0],U=arguments[1],j=arguments[2],Q=arguments[3],B=new Ir(R);B.setQuadrantSegments(j),B.setEndCapStyle(Q);var X=B.getResultGeometry(U);return X}};Ir.precisionScaleFactor=function(e,t,n){var i=e.getEnvelopeInternal(),r=Ho.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),l=t>0?t:0,f=r+2*l,a=Math.trunc(Math.log(f)/Math.log(10)+1),_=n-a,x=Math.pow(10,_);return x};cf.CAP_ROUND.get=function(){return Nn.CAP_ROUND};cf.CAP_BUTT.get=function(){return Nn.CAP_FLAT};cf.CAP_FLAT.get=function(){return Nn.CAP_FLAT};cf.CAP_SQUARE.get=function(){return Nn.CAP_SQUARE};cf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Ir,cf);var Jr=function(){this._pt=[new Dt,new Dt],this._distance=tn.NaN,this._isNull=!0};Jr.prototype.getCoordinates=function(){return this._pt};Jr.prototype.getCoordinate=function(e){return this._pt[e]};Jr.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var i=t.distance(n);ithis._distance&&this.initialize(t,n,i)}};Jr.prototype.interfaces_=function(){return[]};Jr.prototype.getClass=function(){return Jr};var Da=function(){};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};Da.computeDistance=function(){if(arguments[2]instanceof Jr&&arguments[0]instanceof Mi&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=e.getCoordinates(),r=new ze,l=0;l0||this._isIn?zt.INTERIOR:zt.EXTERIOR)};zs.prototype.interfaces_=function(){return[]};zs.prototype.getClass=function(){return zs};var Qr=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];this._component=i,this._segIndex=r,this._pt=l}},Ux={INSIDE_AREA:{configurable:!0}};Qr.prototype.isInsideArea=function(){return this._segIndex===Qr.INSIDE_AREA};Qr.prototype.getCoordinate=function(){return this._pt};Qr.prototype.getGeometryComponent=function(){return this._component};Qr.prototype.getSegmentIndex=function(){return this._segIndex};Qr.prototype.interfaces_=function(){return[]};Qr.prototype.getClass=function(){return Qr};Ux.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Qr,Ux);var Wl=function(e){this._pts=e||null};Wl.prototype.filter=function(e){e instanceof Mo&&this._pts.add(e)};Wl.prototype.interfaces_=function(){return[ca]};Wl.prototype.getClass=function(){return Wl};Wl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Mo?Rs.singletonList(e):Wl.getPoints(e,new he)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Mo?n.add(t):t instanceof eo&&t.apply(new Wl(n)),n}};var Cc=function(){this._locations=null;var e=arguments[0];this._locations=e};Cc.prototype.filter=function(e){(e instanceof Mo||e instanceof Mi||e instanceof er)&&this._locations.add(new Qr(e,0,e.getCoordinate()))};Cc.prototype.interfaces_=function(){return[ca]};Cc.prototype.getClass=function(){return Cc};Cc.getLocations=function(e){var t=new he;return e.apply(new Cc(t)),t};var Mr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new zs,this._minDistanceLocation=null,this._minDistance=tn.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}};Mr.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=1-n,l=fl.getPolygons(this._geom[n]);if(l.size()>0){var f=Cc.getLocations(this._geom[r]);if(this.computeContainmentDistance(f,l,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&We(arguments[0],ks)&&We(arguments[1],ks)){for(var a=arguments[0],_=arguments[1],x=arguments[2],S=0;Sthis._minDistance)return null;for(var r=t.getCoordinates(),l=n.getCoordinate(),f=0;fthis._minDistance)return null;for(var k=S.getCoordinates(),R=L.getCoordinates(),U=0;Uthis._distance&&this.initialize(t,n,i)}};Br.prototype.interfaces_=function(){return[]};Br.prototype.getClass=function(){return Br};var ea=function(){};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};ea.computeDistance=function(){if(arguments[2]instanceof Br&&arguments[0]instanceof Mi&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=new ze,r=e.getCoordinates(),l=0;l1||e<=0)throw new di("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ms.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ms.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ms.prototype.computeOrientedDistance=function(e,t,n){var i=new Tc(t);if(e.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new tu(t,this._densifyFrac);e.apply(r),n.setMaximum(r.getMaxPointDistance())}};ms.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ms.prototype.interfaces_=function(){return[]};ms.prototype.getClass=function(){return ms};ms.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ms(e,t);return n.distance()}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2],f=new ms(i,r);return f.setDensifyFraction(l),f.distance()}};jy.MaxPointDistanceFilter.get=function(){return Tc};jy.MaxDensifiedByFractionDistanceFilter.get=function(){return tu};Object.defineProperties(ms,jy);var Tc=function(){this._maxPtDist=new Br,this._minPtDist=new Br,this._euclideanDist=new ea,this._geom=null;var e=arguments[0];this._geom=e};Tc.prototype.filter=function(e){this._minPtDist.initialize(),ea.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Tc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Tc.prototype.interfaces_=function(){return[Fa]};Tc.prototype.getClass=function(){return Tc};var tu=function(){this._maxPtDist=new Br,this._minPtDist=new Br,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};tu.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var i=e.getCoordinate(t-1),r=e.getCoordinate(t),l=(r.x-i.x)/this._numSubSegs,f=(r.y-i.y)/this._numSubSegs,a=0;an){this._isValid=!1;var r=i.getCoordinates();this._errorLocation=r[1],this._errorIndicator=e.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+As.toLineString(r[0],r[1])+")"}};Lo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=Lo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Lo.VERBOSE&&Lr.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Lo.prototype.checkNegativeValid=function(){if(!(this._input instanceof er||this._input instanceof Oa||this._input instanceof eo))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};Lo.prototype.getErrorIndicator=function(){return this._errorIndicator};Lo.prototype.checkMinimumDistance=function(e,t,n){var i=new Mr(e,t,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Pr.prototype.report=function(e){if(!Pr.VERBOSE)return null;Lr.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Pr.prototype.getErrorMessage=function(){return this._errorMsg};Pr.prototype.interfaces_=function(){return[]};Pr.prototype.getClass=function(){return Pr};Pr.isValidMsg=function(e,t,n){var i=new Pr(e,t,n);return i.isValid()?null:i.getErrorMessage()};Pr.isValid=function(e,t,n){var i=new Pr(e,t,n);return!!i.isValid()};Zy.VERBOSE.get=function(){return!1};Zy.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Pr,Zy);var ga=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};ga.prototype.getCoordinates=function(){return this._pts};ga.prototype.size=function(){return this._pts.length};ga.prototype.getCoordinate=function(e){return this._pts[e]};ga.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ga.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:wc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};ga.prototype.setData=function(e){this._data=e};ga.prototype.getData=function(){return this._data};ga.prototype.toString=function(){return As.toLineString(new Di(this._pts))};ga.prototype.interfaces_=function(){return[Ua]};ga.prototype.getClass=function(){return ga};var wr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new he,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};wr.prototype.getInteriorIntersection=function(){return this._interiorIntersection};wr.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};wr.prototype.getIntersectionSegments=function(){return this._intSegments};wr.prototype.count=function(){return this._intersectionCount};wr.prototype.getIntersections=function(){return this._intersections};wr.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};wr.prototype.setKeepIntersections=function(e){this._keepIntersections=e};wr.prototype.processIntersections=function(e,t,n,i){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===i)return null;if(this._isCheckEndSegmentsOnly){var r=this.isEndSegment(e,t)||this.isEndSegment(n,i);if(!r)return null}var l=e.getCoordinates()[t],f=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];this._li.computeIntersection(l,f,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=l,this._intSegments[1]=f,this._intSegments[2]=a,this._intSegments[3]=_,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};wr.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};wr.prototype.hasIntersection=function(){return this._interiorIntersection!==null};wr.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};wr.prototype.interfaces_=function(){return[Fu]};wr.prototype.getClass=function(){return wr};wr.createAllIntersectionsFinder=function(e){var t=new wr(e);return t.setFindAllIntersections(!0),t};wr.createAnyIntersectionFinder=function(e){return new wr(e)};wr.createIntersectionCounter=function(e){var t=new wr(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Fs=function(){this._li=new qu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Fs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Fs.prototype.getIntersections=function(){return this._segInt.getIntersections()};Fs.prototype.isValid=function(){return this.execute(),this._isValid};Fs.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Fs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new wr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new Uy;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Fs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ml(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Fs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+As.toLineString(e[0],e[1])+" and "+As.toLineString(e[2],e[3])};Fs.prototype.interfaces_=function(){return[]};Fs.prototype.getClass=function(){return Fs};Fs.computeIntersections=function(e){var t=new Fs(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var Uu=function e(){this._nv=null;var t=arguments[0];this._nv=new Fs(e.toSegmentStrings(t))};Uu.prototype.checkValid=function(){this._nv.checkValid()};Uu.prototype.interfaces_=function(){return[]};Uu.prototype.getClass=function(){return Uu};Uu.toSegmentStrings=function(e){for(var t=new he,n=e.iterator();n.hasNext();){var i=n.next();t.add(new ga(i.getCoordinates(),i))}return t};Uu.checkValid=function(e){var t=new Uu(e);t.checkValid()};var Lc=function(e){this._mapOp=e};Lc.prototype.map=function(e){for(var t=this,n=new he,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};_o.prototype.interfaces_=function(){return[]};_o.prototype.getClass=function(){return _o};var qa=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ze,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Mi&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var i=arguments[0],r=arguments[1];this._srcPts=i,this._isClosed=e.isClosed(i),this._snapTolerance=r}};qa.prototype.snapVertices=function(e,t){for(var n=this,i=this._isClosed?e.size()-1:e.size(),r=0;r=0&&e.add(f+1,new Dt(l),!1)}};qa.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,i=tn.MAX_VALUE,r=-1,l=0;lt&&(t=i)}return t}else if(arguments.length===2){var r=arguments[0],l=arguments[1];return Math.min(Ri.computeOverlaySnapTolerance(r),Ri.computeOverlaySnapTolerance(l))}};Ri.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),i=n*Ri.SNAP_PRECISION_FACTOR;return i};Ri.snapToSelf=function(e,t,n){var i=new Ri(e);return i.snapToSelf(t,n)};Gx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Ri,Gx);var jx=function(e){function t(n,i,r){e.call(this),this._snapTolerance=n||null,this._snapPts=i||null,this._isSelfSnap=r!==void 0?r:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var r=new qa(n,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var r=n.toCoordinateArray(),l=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(l)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_o),Kr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Kr.prototype.getCommon=function(){return tn.longBitsToDouble(this._commonBits)};Kr.prototype.add=function(e){var t=tn.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Kr.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Kr.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Kr.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Kr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Kr.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=tn.longBitsToDouble(e),n=tn.toBinaryString(e),i="0000000000000000000000000000000000000000000000000000000000000000"+n,r=i.substring(i.length-64),l=r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+t+" ]";return l}};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};Kr.getBit=function(e,t){var n=1<>52};Kr.zeroLowerBits=function(e,t){var n=(1<=0;i--){if(Kr.getBit(e,i)!==Kr.getBit(t,i))return n;n++}return 52};var eu=function(){this._commonCoord=null,this._ccFilter=new Pc},Wy={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};eu.prototype.addCommonBits=function(e){var t=new nu(this._commonCoord);e.apply(t),e.geometryChanged()};eu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Dt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new nu(t);return e.apply(n),e.geometryChanged(),e};eu.prototype.getCommonCoordinate=function(){return this._commonCoord};eu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};eu.prototype.interfaces_=function(){return[]};eu.prototype.getClass=function(){return eu};Wy.CommonCoordinateFilter.get=function(){return Pc};Wy.Translater.get=function(){return nu};Object.defineProperties(eu,Wy);var Pc=function(){this._commonBitsX=new Kr,this._commonBitsY=new Kr};Pc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Pc.prototype.getCommonCoordinate=function(){return new Dt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Pc.prototype.interfaces_=function(){return[Fa]};Pc.prototype.getClass=function(){return Pc};var nu=function(){this.trans=null;var e=arguments[0];this.trans=e};nu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,i=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,i)};nu.prototype.isDone=function(){return!1};nu.prototype.isGeometryChanged=function(){return!0};nu.prototype.interfaces_=function(){return[Ns]};nu.prototype.getClass=function(){return nu};var Sr=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};Sr.prototype.selfSnap=function(e){var t=new Ri(e),n=t.snapTo(e,this._snapTolerance);return n};Sr.prototype.removeCommonBits=function(e){this._cbr=new eu,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};Sr.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};Sr.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=sn.overlayOp(t[0],t[1],e);return this.prepareResult(n)};Sr.prototype.checkValid=function(e){e.isValid()||Lr.out.println("Snapped geometry is invalid")};Sr.prototype.computeSnapTolerance=function(){this._snapTolerance=Ri.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};Sr.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Ri.snap(t[0],t[1],this._snapTolerance);return n};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};Sr.overlayOp=function(e,t,n){var i=new Sr(e,t);return i.getResultGeometry(n)};Sr.union=function(e,t){return Sr.overlayOp(e,t,sn.UNION)};Sr.intersection=function(e,t){return Sr.overlayOp(e,t,sn.INTERSECTION)};Sr.symDifference=function(e,t){return Sr.overlayOp(e,t,sn.SYMDIFFERENCE)};Sr.difference=function(e,t){return Sr.overlayOp(e,t,sn.DIFFERENCE)};var ro=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};ro.prototype.getResultGeometry=function(e){var t=null,n=!1,i=null;try{t=sn.overlayOp(this._geom[0],this._geom[1],e);var r=!0;r&&(n=!0)}catch(l){if(l instanceof pl)i=l;else throw l}finally{}if(!n)try{t=Sr.overlayOp(this._geom[0],this._geom[1],e)}catch(l){throw l instanceof pl?i:l}finally{}return t};ro.prototype.interfaces_=function(){return[]};ro.prototype.getClass=function(){return ro};ro.overlayOp=function(e,t,n){var i=new ro(e,t);return i.getResultGeometry(n)};ro.union=function(e,t){return ro.overlayOp(e,t,sn.UNION)};ro.intersection=function(e,t){return ro.overlayOp(e,t,sn.INTERSECTION)};ro.symDifference=function(e,t){return ro.overlayOp(e,t,sn.SYMDIFFERENCE)};ro.difference=function(e,t){return ro.overlayOp(e,t,sn.DIFFERENCE)};var id=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};id.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};id.prototype.interfaces_=function(){return[]};id.prototype.getClass=function(){return id};var Ao=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];this._eventType=e.INSERT,this._label=i,this._xValue=r,this._obj=l}},Xy={INSERT:{configurable:!0},DELETE:{configurable:!0}};Ao.prototype.isDelete=function(){return this._eventType===Ao.DELETE};Ao.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};Ao.prototype.getObject=function(){return this._obj};Ao.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};Ao.prototype.getInsertEvent=function(){return this._insertEvent};Ao.prototype.isInsert=function(){return this._eventType===Ao.INSERT};Ao.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};Ao.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Ao.prototype.interfaces_=function(){return[vs]};Ao.prototype.getClass=function(){return Ao};Xy.INSERT.get=function(){return 1};Xy.DELETE.get=function(){return 2};Object.defineProperties(Ao,Xy);var ig=function(){};ig.prototype.interfaces_=function(){return[]};ig.prototype.getClass=function(){return ig};var kr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};kr.prototype.isTrivialIntersection=function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(kr.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var r=e.getNumPoints()-1;if(t===0&&i===r||i===0&&t===r)return!0}}return!1};kr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};kr.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};kr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};kr.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next(),r=i.getCoordinate();if(e.isIntersection(r))return!0}return!1};kr.prototype.hasProperIntersection=function(){return this._hasProper};kr.prototype.hasIntersection=function(){return this._hasIntersection};kr.prototype.isDone=function(){return this._isDone};kr.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};kr.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};kr.prototype.addIntersections=function(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var r=e.getCoordinates()[t],l=e.getCoordinates()[t+1],f=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,l,f,a),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};kr.prototype.interfaces_=function(){return[]};kr.prototype.getClass=function(){return kr};kr.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var DC=function(e){function t(){e.call(this),this.events=new he,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Rs.sort(this.events);for(var i=0;it||this._maxl?1:0};rd.prototype.interfaces_=function(){return[Rh]};rd.prototype.getClass=function(){return rd};var RC=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],i=arguments[1],r=arguments[2];this._min=n,this._max=i,this._item=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;r.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Za),OC=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],i=arguments[1];this._node1=n,this._node2=i,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,r),this._node2!==null&&this._node2.query(n,i,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Za),Wa=function(){this._leaves=new he,this._root=null,this._level=0};Wa.prototype.buildTree=function(){var e=this;Rs.sort(this._leaves,new Za.NodeComparator);for(var t=this._leaves,n=null,i=new he;;){if(e.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}};Wa.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new RC(e,t,n))};Wa.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};Wa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Wa.prototype.printNode=function(e){Lr.out.println(As.toLineString(new Dt(e._min,this._level),new Dt(e._max,this._level)))};Wa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Wa.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),r=0,l=n.iterator();l.hasNext();){var f=l.next();i[r++]=f.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,r){if(this.isBoundaryNode(n,i))return null;r===zt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,r)},t.prototype.addPolygonRing=function(n,i,r){if(n.isEmpty())return null;var l=gn.removeRepeatedPoints(n.getCoordinates());if(l.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var f=i,a=r;ve.isCCW(l)&&(f=r,a=i);var _=new ng(l,new Un(this._argIndex,zt.BOUNDARY,f,a));this._lineEdgeMap.put(n,_),this.insertEdge(_),this.insertPoint(this._argIndex,l[0],zt.BOUNDARY)},t.prototype.insertPoint=function(n,i,r){var l=this._nodes.addNode(i),f=l.getLabel();f===null?l._label=new Un(n,r):f.setLocation(n,r)},t.prototype.createEdgeSetIntersector=function(){return new DC},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,r=this._edges.iterator();r.hasNext();)for(var l=r.next(),f=l.getLabel().getLocation(n),a=l.eiList.iterator();a.hasNext();){var _=a.next();i.addSelfIntersectionNode(n,_.coord,f)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Oa&&(this._useBoundaryDeterminationRule=!1),n instanceof er)this.addPolygon(n);else if(n instanceof Mi)this.addLineString(n);else if(n instanceof Mo)this.addPoint(n);else if(n instanceof Gh)this.addCollection(n);else if(n instanceof Ru)this.addCollection(n);else if(n instanceof Oa)this.addCollection(n);else if(n instanceof eo)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,r=0;r50?(this._areaPtLocator===null&&(this._areaPtLocator=new Yh(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?zt.BOUNDARY:zt.INTERIOR},t}(bi),Jh=function(){if(this._li=new qu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new xp(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=gs.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xp(0,t,i),this._arg[1]=new xp(1,n,i)}else if(arguments.length===3){var r=arguments[0],l=arguments[1],f=arguments[2];r.getPrecisionModel().compareTo(l.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(l.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xp(0,r,f),this._arg[1]=new xp(1,l,f)}};Jh.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Jh.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Jh.prototype.interfaces_=function(){return[]};Jh.prototype.getClass=function(){return Jh};var Au=function(){};Au.prototype.interfaces_=function(){return[]};Au.prototype.getClass=function(){return Au};Au.map=function(){if(arguments[0]instanceof Ze&&We(arguments[1],Au.MapOp)){for(var e=arguments[0],t=arguments[1],n=new he,i=0;i=e.size()?null:e.get(t)};ji.union=function(e){var t=new ji(e);return t.union()};Wx.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(ji,Wx);var rg=function(){};rg.prototype.interfaces_=function(){return[]};rg.prototype.getClass=function(){return rg};rg.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return sn.createEmptyResult(sn.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),ro.overlayOp(e,t,sn.UNION)};function Zu(){return new og}function og(){this.reset()}og.prototype={constructor:og,reset:function(){this.s=this.t=0},add:function(e){b1(km,e,this.t),b1(this,km.s,this.s),this.s?this.t+=km.t:this.s=km.t},valueOf:function(){return this.s}};var km=new og;function b1(e,t,n){var i=e.s=t+n,r=i-t,l=i-r;e.t=t-l+(n-r)}var Ci=1e-6,Kn=Math.PI,hl=Kn/2,x1=Kn/4,yl=Kn*2,Cu=180/Kn,Qs=Kn/180,$r=Math.abs,zC=Math.atan,$h=Math.atan2,Qi=Math.cos,$i=Math.sin,hf=Math.sqrt;function Xx(e){return e>1?0:e<-1?Kn:Math.acos(e)}function kc(e){return e>1?hl:e<-1?-hl:Math.asin(e)}function Ap(){}function sg(e,t){e&&S1.hasOwnProperty(e.type)&&S1[e.type](e,t)}var w1={Feature:function(e,t){sg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++iKn?e-yl:e<-Kn?e+yl:e,t]}wy.invert=wy;function BC(e,t,n){return(e%=yl)?t||n?Hx(C1(e),T1(t,n)):C1(e):t||n?T1(t,n):wy}function I1(e){return function(t,n){return t+=e,[t>Kn?t-yl:t<-Kn?t+yl:t,n]}}function C1(e){var t=I1(e);return t.invert=I1(-e),t}function T1(e,t){var n=Qi(e),i=$i(e),r=Qi(t),l=$i(t);function f(a,_){var x=Qi(_),S=Qi(a)*x,L=$i(a)*x,A=$i(_),k=A*n+S*i;return[$h(L*r-k*l,S*n-A*i),kc(k*r+L*l)]}return f.invert=function(a,_){var x=Qi(_),S=Qi(a)*x,L=$i(a)*x,A=$i(_),k=A*r-L*l;return[$h(L*r+A*l,S*n+k*i),kc(k*n-S*i)]},f}function VC(e,t,n,i,r,l){if(n){var f=Qi(t),a=$i(t),_=i*n;r==null?(r=t+i*yl,l=t-_/2):(r=L1(f,r),l=L1(f,l),(i>0?rl)&&(r+=i*yl));for(var x,S=r;i>0?S>l:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function UC(e,t,n,i,r,l){var f=e[0],a=e[1],_=t[0],x=t[1],S=0,L=1,A=_-f,k=x-a,R;if(R=n-f,!(!A&&R>0)){if(R/=A,A<0){if(R0){if(R>L)return;R>S&&(S=R)}if(R=r-f,!(!A&&R<0)){if(R/=A,A<0){if(R>L)return;R>S&&(S=R)}else if(A>0){if(R0)){if(R/=k,k<0){if(R0){if(R>L)return;R>S&&(S=R)}if(R=l-a,!(!k&&R<0)){if(R/=k,k<0){if(R>L)return;R>S&&(S=R)}else if(k>0){if(R0&&(e[0]=f+S*A,e[1]=a+S*k),L<1&&(t[0]=f+L*A,t[1]=a+L*k),!0}}}}}function Gm(e,t){return $r(e[0]-t[0])=0;--a)r.point((L=S[a])[0],L[1]);else i(A.x,A.p.x,-1,r);A=A.p}A=A.o,S=A.z,k=!k}while(!A.v);r.lineEnd()}}}function M1(e){if(t=e.length){for(var t,n=0,i=e[0],r;++nt?1:e>=t?0:NaN}function GC(e){return e.length===1&&(e=jC(e)),{left:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[l],n)<0?i=l+1:r=l}return i},right:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[l],n)>0?r=l:i=l+1}return i}}}function jC(e){return function(t,n){return Jx(e(t),n)}}GC(Jx);function Qx(e){for(var t=e.length,n,i=-1,r=0,l,f;++i=0;)for(f=e[t],n=f.length;--n>=0;)l[--r]=f[n];return l}var Np=1e9,Rm=-Np;function qC(e,t,n,i){function r(x,S){return e<=x&&x<=n&&t<=S&&S<=i}function l(x,S,L,A){var k=0,R=0;if(x==null||(k=f(x,L))!==(R=f(S,L))||_(x,S)<0^L>0)do A.point(k===0||k===3?e:n,k>1?i:t);while((k=(k+L+4)%4)!==R);else A.point(S[0],S[1])}function f(x,S){return $r(x[0]-e)0?0:3:$r(x[0]-n)0?2:1:$r(x[1]-t)0?1:0:S>0?3:2}function a(x,S){return _(x.x,S.x)}function _(x,S){var L=f(x,1),A=f(S,1);return L!==A?L-A:L===0?S[1]-x[1]:L===1?x[0]-S[0]:L===2?x[1]-S[1]:S[0]-x[0]}return function(x){var S=x,L=Yx(),A,k,R,U,j,Q,B,X,J,it,ft,mt={point:_t,lineStart:vt,lineEnd:me,polygonStart:Mt,polygonEnd:xt};function _t(Gt,te){r(Gt,te)&&S.point(Gt,te)}function ct(){for(var Gt=0,te=0,se=k.length;tei&&(fn-Fe)*(i-ke)>(Jn-ke)*(e-Fe)&&++Gt:Jn<=i&&(fn-Fe)*(i-ke)<(Jn-ke)*(e-Fe)&&--Gt;return Gt}function Mt(){S=L,A=[],k=[],ft=!0}function xt(){var Gt=ct(),te=ft&&Gt,se=(A=Qx(A)).length;(te||se)&&(x.polygonStart(),te&&(x.lineStart(),l(null,null,1,x),x.lineEnd()),se&&Kx(A,a,Gt,l,x),x.polygonEnd()),S=x,A=k=R=null}function vt(){mt.point=Rt,k&&k.push(R=[]),it=!0,J=!1,B=X=NaN}function me(){A&&(Rt(U,j),Q&&J&&L.rejoin(),A.push(L.result())),mt.point=_t,J&&S.lineEnd()}function Rt(Gt,te){var se=r(Gt,te);if(k&&R.push([Gt,te]),it)U=Gt,j=te,Q=se,it=!1,se&&(S.lineStart(),S.point(Gt,te));else if(se&&J)S.point(Gt,te);else{var Ce=[B=Math.max(Rm,Math.min(Np,B)),X=Math.max(Rm,Math.min(Np,X))],yn=[Gt=Math.max(Rm,Math.min(Np,Gt)),te=Math.max(Rm,Math.min(Np,te))];UC(Ce,yn,e,t,n,i)?(J||(S.lineStart(),S.point(Ce[0],Ce[1])),S.point(yn[0],yn[1]),se||S.lineEnd(),ft=!1):se&&(S.lineStart(),S.point(Gt,te),ft=!1)}B=Gt,X=te,J=se}return mt}}var K_=Zu();function ZC(e,t){var n=t[0],i=t[1],r=[$i(n),-Qi(n),0],l=0,f=0;K_.reset();for(var a=0,_=e.length;a<_;++a)if(S=(x=e[a]).length)for(var x,S,L=x[S-1],A=L[0],k=L[1]/2+x1,R=$i(k),U=Qi(k),j=0;j=0?1:-1,_t=mt*ft,ct=_t>Kn,Mt=R*J;if(K_.add($h(Mt*mt*$i(_t),U*it+Mt*Qi(_t))),l+=ct?ft+mt*yl:ft,ct^A>=n^B>=n){var xt=ag(tf(L),tf(Q));xy(xt);var vt=ag(r,xt);xy(vt);var me=(ct^ft>=0?-1:1)*kc(vt[2]);(i>me||i===me&&(xt[0]||xt[1]))&&(f+=ct^ft>=0?1:-1)}}return(l<-Ci||lod&&(od=e),tug&&(ug=t)}Zu();function $x(e,t,n,i){return function(r,l){var f=t(l),a=r.invert(i[0],i[1]),_=Yx(),x=t(_),S=!1,L,A,k,R={point:U,lineStart:Q,lineEnd:B,polygonStart:function(){R.point=X,R.lineStart=J,R.lineEnd=it,A=[],L=[]},polygonEnd:function(){R.point=U,R.lineStart=Q,R.lineEnd=B,A=Qx(A);var ft=ZC(L,a);A.length?(S||(l.polygonStart(),S=!0),Kx(A,HC,ft,n,l)):ft&&(S||(l.polygonStart(),S=!0),l.lineStart(),n(null,null,1,l),l.lineEnd()),S&&(l.polygonEnd(),S=!1),A=L=null},sphere:function(){l.polygonStart(),l.lineStart(),n(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function U(ft,mt){var _t=r(ft,mt);e(ft=_t[0],mt=_t[1])&&l.point(ft,mt)}function j(ft,mt){var _t=r(ft,mt);f.point(_t[0],_t[1])}function Q(){R.point=j,f.lineStart()}function B(){R.point=U,f.lineEnd()}function X(ft,mt){k.push([ft,mt]);var _t=r(ft,mt);x.point(_t[0],_t[1])}function J(){x.lineStart(),k=[]}function it(){X(k[0][0],k[0][1]),x.lineEnd();var ft=x.clean(),mt=_.result(),_t,ct=mt.length,Mt,xt,vt;if(k.pop(),L.push(k),k=null,!!ct){if(ft&1){if(xt=mt[0],(Mt=xt.length-1)>0){for(S||(l.polygonStart(),S=!0),l.lineStart(),_t=0;_t1&&ft&2&&mt.push(mt.pop().concat(mt.shift())),A.push(mt.filter(XC))}}return R}}function XC(e){return e.length>1}function HC(e,t){return((e=e.x)[0]<0?e[1]-hl-Ci:hl-e[1])-((t=t.x)[0]<0?t[1]-hl-Ci:hl-t[1])}const A1=$x(function(){return!0},YC,JC,[-Kn,-hl]);function YC(e){var t=NaN,n=NaN,i=NaN,r;return{lineStart:function(){e.lineStart(),r=1},point:function(l,f){var a=l>0?Kn:-Kn,_=$r(l-t);$r(_-Kn)0?hl:-hl),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(l,n),r=0):i!==a&&_>=Kn&&($r(t-i)Ci?zC(($i(t)*(l=Qi(i))*$i(n)-$i(i)*(r=Qi(t))*$i(e))/(r*l*f)):(t+i)/2}function JC(e,t,n,i){var r;if(e==null)r=n*hl,i.point(-Kn,r),i.point(0,r),i.point(Kn,r),i.point(Kn,0),i.point(Kn,-r),i.point(0,-r),i.point(-Kn,-r),i.point(-Kn,0),i.point(-Kn,r);else if($r(e[0]-t[0])>Ci){var l=e[0]0,r=$r(n)>Ci;function l(S,L,A,k){VC(k,e,t,A,S,L)}function f(S,L){return Qi(S)*Qi(L)>n}function a(S){var L,A,k,R,U;return{lineStart:function(){R=k=!1,U=1},point:function(j,Q){var B=[j,Q],X,J=f(j,Q),it=i?J?0:x(j,Q):J?x(j+(j<0?Kn:-Kn),Q):0;if(!L&&(R=k=J)&&S.lineStart(),J!==k&&(X=_(L,B),(!X||Gm(L,X)||Gm(B,X))&&(B[0]+=Ci,B[1]+=Ci,J=f(B[0],B[1]))),J!==k)U=0,J?(S.lineStart(),X=_(B,L),S.point(X[0],X[1])):(X=_(L,B),S.point(X[0],X[1]),S.lineEnd()),L=X;else if(r&&L&&i^J){var ft;!(it&A)&&(ft=_(B,L,!0))&&(U=0,i?(S.lineStart(),S.point(ft[0][0],ft[0][1]),S.point(ft[1][0],ft[1][1]),S.lineEnd()):(S.point(ft[1][0],ft[1][1]),S.lineEnd(),S.lineStart(),S.point(ft[0][0],ft[0][1])))}J&&(!L||!Gm(L,B))&&S.point(B[0],B[1]),L=B,k=J,A=it},lineEnd:function(){k&&S.lineEnd(),L=null},clean:function(){return U|(R&&k)<<1}}}function _(S,L,A){var k=tf(S),R=tf(L),U=[1,0,0],j=ag(k,R),Q=Am(j,j),B=j[0],X=Q-B*B;if(!X)return!A&&S;var J=n*Q/X,it=-n*B/X,ft=ag(U,j),mt=Nm(U,J),_t=Nm(j,it);Y_(mt,_t);var ct=ft,Mt=Am(mt,ct),xt=Am(ct,ct),vt=Mt*Mt-xt*(Am(mt,mt)-1);if(!(vt<0)){var me=hf(vt),Rt=Nm(ct,(-Mt-me)/xt);if(Y_(Rt,mt),Rt=by(Rt),!A)return Rt;var Gt=S[0],te=L[0],se=S[1],Ce=L[1],yn;te0^Rt[1]<($r(Rt[0]-Gt)Kn^(Gt<=Rt[0]&&Rt[0]<=te)){var ke=Nm(ct,(-Mt+me)/xt);return Y_(ke,mt),[Rt,by(ke)]}}}function x(S,L){var A=i?e:Kn-e,k=0;return S<-A?k|=1:S>A&&(k|=2),L<-A?k|=4:L>A&&(k|=8),k}return $x(f,a,l,i?[0,-e]:[-Kn,e-Kn])}function tw(e){return function(t){var n=new Sy;for(var i in e)n[i]=e[i];return n.stream=t,n}}function Sy(){}Sy.prototype={constructor:Sy,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ew(e,t,n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],l=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),l!=null&&e.clipExtent(null),FC(n,e.stream(k1));var f=k1.result(),a=Math.min(i/(f[1][0]-f[0][0]),r/(f[1][1]-f[0][1])),_=+t[0][0]+(i-a*(f[1][0]+f[0][0]))/2,x=+t[0][1]+(r-a*(f[1][1]+f[0][1]))/2;return l!=null&&e.clipExtent(l),e.scale(a*150).translate([_,x])}function $C(e,t,n){return ew(e,[[0,0],t],n)}var N1=16,tT=Qi(30*Qs);function D1(e,t){return+t?nT(e,t):eT(e)}function eT(e){return tw({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function nT(e,t){function n(i,r,l,f,a,_,x,S,L,A,k,R,U,j){var Q=x-i,B=S-r,X=Q*Q+B*B;if(X>4*t&&U--){var J=f+A,it=a+k,ft=_+R,mt=hf(J*J+it*it+ft*ft),_t=kc(ft/=mt),ct=$r($r(ft)-1)t||$r((Q*me+B*Rt)/X-.5)>.3||f*A+a*k+_*R2?Rt[2]%360*Qs:0,vt()):[x*Cu,S*Cu,L*Cu]},ct.precision=function(Rt){return arguments.length?(ft=D1(xt,it=Rt*Rt),me()):hf(it)},ct.fitExtent=function(Rt,Gt){return ew(ct,Rt,Gt)},ct.fitSize=function(Rt,Gt){return $C(ct,Rt,Gt)};function vt(){k=Hx(A=BC(x,S,L),t);var Rt=t(a,_);return l=i-Rt[0]*n,f=r+Rt[1]*n,me()}function me(){return mt=_t=null,ct}return function(){return t=e.apply(this,arguments),ct.invert=t.invert&&Mt,vt()}}function nw(e){return function(t,n){var i=Qi(t),r=Qi(n),l=e(i*r);return[l*r*$i(t),l*$i(n)]}}function iw(e){return function(t,n){var i=hf(t*t+n*n),r=e(i),l=$i(r),f=Qi(r);return[$h(t*l,i*f),kc(i&&n*l/i)]}}var sT=nw(function(e){return hf(2/(1+e))});sT.invert=iw(function(e){return 2*kc(e/2)});var rw=nw(function(e){return(e=Xx(e))&&e/$i(e)});rw.invert=iw(function(e){return e});function aT(){return rT(rw).scale(79.4188).clipAngle(180-.001)}function R1(e,t){return[e,t]}R1.invert=R1;function lT(e,t,n){n=n||{};var i=n.units||"kilometers",r=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof r!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var l=[];switch(e.type){case"GeometryCollection":return vx(e,function(f){var a=jm(f,t,i,r);a&&l.push(a)}),gy(l);case"FeatureCollection":return m1(e,function(f){var a=jm(f,t,i,r);a&&m1(a,function(_){_&&l.push(_)})}),gy(l)}return jm(e,t,i,r)}function jm(e,t,n,i){var r=e.properties||{},l=e.type==="Feature"?e.geometry:e;if(l.type==="GeometryCollection"){var f=[];return vx(e,function(U){var j=jm(U,t,n,i);j&&f.push(j)}),gy(f)}var a=uT(l),_={type:l.type,coordinates:sw(l.coordinates,a)},x=new Vy,S=x.read(_),L=gC(_C(t,n),"meters"),A=Ir.bufferOp(S,L,i),k=new Mx;if(A=k.write(A),!ow(A.coordinates)){var R={type:A.type,coordinates:aw(A.coordinates,a)};return yg(R,r)}}function ow(e){return Array.isArray(e[0])?ow(e[0]):isNaN(e[0])}function sw(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return sw(n,t)})}function aw(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return aw(n,t)})}function uT(e){var t=vC(e).geometry.coordinates,n=[-t[0],-t[1]];return aT().rotate(n).scale(jo)}function cT(e,t){var n=$m(e),i=$m(t),r=e.properties||{},l=dx.difference(n.coordinates,i.coordinates);return l.length===0?null:l.length===1?gx(l[0],r):_x(l,r)}function O1(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function z1(e,t){const n=cT({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const i=lT(e,0);if(i.geometry.type==="Polygon")for(const r of i.geometry.coordinates)O1(r);else for(const r of i.geometry.coordinates)for(const l of r)O1(l);t({type:"FeatureCollection",features:[i,n]})}let F1={type:"FeatureCollection",features:[]};function hT(e,t,n=!0,i=!0,r={},l={},f={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let a,_=[],x,S;function L(){(f!=null&&f.fill||f!=null&&f.line)&&e.addSource("full-geom",{type:"geojson",data:F1}),f!=null&&f.fill&&e.addLayer({...f==null?void 0:f.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),f!=null&&f.line&&e.addLayer({...f==null?void 0:f.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?L():e.once("load",()=>{L()});const A=R=>{a==null||a({type:"mapClick",coordinates:[R.lngLat.lng,R.lngLat.lat]})};function k(R=!1){if(!t)throw new Error;const U=document.createElement("div");return R&&U.classList.add("marker-interactive"),new VI({props:{displayIn:"maplibre"},target:U}),new t.Marker({element:U,offset:[1,-13]})}return{setEventHandler(R){R?(a=R,e.on("click",A)):(a=void 0,e.off("click",A))},flyTo(R,U){e.flyTo({center:R,zoom:U,...r})},fitBounds(R,U,j){e.fitBounds([[R[0],R[1]],[R[2],R[3]]],{padding:U,maxZoom:j,...l})},indicateReverse(R){e.getCanvasContainer().style.cursor=R?"crosshair":""},setReverseMarker(R){!t||!n||(S?R?S.setLngLat(R):(S.remove(),S=void 0):R&&(S=(typeof n=="object"?new t.Marker(n):k()).setLngLat(R).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(R,U){if(!n)return;function j(Q){var B;(B=e.getSource("full-geom"))==null||B.setData(Q)}for(const Q of _)Q.remove();if(_.length=0,j(F1),!!t){if(U){let Q=!1;if(U.geometry.type==="GeometryCollection"){const B=U.geometry.geometries.filter(X=>X.type==="Polygon"||X.type==="MultiPolygon");if(B.length>0){let X=B.pop();for(const J of B)X=yC(X,J);z1({...U,geometry:X},j),Q=!0}else{const X=U.geometry.geometries.filter(J=>J.type==="LineString"||J.type==="MultiLineString");X.length>0&&(j({...U,geometry:{type:"GeometryCollection",geometries:X}}),Q=!0)}}if(!Q){if(U.geometry.type==="Polygon"||U.geometry.type==="MultiPolygon")z1(U,j);else if(U.geometry.type==="LineString"||U.geometry.type==="MultiLineString"){j(U);return}}n&&_.push((typeof n=="object"?new t.Marker(n):k()).setLngLat(U.center).addTo(e))}if(i)for(const Q of R??[]){if(Q===U)continue;const B=(typeof i=="object"?new t.Marker(i):k(!0)).setLngLat(Q.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(Q.place_type[0]==="reverse"?Q.place_name:Q.place_name.replace(/,.*/,""))).addTo(e),X=B.getElement();X.addEventListener("click",J=>{J.stopPropagation(),a==null||a({type:"markerClick",id:Q.id})}),X.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:Q.id}),B.togglePopup()}),X.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:Q.id}),B.togglePopup()}),_.push(B)}}},setSelectedMarker(R){x&&x.getElement().classList.toggle("marker-selected",!1),x=R>-1?_[R]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const R=e.getCenter();return[e.getZoom(),R.lng,R.lat]}}}function fT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),It(n,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),It(t,"viewBox","0 0 14 14"),It(t,"width","13"),It(t,"height","13"),It(t,"class","svelte-en2qvf")},m(i,r){At(i,t,r),lt(t,n)},p:we,i:we,o:we,d(i){i&&kt(t)}}}class lw extends nn{constructor(t){super(),en(this,t,null,fT,Ye,{})}}function pT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),It(n,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),It(t,"viewBox","0 0 30 30"),It(t,"fill","none"),It(t,"xmlns","http://www.w3.org/2000/svg"),It(t,"class","svelte-d2loi5")},m(i,r){At(i,t,r),lt(t,n)},p:we,i:we,o:we,d(i){i&&kt(t)}}}class uw extends nn{constructor(t){super(),en(this,t,null,pT,Ye,{})}}function dT(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"area.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"area.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function mT(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"reverse.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"reverse.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function gT(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"poi.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"poi.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function _T(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"postal_code.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"postal_code.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function yT(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"street.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"street.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function vT(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"road.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"road.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function bT(e){let t,n;return{c(){t=dt("img"),hr(t.src,n=e[3]+"housenumber.svg")||It(t,"src",n),It(t,"alt",e[6]),It(t,"class","svelte-ltkwvy")},m(i,r){At(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"housenumber.svg")&&It(t,"src",n),r&64&&It(t,"alt",i[6])},d(i){i&&kt(t)}}}function xT(e){let t,n,i,r;return{c(){t=dt("img"),hr(t.src,n=e[5])||It(t,"src",n),It(t,"alt",e[4]),It(t,"class","svelte-ltkwvy")},m(l,f){At(l,t,f),i||(r=be(t,"error",e[14]),i=!0)},p(l,f){f&32&&!hr(t.src,n=l[5])&&It(t,"src",n),f&16&&It(t,"alt",l[4])},d(l){l&&kt(t),i=!1,r()}}}function B1(e){let t,n;return{c(){t=dt("span"),n=Xe(e[6]),It(t,"class","secondary svelte-ltkwvy")},m(i,r){At(i,t,r),lt(t,n)},p(i,r){r&64&&qi(n,i[6])},d(i){i&&kt(t)}}}function wT(e){var mt,_t;let t,n,i,r,l,f,a,_,x=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,L,A=e[2]==="always"||e[2]&&!e[0].address&&((mt=e[0].properties)==null?void 0:mt.kind)!=="road"&&((_t=e[0].properties)==null?void 0:_t.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],k,R,U=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",j,Q,B;function X(ct,Mt){var xt,vt;return Mt&1&&(n=null),Mt&1&&(i=null),Mt&1&&(r=null),ct[5]?xT:ct[0].address?bT:((xt=ct[0].properties)==null?void 0:xt.kind)==="road"||((vt=ct[0].properties)==null?void 0:vt.kind)==="road_relation"?vT:(n==null&&(n=!!ct[0].id.startsWith("address.")),n?yT:(i==null&&(i=!!ct[0].id.startsWith("postal_code.")),i?_T:(r==null&&(r=!!ct[0].id.startsWith("poi.")),r?gT:ct[7]?mT:dT)))}let J=X(e,-1),it=J(e),ft=A&&B1(e);return{c(){t=dt("li"),it.c(),l=Zt(),f=dt("span"),a=dt("span"),_=dt("span"),S=Xe(x),L=Zt(),ft&&ft.c(),k=Zt(),R=dt("span"),j=Xe(U),It(_,"class","primary svelte-ltkwvy"),It(a,"class","svelte-ltkwvy"),It(R,"class","line2 svelte-ltkwvy"),It(f,"class","texts svelte-ltkwvy"),It(t,"tabindex","0"),It(t,"data-selected",e[1]),It(t,"class","svelte-ltkwvy"),cl(t,"selected",e[1])},m(ct,Mt){At(ct,t,Mt),it.m(t,null),lt(t,l),lt(t,f),lt(f,a),lt(a,_),lt(_,S),lt(a,L),ft&&ft.m(a,null),lt(f,k),lt(f,R),lt(R,j),Q||(B=[be(t,"mouseenter",e[12]),be(t,"focus",e[13])],Q=!0)},p(ct,[Mt]){var xt,vt;J===(J=X(ct,Mt))&&it?it.p(ct,Mt):(it.d(1),it=J(ct),it&&(it.c(),it.m(t,l))),Mt&1&&x!==(x=(ct[7]?ct[0].place_name:ct[0].place_name.replace(/,.*/,""))+"")&&qi(S,x),Mt&37&&(A=ct[2]==="always"||ct[2]&&!ct[0].address&&((xt=ct[0].properties)==null?void 0:xt.kind)!=="road"&&((vt=ct[0].properties)==null?void 0:vt.kind)!=="road_relation"&&!ct[0].id.startsWith("address.")&&!ct[0].id.startsWith("postal_code.")&&(!ct[0].id.startsWith("poi.")||!ct[5])&&!ct[7]),A?ft?ft.p(ct,Mt):(ft=B1(ct),ft.c(),ft.m(a,null)):ft&&(ft.d(1),ft=null),Mt&1&&U!==(U=(ct[7]?"":ct[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&qi(j,U),Mt&2&&It(t,"data-selected",ct[1]),Mt&2&&cl(t,"selected",ct[1])},i:we,o:we,d(ct){ct&&kt(t),it.d(),ft&&ft.d(),Q=!1,Wi(B)}}}function ST(e,t,n){var X;let i,r,{feature:l}=t,{selected:f=!1}=t,{showPlaceType:a}=t,{missingIconsCache:_}=t,{iconsBaseUrl:x}=t;const S=(X=l.properties)==null?void 0:X.categories;let L,A,k=0,R=l.place_type[0]==="reverse";function U(J){A&&_.add(A),n(10,k++,k)}function j(J){ii.call(this,e,J)}function Q(J){ii.call(this,e,J)}const B=J=>U(J.currentTarget);return e.$$set=J=>{"feature"in J&&n(0,l=J.feature),"selected"in J&&n(1,f=J.selected),"showPlaceType"in J&&n(2,a=J.showPlaceType),"missingIconsCache"in J&&n(9,_=J.missingIconsCache),"iconsBaseUrl"in J&&n(3,x=J.iconsBaseUrl)},e.$$.update=()=>{var J,it,ft,mt;if(e.$$.dirty&3640)do n(11,i--,i),n(4,L=S==null?void 0:S[i]),n(5,A=L?x+L.replace(/ /g,"_")+".svg":void 0);while(i>-1&&(!A||_.has(A)));e.$$.dirty&1&&n(6,r=l.id.startsWith("poi.")?(it=(J=l.properties)==null?void 0:J.categories)==null?void 0:it.join(", "):((mt=(ft=l.properties)==null?void 0:ft.place_type_name)==null?void 0:mt[0])??l.place_type[0])},n(11,i=(S==null?void 0:S.length)??0),[l,f,a,x,L,A,r,R,U,_,k,i,j,Q,B]}class ET extends nn{constructor(t){super(),en(this,t,ST,wT,Ye,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function IT(e){let t;return{c(){t=dt("div"),t.innerHTML='',It(t,"class","svelte-7cmwmc")},m(n,i){At(n,t,i)},p:we,i:we,o:we,d(n){n&&kt(t)}}}class CT extends nn{constructor(t){super(),en(this,t,null,IT,Ye,{})}}function TT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),It(n,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),It(t,"viewBox","0 0 60.006 21.412"),It(t,"width","14"),It(t,"height","20"),It(t,"class","svelte-en2qvf")},m(i,r){At(i,t,r),lt(t,n)},p:we,i:we,o:we,d(i){i&&kt(t)}}}class LT extends nn{constructor(t){super(),en(this,t,null,TT,Ye,{})}}function MT(e){let t,n,i;return{c(){t=Zl("svg"),n=Zl("circle"),i=Zl("path"),It(n,"cx","4.789"),It(n,"cy","4.787"),It(n,"r","3.85"),pi(n,"stroke-width","1.875"),pi(n,"fill","none"),It(i,"d","M12.063 12.063 7.635 7.635"),pi(i,"stroke-width","1.875"),pi(i,"stroke-linecap","round"),It(t,"xmlns","http://www.w3.org/2000/svg"),It(t,"width","13"),It(t,"height","13"),It(t,"viewBox","0 0 13 13"),It(t,"class","svelte-1bpbt60")},m(r,l){At(r,t,l),lt(t,n),lt(t,i)},p:we,i:we,o:we,d(r){r&&kt(t)}}}class PT extends nn{constructor(t){super(),en(this,t,null,MT,Ye,{})}}function kT(e,t,n){const i=t[1],r=t[0],l=i-r;return e===i&&n?e:((e-r)%l+l)%l+r}function V1(e){const t=[...e];return t[2]i[0]||r.maxZoom!=null&&r.maxZoomDate.now()){if(!wp.coords)break t;return wp.coords}let l;try{return l=await new Promise((f,a)=>{n.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{f([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},r)}),l}catch{}finally{r.cachedLocationExpiry&&(wp={time:Date.now(),coords:l})}if(n.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(i&&r.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}const U1=/(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?/i,G1=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?/i,j1=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?/i,q1=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?/i;function NT(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(f=>Number(f.trim()));let n=Z1(t[0],e),i=Z1(t[1],e);n.endsWith('.0"')&&i.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),i=i.replace(/\.0"$/,'"'));const r=t[0]>=0?" N":" S",l=t[1]>=0?" E":" W";return`${n+r}, ${i+l}`}else throw new Error("no decimal coordinates to convert")}function Z1(e,t){const n=Math.abs(e),i=Math.floor(n),r=(n-i)*60;if(t=="DM"){let a=DT(r,3).toFixed(3).padStart(6,"0");return`${i}° ${a}'`}let l=Math.floor(r),f=((r-l)*60).toFixed(1).padStart(4,"0");return l=l.toString().padStart(2,"0"),`${i}° ${l}' ${f}"`}function DT(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function Yy(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,i=null,r="",l="",f=[],a=!1;if(U1.test(e))if(f=U1.exec(e),a=Om(f),a){if(n=f[2],i=f[6],n.includes(",")&&(n=n.replace(",",".")),i.includes(",")&&(i=i.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(i))==Number(i))throw new Error("integer only coordinate provided");f[1]?(r=f[1],l=f[5]):f[4]&&(r=f[4],l=f[8])}else throw new Error("invalid decimal coordinate format");else if(G1.test(e))if(f=G1.exec(e),a=Om(f),a)n=Math.abs(parseInt(f[2])),f[4]&&(n+=f[4]/60),f[6]&&(n+=f[6].replace(",",".")/3600),parseInt(f[2])<0&&(n=-1*n),i=Math.abs(parseInt(f[9])),f[11]&&(i+=f[11]/60),f[13]&&(i+=f[13].replace(",",".")/3600),parseInt(f[9])<0&&(i=-1*i),f[1]?(r=f[1],l=f[8]):f[7]&&(r=f[7],l=f[14]);else throw new Error("invalid DMS coordinates format");else if(j1.test(e))if(f=j1.exec(e),a=Om(f),a)n=Math.abs(parseInt(f[2])),f[4]&&(n+=f[4]/60),f[6]&&(n+=f[6]/3600),parseInt(f[2])<0&&(n=-1*n),i=Math.abs(parseInt(f[10])),f[12]&&(i+=f[12]/60),f[14]&&(i+=f[14]/3600),parseInt(f[10])<0&&(i=-1*i),f[1]?(r=f[1],l=f[9]):f[8]&&(r=f[8],l=f[16]);else throw new Error("invalid DMS coordinates format");else if(q1.test(e))if(f=q1.exec(e),a=Om(f),a)n=Math.abs(parseInt(f[2])),f[4]&&(n+=f[4]/60),f[6]&&(n+=f[6]/3600),parseInt(f[2])<0&&(n=-1*n),i=Math.abs(parseInt(f[10])),f[12]&&(i+=f[12]/60),f[14]&&(i+=f[14]/3600),parseInt(f[10])<0&&(i=-1*i),f[1]?(r=f[1],l=f[9]):f[8]&&(r=f[8],l=f[16]);else throw new Error("invalid coordinates format");if(a){if(Math.abs(i)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((r||l)&&(!r||!l))throw new Error("invalid coordinates format");if(r&&r==l)throw new Error("invalid coordinates format");let _=/S|SOUTH/i;_.test(r)&&n>0&&(n=-1*n),_=/W|WEST/i,_.test(l)&&i>0&&(i=-1*i);const x=f[0].trim();let S,L;const A=/[,/;\u0020]/g,k=x.match(A);if(k==null){const j=Math.floor(e.length/2);S=x.substring(0,j).trim(),L=x.substring(j).trim()}else{let j;k.length%2==1?j=Math.floor(k.length/2):j=k.length/2-1;let Q=0;if(j==0)Q=x.indexOf(k[0]),S=x.substring(0,Q).trim(),L=x.substring(Q+1).trim();else{let B=0,X=0;for(;B<=j;)Q=x.indexOf(k[B],X),X=Q+1,B++;S=x.substring(0,Q).trim(),L=x.substring(Q+1).trim()}}const R=S.split(".");if(R.length==2&&R[1]==0&&R[1].length!=2)throw new Error("invalid coordinates format");const U=L.split(".");if(U.length==2&&U[1]==0&&U[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(L))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(i)&&i.includes(",")&&(i=i.replace(",",".")),i=Number(Number(i).toFixed(t)),Object.freeze({verbatimCoordinates:x,verbatimLatitude:S,verbatimLongitude:L,decimalLatitude:n,decimalLongitude:i,decimalCoordinates:`${n},${i}`,closeEnough:RT,toCoordinateFormat:NT})}else throw new Error("coordinates pattern match failed")}function Om(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,i=/[eastsouthnorthwest]+/i,r=t.length/2;for(let l=0;l{t.decimalLatitude?e.push(t):e.push({...t,...FT})}),[...e,...BT,...VT]}const GT=UT();Yy.formats=GT.map(e=>e.verbatimCoordinates);const jT=Yy;function X1(e,t,n){const i=e.slice();return i[81]=t[n],i[83]=n,i}function H1(e){let t,n;return t=new CT({}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function Y1(e){let t,n,i,r,l;return n=new LT({}),{c(){t=dt("button"),Qt(n.$$.fragment),It(t,"type","button"),It(t,"title",e[9]),It(t,"class","svelte-zh3kmv"),cl(t,"active",e[0])},m(f,a){At(f,t,a),Kt(n,t,null),i=!0,r||(l=be(t,"click",e[67]),r=!0)},p(f,a){(!i||a[0]&512)&&It(t,"title",f[9]),(!i||a[0]&1)&&cl(t,"active",f[0])},i(f){i||(wt(n.$$.fragment,f),i=!0)},o(f){Pt(n.$$.fragment,f),i=!1},d(f){f&&kt(t),Jt(n),r=!1,l()}}}function qT(e){let t,n=[],i=new Map,r,l,f,a=aa(e[14]);const _=x=>x[81].id+(x[81].address?","+x[81].address:"");for(let x=0;x{mt=null}),Li()),(!X||Gt[0]&2)&&cl(x,"displayable",Rt[1]!==""),Rt[5]===!0?_t?(_t.p(Rt,Gt),Gt[0]&32&&wt(_t,1)):(_t=Y1(Rt),_t.c(),wt(_t,1),_t.m(i,R)):_t&&(Ti(),Pt(_t,1,1,()=>{_t=null}),Li()),Mt&&Mt.p&&(!X||Gt[1]&134217728)&&lr(Mt,ct,Rt,Rt[58],X?ar(ct,Rt[58],Gt,null):ur(Rt[58]),null);let te=j;j=me(Rt),j===te?~j&&vt[j].p(Rt,Gt):(Q&&(Ti(),Pt(vt[te],1,1,()=>{vt[te]=null}),Li()),~j?(Q=vt[j],Q?Q.p(Rt,Gt):(Q=vt[j]=xt[j](Rt),Q.c()),wt(Q,1),Q.m(n,null)):Q=null),(!X||Gt[0]&4&&B!==(B=qm(Rt[2])+" svelte-zh3kmv"))&&It(n,"class",B),(!X||Gt[0]&22)&&cl(n,"can-collapse",Rt[4]&&Rt[1]==="")},i(Rt){X||(wt(ft),wt(l.$$.fragment,Rt),wt(L.$$.fragment,Rt),wt(mt),wt(_t),wt(Mt,Rt),wt(Q),X=!0)},o(Rt){Pt(ft),Pt(l.$$.fragment,Rt),Pt(L.$$.fragment,Rt),Pt(mt),Pt(_t),Pt(Mt,Rt),Pt(Q),X=!1},d(Rt){Rt&&(kt(t),kt(n)),Jt(l),e[61](null),Jt(L),mt&&mt.d(),_t&&_t.d(),Mt&&Mt.d(Rt),~j&&vt[j].d(),J=!1,Wi(it)}}}function YT(e,t,n){let i,{$$slots:r={},$$scope:l}=t,{class:f=void 0}=t,{apiKey:a}=t,{bbox:_=void 0}=t,{clearButtonTitle:x="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:L=!1}=t,{country:A=void 0}=t,{debounceSearch:k=200}=t,{enableReverse:R=!1}=t,{errorMessage:U="Something went wrong…"}=t,{filter:j=()=>!0}=t,{flyTo:Q=!0}=t,{fuzzyMatch:B=!0}=t,{language:X=void 0}=t,{limit:J=void 0}=t,{mapController:it=void 0}=t,{minLength:ft=2}=t,{noResultsMessage:mt="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=t,{placeholder:_t="Search"}=t,{proximity:ct=[{type:"server-geolocation"}]}=t,{reverseActive:Mt=R==="always"}=t,{reverseButtonTitle:xt="toggle reverse geocoding"}=t,{searchValue:vt=""}=t,{showFullGeometry:me=!0}=t,{showPlaceType:Rt="ifNeeded"}=t,{showResultsWhileTyping:Gt=!0}=t,{selectFirst:te=!0}=t,{flyToSelected:se=!1}=t,{markerOnSelected:Ce=!0}=t,{types:yn=void 0}=t,{excludeTypes:jn=!1}=t,{zoom:$e=16}=t,{maxZoom:Fe=18}=t,{apiUrl:ke="https://api.maptiler.com/geocoding"}=t,{fetchParameters:fn={}}=t,{iconsBaseUrl:Jn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.1/icons/"}=t,{adjustUrlQuery:qn=Z=>{}}=t;function ie(){Xn.focus()}function De(){Xn.blur()}function hn(Z,ot=!0){n(1,vt=Z),ot?(n(15,pn=-1),es()):(yo(),setTimeout(()=>{Xn.focus(),Xn.select()}))}function On(){n(14,gt=void 0),n(55,qe=void 0),n(15,pn=-1)}function mi(){n(54,Ie=[]),n(55,qe=void 0)}let wn=!1,gt,Ie,qe,nr="",Xn,pn=-1,Xi,jt=[],Fi,fr,zn,In;const ts=new Set,oo=Nc();sa(()=>{it&&(it.setEventHandler(void 0),it.indicateReverse(!1),it.setSelectedMarker(-1),it.setMarkers(void 0,void 0))});function es(Z){if(fr&&(clearTimeout(fr),fr=void 0),pn>-1&>)n(55,qe=gt[pn]),n(1,vt=qe.place_type[0]==="reverse"?qe.place_name:qe.place_name.replace(/,.*/,"")),n(18,Xi=void 0),n(54,Ie=void 0),n(15,pn=-1);else if(vt){const ot=Z||!Ha(vt);Us(vt,{exact:!0}).then(()=>{n(54,Ie=gt),n(55,qe=void 0),ot&&Gs()}).catch(Ct=>n(18,Xi=Ct))}}function Ha(Z){try{return jT(Z,6)}catch{return!1}}async function Us(Z,{byId:ot=!1,exact:Ct=!1}={}){n(18,Xi=void 0),Fi==null||Fi.abort();const yt=new AbortController;n(19,Fi=yt);try{const rt=Ha(Z),St=new URLSearchParams;if(X!==void 0&&St.set("language",Array.isArray(X)?X.join(","):X??""),yn&&St.set("types",yn.join(",")),jn&&St.set("excludeTypes",String(jn)),_&&St.set("bbox",_.map(Ne=>Ne.toFixed(6)).join(",")),A&&St.set("country",Array.isArray(A)?A.join(","):A),!ot&&!rt){const Ne=await AT(it,ct,yt);Ne&&St.set("proximity",Ne),(Ct||!Gt)&&St.set("autocomplete","false"),St.set("fuzzyMatch",String(B))}J!==void 0&&(!rt||(yn==null?void 0:yn.length)===1)&&St.set("limit",String(J)),St.set("key",a),qn(St);const qt=ke+"/"+encodeURIComponent(rt?rt.decimalLongitude+","+rt.decimalLatitude:Z)+".json?"+St.toString();if(qt===nr){ot?(n(14,gt=void 0),n(55,qe=jt[0])):n(14,gt=jt);return}nr=qt;const Wt=await fetch(qt,{signal:yt.signal,...fn});if(!Wt.ok)throw new Error(await Wt.text());const Ht=await Wt.json();oo("response",{url:qt,featureCollection:Ht}),ot?(n(14,gt=void 0),n(55,qe=Ht.features[0]),jt=[qe]):(n(14,gt=Ht.features.filter(j)),rt&>.unshift({type:"Feature",properties:{},id:"reverse_"+rt.decimalLongitude+"_"+rt.decimalLatitude,text:rt.decimalLatitude+", "+rt.decimalLongitude,place_name:rt.decimalLatitude+", "+rt.decimalLongitude,place_type:["reverse"],center:[rt.decimalLongitude,rt.decimalLatitude],bbox:[rt.decimalLongitude,rt.decimalLatitude,rt.decimalLongitude,rt.decimalLatitude],geometry:{type:"Point",coordinates:[rt.decimalLongitude,rt.decimalLatitude]}}),jt=gt,rt&&Xn.focus())}catch(rt){if(rt&&typeof rt=="object"&&"name"in rt&&rt.name==="AbortError")return;throw rt}finally{yt===Fi&&n(19,Fi=void 0)}}function Gs(){var Ct;if(!(Ie!=null&&Ie.length)||!Q)return;const Z=[180,90,-180,-90],ot=!Ie.some(yt=>!yt.matching_text);for(const yt of Ie)if(ot||!yt.matching_text)for(const rt of[0,1,2,3])Z[rt]=Math[rt<2?"min":"max"](Z[rt],((Ct=yt.bbox)==null?void 0:Ct[rt])??yt.center[rt%2]);it&&Ie.length>0&&(qe&&Z[0]===Z[2]&&Z[1]===Z[3]?it.flyTo(qe.center,$e):it.fitBounds(V1(Z),50,Fe))}function wa(Z){n(0,Mt=R==="always"),n(14,gt=void 0),n(55,qe=void 0),n(15,pn=-1),hn(Z[1].toFixed(6)+", "+kT(Z[0],[-180,180],!0).toFixed(6),!1)}function ae(Z){if(!gt)return;let ot=Z.key==="ArrowDown"?1:Z.key==="ArrowUp"?-1:0;ot&&(pn===(te?0:-1)&&ot===-1&&n(15,pn=gt.length),n(15,pn+=ot),pn>=gt.length&&n(15,pn=-1),pn<0&&te&&n(15,pn=0),Z.preventDefault())}function yo(Z=!0){if(n(18,Xi=void 0),Gt){if(fr&&clearTimeout(fr),vt.length{Us(ot).catch(Ct=>n(18,Xi=Ct))},Z?k:0)}else n(14,gt=void 0),n(18,Xi=void 0)}function ri(Z){n(55,qe=Z),n(1,vt=Z.place_name),n(15,pn=-1)}const Sa=()=>Xn.focus();function xs(Z){cr[Z?"unshift":"push"](()=>{Xn=Z,n(17,Xn)})}function ue(){vt=this.value,n(1,vt),n(13,wn),n(27,S)}const ln=()=>n(13,wn=!0),Je=()=>n(13,wn=!1),Ar=()=>yo(),ns=()=>{n(1,vt=""),Xn.focus()},on=()=>n(0,Mt=!Mt),ws=()=>n(18,Xi=void 0),st=Z=>n(15,pn=Z),V=Z=>ri(Z),q=()=>{te||n(15,pn=-1)},K=()=>{};return e.$$set=Z=>{"class"in Z&&n(2,f=Z.class),"apiKey"in Z&&n(25,a=Z.apiKey),"bbox"in Z&&n(26,_=Z.bbox),"clearButtonTitle"in Z&&n(3,x=Z.clearButtonTitle),"clearOnBlur"in Z&&n(27,S=Z.clearOnBlur),"collapsed"in Z&&n(4,L=Z.collapsed),"country"in Z&&n(28,A=Z.country),"debounceSearch"in Z&&n(29,k=Z.debounceSearch),"enableReverse"in Z&&n(5,R=Z.enableReverse),"errorMessage"in Z&&n(6,U=Z.errorMessage),"filter"in Z&&n(30,j=Z.filter),"flyTo"in Z&&n(31,Q=Z.flyTo),"fuzzyMatch"in Z&&n(32,B=Z.fuzzyMatch),"language"in Z&&n(33,X=Z.language),"limit"in Z&&n(34,J=Z.limit),"mapController"in Z&&n(35,it=Z.mapController),"minLength"in Z&&n(36,ft=Z.minLength),"noResultsMessage"in Z&&n(7,mt=Z.noResultsMessage),"placeholder"in Z&&n(8,_t=Z.placeholder),"proximity"in Z&&n(37,ct=Z.proximity),"reverseActive"in Z&&n(0,Mt=Z.reverseActive),"reverseButtonTitle"in Z&&n(9,xt=Z.reverseButtonTitle),"searchValue"in Z&&n(1,vt=Z.searchValue),"showFullGeometry"in Z&&n(38,me=Z.showFullGeometry),"showPlaceType"in Z&&n(10,Rt=Z.showPlaceType),"showResultsWhileTyping"in Z&&n(39,Gt=Z.showResultsWhileTyping),"selectFirst"in Z&&n(11,te=Z.selectFirst),"flyToSelected"in Z&&n(40,se=Z.flyToSelected),"markerOnSelected"in Z&&n(41,Ce=Z.markerOnSelected),"types"in Z&&n(42,yn=Z.types),"excludeTypes"in Z&&n(43,jn=Z.excludeTypes),"zoom"in Z&&n(44,$e=Z.zoom),"maxZoom"in Z&&n(45,Fe=Z.maxZoom),"apiUrl"in Z&&n(46,ke=Z.apiUrl),"fetchParameters"in Z&&n(47,fn=Z.fetchParameters),"iconsBaseUrl"in Z&&n(12,Jn=Z.iconsBaseUrl),"adjustUrlQuery"in Z&&n(48,qn=Z.adjustUrlQuery),"$$scope"in Z&&n(58,l=Z.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,zn=wn),S&&!wn&&n(1,vt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&vt.lengthn(18,Xi=Z)),e.$$.dirty[1]&50356241&&(it&&qe&&qe.id!==In&&Q&&(!qe.bbox||qe.bbox[0]===qe.bbox[2]&&qe.bbox[1]===qe.bbox[3]?it.flyTo(qe.center,qe.id.startsWith("poi.")||qe.id.startsWith("address.")?Fe:$e):it.fitBounds(V1(qe.bbox),50,Fe),n(14,gt=void 0),n(54,Ie=void 0),n(15,pn=-1)),n(56,In=qe==null?void 0:qe.id)),e.$$.dirty[0]&18432&&te&>!=null&>.length&&n(15,pn=0),e.$$.dirty[0]&2050&&(te||n(15,pn=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Ie!==gt&&n(54,Ie=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&it&&it.setEventHandler(Z=>{switch(Z.type){case"mapClick":Mt&&wa(Z.coordinates);break;case"markerClick":{const ot=gt==null?void 0:gt.find(Ct=>Ct.id===Z.id);ot&&ri(ot)}break;case"markerMouseEnter":Ie&&n(15,pn=zn?(gt==null?void 0:gt.findIndex(ot=>ot.id===Z.id))??-1:-1);break;case"markerMouseLeave":Ie&&n(15,pn=-1);break}}),e.$$.dirty[0]&49152&&n(57,i=gt==null?void 0:gt[pn]),e.$$.dirty[1]&67133969&&it&&i&&Q&&se&&it.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Fe:$e),e.$$.dirty[1]&1040&&(Ce||it==null||it.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&it&&Ce&&!Ie&&(it.setMarkers(i?[i]:void 0,void 0),it.setSelectedMarker(i?0:-1)),e.$$.dirty[1]&25165840&&it&&it.setMarkers(Ie,qe),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Ie&&it&&it.setSelectedMarker(pn),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&it){const Z=Ha(vt);it.setReverseMarker(Z?[Z.decimalLongitude,Z.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&oo("select",i),e.$$.dirty[1]&16777216&&oo("pick",qe),e.$$.dirty[0]&81920&&oo("optionsVisibilityChange",zn&&!!gt),e.$$.dirty[0]&16384&&oo("featuresListed",gt),e.$$.dirty[1]&8388608&&oo("featuresMarked",Ie),e.$$.dirty[0]&1&&oo("reverseToggle",Mt),e.$$.dirty[0]&2&&oo("queryChange",vt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&it&&it.indicateReverse(Mt)},[Mt,vt,f,x,L,R,U,mt,_t,xt,Rt,te,Jn,wn,gt,pn,zn,Xn,Xi,Fi,ts,es,ae,yo,ri,a,_,S,A,k,j,Q,B,X,J,it,ft,ct,me,Gt,se,Ce,yn,jn,$e,Fe,ke,fn,qn,ie,De,hn,On,mi,Ie,qe,In,i,l,r,Sa,xs,ue,ln,Je,Ar,ns,on,ws,st,V,q,K]}class KT extends nn{constructor(t){super(),en(this,t,YT,HT,Ye,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function J1(e){let t,n,i;return n=new KT({props:{mapController:e[0],apiKey:Py}}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"class","svelte-ixhnie")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p(r,l){const f={};l&1&&(f.mapController=r[0]),n.$set(f)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function JT(e){let t,n,i=e[0]&&J1(e);return{c(){i&&i.c(),t=$o()},m(r,l){i&&i.m(r,l),At(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&wt(i,1)):(i=J1(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function QT(e,t,n){let i,r;return Ee(e,Nu,l=>n(1,r=l)),e.$$.update=()=>{e.$$.dirty&2&&n(0,i=r?hT(r,Ls):null)},[i,r]}class $T extends nn{constructor(t){super(),en(this,t,QT,JT,Ye,{})}}const tL=e=>({}),Q1=e=>({}),eL=e=>({}),$1=e=>({}),nL=e=>({}),tb=e=>({});function iL(e){let t,n,i,r,l,f;const a=e[1].top,_=sr(a,e,e[0],tb),x=e[1].left,S=sr(x,e,e[0],$1),L=e[1].main,A=sr(L,e,e[0],Q1);return{c(){t=dt("div"),_&&_.c(),n=Zt(),i=dt("div"),S&&S.c(),r=Zt(),l=dt("div"),A&&A.c(),It(t,"class","top svelte-3nmiww"),It(i,"class","left svelte-3nmiww"),It(l,"class","main svelte-3nmiww")},m(k,R){At(k,t,R),_&&_.m(t,null),At(k,n,R),At(k,i,R),S&&S.m(i,null),At(k,r,R),At(k,l,R),A&&A.m(l,null),f=!0},p(k,[R]){_&&_.p&&(!f||R&1)&&lr(_,a,k,k[0],f?ar(a,k[0],R,nL):ur(k[0]),tb),S&&S.p&&(!f||R&1)&&lr(S,x,k,k[0],f?ar(x,k[0],R,eL):ur(k[0]),$1),A&&A.p&&(!f||R&1)&&lr(A,L,k,k[0],f?ar(L,k[0],R,tL):ur(k[0]),Q1)},i(k){f||(wt(_,k),wt(S,k),wt(A,k),f=!0)},o(k){Pt(_,k),Pt(S,k),Pt(A,k),f=!1},d(k){k&&(kt(t),kt(n),kt(i),kt(r),kt(l)),_&&_.d(k),S&&S.d(k),A&&A.d(k)}}}function rL(e,t,n){let{$$slots:i={},$$scope:r}=t;return e.$$set=l=>{"$$scope"in l&&n(0,r=l.$$scope)},[r,i]}class oL extends nn{constructor(t){super(),en(this,t,rL,iL,Ye,{})}}function sL(e){let t,n,i,r;const l=e[1].default,f=sr(l,e,e[0],null);return{c(){t=dt("a"),f&&f.c(),It(t,"href","#")},m(a,_){At(a,t,_),f&&f.m(t,null),n=!0,i||(r=be(t,"click",e[2]),i=!0)},p(a,[_]){f&&f.p&&(!n||_&1)&&lr(f,l,a,a[0],n?ar(l,a[0],_,null):ur(a[0]),null)},i(a){n||(wt(f,a),n=!0)},o(a){Pt(f,a),n=!1},d(a){a&&kt(t),f&&f.d(a),i=!1,r()}}}function aL(e,t,n){let{$$slots:i={},$$scope:r}=t;function l(f){ii.call(this,e,f)}return e.$$set=f=>{"$$scope"in f&&n(0,r=f.$$scope)},[r,i,l]}class lL extends nn{constructor(t){super(),en(this,t,aL,sL,Ye,{})}}function eb(e){let t,n;return{c(){t=dt("div"),n=Xe(e[0]),It(t,"class","svelte-1uuov7f")},m(i,r){At(i,t,r),lt(t,n)},p(i,r){r&1&&qi(n,i[0])},d(i){i&&kt(t)}}}function uL(e){let t,n=e[0]&&eb(e);return{c(){n&&n.c(),t=$o()},m(i,r){n&&n.m(i,r),At(i,t,r)},p(i,[r]){i[0]?n?n.p(i,r):(n=eb(i),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:we,o:we,d(i){i&&kt(t),n&&n.d(i)}}}function cL(e,t,n){let{msg:i=null}=t;return e.$$set=r=>{"msg"in r&&n(0,i=r.msg)},[i]}class cw extends nn{constructor(t){super(),en(this,t,cL,uL,Ye,{msg:0})}}const hL=e=>({dialog:e&1}),nb=e=>({dialog:e[0]});function fL(e){let t,n,i,r,l;const f=e[4].default,a=sr(f,e,e[3],nb);return{c(){t=dt("dialog"),n=dt("article"),a&&a.c(),t.open=!0},m(_,x){At(_,t,x),lt(t,n),a&&a.m(n,null),e[6](t),i=!0,r||(l=[be(window,"click",e[1]),be(window,"keydown",e[2]),be(t,"close",e[5])],r=!0)},p(_,[x]){a&&a.p&&(!i||x&9)&&lr(a,f,_,_[3],i?ar(f,_[3],x,hL):ur(_[3]),nb)},i(_){i||(wt(a,_),i=!0)},o(_){Pt(a,_),i=!1},d(_){_&&kt(t),a&&a.d(_),e[6](null),r=!1,Wi(l)}}}function pL(e,t,n){let{$$slots:i={},$$scope:r}=t,l;function f(S){l.open&&S.target==l&&l.close()}function a(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),l.close())}function _(S){ii.call(this,e,S)}function x(S){cr[S?"unshift":"push"](()=>{l=S,n(0,l)})}return e.$$set=S=>{"$$scope"in S&&n(3,r=S.$$scope)},[l,f,a,r,i,_,x]}class Ky extends nn{constructor(t){super(),en(this,t,pL,fL,Ye,{})}}var To=63710088e-1,Jy={centimeters:To*100,centimetres:To*100,degrees:To/111325,feet:To*3.28084,inches:To*39.37,kilometers:To/1e3,kilometres:To/1e3,meters:To,metres:To,miles:To/1609.344,millimeters:To*1e3,millimetres:To*1e3,nauticalmiles:To/1852,radians:1,yards:To*1.0936},dL={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/To,yards:1.0936133},Ey={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ya(e,t,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function mL(e,t,n){switch(e){case"Point":return fs(t).geometry;case"LineString":return na(t).geometry;case"Polygon":return Qy(t).geometry;case"MultiPoint":return fw(t).geometry;case"MultiLineString":return hw(t).geometry;case"MultiPolygon":return pw(t).geometry;default:throw new Error(e+" is invalid")}}function fs(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!cg(e[0])||!cg(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return ya(i,t,n)}function gL(e,t,n){return n===void 0&&(n={}),Ac(e.map(function(i){return fs(i,t)}),n)}function Qy(e,t,n){n===void 0&&(n={});for(var i=0,r=e;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function $y(e,t){t===void 0&&(t="kilometers");var n=Jy[t];if(!n)throw new Error(t+" units is invalid");return e*n}function kg(e,t){t===void 0&&(t="kilometers");var n=Jy[t];if(!n)throw new Error(t+" units is invalid");return e/n}function xL(e,t){return sd(kg(e,t))}function wL(e){var t=e%360;return t<0&&(t+=360),t}function sd(e){var t=e%(2*Math.PI);return t*180/Math.PI}function ia(e){var t=e%360;return t*Math.PI/180}function SL(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return $y(kg(e,t),n)}function EL(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=Ey[t];if(!i)throw new Error("invalid original units");var r=Ey[n];if(!r)throw new Error("invalid final units");return e/i*r}function cg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function t0(e){return!!e&&e.constructor===Object}function IL(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!cg(t))throw new Error("bbox must only contain numbers")})}function CL(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const TL=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Ey,bearingToAzimuth:wL,convertArea:EL,convertLength:SL,degreesToRadians:ia,earthRadius:To,factors:Jy,feature:ya,featureCollection:Ac,geometry:mL,geometryCollection:vL,isNumber:cg,isObject:t0,lengthToDegrees:xL,lengthToRadians:kg,lineString:na,lineStrings:yL,multiLineString:hw,multiPoint:fw,multiPolygon:pw,point:fs,points:gL,polygon:Qy,polygons:_L,radiansToDegrees:sd,radiansToLength:$y,round:bL,unitsFactors:dL,validateBBox:IL,validateId:CL},Symbol.toStringTag,{value:"Module"}));function ad(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function nf(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function dw(e,t,n){if(n===void 0&&(n={}),n.final===!0)return LL(e,t);var i=ad(e),r=ad(t),l=ia(i[0]),f=ia(r[0]),a=ia(i[1]),_=ia(r[1]),x=Math.sin(f-l)*Math.cos(_),S=Math.cos(a)*Math.sin(_)-Math.sin(a)*Math.cos(_)*Math.cos(f-l);return sd(Math.atan2(x,S))}function LL(e,t){var n=dw(t,e);return n=(n+180)%360,n}function Sp(e,t,n){n===void 0&&(n={});var i=ad(e),r=ad(t),l=ia(r[1]-i[1]),f=ia(r[0]-i[0]),a=ia(i[1]),_=ia(r[1]),x=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(a)*Math.cos(_);return $y(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),n.units)}function ib(e,t,n,i){i===void 0&&(i={});var r=ad(e),l=ia(r[0]),f=ia(r[1]),a=ia(n),_=kg(t,i.units),x=Math.asin(Math.sin(f)*Math.cos(_)+Math.cos(f)*Math.sin(_)*Math.cos(a)),S=l+Math.atan2(Math.sin(a)*Math.sin(_)*Math.cos(f),Math.cos(_)-Math.sin(f)*Math.sin(x)),L=sd(S),A=sd(x);return fs([L,A],i.properties)}function vd(e,t,n){if(e!==null)for(var i,r,l,f,a,_,x,S=0,L=0,A,k=e.type,R=k==="FeatureCollection",U=k==="Feature",j=R?e.features.length:1,Q=0;Q_||R>x||U>S){a=L,_=i,x=R,S=U,l=0;return}var j=na([a,L],n.properties);if(t(j,i,r,U,l)===!1)return!1;l++,a=L})===!1)return!1}}})}function RL(e,t,n){var i=n,r=!1;return gw(e,function(l,f,a,_,x){r===!1&&n===void 0?i=l:i=t(i,l,f,a,_,x),r=!0}),i}function _w(e,t){if(!e)throw new Error("geojson is required");ff(e,function(n,i,r){if(n.geometry!==null){var l=n.geometry.type,f=n.geometry.coordinates;switch(l){case"LineString":if(t(n,i,r,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ar?n:r,x=i>l?i:l;return[f,a,_,x]}var n0={exports:{}},yw={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Qb,function(){function n(B,X,J,it,ft){(function mt(_t,ct,Mt,xt,vt){for(;xt>Mt;){if(xt-Mt>600){var me=xt-Mt+1,Rt=ct-Mt+1,Gt=Math.log(me),te=.5*Math.exp(2*Gt/3),se=.5*Math.sqrt(Gt*te*(me-te)/me)*(Rt-me/2<0?-1:1),Ce=Math.max(Mt,Math.floor(ct-Rt*te/me+se)),yn=Math.min(xt,Math.floor(ct+(me-Rt)*te/me+se));mt(_t,ct,Ce,yn,vt)}var jn=_t[ct],$e=Mt,Fe=xt;for(i(_t,Mt,ct),vt(_t[xt],jn)>0&&i(_t,Mt,xt);$e0;)Fe--}vt(_t[Mt],jn)===0?i(_t,Mt,Fe):i(_t,++Fe,xt),Fe<=ct&&(Mt=Fe+1),ct<=Fe&&(xt=Fe-1)}})(B,X,J||0,it||B.length-1,ft||r)}function i(B,X,J){var it=B[X];B[X]=B[J],B[J]=it}function r(B,X){return BX?1:0}var l=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function f(B,X,J){if(!J)return X.indexOf(B);for(var it=0;it=B.minX&&X.maxY>=B.minY}function j(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Q(B,X,J,it,ft){for(var mt=[X,J];mt.length;)if(!((J=mt.pop())-(X=mt.pop())<=it)){var _t=X+Math.ceil((J-X)/it/2)*it;n(B,_t,X,J,ft),mt.push(X,_t,_t,J)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(B){var X=this.data,J=[];if(!U(B,X))return J;for(var it=this.toBBox,ft=[];X;){for(var mt=0;mt=0&&ft[X].children.length>this._maxEntries;)this._split(ft,X),X--;this._adjustParentBBoxes(it,ft,X)},l.prototype._split=function(B,X){var J=B[X],it=J.children.length,ft=this._minEntries;this._chooseSplitAxis(J,ft,it);var mt=this._chooseSplitIndex(J,ft,it),_t=j(J.children.splice(mt,J.children.length-mt));_t.height=J.height,_t.leaf=J.leaf,a(J,this.toBBox),a(_t,this.toBBox),X?B[X-1].children.push(_t):this._splitRoot(J,_t)},l.prototype._splitRoot=function(B,X){this.data=j([B,X]),this.data.height=B.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(B,X,J){for(var it,ft,mt,_t,ct,Mt,xt,vt=1/0,me=1/0,Rt=X;Rt<=J-X;Rt++){var Gt=_(B,0,Rt,this.toBBox),te=_(B,Rt,J,this.toBBox),se=(ft=Gt,mt=te,_t=void 0,ct=void 0,Mt=void 0,xt=void 0,_t=Math.max(ft.minX,mt.minX),ct=Math.max(ft.minY,mt.minY),Mt=Math.min(ft.maxX,mt.maxX),xt=Math.min(ft.maxY,mt.maxY),Math.max(0,Mt-_t)*Math.max(0,xt-ct)),Ce=A(Gt)+A(te);se=X;vt--){var me=B.children[vt];x(_t,B.leaf?ft(me):me),ct+=k(_t)}return ct},l.prototype._adjustParentBBoxes=function(B,X,J){for(var it=J;it>=0;it--)x(X[it],B)},l.prototype._condense=function(B){for(var X=B.length-1,J=void 0;X>=0;X--)B[X].children.length===0?X>0?(J=B[X-1].children).splice(J.indexOf(B[X]),1):this.clear():a(B[X],this.toBBox)},l})})(yw);var jL=yw.exports;const qL=tx(TL),vw=tx(BL);var i0={};Object.defineProperty(i0,"__esModule",{value:!0});var ZL=vw;function Iy(e){var t=[1/0,1/0,-1/0,-1/0];return ZL.coordEach(e,function(n){t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2] line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var r=n[0][0],l=n[0][1],f=n[1][0],a=n[1][1],_=i[0][0],x=i[0][1],S=i[1][0],L=i[1][1],A=(L-x)*(f-r)-(S-_)*(a-l),k=(S-_)*(l-x)-(L-x)*(r-_),R=(f-r)*(l-x)-(a-l)*(r-_);if(A===0)return null;var U=k/A,j=R/A;if(U>=0&&U<=1&&j>=0&&j<=1){var Q=r+U*(f-r),B=l+U*(a-l);return fs([Q,B])}return null}function KL(e,t,n){n===void 0&&(n={});var i=fs([1/0,1/0],{dist:1/0}),r=0;return ff(e,function(l){for(var f=nf(l),a=0;a0&&(j=U.features[0],j.properties.dist=Sp(t,j,n),j.properties.location=r+Sp(_,j,n)),_.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let r of this.points)r[0]-=n,r[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});Zn(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(ab(this.points).forEach((i,r)=>{n.push([r+1,KL(i,this.cursor).properties.dist])}),n.sort((i,r)=>i[1]-r[1]),n.length>0){let i=n[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});Zn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=J_(t.lngLat.toArray()),this.onClick(t),this.finish())});Zn(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Zn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Zn(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});Zn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((r,l)=>{let f=J_(r);f.properties.hover=this.hover==l,f.properties.idx=l,t.features.push(f)}),t.features=t.features.concat(ab(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),Sw.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,Ew.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=J_(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(Lw),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>JL&&this.previousStates.shift()}}function ab(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function $L(e){let t,n,i;return{c(){t=Xe("Undo ("),n=Xe(e[1]),i=Xe(")")},m(r,l){At(r,t,l),At(r,n,l),At(r,i,l)},p(r,l){l&2&&qi(n,r[1])},d(r){r&&(kt(t),kt(n),kt(i))}}}function tM(e){let t;return{c(){t=Xe("Undo")},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function eM(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?tM:$L}let _=a(e),x=_(e);return{c(){t=dt("button"),x.c(),i=Zt(),r=dt("ul"),r.innerHTML=`
  • Click +`)}return e.toString()};jr.prototype.computeEdgeEndLabels=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.computeLabel(e)}};jr.prototype.computeLabelling=function(e){var t=this;this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var r=i.next(),l=r.getLabel(),f=0;f<2;f++)l.isLine(f)&&l.getLocation(f)===zt.BOUNDARY&&(n[f]=!0);for(var a=this.iterator();a.hasNext();)for(var _=a.next(),x=_.getLabel(),S=0;S<2;S++)if(x.isAnyNull(S)){var L=zt.NONE;if(n[S])L=zt.EXTERIOR;else{var A=_.getCoordinate();L=t.getLocation(S,A,e)}x.setAllLocationsIfNull(S,L)}};jr.prototype.getDegree=function(){return this._edgeMap.size()};jr.prototype.insertEdgeEnd=function(e,t){this._edgeMap.put(e,t),this._edgeList=null};jr.prototype.interfaces_=function(){return[]};jr.prototype.getClass=function(){return jr};var DC=function(e){function t(){e.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var i=null,r=null,l=this._SCANNING_FOR_INCOMING,f=0;f=0;l--){var f=n._edgeList.get(l),a=f.getSym();r===null&&(r=a),i!==null&&a.setNext(i),i=f}r.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],r=this.findIndex(i),l=i.getDepth(re.LEFT),f=i.getDepth(re.RIGHT),a=this.computeDepths(r+1,this._edgeList.size(),l),_=this.computeDepths(0,r,a);if(_!==f)throw new gl("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var x=arguments[0],S=arguments[1],L=arguments[2],A=L,P=x;P=0;a--){var _=i._resultAreaEdgeList.get(a),x=_.getSym();switch(r===null&&_.getEdgeRing()===n&&(r=_),f){case i._SCANNING_FOR_INCOMING:if(x.getEdgeRing()!==n)continue;l=x,f=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==n)continue;l.setNextMin(_),f=i._SCANNING_FOR_INCOMING;break}}f===this._LINKING_TO_OUTGOING&&(an.isTrue(r!==null,"found null for first outgoing dirEdge"),an.isTrue(r.getEdgeRing()===n,"unable to link last incoming dirEdge"),l.setNextMin(r))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var r=i.next();r.isInResult()&&n++}return n}else if(arguments.length===1){for(var l=arguments[0],f=0,a=this.iterator();a.hasNext();){var _=a.next();_.getEdgeRing()===l&&f++}return f}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=zt.NONE,i=this.iterator();i.hasNext();){var r=i.next(),l=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){n=zt.INTERIOR;break}if(l.isInResult()){n=zt.EXTERIOR;break}}}if(n===zt.NONE)return null;for(var f=n,a=this.iterator();a.hasNext();){var _=a.next(),x=_.getSym();_.isLineEdge()?_.getEdge().setCovered(f===zt.INTERIOR):(_.isInResult()&&(f=zt.EXTERIOR),x.isInResult()&&(f=zt.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;e.prototype.computeLabelling.call(this,n),this._label=new Un(zt.NONE);for(var r=this.iterator();r.hasNext();)for(var l=r.next(),f=l.getEdge(),a=f.getLabel(),_=0;_<2;_++){var x=a.getLocation(_);(x===zt.INTERIOR||x===zt.BOUNDARY)&&i._label.setLocation(_,zt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jr),Ox=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new Pg(n,new DC)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(qh),Jl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Jl.prototype.compareTo=function(e){var t=e,n=Jl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Jl.prototype.interfaces_=function(){return[bs]};Jl.prototype.getClass=function(){return Jl};Jl.orientation=function(e){return gn.increasingDirection(e)===1};Jl.compareOriented=function(e,t,n,i){for(var r=t?1:-1,l=i?1:-1,f=t?e.length:-1,a=i?n.length:-1,_=t?0:e.length-1,x=i?0:n.length-1;;){var S=e[_].compareTo(n[x]);if(S!==0)return S;_+=r,x+=l;var L=_===f,A=x===a;if(L&&!A)return-1;if(!L&&A)return 1;if(L&&A)return 0}};var zs=function(){this._edges=new he,this._ocaMap=new Ur};zs.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var r=i.getCoordinates(),l=0;l0&&e.print(","),e.print(r[l].x+" "+r[l].y);e.println(")")}e.print(") ")};zs.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};zs.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(r);l||i--;var f=new Array(i).fill(null),a=0;f[a++]=new Dt(e.coord);for(var _=e.segmentIndex+1;_<=t.segmentIndex;_++)f[a++]=n.edge.pts[_];return l&&(f[a]=t.coord),new ig(f,new Un(this.edge._label))};ja.prototype.add=function(e,t,n){var i=new ma(e,t,n),r=this._nodeMap.get(i);return r!==null?r:(this._nodeMap.put(i,i),i)};ja.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};ja.prototype.interfaces_=function(){return[]};ja.prototype.getClass=function(){return ja};var Vu=function(){};Vu.prototype.getChainStartIndices=function(e){var t=this,n=0,i=new he;i.add(new ua(n));do{var r=t.findChainEnd(e,n);i.add(new ua(r)),n=r}while(nn?t:n};yl.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(r=1),e._depth[t][i]=r}}};Cr.prototype.getDelta=function(e){return this._depth[e][re.RIGHT]-this._depth[e][re.LEFT]};Cr.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Cr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Cr.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var r=t.getLocation(n,i);(r===zt.EXTERIOR||r===zt.INTERIOR)&&(e.isNull(n,i)?e._depth[n][i]=Cr.depthAtLocation(r):e._depth[n][i]+=Cr.depthAtLocation(r))}else if(arguments.length===3){var l=arguments[0],f=arguments[1],a=arguments[2];a===zt.INTERIOR&&this._depth[l][f]++}};Cr.prototype.interfaces_=function(){return[]};Cr.prototype.getClass=function(){return Cr};Cr.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Cr.NULL_VALUE};zx.NULL_VALUE.get=function(){return-1};Object.defineProperties(Cr,zx);var ig=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new ja(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Cr,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],r=arguments[1];this.pts=i,this._label=r}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,Un.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var r=n;if(this.pts.length!==r.pts.length)return!1;for(var l=!0,f=!0,a=this.pts.length,_=0;_0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var r=0;r0&&n.print(","),n.print(i.pts[r].x+" "+i.pts[r].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var r=this.pts.length-1;r>=0;r--)n.print(i.pts[r]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new yl(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Oe;for(var i=0;i0&&i.append(","),i.append(n.pts[r].x+" "+n.pts[r].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var r=0;ri||this._maxyl;if(f)return!1;var a=this.intersectsToleranceSquare(e,t);return an.isTrue(!(f&&a),"Found bad envelope test"),a};go.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Dt(this._maxx,this._maxy),this._corner[1]=new Dt(this._minx,this._maxy),this._corner[2]=new Dt(this._minx,this._miny),this._corner[3]=new Dt(this._maxx,this._miny)};go.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};go.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};go.prototype.getCoordinate=function(){return this._originalPt};go.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};go.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=go.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Oe(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};go.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};go.prototype.intersectsToleranceSquare=function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||e.equals(this._pt)||t.equals(this._pt))};go.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return this.intersects(n,i)?(e.addIntersection(this.getCoordinate(),t),!0):!1};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};Bx.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(go,Bx);var id=function(){this.tempEnv1=new Oe,this.selectedSegment=new ze};id.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};id.prototype.interfaces_=function(){return[]};id.prototype.getClass=function(){return id};var Xh=function(){this._index=null;var e=arguments[0];this._index=e},Vx={HotPixelSnapAction:{configurable:!0}};Xh.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=t.getSafeEnvelope(),l=new Ux(t,n,i);return this._index.query(r,{interfaces_:function(){return[Yl]},visitItem:function(f){var a=f;a.select(r,l)}}),l.isNodeAdded()}};Xh.prototype.interfaces_=function(){return[]};Xh.prototype.getClass=function(){return Xh};Vx.HotPixelSnapAction.get=function(){return Ux};Object.defineProperties(Xh,Vx);var Ux=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],r=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],r=n.getContext();if(this._parentEdge!==null&&r===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,i)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(id),Ic=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new he};Ic.prototype.processIntersections=function(e,t,n,i){var r=this;if(e===n&&t===i)return null;var l=e.getCoordinates()[t],f=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];if(this._li.computeIntersection(l,f,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var x=0;x=0;t--){try{e.bufferReducedPrecision(t)}catch(l){if(l instanceof gl)e._saveException=l;else throw l}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=Ir.precisionScaleFactor(this._argGeom,this._distance,n),r=new Dn(i);this.bufferFixedPrecision(r)}};Ir.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Dn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};Ir.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};Ir.prototype.bufferOriginalPrecision=function(){try{var e=new to(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof dl)this._saveException=t;else throw t}finally{}};Ir.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};Ir.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};Ir.prototype.interfaces_=function(){return[]};Ir.prototype.getClass=function(){return Ir};Ir.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new Ir(e),i=n.getResultGeometry(t);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof $e&&typeof arguments[1]=="number"){var r=arguments[0],l=arguments[1],f=arguments[2],a=new Ir(r);a.setQuadrantSegments(f);var _=a.getResultGeometry(l);return _}else if(arguments[2]instanceof Nn&&arguments[0]instanceof $e&&typeof arguments[1]=="number"){var x=arguments[0],S=arguments[1],L=arguments[2],A=new Ir(x,L),P=A.getResultGeometry(S);return P}}else if(arguments.length===4){var O=arguments[0],B=arguments[1],U=arguments[2],Y=arguments[3],V=new Ir(O);V.setQuadrantSegments(U),V.setEndCapStyle(Y);var $=V.getResultGeometry(B);return $}};Ir.precisionScaleFactor=function(e,t,n){var i=e.getEnvelopeInternal(),r=Ho.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),l=t>0?t:0,f=r+2*l,a=Math.trunc(Math.log(f)/Math.log(10)+1),_=n-a,x=Math.pow(10,_);return x};hf.CAP_ROUND.get=function(){return Nn.CAP_ROUND};hf.CAP_BUTT.get=function(){return Nn.CAP_FLAT};hf.CAP_FLAT.get=function(){return Nn.CAP_FLAT};hf.CAP_SQUARE.get=function(){return Nn.CAP_SQUARE};hf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Ir,hf);var Kr=function(){this._pt=[new Dt,new Dt],this._distance=tn.NaN,this._isNull=!0};Kr.prototype.getCoordinates=function(){return this._pt};Kr.prototype.getCoordinate=function(e){return this._pt[e]};Kr.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var i=t.distance(n);ithis._distance&&this.initialize(t,n,i)}};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};var Ra=function(){};Ra.prototype.interfaces_=function(){return[]};Ra.prototype.getClass=function(){return Ra};Ra.computeDistance=function(){if(arguments[2]instanceof Kr&&arguments[0]instanceof Pi&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=e.getCoordinates(),r=new ze,l=0;l0||this._isIn?zt.INTERIOR:zt.EXTERIOR)};Fs.prototype.interfaces_=function(){return[]};Fs.prototype.getClass=function(){return Fs};var Jr=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];this._component=i,this._segIndex=r,this._pt=l}},Gx={INSIDE_AREA:{configurable:!0}};Jr.prototype.isInsideArea=function(){return this._segIndex===Jr.INSIDE_AREA};Jr.prototype.getCoordinate=function(){return this._pt};Jr.prototype.getGeometryComponent=function(){return this._component};Jr.prototype.getSegmentIndex=function(){return this._segIndex};Jr.prototype.interfaces_=function(){return[]};Jr.prototype.getClass=function(){return Jr};Gx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Jr,Gx);var Wl=function(e){this._pts=e||null};Wl.prototype.filter=function(e){e instanceof Mo&&this._pts.add(e)};Wl.prototype.interfaces_=function(){return[ha]};Wl.prototype.getClass=function(){return Wl};Wl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Mo?Os.singletonList(e):Wl.getPoints(e,new he)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Mo?n.add(t):t instanceof eo&&t.apply(new Wl(n)),n}};var Tc=function(){this._locations=null;var e=arguments[0];this._locations=e};Tc.prototype.filter=function(e){(e instanceof Mo||e instanceof Pi||e instanceof er)&&this._locations.add(new Jr(e,0,e.getCoordinate()))};Tc.prototype.interfaces_=function(){return[ha]};Tc.prototype.getClass=function(){return Tc};Tc.getLocations=function(e){var t=new he;return e.apply(new Tc(t)),t};var Mr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Fs,this._minDistanceLocation=null,this._minDistance=tn.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}};Mr.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=1-n,l=pl.getPolygons(this._geom[n]);if(l.size()>0){var f=Tc.getLocations(this._geom[r]);if(this.computeContainmentDistance(f,l,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&We(arguments[0],As)&&We(arguments[1],As)){for(var a=arguments[0],_=arguments[1],x=arguments[2],S=0;Sthis._minDistance)return null;for(var r=t.getCoordinates(),l=n.getCoordinate(),f=0;fthis._minDistance)return null;for(var P=S.getCoordinates(),O=L.getCoordinates(),B=0;Bthis._distance&&this.initialize(t,n,i)}};Br.prototype.interfaces_=function(){return[]};Br.prototype.getClass=function(){return Br};var na=function(){};na.prototype.interfaces_=function(){return[]};na.prototype.getClass=function(){return na};na.computeDistance=function(){if(arguments[2]instanceof Br&&arguments[0]instanceof Pi&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=new ze,r=e.getCoordinates(),l=0;l1||e<=0)throw new gi("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};gs.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};gs.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};gs.prototype.computeOrientedDistance=function(e,t,n){var i=new Lc(t);if(e.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new eu(t,this._densifyFrac);e.apply(r),n.setMaximum(r.getMaxPointDistance())}};gs.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};gs.prototype.interfaces_=function(){return[]};gs.prototype.getClass=function(){return gs};gs.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new gs(e,t);return n.distance()}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2],f=new gs(i,r);return f.setDensifyFraction(l),f.distance()}};qy.MaxPointDistanceFilter.get=function(){return Lc};qy.MaxDensifiedByFractionDistanceFilter.get=function(){return eu};Object.defineProperties(gs,qy);var Lc=function(){this._maxPtDist=new Br,this._minPtDist=new Br,this._euclideanDist=new na,this._geom=null;var e=arguments[0];this._geom=e};Lc.prototype.filter=function(e){this._minPtDist.initialize(),na.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Lc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Lc.prototype.interfaces_=function(){return[Ba]};Lc.prototype.getClass=function(){return Lc};var eu=function(){this._maxPtDist=new Br,this._minPtDist=new Br,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};eu.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var i=e.getCoordinate(t-1),r=e.getCoordinate(t),l=(r.x-i.x)/this._numSubSegs,f=(r.y-i.y)/this._numSubSegs,a=0;an){this._isValid=!1;var r=i.getCoordinates();this._errorLocation=r[1],this._errorIndicator=e.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ns.toLineString(r[0],r[1])+")"}};Lo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=Lo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Lo.VERBOSE&&Lr.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Lo.prototype.checkNegativeValid=function(){if(!(this._input instanceof er||this._input instanceof za||this._input instanceof eo))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};Lo.prototype.getErrorIndicator=function(){return this._errorIndicator};Lo.prototype.checkMinimumDistance=function(e,t,n){var i=new Mr(e,t,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Pr.prototype.report=function(e){if(!Pr.VERBOSE)return null;Lr.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Pr.prototype.getErrorMessage=function(){return this._errorMsg};Pr.prototype.interfaces_=function(){return[]};Pr.prototype.getClass=function(){return Pr};Pr.isValidMsg=function(e,t,n){var i=new Pr(e,t,n);return i.isValid()?null:i.getErrorMessage()};Pr.isValid=function(e,t,n){var i=new Pr(e,t,n);return!!i.isValid()};$y.VERBOSE.get=function(){return!1};$y.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Pr,$y);var _a=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};_a.prototype.getCoordinates=function(){return this._pts};_a.prototype.size=function(){return this._pts.length};_a.prototype.getCoordinate=function(e){return this._pts[e]};_a.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};_a.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Sc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};_a.prototype.setData=function(e){this._data=e};_a.prototype.getData=function(){return this._data};_a.prototype.toString=function(){return Ns.toLineString(new Ri(this._pts))};_a.prototype.interfaces_=function(){return[Ga]};_a.prototype.getClass=function(){return _a};var wr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new he,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};wr.prototype.getInteriorIntersection=function(){return this._interiorIntersection};wr.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};wr.prototype.getIntersectionSegments=function(){return this._intSegments};wr.prototype.count=function(){return this._intersectionCount};wr.prototype.getIntersections=function(){return this._intersections};wr.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};wr.prototype.setKeepIntersections=function(e){this._keepIntersections=e};wr.prototype.processIntersections=function(e,t,n,i){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===i)return null;if(this._isCheckEndSegmentsOnly){var r=this.isEndSegment(e,t)||this.isEndSegment(n,i);if(!r)return null}var l=e.getCoordinates()[t],f=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];this._li.computeIntersection(l,f,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=l,this._intSegments[1]=f,this._intSegments[2]=a,this._intSegments[3]=_,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};wr.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};wr.prototype.hasIntersection=function(){return this._interiorIntersection!==null};wr.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};wr.prototype.interfaces_=function(){return[Bu]};wr.prototype.getClass=function(){return wr};wr.createAllIntersectionsFinder=function(e){var t=new wr(e);return t.setFindAllIntersections(!0),t};wr.createAnyIntersectionFinder=function(e){return new wr(e)};wr.createIntersectionCounter=function(e){var t=new wr(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Bs=function(){this._li=new Zu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Bs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Bs.prototype.getIntersections=function(){return this._segInt.getIntersections()};Bs.prototype.isValid=function(){return this.execute(),this._isValid};Bs.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Bs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new wr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new Gy;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Bs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new gl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Bs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ns.toLineString(e[0],e[1])+" and "+Ns.toLineString(e[2],e[3])};Bs.prototype.interfaces_=function(){return[]};Bs.prototype.getClass=function(){return Bs};Bs.computeIntersections=function(e){var t=new Bs(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var Gu=function e(){this._nv=null;var t=arguments[0];this._nv=new Bs(e.toSegmentStrings(t))};Gu.prototype.checkValid=function(){this._nv.checkValid()};Gu.prototype.interfaces_=function(){return[]};Gu.prototype.getClass=function(){return Gu};Gu.toSegmentStrings=function(e){for(var t=new he,n=e.iterator();n.hasNext();){var i=n.next();t.add(new _a(i.getCoordinates(),i))}return t};Gu.checkValid=function(e){var t=new Gu(e);t.checkValid()};var Mc=function(e){this._mapOp=e};Mc.prototype.map=function(e){for(var t=this,n=new he,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};_o.prototype.interfaces_=function(){return[]};_o.prototype.getClass=function(){return _o};var Za=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ze,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Pi&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var i=arguments[0],r=arguments[1];this._srcPts=i,this._isClosed=e.isClosed(i),this._snapTolerance=r}};Za.prototype.snapVertices=function(e,t){for(var n=this,i=this._isClosed?e.size()-1:e.size(),r=0;r=0&&e.add(f+1,new Dt(l),!1)}};Za.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,i=tn.MAX_VALUE,r=-1,l=0;lt&&(t=i)}return t}else if(arguments.length===2){var r=arguments[0],l=arguments[1];return Math.min(Oi.computeOverlaySnapTolerance(r),Oi.computeOverlaySnapTolerance(l))}};Oi.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),i=n*Oi.SNAP_PRECISION_FACTOR;return i};Oi.snapToSelf=function(e,t,n){var i=new Oi(e);return i.snapToSelf(t,n)};jx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Oi,jx);var qx=function(e){function t(n,i,r){e.call(this),this._snapTolerance=n||null,this._snapPts=i||null,this._isSelfSnap=r!==void 0?r:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var r=new Za(n,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var r=n.toCoordinateArray(),l=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(l)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_o),Yr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Yr.prototype.getCommon=function(){return tn.longBitsToDouble(this._commonBits)};Yr.prototype.add=function(e){var t=tn.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Yr.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Yr.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Yr.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Yr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Yr.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=tn.longBitsToDouble(e),n=tn.toBinaryString(e),i="0000000000000000000000000000000000000000000000000000000000000000"+n,r=i.substring(i.length-64),l=r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+t+" ]";return l}};Yr.prototype.interfaces_=function(){return[]};Yr.prototype.getClass=function(){return Yr};Yr.getBit=function(e,t){var n=1<>52};Yr.zeroLowerBits=function(e,t){var n=(1<=0;i--){if(Yr.getBit(e,i)!==Yr.getBit(t,i))return n;n++}return 52};var nu=function(){this._commonCoord=null,this._ccFilter=new kc},Wy={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};nu.prototype.addCommonBits=function(e){var t=new iu(this._commonCoord);e.apply(t),e.geometryChanged()};nu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Dt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new iu(t);return e.apply(n),e.geometryChanged(),e};nu.prototype.getCommonCoordinate=function(){return this._commonCoord};nu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};nu.prototype.interfaces_=function(){return[]};nu.prototype.getClass=function(){return nu};Wy.CommonCoordinateFilter.get=function(){return kc};Wy.Translater.get=function(){return iu};Object.defineProperties(nu,Wy);var kc=function(){this._commonBitsX=new Yr,this._commonBitsY=new Yr};kc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};kc.prototype.getCommonCoordinate=function(){return new Dt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};kc.prototype.interfaces_=function(){return[Ba]};kc.prototype.getClass=function(){return kc};var iu=function(){this.trans=null;var e=arguments[0];this.trans=e};iu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,i=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,i)};iu.prototype.isDone=function(){return!1};iu.prototype.isGeometryChanged=function(){return!0};iu.prototype.interfaces_=function(){return[Ds]};iu.prototype.getClass=function(){return iu};var Sr=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};Sr.prototype.selfSnap=function(e){var t=new Oi(e),n=t.snapTo(e,this._snapTolerance);return n};Sr.prototype.removeCommonBits=function(e){this._cbr=new nu,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};Sr.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};Sr.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=sn.overlayOp(t[0],t[1],e);return this.prepareResult(n)};Sr.prototype.checkValid=function(e){e.isValid()||Lr.out.println("Snapped geometry is invalid")};Sr.prototype.computeSnapTolerance=function(){this._snapTolerance=Oi.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};Sr.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Oi.snap(t[0],t[1],this._snapTolerance);return n};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};Sr.overlayOp=function(e,t,n){var i=new Sr(e,t);return i.getResultGeometry(n)};Sr.union=function(e,t){return Sr.overlayOp(e,t,sn.UNION)};Sr.intersection=function(e,t){return Sr.overlayOp(e,t,sn.INTERSECTION)};Sr.symDifference=function(e,t){return Sr.overlayOp(e,t,sn.SYMDIFFERENCE)};Sr.difference=function(e,t){return Sr.overlayOp(e,t,sn.DIFFERENCE)};var ro=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};ro.prototype.getResultGeometry=function(e){var t=null,n=!1,i=null;try{t=sn.overlayOp(this._geom[0],this._geom[1],e);var r=!0;r&&(n=!0)}catch(l){if(l instanceof dl)i=l;else throw l}finally{}if(!n)try{t=Sr.overlayOp(this._geom[0],this._geom[1],e)}catch(l){throw l instanceof dl?i:l}finally{}return t};ro.prototype.interfaces_=function(){return[]};ro.prototype.getClass=function(){return ro};ro.overlayOp=function(e,t,n){var i=new ro(e,t);return i.getResultGeometry(n)};ro.union=function(e,t){return ro.overlayOp(e,t,sn.UNION)};ro.intersection=function(e,t){return ro.overlayOp(e,t,sn.INTERSECTION)};ro.symDifference=function(e,t){return ro.overlayOp(e,t,sn.SYMDIFFERENCE)};ro.difference=function(e,t){return ro.overlayOp(e,t,sn.DIFFERENCE)};var rd=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};rd.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};rd.prototype.interfaces_=function(){return[]};rd.prototype.getClass=function(){return rd};var Ao=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];this._eventType=e.INSERT,this._label=i,this._xValue=r,this._obj=l}},Xy={INSERT:{configurable:!0},DELETE:{configurable:!0}};Ao.prototype.isDelete=function(){return this._eventType===Ao.DELETE};Ao.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};Ao.prototype.getObject=function(){return this._obj};Ao.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};Ao.prototype.getInsertEvent=function(){return this._insertEvent};Ao.prototype.isInsert=function(){return this._eventType===Ao.INSERT};Ao.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};Ao.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Ao.prototype.interfaces_=function(){return[bs]};Ao.prototype.getClass=function(){return Ao};Xy.INSERT.get=function(){return 1};Xy.DELETE.get=function(){return 2};Object.defineProperties(Ao,Xy);var rg=function(){};rg.prototype.interfaces_=function(){return[]};rg.prototype.getClass=function(){return rg};var kr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};kr.prototype.isTrivialIntersection=function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(kr.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var r=e.getNumPoints()-1;if(t===0&&i===r||i===0&&t===r)return!0}}return!1};kr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};kr.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};kr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};kr.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next(),r=i.getCoordinate();if(e.isIntersection(r))return!0}return!1};kr.prototype.hasProperIntersection=function(){return this._hasProper};kr.prototype.hasIntersection=function(){return this._hasIntersection};kr.prototype.isDone=function(){return this._isDone};kr.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};kr.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};kr.prototype.addIntersections=function(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var r=e.getCoordinates()[t],l=e.getCoordinates()[t+1],f=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,l,f,a),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};kr.prototype.interfaces_=function(){return[]};kr.prototype.getClass=function(){return kr};kr.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var RC=function(e){function t(){e.call(this),this.events=new he,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Os.sort(this.events);for(var i=0;it||this._maxl?1:0};od.prototype.interfaces_=function(){return[Oh]};od.prototype.getClass=function(){return od};var OC=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],i=arguments[1],r=arguments[2];this._min=n,this._max=i,this._item=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;r.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}($a),zC=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],i=arguments[1];this._node1=n,this._node2=i,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,r),this._node2!==null&&this._node2.query(n,i,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}($a),Wa=function(){this._leaves=new he,this._root=null,this._level=0};Wa.prototype.buildTree=function(){var e=this;Os.sort(this._leaves,new $a.NodeComparator);for(var t=this._leaves,n=null,i=new he;;){if(e.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}};Wa.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new OC(e,t,n))};Wa.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};Wa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Wa.prototype.printNode=function(e){Lr.out.println(Ns.toLineString(new Dt(e._min,this._level),new Dt(e._max,this._level)))};Wa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Wa.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),r=0,l=n.iterator();l.hasNext();){var f=l.next();i[r++]=f.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,r){if(this.isBoundaryNode(n,i))return null;r===zt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,r)},t.prototype.addPolygonRing=function(n,i,r){if(n.isEmpty())return null;var l=gn.removeRepeatedPoints(n.getCoordinates());if(l.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var f=i,a=r;ve.isCCW(l)&&(f=r,a=i);var _=new ig(l,new Un(this._argIndex,zt.BOUNDARY,f,a));this._lineEdgeMap.put(n,_),this.insertEdge(_),this.insertPoint(this._argIndex,l[0],zt.BOUNDARY)},t.prototype.insertPoint=function(n,i,r){var l=this._nodes.addNode(i),f=l.getLabel();f===null?l._label=new Un(n,r):f.setLocation(n,r)},t.prototype.createEdgeSetIntersector=function(){return new RC},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,r=this._edges.iterator();r.hasNext();)for(var l=r.next(),f=l.getLabel().getLocation(n),a=l.eiList.iterator();a.hasNext();){var _=a.next();i.addSelfIntersectionNode(n,_.coord,f)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof za&&(this._useBoundaryDeterminationRule=!1),n instanceof er)this.addPolygon(n);else if(n instanceof Pi)this.addLineString(n);else if(n instanceof Mo)this.addPoint(n);else if(n instanceof jh)this.addCollection(n);else if(n instanceof Ou)this.addCollection(n);else if(n instanceof za)this.addCollection(n);else if(n instanceof eo)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,r=0;r50?(this._areaPtLocator===null&&(this._areaPtLocator=new Yh(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?zt.BOUNDARY:zt.INTERIOR},t}(Si),Jh=function(){if(this._li=new Zu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new wp(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=_s.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wp(0,t,i),this._arg[1]=new wp(1,n,i)}else if(arguments.length===3){var r=arguments[0],l=arguments[1],f=arguments[2];r.getPrecisionModel().compareTo(l.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(l.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wp(0,r,f),this._arg[1]=new wp(1,l,f)}};Jh.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Jh.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Jh.prototype.interfaces_=function(){return[]};Jh.prototype.getClass=function(){return Jh};var Nu=function(){};Nu.prototype.interfaces_=function(){return[]};Nu.prototype.getClass=function(){return Nu};Nu.map=function(){if(arguments[0]instanceof $e&&We(arguments[1],Nu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new he,i=0;i=e.size()?null:e.get(t)};qi.union=function(e){var t=new qi(e);return t.union()};Wx.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(qi,Wx);var og=function(){};og.prototype.interfaces_=function(){return[]};og.prototype.getClass=function(){return og};og.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return sn.createEmptyResult(sn.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),ro.overlayOp(e,t,sn.UNION)};function $u(){return new sg}function sg(){this.reset()}sg.prototype={constructor:sg,reset:function(){this.s=this.t=0},add:function(e){x1(Am,e,this.t),x1(this,Am.s,this.s),this.s?this.t+=Am.t:this.s=Am.t},valueOf:function(){return this.s}};var Am=new sg;function x1(e,t,n){var i=e.s=t+n,r=i-t,l=i-r;e.t=t-l+(n-r)}var Mi=1e-6,Yn=Math.PI,fl=Yn/2,w1=Yn/4,vl=Yn*2,Tu=180/Yn,Qs=Yn/180,Qr=Math.abs,FC=Math.atan,tf=Math.atan2,Ji=Math.cos,Qi=Math.sin,ff=Math.sqrt;function Xx(e){return e>1?0:e<-1?Yn:Math.acos(e)}function Ac(e){return e>1?fl:e<-1?-fl:Math.asin(e)}function Np(){}function ag(e,t){e&&E1.hasOwnProperty(e.type)&&E1[e.type](e,t)}var S1={Feature:function(e,t){ag(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++iYn?e-vl:e<-Yn?e+vl:e,t]}Sy.invert=Sy;function VC(e,t,n){return(e%=vl)?t||n?Hx(T1(e),L1(t,n)):T1(e):t||n?L1(t,n):Sy}function C1(e){return function(t,n){return t+=e,[t>Yn?t-vl:t<-Yn?t+vl:t,n]}}function T1(e){var t=C1(e);return t.invert=C1(-e),t}function L1(e,t){var n=Ji(e),i=Qi(e),r=Ji(t),l=Qi(t);function f(a,_){var x=Ji(_),S=Ji(a)*x,L=Qi(a)*x,A=Qi(_),P=A*n+S*i;return[tf(L*r-P*l,S*n-A*i),Ac(P*r+L*l)]}return f.invert=function(a,_){var x=Ji(_),S=Ji(a)*x,L=Qi(a)*x,A=Qi(_),P=A*r-L*l;return[tf(L*r+A*l,S*n+P*i),Ac(P*n-S*i)]},f}function UC(e,t,n,i,r,l){if(n){var f=Ji(t),a=Qi(t),_=i*n;r==null?(r=t+i*vl,l=t-_/2):(r=M1(f,r),l=M1(f,l),(i>0?rl)&&(r+=i*vl));for(var x,S=r;i>0?S>l:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function GC(e,t,n,i,r,l){var f=e[0],a=e[1],_=t[0],x=t[1],S=0,L=1,A=_-f,P=x-a,O;if(O=n-f,!(!A&&O>0)){if(O/=A,A<0){if(O0){if(O>L)return;O>S&&(S=O)}if(O=r-f,!(!A&&O<0)){if(O/=A,A<0){if(O>L)return;O>S&&(S=O)}else if(A>0){if(O0)){if(O/=P,P<0){if(O0){if(O>L)return;O>S&&(S=O)}if(O=l-a,!(!P&&O<0)){if(O/=P,P<0){if(O>L)return;O>S&&(S=O)}else if(P>0){if(O0&&(e[0]=f+S*A,e[1]=a+S*P),L<1&&(t[0]=f+L*A,t[1]=a+L*P),!0}}}}}function jm(e,t){return Qr(e[0]-t[0])=0;--a)r.point((L=S[a])[0],L[1]);else i(A.x,A.p.x,-1,r);A=A.p}A=A.o,S=A.z,P=!P}while(!A.v);r.lineEnd()}}}function P1(e){if(t=e.length){for(var t,n=0,i=e[0],r;++nt?1:e>=t?0:NaN}function jC(e){return e.length===1&&(e=qC(e)),{left:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[l],n)<0?i=l+1:r=l}return i},right:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[l],n)>0?r=l:i=l+1}return i}}}function qC(e){return function(t,n){return Jx(e(t),n)}}jC(Jx);function Qx(e){for(var t=e.length,n,i=-1,r=0,l,f;++i=0;)for(f=e[t],n=f.length;--n>=0;)l[--r]=f[n];return l}var Dp=1e9,Om=-Dp;function ZC(e,t,n,i){function r(x,S){return e<=x&&x<=n&&t<=S&&S<=i}function l(x,S,L,A){var P=0,O=0;if(x==null||(P=f(x,L))!==(O=f(S,L))||_(x,S)<0^L>0)do A.point(P===0||P===3?e:n,P>1?i:t);while((P=(P+L+4)%4)!==O);else A.point(S[0],S[1])}function f(x,S){return Qr(x[0]-e)0?0:3:Qr(x[0]-n)0?2:1:Qr(x[1]-t)0?1:0:S>0?3:2}function a(x,S){return _(x.x,S.x)}function _(x,S){var L=f(x,1),A=f(S,1);return L!==A?L-A:L===0?S[1]-x[1]:L===1?x[0]-S[0]:L===2?x[1]-S[1]:S[0]-x[0]}return function(x){var S=x,L=Yx(),A,P,O,B,U,Y,V,$,K,nt,ht,dt={point:gt,lineStart:xt,lineEnd:fe,polygonStart:Et,polygonEnd:yt};function gt(Gt,Qt){r(Gt,Qt)&&S.point(Gt,Qt)}function ut(){for(var Gt=0,Qt=0,oe=P.length;Qti&&(fn-Fe)*(i-ke)>(Kn-ke)*(e-Fe)&&++Gt:Kn<=i&&(fn-Fe)*(i-ke)<(Kn-ke)*(e-Fe)&&--Gt;return Gt}function Et(){S=L,A=[],P=[],ht=!0}function yt(){var Gt=ut(),Qt=ht&&Gt,oe=(A=Qx(A)).length;(Qt||oe)&&(x.polygonStart(),Qt&&(x.lineStart(),l(null,null,1,x),x.lineEnd()),oe&&Kx(A,a,Gt,l,x),x.polygonEnd()),S=x,A=P=O=null}function xt(){dt.point=Nt,P&&P.push(O=[]),nt=!0,K=!1,V=$=NaN}function fe(){A&&(Nt(B,U),Y&&K&&L.rejoin(),A.push(L.result())),dt.point=gt,K&&S.lineEnd()}function Nt(Gt,Qt){var oe=r(Gt,Qt);if(P&&O.push([Gt,Qt]),nt)B=Gt,U=Qt,Y=oe,nt=!1,oe&&(S.lineStart(),S.point(Gt,Qt));else if(oe&&K)S.point(Gt,Qt);else{var Ce=[V=Math.max(Om,Math.min(Dp,V)),$=Math.max(Om,Math.min(Dp,$))],yn=[Gt=Math.max(Om,Math.min(Dp,Gt)),Qt=Math.max(Om,Math.min(Dp,Qt))];GC(Ce,yn,e,t,n,i)?(K||(S.lineStart(),S.point(Ce[0],Ce[1])),S.point(yn[0],yn[1]),oe||S.lineEnd(),ht=!1):oe&&(S.lineStart(),S.point(Gt,Qt),ht=!1)}V=Gt,$=Qt,K=oe}return dt}}var K_=$u();function $C(e,t){var n=t[0],i=t[1],r=[Qi(n),-Ji(n),0],l=0,f=0;K_.reset();for(var a=0,_=e.length;a<_;++a)if(S=(x=e[a]).length)for(var x,S,L=x[S-1],A=L[0],P=L[1]/2+w1,O=Qi(P),B=Ji(P),U=0;U=0?1:-1,gt=dt*ht,ut=gt>Yn,Et=O*K;if(K_.add(tf(Et*dt*Qi(gt),B*nt+Et*Ji(gt))),l+=ut?ht+dt*vl:ht,ut^A>=n^V>=n){var yt=lg(ef(L),ef(Y));wy(yt);var xt=lg(r,yt);wy(xt);var fe=(ut^ht>=0?-1:1)*Ac(xt[2]);(i>fe||i===fe&&(yt[0]||yt[1]))&&(f+=ut^ht>=0?1:-1)}}return(l<-Mi||lsd&&(sd=e),tcg&&(cg=t)}$u();function tw(e,t,n,i){return function(r,l){var f=t(l),a=r.invert(i[0],i[1]),_=Yx(),x=t(_),S=!1,L,A,P,O={point:B,lineStart:Y,lineEnd:V,polygonStart:function(){O.point=$,O.lineStart=K,O.lineEnd=nt,A=[],L=[]},polygonEnd:function(){O.point=B,O.lineStart=Y,O.lineEnd=V,A=Qx(A);var ht=$C(L,a);A.length?(S||(l.polygonStart(),S=!0),Kx(A,HC,ht,n,l)):ht&&(S||(l.polygonStart(),S=!0),l.lineStart(),n(null,null,1,l),l.lineEnd()),S&&(l.polygonEnd(),S=!1),A=L=null},sphere:function(){l.polygonStart(),l.lineStart(),n(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function B(ht,dt){var gt=r(ht,dt);e(ht=gt[0],dt=gt[1])&&l.point(ht,dt)}function U(ht,dt){var gt=r(ht,dt);f.point(gt[0],gt[1])}function Y(){O.point=U,f.lineStart()}function V(){O.point=B,f.lineEnd()}function $(ht,dt){P.push([ht,dt]);var gt=r(ht,dt);x.point(gt[0],gt[1])}function K(){x.lineStart(),P=[]}function nt(){$(P[0][0],P[0][1]),x.lineEnd();var ht=x.clean(),dt=_.result(),gt,ut=dt.length,Et,yt,xt;if(P.pop(),L.push(P),P=null,!!ut){if(ht&1){if(yt=dt[0],(Et=yt.length-1)>0){for(S||(l.polygonStart(),S=!0),l.lineStart(),gt=0;gt1&&ht&2&&dt.push(dt.pop().concat(dt.shift())),A.push(dt.filter(XC))}}return O}}function XC(e){return e.length>1}function HC(e,t){return((e=e.x)[0]<0?e[1]-fl-Mi:fl-e[1])-((t=t.x)[0]<0?t[1]-fl-Mi:fl-t[1])}const N1=tw(function(){return!0},YC,JC,[-Yn,-fl]);function YC(e){var t=NaN,n=NaN,i=NaN,r;return{lineStart:function(){e.lineStart(),r=1},point:function(l,f){var a=l>0?Yn:-Yn,_=Qr(l-t);Qr(_-Yn)0?fl:-fl),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(l,n),r=0):i!==a&&_>=Yn&&(Qr(t-i)Mi?FC((Qi(t)*(l=Ji(i))*Qi(n)-Qi(i)*(r=Ji(t))*Qi(e))/(r*l*f)):(t+i)/2}function JC(e,t,n,i){var r;if(e==null)r=n*fl,i.point(-Yn,r),i.point(0,r),i.point(Yn,r),i.point(Yn,0),i.point(Yn,-r),i.point(0,-r),i.point(-Yn,-r),i.point(-Yn,0),i.point(-Yn,r);else if(Qr(e[0]-t[0])>Mi){var l=e[0]0,r=Qr(n)>Mi;function l(S,L,A,P){UC(P,e,t,A,S,L)}function f(S,L){return Ji(S)*Ji(L)>n}function a(S){var L,A,P,O,B;return{lineStart:function(){O=P=!1,B=1},point:function(U,Y){var V=[U,Y],$,K=f(U,Y),nt=i?K?0:x(U,Y):K?x(U+(U<0?Yn:-Yn),Y):0;if(!L&&(O=P=K)&&S.lineStart(),K!==P&&($=_(L,V),(!$||jm(L,$)||jm(V,$))&&(V[0]+=Mi,V[1]+=Mi,K=f(V[0],V[1]))),K!==P)B=0,K?(S.lineStart(),$=_(V,L),S.point($[0],$[1])):($=_(L,V),S.point($[0],$[1]),S.lineEnd()),L=$;else if(r&&L&&i^K){var ht;!(nt&A)&&(ht=_(V,L,!0))&&(B=0,i?(S.lineStart(),S.point(ht[0][0],ht[0][1]),S.point(ht[1][0],ht[1][1]),S.lineEnd()):(S.point(ht[1][0],ht[1][1]),S.lineEnd(),S.lineStart(),S.point(ht[0][0],ht[0][1])))}K&&(!L||!jm(L,V))&&S.point(V[0],V[1]),L=V,P=K,A=nt},lineEnd:function(){P&&S.lineEnd(),L=null},clean:function(){return B|(O&&P)<<1}}}function _(S,L,A){var P=ef(S),O=ef(L),B=[1,0,0],U=lg(P,O),Y=Nm(U,U),V=U[0],$=Y-V*V;if(!$)return!A&&S;var K=n*Y/$,nt=-n*V/$,ht=lg(B,U),dt=Dm(B,K),gt=Dm(U,nt);Y_(dt,gt);var ut=ht,Et=Nm(dt,ut),yt=Nm(ut,ut),xt=Et*Et-yt*(Nm(dt,dt)-1);if(!(xt<0)){var fe=ff(xt),Nt=Dm(ut,(-Et-fe)/yt);if(Y_(Nt,dt),Nt=xy(Nt),!A)return Nt;var Gt=S[0],Qt=L[0],oe=S[1],Ce=L[1],yn;Qt0^Nt[1]<(Qr(Nt[0]-Gt)Yn^(Gt<=Nt[0]&&Nt[0]<=Qt)){var ke=Dm(ut,(-Et+fe)/yt);return Y_(ke,dt),[Nt,xy(ke)]}}}function x(S,L){var A=i?e:Yn-e,P=0;return S<-A?P|=1:S>A&&(P|=2),L<-A?P|=4:L>A&&(P|=8),P}return tw(f,a,l,i?[0,-e]:[-Yn,e-Yn])}function ew(e){return function(t){var n=new Ey;for(var i in e)n[i]=e[i];return n.stream=t,n}}function Ey(){}Ey.prototype={constructor:Ey,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function nw(e,t,n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],l=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),l!=null&&e.clipExtent(null),BC(n,e.stream(A1));var f=A1.result(),a=Math.min(i/(f[1][0]-f[0][0]),r/(f[1][1]-f[0][1])),_=+t[0][0]+(i-a*(f[1][0]+f[0][0]))/2,x=+t[0][1]+(r-a*(f[1][1]+f[0][1]))/2;return l!=null&&e.clipExtent(l),e.scale(a*150).translate([_,x])}function tT(e,t,n){return nw(e,[[0,0],t],n)}var D1=16,eT=Ji(30*Qs);function R1(e,t){return+t?iT(e,t):nT(e)}function nT(e){return ew({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function iT(e,t){function n(i,r,l,f,a,_,x,S,L,A,P,O,B,U){var Y=x-i,V=S-r,$=Y*Y+V*V;if($>4*t&&B--){var K=f+A,nt=a+P,ht=_+O,dt=ff(K*K+nt*nt+ht*ht),gt=Ac(ht/=dt),ut=Qr(Qr(ht)-1)t||Qr((Y*fe+V*Nt)/$-.5)>.3||f*A+a*P+_*O2?Nt[2]%360*Qs:0,xt()):[x*Tu,S*Tu,L*Tu]},ut.precision=function(Nt){return arguments.length?(ht=R1(yt,nt=Nt*Nt),fe()):ff(nt)},ut.fitExtent=function(Nt,Gt){return nw(ut,Nt,Gt)},ut.fitSize=function(Nt,Gt){return tT(ut,Nt,Gt)};function xt(){P=Hx(A=VC(x,S,L),t);var Nt=t(a,_);return l=i-Nt[0]*n,f=r+Nt[1]*n,fe()}function fe(){return dt=gt=null,ut}return function(){return t=e.apply(this,arguments),ut.invert=t.invert&&Et,xt()}}function iw(e){return function(t,n){var i=Ji(t),r=Ji(n),l=e(i*r);return[l*r*Qi(t),l*Qi(n)]}}function rw(e){return function(t,n){var i=ff(t*t+n*n),r=e(i),l=Qi(r),f=Ji(r);return[tf(t*l,i*f),Ac(i&&n*l/i)]}}var aT=iw(function(e){return ff(2/(1+e))});aT.invert=rw(function(e){return 2*Ac(e/2)});var ow=iw(function(e){return(e=Xx(e))&&e/Qi(e)});ow.invert=rw(function(e){return e});function lT(){return oT(ow).scale(79.4188).clipAngle(180-.001)}function O1(e,t){return[e,t]}O1.invert=O1;function uT(e,t,n){n=n||{};var i=n.units||"kilometers",r=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof r!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var l=[];switch(e.type){case"GeometryCollection":return bx(e,function(f){var a=qm(f,t,i,r);a&&l.push(a)}),_y(l);case"FeatureCollection":return g1(e,function(f){var a=qm(f,t,i,r);a&&g1(a,function(_){_&&l.push(_)})}),_y(l)}return qm(e,t,i,r)}function qm(e,t,n,i){var r=e.properties||{},l=e.type==="Feature"?e.geometry:e;if(l.type==="GeometryCollection"){var f=[];return bx(e,function(B){var U=qm(B,t,n,i);U&&f.push(U)}),_y(f)}var a=cT(l),_={type:l.type,coordinates:aw(l.coordinates,a)},x=new Uy,S=x.read(_),L=_C(yC(t,n),"meters"),A=Ir.bufferOp(S,L,i),P=new Px;if(A=P.write(A),!sw(A.coordinates)){var O={type:A.type,coordinates:lw(A.coordinates,a)};return vg(O,r)}}function sw(e){return Array.isArray(e[0])?sw(e[0]):isNaN(e[0])}function aw(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return aw(n,t)})}function lw(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return lw(n,t)})}function cT(e){var t=bC(e).geometry.coordinates,n=[-t[0],-t[1]];return lT().rotate(n).scale(qo)}function hT(e,t){var n=tg(e),i=tg(t),r=e.properties||{},l=mx.difference(n.coordinates,i.coordinates);return l.length===0?null:l.length===1?_x(l[0],r):yx(l,r)}function z1(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function F1(e,t){const n=hT({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const i=uT(e,0);if(i.geometry.type==="Polygon")for(const r of i.geometry.coordinates)z1(r);else for(const r of i.geometry.coordinates)for(const l of r)z1(l);t({type:"FeatureCollection",features:[i,n]})}let B1={type:"FeatureCollection",features:[]};function fT(e,t,n=!0,i=!0,r={},l={},f={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let a,_=[],x,S;function L(){(f!=null&&f.fill||f!=null&&f.line)&&e.addSource("full-geom",{type:"geojson",data:B1}),f!=null&&f.fill&&e.addLayer({...f==null?void 0:f.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),f!=null&&f.line&&e.addLayer({...f==null?void 0:f.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?L():e.once("load",()=>{L()});const A=O=>{a==null||a({type:"mapClick",coordinates:[O.lngLat.lng,O.lngLat.lat]})};function P(O=!1){if(!t)throw new Error;const B=document.createElement("div");return O&&B.classList.add("marker-interactive"),new UI({props:{displayIn:"maplibre"},target:B}),new t.Marker({element:B,offset:[1,-13]})}return{setEventHandler(O){O?(a=O,e.on("click",A)):(a=void 0,e.off("click",A))},flyTo(O,B){e.flyTo({center:O,zoom:B,...r})},fitBounds(O,B,U){e.fitBounds([[O[0],O[1]],[O[2],O[3]]],{padding:B,maxZoom:U,...l})},indicateReverse(O){e.getCanvasContainer().style.cursor=O?"crosshair":""},setReverseMarker(O){!t||!n||(S?O?S.setLngLat(O):(S.remove(),S=void 0):O&&(S=(typeof n=="object"?new t.Marker(n):P()).setLngLat(O).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(O,B){if(!n)return;function U(Y){var V;(V=e.getSource("full-geom"))==null||V.setData(Y)}for(const Y of _)Y.remove();if(_.length=0,U(B1),!!t){if(B){let Y=!1;if(B.geometry.type==="GeometryCollection"){const V=B.geometry.geometries.filter($=>$.type==="Polygon"||$.type==="MultiPolygon");if(V.length>0){let $=V.pop();for(const K of V)$=vC($,K);F1({...B,geometry:$},U),Y=!0}else{const $=B.geometry.geometries.filter(K=>K.type==="LineString"||K.type==="MultiLineString");$.length>0&&(U({...B,geometry:{type:"GeometryCollection",geometries:$}}),Y=!0)}}if(!Y){if(B.geometry.type==="Polygon"||B.geometry.type==="MultiPolygon")F1(B,U);else if(B.geometry.type==="LineString"||B.geometry.type==="MultiLineString"){U(B);return}}n&&_.push((typeof n=="object"?new t.Marker(n):P()).setLngLat(B.center).addTo(e))}if(i)for(const Y of O??[]){if(Y===B)continue;const V=(typeof i=="object"?new t.Marker(i):P(!0)).setLngLat(Y.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(Y.place_type[0]==="reverse"?Y.place_name:Y.place_name.replace(/,.*/,""))).addTo(e),$=V.getElement();$.addEventListener("click",K=>{K.stopPropagation(),a==null||a({type:"markerClick",id:Y.id})}),$.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:Y.id}),V.togglePopup()}),$.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:Y.id}),V.togglePopup()}),_.push(V)}}},setSelectedMarker(O){x&&x.getElement().classList.toggle("marker-selected",!1),x=O>-1?_[O]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const O=e.getCenter();return[e.getZoom(),O.lng,O.lat]}}}function pT(e){let t,n;return{c(){t=$l("svg"),n=$l("path"),Rt(n,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),Rt(t,"viewBox","0 0 14 14"),Rt(t,"width","13"),Rt(t,"height","13"),Rt(t,"class","svelte-en2qvf")},m(i,r){Ct(i,t,r),mt(t,n)},p:Ie,i:Ie,o:Ie,d(i){i&&It(t)}}}class uw extends nn{constructor(t){super(),en(this,t,null,pT,He,{})}}function dT(e){let t,n;return{c(){t=$l("svg"),n=$l("path"),Rt(n,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),Rt(t,"viewBox","0 0 30 30"),Rt(t,"fill","none"),Rt(t,"xmlns","http://www.w3.org/2000/svg"),Rt(t,"class","svelte-d2loi5")},m(i,r){Ct(i,t,r),mt(t,n)},p:Ie,i:Ie,o:Ie,d(i){i&&It(t)}}}class cw extends nn{constructor(t){super(),en(this,t,null,dT,He,{})}}function mT(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"area.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"area.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function gT(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"reverse.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"reverse.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function _T(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"poi.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"poi.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function yT(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"postal_code.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"postal_code.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function vT(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"street.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"street.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function bT(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"road.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"road.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function xT(e){let t,n;return{c(){t=wt("img"),hr(t.src,n=e[3]+"housenumber.svg")||Rt(t,"src",n),Rt(t,"alt",e[6]),Rt(t,"class","svelte-ltkwvy")},m(i,r){Ct(i,t,r)},p(i,r){r&8&&!hr(t.src,n=i[3]+"housenumber.svg")&&Rt(t,"src",n),r&64&&Rt(t,"alt",i[6])},d(i){i&&It(t)}}}function wT(e){let t,n,i,r;return{c(){t=wt("img"),hr(t.src,n=e[5])||Rt(t,"src",n),Rt(t,"alt",e[4]),Rt(t,"class","svelte-ltkwvy")},m(l,f){Ct(l,t,f),i||(r=Ze(t,"error",e[14]),i=!0)},p(l,f){f&32&&!hr(t.src,n=l[5])&&Rt(t,"src",n),f&16&&Rt(t,"alt",l[4])},d(l){l&&It(t),i=!1,r()}}}function V1(e){let t,n;return{c(){t=wt("span"),n=be(e[6]),Rt(t,"class","secondary svelte-ltkwvy")},m(i,r){Ct(i,t,r),mt(t,n)},p(i,r){r&64&&Zi(n,i[6])},d(i){i&&It(t)}}}function ST(e){var dt,gt;let t,n,i,r,l,f,a,_,x=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,L,A=e[2]==="always"||e[2]&&!e[0].address&&((dt=e[0].properties)==null?void 0:dt.kind)!=="road"&&((gt=e[0].properties)==null?void 0:gt.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],P,O,B=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",U,Y,V;function $(ut,Et){var yt,xt;return Et&1&&(n=null),Et&1&&(i=null),Et&1&&(r=null),ut[5]?wT:ut[0].address?xT:((yt=ut[0].properties)==null?void 0:yt.kind)==="road"||((xt=ut[0].properties)==null?void 0:xt.kind)==="road_relation"?bT:(n==null&&(n=!!ut[0].id.startsWith("address.")),n?vT:(i==null&&(i=!!ut[0].id.startsWith("postal_code.")),i?yT:(r==null&&(r=!!ut[0].id.startsWith("poi.")),r?_T:ut[7]?gT:mT)))}let K=$(e,-1),nt=K(e),ht=A&&V1(e);return{c(){t=wt("li"),nt.c(),l=Xt(),f=wt("span"),a=wt("span"),_=wt("span"),S=be(x),L=Xt(),ht&&ht.c(),P=Xt(),O=wt("span"),U=be(B),Rt(_,"class","primary svelte-ltkwvy"),Rt(a,"class","svelte-ltkwvy"),Rt(O,"class","line2 svelte-ltkwvy"),Rt(f,"class","texts svelte-ltkwvy"),Rt(t,"tabindex","0"),Rt(t,"data-selected",e[1]),Rt(t,"class","svelte-ltkwvy"),hl(t,"selected",e[1])},m(ut,Et){Ct(ut,t,Et),nt.m(t,null),mt(t,l),mt(t,f),mt(f,a),mt(a,_),mt(_,S),mt(a,L),ht&&ht.m(a,null),mt(f,P),mt(f,O),mt(O,U),Y||(V=[Ze(t,"mouseenter",e[12]),Ze(t,"focus",e[13])],Y=!0)},p(ut,[Et]){var yt,xt;K===(K=$(ut,Et))&&nt?nt.p(ut,Et):(nt.d(1),nt=K(ut),nt&&(nt.c(),nt.m(t,l))),Et&1&&x!==(x=(ut[7]?ut[0].place_name:ut[0].place_name.replace(/,.*/,""))+"")&&Zi(S,x),Et&37&&(A=ut[2]==="always"||ut[2]&&!ut[0].address&&((yt=ut[0].properties)==null?void 0:yt.kind)!=="road"&&((xt=ut[0].properties)==null?void 0:xt.kind)!=="road_relation"&&!ut[0].id.startsWith("address.")&&!ut[0].id.startsWith("postal_code.")&&(!ut[0].id.startsWith("poi.")||!ut[5])&&!ut[7]),A?ht?ht.p(ut,Et):(ht=V1(ut),ht.c(),ht.m(a,null)):ht&&(ht.d(1),ht=null),Et&1&&B!==(B=(ut[7]?"":ut[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Zi(U,B),Et&2&&Rt(t,"data-selected",ut[1]),Et&2&&hl(t,"selected",ut[1])},i:Ie,o:Ie,d(ut){ut&&It(t),nt.d(),ht&&ht.d(),Y=!1,No(V)}}}function ET(e,t,n){var $;let i,r,{feature:l}=t,{selected:f=!1}=t,{showPlaceType:a}=t,{missingIconsCache:_}=t,{iconsBaseUrl:x}=t;const S=($=l.properties)==null?void 0:$.categories;let L,A,P=0,O=l.place_type[0]==="reverse";function B(K){A&&_.add(A),n(10,P++,P)}function U(K){ii.call(this,e,K)}function Y(K){ii.call(this,e,K)}const V=K=>B(K.currentTarget);return e.$$set=K=>{"feature"in K&&n(0,l=K.feature),"selected"in K&&n(1,f=K.selected),"showPlaceType"in K&&n(2,a=K.showPlaceType),"missingIconsCache"in K&&n(9,_=K.missingIconsCache),"iconsBaseUrl"in K&&n(3,x=K.iconsBaseUrl)},e.$$.update=()=>{var K,nt,ht,dt;if(e.$$.dirty&3640)do n(11,i--,i),n(4,L=S==null?void 0:S[i]),n(5,A=L?x+L.replace(/ /g,"_")+".svg":void 0);while(i>-1&&(!A||_.has(A)));e.$$.dirty&1&&n(6,r=l.id.startsWith("poi.")?(nt=(K=l.properties)==null?void 0:K.categories)==null?void 0:nt.join(", "):((dt=(ht=l.properties)==null?void 0:ht.place_type_name)==null?void 0:dt[0])??l.place_type[0])},n(11,i=(S==null?void 0:S.length)??0),[l,f,a,x,L,A,r,O,B,_,P,i,U,Y,V]}class IT extends nn{constructor(t){super(),en(this,t,ET,ST,He,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function CT(e){let t;return{c(){t=wt("div"),t.innerHTML='',Rt(t,"class","svelte-7cmwmc")},m(n,i){Ct(n,t,i)},p:Ie,i:Ie,o:Ie,d(n){n&&It(t)}}}class TT extends nn{constructor(t){super(),en(this,t,null,CT,He,{})}}function LT(e){let t,n;return{c(){t=$l("svg"),n=$l("path"),Rt(n,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),Rt(t,"viewBox","0 0 60.006 21.412"),Rt(t,"width","14"),Rt(t,"height","20"),Rt(t,"class","svelte-en2qvf")},m(i,r){Ct(i,t,r),mt(t,n)},p:Ie,i:Ie,o:Ie,d(i){i&&It(t)}}}class MT extends nn{constructor(t){super(),en(this,t,null,LT,He,{})}}function PT(e){let t,n,i;return{c(){t=$l("svg"),n=$l("circle"),i=$l("path"),Rt(n,"cx","4.789"),Rt(n,"cy","4.787"),Rt(n,"r","3.85"),mi(n,"stroke-width","1.875"),mi(n,"fill","none"),Rt(i,"d","M12.063 12.063 7.635 7.635"),mi(i,"stroke-width","1.875"),mi(i,"stroke-linecap","round"),Rt(t,"xmlns","http://www.w3.org/2000/svg"),Rt(t,"width","13"),Rt(t,"height","13"),Rt(t,"viewBox","0 0 13 13"),Rt(t,"class","svelte-1bpbt60")},m(r,l){Ct(r,t,l),mt(t,n),mt(t,i)},p:Ie,i:Ie,o:Ie,d(r){r&&It(t)}}}class kT extends nn{constructor(t){super(),en(this,t,null,PT,He,{})}}function AT(e,t,n){const i=t[1],r=t[0],l=i-r;return e===i&&n?e:((e-r)%l+l)%l+r}function U1(e){const t=[...e];return t[2]i[0]||r.maxZoom!=null&&r.maxZoomDate.now()){if(!Sp.coords)break t;return Sp.coords}let l;try{return l=await new Promise((f,a)=>{n.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{f([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},r)}),l}catch{}finally{r.cachedLocationExpiry&&(Sp={time:Date.now(),coords:l})}if(n.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(i&&r.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}const G1=/(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?/i,j1=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?/i,q1=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?/i,Z1=/(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?/i;function DT(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(f=>Number(f.trim()));let n=$1(t[0],e),i=$1(t[1],e);n.endsWith('.0"')&&i.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),i=i.replace(/\.0"$/,'"'));const r=t[0]>=0?" N":" S",l=t[1]>=0?" E":" W";return`${n+r}, ${i+l}`}else throw new Error("no decimal coordinates to convert")}function $1(e,t){const n=Math.abs(e),i=Math.floor(n),r=(n-i)*60;if(t=="DM"){let a=RT(r,3).toFixed(3).padStart(6,"0");return`${i}° ${a}'`}let l=Math.floor(r),f=((r-l)*60).toFixed(1).padStart(4,"0");return l=l.toString().padStart(2,"0"),`${i}° ${l}' ${f}"`}function RT(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function Yy(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,i=null,r="",l="",f=[],a=!1;if(G1.test(e))if(f=G1.exec(e),a=zm(f),a){if(n=f[2],i=f[6],n.includes(",")&&(n=n.replace(",",".")),i.includes(",")&&(i=i.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(i))==Number(i))throw new Error("integer only coordinate provided");f[1]?(r=f[1],l=f[5]):f[4]&&(r=f[4],l=f[8])}else throw new Error("invalid decimal coordinate format");else if(j1.test(e))if(f=j1.exec(e),a=zm(f),a)n=Math.abs(parseInt(f[2])),f[4]&&(n+=f[4]/60),f[6]&&(n+=f[6].replace(",",".")/3600),parseInt(f[2])<0&&(n=-1*n),i=Math.abs(parseInt(f[9])),f[11]&&(i+=f[11]/60),f[13]&&(i+=f[13].replace(",",".")/3600),parseInt(f[9])<0&&(i=-1*i),f[1]?(r=f[1],l=f[8]):f[7]&&(r=f[7],l=f[14]);else throw new Error("invalid DMS coordinates format");else if(q1.test(e))if(f=q1.exec(e),a=zm(f),a)n=Math.abs(parseInt(f[2])),f[4]&&(n+=f[4]/60),f[6]&&(n+=f[6]/3600),parseInt(f[2])<0&&(n=-1*n),i=Math.abs(parseInt(f[10])),f[12]&&(i+=f[12]/60),f[14]&&(i+=f[14]/3600),parseInt(f[10])<0&&(i=-1*i),f[1]?(r=f[1],l=f[9]):f[8]&&(r=f[8],l=f[16]);else throw new Error("invalid DMS coordinates format");else if(Z1.test(e))if(f=Z1.exec(e),a=zm(f),a)n=Math.abs(parseInt(f[2])),f[4]&&(n+=f[4]/60),f[6]&&(n+=f[6]/3600),parseInt(f[2])<0&&(n=-1*n),i=Math.abs(parseInt(f[10])),f[12]&&(i+=f[12]/60),f[14]&&(i+=f[14]/3600),parseInt(f[10])<0&&(i=-1*i),f[1]?(r=f[1],l=f[9]):f[8]&&(r=f[8],l=f[16]);else throw new Error("invalid coordinates format");if(a){if(Math.abs(i)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((r||l)&&(!r||!l))throw new Error("invalid coordinates format");if(r&&r==l)throw new Error("invalid coordinates format");let _=/S|SOUTH/i;_.test(r)&&n>0&&(n=-1*n),_=/W|WEST/i,_.test(l)&&i>0&&(i=-1*i);const x=f[0].trim();let S,L;const A=/[,/;\u0020]/g,P=x.match(A);if(P==null){const U=Math.floor(e.length/2);S=x.substring(0,U).trim(),L=x.substring(U).trim()}else{let U;P.length%2==1?U=Math.floor(P.length/2):U=P.length/2-1;let Y=0;if(U==0)Y=x.indexOf(P[0]),S=x.substring(0,Y).trim(),L=x.substring(Y+1).trim();else{let V=0,$=0;for(;V<=U;)Y=x.indexOf(P[V],$),$=Y+1,V++;S=x.substring(0,Y).trim(),L=x.substring(Y+1).trim()}}const O=S.split(".");if(O.length==2&&O[1]==0&&O[1].length!=2)throw new Error("invalid coordinates format");const B=L.split(".");if(B.length==2&&B[1]==0&&B[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(L))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(i)&&i.includes(",")&&(i=i.replace(",",".")),i=Number(Number(i).toFixed(t)),Object.freeze({verbatimCoordinates:x,verbatimLatitude:S,verbatimLongitude:L,decimalLatitude:n,decimalLongitude:i,decimalCoordinates:`${n},${i}`,closeEnough:OT,toCoordinateFormat:DT})}else throw new Error("coordinates pattern match failed")}function zm(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,i=/[eastsouthnorthwest]+/i,r=t.length/2;for(let l=0;l{t.decimalLatitude?e.push(t):e.push({...t,...BT})}),[...e,...VT,...UT]}const jT=GT();Yy.formats=jT.map(e=>e.verbatimCoordinates);const qT=Yy;function X1(e,t,n){const i=e.slice();return i[81]=t[n],i[83]=n,i}function H1(e){let t,n;return t=new TT({}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Y1(e){let t,n,i,r,l;return n=new MT({}),{c(){t=wt("button"),Zt(n.$$.fragment),Rt(t,"type","button"),Rt(t,"title",e[9]),Rt(t,"class","svelte-zh3kmv"),hl(t,"active",e[0])},m(f,a){Ct(f,t,a),jt(n,t,null),i=!0,r||(l=Ze(t,"click",e[67]),r=!0)},p(f,a){(!i||a[0]&512)&&Rt(t,"title",f[9]),(!i||a[0]&1)&&hl(t,"active",f[0])},i(f){i||(pt(n.$$.fragment,f),i=!0)},o(f){bt(n.$$.fragment,f),i=!1},d(f){f&&It(t),qt(n),r=!1,l()}}}function ZT(e){let t,n=[],i=new Map,r,l,f,a=la(e[14]);const _=x=>x[81].id+(x[81].address?","+x[81].address:"");for(let x=0;x{dt=null}),ci()),(!$||Gt[0]&2)&&hl(x,"displayable",Nt[1]!==""),Nt[5]===!0?gt?(gt.p(Nt,Gt),Gt[0]&32&&pt(gt,1)):(gt=Y1(Nt),gt.c(),pt(gt,1),gt.m(i,O)):gt&&(ui(),bt(gt,1,1,()=>{gt=null}),ci()),Et&&Et.p&&(!$||Gt[1]&134217728)&&lr(Et,ut,Nt,Nt[58],$?ar(ut,Nt[58],Gt,null):ur(Nt[58]),null);let Qt=U;U=fe(Nt),U===Qt?~U&&xt[U].p(Nt,Gt):(Y&&(ui(),bt(xt[Qt],1,1,()=>{xt[Qt]=null}),ci()),~U?(Y=xt[U],Y?Y.p(Nt,Gt):(Y=xt[U]=yt[U](Nt),Y.c()),pt(Y,1),Y.m(n,null)):Y=null),(!$||Gt[0]&4&&V!==(V=Zm(Nt[2])+" svelte-zh3kmv"))&&Rt(n,"class",V),(!$||Gt[0]&22)&&hl(n,"can-collapse",Nt[4]&&Nt[1]==="")},i(Nt){$||(pt(ht),pt(l.$$.fragment,Nt),pt(L.$$.fragment,Nt),pt(dt),pt(gt),pt(Et,Nt),pt(Y),$=!0)},o(Nt){bt(ht),bt(l.$$.fragment,Nt),bt(L.$$.fragment,Nt),bt(dt),bt(gt),bt(Et,Nt),bt(Y),$=!1},d(Nt){Nt&&(It(t),It(n)),qt(l),e[61](null),qt(L),dt&&dt.d(),gt&>.d(),Et&&Et.d(Nt),~U&&xt[U].d(),K=!1,No(nt)}}}function YT(e,t,n){let i,{$$slots:r={},$$scope:l}=t,{class:f=void 0}=t,{apiKey:a}=t,{bbox:_=void 0}=t,{clearButtonTitle:x="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:L=!1}=t,{country:A=void 0}=t,{debounceSearch:P=200}=t,{enableReverse:O=!1}=t,{errorMessage:B="Something went wrong…"}=t,{filter:U=()=>!0}=t,{flyTo:Y=!0}=t,{fuzzyMatch:V=!0}=t,{language:$=void 0}=t,{limit:K=void 0}=t,{mapController:nt=void 0}=t,{minLength:ht=2}=t,{noResultsMessage:dt="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=t,{placeholder:gt="Search"}=t,{proximity:ut=[{type:"server-geolocation"}]}=t,{reverseActive:Et=O==="always"}=t,{reverseButtonTitle:yt="toggle reverse geocoding"}=t,{searchValue:xt=""}=t,{showFullGeometry:fe=!0}=t,{showPlaceType:Nt="ifNeeded"}=t,{showResultsWhileTyping:Gt=!0}=t,{selectFirst:Qt=!0}=t,{flyToSelected:oe=!1}=t,{markerOnSelected:Ce=!0}=t,{types:yn=void 0}=t,{excludeTypes:jn=!1}=t,{zoom:Qe=16}=t,{maxZoom:Fe=18}=t,{apiUrl:ke="https://api.maptiler.com/geocoding"}=t,{fetchParameters:fn={}}=t,{iconsBaseUrl:Kn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.1/icons/"}=t,{adjustUrlQuery:qn=Z=>{}}=t;function ie(){Wn.focus()}function De(){Wn.blur()}function hn(Z,ot=!0){n(1,xt=Z),ot?(n(15,pn=-1),ns()):(yo(),setTimeout(()=>{Wn.focus(),Wn.select()}))}function On(){n(14,_t=void 0),n(55,qe=void 0),n(15,pn=-1)}function _i(){n(54,Ee=[]),n(55,qe=void 0)}let wn=!1,_t,Ee,qe,nr="",Wn,pn=-1,Wi,$t=[],Bi,fr,zn,In;const es=new Set,oo=Dc();aa(()=>{nt&&(nt.setEventHandler(void 0),nt.indicateReverse(!1),nt.setSelectedMarker(-1),nt.setMarkers(void 0,void 0))});function ns(Z){if(fr&&(clearTimeout(fr),fr=void 0),pn>-1&&_t)n(55,qe=_t[pn]),n(1,xt=qe.place_type[0]==="reverse"?qe.place_name:qe.place_name.replace(/,.*/,"")),n(18,Wi=void 0),n(54,Ee=void 0),n(15,pn=-1);else if(xt){const ot=Z||!Ha(xt);Gs(xt,{exact:!0}).then(()=>{n(54,Ee=_t),n(55,qe=void 0),ot&&js()}).catch(Mt=>n(18,Wi=Mt))}}function Ha(Z){try{return qT(Z,6)}catch{return!1}}async function Gs(Z,{byId:ot=!1,exact:Mt=!1}={}){n(18,Wi=void 0),Bi==null||Bi.abort();const vt=new AbortController;n(19,Bi=vt);try{const rt=Ha(Z),Tt=new URLSearchParams;if($!==void 0&&Tt.set("language",Array.isArray($)?$.join(","):$??""),yn&&Tt.set("types",yn.join(",")),jn&&Tt.set("excludeTypes",String(jn)),_&&Tt.set("bbox",_.map(Ne=>Ne.toFixed(6)).join(",")),A&&Tt.set("country",Array.isArray(A)?A.join(","):A),!ot&&!rt){const Ne=await NT(nt,ut,vt);Ne&&Tt.set("proximity",Ne),(Mt||!Gt)&&Tt.set("autocomplete","false"),Tt.set("fuzzyMatch",String(V))}K!==void 0&&(!rt||(yn==null?void 0:yn.length)===1)&&Tt.set("limit",String(K)),Tt.set("key",a),qn(Tt);const Wt=ke+"/"+encodeURIComponent(rt?rt.decimalLongitude+","+rt.decimalLatitude:Z)+".json?"+Tt.toString();if(Wt===nr){ot?(n(14,_t=void 0),n(55,qe=$t[0])):n(14,_t=$t);return}nr=Wt;const Ht=await fetch(Wt,{signal:vt.signal,...fn});if(!Ht.ok)throw new Error(await Ht.text());const Kt=await Ht.json();oo("response",{url:Wt,featureCollection:Kt}),ot?(n(14,_t=void 0),n(55,qe=Kt.features[0]),$t=[qe]):(n(14,_t=Kt.features.filter(U)),rt&&_t.unshift({type:"Feature",properties:{},id:"reverse_"+rt.decimalLongitude+"_"+rt.decimalLatitude,text:rt.decimalLatitude+", "+rt.decimalLongitude,place_name:rt.decimalLatitude+", "+rt.decimalLongitude,place_type:["reverse"],center:[rt.decimalLongitude,rt.decimalLatitude],bbox:[rt.decimalLongitude,rt.decimalLatitude,rt.decimalLongitude,rt.decimalLatitude],geometry:{type:"Point",coordinates:[rt.decimalLongitude,rt.decimalLatitude]}}),$t=_t,rt&&Wn.focus())}catch(rt){if(rt&&typeof rt=="object"&&"name"in rt&&rt.name==="AbortError")return;throw rt}finally{vt===Bi&&n(19,Bi=void 0)}}function js(){var Mt;if(!(Ee!=null&&Ee.length)||!Y)return;const Z=[180,90,-180,-90],ot=!Ee.some(vt=>!vt.matching_text);for(const vt of Ee)if(ot||!vt.matching_text)for(const rt of[0,1,2,3])Z[rt]=Math[rt<2?"min":"max"](Z[rt],((Mt=vt.bbox)==null?void 0:Mt[rt])??vt.center[rt%2]);nt&&Ee.length>0&&(qe&&Z[0]===Z[2]&&Z[1]===Z[3]?nt.flyTo(qe.center,Qe):nt.fitBounds(U1(Z),50,Fe))}function Sa(Z){n(0,Et=O==="always"),n(14,_t=void 0),n(55,qe=void 0),n(15,pn=-1),hn(Z[1].toFixed(6)+", "+AT(Z[0],[-180,180],!0).toFixed(6),!1)}function ae(Z){if(!_t)return;let ot=Z.key==="ArrowDown"?1:Z.key==="ArrowUp"?-1:0;ot&&(pn===(Qt?0:-1)&&ot===-1&&n(15,pn=_t.length),n(15,pn+=ot),pn>=_t.length&&n(15,pn=-1),pn<0&&Qt&&n(15,pn=0),Z.preventDefault())}function yo(Z=!0){if(n(18,Wi=void 0),Gt){if(fr&&clearTimeout(fr),xt.length{Gs(ot).catch(Mt=>n(18,Wi=Mt))},Z?P:0)}else n(14,_t=void 0),n(18,Wi=void 0)}function ri(Z){n(55,qe=Z),n(1,xt=Z.place_name),n(15,pn=-1)}const Ea=()=>Wn.focus();function ws(Z){cr[Z?"unshift":"push"](()=>{Wn=Z,n(17,Wn)})}function ue(){xt=this.value,n(1,xt),n(13,wn),n(27,S)}const ln=()=>n(13,wn=!0),Ke=()=>n(13,wn=!1),Ar=()=>yo(),is=()=>{n(1,xt=""),Wn.focus()},on=()=>n(0,Et=!Et),Ss=()=>n(18,Wi=void 0),st=Z=>n(15,pn=Z),G=Z=>ri(Z),q=()=>{Qt||n(15,pn=-1)},J=()=>{};return e.$$set=Z=>{"class"in Z&&n(2,f=Z.class),"apiKey"in Z&&n(25,a=Z.apiKey),"bbox"in Z&&n(26,_=Z.bbox),"clearButtonTitle"in Z&&n(3,x=Z.clearButtonTitle),"clearOnBlur"in Z&&n(27,S=Z.clearOnBlur),"collapsed"in Z&&n(4,L=Z.collapsed),"country"in Z&&n(28,A=Z.country),"debounceSearch"in Z&&n(29,P=Z.debounceSearch),"enableReverse"in Z&&n(5,O=Z.enableReverse),"errorMessage"in Z&&n(6,B=Z.errorMessage),"filter"in Z&&n(30,U=Z.filter),"flyTo"in Z&&n(31,Y=Z.flyTo),"fuzzyMatch"in Z&&n(32,V=Z.fuzzyMatch),"language"in Z&&n(33,$=Z.language),"limit"in Z&&n(34,K=Z.limit),"mapController"in Z&&n(35,nt=Z.mapController),"minLength"in Z&&n(36,ht=Z.minLength),"noResultsMessage"in Z&&n(7,dt=Z.noResultsMessage),"placeholder"in Z&&n(8,gt=Z.placeholder),"proximity"in Z&&n(37,ut=Z.proximity),"reverseActive"in Z&&n(0,Et=Z.reverseActive),"reverseButtonTitle"in Z&&n(9,yt=Z.reverseButtonTitle),"searchValue"in Z&&n(1,xt=Z.searchValue),"showFullGeometry"in Z&&n(38,fe=Z.showFullGeometry),"showPlaceType"in Z&&n(10,Nt=Z.showPlaceType),"showResultsWhileTyping"in Z&&n(39,Gt=Z.showResultsWhileTyping),"selectFirst"in Z&&n(11,Qt=Z.selectFirst),"flyToSelected"in Z&&n(40,oe=Z.flyToSelected),"markerOnSelected"in Z&&n(41,Ce=Z.markerOnSelected),"types"in Z&&n(42,yn=Z.types),"excludeTypes"in Z&&n(43,jn=Z.excludeTypes),"zoom"in Z&&n(44,Qe=Z.zoom),"maxZoom"in Z&&n(45,Fe=Z.maxZoom),"apiUrl"in Z&&n(46,ke=Z.apiUrl),"fetchParameters"in Z&&n(47,fn=Z.fetchParameters),"iconsBaseUrl"in Z&&n(12,Kn=Z.iconsBaseUrl),"adjustUrlQuery"in Z&&n(48,qn=Z.adjustUrlQuery),"$$scope"in Z&&n(58,l=Z.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,zn=wn),S&&!wn&&n(1,xt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&xt.lengthn(18,Wi=Z)),e.$$.dirty[1]&50356241&&(nt&&qe&&qe.id!==In&&Y&&(!qe.bbox||qe.bbox[0]===qe.bbox[2]&&qe.bbox[1]===qe.bbox[3]?nt.flyTo(qe.center,qe.id.startsWith("poi.")||qe.id.startsWith("address.")?Fe:Qe):nt.fitBounds(U1(qe.bbox),50,Fe),n(14,_t=void 0),n(54,Ee=void 0),n(15,pn=-1)),n(56,In=qe==null?void 0:qe.id)),e.$$.dirty[0]&18432&&Qt&&_t!=null&&_t.length&&n(15,pn=0),e.$$.dirty[0]&2050&&(Qt||n(15,pn=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Ee!==_t&&n(54,Ee=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&nt&&nt.setEventHandler(Z=>{switch(Z.type){case"mapClick":Et&&Sa(Z.coordinates);break;case"markerClick":{const ot=_t==null?void 0:_t.find(Mt=>Mt.id===Z.id);ot&&ri(ot)}break;case"markerMouseEnter":Ee&&n(15,pn=zn?(_t==null?void 0:_t.findIndex(ot=>ot.id===Z.id))??-1:-1);break;case"markerMouseLeave":Ee&&n(15,pn=-1);break}}),e.$$.dirty[0]&49152&&n(57,i=_t==null?void 0:_t[pn]),e.$$.dirty[1]&67133969&&nt&&i&&Y&&oe&&nt.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Fe:Qe),e.$$.dirty[1]&1040&&(Ce||nt==null||nt.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&nt&&Ce&&!Ee&&(nt.setMarkers(i?[i]:void 0,void 0),nt.setSelectedMarker(i?0:-1)),e.$$.dirty[1]&25165840&&nt&&nt.setMarkers(Ee,qe),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Ee&&nt&&nt.setSelectedMarker(pn),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&nt){const Z=Ha(xt);nt.setReverseMarker(Z?[Z.decimalLongitude,Z.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&oo("select",i),e.$$.dirty[1]&16777216&&oo("pick",qe),e.$$.dirty[0]&81920&&oo("optionsVisibilityChange",zn&&!!_t),e.$$.dirty[0]&16384&&oo("featuresListed",_t),e.$$.dirty[1]&8388608&&oo("featuresMarked",Ee),e.$$.dirty[0]&1&&oo("reverseToggle",Et),e.$$.dirty[0]&2&&oo("queryChange",xt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&nt&&nt.indicateReverse(Et)},[Et,xt,f,x,L,O,B,dt,gt,yt,Nt,Qt,Kn,wn,_t,pn,zn,Wn,Wi,Bi,es,ns,ae,yo,ri,a,_,S,A,P,U,Y,V,$,K,nt,ht,ut,fe,Gt,oe,Ce,yn,jn,Qe,Fe,ke,fn,qn,ie,De,hn,On,_i,Ee,qe,In,i,l,r,Ea,ws,ue,ln,Ke,Ar,is,on,Ss,st,G,q,J]}class KT extends nn{constructor(t){super(),en(this,t,YT,HT,He,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function J1(e){let t,n,i;return n=new KT({props:{mapController:e[0],apiKey:ky}}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"class","svelte-ixhnie")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&1&&(f.mapController=r[0]),n.$set(f)},i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function JT(e){let t,n,i=e[0]&&J1(e);return{c(){i&&i.c(),t=ts()},m(r,l){i&&i.m(r,l),Ct(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&pt(i,1)):(i=J1(r),i.c(),pt(i,1),i.m(t.parentNode,t)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function QT(e,t,n){let i,r;return Se(e,Du,l=>n(1,r=l)),e.$$.update=()=>{e.$$.dirty&2&&n(0,i=r?fT(r,Ms):null)},[i,r]}class tL extends nn{constructor(t){super(),en(this,t,QT,JT,He,{})}}const eL=e=>({}),Q1=e=>({}),nL=e=>({}),tb=e=>({}),iL=e=>({}),eb=e=>({});function rL(e){let t,n,i,r,l,f;const a=e[1].top,_=sr(a,e,e[0],eb),x=e[1].left,S=sr(x,e,e[0],tb),L=e[1].main,A=sr(L,e,e[0],Q1);return{c(){t=wt("div"),_&&_.c(),n=Xt(),i=wt("div"),S&&S.c(),r=Xt(),l=wt("div"),A&&A.c(),Rt(t,"class","top svelte-3nmiww"),Rt(i,"class","left svelte-3nmiww"),Rt(l,"class","main svelte-3nmiww")},m(P,O){Ct(P,t,O),_&&_.m(t,null),Ct(P,n,O),Ct(P,i,O),S&&S.m(i,null),Ct(P,r,O),Ct(P,l,O),A&&A.m(l,null),f=!0},p(P,[O]){_&&_.p&&(!f||O&1)&&lr(_,a,P,P[0],f?ar(a,P[0],O,iL):ur(P[0]),eb),S&&S.p&&(!f||O&1)&&lr(S,x,P,P[0],f?ar(x,P[0],O,nL):ur(P[0]),tb),A&&A.p&&(!f||O&1)&&lr(A,L,P,P[0],f?ar(L,P[0],O,eL):ur(P[0]),Q1)},i(P){f||(pt(_,P),pt(S,P),pt(A,P),f=!0)},o(P){bt(_,P),bt(S,P),bt(A,P),f=!1},d(P){P&&(It(t),It(n),It(i),It(r),It(l)),_&&_.d(P),S&&S.d(P),A&&A.d(P)}}}function oL(e,t,n){let{$$slots:i={},$$scope:r}=t;return e.$$set=l=>{"$$scope"in l&&n(0,r=l.$$scope)},[r,i]}class sL extends nn{constructor(t){super(),en(this,t,oL,rL,He,{})}}function aL(e){let t,n,i,r;const l=e[1].default,f=sr(l,e,e[0],null);return{c(){t=wt("a"),f&&f.c(),Rt(t,"href","#")},m(a,_){Ct(a,t,_),f&&f.m(t,null),n=!0,i||(r=Ze(t,"click",e[2]),i=!0)},p(a,[_]){f&&f.p&&(!n||_&1)&&lr(f,l,a,a[0],n?ar(l,a[0],_,null):ur(a[0]),null)},i(a){n||(pt(f,a),n=!0)},o(a){bt(f,a),n=!1},d(a){a&&It(t),f&&f.d(a),i=!1,r()}}}function lL(e,t,n){let{$$slots:i={},$$scope:r}=t;function l(f){ii.call(this,e,f)}return e.$$set=f=>{"$$scope"in f&&n(0,r=f.$$scope)},[r,i,l]}class bi extends nn{constructor(t){super(),en(this,t,lL,aL,He,{})}}function nb(e){let t,n;return{c(){t=wt("div"),n=be(e[0]),Rt(t,"class","svelte-1uuov7f")},m(i,r){Ct(i,t,r),mt(t,n)},p(i,r){r&1&&Zi(n,i[0])},d(i){i&&It(t)}}}function uL(e){let t,n=e[0]&&nb(e);return{c(){n&&n.c(),t=ts()},m(i,r){n&&n.m(i,r),Ct(i,t,r)},p(i,[r]){i[0]?n?n.p(i,r):(n=nb(i),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Ie,o:Ie,d(i){i&&It(t),n&&n.d(i)}}}function cL(e,t,n){let{msg:i=null}=t;return e.$$set=r=>{"msg"in r&&n(0,i=r.msg)},[i]}class hw extends nn{constructor(t){super(),en(this,t,cL,uL,He,{msg:0})}}const hL=e=>({dialog:e&1}),ib=e=>({dialog:e[0]});function fL(e){let t,n,i,r,l;const f=e[4].default,a=sr(f,e,e[3],ib);return{c(){t=wt("dialog"),n=wt("article"),a&&a.c(),t.open=!0},m(_,x){Ct(_,t,x),mt(t,n),a&&a.m(n,null),e[6](t),i=!0,r||(l=[Ze(window,"click",e[1]),Ze(window,"keydown",e[2]),Ze(t,"close",e[5])],r=!0)},p(_,[x]){a&&a.p&&(!i||x&9)&&lr(a,f,_,_[3],i?ar(f,_[3],x,hL):ur(_[3]),ib)},i(_){i||(pt(a,_),i=!0)},o(_){bt(a,_),i=!1},d(_){_&&It(t),a&&a.d(_),e[6](null),r=!1,No(l)}}}function pL(e,t,n){let{$$slots:i={},$$scope:r}=t,l;function f(S){l.open&&S.target==l&&l.close()}function a(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),l.close())}function _(S){ii.call(this,e,S)}function x(S){cr[S?"unshift":"push"](()=>{l=S,n(0,l)})}return e.$$set=S=>{"$$scope"in S&&n(3,r=S.$$scope)},[l,f,a,r,i,_,x]}class Ky extends nn{constructor(t){super(),en(this,t,pL,fL,He,{})}}var To=63710088e-1,Jy={centimeters:To*100,centimetres:To*100,degrees:To/111325,feet:To*3.28084,inches:To*39.37,kilometers:To/1e3,kilometres:To/1e3,meters:To,metres:To,miles:To/1609.344,millimeters:To*1e3,millimetres:To*1e3,nauticalmiles:To/1852,radians:1,yards:To*1.0936},dL={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/To,yards:1.0936133},Iy={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function va(e,t,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function mL(e,t,n){switch(e){case"Point":return ps(t).geometry;case"LineString":return ia(t).geometry;case"Polygon":return Qy(t).geometry;case"MultiPoint":return pw(t).geometry;case"MultiLineString":return fw(t).geometry;case"MultiPolygon":return dw(t).geometry;default:throw new Error(e+" is invalid")}}function ps(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!hg(e[0])||!hg(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return va(i,t,n)}function gL(e,t,n){return n===void 0&&(n={}),Nc(e.map(function(i){return ps(i,t)}),n)}function Qy(e,t,n){n===void 0&&(n={});for(var i=0,r=e;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function t0(e,t){t===void 0&&(t="kilometers");var n=Jy[t];if(!n)throw new Error(t+" units is invalid");return e*n}function Ag(e,t){t===void 0&&(t="kilometers");var n=Jy[t];if(!n)throw new Error(t+" units is invalid");return e/n}function xL(e,t){return ad(Ag(e,t))}function wL(e){var t=e%360;return t<0&&(t+=360),t}function ad(e){var t=e%(2*Math.PI);return t*180/Math.PI}function ra(e){var t=e%360;return t*Math.PI/180}function SL(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return t0(Ag(e,t),n)}function EL(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=Iy[t];if(!i)throw new Error("invalid original units");var r=Iy[n];if(!r)throw new Error("invalid final units");return e/i*r}function hg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function e0(e){return!!e&&e.constructor===Object}function IL(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!hg(t))throw new Error("bbox must only contain numbers")})}function CL(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const TL=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Iy,bearingToAzimuth:wL,convertArea:EL,convertLength:SL,degreesToRadians:ra,earthRadius:To,factors:Jy,feature:va,featureCollection:Nc,geometry:mL,geometryCollection:vL,isNumber:hg,isObject:e0,lengthToDegrees:xL,lengthToRadians:Ag,lineString:ia,lineStrings:yL,multiLineString:fw,multiPoint:pw,multiPolygon:dw,point:ps,points:gL,polygon:Qy,polygons:_L,radiansToDegrees:ad,radiansToLength:t0,round:bL,unitsFactors:dL,validateBBox:IL,validateId:CL},Symbol.toStringTag,{value:"Module"}));function ld(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function rf(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function mw(e,t,n){if(n===void 0&&(n={}),n.final===!0)return LL(e,t);var i=ld(e),r=ld(t),l=ra(i[0]),f=ra(r[0]),a=ra(i[1]),_=ra(r[1]),x=Math.sin(f-l)*Math.cos(_),S=Math.cos(a)*Math.sin(_)-Math.sin(a)*Math.cos(_)*Math.cos(f-l);return ad(Math.atan2(x,S))}function LL(e,t){var n=mw(t,e);return n=(n+180)%360,n}function Ep(e,t,n){n===void 0&&(n={});var i=ld(e),r=ld(t),l=ra(r[1]-i[1]),f=ra(r[0]-i[0]),a=ra(i[1]),_=ra(r[1]),x=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(a)*Math.cos(_);return t0(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),n.units)}function rb(e,t,n,i){i===void 0&&(i={});var r=ld(e),l=ra(r[0]),f=ra(r[1]),a=ra(n),_=Ag(t,i.units),x=Math.asin(Math.sin(f)*Math.cos(_)+Math.cos(f)*Math.sin(_)*Math.cos(a)),S=l+Math.atan2(Math.sin(a)*Math.sin(_)*Math.cos(f),Math.cos(_)-Math.sin(f)*Math.sin(x)),L=ad(S),A=ad(x);return ps([L,A],i.properties)}function bd(e,t,n){if(e!==null)for(var i,r,l,f,a,_,x,S=0,L=0,A,P=e.type,O=P==="FeatureCollection",B=P==="Feature",U=O?e.features.length:1,Y=0;Y_||O>x||B>S){a=L,_=i,x=O,S=B,l=0;return}var U=ia([a,L],n.properties);if(t(U,i,r,B,l)===!1)return!1;l++,a=L})===!1)return!1}}})}function RL(e,t,n){var i=n,r=!1;return _w(e,function(l,f,a,_,x){r===!1&&n===void 0?i=l:i=t(i,l,f,a,_,x),r=!0}),i}function yw(e,t){if(!e)throw new Error("geojson is required");pf(e,function(n,i,r){if(n.geometry!==null){var l=n.geometry.type,f=n.geometry.coordinates;switch(l){case"LineString":if(t(n,i,r,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ar?n:r,x=i>l?i:l;return[f,a,_,x]}var i0={exports:{}},vw={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Qb,function(){function n(V,$,K,nt,ht){(function dt(gt,ut,Et,yt,xt){for(;yt>Et;){if(yt-Et>600){var fe=yt-Et+1,Nt=ut-Et+1,Gt=Math.log(fe),Qt=.5*Math.exp(2*Gt/3),oe=.5*Math.sqrt(Gt*Qt*(fe-Qt)/fe)*(Nt-fe/2<0?-1:1),Ce=Math.max(Et,Math.floor(ut-Nt*Qt/fe+oe)),yn=Math.min(yt,Math.floor(ut+(fe-Nt)*Qt/fe+oe));dt(gt,ut,Ce,yn,xt)}var jn=gt[ut],Qe=Et,Fe=yt;for(i(gt,Et,ut),xt(gt[yt],jn)>0&&i(gt,Et,yt);Qe0;)Fe--}xt(gt[Et],jn)===0?i(gt,Et,Fe):i(gt,++Fe,yt),Fe<=ut&&(Et=Fe+1),ut<=Fe&&(yt=Fe-1)}})(V,$,K||0,nt||V.length-1,ht||r)}function i(V,$,K){var nt=V[$];V[$]=V[K],V[K]=nt}function r(V,$){return V<$?-1:V>$?1:0}var l=function(V){V===void 0&&(V=9),this._maxEntries=Math.max(4,V),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function f(V,$,K){if(!K)return $.indexOf(V);for(var nt=0;nt<$.length;nt++)if(K(V,$[nt]))return nt;return-1}function a(V,$){_(V,0,V.children.length,$,V)}function _(V,$,K,nt,ht){ht||(ht=U(null)),ht.minX=1/0,ht.minY=1/0,ht.maxX=-1/0,ht.maxY=-1/0;for(var dt=$;dt=V.minX&&$.maxY>=V.minY}function U(V){return{children:V,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Y(V,$,K,nt,ht){for(var dt=[$,K];dt.length;)if(!((K=dt.pop())-($=dt.pop())<=nt)){var gt=$+Math.ceil((K-$)/nt/2)*nt;n(V,gt,$,K,ht),dt.push($,gt,gt,K)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(V){var $=this.data,K=[];if(!B(V,$))return K;for(var nt=this.toBBox,ht=[];$;){for(var dt=0;dt<$.children.length;dt++){var gt=$.children[dt],ut=$.leaf?nt(gt):gt;B(V,ut)&&($.leaf?K.push(gt):O(V,ut)?this._all(gt,K):ht.push(gt))}$=ht.pop()}return K},l.prototype.collides=function(V){var $=this.data;if(!B(V,$))return!1;for(var K=[];$;){for(var nt=0;nt<$.children.length;nt++){var ht=$.children[nt],dt=$.leaf?this.toBBox(ht):ht;if(B(V,dt)){if($.leaf||O(V,dt))return!0;K.push(ht)}}$=K.pop()}return!1},l.prototype.load=function(V){if(!V||!V.length)return this;if(V.length=0&&ht[$].children.length>this._maxEntries;)this._split(ht,$),$--;this._adjustParentBBoxes(nt,ht,$)},l.prototype._split=function(V,$){var K=V[$],nt=K.children.length,ht=this._minEntries;this._chooseSplitAxis(K,ht,nt);var dt=this._chooseSplitIndex(K,ht,nt),gt=U(K.children.splice(dt,K.children.length-dt));gt.height=K.height,gt.leaf=K.leaf,a(K,this.toBBox),a(gt,this.toBBox),$?V[$-1].children.push(gt):this._splitRoot(K,gt)},l.prototype._splitRoot=function(V,$){this.data=U([V,$]),this.data.height=V.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(V,$,K){for(var nt,ht,dt,gt,ut,Et,yt,xt=1/0,fe=1/0,Nt=$;Nt<=K-$;Nt++){var Gt=_(V,0,Nt,this.toBBox),Qt=_(V,Nt,K,this.toBBox),oe=(ht=Gt,dt=Qt,gt=void 0,ut=void 0,Et=void 0,yt=void 0,gt=Math.max(ht.minX,dt.minX),ut=Math.max(ht.minY,dt.minY),Et=Math.min(ht.maxX,dt.maxX),yt=Math.min(ht.maxY,dt.maxY),Math.max(0,Et-gt)*Math.max(0,yt-ut)),Ce=A(Gt)+A(Qt);oe=$;xt--){var fe=V.children[xt];x(gt,V.leaf?ht(fe):fe),ut+=P(gt)}return ut},l.prototype._adjustParentBBoxes=function(V,$,K){for(var nt=K;nt>=0;nt--)x($[nt],V)},l.prototype._condense=function(V){for(var $=V.length-1,K=void 0;$>=0;$--)V[$].children.length===0?$>0?(K=V[$-1].children).splice(K.indexOf(V[$]),1):this.clear():a(V[$],this.toBBox)},l})})(vw);var jL=vw.exports;const qL=ex(TL),bw=ex(BL);var r0={};Object.defineProperty(r0,"__esModule",{value:!0});var ZL=bw;function Cy(e){var t=[1/0,1/0,-1/0,-1/0];return ZL.coordEach(e,function(n){t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2] line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var r=n[0][0],l=n[0][1],f=n[1][0],a=n[1][1],_=i[0][0],x=i[0][1],S=i[1][0],L=i[1][1],A=(L-x)*(f-r)-(S-_)*(a-l),P=(S-_)*(l-x)-(L-x)*(r-_),O=(f-r)*(l-x)-(a-l)*(r-_);if(A===0)return null;var B=P/A,U=O/A;if(B>=0&&B<=1&&U>=0&&U<=1){var Y=r+B*(f-r),V=l+B*(a-l);return ps([Y,V])}return null}function YL(e,t,n){n===void 0&&(n={});var i=ps([1/0,1/0],{dist:1/0}),r=0;return pf(e,function(l){for(var f=rf(l),a=0;a0&&(U=B.features[0],U.properties.dist=Ep(t,U,n),U.properties.location=r+Ep(_,U,n)),_.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let r of this.points)r[0]-=n,r[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});Zn(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(lb(this.points).forEach((i,r)=>{n.push([r+1,YL(i,this.cursor).properties.dist])}),n.sort((i,r)=>i[1]-r[1]),n.length>0){let i=n[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(t))});Zn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=J_(t.lngLat.toArray()),this.onClick(t),this.finish())});Zn(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Zn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Zn(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});Zn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((r,l)=>{let f=J_(r);f.properties.hover=this.hover==l,f.properties.idx=l,t.features.push(f)}),t.features=t.features.concat(lb(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),Ew.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,Iw.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=J_(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(Mw),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>KL&&this.previousStates.shift()}}function lb(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function QL(e){let t,n,i;return{c(){t=be("Undo ("),n=be(e[1]),i=be(")")},m(r,l){Ct(r,t,l),Ct(r,n,l),Ct(r,i,l)},p(r,l){l&2&&Zi(n,r[1])},d(r){r&&(It(t),It(n),It(i))}}}function tM(e){let t;return{c(){t=be("Undo")},m(n,i){Ct(n,t,i)},p:Ie,d(n){n&&It(t)}}}function eM(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?tM:QL}let _=a(e),x=_(e);return{c(){t=wt("button"),x.c(),i=Xt(),r=wt("ul"),r.innerHTML=`
  • Click the map to add a vertex
  • Click a vertex to delete it
  • Drag a vertex or the polygon to move it
  • Press Control+Z @@ -612,21 +612,21 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,t.disabled=n=e[1]==0},m(S,L){At(S,t,L),x.m(t,null),At(S,i,L),At(S,r,L),l||(f=be(t,"click",e[2]),l=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:we,o:we,d(S){S&&(kt(t),kt(i),kt(r)),x.d(),l=!1,f()}}}function nM(e,t,n){let i;Ee(e,Ew,f=>n(1,i=f));let{polygonTool:r}=t;const l=()=>r.undo();return e.$$set=f=>{"polygonTool"in f&&n(0,r=f.polygonTool)},[r,i,l]}class iM extends nn{constructor(t){super(),en(this,t,nM,eM,Ye,{polygonTool:0})}}function rM(e){let t,n,i,r,l,f,a;return{c(){t=dt("button"),t.textContent="Import current view",n=Zt(),i=dt("i"),i.textContent="or...",r=Zt(),l=dt("button"),l.textContent="Draw an area to import on the map",It(t,"type","button"),It(l,"type","button")},m(_,x){At(_,t,x),At(_,n,x),At(_,i,x),At(_,r,x),At(_,l,x),f||(a=[be(t,"click",e[1]),be(l,"click",e[2])],f=!0)},p:we,i:we,o:we,d(_){_&&(kt(t),kt(n),kt(i),kt(r),kt(l)),f=!1,Wi(a)}}}function oM(e){let t,n;return t=new iM({props:{polygonTool:e[0]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&1&&(l.polygonTool=i[0]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function sM(e){let t,n,i,r;const l=[oM,rM],f=[];function a(_,x){return _[0]?0:1}return t=a(e),n=f[t]=l[t](e),{c(){n.c(),i=$o()},m(_,x){f[t].m(_,x),At(_,i,x),r=!0},p(_,[x]){let S=t;t=a(_),t===S?f[t].p(_,x):(Ti(),Pt(f[S],1,1,()=>{f[S]=null}),Li(),n=f[t],n?n.p(_,x):(n=f[t]=l[t](_),n.c()),wt(n,1),n.m(i.parentNode,i))},i(_){r||(wt(n),r=!0)},o(_){Pt(n),r=!1},d(_){_&&kt(i),f[t].d(_)}}}function Ep(e){return[e.lng,e.lat]}function aM(e,t,n){let{map:i}=t;const r=Nc();let l=null;async function f(S){try{r("loading","Loading from Overpass");let A=await(await fetch(Mw(S))).text();r("gotXml",A)}catch(L){r("error",L.toString())}}function a(){let S=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Ep(S.getSouthWest()),Ep(S.getNorthWest()),Ep(S.getNorthEast()),Ep(S.getSouthEast()),Ep(S.getSouthWest())]],type:"Polygon"}}}async function _(){if(i){if(i.getZoom()<13){r("error","Zoom in more to import");return}await f(a())}}function x(){i&&(n(0,l=new QL(i)),l.startNew(),l.addEventListenerSuccess(async S=>{n(0,l=null),await f(S)}),l.addEventListenerFailure(()=>{n(0,l=null)}))}return e.$$set=S=>{"map"in S&&n(3,i=S.map)},[l,_,x,i]}class lM extends nn{constructor(t){super(),en(this,t,aM,sM,Ye,{map:3})}}const uM=e=>({props:e&8}),lb=e=>({props:fM(e[3])});function cM(e){let t;const n=e[1].default,i=sr(n,e,e[2],lb);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&12)&&lr(i,n,r,r[2],t?ar(n,r[2],l,uM):ur(r[2]),lb)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function hM(e){let t,n;return t=new QE({props:{openOn:e[0],$$slots:{default:[cM,({features:i})=>({3:i}),({features:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&1&&(l.openOn=i[0]),r&12&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function fM(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function pM(e,t,n){let{$$slots:i={},$$scope:r}=t,{openOn:l="hover"}=t;return e.$$set=f=>{"openOn"in f&&n(0,l=f.openOn),"$$scope"in f&&n(2,r=f.$$scope)},[l,i,r]}class xl extends nn{constructor(t){super(),en(this,t,pM,hM,Ye,{openOn:0})}}function ub(e,t,n){const i=e.slice();return i[1]=t[n][0],i[2]=t[n][1],i}function cb(e){let t,n,i=e[1]+"",r,l,f,a=e[2]+"",_,x;return{c(){t=dt("tr"),n=dt("td"),r=Xe(i),l=Zt(),f=dt("td"),_=Xe(a),x=Zt()},m(S,L){At(S,t,L),lt(t,n),lt(n,r),lt(t,l),lt(t,f),lt(f,_),lt(t,x)},p(S,L){L&1&&i!==(i=S[1]+"")&&qi(r,i),L&1&&a!==(a=S[2]+"")&&qi(_,a)},d(S){S&&kt(t)}}}function dM(e){let t,n,i=aa(Object.entries(e[0])),r=[];for(let l=0;l{"properties"in r&&n(0,i=r.properties)},[i]}class pf extends nn{constructor(t){super(),en(this,t,mM,dM,Ye,{properties:0})}}function Vr(e){return{id:e,beforeId:gM(e)}}function gM(e){let t=Bb(Nu);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let n,i=!1;for(let r=hb.length-1;r>=0;r--){let l=hb[r];if(l==e){i=!0;break}t.getLayer(l)&&(n=l)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return n}const hb=["Background","neighbourhood-boundaries","Residential","debug-borders","debug-crosses","debug-filters","cells","interior-roads","compare-route","shortcuts","shortcuts-focus","Building","route-points","route-lines","route-polygons","Road labels","modal-filters","boundary","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"],Iw=["==",["geometry-type"],"Polygon"],Cw=["==",["geometry-type"],"LineString"],Tw=["==",["geometry-type"],"Point"];function Dp(e,t,n){let i=["match",e];for(let[r,l]of Object.entries(t))i.push(r),i.push(l);return i.push(n),i}function _M(e,t){let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(t)),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function yi(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}function J_(e){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Lw(e)}}}function Lw(e){return[Math.round(e[0]*1e7)/1e7,Math.round(e[1]*1e7)/1e7]}function Mw(e){let t='poly:"';for(let[i,r]of e.geometry.coordinates[0])t+=`${r} ${i} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function yM(e){let t;return{c(){t=Xe("Back")},m(n,i){At(n,t,i)},d(n){n&&kt(t)}}}function vM(e){let t,n,i,r;return t=new lL({props:{$$slots:{default:[yM]},$$scope:{ctx:e}}}),t.$on("click",e[2]),{c(){Qt(t.$$.fragment)},m(l,f){Kt(t,l,f),n=!0,i||(r=be(window,"keydown",e[1]),i=!0)},p(l,[f]){const a={};f&8&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(wt(t.$$.fragment,l),n=!0)},o(l){Pt(t.$$.fragment,l),n=!1},d(l){Jt(t,l),i=!1,r()}}}function bM(e){let t=Nc();function n(r){r.key=="Escape"&&(r.stopPropagation(),t("click"))}return[t,n,()=>t("click")]}class Ag extends nn{constructor(t){super(),en(this,t,bM,vM,Ye,{})}}function Cy(e){let t=["#8dd3c7","#ffffb3","#bebada","#80b1d3","#fdb462","#b3de69","#fccde5","#bc80bd","#ccebc5","#ffed6f"];for(let n of e.features)n.properties??(n.properties={}),n.properties.cell_color=="disconnected"?n.properties.color="red":Object.hasOwn(n.properties,"cell_color")&&(n.properties.color=t[n.properties.cell_color%t.length]);return e}const xM=e=>({}),fb=e=>({}),wM=e=>({}),pb=e=>({});function db(e){let t;const n=e[5]["line-popup"],i=sr(n,e,e[7],pb);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&128)&&lr(i,n,r,r[7],t?ar(n,r[7],l,wM):ur(r[7]),pb)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function SM(e){let t,n,i=e[0]&&db(e);return{c(){i&&i.c(),t=$o()},m(r,l){i&&i.m(r,l),At(r,t,l),n=!0},p(r,l){r[0]?i?(i.p(r,l),l&1&&wt(i,1)):(i=db(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function EM(e){let t,n,i,r,l;const f=[Vr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let a={};for(let A=0;A{}}=t;const S=L=>_&&x(L.detail.features[0]);return e.$$set=L=>{"gjInput"in L&&n(4,a=L.gjInput),"interactive"in L&&n(0,_=L.interactive),"onClickLine"in L&&n(1,x=L.onClickLine),"$$scope"in L&&n(7,f=L.$$scope)},e.$$.update=()=>{e.$$.dirty&16&&n(3,i=Cy(a)),e.$$.dirty&16&&n(2,r=Math.max(...a.features.map(L=>L.properties.shortcuts??0)))},[_,x,r,i,a,l,S,f]}class Ng extends nn{constructor(t){super(),en(this,t,CM,IM,Ye,{gjInput:4,interactive:0,onClickLine:1})}}const TM=e=>({}),mb=e=>({}),LM=e=>({}),gb=e=>({}),MM=e=>({}),_b=e=>({});function PM(e){let t,n,i,r,l,f;const a=e[4].top,_=sr(a,e,e[3],_b),x=e[4].sidebar,S=sr(x,e,e[3],gb),L=e[4].map,A=sr(L,e,e[3],mb);return{c(){t=dt("div"),_&&_.c(),n=Zt(),i=dt("div"),S&&S.c(),r=Zt(),l=dt("div"),A&&A.c()},m(k,R){At(k,t,R),_&&_.m(t,null),e[5](t),At(k,n,R),At(k,i,R),S&&S.m(i,null),e[6](i),At(k,r,R),At(k,l,R),A&&A.m(l,null),e[7](l),f=!0},p(k,[R]){_&&_.p&&(!f||R&8)&&lr(_,a,k,k[3],f?ar(a,k[3],R,MM):ur(k[3]),_b),S&&S.p&&(!f||R&8)&&lr(S,x,k,k[3],f?ar(x,k[3],R,LM):ur(k[3]),gb),A&&A.p&&(!f||R&8)&&lr(A,L,k,k[3],f?ar(L,k[3],R,TM):ur(k[3]),mb)},i(k){f||(wt(_,k),wt(S,k),wt(A,k),f=!0)},o(k){Pt(_,k),Pt(S,k),Pt(A,k),f=!1},d(k){k&&(kt(t),kt(n),kt(i),kt(r),kt(l)),_&&_.d(k),e[5](null),S&&S.d(k),e[6](null),A&&A.d(k),e[7](null)}}}function kM(e,t,n){let i,r,l;Ee(e,ry,L=>n(0,i=L)),Ee(e,oy,L=>n(1,r=L)),Ee(e,sy,L=>n(2,l=L));let{$$slots:f={},$$scope:a}=t;function _(L){cr[L?"unshift":"push"](()=>{i=L,ry.set(i)})}function x(L){cr[L?"unshift":"push"](()=>{r=L,oy.set(r)})}function S(L){cr[L?"unshift":"push"](()=>{l=L,sy.set(l)})}return e.$$set=L=>{"$$scope"in L&&n(3,a=L.$$scope)},[i,r,l,a,f,_,x,S]}class Wu extends nn{constructor(t){super(),en(this,t,kM,PM,Ye,{})}}function AM(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R,U;return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),_=dt("a"),_.textContent="Pick neighbourhood",x=Zt(),S=dt("li"),L=dt("a"),L.textContent="Editing modal filters",A=Zt(),k=dt("li"),k.textContent="Debug mode",It(l,"href","#"),It(_,"href","#"),It(L,"href","#"),It(n,"aria-label","breadcrumb"),It(t,"slot","top")},m(j,Q){At(j,t,Q),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),lt(a,_),lt(i,x),lt(i,S),lt(S,L),lt(i,A),lt(i,k),R||(U=[be(l,"click",e[4]),be(_,"click",e[5]),be(L,"click",e[6])],R=!0)},p:we,d(j){j&&kt(t),R=!1,Wi(U)}}}function NM(e){let t,n,i;return n=new Ag({}),n.$on("click",e[3]),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","sidebar")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p:we,i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function DM(e){let t,n;return t=new pf({props:{properties:e[7]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&128&&(l.properties=i[7]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function RM(e){let t,n,i;return n=new xl({props:{openOn:"hover",$$slots:{default:[DM,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:e}}}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","line-popup")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p(r,l){const f={};l&384&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function OM(e){let t,n;return t=new pf({props:{properties:e[7]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&128&&(l.properties=i[7]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function zM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[OM,({props:i})=>({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&384&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function FM(e){let t,n;return t=new pf({props:{properties:e[7]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&128&&(l.properties=i[7]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function BM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[FM,({props:i})=>({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&384&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function VM(e){let t,n,i,r;const l=[Vr("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let f={$$slots:{default:[zM]},$$scope:{ctx:e}};for(let x=0;x({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&384&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function jM(e){let t,n;const i=[Vr("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let r={$$slots:{default:[GM]},$$scope:{ctx:e}};for(let l=0;ln(0,i=S)),Ee(e,xn,S=>n(1,r=S)),[i,r,S=>window.open(yi(S.properties).way,"_blank"),()=>je(xn,r={mode:"neighbourhood"},r),()=>je(xn,r={mode:"title"},r),()=>je(xn,r={mode:"network"},r),()=>je(xn,r={mode:"neighbourhood"},r)]}class XM extends nn{constructor(t){super(),en(this,t,WM,ZM,Ye,{})}}function HM(e){let t,n,i,r,l,f,a,_,x;return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),a.textContent="Debug route snapper",It(l,"href","#"),It(n,"aria-label","breadcrumb"),It(t,"slot","top")},m(S,L){At(S,t,L),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),_||(x=be(l,"click",e[3]),_=!0)},p:we,d(S){S&&kt(t),_=!1,x()}}}function YM(e){let t,n,i;return n=new Ag({}),n.$on("click",e[2]),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","sidebar")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p:we,i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function KM(e){let t,n;return t=new pf({props:{properties:e[4]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&16&&(l.properties=i[4]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function JM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[KM,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&48&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function QM(e){let t,n;return t=new pf({props:{properties:e[4]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&16&&(l.properties=i[4]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function $M(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[QM,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&48&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function tP(e){let t,n,i,r;return t=new iu({props:{manageHoverState:!0,paint:{"line-width":8,"line-color":"black","line-opacity":iy(.5,1)},$$slots:{default:[JM]},$$scope:{ctx:e}}}),i=new cd({props:{manageHoverState:!0,paint:{"circle-radius":10,"circle-color":"black","circle-opacity":iy(.5,1)},$$slots:{default:[$M]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment),n=Zt(),Qt(i.$$.fragment)},m(l,f){Kt(t,l,f),At(l,n,f),Kt(i,l,f),r=!0},p(l,f){const a={};f&32&&(a.$$scope={dirty:f,ctx:l}),t.$set(a);const _={};f&32&&(_.$$scope={dirty:f,ctx:l}),i.$set(_)},i(l){r||(wt(t.$$.fragment,l),wt(i.$$.fragment,l),r=!0)},o(l){Pt(t.$$.fragment,l),Pt(i.$$.fragment,l),r=!1},d(l){l&&kt(n),Jt(t,l),Jt(i,l)}}}function eP(e){let t,n,i;return n=new Ms({props:{data:JSON.parse(yi(e[0]).toRouteSnapperGj()),generateId:!0,$$slots:{default:[tP]},$$scope:{ctx:e}}}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","map")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p(r,l){const f={};l&1&&(f.data=JSON.parse(yi(r[0]).toRouteSnapperGj())),l&32&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function nP(e){let t,n;return t=new Wu({props:{$$slots:{map:[eP],sidebar:[YM],top:[HM]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&35&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function iP(e,t,n){let i,r;return Ee(e,Wo,a=>n(0,i=a)),Ee(e,xn,a=>n(1,r=a)),[i,r,()=>je(xn,r={mode:"network"},r),()=>je(xn,r={mode:"title"},r)]}class rP extends nn{constructor(t){super(),en(this,t,iP,nP,Ye,{})}}function oP(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R,U,j,Q,B;return U=new cw({props:{msg:e[0]}}),{c(){t=dt("details"),n=dt("summary"),n.textContent="Save / load project",i=Zt(),r=dt("button"),r.textContent="Save to GJ",l=Zt(),f=dt("label"),a=Xe(`Load edits from GJ - `),_=dt("input"),x=Zt(),S=dt("div"),L=dt("button"),L.textContent="Save to local storage",A=Zt(),k=dt("button"),k.textContent="Load from local storage",R=Zt(),Qt(U.$$.fragment),It(_,"type","file"),pi(S,"display","flex"),pi(S,"justify-content","space-between")},m(X,J){At(X,t,J),lt(t,n),lt(t,i),lt(t,r),lt(t,l),lt(t,f),lt(f,a),lt(f,_),e[7](_),lt(t,x),lt(t,S),lt(S,L),lt(S,A),lt(S,k),At(X,R,J),Kt(U,X,J),j=!0,Q||(B=[be(r,"click",e[2]),be(_,"change",e[3]),be(L,"click",e[5]),be(k,"click",e[4])],Q=!0)},p(X,[J]){const it={};J&1&&(it.msg=X[0]),U.$set(it)},i(X){j||(wt(U.$$.fragment,X),j=!0)},o(X){Pt(U.$$.fragment,X),j=!1},d(X){X&&(kt(t),kt(R)),e[7](null),Jt(U,X),Q=!1,Wi(B)}}}function sP(e,t,n){let i,r,l,f;Ee(e,Wo,U=>n(9,r=U)),Ee(e,xn,U=>n(10,l=U)),Ee(e,Mu,U=>n(6,f=U));let a=null;function _(){_M(i,r.toSavefile())}let x;async function S(U){n(0,a="Loading project from file");try{k(await x.files[0].text())}catch(j){window.alert(`Couldn't open this file: ${j}`)}n(0,a=null)}function L(){n(0,a="Loading projects from local storage");try{let U=window.localStorage.getItem(i);U?k(U):window.alert("Nothing was saved in local storage")}catch(U){window.alert(`Couldn't load from local storage: ${U}`)}n(0,a=null)}function A(){window.localStorage.setItem(i,r.toSavefile())}function k(U){r.loadSavefile(JSON.parse(U)),je(xn,l={mode:"network"},l),Wo.set(r)}function R(U){cr[U?"unshift":"push"](()=>{x=U,n(1,x)})}return e.$$.update=()=>{e.$$.dirty&64&&(i=`ltn_${f||"custom"}.geojson`)},[a,x,_,S,L,A,f,R]}class Pw extends nn{constructor(t){super(),en(this,t,sP,oP,Ye,{})}}function yb(e,t,n){const i=e.slice();return i[7]=t[n][0],i[8]=t[n][1],i[9]=t[n][2],i}function vb(e){let t,n,i,r,l,f,a=e[8]+"",_,x,S,L,A;function k(){return e[3](e[7])}return{c(){t=dt("button"),n=dt("img"),r=Zt(),l=dt("br"),f=Zt(),_=Xe(a),x=Zt(),hr(n.src,i=`/ltn//filters/${e[7]}_icon.gif`)||It(n,"src",i),It(n,"width","80"),It(n,"alt",e[8]),It(t,"class","outline"),pi(t,"width","100%"),t.disabled=S=e[0]==e[7]},m(R,U){At(R,t,U),lt(t,n),lt(t,r),lt(t,l),lt(t,f),lt(t,_),lt(t,x),L||(A=be(t,"click",k),L=!0)},p(R,U){e=R,U&1&&S!==(S=e[0]==e[7])&&(t.disabled=S)},d(R){R&&kt(t),L=!1,A()}}}function aP(e){let t,n,i,r,l,f,a,_,x,S,L,A,k=e[1][2]+"",R,U,j,Q,B,X,J=aa(e[2]),it=[];for(let mt=0;mt({6:i}),({dialog:i})=>i?64:0]},$$scope:{ctx:e}}}),t.$on("close",e[5]),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&4163&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function uP(e,t,n){let i,r;Ee(e,ay,x=>n(0,r=x));let l=[["walk_cycle_only","Walking/cycling only","A physical barrier that only allows people walking, cycling, and rolling to pass. Often planters or bollards. Larger vehicles cannot enter."],["no_entry","No entry","An alternative sign to indicate vehicles are not allowed to enter the street. Only people walking, cycling, and rolling may pass through."],["bus_gate","Bus gate","A bus gate sign and traffic cameras are installed to allow buses, pedestrians, and cyclists to pass. There is no physical barrier."],["school_street","School street","A closure during school hours only. The barrier usually allows teachers and staff to access the school."]];const f=x=>je(ay,r=x,r),a=x=>yi(x).close();function _(x){ii.call(this,e,x)}return e.$$.update=()=>{e.$$.dirty&1&&n(1,i=l.find(x=>x[0]==r))},[r,i,l,f,a,_]}class cP extends nn{constructor(t){super(),en(this,t,uP,lP,Ye,{})}}function bb(e){let t,n;return t=new Ms({props:{data:e[0],$$slots:{default:[hP]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&1&&(l.data=i[0]),r&64&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function hP(e){let t,n;const i=[Vr("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let r={};for(let l=0;l{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function pP(e,t,n){let{map:i}=t,r=null;const l=Nc();i.on("dragstart",f),i.on("mousemove",a),i.on("mouseup",_),sa(()=>{i.dragPan.enable(),i.off("dragstart",f),i.off("mousemove",a),i.off("mouseup",_)});function f(){i.dragPan.disable(),n(0,r={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function a(x){r&&(r.geometry.coordinates.push(x.lngLat.toArray()),n(0,r))}function _(){r&&(l("done",r),n(0,r=null))}return e.$$set=x=>{"map"in x&&n(1,i=x.map)},[r,i]}class dP extends nn{constructor(t){super(),en(this,t,pP,fP,Ye,{map:1})}}function mP(e){let t;const n=e[3].default,i=sr(n,e,e[5],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&32)&&lr(i,n,r,r[5],t?ar(n,r[5],l,null):ur(r[5]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function gP(e){let t,n;const i=[Vr("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}}];let r={$$slots:{default:[mP]},$$scope:{ctx:e}};for(let l=0;ln(1,r=x)),Ee(e,mc,x=>n(2,l=x));let{$$slots:f={},$$scope:a}=t;function _(x){ii.call(this,e,x)}return e.$$set=x=>{"$$scope"in x&&n(5,a=x.$$scope)},e.$$.update=()=>{e.$$.dirty&6&&n(0,i=l>0?JSON.parse(r.renderModalFilters()):null)},[i,r,l,f,_,a]}class Dg extends nn{constructor(t){super(),en(this,t,yP,_P,Ye,{})}}function vP(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R,U,j,Q,B,X,J,it,ft,mt,_t,ct,Mt;return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),_=dt("a"),_.textContent="Pick neighbourhood",x=Zt(),S=dt("li"),S.textContent="Editing modal filters",L=Zt(),A=dt("nav"),k=dt("ul"),R=dt("li"),U=dt("a"),U.textContent="View shortcuts",j=Zt(),Q=dt("li"),B=dt("a"),B.textContent="Route",X=Zt(),J=dt("li"),it=dt("a"),it.textContent="Change this boundary",ft=Zt(),mt=dt("li"),_t=dt("a"),_t.textContent="Debug",It(l,"href","#"),It(_,"href","#"),It(n,"aria-label","breadcrumb"),It(U,"href","#"),It(B,"href","#"),It(it,"href","#"),It(_t,"href","#"),It(t,"slot","top"),pi(t,"display","flex"),pi(t,"justify-content","space-between")},m(xt,vt){At(xt,t,vt),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),lt(a,_),lt(i,x),lt(i,S),lt(t,L),lt(t,A),lt(A,k),lt(k,R),lt(R,U),lt(k,j),lt(k,Q),lt(Q,B),lt(k,X),lt(k,J),lt(J,it),lt(k,ft),lt(k,mt),lt(mt,_t),ct||(Mt=[be(l,"click",e[20]),be(_,"click",e[21]),be(U,"click",e[22]),be(B,"click",e[23]),be(it,"click",e[24]),be(_t,"click",e[25])],ct=!0)},p:we,d(xt){xt&&kt(t),ct=!1,Wi(Mt)}}}function bP(e){let t,n,i;return{c(){t=Xe("Undo ("),n=Xe(e[4]),i=Xe(")")},m(r,l){At(r,t,l),At(r,n,l),At(r,i,l)},p(r,l){l[0]&16&&qi(n,r[4])},d(r){r&&(kt(t),kt(n),kt(i))}}}function xP(e){let t;return{c(){t=Xe("Undo")},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function wP(e){let t,n,i;return{c(){t=Xe("Redo ("),n=Xe(e[5]),i=Xe(")")},m(r,l){At(r,t,l),At(r,n,l),At(r,i,l)},p(r,l){l[0]&32&&qi(n,r[5])},d(r){r&&(kt(t),kt(n),kt(i))}}}function SP(e){let t;return{c(){t=Xe("Redo")},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function xb(e){let t,n;return t=new cP({}),t.$on("close",e[19]),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p:we,i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function EP(e){let t,n,i,r,l=yi(yi(e[6]).properties).name+"",f,a,_,x,S,L,A,k,R,U,j,Q,B,X,J,it,ft,mt,_t,ct,Mt,xt,vt,me,Rt,Gt,te,se,Ce,yn,jn,$e,Fe,ke,fn,Jn;function qn(gt,Ie){return gt[4]==0?xP:bP}let ie=qn(e),De=ie(e);function hn(gt,Ie){return gt[5]==0?SP:wP}let On=hn(e),mi=On(e),wn=e[3]&&xb(e);return Fe=new Pw({}),{c(){t=dt("div"),n=dt("p"),i=Xe("Editing neighbourhood "),r=dt("u"),f=Xe(l),a=Zt(),_=dt("p"),_.textContent=`Now that you've defined a neighbourhood boundary, you can see the possible + to cancel`,t.disabled=n=e[1]==0},m(S,L){Ct(S,t,L),x.m(t,null),Ct(S,i,L),Ct(S,r,L),l||(f=Ze(t,"click",e[2]),l=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:Ie,o:Ie,d(S){S&&(It(t),It(i),It(r)),x.d(),l=!1,f()}}}function nM(e,t,n){let i;Se(e,Iw,f=>n(1,i=f));let{polygonTool:r}=t;const l=()=>r.undo();return e.$$set=f=>{"polygonTool"in f&&n(0,r=f.polygonTool)},[r,i,l]}class iM extends nn{constructor(t){super(),en(this,t,nM,eM,He,{polygonTool:0})}}function rM(e){let t,n,i,r,l,f,a;return{c(){t=wt("button"),t.textContent="Import current view",n=Xt(),i=wt("i"),i.textContent="or...",r=Xt(),l=wt("button"),l.textContent="Draw an area to import on the map",Rt(t,"type","button"),Rt(l,"type","button")},m(_,x){Ct(_,t,x),Ct(_,n,x),Ct(_,i,x),Ct(_,r,x),Ct(_,l,x),f||(a=[Ze(t,"click",e[1]),Ze(l,"click",e[2])],f=!0)},p:Ie,i:Ie,o:Ie,d(_){_&&(It(t),It(n),It(i),It(r),It(l)),f=!1,No(a)}}}function oM(e){let t,n;return t=new iM({props:{polygonTool:e[0]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&1&&(l.polygonTool=i[0]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function sM(e){let t,n,i,r;const l=[oM,rM],f=[];function a(_,x){return _[0]?0:1}return t=a(e),n=f[t]=l[t](e),{c(){n.c(),i=ts()},m(_,x){f[t].m(_,x),Ct(_,i,x),r=!0},p(_,[x]){let S=t;t=a(_),t===S?f[t].p(_,x):(ui(),bt(f[S],1,1,()=>{f[S]=null}),ci(),n=f[t],n?n.p(_,x):(n=f[t]=l[t](_),n.c()),pt(n,1),n.m(i.parentNode,i))},i(_){r||(pt(n),r=!0)},o(_){bt(n),r=!1},d(_){_&&It(i),f[t].d(_)}}}function Ip(e){return[e.lng,e.lat]}function aM(e,t,n){let{map:i}=t;const r=Dc();let l=null;async function f(S){try{r("loading","Loading from Overpass");let A=await(await fetch(Pw(S))).text();r("gotXml",A)}catch(L){r("error",L.toString())}}function a(){let S=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Ip(S.getSouthWest()),Ip(S.getNorthWest()),Ip(S.getNorthEast()),Ip(S.getSouthEast()),Ip(S.getSouthWest())]],type:"Polygon"}}}async function _(){if(i){if(i.getZoom()<13){r("error","Zoom in more to import");return}await f(a())}}function x(){i&&(n(0,l=new JL(i)),l.startNew(),l.addEventListenerSuccess(async S=>{n(0,l=null),await f(S)}),l.addEventListenerFailure(()=>{n(0,l=null)}))}return e.$$set=S=>{"map"in S&&n(3,i=S.map)},[l,_,x,i]}class lM extends nn{constructor(t){super(),en(this,t,aM,sM,He,{map:3})}}const uM=e=>({props:e&8}),ub=e=>({props:fM(e[3])});function cM(e){let t;const n=e[1].default,i=sr(n,e,e[2],ub);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&12)&&lr(i,n,r,r[2],t?ar(n,r[2],l,uM):ur(r[2]),ub)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function hM(e){let t,n;return t=new QE({props:{openOn:e[0],$$slots:{default:[cM,({features:i})=>({3:i}),({features:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&1&&(l.openOn=i[0]),r&12&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function fM(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function pM(e,t,n){let{$$slots:i={},$$scope:r}=t,{openOn:l="hover"}=t;return e.$$set=f=>{"openOn"in f&&n(0,l=f.openOn),"$$scope"in f&&n(2,r=f.$$scope)},[l,i,r]}class wl extends nn{constructor(t){super(),en(this,t,pM,hM,He,{openOn:0})}}function cb(e,t,n){const i=e.slice();return i[1]=t[n][0],i[2]=t[n][1],i}function hb(e){let t,n,i=e[1]+"",r,l,f,a=e[2]+"",_,x;return{c(){t=wt("tr"),n=wt("td"),r=be(i),l=Xt(),f=wt("td"),_=be(a),x=Xt()},m(S,L){Ct(S,t,L),mt(t,n),mt(n,r),mt(t,l),mt(t,f),mt(f,_),mt(t,x)},p(S,L){L&1&&i!==(i=S[1]+"")&&Zi(r,i),L&1&&a!==(a=S[2]+"")&&Zi(_,a)},d(S){S&&It(t)}}}function dM(e){let t,n,i=la(Object.entries(e[0])),r=[];for(let l=0;l{"properties"in r&&n(0,i=r.properties)},[i]}class df extends nn{constructor(t){super(),en(this,t,mM,dM,He,{properties:0})}}function Vr(e){return{id:e,beforeId:gM(e)}}function gM(e){let t=Vb(Du);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let n,i=!1;for(let r=fb.length-1;r>=0;r--){let l=fb[r];if(l==e){i=!0;break}t.getLayer(l)&&(n=l)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return n}const fb=["Background","neighbourhood-boundaries","Residential","debug-borders","debug-crosses","debug-filters","cells","interior-roads","compare-route","shortcuts","shortcuts-focus","Building","route-points","route-lines","route-polygons","Road labels","modal-filters","boundary","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"],Cw=["==",["geometry-type"],"Polygon"],Tw=["==",["geometry-type"],"LineString"],Lw=["==",["geometry-type"],"Point"];function Rp(e,t,n){let i=["match",e];for(let[r,l]of Object.entries(t))i.push(r),i.push(l);return i.push(n),i}function _M(e,t){let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(t)),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function xi(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}function J_(e){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Mw(e)}}}function Mw(e){return[Math.round(e[0]*1e7)/1e7,Math.round(e[1]*1e7)/1e7]}function Pw(e){let t='poly:"';for(let[i,r]of e.geometry.coordinates[0])t+=`${r} ${i} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function yM(e){let t;return{c(){t=be("Back")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function vM(e){let t,n,i,r;return t=new bi({props:{$$slots:{default:[yM]},$$scope:{ctx:e}}}),t.$on("click",e[2]),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ze(window,"keydown",e[1]),i=!0)},p(l,[f]){const a={};f&8&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(pt(t.$$.fragment,l),n=!0)},o(l){bt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function bM(e){let t=Dc();function n(r){r.key=="Escape"&&(r.stopPropagation(),t("click"))}return[t,n,()=>t("click")]}class Ng extends nn{constructor(t){super(),en(this,t,bM,vM,He,{})}}function Ty(e){let t=["#8dd3c7","#ffffb3","#bebada","#80b1d3","#fdb462","#b3de69","#fccde5","#bc80bd","#ccebc5","#ffed6f"];for(let n of e.features)n.properties??(n.properties={}),n.properties.cell_color=="disconnected"?n.properties.color="red":Object.hasOwn(n.properties,"cell_color")&&(n.properties.color=t[n.properties.cell_color%t.length]);return e}const xM=e=>({}),pb=e=>({}),wM=e=>({}),db=e=>({});function mb(e){let t;const n=e[5]["line-popup"],i=sr(n,e,e[7],db);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&128)&&lr(i,n,r,r[7],t?ar(n,r[7],l,wM):ur(r[7]),db)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function SM(e){let t,n,i=e[0]&&mb(e);return{c(){i&&i.c(),t=ts()},m(r,l){i&&i.m(r,l),Ct(r,t,l),n=!0},p(r,l){r[0]?i?(i.p(r,l),l&1&&pt(i,1)):(i=mb(r),i.c(),pt(i,1),i.m(t.parentNode,t)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function EM(e){let t,n,i,r,l;const f=[Vr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let a={};for(let A=0;A{}}=t;const S=L=>_&&x(L.detail.features[0]);return e.$$set=L=>{"gjInput"in L&&n(4,a=L.gjInput),"interactive"in L&&n(0,_=L.interactive),"onClickLine"in L&&n(1,x=L.onClickLine),"$$scope"in L&&n(7,f=L.$$scope)},e.$$.update=()=>{e.$$.dirty&16&&n(3,i=Ty(a)),e.$$.dirty&16&&n(2,r=Math.max(...a.features.map(L=>L.properties.shortcuts??0)))},[_,x,r,i,a,l,S,f]}class Dg extends nn{constructor(t){super(),en(this,t,CM,IM,He,{gjInput:4,interactive:0,onClickLine:1})}}const TM=e=>({}),gb=e=>({}),LM=e=>({}),_b=e=>({}),MM=e=>({}),yb=e=>({});function PM(e){let t,n,i,r,l,f;const a=e[4].top,_=sr(a,e,e[3],yb),x=e[4].sidebar,S=sr(x,e,e[3],_b),L=e[4].map,A=sr(L,e,e[3],gb);return{c(){t=wt("div"),_&&_.c(),n=Xt(),i=wt("div"),S&&S.c(),r=Xt(),l=wt("div"),A&&A.c()},m(P,O){Ct(P,t,O),_&&_.m(t,null),e[5](t),Ct(P,n,O),Ct(P,i,O),S&&S.m(i,null),e[6](i),Ct(P,r,O),Ct(P,l,O),A&&A.m(l,null),e[7](l),f=!0},p(P,[O]){_&&_.p&&(!f||O&8)&&lr(_,a,P,P[3],f?ar(a,P[3],O,MM):ur(P[3]),yb),S&&S.p&&(!f||O&8)&&lr(S,x,P,P[3],f?ar(x,P[3],O,LM):ur(P[3]),_b),A&&A.p&&(!f||O&8)&&lr(A,L,P,P[3],f?ar(L,P[3],O,TM):ur(P[3]),gb)},i(P){f||(pt(_,P),pt(S,P),pt(A,P),f=!0)},o(P){bt(_,P),bt(S,P),bt(A,P),f=!1},d(P){P&&(It(t),It(n),It(i),It(r),It(l)),_&&_.d(P),e[5](null),S&&S.d(P),e[6](null),A&&A.d(P),e[7](null)}}}function kM(e,t,n){let i,r,l;Se(e,oy,L=>n(0,i=L)),Se(e,sy,L=>n(1,r=L)),Se(e,ay,L=>n(2,l=L));let{$$slots:f={},$$scope:a}=t;function _(L){cr[L?"unshift":"push"](()=>{i=L,oy.set(i)})}function x(L){cr[L?"unshift":"push"](()=>{r=L,sy.set(r)})}function S(L){cr[L?"unshift":"push"](()=>{l=L,ay.set(l)})}return e.$$set=L=>{"$$scope"in L&&n(3,a=L.$$scope)},[i,r,l,a,f,_,x,S]}class Wu extends nn{constructor(t){super(),en(this,t,kM,PM,He,{})}}function AM(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function NM(e){let t;return{c(){t=be("Pick neighbourhood")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function DM(e){let t;return{c(){t=be("Editing modal filters")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function RM(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O;return l=new bi({props:{$$slots:{default:[AM]},$$scope:{ctx:e}}}),l.$on("click",e[4]),_=new bi({props:{$$slots:{default:[NM]},$$scope:{ctx:e}}}),_.$on("click",e[5]),L=new bi({props:{$$slots:{default:[DM]},$$scope:{ctx:e}}}),L.$on("click",e[6]),{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),Zt(_.$$.fragment),x=Xt(),S=wt("li"),Zt(L.$$.fragment),A=Xt(),P=wt("li"),P.textContent="Debug mode",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(B,U){Ct(B,t,U),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),jt(_,a,null),mt(i,x),mt(i,S),jt(L,S,null),mt(i,A),mt(i,P),O=!0},p(B,U){const Y={};U&256&&(Y.$$scope={dirty:U,ctx:B}),l.$set(Y);const V={};U&256&&(V.$$scope={dirty:U,ctx:B}),_.$set(V);const $={};U&256&&($.$$scope={dirty:U,ctx:B}),L.$set($)},i(B){O||(pt(l.$$.fragment,B),pt(_.$$.fragment,B),pt(L.$$.fragment,B),O=!0)},o(B){bt(l.$$.fragment,B),bt(_.$$.fragment,B),bt(L.$$.fragment,B),O=!1},d(B){B&&It(t),qt(l),qt(_),qt(L)}}}function OM(e){let t,n,i;return n=new Ng({}),n.$on("click",e[3]),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","sidebar")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p:Ie,i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function zM(e){let t,n;return t=new df({props:{properties:e[7]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&128&&(l.properties=i[7]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function FM(e){let t,n,i;return n=new wl({props:{openOn:"hover",$$slots:{default:[zM,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:e}}}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&384&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function BM(e){let t,n;return t=new df({props:{properties:e[7]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&128&&(l.properties=i[7]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function VM(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[BM,({props:i})=>({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&384&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function UM(e){let t,n;return t=new df({props:{properties:e[7]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&128&&(l.properties=i[7]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function GM(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[UM,({props:i})=>({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&384&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function jM(e){let t,n,i,r;const l=[Vr("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let f={$$slots:{default:[VM]},$$scope:{ctx:e}};for(let x=0;x({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&384&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function $M(e){let t,n;const i=[Vr("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let r={$$slots:{default:[ZM]},$$scope:{ctx:e}};for(let l=0;ln(0,i=S)),Se(e,xn,S=>n(1,r=S)),[i,r,S=>window.open(xi(S.properties).way,"_blank"),()=>je(xn,r={mode:"neighbourhood"},r),()=>je(xn,r={mode:"title"},r),()=>je(xn,r={mode:"network"},r),()=>je(xn,r={mode:"neighbourhood"},r)]}class YM extends nn{constructor(t){super(),en(this,t,HM,XM,He,{})}}function KM(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function JM(e){let t,n,i,r,l,f,a,_;return l=new bi({props:{$$slots:{default:[KM]},$$scope:{ctx:e}}}),l.$on("click",e[3]),{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),a.textContent="Debug route snapper",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(x,S){Ct(x,t,S),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),_=!0},p(x,S){const L={};S&32&&(L.$$scope={dirty:S,ctx:x}),l.$set(L)},i(x){_||(pt(l.$$.fragment,x),_=!0)},o(x){bt(l.$$.fragment,x),_=!1},d(x){x&&It(t),qt(l)}}}function QM(e){let t,n,i;return n=new Ng({}),n.$on("click",e[2]),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","sidebar")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p:Ie,i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function tP(e){let t,n;return t=new df({props:{properties:e[4]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&16&&(l.properties=i[4]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function eP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[tP,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&48&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function nP(e){let t,n;return t=new df({props:{properties:e[4]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&16&&(l.properties=i[4]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function iP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[nP,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&48&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function rP(e){let t,n,i,r;return t=new ru({props:{manageHoverState:!0,paint:{"line-width":8,"line-color":"black","line-opacity":ry(.5,1)},$$slots:{default:[eP]},$$scope:{ctx:e}}}),i=new hd({props:{manageHoverState:!0,paint:{"circle-radius":10,"circle-color":"black","circle-opacity":ry(.5,1)},$$slots:{default:[iP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment),n=Xt(),Zt(i.$$.fragment)},m(l,f){jt(t,l,f),Ct(l,n,f),jt(i,l,f),r=!0},p(l,f){const a={};f&32&&(a.$$scope={dirty:f,ctx:l}),t.$set(a);const _={};f&32&&(_.$$scope={dirty:f,ctx:l}),i.$set(_)},i(l){r||(pt(t.$$.fragment,l),pt(i.$$.fragment,l),r=!0)},o(l){bt(t.$$.fragment,l),bt(i.$$.fragment,l),r=!1},d(l){l&&It(n),qt(t,l),qt(i,l)}}}function oP(e){let t,n,i;return n=new Ps({props:{data:JSON.parse(xi(e[0]).toRouteSnapperGj()),generateId:!0,$$slots:{default:[rP]},$$scope:{ctx:e}}}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&1&&(f.data=JSON.parse(xi(r[0]).toRouteSnapperGj())),l&32&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function sP(e){let t,n;return t=new Wu({props:{$$slots:{map:[oP],sidebar:[QM],top:[JM]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&35&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function aP(e,t,n){let i,r;return Se(e,Wo,a=>n(0,i=a)),Se(e,xn,a=>n(1,r=a)),[i,r,()=>je(xn,r={mode:"network"},r),()=>je(xn,r={mode:"title"},r)]}class lP extends nn{constructor(t){super(),en(this,t,aP,sP,He,{})}}function uP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O,B,U,Y,V;return B=new hw({props:{msg:e[0]}}),{c(){t=wt("details"),n=wt("summary"),n.textContent="Save / load project",i=Xt(),r=wt("button"),r.textContent="Save to GJ",l=Xt(),f=wt("label"),a=be(`Load edits from GJ + `),_=wt("input"),x=Xt(),S=wt("div"),L=wt("button"),L.textContent="Save to local storage",A=Xt(),P=wt("button"),P.textContent="Load from local storage",O=Xt(),Zt(B.$$.fragment),Rt(_,"type","file"),mi(S,"display","flex"),mi(S,"justify-content","space-between")},m($,K){Ct($,t,K),mt(t,n),mt(t,i),mt(t,r),mt(t,l),mt(t,f),mt(f,a),mt(f,_),e[7](_),mt(t,x),mt(t,S),mt(S,L),mt(S,A),mt(S,P),Ct($,O,K),jt(B,$,K),U=!0,Y||(V=[Ze(r,"click",e[2]),Ze(_,"change",e[3]),Ze(L,"click",e[5]),Ze(P,"click",e[4])],Y=!0)},p($,[K]){const nt={};K&1&&(nt.msg=$[0]),B.$set(nt)},i($){U||(pt(B.$$.fragment,$),U=!0)},o($){bt(B.$$.fragment,$),U=!1},d($){$&&(It(t),It(O)),e[7](null),qt(B,$),Y=!1,No(V)}}}function cP(e,t,n){let i,r,l,f;Se(e,Wo,B=>n(9,r=B)),Se(e,xn,B=>n(10,l=B)),Se(e,Pu,B=>n(6,f=B));let a=null;function _(){_M(i,r.toSavefile())}let x;async function S(B){n(0,a="Loading project from file");try{P(await x.files[0].text())}catch(U){window.alert(`Couldn't open this file: ${U}`)}n(0,a=null)}function L(){n(0,a="Loading projects from local storage");try{let B=window.localStorage.getItem(i);B?P(B):window.alert("Nothing was saved in local storage")}catch(B){window.alert(`Couldn't load from local storage: ${B}`)}n(0,a=null)}function A(){window.localStorage.setItem(i,r.toSavefile())}function P(B){r.loadSavefile(JSON.parse(B)),je(xn,l={mode:"network"},l),Wo.set(r)}function O(B){cr[B?"unshift":"push"](()=>{x=B,n(1,x)})}return e.$$.update=()=>{e.$$.dirty&64&&(i=`ltn_${f||"custom"}.geojson`)},[a,x,_,S,L,A,f,O]}class kw extends nn{constructor(t){super(),en(this,t,cP,uP,He,{})}}function vb(e,t,n){const i=e.slice();return i[7]=t[n][0],i[8]=t[n][1],i[9]=t[n][2],i}function bb(e){let t,n,i,r,l,f,a=e[8]+"",_,x,S,L,A;function P(){return e[3](e[7])}return{c(){t=wt("button"),n=wt("img"),r=Xt(),l=wt("br"),f=Xt(),_=be(a),x=Xt(),hr(n.src,i=`/ltn//filters/${e[7]}_icon.gif`)||Rt(n,"src",i),Rt(n,"width","80"),Rt(n,"alt",e[8]),Rt(t,"class","outline"),mi(t,"width","100%"),t.disabled=S=e[0]==e[7]},m(O,B){Ct(O,t,B),mt(t,n),mt(t,r),mt(t,l),mt(t,f),mt(t,_),mt(t,x),L||(A=Ze(t,"click",P),L=!0)},p(O,B){e=O,B&1&&S!==(S=e[0]==e[7])&&(t.disabled=S)},d(O){O&&It(t),L=!1,A()}}}function hP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P=e[1][2]+"",O,B,U,Y,V,$,K=la(e[2]),nt=[];for(let dt=0;dt({6:i}),({dialog:i})=>i?64:0]},$$scope:{ctx:e}}}),t.$on("close",e[5]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&4163&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function pP(e,t,n){let i,r;Se(e,ly,x=>n(0,r=x));let l=[["walk_cycle_only","Walking/cycling only","A physical barrier that only allows people walking, cycling, and rolling to pass. Often planters or bollards. Larger vehicles cannot enter."],["no_entry","No entry","An alternative sign to indicate vehicles are not allowed to enter the street. Only people walking, cycling, and rolling may pass through."],["bus_gate","Bus gate","A bus gate sign and traffic cameras are installed to allow buses, pedestrians, and cyclists to pass. There is no physical barrier."],["school_street","School street","A closure during school hours only. The barrier usually allows teachers and staff to access the school."]];const f=x=>je(ly,r=x,r),a=x=>xi(x).close();function _(x){ii.call(this,e,x)}return e.$$.update=()=>{e.$$.dirty&1&&n(1,i=l.find(x=>x[0]==r))},[r,i,l,f,a,_]}class dP extends nn{constructor(t){super(),en(this,t,pP,fP,He,{})}}function xb(e){let t,n;return t=new Ps({props:{data:e[0],$$slots:{default:[mP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&1&&(l.data=i[0]),r&64&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function mP(e){let t,n;const i=[Vr("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let r={};for(let l=0;l{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function _P(e,t,n){let{map:i}=t,r=null;const l=Dc();i.on("dragstart",f),i.on("mousemove",a),i.on("mouseup",_),aa(()=>{i.dragPan.enable(),i.off("dragstart",f),i.off("mousemove",a),i.off("mouseup",_)});function f(){i.dragPan.disable(),n(0,r={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function a(x){r&&(r.geometry.coordinates.push(x.lngLat.toArray()),n(0,r))}function _(){r&&(l("done",r),n(0,r=null))}return e.$$set=x=>{"map"in x&&n(1,i=x.map)},[r,i]}class yP extends nn{constructor(t){super(),en(this,t,_P,gP,He,{map:1})}}function vP(e){let t;const n=e[3].default,i=sr(n,e,e[5],null);return{c(){i&&i.c()},m(r,l){i&&i.m(r,l),t=!0},p(r,l){i&&i.p&&(!t||l&32)&&lr(i,n,r,r[5],t?ar(n,r[5],l,null):ur(r[5]),null)},i(r){t||(pt(i,r),t=!0)},o(r){bt(i,r),t=!1},d(r){i&&i.d(r)}}}function bP(e){let t,n;const i=[Vr("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}}];let r={$$slots:{default:[vP]},$$scope:{ctx:e}};for(let l=0;ln(1,r=x)),Se(e,gc,x=>n(2,l=x));let{$$slots:f={},$$scope:a}=t;function _(x){ii.call(this,e,x)}return e.$$set=x=>{"$$scope"in x&&n(5,a=x.$$scope)},e.$$.update=()=>{e.$$.dirty&6&&n(0,i=l>0?JSON.parse(r.renderModalFilters()):null)},[i,r,l,f,_,a]}class Rg extends nn{constructor(t){super(),en(this,t,wP,xP,He,{})}}function SP(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function EP(e){let t;return{c(){t=be("Pick neighbourhood")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function IP(e){let t;return{c(){t=be("View shortcuts")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function CP(e){let t;return{c(){t=be("Route")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function TP(e){let t;return{c(){t=be("Change this boundary")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function LP(e){let t;return{c(){t=be("Debug")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function MP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O,B,U,Y,V,$,K,nt,ht,dt,gt,ut;return l=new bi({props:{$$slots:{default:[SP]},$$scope:{ctx:e}}}),l.$on("click",e[20]),_=new bi({props:{$$slots:{default:[EP]},$$scope:{ctx:e}}}),_.$on("click",e[21]),B=new bi({props:{$$slots:{default:[IP]},$$scope:{ctx:e}}}),B.$on("click",e[22]),V=new bi({props:{$$slots:{default:[CP]},$$scope:{ctx:e}}}),V.$on("click",e[23]),nt=new bi({props:{$$slots:{default:[TP]},$$scope:{ctx:e}}}),nt.$on("click",e[24]),gt=new bi({props:{$$slots:{default:[LP]},$$scope:{ctx:e}}}),gt.$on("click",e[25]),{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),Zt(_.$$.fragment),x=Xt(),S=wt("li"),S.textContent="Editing modal filters",L=Xt(),A=wt("nav"),P=wt("ul"),O=wt("li"),Zt(B.$$.fragment),U=Xt(),Y=wt("li"),Zt(V.$$.fragment),$=Xt(),K=wt("li"),Zt(nt.$$.fragment),ht=Xt(),dt=wt("li"),Zt(gt.$$.fragment),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top"),mi(t,"display","flex"),mi(t,"justify-content","space-between")},m(Et,yt){Ct(Et,t,yt),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),jt(_,a,null),mt(i,x),mt(i,S),mt(t,L),mt(t,A),mt(A,P),mt(P,O),jt(B,O,null),mt(P,U),mt(P,Y),jt(V,Y,null),mt(P,$),mt(P,K),jt(nt,K,null),mt(P,ht),mt(P,dt),jt(gt,dt,null),ut=!0},p(Et,yt){const xt={};yt[1]&1&&(xt.$$scope={dirty:yt,ctx:Et}),l.$set(xt);const fe={};yt[1]&1&&(fe.$$scope={dirty:yt,ctx:Et}),_.$set(fe);const Nt={};yt[1]&1&&(Nt.$$scope={dirty:yt,ctx:Et}),B.$set(Nt);const Gt={};yt[1]&1&&(Gt.$$scope={dirty:yt,ctx:Et}),V.$set(Gt);const Qt={};yt[1]&1&&(Qt.$$scope={dirty:yt,ctx:Et}),nt.$set(Qt);const oe={};yt[1]&1&&(oe.$$scope={dirty:yt,ctx:Et}),gt.$set(oe)},i(Et){ut||(pt(l.$$.fragment,Et),pt(_.$$.fragment,Et),pt(B.$$.fragment,Et),pt(V.$$.fragment,Et),pt(nt.$$.fragment,Et),pt(gt.$$.fragment,Et),ut=!0)},o(Et){bt(l.$$.fragment,Et),bt(_.$$.fragment,Et),bt(B.$$.fragment,Et),bt(V.$$.fragment,Et),bt(nt.$$.fragment,Et),bt(gt.$$.fragment,Et),ut=!1},d(Et){Et&&It(t),qt(l),qt(_),qt(B),qt(V),qt(nt),qt(gt)}}}function PP(e){let t,n,i;return{c(){t=be("Undo ("),n=be(e[4]),i=be(")")},m(r,l){Ct(r,t,l),Ct(r,n,l),Ct(r,i,l)},p(r,l){l[0]&16&&Zi(n,r[4])},d(r){r&&(It(t),It(n),It(i))}}}function kP(e){let t;return{c(){t=be("Undo")},m(n,i){Ct(n,t,i)},p:Ie,d(n){n&&It(t)}}}function AP(e){let t,n,i;return{c(){t=be("Redo ("),n=be(e[5]),i=be(")")},m(r,l){Ct(r,t,l),Ct(r,n,l),Ct(r,i,l)},p(r,l){l[0]&32&&Zi(n,r[5])},d(r){r&&(It(t),It(n),It(i))}}}function NP(e){let t;return{c(){t=be("Redo")},m(n,i){Ct(n,t,i)},p:Ie,d(n){n&&It(t)}}}function wb(e){let t,n;return t=new dP({}),t.$on("close",e[19]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p:Ie,i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function DP(e){let t,n,i,r,l=xi(xi(e[6]).properties).name+"",f,a,_,x,S,L,A,P,O,B,U,Y,V,$,K,nt,ht,dt,gt,ut,Et,yt,xt,fe,Nt,Gt,Qt,oe,Ce,yn,jn,Qe,Fe,ke,fn,Kn;function qn(_t,Ee){return _t[4]==0?kP:PP}let ie=qn(e),De=ie(e);function hn(_t,Ee){return _t[5]==0?NP:AP}let On=hn(e),_i=On(e),wn=e[3]&&wb(e);return Fe=new kw({}),{c(){t=wt("div"),n=wt("p"),i=be("Editing neighbourhood "),r=wt("u"),f=be(l),a=Xt(),_=wt("p"),_.textContent=`Now that you've defined a neighbourhood boundary, you can see the possible shortcuts that vehicles are currently able to take through it. You can add a new modal filter to try and solve this. The colored "cell" areas show - what's reachable for drivers without leaving the boundary you've drawn.`,x=Zt(),S=dt("hr"),L=Zt(),A=dt("button"),k=dt("img"),U=Xe(` - Add a modal filter`),Q=Zt(),B=dt("button"),X=Xe("Add many modal filters along line"),it=Zt(),ft=dt("button"),mt=Xe("Change modal filter type"),ct=Zt(),Mt=dt("div"),xt=dt("button"),De.c(),me=Zt(),Rt=dt("button"),mi.c(),te=Zt(),wn&&wn.c(),se=Zt(),Ce=dt("hr"),yn=Zt(),jn=dt("hr"),$e=Zt(),Qt(Fe.$$.fragment),hr(k.src,R=`/ltn//filters/${e[8]}_icon.gif`)||It(k,"src",R),It(k,"width","30"),It(k,"alt","Add a modal filter"),A.disabled=j=e[0]||e[2],B.disabled=J=e[0]||e[2],ft.disabled=_t=e[0]||e[2],xt.disabled=vt=e[4]==0,Rt.disabled=Gt=e[5]==0,pi(Mt,"display","flex"),pi(Mt,"justify-content","space-between"),It(t,"slot","sidebar")},m(gt,Ie){At(gt,t,Ie),lt(t,n),lt(n,i),lt(n,r),lt(r,f),lt(t,a),lt(t,_),lt(t,x),lt(t,S),lt(t,L),lt(t,A),lt(A,k),lt(A,U),lt(t,Q),lt(t,B),lt(B,X),lt(t,it),lt(t,ft),lt(ft,mt),lt(t,ct),lt(t,Mt),lt(Mt,xt),De.m(xt,null),lt(Mt,me),lt(Mt,Rt),mi.m(Rt,null),lt(t,te),wn&&wn.m(t,null),lt(t,se),lt(t,Ce),lt(t,yn),lt(t,jn),lt(t,$e),Kt(Fe,t,null),ke=!0,fn||(Jn=[be(A,"click",e[16]),be(B,"click",e[17]),be(ft,"click",e[18]),be(xt,"click",e[12]),be(Rt,"click",e[13])],fn=!0)},p(gt,Ie){(!ke||Ie[0]&64)&&l!==(l=yi(yi(gt[6]).properties).name+"")&&qi(f,l),(!ke||Ie[0]&256&&!hr(k.src,R=`/ltn//filters/${gt[8]}_icon.gif`))&&It(k,"src",R),(!ke||Ie[0]&5&&j!==(j=gt[0]||gt[2]))&&(A.disabled=j),(!ke||Ie[0]&5&&J!==(J=gt[0]||gt[2]))&&(B.disabled=J),(!ke||Ie[0]&5&&_t!==(_t=gt[0]||gt[2]))&&(ft.disabled=_t),ie===(ie=qn(gt))&&De?De.p(gt,Ie):(De.d(1),De=ie(gt),De&&(De.c(),De.m(xt,null))),(!ke||Ie[0]&16&&vt!==(vt=gt[4]==0))&&(xt.disabled=vt),On===(On=hn(gt))&&mi?mi.p(gt,Ie):(mi.d(1),mi=On(gt),mi&&(mi.c(),mi.m(Rt,null))),(!ke||Ie[0]&32&&Gt!==(Gt=gt[5]==0))&&(Rt.disabled=Gt),gt[3]?wn?(wn.p(gt,Ie),Ie[0]&8&&wt(wn,1)):(wn=xb(gt),wn.c(),wt(wn,1),wn.m(t,se)):wn&&(Ti(),Pt(wn,1,1,()=>{wn=null}),Li())},i(gt){ke||(wt(wn),wt(Fe.$$.fragment,gt),ke=!0)},o(gt){Pt(wn),Pt(Fe.$$.fragment,gt),ke=!1},d(gt){gt&&kt(t),De.d(),mi.d(),wn&&wn.d(),Jt(Fe),fn=!1,Wi(Jn)}}}function IP(e){let t,n=e[30].shortcuts+"",i,r,l=(e[30].name??"unnamed road")+"",f;return{c(){t=dt("p"),i=Xe(n),r=Xe(" shortcuts through "),f=Xe(l)},m(a,_){At(a,t,_),lt(t,i),lt(t,r),lt(t,f)},p(a,_){_[0]&1073741824&&n!==(n=a[30].shortcuts+"")&&qi(i,n),_[0]&1073741824&&l!==(l=(a[30].name??"unnamed road")+"")&&qi(f,l)},d(a){a&&kt(t)}}}function CP(e){let t,n,i;return n=new xl({props:{openOn:"hover",$$slots:{default:[IP,({props:r})=>({30:r}),({props:r})=>[r?1073741824:0]]},$$scope:{ctx:e}}}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","line-popup")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p(r,l){const f={};l[0]&1073741824|l[1]&1&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function TP(e){let t;return{c(){t=Xe("Click to delete")},m(n,i){At(n,t,i)},d(n){n&&kt(t)}}}function LP(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[TP]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r[1]&1&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function wb(e){let t,n;return t=new dP({props:{map:yi(e[1])}}),t.$on("done",e[14]),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r[0]&2&&(l.map=yi(i[1])),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function MP(e){let t,n,i,r,l,f;n=new Ng({props:{gjInput:e[7],interactive:!e[0]&&!e[2],$$slots:{"line-popup":[CP]},$$scope:{ctx:e}}}),r=new Dg({props:{$$slots:{default:[LP]},$$scope:{ctx:e}}}),r.$on("click",e[10]);let a=e[2]&&wb(e);return{c(){t=dt("div"),Qt(n.$$.fragment),i=Zt(),Qt(r.$$.fragment),l=Zt(),a&&a.c(),It(t,"slot","map")},m(_,x){At(_,t,x),Kt(n,t,null),lt(t,i),Kt(r,t,null),lt(t,l),a&&a.m(t,null),f=!0},p(_,x){const S={};x[0]&128&&(S.gjInput=_[7]),x[0]&5&&(S.interactive=!_[0]&&!_[2]),x[1]&1&&(S.$$scope={dirty:x,ctx:_}),n.$set(S);const L={};x[1]&1&&(L.$$scope={dirty:x,ctx:_}),r.$set(L),_[2]?a?(a.p(_,x),x[0]&4&&wt(a,1)):(a=wb(_),a.c(),wt(a,1),a.m(t,null)):a&&(Ti(),Pt(a,1,1,()=>{a=null}),Li())},i(_){f||(wt(n.$$.fragment,_),wt(r.$$.fragment,_),wt(a),f=!0)},o(_){Pt(n.$$.fragment,_),Pt(r.$$.fragment,_),Pt(a),f=!1},d(_){_&&kt(t),Jt(n),Jt(r),a&&a.d()}}}function PP(e){let t,n,i,r;return t=new Wu({props:{$$slots:{map:[MP],sidebar:[EP],top:[vP]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(l,f){Kt(t,l,f),n=!0,i||(r=be(window,"keydown",e[11]),i=!0)},p(l,f){const a={};f[0]&1023|f[1]&1&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(wt(t.$$.fragment,l),n=!0)},o(l){Pt(t.$$.fragment,l),n=!1},d(l){Jt(t,l),i=!1,r()}}}function kP(e,t,n){let i,r,l,f,a;Ee(e,mc,se=>n(15,i=se)),Ee(e,ay,se=>n(8,r=se)),Ee(e,Wo,se=>n(26,l=se)),Ee(e,Nu,se=>n(1,f=se)),Ee(e,xn,se=>n(9,a=se));let _=!1,x=!1,S=!1,L=0,A=0,k,R;function U(se){n(7,R=JSON.parse(l.renderNeighbourhood())),n(6,k=R.features.find(Ce=>Ce.properties.kind=="boundary")),n(4,L=R.undo_length),n(5,A=R.redo_length)}sa(()=>{Q()});function j(se){l.addModalFilter(se.lngLat,r),je(mc,i++,i),Q()}function Q(){n(0,_=!1),f.off("click",j),f.getCanvas().style.cursor="inherit"}function B(se){let Ce=se.detail.features[0];l.deleteModalFilter(Ce.properties.road),je(mc,i++,i)}function X(se){se.key=="a"&&!_&&!x&&n(0,_=!0),se.key=="z"&&se.ctrlKey&&J(),se.key=="y"&&se.ctrlKey&&it()}function J(){l.undo(),je(mc,i++,i)}function it(){l.redo(),je(mc,i++,i)}function ft(se){let Ce=se.detail;Ce&&(l.addManyModalFilters(Ce,r),je(mc,i++,i)),n(2,x=!1)}const mt=()=>n(0,_=!0),_t=()=>n(2,x=!0),ct=()=>n(3,S=!0),Mt=()=>n(3,S=!1),xt=()=>je(xn,a={mode:"title"},a),vt=()=>je(xn,a={mode:"network"},a),me=()=>je(xn,a={mode:"view-shortcuts"},a),Rt=()=>je(xn,a={mode:"route",prevMode:"neighbourhood"},a),Gt=()=>je(xn,a={mode:"set-boundary",name:yi(yi(k).properties).name,existing:k},a),te=()=>je(xn,a={mode:"debug"},a);return e.$$.update=()=>{e.$$.dirty[0]&32768&&U(),e.$$.dirty[0]&3&&_&&(f.on("click",j),f.getCanvas().style.cursor="crosshair")},[_,f,x,S,L,A,k,R,r,a,B,X,J,it,ft,i,mt,_t,ct,Mt,xt,vt,me,Rt,Gt,te]}class AP extends nn{constructor(t){super(),en(this,t,kP,PP,Ye,{},null,[-1,-1])}}function Sb(e,t,n){const i=e.slice();return i[14]=t[n],i}function NP(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R,U,j,Q;return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),a.textContent="Pick neighbourhood",_=Zt(),x=dt("nav"),S=dt("ul"),L=dt("li"),A=dt("a"),A.textContent="Route",k=Zt(),R=dt("li"),U=dt("a"),U.textContent="Debug route snapper",It(l,"href","#"),It(n,"aria-label","breadcrumb"),It(A,"href","#"),It(U,"href","#"),It(t,"slot","top"),pi(t,"display","flex"),pi(t,"justify-content","space-between")},m(B,X){At(B,t,X),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),lt(t,_),lt(t,x),lt(x,S),lt(S,L),lt(L,A),lt(S,k),lt(S,R),lt(R,U),j||(Q=[be(l,"click",e[10]),be(A,"click",e[11]),be(U,"click",e[12])],j=!0)},p:we,d(B){B&&kt(t),j=!1,Wi(Q)}}}function Eb(e){let t,n,i,r=e[14]+"",l,f,a,_,x,S;function L(){return e[8](e[14])}function A(){return e[9](e[14])}return{c(){t=dt("li"),n=dt("span"),i=dt("a"),l=Xe(r),f=Zt(),a=dt("button"),a.textContent="X",_=Zt(),It(i,"href","#"),It(a,"class","secondary outline"),pi(n,"display","flex"),pi(n,"justify-content","space-between")},m(k,R){At(k,t,R),lt(t,n),lt(n,i),lt(i,l),lt(n,f),lt(n,a),lt(t,_),x||(S=[be(i,"click",L),be(a,"click",A)],x=!0)},p(k,R){e=k,R&2&&r!==(r=e[14]+"")&&qi(l,r)},d(k){k&&kt(t),x=!1,Wi(S)}}}function DP(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R=aa(e[1]),U=[];for(let j=0;j{wn=null}),ci())},i(_t){ke||(pt(wn),pt(Fe.$$.fragment,_t),ke=!0)},o(_t){bt(wn),bt(Fe.$$.fragment,_t),ke=!1},d(_t){_t&&It(t),De.d(),_i.d(),wn&&wn.d(),qt(Fe),fn=!1,No(Kn)}}}function RP(e){let t,n=e[30].shortcuts+"",i,r,l=(e[30].name??"unnamed road")+"",f;return{c(){t=wt("p"),i=be(n),r=be(" shortcuts through "),f=be(l)},m(a,_){Ct(a,t,_),mt(t,i),mt(t,r),mt(t,f)},p(a,_){_[0]&1073741824&&n!==(n=a[30].shortcuts+"")&&Zi(i,n),_[0]&1073741824&&l!==(l=(a[30].name??"unnamed road")+"")&&Zi(f,l)},d(a){a&&It(t)}}}function OP(e){let t,n,i;return n=new wl({props:{openOn:"hover",$$slots:{default:[RP,({props:r})=>({30:r}),({props:r})=>[r?1073741824:0]]},$$scope:{ctx:e}}}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l[0]&1073741824|l[1]&1&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function zP(e){let t;return{c(){t=be("Click to delete")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function FP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[zP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r[1]&1&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Sb(e){let t,n;return t=new yP({props:{map:xi(e[1])}}),t.$on("done",e[14]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r[0]&2&&(l.map=xi(i[1])),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function BP(e){let t,n,i,r,l,f;n=new Dg({props:{gjInput:e[7],interactive:!e[0]&&!e[2],$$slots:{"line-popup":[OP]},$$scope:{ctx:e}}}),r=new Rg({props:{$$slots:{default:[FP]},$$scope:{ctx:e}}}),r.$on("click",e[10]);let a=e[2]&&Sb(e);return{c(){t=wt("div"),Zt(n.$$.fragment),i=Xt(),Zt(r.$$.fragment),l=Xt(),a&&a.c(),Rt(t,"slot","map")},m(_,x){Ct(_,t,x),jt(n,t,null),mt(t,i),jt(r,t,null),mt(t,l),a&&a.m(t,null),f=!0},p(_,x){const S={};x[0]&128&&(S.gjInput=_[7]),x[0]&5&&(S.interactive=!_[0]&&!_[2]),x[1]&1&&(S.$$scope={dirty:x,ctx:_}),n.$set(S);const L={};x[1]&1&&(L.$$scope={dirty:x,ctx:_}),r.$set(L),_[2]?a?(a.p(_,x),x[0]&4&&pt(a,1)):(a=Sb(_),a.c(),pt(a,1),a.m(t,null)):a&&(ui(),bt(a,1,1,()=>{a=null}),ci())},i(_){f||(pt(n.$$.fragment,_),pt(r.$$.fragment,_),pt(a),f=!0)},o(_){bt(n.$$.fragment,_),bt(r.$$.fragment,_),bt(a),f=!1},d(_){_&&It(t),qt(n),qt(r),a&&a.d()}}}function VP(e){let t,n,i,r;return t=new Wu({props:{$$slots:{map:[BP],sidebar:[DP],top:[MP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ze(window,"keydown",e[11]),i=!0)},p(l,f){const a={};f[0]&1023|f[1]&1&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(pt(t.$$.fragment,l),n=!0)},o(l){bt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function UP(e,t,n){let i,r,l,f,a;Se(e,gc,oe=>n(15,i=oe)),Se(e,ly,oe=>n(8,r=oe)),Se(e,Wo,oe=>n(26,l=oe)),Se(e,Du,oe=>n(1,f=oe)),Se(e,xn,oe=>n(9,a=oe));let _=!1,x=!1,S=!1,L=0,A=0,P,O;function B(oe){n(7,O=JSON.parse(l.renderNeighbourhood())),n(6,P=O.features.find(Ce=>Ce.properties.kind=="boundary")),n(4,L=O.undo_length),n(5,A=O.redo_length)}aa(()=>{Y()});function U(oe){l.addModalFilter(oe.lngLat,r),je(gc,i++,i),Y()}function Y(){n(0,_=!1),f.off("click",U),f.getCanvas().style.cursor="inherit"}function V(oe){let Ce=oe.detail.features[0];l.deleteModalFilter(Ce.properties.road),je(gc,i++,i)}function $(oe){oe.key=="a"&&!_&&!x&&n(0,_=!0),oe.key=="z"&&oe.ctrlKey&&K(),oe.key=="y"&&oe.ctrlKey&&nt()}function K(){l.undo(),je(gc,i++,i)}function nt(){l.redo(),je(gc,i++,i)}function ht(oe){let Ce=oe.detail;Ce&&(l.addManyModalFilters(Ce,r),je(gc,i++,i)),n(2,x=!1)}const dt=()=>n(0,_=!0),gt=()=>n(2,x=!0),ut=()=>n(3,S=!0),Et=()=>n(3,S=!1),yt=()=>je(xn,a={mode:"title"},a),xt=()=>je(xn,a={mode:"network"},a),fe=()=>je(xn,a={mode:"view-shortcuts"},a),Nt=()=>je(xn,a={mode:"route",prevMode:"neighbourhood"},a),Gt=()=>je(xn,a={mode:"set-boundary",name:xi(xi(P).properties).name,existing:P},a),Qt=()=>je(xn,a={mode:"debug"},a);return e.$$.update=()=>{e.$$.dirty[0]&32768&&B(),e.$$.dirty[0]&3&&_&&(f.on("click",U),f.getCanvas().style.cursor="crosshair")},[_,f,x,S,L,A,P,O,r,a,V,$,K,nt,ht,i,dt,gt,ut,Et,yt,xt,fe,Nt,Gt,Qt]}class GP extends nn{constructor(t){super(),en(this,t,UP,VP,He,{},null,[-1,-1])}}function Eb(e,t,n){const i=e.slice();return i[14]=t[n],i}function jP(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function qP(e){let t;return{c(){t=be("Route")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function ZP(e){let t;return{c(){t=be("Debug route snapper")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function $P(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O,B,U;return l=new bi({props:{$$slots:{default:[jP]},$$scope:{ctx:e}}}),l.$on("click",e[10]),A=new bi({props:{$$slots:{default:[qP]},$$scope:{ctx:e}}}),A.$on("click",e[11]),B=new bi({props:{$$slots:{default:[ZP]},$$scope:{ctx:e}}}),B.$on("click",e[12]),{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),a.textContent="Pick neighbourhood",_=Xt(),x=wt("nav"),S=wt("ul"),L=wt("li"),Zt(A.$$.fragment),P=Xt(),O=wt("li"),Zt(B.$$.fragment),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top"),mi(t,"display","flex"),mi(t,"justify-content","space-between")},m(Y,V){Ct(Y,t,V),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),mt(t,_),mt(t,x),mt(x,S),mt(S,L),jt(A,L,null),mt(S,P),mt(S,O),jt(B,O,null),U=!0},p(Y,V){const $={};V&131072&&($.$$scope={dirty:V,ctx:Y}),l.$set($);const K={};V&131072&&(K.$$scope={dirty:V,ctx:Y}),A.$set(K);const nt={};V&131072&&(nt.$$scope={dirty:V,ctx:Y}),B.$set(nt)},i(Y){U||(pt(l.$$.fragment,Y),pt(A.$$.fragment,Y),pt(B.$$.fragment,Y),U=!0)},o(Y){bt(l.$$.fragment,Y),bt(A.$$.fragment,Y),bt(B.$$.fragment,Y),U=!1},d(Y){Y&&It(t),qt(l),qt(A),qt(B)}}}function WP(e){let t;return{c(){t=be("Draw a new boundary")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function XP(e){let t=e[14]+"",n;return{c(){n=be(t)},m(i,r){Ct(i,n,r)},p(i,r){r&2&&t!==(t=i[14]+"")&&Zi(n,t)},d(i){i&&It(n)}}}function Ib(e){let t,n,i,r,l,f,a,_,x;function S(){return e[8](e[14])}i=new bi({props:{$$slots:{default:[XP]},$$scope:{ctx:e}}}),i.$on("click",S);function L(){return e[9](e[14])}return{c(){t=wt("li"),n=wt("span"),Zt(i.$$.fragment),r=Xt(),l=wt("button"),l.textContent="X",f=Xt(),Rt(l,"class","secondary outline"),mi(n,"display","flex"),mi(n,"justify-content","space-between")},m(A,P){Ct(A,t,P),mt(t,n),jt(i,n,null),mt(n,r),mt(n,l),mt(t,f),a=!0,_||(x=Ze(l,"click",L),_=!0)},p(A,P){e=A;const O={};P&131074&&(O.$$scope={dirty:P,ctx:e}),i.$set(O)},i(A){a||(pt(i.$$.fragment,A),a=!0)},o(A){bt(i.$$.fragment,A),a=!1},d(A){A&&It(t),qt(i),_=!1,x()}}}function HP(e){let t,n,i,r,l,f,a,_,x,S,L;r=new bi({props:{$$slots:{default:[WP]},$$scope:{ctx:e}}}),r.$on("click",e[5]);let A=la(e[1]),P=[];for(let B=0;Bbt(P[B],1,1,()=>{P[B]=null});return S=new kw({}),{c(){t=wt("div"),n=wt("p"),n.textContent=`Inside the neighbourhood you define, the goal is to eliminate (or deliberately permit) through-traffic. An appropriate neighbourhood boundary depends on many factors. The simplest approach is to find the area bounded on all sides by "main" roads, which are designed for higher traffic volumes. There are many other considerations, though -- maybe severances like rivers or rail should be part of a boundary. Bridges and tunnels near a boundary may be confusing as well. And note that your - boundary may not match the conventional definition of "neighbourhood."`,i=Zt(),r=dt("a"),r.textContent="Draw a new boundary",l=Zt(),f=dt("ul");for(let j=0;j({13:i}),({props:i})=>i?8192:0]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&139264&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function zP(e){let t,n,i,r;const l=[Vr("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":iy(.3,.5)}},{manageHoverState:!0},{hoverCursor:"pointer"}];let f={$$slots:{default:[OP]},$$scope:{ctx:e}};for(let a=0;an(2,l=j)),Ee(e,Wo,j=>n(6,f=j));function a(j){f.setCurrentNeighbourhood(j),je(xn,l={mode:"neighbourhood"},l)}function _(j){f.deleteNeighbourhoodBoundary(j),n(0,i=JSON.parse(f.toSavefile()))}function x(){let j=window.prompt("What do you want to name the neighbourhood?");j&&je(xn,l={mode:"set-boundary",name:j,existing:null},l)}const S=j=>a(yi(j.detail.features[0].properties).name),L=j=>a(j),A=j=>_(j),k=()=>je(xn,l={mode:"title"},l),R=()=>je(xn,l={mode:"route",prevMode:"network"},l),U=()=>je(xn,l={mode:"debug-gj"},l);return e.$$.update=()=>{e.$$.dirty&64&&n(0,i=JSON.parse(f.toSavefile())),e.$$.dirty&1&&n(1,r=i.features.filter(j=>j.properties.kind=="boundary").map(j=>j.properties.name))},[i,r,l,a,_,x,f,S,L,A,k,R,U]}class UP extends nn{constructor(t){super(),en(this,t,VP,BP,Ye,{})}}function Ib(e){let t,n,i,r;return{c(){t=dt("li"),n=dt("a"),n.textContent="Editing modal filters",It(n,"href","#")},m(l,f){At(l,t,f),lt(t,n),i||(r=be(n,"click",e[11]),i=!0)},p:we,d(l){l&&kt(t),i=!1,r()}}}function GP(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R=e[0]=="neighbourhood"&&Ib(e);return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),_=dt("a"),_.textContent="Pick neighbourhood",x=Zt(),R&&R.c(),S=Zt(),L=dt("li"),L.textContent="Routing",It(l,"href","#"),It(_,"href","#"),It(n,"aria-label","breadcrumb"),It(t,"slot","top")},m(U,j){At(U,t,j),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),lt(a,_),lt(i,x),R&&R.m(i,null),lt(i,S),lt(i,L),A||(k=[be(l,"click",e[9]),be(_,"click",e[10])],A=!0)},p(U,j){U[0]=="neighbourhood"?R?R.p(U,j):(R=Ib(U),R.c(),R.m(i,S)):R&&(R.d(1),R=null)},d(U){U&&kt(t),R&&R.d(),A=!1,Wi(k)}}}function jP(e){let t,n,i,r,l,f,a;return n=new Ag({}),n.$on("click",e[6]),{c(){t=dt("div"),Qt(n.$$.fragment),i=Zt(),r=dt("p"),r.textContent="Drag markers for a route",l=Zt(),f=dt("p"),f.innerHTML=`Route before + boundary may not match the conventional definition of "neighbourhood."`,i=Xt(),Zt(r.$$.fragment),l=Xt(),f=wt("ul");for(let B=0;B({13:i}),({props:i})=>i?8192:0]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&139264&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function JP(e){let t,n,i,r;const l=[Vr("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":ry(.3,.5)}},{manageHoverState:!0},{hoverCursor:"pointer"}];let f={$$slots:{default:[KP]},$$scope:{ctx:e}};for(let a=0;an(2,l=U)),Se(e,Wo,U=>n(6,f=U));function a(U){f.setCurrentNeighbourhood(U),je(xn,l={mode:"neighbourhood"},l)}function _(U){f.deleteNeighbourhoodBoundary(U),n(0,i=JSON.parse(f.toSavefile()))}function x(){let U=window.prompt("What do you want to name the neighbourhood?");U&&je(xn,l={mode:"set-boundary",name:U,existing:null},l)}const S=U=>a(xi(U.detail.features[0].properties).name),L=U=>a(U),A=U=>_(U),P=()=>je(xn,l={mode:"title"},l),O=()=>je(xn,l={mode:"route",prevMode:"network"},l),B=()=>je(xn,l={mode:"debug-gj"},l);return e.$$.update=()=>{e.$$.dirty&64&&n(0,i=JSON.parse(f.toSavefile())),e.$$.dirty&1&&n(1,r=i.features.filter(U=>U.properties.kind=="boundary").map(U=>U.properties.name))},[i,r,l,a,_,x,f,S,L,A,P,O,B]}class nk extends nn{constructor(t){super(),en(this,t,ek,tk,He,{})}}function ik(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function rk(e){let t;return{c(){t=be("Pick neighbourhood")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function Cb(e){let t,n,i;return n=new bi({props:{$$slots:{default:[ok]},$$scope:{ctx:e}}}),n.$on("click",e[11]),{c(){t=wt("li"),Zt(n.$$.fragment)},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&4096&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function ok(e){let t;return{c(){t=be("Editing modal filters")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function sk(e){let t,n,i,r,l,f,a,_,x,S,L,A;l=new bi({props:{$$slots:{default:[ik]},$$scope:{ctx:e}}}),l.$on("click",e[9]),_=new bi({props:{$$slots:{default:[rk]},$$scope:{ctx:e}}}),_.$on("click",e[10]);let P=e[0]=="neighbourhood"&&Cb(e);return{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),Zt(_.$$.fragment),x=Xt(),P&&P.c(),S=Xt(),L=wt("li"),L.textContent="Routing",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(O,B){Ct(O,t,B),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),jt(_,a,null),mt(i,x),P&&P.m(i,null),mt(i,S),mt(i,L),A=!0},p(O,B){const U={};B&4096&&(U.$$scope={dirty:B,ctx:O}),l.$set(U);const Y={};B&4096&&(Y.$$scope={dirty:B,ctx:O}),_.$set(Y),O[0]=="neighbourhood"?P?(P.p(O,B),B&1&&pt(P,1)):(P=Cb(O),P.c(),pt(P,1),P.m(i,S)):P&&(ui(),bt(P,1,1,()=>{P=null}),ci())},i(O){A||(pt(l.$$.fragment,O),pt(_.$$.fragment,O),pt(P),A=!0)},o(O){bt(l.$$.fragment,O),bt(_.$$.fragment,O),bt(P),A=!1},d(O){O&&It(t),qt(l),qt(_),P&&P.d()}}}function ak(e){let t,n,i,r,l,f,a;return n=new Ng({}),n.$on("click",e[6]),{c(){t=wt("div"),Zt(n.$$.fragment),i=Xt(),r=wt("p"),r.textContent="Drag markers for a route",l=Xt(),f=wt("p"),f.innerHTML=`Route before , - route after`,It(t,"slot","sidebar")},m(_,x){At(_,t,x),Kt(n,t,null),lt(t,i),lt(t,r),lt(t,l),lt(t,f),a=!0},p:we,i(_){a||(wt(n.$$.fragment,_),a=!0)},o(_){Pt(n.$$.fragment,_),a=!1},d(_){_&&kt(t),Jt(n)}}}function Cb(e){let t,n;return t=new Ng({props:{gjInput:JSON.parse(yi(e[3]).renderNeighbourhood()),interactive:!1}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&8&&(l.gjInput=JSON.parse(yi(i[3]).renderNeighbourhood())),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function qP(e){let t,n;const i=[Vr("compare-route"),{paint:{"line-width":10,"line-color":Dp(["get","kind"],{before:"red",after:"blue"},"red")}}];let r={};for(let l=0;lyc(a,"lngLat",R));function j(B){e[8](B)}let Q={draggable:!0,$$slots:{default:[WP]},$$scope:{ctx:e}};return e[1]!==void 0&&(Q.lngLat=e[1]),S=new Yv({props:Q}),cr.push(()=>yc(S,"lngLat",j)),{c(){t=dt("div"),k&&k.c(),n=Zt(),Qt(i.$$.fragment),r=Zt(),Qt(l.$$.fragment),f=Zt(),Qt(a.$$.fragment),x=Zt(),Qt(S.$$.fragment),It(t,"slot","map")},m(B,X){At(B,t,X),k&&k.m(t,null),lt(t,n),Kt(i,t,null),lt(t,r),Kt(l,t,null),lt(t,f),Kt(a,t,null),lt(t,x),Kt(S,t,null),A=!0},p(B,X){B[0]=="neighbourhood"?k?(k.p(B,X),X&1&&wt(k,1)):(k=Cb(B),k.c(),wt(k,1),k.m(t,n)):k&&(Ti(),Pt(k,1,1,()=>{k=null}),Li());const J={};X&16&&(J.data=B[4]),X&4096&&(J.$$scope={dirty:X,ctx:B}),l.$set(J);const it={};X&4096&&(it.$$scope={dirty:X,ctx:B}),!_&&X&4&&(_=!0,it.lngLat=B[2],_c(()=>_=!1)),a.$set(it);const ft={};X&4096&&(ft.$$scope={dirty:X,ctx:B}),!L&&X&2&&(L=!0,ft.lngLat=B[1],_c(()=>L=!1)),S.$set(ft)},i(B){A||(wt(k),wt(i.$$.fragment,B),wt(l.$$.fragment,B),wt(a.$$.fragment,B),wt(S.$$.fragment,B),A=!0)},o(B){Pt(k),Pt(i.$$.fragment,B),Pt(l.$$.fragment,B),Pt(a.$$.fragment,B),Pt(S.$$.fragment,B),A=!1},d(B){B&&kt(t),k&&k.d(),Jt(i),Jt(l),Jt(a),Jt(S)}}}function HP(e){let t,n;return t=new Wu({props:{$$slots:{map:[XP],sidebar:[jP],top:[GP]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&4159&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function YP(e,t,n){let i,r,l,f,a;Ee(e,xn,U=>n(5,r=U)),Ee(e,Km,U=>n(1,l=U)),Ee(e,Ym,U=>n(2,f=U)),Ee(e,Wo,U=>n(3,a=U));let{prevMode:_}=t;function x(){je(xn,r={mode:_},r)}function S(U){f=U,Ym.set(f)}function L(U){l=U,Km.set(l)}const A=()=>je(xn,r={mode:"title"},r),k=()=>je(xn,r={mode:"network"},r),R=()=>je(xn,r={mode:"neighbourhood"},r);return e.$$set=U=>{"prevMode"in U&&n(0,_=U.prevMode)},e.$$.update=()=>{e.$$.dirty&14&&n(4,i=JSON.parse(a.compareRoute(f.lng,f.lat,l.lng,l.lat)))},[_,l,f,a,i,r,x,S,L,A,k,R]}class KP extends nn{constructor(t){super(),en(this,t,YP,HP,Ye,{prevMode:0})}}const JP="/ltn/assets/settings-342fb430.svg";function Tb(e){let t,n;return t=new Ky({props:{$$slots:{default:[QP]},$$scope:{ctx:e}}}),t.$on("close",e[3]),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&17&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function QP(e){let t,n,i,r,l,f,a,_,x;return i=new yI({}),{c(){t=dt("h1"),t.textContent="Settings",n=Zt(),Qt(i.$$.fragment),r=Zt(),l=dt("center"),f=dt("button"),f.textContent="Confirm"},m(S,L){At(S,t,L),At(S,n,L),Kt(i,S,L),At(S,r,L),At(S,l,L),lt(l,f),a=!0,_||(x=be(f,"click",e[2]),_=!0)},p:we,i(S){a||(wt(i.$$.fragment,S),a=!0)},o(S){Pt(i.$$.fragment,S),a=!1},d(S){S&&(kt(t),kt(n),kt(r),kt(l)),Jt(i,S),_=!1,x()}}}function $P(e){let t,n,i,r,l,f,a=e[0]&&Tb(e);return{c(){t=dt("button"),t.innerHTML=`Settings`,n=Zt(),a&&a.c(),i=$o(),It(t,"class","outline")},m(_,x){At(_,t,x),At(_,n,x),a&&a.m(_,x),At(_,i,x),r=!0,l||(f=be(t,"click",e[1]),l=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&wt(a,1)):(a=Tb(_),a.c(),wt(a,1),a.m(i.parentNode,i)):a&&(Ti(),Pt(a,1,1,()=>{a=null}),Li())},i(_){r||(wt(a),r=!0)},o(_){Pt(a),r=!1},d(_){_&&(kt(t),kt(n),kt(i)),a&&a.d(_),l=!1,f()}}}function tk(e,t,n){let i=!1;return[i,()=>n(0,i=!0),()=>n(0,i=!1),()=>n(0,i=!1)]}class ek extends nn{constructor(t){super(),en(this,t,tk,$P,Ye,{})}}function nk(e){let t,n,i,r,l,f;const a=[Vr("route-points"),{filter:Tw},{paint:{"circle-color":Dp(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Dp(["get","type"],{node:zm/2},zm)}}];let _={};for(let k=0;kn(0,i=r)),[i]}class ok extends nn{constructor(t){super(),en(this,t,rk,ik,Ye,{})}}function sk(e){let t,n,i;return{c(){t=Xe("Undo ("),n=Xe(e[1]),i=Xe(")")},m(r,l){At(r,t,l),At(r,n,l),At(r,i,l)},p(r,l){l&2&&qi(n,r[1])},d(r){r&&(kt(t),kt(n),kt(i))}}}function ak(e){let t;return{c(){t=Xe("Undo")},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function lk(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?ak:sk}let _=a(e),x=_(e);return{c(){t=dt("button"),x.c(),i=Zt(),r=dt("ul"),r.innerHTML=`
  • Click + route after`,Rt(t,"slot","sidebar")},m(_,x){Ct(_,t,x),jt(n,t,null),mt(t,i),mt(t,r),mt(t,l),mt(t,f),a=!0},p:Ie,i(_){a||(pt(n.$$.fragment,_),a=!0)},o(_){bt(n.$$.fragment,_),a=!1},d(_){_&&It(t),qt(n)}}}function Tb(e){let t,n;return t=new Dg({props:{gjInput:JSON.parse(xi(e[3]).renderNeighbourhood()),interactive:!1}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&8&&(l.gjInput=JSON.parse(xi(i[3]).renderNeighbourhood())),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function lk(e){let t,n;const i=[Vr("compare-route"),{paint:{"line-width":10,"line-color":Rp(["get","kind"],{before:"red",after:"blue"},"red")}}];let r={};for(let l=0;lvc(a,"lngLat",O));function U(V){e[8](V)}let Y={draggable:!0,$$slots:{default:[ck]},$$scope:{ctx:e}};return e[1]!==void 0&&(Y.lngLat=e[1]),S=new Yv({props:Y}),cr.push(()=>vc(S,"lngLat",U)),{c(){t=wt("div"),P&&P.c(),n=Xt(),Zt(i.$$.fragment),r=Xt(),Zt(l.$$.fragment),f=Xt(),Zt(a.$$.fragment),x=Xt(),Zt(S.$$.fragment),Rt(t,"slot","map")},m(V,$){Ct(V,t,$),P&&P.m(t,null),mt(t,n),jt(i,t,null),mt(t,r),jt(l,t,null),mt(t,f),jt(a,t,null),mt(t,x),jt(S,t,null),A=!0},p(V,$){V[0]=="neighbourhood"?P?(P.p(V,$),$&1&&pt(P,1)):(P=Tb(V),P.c(),pt(P,1),P.m(t,n)):P&&(ui(),bt(P,1,1,()=>{P=null}),ci());const K={};$&16&&(K.data=V[4]),$&4096&&(K.$$scope={dirty:$,ctx:V}),l.$set(K);const nt={};$&4096&&(nt.$$scope={dirty:$,ctx:V}),!_&&$&4&&(_=!0,nt.lngLat=V[2],yc(()=>_=!1)),a.$set(nt);const ht={};$&4096&&(ht.$$scope={dirty:$,ctx:V}),!L&&$&2&&(L=!0,ht.lngLat=V[1],yc(()=>L=!1)),S.$set(ht)},i(V){A||(pt(P),pt(i.$$.fragment,V),pt(l.$$.fragment,V),pt(a.$$.fragment,V),pt(S.$$.fragment,V),A=!0)},o(V){bt(P),bt(i.$$.fragment,V),bt(l.$$.fragment,V),bt(a.$$.fragment,V),bt(S.$$.fragment,V),A=!1},d(V){V&&It(t),P&&P.d(),qt(i),qt(l),qt(a),qt(S)}}}function fk(e){let t,n;return t=new Wu({props:{$$slots:{map:[hk],sidebar:[ak],top:[sk]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&4159&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function pk(e,t,n){let i,r,l,f,a;Se(e,xn,B=>n(5,r=B)),Se(e,Km,B=>n(1,l=B)),Se(e,Ym,B=>n(2,f=B)),Se(e,Wo,B=>n(3,a=B));let{prevMode:_}=t;function x(){je(xn,r={mode:_},r)}function S(B){f=B,Ym.set(f)}function L(B){l=B,Km.set(l)}const A=()=>je(xn,r={mode:"title"},r),P=()=>je(xn,r={mode:"network"},r),O=()=>je(xn,r={mode:"neighbourhood"},r);return e.$$set=B=>{"prevMode"in B&&n(0,_=B.prevMode)},e.$$.update=()=>{e.$$.dirty&14&&n(4,i=JSON.parse(a.compareRoute(f.lng,f.lat,l.lng,l.lat)))},[_,l,f,a,i,r,x,S,L,A,P,O]}class dk extends nn{constructor(t){super(),en(this,t,pk,fk,He,{prevMode:0})}}const mk="/ltn/assets/settings-342fb430.svg";function Lb(e){let t,n;return t=new Ky({props:{$$slots:{default:[gk]},$$scope:{ctx:e}}}),t.$on("close",e[3]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&17&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function gk(e){let t,n,i,r,l,f,a,_,x;return i=new vI({}),{c(){t=wt("h1"),t.textContent="Settings",n=Xt(),Zt(i.$$.fragment),r=Xt(),l=wt("center"),f=wt("button"),f.textContent="Confirm"},m(S,L){Ct(S,t,L),Ct(S,n,L),jt(i,S,L),Ct(S,r,L),Ct(S,l,L),mt(l,f),a=!0,_||(x=Ze(f,"click",e[2]),_=!0)},p:Ie,i(S){a||(pt(i.$$.fragment,S),a=!0)},o(S){bt(i.$$.fragment,S),a=!1},d(S){S&&(It(t),It(n),It(r),It(l)),qt(i,S),_=!1,x()}}}function _k(e){let t,n,i,r,l,f,a=e[0]&&Lb(e);return{c(){t=wt("button"),t.innerHTML=`Settings`,n=Xt(),a&&a.c(),i=ts(),Rt(t,"class","outline")},m(_,x){Ct(_,t,x),Ct(_,n,x),a&&a.m(_,x),Ct(_,i,x),r=!0,l||(f=Ze(t,"click",e[1]),l=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&pt(a,1)):(a=Lb(_),a.c(),pt(a,1),a.m(i.parentNode,i)):a&&(ui(),bt(a,1,1,()=>{a=null}),ci())},i(_){r||(pt(a),r=!0)},o(_){bt(a),r=!1},d(_){_&&(It(t),It(n),It(i)),a&&a.d(_),l=!1,f()}}}function yk(e,t,n){let i=!1;return[i,()=>n(0,i=!0),()=>n(0,i=!1),()=>n(0,i=!1)]}class vk extends nn{constructor(t){super(),en(this,t,yk,_k,He,{})}}function bk(e){let t,n,i,r,l,f;const a=[Vr("route-points"),{filter:Lw},{paint:{"circle-color":Rp(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Rp(["get","type"],{node:Fm/2},Fm)}}];let _={};for(let P=0;Pn(0,i=r)),[i]}class Sk extends nn{constructor(t){super(),en(this,t,wk,xk,He,{})}}function Ek(e){let t,n,i;return{c(){t=be("Undo ("),n=be(e[1]),i=be(")")},m(r,l){Ct(r,t,l),Ct(r,n,l),Ct(r,i,l)},p(r,l){l&2&&Zi(n,r[1])},d(r){r&&(It(t),It(n),It(i))}}}function Ik(e){let t;return{c(){t=be("Undo")},m(n,i){Ct(n,t,i)},p:Ie,d(n){n&&It(t)}}}function Ck(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?Ik:Ek}let _=a(e),x=_(e);return{c(){t=wt("button"),x.c(),i=Xt(),r=wt("ul"),r.innerHTML=`
  • Click the map to add points
  • Click and drag any point to move it
  • Click a waypoint to delete it
  • Press Control+Z @@ -634,21 +634,21 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,t.disabled=n=e[1]==0},m(S,L){At(S,t,L),x.m(t,null),At(S,i,L),At(S,r,L),l||(f=be(t,"click",e[2]),l=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:we,o:we,d(S){S&&(kt(t),kt(i),kt(r)),x.d(),l=!1,f()}}}function uk(e,t,n){let i;Ee(e,ax,f=>n(1,i=f));let{route_tool:r}=t;const l=()=>r.undo();return e.$$set=f=>{"route_tool"in f&&n(0,r=f.route_tool)},[r,i,l]}class ck extends nn{constructor(t){super(),en(this,t,uk,lk,Ye,{route_tool:0})}}function hk(e){let t;return{c(){t=dt("li"),t.textContent="Creating new neighbourhood boundary"},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function fk(e){let t,n,i,r,l,f;return{c(){t=dt("li"),n=dt("a"),n.textContent="Editing modal filters",i=Zt(),r=dt("li"),r.textContent="Changing neighbourhood boundary",It(n,"href","#")},m(a,_){At(a,t,_),lt(t,n),At(a,i,_),At(a,r,_),l||(f=be(n,"click",e[8]),l=!0)},p:we,d(a){a&&(kt(t),kt(i),kt(r)),l=!1,f()}}}function pk(e){let t,n,i,r,l,f,a,_,x,S,L;function A(U,j){return U[1]?fk:hk}let k=A(e),R=k(e);return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),_=dt("a"),_.textContent="Pick neighbourhood",x=Zt(),R.c(),It(l,"href","#"),It(_,"href","#"),It(n,"aria-label","breadcrumb"),It(t,"slot","top")},m(U,j){At(U,t,j),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),lt(a,_),lt(i,x),R.m(i,null),S||(L=[be(l,"click",e[6]),be(_,"click",e[7])],S=!0)},p(U,j){k===(k=A(U))&&R?R.p(U,j):(R.d(1),R=k(U),R&&(R.c(),R.m(i,null)))},d(U){U&&kt(t),R.d(),S=!1,Wi(L)}}}function dk(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R,U,j;return k=new ck({props:{route_tool:yi(e[2])}}),{c(){t=dt("div"),n=dt("h1"),i=Xe("Draw your neighbourhood boundary for "),r=Xe(e[0]),l=Zt(),f=dt("div"),a=dt("a"),a.textContent="Finish",_=Zt(),x=dt("a"),x.textContent="Cancel",S=Zt(),L=dt("p"),L.textContent="TODO: maybe move the instructions from the previous screen to here...",A=Zt(),Qt(k.$$.fragment),It(a,"href","#"),It(x,"href","#"),pi(f,"display","flex"),pi(f,"justify-content","space-between"),It(t,"slot","sidebar")},m(Q,B){At(Q,t,B),lt(t,n),lt(n,i),lt(n,r),lt(t,l),lt(t,f),lt(f,a),lt(f,_),lt(f,x),lt(t,S),lt(t,L),lt(t,A),Kt(k,t,null),R=!0,U||(j=[be(a,"click",e[5]),be(x,"click",e[4])],U=!0)},p(Q,B){(!R||B&1)&&qi(r,Q[0]);const X={};B&4&&(X.route_tool=yi(Q[2])),k.$set(X)},i(Q){R||(wt(k.$$.fragment,Q),R=!0)},o(Q){Pt(k.$$.fragment,Q),R=!1},d(Q){Q&&kt(t),Jt(k),U=!1,Wi(j)}}}function mk(e){let t,n,i;return n=new ok({}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","map")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p:we,i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function gk(e){let t,n;return t=new Wu({props:{$$slots:{map:[mk],sidebar:[dk],top:[pk]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&1039&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function _k(e,t,n){let i,r,l;Ee(e,jp,k=>n(2,i=k)),Ee(e,xn,k=>n(3,r=k)),Ee(e,Wo,k=>n(9,l=k));let{name:f}=t,{existing:a}=t;a?i.editExistingArea(a):i.startArea();function _(){a?je(xn,r={mode:"neighbourhood"},r):je(xn,r={mode:"network"},r),i.clearEventListeners()}i.addEventListenerSuccess(k=>{try{l.setNeighbourhoodBoundary(f,k),l.setCurrentNeighbourhood(f),je(xn,r={mode:"neighbourhood"},r),i.clearEventListeners()}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),_()}}),i.addEventListenerFailure(_);const x=()=>yi(i).finish(),S=()=>je(xn,r={mode:"title"},r),L=()=>je(xn,r={mode:"network"},r),A=()=>je(xn,r={mode:"neighbourhood"},r);return e.$$set=k=>{"name"in k&&n(0,f=k.name),"existing"in k&&n(1,a=k.existing)},[f,a,i,r,_,x,S,L,A]}class yk extends nn{constructor(t){super(),en(this,t,_k,gk,Ye,{name:0,existing:1})}}function vk(e){let t,n,i,r,l,f;const a=[Vr("edit-polygon-fill"),{filter:Iw},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let _={};for(let k=0;kn(0,i=r)),[i]}class wk extends nn{constructor(t){super(),en(this,t,xk,bk,Ye,{})}}function Lb(e){let t,n;return t=new Ky({props:{$$slots:{default:[Sk,({dialog:i})=>({3:i}),({dialog:i})=>i?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&24&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function Sk(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R;function U(){return e[1](e[3])}return{c(){t=dt("h1"),t.textContent="The Low-traffic neighbourhood (LTN) tool, v2",n=Zt(),i=dt("p"),i.innerHTML=`This is an experimental + to cancel`,t.disabled=n=e[1]==0},m(S,L){Ct(S,t,L),x.m(t,null),Ct(S,i,L),Ct(S,r,L),l||(f=Ze(t,"click",e[2]),l=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:Ie,o:Ie,d(S){S&&(It(t),It(i),It(r)),x.d(),l=!1,f()}}}function Tk(e,t,n){let i;Se(e,lx,f=>n(1,i=f));let{route_tool:r}=t;const l=()=>r.undo();return e.$$set=f=>{"route_tool"in f&&n(0,r=f.route_tool)},[r,i,l]}class Lk extends nn{constructor(t){super(),en(this,t,Tk,Ck,He,{route_tool:0})}}function Mk(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function Pk(e){let t;return{c(){t=be("Pick neighbourhood")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function kk(e){let t;return{c(){t=wt("li"),t.textContent="Creating new neighbourhood boundary"},m(n,i){Ct(n,t,i)},p:Ie,i:Ie,o:Ie,d(n){n&&It(t)}}}function Ak(e){let t,n,i,r,l;return n=new bi({props:{$$slots:{default:[Nk]},$$scope:{ctx:e}}}),n.$on("click",e[8]),{c(){t=wt("li"),Zt(n.$$.fragment),i=Xt(),r=wt("li"),r.textContent="Changing neighbourhood boundary"},m(f,a){Ct(f,t,a),jt(n,t,null),Ct(f,i,a),Ct(f,r,a),l=!0},p(f,a){const _={};a&1024&&(_.$$scope={dirty:a,ctx:f}),n.$set(_)},i(f){l||(pt(n.$$.fragment,f),l=!0)},o(f){bt(n.$$.fragment,f),l=!1},d(f){f&&(It(t),It(i),It(r)),qt(n)}}}function Nk(e){let t;return{c(){t=be("Editing modal filters")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function Dk(e){let t,n,i,r,l,f,a,_,x,S,L,A;l=new bi({props:{$$slots:{default:[Mk]},$$scope:{ctx:e}}}),l.$on("click",e[6]),_=new bi({props:{$$slots:{default:[Pk]},$$scope:{ctx:e}}}),_.$on("click",e[7]);const P=[Ak,kk],O=[];function B(U,Y){return U[1]?0:1}return S=B(e),L=O[S]=P[S](e),{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),Zt(_.$$.fragment),x=Xt(),L.c(),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(U,Y){Ct(U,t,Y),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),jt(_,a,null),mt(i,x),O[S].m(i,null),A=!0},p(U,Y){const V={};Y&1024&&(V.$$scope={dirty:Y,ctx:U}),l.$set(V);const $={};Y&1024&&($.$$scope={dirty:Y,ctx:U}),_.$set($);let K=S;S=B(U),S===K?O[S].p(U,Y):(ui(),bt(O[K],1,1,()=>{O[K]=null}),ci(),L=O[S],L?L.p(U,Y):(L=O[S]=P[S](U),L.c()),pt(L,1),L.m(i,null))},i(U){A||(pt(l.$$.fragment,U),pt(_.$$.fragment,U),pt(L),A=!0)},o(U){bt(l.$$.fragment,U),bt(_.$$.fragment,U),bt(L),A=!1},d(U){U&&It(t),qt(l),qt(_),O[S].d()}}}function Rk(e){let t;return{c(){t=be("Finish")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function Ok(e){let t;return{c(){t=be("Cancel")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function zk(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O;return a=new bi({props:{$$slots:{default:[Rk]},$$scope:{ctx:e}}}),a.$on("click",e[5]),x=new bi({props:{$$slots:{default:[Ok]},$$scope:{ctx:e}}}),x.$on("click",e[4]),P=new Lk({props:{route_tool:xi(e[2])}}),{c(){t=wt("div"),n=wt("h1"),i=be("Draw your neighbourhood boundary for "),r=be(e[0]),l=Xt(),f=wt("div"),Zt(a.$$.fragment),_=Xt(),Zt(x.$$.fragment),S=Xt(),L=wt("p"),L.textContent="TODO: maybe move the instructions from the previous screen to here...",A=Xt(),Zt(P.$$.fragment),mi(f,"display","flex"),mi(f,"justify-content","space-between"),Rt(t,"slot","sidebar")},m(B,U){Ct(B,t,U),mt(t,n),mt(n,i),mt(n,r),mt(t,l),mt(t,f),jt(a,f,null),mt(f,_),jt(x,f,null),mt(t,S),mt(t,L),mt(t,A),jt(P,t,null),O=!0},p(B,U){(!O||U&1)&&Zi(r,B[0]);const Y={};U&1024&&(Y.$$scope={dirty:U,ctx:B}),a.$set(Y);const V={};U&1024&&(V.$$scope={dirty:U,ctx:B}),x.$set(V);const $={};U&4&&($.route_tool=xi(B[2])),P.$set($)},i(B){O||(pt(a.$$.fragment,B),pt(x.$$.fragment,B),pt(P.$$.fragment,B),O=!0)},o(B){bt(a.$$.fragment,B),bt(x.$$.fragment,B),bt(P.$$.fragment,B),O=!1},d(B){B&&It(t),qt(a),qt(x),qt(P)}}}function Fk(e){let t,n,i;return n=new Sk({}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p:Ie,i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function Bk(e){let t,n;return t=new Wu({props:{$$slots:{map:[Fk],sidebar:[zk],top:[Dk]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&1039&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Vk(e,t,n){let i,r,l;Se(e,qp,P=>n(2,i=P)),Se(e,xn,P=>n(3,r=P)),Se(e,Wo,P=>n(9,l=P));let{name:f}=t,{existing:a}=t;a?i.editExistingArea(a):i.startArea();function _(){a?je(xn,r={mode:"neighbourhood"},r):je(xn,r={mode:"network"},r),i.clearEventListeners()}i.addEventListenerSuccess(P=>{try{l.setNeighbourhoodBoundary(f,P),l.setCurrentNeighbourhood(f),je(xn,r={mode:"neighbourhood"},r),i.clearEventListeners()}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),_()}}),i.addEventListenerFailure(_);const x=()=>xi(i).finish(),S=()=>je(xn,r={mode:"title"},r),L=()=>je(xn,r={mode:"network"},r),A=()=>je(xn,r={mode:"neighbourhood"},r);return e.$$set=P=>{"name"in P&&n(0,f=P.name),"existing"in P&&n(1,a=P.existing)},[f,a,i,r,_,x,S,L,A]}class Uk extends nn{constructor(t){super(),en(this,t,Vk,Bk,He,{name:0,existing:1})}}function Gk(e){let t,n,i,r,l,f;const a=[Vr("edit-polygon-fill"),{filter:Cw},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let _={};for(let P=0;Pn(0,i=r)),[i]}class Zk extends nn{constructor(t){super(),en(this,t,qk,jk,He,{})}}function Mb(e){let t,n;return t=new Ky({props:{$$slots:{default:[$k,({dialog:i})=>({3:i}),({dialog:i})=>i?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&24&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function $k(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O;function B(){return e[1](e[3])}return{c(){t=wt("h1"),t.textContent="The Low-traffic neighbourhood (LTN) tool, v2",n=Xt(),i=wt("p"),i.innerHTML=`This is an experimental version of the A/B Street LTN tool . Most parts of it do not work yet, and you should probably use the other version - of the tool instead.`,r=Zt(),l=dt("p"),l.textContent="To use this tool, you need to:",f=Zt(),a=dt("ol"),a.innerHTML=`
  • Choose your study area to analyze
  • Define one or more neighbourhood boundaries
  • Optionally, to fix the basemap data on existing modal filters, turn + of the tool instead.`,r=Xt(),l=wt("p"),l.textContent="To use this tool, you need to:",f=Xt(),a=wt("ol"),a.innerHTML=`
  • Choose your study area to analyze
  • Define one or more neighbourhood boundaries
  • Optionally, to fix the basemap data on existing modal filters, turn restrictions, one-ways, etc
  • To create one or more proposals with new modal filters, and explore - their effects
  • `,_=Zt(),x=dt("p"),x.innerHTML=`This tool is created by Dustin Carlino + their effects`,_=Xt(),x=wt("p"),x.innerHTML=`This tool is created by Dustin Carlino and relies heavily on OpenStreetMap - data.`,S=Zt(),L=dt("center"),A=dt("button"),A.textContent="Start!"},m(j,Q){At(j,t,Q),At(j,n,Q),At(j,i,Q),At(j,r,Q),At(j,l,Q),At(j,f,Q),At(j,a,Q),At(j,_,Q),At(j,x,Q),At(j,S,Q),At(j,L,Q),lt(L,A),k||(R=be(A,"click",U),k=!0)},p(j,Q){e=j},d(j){j&&(kt(t),kt(n),kt(i),kt(r),kt(l),kt(f),kt(a),kt(_),kt(x),kt(S),kt(L)),k=!1,R()}}}function Ek(e){let t,n,i=e[0]&&Lb(e);return{c(){i&&i.c(),t=$o()},m(r,l){i&&i.m(r,l),At(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&wt(i,1)):(i=Lb(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ti(),Pt(i,1,1,()=>{i=null}),Li())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&kt(t),i&&i.d(r)}}}function Ik(e,t,n){let i;return Ee(e,Hm,f=>n(0,i=f)),[i,f=>yi(f).close(),()=>je(Hm,i=!1,i)]}class Ck extends nn{constructor(t){super(),en(this,t,Ik,Ek,Ye,{})}}function Mb(e,t,n){const i=e.slice();return i[22]=t[n][0],i[23]=t[n][1],i}function Pb(e,t,n){const i=e.slice();return i[26]=t[n][0],i[27]=t[n][1],i}function kb(e){let t,n=e[27]+"",i,r;return{c(){t=dt("option"),i=Xe(n),t.__value=r=e[26],jl(t,t.__value)},m(l,f){At(l,t,f),lt(t,i)},p(l,f){f&4&&n!==(n=l[27]+"")&&qi(i,n),f&4&&r!==(r=l[26])&&(t.__value=r,jl(t,t.__value))},d(l){l&&kt(t)}}}function Ab(e){let t,n,i=aa(e[23]),r=[];for(let l=0;le[9].call(l)),It(A,"type","file")},m(ft,mt){Kt(t,ft,mt),At(ft,n,mt),At(ft,i,mt),lt(i,r),lt(i,l),lt(l,f);for(let _t=0;_tn(15,i=ct)),Ee(e,Mu,ct=>n(4,r=ct)),Ee(e,Km,ct=>n(16,l=ct)),Ee(e,Ym,ct=>n(17,f=ct)),Ee(e,Nu,ct=>n(5,a=ct)),Ee(e,jp,ct=>n(18,_=ct)),Ee(e,xn,ct=>n(19,x=ct));let S=null,L=!1,A=[];pg(async()=>{try{let ct=await fetch("/osm/areas.json");if(ct.ok)L=!0,console.log("Using local cache, not od2net.org"),n(2,A=await ct.json());else{let Mt=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,A=await Mt.json())}}catch{}});let k;async function R(ct){try{U(await k.files[0].arrayBuffer()),je(Mu,r="",r)}catch(Mt){window.alert(`Couldn't open this file: ${Mt}`)}n(1,S=null)}function U(ct){n(1,S="Building map model from OSM input"),console.time("load"),je(Wo,i=new HS(new Uint8Array(ct),r==""?void 0:r),i),console.timeEnd("load");let Mt=`ltn_${r||"custom"}.geojson`,xt=window.localStorage.getItem(Mt);if(xt)try{i.loadSavefile(JSON.parse(xt))}catch(vt){console.log(`Didn't restore from local storage ${Mt}: ${vt}`)}je(xn,x={mode:"network"},x),je(jp,_=new mI(a,i.toRouteSnapper()),_),a.fitBounds(Array.from(i.getBounds()),{animate:!1}),je(Ym,f=X(),f),je(Km,l=X(),l)}function j(ct){try{U(new TextEncoder().encode(ct.detail)),je(Mu,r="",r)}catch(Mt){window.alert(`Couldn't import from Overpass: ${Mt}`)}n(1,S=null)}async function Q(ct){ct!=""&&(L?await B(`/osm/${ct}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${ct}.pbf`))}async function B(ct){try{n(1,S=`Downloading ${ct}`);let Mt=await fetch(ct);U(await Mt.arrayBuffer())}catch(Mt){window.alert(`Couldn't open from URL ${ct}: ${Mt}`)}n(1,S=null)}function X(){let ct=i.getBounds(),Mt=ct[0]+Math.random()*(ct[2]-ct[0]),xt=ct[1]+Math.random()*(ct[3]-ct[1]);return new dg.LngLat(Mt,xt)}function J(){r=Ub(this),Mu.set(r),n(2,A)}const it=()=>Q(r);function ft(ct){cr[ct?"unshift":"push"](()=>{k=ct,n(3,k)})}return[Q,S,A,k,r,a,R,j,U,J,it,ft,ct=>n(1,S=ct.detail),ct=>window.alert(ct.detail)]}class Mk extends nn{constructor(t){super(),en(this,t,Lk,Tk,Ye,{loadMap:8,loadExample:0})}get loadMap(){return this.$$.ctx[8]}get loadExample(){return this.$$.ctx[0]}}function Pk(e){let t;return{c(){t=dt("div"),t.innerHTML='',It(t,"slot","top")},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function Nb(e){let t,n,i,r,l;return{c(){t=dt("label"),n=Xe(`Load a project from a file - `),i=dt("input"),It(i,"type","file")},m(f,a){At(f,t,a),lt(t,n),lt(t,i),e[7](i),r||(l=be(i,"change",e[5]),r=!0)},p:we,d(f){f&&kt(t),e[7](null),r=!1,l()}}}function kk(e){let t;return{c(){t=dt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,i){At(n,t,i)},p:we,i:we,o:we,d(n){n&&kt(t)}}}function Ak(e){let t,n,i={};return t=new Mk({props:i}),e[8](t),{c(){Qt(t.$$.fragment)},m(r,l){Kt(t,r,l),n=!0},p(r,l){const f={};t.$set(f)},i(r){n||(wt(t.$$.fragment,r),n=!0)},o(r){Pt(t.$$.fragment,r),n=!1},d(r){e[8](null),Jt(t,r)}}}function Nk(e){let t,n,i,r,l,f,a,_,x,S,L,A,k;n=new Ck({});let R=e[1]&&Nb(e);const U=[Ak,kk],j=[];function Q(B,X){return B[4]&&B[0]?0:1}return x=Q(e),S=j[x]=U[x](e),{c(){t=dt("div"),Qt(n.$$.fragment),i=Zt(),r=dt("button"),r.textContent="About the LTN tool",l=Zt(),R&&R.c(),f=Zt(),a=dt("hr"),_=Zt(),S.c(),It(t,"slot","sidebar")},m(B,X){At(B,t,X),Kt(n,t,null),lt(t,i),lt(t,r),lt(t,l),R&&R.m(t,null),lt(t,f),lt(t,a),lt(t,_),j[x].m(t,null),L=!0,A||(k=be(r,"click",e[6]),A=!0)},p(B,X){B[1]?R?R.p(B,X):(R=Nb(B),R.c(),R.m(t,f)):R&&(R.d(1),R=null);let J=x;x=Q(B),x===J?j[x].p(B,X):(Ti(),Pt(j[J],1,1,()=>{j[J]=null}),Li(),S=j[x],S?S.p(B,X):(S=j[x]=U[x](B),S.c()),wt(S,1),S.m(t,null))},i(B){L||(wt(n.$$.fragment,B),wt(S),L=!0)},o(B){Pt(n.$$.fragment,B),Pt(S),L=!1},d(B){B&&kt(t),Jt(n),R&&R.d(),j[x].d(),A=!1,k()}}}function Dk(e){let t,n,i;return n=new wk({}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","map")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p:we,i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function Rk(e){let t,n;return t=new Wu({props:{$$slots:{map:[Dk],sidebar:[Nk],top:[Pk]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&4127&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function Ok(e,t,n){let i,r,l,f,a;Ee(e,Mu,U=>n(9,i=U)),Ee(e,jp,U=>n(10,r=U)),Ee(e,Wo,U=>n(11,l=U)),Ee(e,Hm,U=>n(3,f=U)),Ee(e,Nu,U=>n(4,a=U));let{wasmReady:_}=t;je(Wo,l=null,l),je(jp,r=null,r);let x,S;async function L(U){try{let j=JSON.parse(await S.files[0].text());if(j.study_area_name)je(Mu,i=j.study_area_name,i),window.localStorage.setItem(`ltn_${j.study_area_name}.geojson`,JSON.stringify(j)),await x.loadExample(j.study_area_name);else{je(Mu,i="",i);let Q=j.features.find(J=>J.properties.kind=="study_area_boundary"),X=await(await fetch(Mw(Q))).arrayBuffer();window.localStorage.setItem("ltn_custom.geojson",JSON.stringify(j)),x.loadMap(X)}}catch(j){window.alert(`Couldn't open this file: ${j}`)}}const A=()=>je(Hm,f=!0,f);function k(U){cr[U?"unshift":"push"](()=>{S=U,n(2,S)})}function R(U){cr[U?"unshift":"push"](()=>{x=U,n(1,x)})}return e.$$set=U=>{"wasmReady"in U&&n(0,_=U.wasmReady)},[_,x,S,f,a,L,A,k,R]}class zk extends nn{constructor(t){super(),en(this,t,Ok,Rk,Ye,{wasmReady:0})}}const{window:Fk}=MS;function Bk(e){let t,n,i,r,l,f,a,_,x,S,L,A,k,R,U;return{c(){t=dt("div"),n=dt("nav"),i=dt("ul"),r=dt("li"),l=dt("a"),l.textContent="Choose study area",f=Zt(),a=dt("li"),_=dt("a"),_.textContent="Pick neighbourhood",x=Zt(),S=dt("li"),L=dt("a"),L.textContent="Editing modal filters",A=Zt(),k=dt("li"),k.textContent="Viewing shortcuts",It(l,"href","#"),It(_,"href","#"),It(L,"href","#"),It(n,"aria-label","breadcrumb"),It(t,"slot","top")},m(j,Q){At(j,t,Q),lt(t,n),lt(n,i),lt(i,r),lt(r,l),lt(i,f),lt(i,a),lt(a,_),lt(i,x),lt(i,S),lt(S,L),lt(i,A),lt(i,k),R||(U=[be(l,"click",e[9]),be(_,"click",e[10]),be(L,"click",e[5])],R=!0)},p:we,d(j){j&&kt(t),R=!1,Wi(U)}}}function Vk(e){let t,n,i,r,l,f,a,_,x,S=e[0].shortcutIndex+1+"",L,A,k=e[0].gj.features.length+"",R,U,j,Q,B,X,J;return{c(){t=dt("p"),t.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. + data.`,S=Xt(),L=wt("center"),A=wt("button"),A.textContent="Start!"},m(U,Y){Ct(U,t,Y),Ct(U,n,Y),Ct(U,i,Y),Ct(U,r,Y),Ct(U,l,Y),Ct(U,f,Y),Ct(U,a,Y),Ct(U,_,Y),Ct(U,x,Y),Ct(U,S,Y),Ct(U,L,Y),mt(L,A),P||(O=Ze(A,"click",B),P=!0)},p(U,Y){e=U},d(U){U&&(It(t),It(n),It(i),It(r),It(l),It(f),It(a),It(_),It(x),It(S),It(L)),P=!1,O()}}}function Wk(e){let t,n,i=e[0]&&Mb(e);return{c(){i&&i.c(),t=ts()},m(r,l){i&&i.m(r,l),Ct(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&pt(i,1)):(i=Mb(r),i.c(),pt(i,1),i.m(t.parentNode,t)):i&&(ui(),bt(i,1,1,()=>{i=null}),ci())},i(r){n||(pt(i),n=!0)},o(r){bt(i),n=!1},d(r){r&&It(t),i&&i.d(r)}}}function Xk(e,t,n){let i;return Se(e,Hm,f=>n(0,i=f)),[i,f=>xi(f).close(),()=>je(Hm,i=!1,i)]}class Hk extends nn{constructor(t){super(),en(this,t,Xk,Wk,He,{})}}function Pb(e,t,n){const i=e.slice();return i[22]=t[n][0],i[23]=t[n][1],i}function kb(e,t,n){const i=e.slice();return i[26]=t[n][0],i[27]=t[n][1],i}function Ab(e){let t,n=e[27]+"",i,r;return{c(){t=wt("option"),i=be(n),t.__value=r=e[26],ql(t,t.__value)},m(l,f){Ct(l,t,f),mt(t,i)},p(l,f){f&4&&n!==(n=l[27]+"")&&Zi(i,n),f&4&&r!==(r=l[26])&&(t.__value=r,ql(t,t.__value))},d(l){l&&It(t)}}}function Nb(e){let t,n,i=la(e[23]),r=[];for(let l=0;le[9].call(l)),Rt(A,"type","file")},m(ht,dt){jt(t,ht,dt),Ct(ht,n,dt),Ct(ht,i,dt),mt(i,r),mt(i,l),mt(l,f);for(let gt=0;gtn(15,i=ut)),Se(e,Pu,ut=>n(4,r=ut)),Se(e,Km,ut=>n(16,l=ut)),Se(e,Ym,ut=>n(17,f=ut)),Se(e,Du,ut=>n(5,a=ut)),Se(e,qp,ut=>n(18,_=ut)),Se(e,xn,ut=>n(19,x=ut));let S=null,L=!1,A=[];dg(async()=>{try{let ut=await fetch("/osm/areas.json");if(ut.ok)L=!0,console.log("Using local cache, not od2net.org"),n(2,A=await ut.json());else{let Et=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,A=await Et.json())}}catch{}});let P;async function O(ut){try{B(await P.files[0].arrayBuffer()),je(Pu,r="",r)}catch(Et){window.alert(`Couldn't open this file: ${Et}`)}n(1,S=null)}function B(ut){n(1,S="Building map model from OSM input"),console.time("load"),je(Wo,i=new HS(new Uint8Array(ut),r==""?void 0:r),i),console.timeEnd("load");let Et=`ltn_${r||"custom"}.geojson`,yt=window.localStorage.getItem(Et);if(yt)try{i.loadSavefile(JSON.parse(yt))}catch(xt){console.log(`Didn't restore from local storage ${Et}: ${xt}`)}je(xn,x={mode:"network"},x),je(qp,_=new gI(a,i.toRouteSnapper()),_),a.fitBounds(Array.from(i.getBounds()),{animate:!1}),je(Ym,f=$(),f),je(Km,l=$(),l)}function U(ut){try{B(new TextEncoder().encode(ut.detail)),je(Pu,r="",r)}catch(Et){window.alert(`Couldn't import from Overpass: ${Et}`)}n(1,S=null)}async function Y(ut){ut!=""&&(L?await V(`/osm/${ut}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${ut}.pbf`))}async function V(ut){try{n(1,S=`Downloading ${ut}`);let Et=await fetch(ut);B(await Et.arrayBuffer())}catch(Et){window.alert(`Couldn't open from URL ${ut}: ${Et}`)}n(1,S=null)}function $(){let ut=i.getBounds(),Et=ut[0]+Math.random()*(ut[2]-ut[0]),yt=ut[1]+Math.random()*(ut[3]-ut[1]);return new mg.LngLat(Et,yt)}function K(){r=Gb(this),Pu.set(r),n(2,A)}const nt=()=>Y(r);function ht(ut){cr[ut?"unshift":"push"](()=>{P=ut,n(3,P)})}return[Y,S,A,P,r,a,O,U,B,K,nt,ht,ut=>n(1,S=ut.detail),ut=>window.alert(ut.detail)]}class Jk extends nn{constructor(t){super(),en(this,t,Kk,Yk,He,{loadMap:8,loadExample:0})}get loadMap(){return this.$$.ctx[8]}get loadExample(){return this.$$.ctx[0]}}function Qk(e){let t;return{c(){t=wt("div"),t.innerHTML='',Rt(t,"slot","top")},m(n,i){Ct(n,t,i)},p:Ie,d(n){n&&It(t)}}}function Db(e){let t,n,i,r,l;return{c(){t=wt("label"),n=be(`Load a project from a file + `),i=wt("input"),Rt(i,"type","file")},m(f,a){Ct(f,t,a),mt(t,n),mt(t,i),e[7](i),r||(l=Ze(i,"change",e[5]),r=!0)},p:Ie,d(f){f&&It(t),e[7](null),r=!1,l()}}}function tA(e){let t;return{c(){t=wt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,i){Ct(n,t,i)},p:Ie,i:Ie,o:Ie,d(n){n&&It(t)}}}function eA(e){let t,n,i={};return t=new Jk({props:i}),e[8](t),{c(){Zt(t.$$.fragment)},m(r,l){jt(t,r,l),n=!0},p(r,l){const f={};t.$set(f)},i(r){n||(pt(t.$$.fragment,r),n=!0)},o(r){bt(t.$$.fragment,r),n=!1},d(r){e[8](null),qt(t,r)}}}function nA(e){let t,n,i,r,l,f,a,_,x,S,L,A,P;n=new Hk({});let O=e[1]&&Db(e);const B=[eA,tA],U=[];function Y(V,$){return V[4]&&V[0]?0:1}return x=Y(e),S=U[x]=B[x](e),{c(){t=wt("div"),Zt(n.$$.fragment),i=Xt(),r=wt("button"),r.textContent="About the LTN tool",l=Xt(),O&&O.c(),f=Xt(),a=wt("hr"),_=Xt(),S.c(),Rt(t,"slot","sidebar")},m(V,$){Ct(V,t,$),jt(n,t,null),mt(t,i),mt(t,r),mt(t,l),O&&O.m(t,null),mt(t,f),mt(t,a),mt(t,_),U[x].m(t,null),L=!0,A||(P=Ze(r,"click",e[6]),A=!0)},p(V,$){V[1]?O?O.p(V,$):(O=Db(V),O.c(),O.m(t,f)):O&&(O.d(1),O=null);let K=x;x=Y(V),x===K?U[x].p(V,$):(ui(),bt(U[K],1,1,()=>{U[K]=null}),ci(),S=U[x],S?S.p(V,$):(S=U[x]=B[x](V),S.c()),pt(S,1),S.m(t,null))},i(V){L||(pt(n.$$.fragment,V),pt(S),L=!0)},o(V){bt(n.$$.fragment,V),bt(S),L=!1},d(V){V&&It(t),qt(n),O&&O.d(),U[x].d(),A=!1,P()}}}function iA(e){let t,n,i;return n=new Zk({}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p:Ie,i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function rA(e){let t,n;return t=new Wu({props:{$$slots:{map:[iA],sidebar:[nA],top:[Qk]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&4127&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function oA(e,t,n){let i,r,l,f,a;Se(e,Pu,B=>n(9,i=B)),Se(e,qp,B=>n(10,r=B)),Se(e,Wo,B=>n(11,l=B)),Se(e,Hm,B=>n(3,f=B)),Se(e,Du,B=>n(4,a=B));let{wasmReady:_}=t;je(Wo,l=null,l),je(qp,r=null,r);let x,S;async function L(B){try{let U=JSON.parse(await S.files[0].text());if(U.study_area_name)je(Pu,i=U.study_area_name,i),window.localStorage.setItem(`ltn_${U.study_area_name}.geojson`,JSON.stringify(U)),await x.loadExample(U.study_area_name);else{je(Pu,i="",i);let Y=U.features.find(K=>K.properties.kind=="study_area_boundary"),$=await(await fetch(Pw(Y))).arrayBuffer();window.localStorage.setItem("ltn_custom.geojson",JSON.stringify(U)),x.loadMap($)}}catch(U){window.alert(`Couldn't open this file: ${U}`)}}const A=()=>je(Hm,f=!0,f);function P(B){cr[B?"unshift":"push"](()=>{S=B,n(2,S)})}function O(B){cr[B?"unshift":"push"](()=>{x=B,n(1,x)})}return e.$$set=B=>{"wasmReady"in B&&n(0,_=B.wasmReady)},[_,x,S,f,a,L,A,P,O]}class sA extends nn{constructor(t){super(),en(this,t,oA,rA,He,{wasmReady:0})}}const{window:aA}=PS;function lA(e){let t;return{c(){t=be("Choose study area")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function uA(e){let t;return{c(){t=be("Pick neighbourhood")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function cA(e){let t;return{c(){t=be("Editing modal filters")},m(n,i){Ct(n,t,i)},d(n){n&&It(t)}}}function hA(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,O;return l=new bi({props:{$$slots:{default:[lA]},$$scope:{ctx:e}}}),l.$on("click",e[9]),_=new bi({props:{$$slots:{default:[uA]},$$scope:{ctx:e}}}),_.$on("click",e[10]),L=new bi({props:{$$slots:{default:[cA]},$$scope:{ctx:e}}}),L.$on("click",e[5]),{c(){t=wt("div"),n=wt("nav"),i=wt("ul"),r=wt("li"),Zt(l.$$.fragment),f=Xt(),a=wt("li"),Zt(_.$$.fragment),x=Xt(),S=wt("li"),Zt(L.$$.fragment),A=Xt(),P=wt("li"),P.textContent="Viewing shortcuts",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(B,U){Ct(B,t,U),mt(t,n),mt(n,i),mt(i,r),jt(l,r,null),mt(i,f),mt(i,a),jt(_,a,null),mt(i,x),mt(i,S),jt(L,S,null),mt(i,A),mt(i,P),O=!0},p(B,U){const Y={};U&8192&&(Y.$$scope={dirty:U,ctx:B}),l.$set(Y);const V={};U&8192&&(V.$$scope={dirty:U,ctx:B}),_.$set(V);const $={};U&8192&&($.$$scope={dirty:U,ctx:B}),L.$set($)},i(B){O||(pt(l.$$.fragment,B),pt(_.$$.fragment,B),pt(L.$$.fragment,B),O=!0)},o(B){bt(l.$$.fragment,B),bt(_.$$.fragment,B),bt(L.$$.fragment,B),O=!1},d(B){B&&It(t),qt(l),qt(_),qt(L)}}}function fA(e){let t,n,i,r,l,f,a,_,x,S=e[0].shortcutIndex+1+"",L,A,P=e[0].gj.features.length+"",O,B,U,Y,V,$,K;return{c(){t=wt("p"),t.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. A shortcut is defined as a route starting and ending outside the neighbourhood, but cutting through it. It might not actually be considered a "good shortcut" in practice -- this tool doesn't know any real traffic patterns; it's just looking for any possible path. This - view lets you understand the limits of this assumption.`,n=Zt(),i=dt("button"),i.textContent="Pick a different road",r=Zt(),l=dt("div"),f=dt("button"),a=Xe("Previous"),x=Zt(),L=Xe(S),A=Xe(" / "),R=Xe(k),U=Zt(),j=dt("button"),Q=Xe("Next"),f.disabled=_=e[0].shortcutIndex==0,j.disabled=B=e[0].shortcutIndex==e[0].gj.features.length-1,pi(l,"display","flex"),pi(l,"justify-content","space-between")},m(it,ft){At(it,t,ft),At(it,n,ft),At(it,i,ft),At(it,r,ft),At(it,l,ft),lt(l,f),lt(f,a),lt(l,x),lt(l,L),lt(l,A),lt(l,R),lt(l,U),lt(l,j),lt(j,Q),X||(J=[be(i,"click",e[8]),be(f,"click",e[6]),be(j,"click",e[7])],X=!0)},p(it,ft){ft&1&&_!==(_=it[0].shortcutIndex==0)&&(f.disabled=_),ft&1&&S!==(S=it[0].shortcutIndex+1+"")&&qi(L,S),ft&1&&k!==(k=it[0].gj.features.length+"")&&qi(R,k),ft&1&&B!==(B=it[0].shortcutIndex==it[0].gj.features.length-1)&&(j.disabled=B)},d(it){it&&(kt(t),kt(n),kt(i),kt(r),kt(l)),X=!1,Wi(J)}}}function Uk(e){let t;return{c(){t=dt("p"),t.textContent="Click a road to see shortcuts"},m(n,i){At(n,t,i)},p:we,d(n){n&&kt(t)}}}function Gk(e){let t,n,i,r;n=new Ag({}),n.$on("click",e[5]);function l(_,x){if(_[0].state=="neutral")return Uk;if(_[0].state=="chose-road")return Vk}let f=l(e),a=f&&f(e);return{c(){t=dt("div"),Qt(n.$$.fragment),i=Zt(),a&&a.c(),It(t,"slot","sidebar")},m(_,x){At(_,t,x),Kt(n,t,null),lt(t,i),a&&a.m(t,null),r=!0},p(_,x){f===(f=l(_))&&a?a.p(_,x):(a&&a.d(1),a=f&&f(_),a&&(a.c(),a.m(t,null)))},i(_){r||(wt(n.$$.fragment,_),r=!0)},o(_){Pt(n.$$.fragment,_),r=!1},d(_){_&&kt(t),Jt(n),a&&a.d()}}}function jk(e){let t,n,i,r,l,f;return t=new Ms({props:{data:Cy(JSON.parse(yi(e[2]).renderNeighbourhood())),$$slots:{default:[Zk]},$$scope:{ctx:e}}}),i=new Ms({props:{data:e[0].gj.features[e[0].shortcutIndex],$$slots:{default:[Wk]},$$scope:{ctx:e}}}),l=new Ms({props:{data:e[0].roadGj,$$slots:{default:[Xk]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment),n=Zt(),Qt(i.$$.fragment),r=Zt(),Qt(l.$$.fragment)},m(a,_){Kt(t,a,_),At(a,n,_),Kt(i,a,_),At(a,r,_),Kt(l,a,_),f=!0},p(a,_){const x={};_&4&&(x.data=Cy(JSON.parse(yi(a[2]).renderNeighbourhood()))),_&8192&&(x.$$scope={dirty:_,ctx:a}),t.$set(x);const S={};_&1&&(S.data=a[0].gj.features[a[0].shortcutIndex]),_&8192&&(S.$$scope={dirty:_,ctx:a}),i.$set(S);const L={};_&1&&(L.data=a[0].roadGj),_&8192&&(L.$$scope={dirty:_,ctx:a}),l.$set(L)},i(a){f||(wt(t.$$.fragment,a),wt(i.$$.fragment,a),wt(l.$$.fragment,a),f=!0)},o(a){Pt(t.$$.fragment,a),Pt(i.$$.fragment,a),Pt(l.$$.fragment,a),f=!1},d(a){a&&(kt(n),kt(r)),Jt(t,a),Jt(i,a),Jt(l,a)}}}function qk(e){let t,n;return t=new Ng({props:{gjInput:JSON.parse(yi(e[2]).renderNeighbourhood()),onClickLine:e[3],$$slots:{"line-popup":[Yk]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&4&&(l.gjInput=JSON.parse(yi(i[2]).renderNeighbourhood())),r&8192&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function Zk(e){let t,n;const i=[Vr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let r={};for(let l=0;l({12:r}),({props:r})=>r?4096:0]},$$scope:{ctx:e}}}),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","line-popup")},m(r,l){At(r,t,l),Kt(n,t,null),i=!0},p(r,l){const f={};l&12288&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&kt(t),Jt(n)}}}function Kk(e){let t,n,i,r,l,f;const a=[qk,jk],_=[];function x(S,L){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(n=x(e))&&(i=_[n]=a[n](e)),l=new Dg({}),{c(){t=dt("div"),i&&i.c(),r=Zt(),Qt(l.$$.fragment),It(t,"slot","map")},m(S,L){At(S,t,L),~n&&_[n].m(t,null),lt(t,r),Kt(l,t,null),f=!0},p(S,L){let A=n;n=x(S),n===A?~n&&_[n].p(S,L):(i&&(Ti(),Pt(_[A],1,1,()=>{_[A]=null}),Li()),~n?(i=_[n],i?i.p(S,L):(i=_[n]=a[n](S),i.c()),wt(i,1),i.m(t,r)):i=null)},i(S){f||(wt(i),wt(l.$$.fragment,S),f=!0)},o(S){Pt(i),Pt(l.$$.fragment,S),f=!1},d(S){S&&kt(t),~n&&_[n].d(),Jt(l)}}}function Jk(e){let t,n,i,r;return t=new Wu({props:{$$slots:{map:[Kk],sidebar:[Gk],top:[Bk]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(l,f){Kt(t,l,f),n=!0,i||(r=be(Fk,"keydown",e[4]),i=!0)},p(l,[f]){const a={};f&8199&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(wt(t.$$.fragment,l),n=!0)},o(l){Pt(t.$$.fragment,l),n=!1},d(l){Jt(t,l),i=!1,r()}}}function Qk(e,t,n){let i,r,l;Ee(e,xn,U=>n(1,i=U)),Ee(e,Nu,U=>n(11,r=U)),Ee(e,Wo,U=>n(2,l=U));let f={state:"neutral"};function a(U){let j=JSON.parse(l.getShortcutsCrossingRoad(U.properties.id));if(j.features.length==0){window.alert("No shortcuts here");return}n(0,f={state:"chose-road",roadGj:U,gj:j,shortcutIndex:0})}pg(()=>{r==null||r.keyboard.disable()}),sa(()=>{r==null||r.keyboard.enable()});function _(U){f.state=="chose-road"&&(U.key=="ArrowLeft"&&f.shortcutIndex>0&&(U.stopPropagation(),n(0,f.shortcutIndex--,f)),U.key=="ArrowRight"&&(U.stopPropagation(),f.shortcutIndex!=f.gj.features.length-1&&n(0,f.shortcutIndex++,f)))}function x(){je(xn,i={mode:"neighbourhood"},i)}function S(){f.state=="chose-road"&&n(0,f.shortcutIndex--,f)}function L(){f.state=="chose-road"&&n(0,f.shortcutIndex++,f)}return[f,i,l,a,_,x,S,L,()=>n(0,f={state:"neutral"}),()=>je(xn,i={mode:"title"},i),()=>je(xn,i={mode:"network"},i)]}class $k extends nn{constructor(t){super(),en(this,t,Qk,Jk,Ye,{})}}function tA(e){let t,n,i,r,l,f,a,_;return l=new ek({}),{c(){t=dt("div"),n=dt("img"),r=Zt(),Qt(l.$$.fragment),f=Zt(),a=dt("span"),hr(n.src,i=US)||It(n,"src",i),pi(n,"height","8vh"),pi(n,"margin-right","20px"),It(n,"alt","A/B Street logo"),pi(a,"width","100%"),It(t,"slot","top"),pi(t,"display","flex")},m(x,S){At(x,t,S),lt(t,n),lt(t,r),Kt(l,t,null),lt(t,f),lt(t,a),e[16](a),_=!0},p:we,i(x){_||(wt(l.$$.fragment,x),_=!0)},o(x){Pt(l.$$.fragment,x),_=!1},d(x){x&&kt(t),Jt(l),e[16](null)}}}function Db(e){let t,n,i;return{c(){t=dt("button"),t.textContent="Zoom to fit study area",It(t,"class","secondary")},m(r,l){At(r,t,l),n||(i=be(t,"click",e[8]),n=!0)},p:we,d(r){r&&kt(t),n=!1,i()}}}function eA(e){let t,n,i,r,l,f=e[5]&&Db(e);return{c(){t=dt("div"),n=dt("div"),i=Zt(),r=dt("hr"),l=Zt(),f&&f.c(),It(t,"slot","left")},m(a,_){At(a,t,_),lt(t,n),e[15](n),lt(t,i),lt(t,r),lt(t,l),f&&f.m(t,null)},p(a,_){a[5]?f?f.p(a,_):(f=Db(a),f.c(),f.m(t,null)):f&&(f.d(1),f=null)},d(a){a&&kt(t),e[15](null),f&&f.d()}}}function Rb(e){let t,n;return t=new zk({props:{wasmReady:e[4]}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,r){const l={};r&16&&(l.wasmReady=i[4]),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function Ob(e){let t,n,i,r,l,f;t=new Ms({props:{data:JSON.parse(e[5].getInvertedBoundary()),$$slots:{default:[nA]},$$scope:{ctx:e}}});const a=[uA,lA,aA,sA,oA,rA,iA],_=[];function x(S,L){return S[7].mode=="network"?0:S[7].mode=="set-boundary"?1:S[7].mode=="neighbourhood"?2:S[7].mode=="view-shortcuts"?3:S[7].mode=="route"?4:S[7].mode=="debug"?5:S[7].mode=="debug-gj"?6:-1}return~(i=x(e))&&(r=_[i]=a[i](e)),{c(){Qt(t.$$.fragment),n=Zt(),r&&r.c(),l=$o()},m(S,L){Kt(t,S,L),At(S,n,L),~i&&_[i].m(S,L),At(S,l,L),f=!0},p(S,L){const A={};L&32&&(A.data=JSON.parse(S[5].getInvertedBoundary())),L&262144&&(A.$$scope={dirty:L,ctx:S}),t.$set(A);let k=i;i=x(S),i===k?~i&&_[i].p(S,L):(r&&(Ti(),Pt(_[k],1,1,()=>{_[k]=null}),Li()),~i?(r=_[i],r?r.p(S,L):(r=_[i]=a[i](S),r.c()),wt(r,1),r.m(l.parentNode,l)):r=null)},i(S){f||(wt(t.$$.fragment,S),wt(r),f=!0)},o(S){Pt(t.$$.fragment,S),Pt(r),f=!1},d(S){S&&(kt(n),kt(l)),Jt(t,S),~i&&_[i].d(S)}}}function nA(e){let t,n;const i=[Vr("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let r={};for(let l=0;l{_=null}),Li()),S[5]?x?(x.p(S,L),L&32&&wt(x,1)):(x=Ob(S),x.c(),wt(x,1),x.m(f.parentNode,f)):x&&(Ti(),Pt(x,1,1,()=>{x=null}),Li())},i(S){a||(wt(t.$$.fragment,S),wt(_),wt(x),a=!0)},o(S){Pt(t.$$.fragment,S),Pt(_),Pt(x),a=!1},d(S){S&&(kt(n),kt(i),kt(r),kt(l),kt(f)),Jt(t,S),e[12](null),_&&_.d(S),x&&x.d(S)}}}function hA(e){let t,n,i,r;function l(a){e[13](a)}let f={style:e[6],standardControls:!0,hash:!0,images:[{id:"walk_cycle_only",url:"/ltn//filters/walk_cycle_only_icon.gif"},{id:"no_entry",url:"/ltn//filters/no_entry_icon.gif"},{id:"bus_gate",url:"/ltn//filters/bus_gate_icon.gif"},{id:"school_street",url:"/ltn//filters/school_street_icon.gif"}],$$slots:{default:[cA]},$$scope:{ctx:e}};return e[0]!==void 0&&(f.map=e[0]),n=new ZE({props:f}),cr.push(()=>yc(n,"map",l)),n.$on("error",e[14]),{c(){t=dt("div"),Qt(n.$$.fragment),It(t,"slot","main"),pi(t,"position","relative"),pi(t,"width","100%"),pi(t,"height","100%")},m(a,_){At(a,t,_),Kt(n,t,null),r=!0},p(a,_){const x={};_&64&&(x.style=a[6]),_&262328&&(x.$$scope={dirty:_,ctx:a}),!i&&_&1&&(i=!0,x.map=a[0],_c(()=>i=!1)),n.$set(x)},i(a){r||(wt(n.$$.fragment,a),r=!0)},o(a){Pt(n.$$.fragment,a),r=!1},d(a){a&&kt(t),Jt(n)}}}function fA(e){let t,n;return t=new oL({props:{$$slots:{main:[hA],left:[eA],top:[tA]},$$scope:{ctx:e}}}),{c(){Qt(t.$$.fragment)},m(i,r){Kt(t,i,r),n=!0},p(i,[r]){const l={};r&262399&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){Jt(t,i)}}}function pA(e,t,n){let i,r,l,f,a,_,x;Ee(e,sy,it=>n(9,i=it)),Ee(e,oy,it=>n(10,r=it)),Ee(e,ry,it=>n(11,l=it)),Ee(e,Wo,it=>n(5,f=it)),Ee(e,Nu,it=>n(17,a=it)),Ee(e,lx,it=>n(6,_=it)),Ee(e,xn,it=>n(7,x=it));let S=!1;pg(async()=>{await Yb(),await Jb(),n(4,S=!0)});let L;function A(){a.fitBounds(Array.from(f.getBounds()),{animate:!1})}let k,R,U;function j(it){cr[it?"unshift":"push"](()=>{U=it,n(3,U),n(9,i)})}function Q(it){L=it,n(0,L)}const B=it=>{console.log(it.detail.error)};function X(it){cr[it?"unshift":"push"](()=>{R=it,n(2,R),n(10,r)})}function J(it){cr[it?"unshift":"push"](()=>{k=it,n(1,k),n(11,l)})}return e.$$.update=()=>{e.$$.dirty&1&&L&&Nu.set(L),e.$$.dirty&2050&&k&&l&&(n(1,k.innerHTML="",k),k.appendChild(l)),e.$$.dirty&1028&&R&&r&&(n(2,R.innerHTML="",R),R.appendChild(r)),e.$$.dirty&520&&U&&i&&(n(3,U.innerHTML="",U),U.appendChild(i))},[L,k,R,U,S,f,_,x,A,i,r,l,j,Q,B,X,J]}class dA extends nn{constructor(t){super(),en(this,t,pA,fA,Ye,{})}}new dA({target:document.getElementById("app")}); + view lets you understand the limits of this assumption.`,n=Xt(),i=wt("button"),i.textContent="Pick a different road",r=Xt(),l=wt("div"),f=wt("button"),a=be("Previous"),x=Xt(),L=be(S),A=be(" / "),O=be(P),B=Xt(),U=wt("button"),Y=be("Next"),f.disabled=_=e[0].shortcutIndex==0,U.disabled=V=e[0].shortcutIndex==e[0].gj.features.length-1,mi(l,"display","flex"),mi(l,"justify-content","space-between")},m(nt,ht){Ct(nt,t,ht),Ct(nt,n,ht),Ct(nt,i,ht),Ct(nt,r,ht),Ct(nt,l,ht),mt(l,f),mt(f,a),mt(l,x),mt(l,L),mt(l,A),mt(l,O),mt(l,B),mt(l,U),mt(U,Y),$||(K=[Ze(i,"click",e[8]),Ze(f,"click",e[6]),Ze(U,"click",e[7])],$=!0)},p(nt,ht){ht&1&&_!==(_=nt[0].shortcutIndex==0)&&(f.disabled=_),ht&1&&S!==(S=nt[0].shortcutIndex+1+"")&&Zi(L,S),ht&1&&P!==(P=nt[0].gj.features.length+"")&&Zi(O,P),ht&1&&V!==(V=nt[0].shortcutIndex==nt[0].gj.features.length-1)&&(U.disabled=V)},d(nt){nt&&(It(t),It(n),It(i),It(r),It(l)),$=!1,No(K)}}}function pA(e){let t;return{c(){t=wt("p"),t.textContent="Click a road to see shortcuts"},m(n,i){Ct(n,t,i)},p:Ie,d(n){n&&It(t)}}}function dA(e){let t,n,i,r;n=new Ng({}),n.$on("click",e[5]);function l(_,x){if(_[0].state=="neutral")return pA;if(_[0].state=="chose-road")return fA}let f=l(e),a=f&&f(e);return{c(){t=wt("div"),Zt(n.$$.fragment),i=Xt(),a&&a.c(),Rt(t,"slot","sidebar")},m(_,x){Ct(_,t,x),jt(n,t,null),mt(t,i),a&&a.m(t,null),r=!0},p(_,x){f===(f=l(_))&&a?a.p(_,x):(a&&a.d(1),a=f&&f(_),a&&(a.c(),a.m(t,null)))},i(_){r||(pt(n.$$.fragment,_),r=!0)},o(_){bt(n.$$.fragment,_),r=!1},d(_){_&&It(t),qt(n),a&&a.d()}}}function mA(e){let t,n,i,r,l,f;return t=new Ps({props:{data:Ty(JSON.parse(xi(e[2]).renderNeighbourhood())),$$slots:{default:[_A]},$$scope:{ctx:e}}}),i=new Ps({props:{data:e[0].gj.features[e[0].shortcutIndex],$$slots:{default:[yA]},$$scope:{ctx:e}}}),l=new Ps({props:{data:e[0].roadGj,$$slots:{default:[vA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment),n=Xt(),Zt(i.$$.fragment),r=Xt(),Zt(l.$$.fragment)},m(a,_){jt(t,a,_),Ct(a,n,_),jt(i,a,_),Ct(a,r,_),jt(l,a,_),f=!0},p(a,_){const x={};_&4&&(x.data=Ty(JSON.parse(xi(a[2]).renderNeighbourhood()))),_&8192&&(x.$$scope={dirty:_,ctx:a}),t.$set(x);const S={};_&1&&(S.data=a[0].gj.features[a[0].shortcutIndex]),_&8192&&(S.$$scope={dirty:_,ctx:a}),i.$set(S);const L={};_&1&&(L.data=a[0].roadGj),_&8192&&(L.$$scope={dirty:_,ctx:a}),l.$set(L)},i(a){f||(pt(t.$$.fragment,a),pt(i.$$.fragment,a),pt(l.$$.fragment,a),f=!0)},o(a){bt(t.$$.fragment,a),bt(i.$$.fragment,a),bt(l.$$.fragment,a),f=!1},d(a){a&&(It(n),It(r)),qt(t,a),qt(i,a),qt(l,a)}}}function gA(e){let t,n;return t=new Dg({props:{gjInput:JSON.parse(xi(e[2]).renderNeighbourhood()),onClickLine:e[3],$$slots:{"line-popup":[xA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&4&&(l.gjInput=JSON.parse(xi(i[2]).renderNeighbourhood())),r&8192&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function _A(e){let t,n;const i=[Vr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let r={};for(let l=0;l({12:r}),({props:r})=>r?4096:0]},$$scope:{ctx:e}}}),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){Ct(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&12288&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(pt(n.$$.fragment,r),i=!0)},o(r){bt(n.$$.fragment,r),i=!1},d(r){r&&It(t),qt(n)}}}function wA(e){let t,n,i,r,l,f;const a=[gA,mA],_=[];function x(S,L){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(n=x(e))&&(i=_[n]=a[n](e)),l=new Rg({}),{c(){t=wt("div"),i&&i.c(),r=Xt(),Zt(l.$$.fragment),Rt(t,"slot","map")},m(S,L){Ct(S,t,L),~n&&_[n].m(t,null),mt(t,r),jt(l,t,null),f=!0},p(S,L){let A=n;n=x(S),n===A?~n&&_[n].p(S,L):(i&&(ui(),bt(_[A],1,1,()=>{_[A]=null}),ci()),~n?(i=_[n],i?i.p(S,L):(i=_[n]=a[n](S),i.c()),pt(i,1),i.m(t,r)):i=null)},i(S){f||(pt(i),pt(l.$$.fragment,S),f=!0)},o(S){bt(i),bt(l.$$.fragment,S),f=!1},d(S){S&&It(t),~n&&_[n].d(),qt(l)}}}function SA(e){let t,n,i,r;return t=new Wu({props:{$$slots:{map:[wA],sidebar:[dA],top:[hA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ze(aA,"keydown",e[4]),i=!0)},p(l,[f]){const a={};f&8199&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(pt(t.$$.fragment,l),n=!0)},o(l){bt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function EA(e,t,n){let i,r,l;Se(e,xn,B=>n(1,i=B)),Se(e,Du,B=>n(11,r=B)),Se(e,Wo,B=>n(2,l=B));let f={state:"neutral"};function a(B){let U=JSON.parse(l.getShortcutsCrossingRoad(B.properties.id));if(U.features.length==0){window.alert("No shortcuts here");return}n(0,f={state:"chose-road",roadGj:B,gj:U,shortcutIndex:0})}dg(()=>{r==null||r.keyboard.disable()}),aa(()=>{r==null||r.keyboard.enable()});function _(B){f.state=="chose-road"&&(B.key=="ArrowLeft"&&f.shortcutIndex>0&&(B.stopPropagation(),n(0,f.shortcutIndex--,f)),B.key=="ArrowRight"&&(B.stopPropagation(),f.shortcutIndex!=f.gj.features.length-1&&n(0,f.shortcutIndex++,f)))}function x(){je(xn,i={mode:"neighbourhood"},i)}function S(){f.state=="chose-road"&&n(0,f.shortcutIndex--,f)}function L(){f.state=="chose-road"&&n(0,f.shortcutIndex++,f)}return[f,i,l,a,_,x,S,L,()=>n(0,f={state:"neutral"}),()=>je(xn,i={mode:"title"},i),()=>je(xn,i={mode:"network"},i)]}class IA extends nn{constructor(t){super(),en(this,t,EA,SA,He,{})}}function CA(e){let t,n,i,r,l,f,a,_;return l=new vk({}),{c(){t=wt("div"),n=wt("img"),r=Xt(),Zt(l.$$.fragment),f=Xt(),a=wt("span"),hr(n.src,i=GS)||Rt(n,"src",i),mi(n,"height","8vh"),mi(n,"margin-right","20px"),Rt(n,"alt","A/B Street logo"),mi(a,"width","100%"),Rt(t,"slot","top"),mi(t,"display","flex")},m(x,S){Ct(x,t,S),mt(t,n),mt(t,r),jt(l,t,null),mt(t,f),mt(t,a),e[16](a),_=!0},p:Ie,i(x){_||(pt(l.$$.fragment,x),_=!0)},o(x){bt(l.$$.fragment,x),_=!1},d(x){x&&It(t),qt(l),e[16](null)}}}function Rb(e){let t,n,i;return{c(){t=wt("button"),t.textContent="Zoom to fit study area",Rt(t,"class","secondary")},m(r,l){Ct(r,t,l),n||(i=Ze(t,"click",e[8]),n=!0)},p:Ie,d(r){r&&It(t),n=!1,i()}}}function TA(e){let t,n,i,r,l,f=e[5]&&Rb(e);return{c(){t=wt("div"),n=wt("div"),i=Xt(),r=wt("hr"),l=Xt(),f&&f.c(),Rt(t,"slot","left")},m(a,_){Ct(a,t,_),mt(t,n),e[15](n),mt(t,i),mt(t,r),mt(t,l),f&&f.m(t,null)},p(a,_){a[5]?f?f.p(a,_):(f=Rb(a),f.c(),f.m(t,null)):f&&(f.d(1),f=null)},d(a){a&&It(t),e[15](null),f&&f.d()}}}function Ob(e){let t,n;return t=new sA({props:{wasmReady:e[4]}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,r){const l={};r&16&&(l.wasmReady=i[4]),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function zb(e){let t,n,i,r,l,f;t=new Ps({props:{data:JSON.parse(e[5].getInvertedBoundary()),$$slots:{default:[LA]},$$scope:{ctx:e}}});const a=[RA,DA,NA,AA,kA,PA,MA],_=[];function x(S,L){return S[7].mode=="network"?0:S[7].mode=="set-boundary"?1:S[7].mode=="neighbourhood"?2:S[7].mode=="view-shortcuts"?3:S[7].mode=="route"?4:S[7].mode=="debug"?5:S[7].mode=="debug-gj"?6:-1}return~(i=x(e))&&(r=_[i]=a[i](e)),{c(){Zt(t.$$.fragment),n=Xt(),r&&r.c(),l=ts()},m(S,L){jt(t,S,L),Ct(S,n,L),~i&&_[i].m(S,L),Ct(S,l,L),f=!0},p(S,L){const A={};L&32&&(A.data=JSON.parse(S[5].getInvertedBoundary())),L&262144&&(A.$$scope={dirty:L,ctx:S}),t.$set(A);let P=i;i=x(S),i===P?~i&&_[i].p(S,L):(r&&(ui(),bt(_[P],1,1,()=>{_[P]=null}),ci()),~i?(r=_[i],r?r.p(S,L):(r=_[i]=a[i](S),r.c()),pt(r,1),r.m(l.parentNode,l)):r=null)},i(S){f||(pt(t.$$.fragment,S),pt(r),f=!0)},o(S){bt(t.$$.fragment,S),bt(r),f=!1},d(S){S&&(It(n),It(l)),qt(t,S),~i&&_[i].d(S)}}}function LA(e){let t,n;const i=[Vr("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let r={};for(let l=0;l{_=null}),ci()),S[5]?x?(x.p(S,L),L&32&&pt(x,1)):(x=zb(S),x.c(),pt(x,1),x.m(f.parentNode,f)):x&&(ui(),bt(x,1,1,()=>{x=null}),ci())},i(S){a||(pt(t.$$.fragment,S),pt(_),pt(x),a=!0)},o(S){bt(t.$$.fragment,S),bt(_),bt(x),a=!1},d(S){S&&(It(n),It(i),It(r),It(l),It(f)),qt(t,S),e[12](null),_&&_.d(S),x&&x.d(S)}}}function zA(e){let t,n,i,r;function l(a){e[13](a)}let f={style:e[6],standardControls:!0,hash:!0,images:[{id:"walk_cycle_only",url:"/ltn//filters/walk_cycle_only_icon.gif"},{id:"no_entry",url:"/ltn//filters/no_entry_icon.gif"},{id:"bus_gate",url:"/ltn//filters/bus_gate_icon.gif"},{id:"school_street",url:"/ltn//filters/school_street_icon.gif"}],$$slots:{default:[OA]},$$scope:{ctx:e}};return e[0]!==void 0&&(f.map=e[0]),n=new $E({props:f}),cr.push(()=>vc(n,"map",l)),n.$on("error",e[14]),{c(){t=wt("div"),Zt(n.$$.fragment),Rt(t,"slot","main"),mi(t,"position","relative"),mi(t,"width","100%"),mi(t,"height","100%")},m(a,_){Ct(a,t,_),jt(n,t,null),r=!0},p(a,_){const x={};_&64&&(x.style=a[6]),_&262328&&(x.$$scope={dirty:_,ctx:a}),!i&&_&1&&(i=!0,x.map=a[0],yc(()=>i=!1)),n.$set(x)},i(a){r||(pt(n.$$.fragment,a),r=!0)},o(a){bt(n.$$.fragment,a),r=!1},d(a){a&&It(t),qt(n)}}}function FA(e){let t,n;return t=new sL({props:{$$slots:{main:[zA],left:[TA],top:[CA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p(i,[r]){const l={};r&262399&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(pt(t.$$.fragment,i),n=!0)},o(i){bt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function BA(e,t,n){let i,r,l,f,a,_,x;Se(e,ay,nt=>n(9,i=nt)),Se(e,sy,nt=>n(10,r=nt)),Se(e,oy,nt=>n(11,l=nt)),Se(e,Wo,nt=>n(5,f=nt)),Se(e,Du,nt=>n(17,a=nt)),Se(e,ux,nt=>n(6,_=nt)),Se(e,xn,nt=>n(7,x=nt));let S=!1;dg(async()=>{await Yb(),await Jb(),n(4,S=!0)});let L;function A(){a.fitBounds(Array.from(f.getBounds()),{animate:!1})}let P,O,B;function U(nt){cr[nt?"unshift":"push"](()=>{B=nt,n(3,B),n(9,i)})}function Y(nt){L=nt,n(0,L)}const V=nt=>{console.log(nt.detail.error)};function $(nt){cr[nt?"unshift":"push"](()=>{O=nt,n(2,O),n(10,r)})}function K(nt){cr[nt?"unshift":"push"](()=>{P=nt,n(1,P),n(11,l)})}return e.$$.update=()=>{e.$$.dirty&1&&L&&Du.set(L),e.$$.dirty&2050&&P&&l&&(n(1,P.innerHTML="",P),P.appendChild(l)),e.$$.dirty&1028&&O&&r&&(n(2,O.innerHTML="",O),O.appendChild(r)),e.$$.dirty&520&&B&&i&&(n(3,B.innerHTML="",B),B.appendChild(i))},[L,P,O,B,S,f,_,x,A,i,r,l,U,Y,V,$,K]}class VA extends nn{constructor(t){super(),en(this,t,BA,FA,He,{})}}new VA({target:document.getElementById("app")}); diff --git a/index.html b/index.html index b160d8a..2adb7ff 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ LTN from scratch - +