diff --git a/assets/main-9867e006.js b/assets/main-b27cabf1.js similarity index 92% rename from assets/main-9867e006.js rename to assets/main-b27cabf1.js index 5dbb18b..68d74af 100644 --- a/assets/main-9867e006.js +++ b/assets/main-b27cabf1.js @@ -1,7 +1,7 @@ -var LS=Object.defineProperty;var MS=(e,t,n)=>t in e?LS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Wn=(e,t,n)=>(MS(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 Ce(){}function xr(e,t){for(const n in t)e[n]=t[n];return e}function Bb(e){return e()}function Bv(){return Object.create(null)}function No(e){e.forEach(Bb)}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 PS(e){return Object.keys(e).length===0}function Vb(e,...t){if(e==null){for(const i of t)i(void 0);return Ce}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Ub(e){let t;return Vb(e,n=>t=n)(),t}function Ee(e,t,n){e.$$.on_destroy.push(Vb(t,n))}function sr(e,t,n,i){if(e){const r=Gb(e,t,n,i);return e[0](r)}}function Gb(e,t,n,i){return e[1]&&i?xr(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 NS(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 DS(e){return Array.from(e.childNodes)}function Fi(e,t){t=""+t,e.data!==t&&(e.data=t)}function ql(e,t){e.value=t??""}function ri(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=RS(t,n,{cancelable:i});return r.slice().forEach(f=>{f.call(e,l)}),!l.defaultPrevented}return!0}}function qb(e,t){return cd().$$.context.set(e,t),t}function OS(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=[],Zb=Promise.resolve();let ey=!1;function $b(){ey||(ey=!0,Zb.then(Wb))}function zS(){return $b(),Zb}function jp(e){Nh.push(e)}function yc(e){ty.push(e)}const j_=new Set;let Ih=0;function Wb(){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 hi(){_c={r:0,c:[],p:_c}}function fi(){_c.r||No(_c.c),_c=_c.p}function dt(e,t){e&&e.i&&(Bm.delete(e),e.i(t))}function vt(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 VS(e,t){vt(e,1,1,()=>{t.delete(e.key)})}function US(e,t,n,i,r,l,f,a,_,x,S,L){let A=e.length,P=l.length,D=A;const B={};for(;D--;)B[e[D].key]=D;const U=[],Y=new Map,V=new Map,Z=[];for(D=P;D--;){const ht=L(r,l,D),gt=n(ht);let lt=f.get(gt);lt?i&&Z.push(()=>lt.p(ht,t)):(lt=x(gt,ht),lt.c()),Y.set(gt,U[D]=lt),gt in B&&V.set(gt,Math.abs(D-B[gt]))}const K=new Set,it=new Set;function mt(ht){dt(ht,1),ht.m(a,S),f.set(ht.key,ht),S=ht.first,P--}for(;A&&P;){const ht=U[P-1],gt=e[A-1],lt=ht.key,It=gt.key;ht===gt?(S=ht.first,A--,P--):Y.has(It)?!f.has(lt)||K.has(lt)?mt(ht):it.has(It)?A--:V.get(lt)>V.get(It)?(it.add(lt),mt(ht)):(K.add(It),A--):(_(gt,f),A--)}for(;A--;){const ht=e[A];Y.has(ht.key)||_(ht,f)}for(;P;)mt(U[P-1]);return No(Z),U}function Xb(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(Bb).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&&(BS(n.after_update),No(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function GS(e,t){e.$$.dirty[0]===-1&&(Mh.push(e),$b(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const D=P.length?P[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=D)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](D),S&&GS(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=DS(t.target);x.fragment&&x.fragment.l(L),L.forEach(wt)}else x.fragment&&x.fragment.c();t.intro&&dt(e.$$.fragment),jt(e,t.target,t.anchor),Wb()}Op(_)}class tn{constructor(){Wn(this,"$$");Wn(this,"$$set")}$destroy(){qt(this,1),this.$destroy=Ce}$on(t,n){if(!pg(n))return Ce;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&&!PS(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const jS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(jS);const qS="/ltn/assets/logo-7ace0a42.png";let pe;const Ul=new Array(128).fill(void 0);Ul.push(void 0,null,!0,!1);function fn(e){return Ul[e]}let Ls=0,Cp=null;function Dh(){return(Cp===null||Cp.byteLength===0)&&(Cp=new Uint8Array(pe.memory.buffer)),Cp}const Vm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ZS=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),_=ZS(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(pe.memory.buffer)),Tp}let zp=Ul.length;function $S(e){e<132||(Ul[e]=zp,zp=e)}function fs(e){const t=fn(e);return $S(e),t}const Hb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Hb.decode();function ea(e,t){return e=e>>>0,Hb.decode(Dh().subarray(e,e+t))}function li(e){zp===Ul.length&&Ul.push(Ul.length+1);const t=zp;return zp=Ul[t],Ul[t]=e,t}let Lp=null;function Yb(){return(Lp===null||Lp.byteLength===0)&&(Lp=new Float64Array(pe.memory.buffer)),Lp}let Mp=null;function WS(){return(Mp===null||Mp.byteLength===0)&&(Mp=new BigInt64Array(pe.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} +var LS=Object.defineProperty;var MS=(e,t,n)=>t in e?LS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Wn=(e,t,n)=>(MS(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 Me(){}function xr(e,t){for(const n in t)e[n]=t[n];return e}function Bb(e){return e()}function Bv(){return Object.create(null)}function yo(e){e.forEach(Bb)}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 PS(e){return Object.keys(e).length===0}function Vb(e,...t){if(e==null){for(const i of t)i(void 0);return Me}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Ub(e){let t;return Vb(e,n=>t=n)(),t}function Ee(e,t,n){e.$$.on_destroy.push(Vb(t,n))}function sr(e,t,n,i){if(e){const r=Gb(e,t,n,i);return e[0](r)}}function Gb(e,t,n,i){return e[1]&&i?xr(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 NS(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 DS(e){return Array.from(e.childNodes)}function Fi(e,t){t=""+t,e.data!==t&&(e.data=t)}function ql(e,t){e.value=t??""}function ri(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=RS(t,n,{cancelable:i});return r.slice().forEach(f=>{f.call(e,l)}),!l.defaultPrevented}return!0}}function qb(e,t){return cd().$$.context.set(e,t),t}function OS(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=[],Zb=Promise.resolve();let ey=!1;function $b(){ey||(ey=!0,Zb.then(Wb))}function zS(){return $b(),Zb}function jp(e){Nh.push(e)}function yc(e){ty.push(e)}const j_=new Set;let Ih=0;function Wb(){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 hi(){_c={r:0,c:[],p:_c}}function fi(){_c.r||yo(_c.c),_c=_c.p}function dt(e,t){e&&e.i&&(Bm.delete(e),e.i(t))}function vt(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 VS(e,t){vt(e,1,1,()=>{t.delete(e.key)})}function US(e,t,n,i,r,l,f,a,_,x,S,L){let A=e.length,P=l.length,D=A;const F={};for(;D--;)F[e[D].key]=D;const U=[],Y=new Map,V=new Map,Z=[];for(D=P;D--;){const ft=L(r,l,D),gt=n(ft);let lt=f.get(gt);lt?i&&Z.push(()=>lt.p(ft,t)):(lt=x(gt,ft),lt.c()),Y.set(gt,U[D]=lt),gt in F&&V.set(gt,Math.abs(D-F[gt]))}const K=new Set,it=new Set;function mt(ft){dt(ft,1),ft.m(a,S),f.set(ft.key,ft),S=ft.first,P--}for(;A&&P;){const ft=U[P-1],gt=e[A-1],lt=ft.key,It=gt.key;ft===gt?(S=ft.first,A--,P--):Y.has(It)?!f.has(lt)||K.has(lt)?mt(ft):it.has(It)?A--:V.get(lt)>V.get(It)?(it.add(lt),mt(ft)):(K.add(It),A--):(_(gt,f),A--)}for(;A--;){const ft=e[A];Y.has(ft.key)||_(ft,f)}for(;P;)mt(U[P-1]);return yo(Z),U}function Xb(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(Bb).filter(pg);e.$$.on_destroy?e.$$.on_destroy.push(...l):yo(l),e.$$.on_mount=[]}),r.forEach(jp)}function qt(e,t){const n=e.$$;n.fragment!==null&&(BS(n.after_update),yo(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function GS(e,t){e.$$.dirty[0]===-1&&(Mh.push(e),$b(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const D=P.length?P[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=D)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](D),S&&GS(e,L)),A}):[],x.update(),S=!0,yo(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=DS(t.target);x.fragment&&x.fragment.l(L),L.forEach(wt)}else x.fragment&&x.fragment.c();t.intro&&dt(e.$$.fragment),jt(e,t.target,t.anchor),Wb()}Op(_)}class tn{constructor(){Wn(this,"$$");Wn(this,"$$set")}$destroy(){qt(this,1),this.$destroy=Me}$on(t,n){if(!pg(n))return Me;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&&!PS(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const jS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(jS);const qS="/ltn/assets/logo-7ace0a42.png";let pe;const Ul=new Array(128).fill(void 0);Ul.push(void 0,null,!0,!1);function fn(e){return Ul[e]}let Ls=0,Cp=null;function Dh(){return(Cp===null||Cp.byteLength===0)&&(Cp=new Uint8Array(pe.memory.buffer)),Cp}const Vm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ZS=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),_=ZS(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(pe.memory.buffer)),Tp}let zp=Ul.length;function $S(e){e<132||(Ul[e]=zp,zp=e)}function fs(e){const t=fn(e);return $S(e),t}const Hb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Hb.decode();function ea(e,t){return e=e>>>0,Hb.decode(Dh().subarray(e,e+t))}function li(e){zp===Ul.length&&Ul.push(Ul.length+1);const t=zp;return zp=Ul[t],Ul[t]=e,t}let Lp=null;function Yb(){return(Lp===null||Lp.byteLength===0)&&(Lp=new Float64Array(pe.memory.buffer)),Lp}let Mp=null;function WS(){return(Mp===null||Mp.byteLength===0)&&(Mp=new BigInt64Array(pe.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 XS(e,t){const n=t(e.length*1,1)>>>0;return Dh().set(e,n/1),Ls=e.length,n}function HS(e,t){return e=e>>>0,Yb().subarray(e/8,e/8+t)}function YS(e,t){return e=e>>>0,Dh().subarray(e/1,e/1+t)}function gc(e,t){try{return e.apply(this,t)}catch(n){pe.__wbindgen_exn_store(li(n))}}class KS{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();pe.__wbg_ltn_free(t)}constructor(t,n){try{const _=pe.__wbindgen_add_to_stack_pointer(-16),x=XS(t,pe.__wbindgen_malloc),S=Ls;var i=Ph(n)?0:Vl(n,pe.__wbindgen_malloc,pe.__wbindgen_realloc),r=Ls;pe.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{pe.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let t,n;try{const x=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(t,n,1)}}getBounds(){try{const r=pe.__wbindgen_add_to_stack_pointer(-16);pe.ltn_getBounds(r,this.__wbg_ptr);var t=Je()[r/4+0],n=Je()[r/4+1],i=HS(t,n).slice();return pe.__wbindgen_free(t,n*8,8),i}finally{pe.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const r=pe.__wbindgen_add_to_stack_pointer(-16);pe.ltn_toRouteSnapper(r,this.__wbg_ptr);var t=Je()[r/4+0],n=Je()[r/4+1],i=YS(t,n).slice();return pe.__wbindgen_free(t,n*1,1),i}finally{pe.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let t,n;try{const x=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(t,n,1)}}renderModalFilters(){let t,n;try{const x=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(t,n,1)}}renderNeighbourhood(){let t,n;try{const x=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(t,n,1)}}setNeighbourhoodBoundary(t,n){try{const l=pe.__wbindgen_add_to_stack_pointer(-16),f=Vl(t,pe.__wbindgen_malloc,pe.__wbindgen_realloc),a=Ls;pe.ltn_setNeighbourhoodBoundary(l,this.__wbg_ptr,f,a,li(n));var i=Je()[l/4+0],r=Je()[l/4+1];if(r)throw fs(i)}finally{pe.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(t){const n=Vl(t,pe.__wbindgen_malloc,pe.__wbindgen_realloc),i=Ls;pe.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,n,i)}setCurrentNeighbourhood(t){try{const r=pe.__wbindgen_add_to_stack_pointer(-16),l=Vl(t,pe.__wbindgen_malloc,pe.__wbindgen_realloc),f=Ls;pe.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{pe.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(t,n){try{const l=pe.__wbindgen_add_to_stack_pointer(-16),f=Vl(n,pe.__wbindgen_malloc,pe.__wbindgen_realloc),a=Ls;pe.ltn_addModalFilter(l,this.__wbg_ptr,li(t),f,a);var i=Je()[l/4+0],r=Je()[l/4+1];if(r)throw fs(i)}finally{pe.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(t,n){try{const l=pe.__wbindgen_add_to_stack_pointer(-16),f=Vl(n,pe.__wbindgen_malloc,pe.__wbindgen_realloc),a=Ls;pe.ltn_addManyModalFilters(l,this.__wbg_ptr,li(t),f,a);var i=Je()[l/4+0],r=Je()[l/4+1];if(r)throw fs(i)}finally{pe.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(t){pe.ltn_deleteModalFilter(this.__wbg_ptr,t)}toggleDirection(t){pe.ltn_toggleDirection(this.__wbg_ptr,t)}undo(){pe.ltn_undo(this.__wbg_ptr)}redo(){pe.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(t){let n,i;try{const S=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(n,i,1)}}toSavefile(){let t,n;try{const x=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(t,n,1)}}loadSavefile(t){try{const r=pe.__wbindgen_add_to_stack_pointer(-16);pe.ltn_loadSavefile(r,this.__wbg_ptr,li(t));var n=Je()[r/4+0],i=Je()[r/4+1];if(i)throw fs(n)}finally{pe.__wbindgen_add_to_stack_pointer(16)}}compareRoute(t,n,i,r){let l,f;try{const P=pe.__wbindgen_add_to_stack_pointer(-16);pe.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{pe.__wbindgen_add_to_stack_pointer(16),pe.__wbindgen_free(l,f,1)}}}async function JS(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 QS(){const e={};return e.wbg={},e.wbg.__wbindgen_string_get=function(t,n){const i=fn(n),r=typeof i=="string"?i:void 0;var l=Ph(r)?0:Vl(r,pe.__wbindgen_malloc,pe.__wbindgen_realloc),f=Ls;Je()[t/4+1]=f,Je()[t/4+0]=l},e.wbg.__wbindgen_object_drop_ref=function(t){fs(t)},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(ea(t,n));return li(i)},e.wbg.__wbindgen_boolean_get=function(t){const n=fn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_is_bigint=function(t){return typeof fn(t)=="bigint"},e.wbg.__wbindgen_bigint_from_i64=function(t){return li(t)},e.wbg.__wbindgen_jsval_eq=function(t,n){return fn(t)===fn(n)},e.wbg.__wbindgen_bigint_from_u64=function(t){const n=BigInt.asUintN(64,t);return li(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=fn(n),r=typeof i=="number"?i:void 0;Yb()[t/8+1]=Ph(r)?0:r,Je()[t/4+0]=!Ph(r)},e.wbg.__wbindgen_is_object=function(t){const n=fn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_in=function(t,n){return fn(t)in fn(n)},e.wbg.__wbindgen_string_new=function(t,n){const i=ea(t,n);return li(i)},e.wbg.__wbindgen_is_undefined=function(t){return fn(t)===void 0},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return fn(t)==fn(n)},e.wbg.__wbindgen_object_clone_ref=function(t){const n=fn(t);return li(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const i=fn(t)[fn(n)];return li(i)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(fn(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(fn(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(fn(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(fn(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(fn(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return li(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=fn(n).stack,r=Vl(i,pe.__wbindgen_malloc,pe.__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{pe.__wbindgen_free(i,r,1)}},e.wbg.__wbg_performance_3f3012faa4463882=function(t){const n=fn(t).performance;return li(n)},e.wbg.__wbg_now_2fd65358804c9485=function(t){return fn(t).now()},e.wbg.__wbg_get_f01601b5a68d10e3=function(t,n){const i=fn(t)[n>>>0];return li(i)},e.wbg.__wbg_length_1009b1af0c481d7b=function(t){return fn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof fn(t)=="function"},e.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(t,n){const i=new Function(ea(t,n));return li(i)},e.wbg.__wbg_next_9b877f231f476d01=function(t){const n=fn(t).next;return li(n)},e.wbg.__wbg_next_6529ee0cca8d57ed=function(){return gc(function(t){const n=fn(t).next();return li(n)},arguments)},e.wbg.__wbg_done_5fe336b092d60cf2=function(t){return fn(t).done},e.wbg.__wbg_value_0c248a78fdc8e19f=function(t){const n=fn(t).value;return li(n)},e.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return li(Symbol.iterator)},e.wbg.__wbg_get_7b48513de5dc5ea4=function(){return gc(function(t,n){const i=Reflect.get(fn(t),fn(n));return li(i)},arguments)},e.wbg.__wbg_call_90c26b09837aba1c=function(){return gc(function(t,n){const i=fn(t).call(fn(n));return li(i)},arguments)},e.wbg.__wbg_self_f0e34d89f33b99fd=function(){return gc(function(){const t=self.self;return li(t)},arguments)},e.wbg.__wbg_window_d3b084224f4774d7=function(){return gc(function(){const t=window.window;return li(t)},arguments)},e.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return gc(function(){const t=globalThis.globalThis;return li(t)},arguments)},e.wbg.__wbg_global_35dfdd59a4da3e74=function(){return gc(function(){const t=global.global;return li(t)},arguments)},e.wbg.__wbg_isArray_74fb723e24f76012=function(t){return Array.isArray(fn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=fn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(t){return Number.isSafeInteger(fn(t))},e.wbg.__wbg_entries_9e2e2aa45aa5094a=function(t){const n=Object.entries(fn(t));return li(n)},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=fn(t).buffer;return li(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(fn(t));return li(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,i){fn(t).set(fn(n),i>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return fn(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=fn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_bigint_get_as_i64=function(t,n){const i=fn(n),r=typeof i=="bigint"?i:void 0;WS()[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(fn(n)),r=Vl(i,pe.__wbindgen_malloc,pe.__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=pe.memory;return li(t)},e}function tE(e,t){return pe=e.exports,Kb.__wbindgen_wasm_module=t,Mp=null,Lp=null,Tp=null,Cp=null,pe}async function Kb(e){if(pe!==void 0)return pe;typeof e>"u"&&(e="/ltn/assets/backend_bg.wasm");const t=QS();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await JS(await e,t);return tE(n,i)}let Xe;const Jb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Jb.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,Jb.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 Br(e){Bp===jl.length&&jl.push(jl.length+1);const t=Bp;return Bp=jl[t],jl[t]=e,t}function Pn(e){return jl[e]}function eE(e){e<132||(jl[e]=Bp,Bp=e)}function Um(e){const t=Pn(e);return eE(e),t}function q_(e){return e==null}let kp=null;function nE(){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 Pu=0;const Gm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},iE=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),Pu=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),_=iE(e,a);f+=_.written}return Pu=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 rE(e,t){const n=t(e.length*1,1)>>>0;return Fp().set(e,n/1),Pu=e.length,n}function Z_(e,t){try{return e.apply(this,t)}catch(n){Xe.__wbindgen_exn_store(Br(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=rE(t,Xe.__wbindgen_malloc),a=Pu;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,Br(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,Br(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,Br(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 oE(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 sE(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const i=Gl(t,n);return Br(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 Br(i)},e.wbg.__wbindgen_is_object=function(t){const n=Pn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return Pn(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return Pn(t)in Pn(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=Pn(n),r=typeof i=="number"?i:void 0;nE()[t/8+1]=q_(r)?0:r,Li()[t/4+0]=!q_(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=Pn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_object_clone_ref=function(t){const n=Pn(t);return Br(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return Pn(t)==Pn(n)},e.wbg.__wbindgen_string_get=function(t,n){const i=Pn(n),r=typeof i=="string"?i:void 0;var l=q_(r)?0:Mm(r,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),f=Pu;Li()[t/4+1]=f,Li()[t/4+0]=l},e.wbg.__wbg_String_4370c5505c674d30=function(t,n){const i=String(Pn(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Pu;Li()[t/4+1]=l,Li()[t/4+0]=r},e.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(t,n){const i=Pn(t)[Pn(n)];return Br(i)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Br(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=Pn(n).stack,r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Pu;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(Pn(t))},e.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(Pn(t))},e.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(Pn(t))},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(Pn(t))},e.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(Pn(t))},e.wbg.__wbg_get_44be0491f933a435=function(t,n){const i=Pn(t)[n>>>0];return Br(i)},e.wbg.__wbg_length_fff51ee6522a1a18=function(t){return Pn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof Pn(t)=="function"},e.wbg.__wbg_next_526fc47e980da008=function(t){const n=Pn(t).next;return Br(n)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return Z_(function(t){const n=Pn(t).next();return Br(n)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Pn(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){const n=Pn(t).value;return Br(n)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Br(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return Z_(function(t,n){const i=Reflect.get(Pn(t),Pn(n));return Br(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return Z_(function(t,n){const i=Pn(t).call(Pn(n));return Br(i)},arguments)},e.wbg.__wbg_isArray_4c24b343cb13cfb1=function(t){return Array.isArray(Pn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let n;try{n=Pn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const n=Pn(t).buffer;return Br(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){const n=new Uint8Array(Pn(t));return Br(n)},e.wbg.__wbg_set_5cf90238115182c3=function(t,n,i){Pn(t).set(Pn(n),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Pn(t).length},e.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let n;try{n=Pn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const i=iy(Pn(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Pu;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 Br(t)},e}function aE(e,t){return Xe=e.exports,Qb.__wbindgen_wasm_module=t,kp=null,Ap=null,Pp=null,Xe}async function Qb(e){if(Xe!==void 0)return Xe;typeof e>"u"&&(e="/ltn/assets/route_snapper_bg.wasm");const t=sE();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await oE(await e,t);return aE(n,i)}const Ch=[];function $_(e,t){return{subscribe:ui(e,t).subscribe}}function ui(e,t=Ce){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 lE=Date.now();function of(e){return`${e}-${lE++}`}const Ly=Symbol.for("svelte-maplibre");function sf(){return OS(Ly)}function uE(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 cE(){let e=new Map;return qb(Ly,{map:ui(null),source:$_(null),layer:$_(null),popupTarget:$_(null),cluster:ui(),loadedImages:ui(new Set),minzoom:ui(0),maxzoom:ui(24),layerEvent:ui(null),layerInfo:e,eventTopMost:uE(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=ui(null),f=Vv(l),a={...r,[e]:Vv(l)};if(t&&(a.popupTarget=f),i){let _=ui(null);a.layerEvent=_,r.layerEvent=_}return n&&(a.cluster=ui()),qb(Ly,a),{...r,self:l}}function hE(){return My({key:"source",setCluster:!0})}function fE(e=!0){return My({key:"layer",setPopupTarget:e,setMouseEvent:e})}function pE(){return My({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function dE(e){return"layerType"in e&&e.layerType==="deckgl"}var tx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ex(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nx(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 ix={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(tx,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(R){v(R)}}function E(k){try{T(p.throw(k))}catch(R){v(R)}}function T(k){var R;k.done?m(k.value):(R=k.value,R instanceof c?R:new c(function(F){F(R)})).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=D;function D(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}D.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 Z(){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 it=K(.25,.1,.25,1);function mt(u,o,c){return Math.min(c,Math.max(o,u))}function ht(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 lt=1;function It(u,o,c){const p={};for(const m in u)p[m]=o.call(c||this,u[m],m,u);return p}function _t(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 bt(u){return Array.isArray(u)?u.map(bt):typeof u=="object"&&u?It(u,bt):u}const ee={};function kt(u){ee[u]||(typeof console<"u"&&console.warn(u),ee[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,R,F,j,X){const H=4*Math.max(-R,0),tt=(Math.max(0,F)-F)*j*4+H,ut=4*j,pt=Math.max(0,R),At=Math.max(0,F);return{rect:{x:pt,y:At,width:Math.min(k.width,R+j)-pt,height:Math.min(k.height,F+X)-At},layout:[{offset:tt,stride:ut}]}}(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=>(dn||(dn=document.createElement("a")),dn.href=u,dn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Fn==null&&(Fn=matchMedia("(prefers-reduced-motion: reduce)")),Fn.matches)}},oe={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Ge 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 pn=ne()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Bn=u=>oe.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf("://"))];function yi(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:pn(),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 Ge(w.status,w.statusText,u.url,E)))).catch(w=>{w.code!==20&&o(new Error(w.message))}),{cancel:()=>{v=!0,m||c.abort()}}}const Ai=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(ne()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,o);if(!ne())return(Bn(u.url)||yi)(u,o)}if(!(/^file:/.test(c=u.url)||/^file:/.test(pn())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return yi(u,o);if(ne()&&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 Ge(v.status,v.statusText,p.url,w))}},v.send(p.body),{cancel:()=>v.abort()}}(u,o)},Lt=function(u,o){return Ai(gt(u,{type:"arrayBuffer"}),o)};function ke(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 xe(u,o,c){c[u]&&c[u].indexOf(o)!==-1||(c[u]=c[u]||[],c[u].push(o))}function rn(u,o,c){if(c&&c[u]){const p=c[u].indexOf(o);p!==-1&&c[u].splice(p,1)}}class un{constructor(o,c={}){gt(this,c),this.type=o}}class mn extends un{constructor(o,c={}){super("error",gt({error:o},c))}}class Xi{on(o,c){return this._listeners=this._listeners||{},xe(o,c,this._listeners),this}off(o,c){return rn(o,c,this._listeners),rn(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},xe(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new un(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)rn(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 mn&&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 Ui=["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 Ui.forEach(p=>{p in o&&(c[p]=o[p])}),c}function Vn(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,ce,cn,Ke,Nr,st,is,$(sn),G,q,J];function xt(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!xt(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(!xt(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 Ct(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,Fe=Ye*Ye*Ye,on=Math.PI/180,$n=180/Math.PI;function Jn(u){return(u%=360)<0&&(u+=360),u}function Nn([u,o,c,p]){let m,v;const w=qr((.2225045*(u=An(u))+.7168786*(o=An(o))+.0606169*(c=An(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 An(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function qr(u){return u>Fe?Math.pow(u,1/3):u/Te+Ne}function si([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*Dr(m),v=Ht*Dr(v),w=Kt*Dr(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 Dr(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 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=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,R,F,j,X,H,tt,ut,pt,At]=w,Et=[R||" ",X||" ",ut].join("");if(Et===" "||Et===" /"||Et===",,"||Et===",,,"){const Nt=[k,j,tt].join(""),Ft=Nt==="%%%"?100:Nt===""?255:0;if(Ft){const Jt=[ou(+T/Ft,0,1),ou(+F/Ft,0,1),ou(+H/Ft,0,1),pt?xd(+pt,At):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,R,F,j,X,H]=v,tt=[T||" ",R||" ",j].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ut=[+E,ou(+k,0,100),ou(+F,0,100),X?xd(+X,H):1];if(su(ut))return function([pt,At,Et,Nt]){function Ft(Jt){const ve=(Jt+pt/30)%12,Me=At*Math.min(Et,1-Et);return Et-Me*Math.max(-1,Math.min(ve-3,9-ve,1))}return pt=Jn(pt),At/=100,Et/=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]=Nn(o),w=Math.sqrt(p*p+m*m);return[Math.round(1e4*w)?Jn(Math.atan2(m,p)*$n):NaN,w,c,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Nn(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 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 Ro{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Ro)return o;if(typeof o=="number")return new Ro([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 Ro(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 Hn||u instanceof mf||u instanceof Zr||u instanceof Ro||u instanceof os||u instanceof Rr)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 cn;if(typeof u=="boolean")return Ke;if(typeof u=="number")return ce;if(u instanceof Hn)return Nr;if(u instanceof mf)return Ss;if(u instanceof Zr)return st;if(u instanceof Ro)return G;if(u instanceof os)return J;if(u instanceof Rr)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=sn;break}c=m}return $(c||sn,o)}return is}function Un(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Hn||u instanceof Zr||u instanceof Ro||u instanceof os||u instanceof Rr?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 Ni{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Gc={string:cn,number:ce,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=sn;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=$(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":Nr,"to-number":ce,"to-string":cn};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 Hn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new Ni(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=Ro.parse(c);if(m)return m}throw new Ni(`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 Ni(`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 Ni(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Zr.fromString(Un(this.args[0].evaluate(o)));case"resolvedImage":return Rr.fromString(Un(this.args[0].evaluate(o)));default:return Un(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]=Hn.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 oi(p,o))}checkSubtype(o,c){const p=xt(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,cn),!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 Hu(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 R=0;Rc[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 R of T){const F=[R.x+v[0],R.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,R]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(" | "),R=[];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 Yu(u){if(u instanceof as&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(c=>{o&&!Yu(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 Ni("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,ce);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,R,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 Ln(u,o,c){return u+c*(o-u)}function Yc(u,o,c){return u.map((p,m)=>Ln(p,o[m],c))}const Oo={number:Ln,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,k,R,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,R!==1&&R!==0||(X=v));else{let At=T-m;T>m&&At>180?At-=360:T180&&(At+=360),j=m+c*At}const[H,tt,ut,pt]=function([At,Et,Nt,Ft]){return At=isNaN(At)?0:At*on,si([Nt,Math.cos(At)*Et,Math.sin(At)*Et,Ft])}([j,X??Ln(v,k,c),Ln(w,R,c),Ln(E,F,c)]);return new Hn(H,tt,ut,pt,!1)}case"lab":{const[m,v,w,E]=si(Yc(u.lab,o.lab,c));return new Hn(m,v,w,E,!1)}}},array:Yc,padding:function(u,o,c){return new Ro(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 Ni(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;wtypeof R!="number"||R<0||R>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,ce),!v)return null;const E=[];let T=null;p==="interpolate-hcl"||p==="interpolate-lab"?T=Nr:c.expectedType&&c.expectedType.kind!=="value"&&(T=c.expectedType);for(let k=0;k=R)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([R,H])}return Wt(T,ce)||Wt(T,Nr)||Wt(T,G)||Wt(T,J)||Wt(T,$(ce))?new zo(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=zo.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 Oo[this.type.kind](T,k,E);case"interpolate-hcl":return Oo.color(T,k,E,"hcl");case"interpolate-lab":return Oo.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=>xt(m,E.type));return new Kc(w?sn: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 Rr&&!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 Ni(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new Ni(`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,sn),m=c.parse(o[2],2,sn);return p&&m?rt(p.type,[Ke,cn,ce,ws,sn])?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(!Ct(c,["boolean","string","number","null"]))throw new Ni(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Ei(c))} instead.`);if(!Ct(p,["string","array"]))throw new Ni(`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=ce,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,sn),m=c.parse(o[2],2,sn);if(!p||!m)return null;if(!rt(p.type,[Ke,cn,ce,ws,sn]))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,ce);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(!Ct(c,["boolean","string","number","null"]))throw new Ni(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Ei(c))} instead.`);if(!Ct(p,["string","array"]))throw new Ni(`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,sn);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,sn),m=c.parse(o[2],2,ce);if(!p||!m)return null;if(!rt(p.type,[$(sn),cn,sn]))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,ce);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(!Ct(c,["string","array"]))throw new Ni(`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 rx{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,sn);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,sn);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 R=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(R=w.parse(v[3],3,Ss),!R)return null}return new rx(T,k,R)}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 Ni(`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=cn,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,ce);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,cn),!v))return null;let w=null;if(m.currency&&(w=c.parse(m.currency,1,cn),!w))return null;let E=null;if(m["min-fraction-digits"]&&(E=c.parse(m["min-fraction-digits"],1,ce),!E))return null;let T=null;return m["max-fraction-digits"]&&(T=c.parse(m["max-fraction-digits"],1,ce),!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,ce),!T))return null;let k=null;if(E["text-font"]&&(k=c.parse(E["text-font"],1,$(cn)),!k))return null;let R=null;if(E["text-color"]&&(R=c.parse(E["text-color"],1,Nr),!R))return null;const F=m[m.length-1];F.scale=T,F.font=k,F.textColor=R}else{const T=c.parse(o[w],1,sn);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(Un(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,cn);return p?new Mf(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=Rr.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=ce,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 Ni(`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:zo,"interpolate-hcl":zo,"interpolate-lab":zo,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 Ni(w);return new Hn(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 Gn(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 Mn(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 R=c?Hn.parse:Ro.parse;(u=yo({},u)).stops&&(u.stops=u.stops.map(F=>[F[0],R(F[1])])),u.default=R(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=Ku;else if(v==="interval")E=vi;else if(v==="categorical"){E=Ci,T=Object.create(null);for(const R of u.stops)T[R[0]]=R[1];k=typeof u.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Rd}if(p){const R={},F=[];for(let H=0;HH[0]),evaluate:({zoom:H},tt)=>Ku({stops:j,base:u.base},o,H).evaluate(H,tt)}}if(m){const R=v==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:zo.interpolationFactor.bind(void 0,R),zoomStops:u.stops.map(F=>F[0]),evaluate:({zoom:F})=>E(u,o,F,T,k)}}return{kind:"source",evaluate(R,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 vi(u,o,c){if(Gn(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 Ku(u,o,c){const p=u.base!==void 0?u.base:1;if(Gn(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(R=>R[0]),c),w=function(R,F,j,X){const H=X-j,tt=R-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=Oo[o.type]||$g;return typeof E.evaluate=="function"?{evaluate(...R){const F=E.evaluate.apply(void 0,R),j=T.evaluate.apply(void 0,R);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=Hn.parse(c);break;case"formatted":c=Zr.fromString(c.toString());break;case"resolvedImage":c=Rr.fromString(c.toString());break;case"padding":c=Ro.parse(c);break;default:Gn(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"},[cn],(u,[o])=>{throw new Ni(o.evaluate(u))}],typeof:[cn,[sn],(u,[o])=>ot(Ei(o.evaluate(u)))],"to-rgba":[$(ce,4),[Nr],(u,[o])=>{const[c,p,m,v]=o.evaluate(u).rgb;return[255*c,255*p,255*m,v]}],rgb:[Nr,[ce,ce,ce],kd],rgba:[Nr,[ce,ce,ce,ce],kd],has:{type:Ke,overloads:[[[cn],(u,[o])=>Ad(o.evaluate(u),u.properties())],[[cn,is],(u,[o,c])=>Ad(o.evaluate(u),c.evaluate(u))]]},get:{type:sn,overloads:[[[cn],(u,[o])=>kf(o.evaluate(u),u.properties())],[[cn,is],(u,[o,c])=>kf(o.evaluate(u),c.evaluate(u))]]},"feature-state":[sn,[cn],(u,[o])=>kf(o.evaluate(u),u.featureState||{})],properties:[is,[],u=>u.properties()],"geometry-type":[cn,[],u=>u.geometryType()],id:[sn,[],u=>u.id()],zoom:[ce,[],u=>u.globals.zoom],"heatmap-density":[ce,[],u=>u.globals.heatmapDensity||0],"line-progress":[ce,[],u=>u.globals.lineProgress||0],accumulated:[sn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ce,Il(ce),(u,o)=>{let c=0;for(const p of o)c+=p.evaluate(u);return c}],"*":[ce,Il(ce),(u,o)=>{let c=1;for(const p of o)c*=p.evaluate(u);return c}],"-":{type:ce,overloads:[[[ce,ce],(u,[o,c])=>o.evaluate(u)-c.evaluate(u)],[[ce],(u,[o])=>-o.evaluate(u)]]},"/":[ce,[ce,ce],(u,[o,c])=>o.evaluate(u)/c.evaluate(u)],"%":[ce,[ce,ce],(u,[o,c])=>o.evaluate(u)%c.evaluate(u)],ln2:[ce,[],()=>Math.LN2],pi:[ce,[],()=>Math.PI],e:[ce,[],()=>Math.E],"^":[ce,[ce,ce],(u,[o,c])=>Math.pow(o.evaluate(u),c.evaluate(u))],sqrt:[ce,[ce],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ce,[ce],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ce,[ce],(u,[o])=>Math.log(o.evaluate(u))],log2:[ce,[ce],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ce,[ce],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ce,[ce],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ce,[ce],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ce,[ce],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ce,[ce],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ce,[ce],(u,[o])=>Math.atan(o.evaluate(u))],min:[ce,Il(ce),(u,o)=>Math.min(...o.map(c=>c.evaluate(u)))],max:[ce,Il(ce),(u,o)=>Math.max(...o.map(c=>c.evaluate(u)))],abs:[ce,[ce],(u,[o])=>Math.abs(o.evaluate(u))],round:[ce,[ce],(u,[o])=>{const c=o.evaluate(u);return c<0?-Math.round(-c):Math.round(c)}],floor:[ce,[ce],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ce,[ce],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[Ke,[cn,sn],(u,[o,c])=>u.properties()[o.value]===c.value],"filter-id-==":[Ke,[sn],(u,[o])=>u.id()===o.value],"filter-type-==":[Ke,[cn],(u,[o])=>u.geometryType()===o.value],"filter-<":[Ke,[cn,sn],(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,[cn,sn],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>m}],"filter-id->":[Ke,[sn],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ke,[cn,sn],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p<=m}],"filter-id-<=":[Ke,[sn],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ke,[cn,sn],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>=m}],"filter-id->=":[Ke,[sn],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ke,[sn],(u,[o])=>o.value in u.properties()],"filter-has-id":[Ke,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[Ke,[$(cn)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[Ke,[$(sn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[Ke,[cn,$(sn)],(u,[o,c])=>c.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[Ke,[cn,$(sn)],(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,[cn],(u,[o])=>{const c=u.globals&&u.globals.isSupportedScript;return!c||c(o.evaluate(u))}],upcase:[cn,[cn],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[cn,[cn],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[cn,Il(sn),(u,o)=>o.map(c=>Un(c.evaluate(u))).join("")],"resolved-locale":[cn,[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 Hn(0,0,0,0):p.type==="color"?Hn.parse(p.default)||null:p.type==="padding"?Ro.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 Ni(`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:Nr,string:cn,number:ce,enum:cn,boolean:Ke,formatted:st,padding:G,resolvedImage:q,variableAnchorOffsetCollection:J};return m.type==="array"?$(v[m.value]||sn,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"&&!Yu(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"&&!Yu(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?zo.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 oi("","data expressions not supported")]);const v=Hc(p,["zoom"]);if(!v&&!Dd(o))return Qa([new oi("","zoom expressions not supported")]);const w=Qu(p);return w||v?w instanceof oi?Qa([w]):w instanceof zo&&!Af(o)?Qa([new oi("",'"interpolate" expressions cannot be used with this property')]):Nd(w?new rh(m?"camera":"composite",c.value,w.labels,w instanceof zo?w.interpolation:void 0):new Df(m?"constant":"source",c.value)):Qa([new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ju{constructor(o,c){this._parameters=o,this._specification=c,yo(this,Mn(this._parameters,this._specification))}static deserialize(o){return new Ju(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Qu(u){let o=null;if(u instanceof Jc)o=Qu(u.result);else if(u instanceof Kc){for(const c of u.args)if(o=Qu(c),o)break}else(u instanceof Ja||u instanceof zo)&&u.input instanceof as&&u.input.name==="zoom"&&(o=u);return o instanceof oi||u.eachChild(c=>{const p=Qu(c);p instanceof oi?o=p:!o&&p?o=new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function tc(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(!tc(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};tc(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(ec)):o==="in"?zd(u[1],u.slice(2)):o==="!in"?ec(zd(u[1],u.slice(2))):o==="has"?Fd(u[1]):o==="!has"?ec(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 ec(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 le(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function lh(u){const o=u.valueSpec,c=Di(u.value.type);let p,m,v,w={};const E=c!=="categorical"&&u.value.property===void 0,T=!E,k=Gn(u.value.stops)==="array"&&Gn(u.value.stops[0])==="array"&&Gn(u.value.stops[0][0])==="object",R=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 le(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})),Gn(tt)==="array"&&tt.length===0&&H.push(new le(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&&R.push(new le(u.key,u.value,'missing required property "property"')),c==="identity"||u.value.stops||R.push(new le(u.key,u.value,'missing required property "stops"')),c==="exponential"&&u.valueSpec.expression&&!Af(u.valueSpec)&&R.push(new le(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(T&&!hu(u.valueSpec)?R.push(new le(u.key,u.value,"property functions not supported")):E&&!Dd(u.valueSpec)&&R.push(new le(u.key,u.value,"zoom functions not supported"))),c!=="categorical"&&!k||u.value.property!==void 0||R.push(new le(u.key,u.value,'"property" property is required')),R;function F(X){let H=[];const tt=X.value,ut=X.key;if(Gn(tt)!=="array")return[new le(ut,tt,`array expected, ${Gn(tt)} found`)];if(tt.length!==2)return[new le(ut,tt,`array length 2 expected, length ${tt.length} found`)];if(k){if(Gn(tt[0])!=="object")return[new le(ut,tt,`object expected, ${Gn(tt[0])} found`)];if(tt[0].zoom===void 0)return[new le(ut,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new le(ut,tt,"object stop key must have value")];if(v&&v>Di(tt[0].zoom))return[new le(ut,tt[0].zoom,"stop zoom values must appear in ascending order")];Di(tt[0].zoom)!==v&&(v=Di(tt[0].zoom),m=void 0,w={}),H=H.concat(vo({key:`${ut}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,objectElementValidators:{zoom:nc,value:j}}))}else H=H.concat(j({key:`${ut}[0]`,value:tt[0],valueSpec:{},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec},tt));return nh(Tl(tt[1]))?H.concat([new le(`${ut}[1]`,tt[1],"expressions are not allowed in function stops.")]):H.concat(X.validateSpec({key:`${ut}[1]`,value:tt[1],valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec}))}function j(X,H){const tt=Gn(X.value),ut=Di(X.value),pt=X.value!==null?X.value:H;if(p){if(tt!==p)return[new le(X.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 le(X.key,pt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let At=`number expected, ${tt} found`;return hu(o)&&c===void 0&&(At+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new le(X.key,pt,At)]}return c!=="categorical"||tt!=="number"||isFinite(ut)&&Math.floor(ut)===ut?c!=="categorical"&&tt==="number"&&m!==void 0&&utnew le(`${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 le(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"&&!Yu(c))return[new le(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!Yu(c))return[new le(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 le(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Xc(c))return[new le(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ic(u){const o=u.key,c=u.value,p=u.valueSpec,m=[];return Array.isArray(p.values)?p.values.indexOf(Di(c))===-1&&m.push(new le(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(Di(c))===-1&&m.push(new le(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),m}function pu(u){return tc(Tl(u.value))?Ll(yo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Vd(u)}function Vd(u){const o=u.value,c=u.key;if(Gn(o)!=="array")return[new le(c,o,`array expected, ${Gn(o)} found`)];const p=u.styleSpec;let m,v=[];if(o.length<1)return[new le(c,o,"filter array must have at least 1 element")];switch(v=v.concat(ic({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Di(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Di(o[1])==="$type"&&v.push(new le(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new le(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(m=Gn(o[1]),m!=="string"&&v.push(new le(`${c}[1]`,o[1],`string expected, ${m} found`)));for(let w=2;w{k in c&&o.push(new le(p,c[k],`"${k}" is prohibited for ref layers`))}),m.layers.forEach(k=>{Di(k.id)===E&&(T=k)}),T?T.ref?o.push(new le(p,c.ref,"ref cannot reference another ref layer")):w=Di(T.type):o.push(new le(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&&Di(T.type);T?k==="vector"&&w==="raster"?o.push(new le(p,c.source,`layer "${c.id}" requires a raster source`)):k!=="raster-dem"&&w==="hillshade"?o.push(new le(p,c.source,`layer "${c.id}" requires a raster-dem source`)):k==="raster"&&w!=="raster"?o.push(new le(p,c.source,`layer "${c.id}" requires a vector source`)):k!=="vector"||c["source-layer"]?k==="raster-dem"&&w!=="hillshade"?o.push(new le(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 le(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new le(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new le(p,c.source,`source "${c.source}" not found`))}else o.push(new le(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=Gn(o);return p!=="string"?[new le(c,o,`string expected, ${p} found`)]:[]}const rc={promoteId:function({key:u,value:o}){if(Gn(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 Fo(u){const o=u.value,c=u.key,p=u.styleSpec,m=u.style,v=u.validateSpec;if(!o.type)return[new le(c,o,'"type" is required')];const w=Di(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:rc,validateSpec:v}),E;case"raster-dem":return E=function(T){var k;const R=(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 ut=Gn(F);if(F===void 0)return tt;if(ut!=="object")return tt.push(new le("source_raster_dem",F,`object expected, ${ut} found`)),tt;const pt=Di(F.encoding)==="custom",At=["redFactor","greenFactor","blueFactor","baseShift"],Et=T.value.encoding?`"${T.value.encoding}"`:"Default";for(const Nt in F)!pt&&At.includes(Nt)?tt.push(new le(Nt,F[Nt],`In "${R}": "${Nt}" is only valid when "encoding" is set to "custom". ${Et} encoding found`)):X[Nt]?tt=tt.concat(T.validateSpec({key:Nt,value:F[Nt],valueSpec:X[Nt],validateSpec:T.validateSpec,style:H,styleSpec:j})):tt.push(new le(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:rc}),o.cluster)for(const T in o.clusterProperties){const[k,R]=o.clusterProperties[T],F=typeof k=="string"?[k,["accumulated"],["get",T]]:k;E.push(...Ll({key:`${c}.${T}.map`,value:R,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 le(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ic({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:p})}}function oc(u){const o=u.value,c=u.styleSpec,p=c.light,m=u.style;let v=[];const w=Gn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new le("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 le(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=Gn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new le("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 le(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 le(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 le(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=Gn(o);return p!=="boolean"?[new le(c,o,`boolean expected, ${p} found`)]:[]},number:nc,color:function(u){const o=u.key,c=u.value,p=Gn(c);return p!=="string"?[new le(o,c,`color expected, ${p} found`)]:Hn.parse(String(c))?[]:[new le(o,c,`color expected, "${c}" found`)]},constants:Bd,enum:ic,filter:pu,function:lh,layer:qd,object:vo,source:Fo,light:oc,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(Gn(c)==="array"){if(c.length<1||c.length>4)return[new le(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(Fo)),ls.sprite=Ta(Ca($d)),ls.glyphs=Ta(Ca(Xd)),ls.light=Ta(Ca(oc)),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 mn(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(R[X])):E[X]=!1}}}}_forEachCell(o,c,p,m,v,w,E,T){const k=this._convertToCellCoord(o),R=this._convertToCellCoord(c),F=this._convertToCellCoord(p),j=this._convertToCellCoord(m);for(let X=k;X<=F;X++)for(let H=R;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)||bn(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!(ye.Arabic(u)||ye["Arabic Supplement"](u)||ye["Arabic Extended-A"](u)||ye["Arabic Presentation Forms-A"](u)||ye["Arabic Presentation Forms-B"](u))}function Uf(u){return!(u!==746&&u!==747&&(u<4352||!(ye["Bopomofo Extended"](u)||ye.Bopomofo(u)||ye["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||ye["CJK Compatibility Ideographs"](u)||ye["CJK Compatibility"](u)||ye["CJK Radicals Supplement"](u)||ye["CJK Strokes"](u)||!(!ye["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||ye["CJK Unified Ideographs Extension A"](u)||ye["CJK Unified Ideographs"](u)||ye["Enclosed CJK Letters and Months"](u)||ye["Hangul Compatibility Jamo"](u)||ye["Hangul Jamo Extended-A"](u)||ye["Hangul Jamo Extended-B"](u)||ye["Hangul Jamo"](u)||ye["Hangul Syllables"](u)||ye.Hiragana(u)||ye["Ideographic Description Characters"](u)||ye.Kanbun(u)||ye["Kangxi Radicals"](u)||ye["Katakana Phonetic Extensions"](u)||ye.Katakana(u)&&u!==12540||!(!ye["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)||!(!ye["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||ye["Unified Canadian Aboriginal Syllabics"](u)||ye["Unified Canadian Aboriginal Syllabics Extended"](u)||ye["Vertical Forms"](u)||ye["Yijing Hexagram Symbols"](u)||ye["Yi Syllables"](u)||ye["Yi Radicals"](u))))}function Kd(u){return!(Uf(u)||function(o){return!!(ye["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||ye["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)||ye["Letterlike Symbols"](o)||ye["Number Forms"](o)||ye["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)||ye["Control Pictures"](o)&&o!==9251||ye["Optical Character Recognition"](o)||ye["Enclosed Alphanumerics"](o)||ye["Geometric Shapes"](o)||ye["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||ye["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||ye["CJK Symbols and Punctuation"](o)||ye.Katakana(o)||ye["Private Use Area"](o)||ye["CJK Compatibility Forms"](o)||ye["Small Form Variants"](o)||ye["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||ye["Arabic Presentation Forms-A"](u)||ye["Arabic Presentation Forms-B"](u)}function Qd(u,o){return!(!o&&Jd(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||ye.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 sc=function(u){u&&typeof u=="string"&&u.indexOf("NetworkError")>-1&&(bo="error"),Zf&&Zf(u)};function $f(){ac.fire(new un("pluginStateChange",{pluginStatus:bo,pluginURL:el}))}const ac=new Xi,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&&Lt({url:el},u=>{u?sc(u):(bo=qf,$f())})},Bo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>bo===qf||Bo.applyArabicShaping!=null,isLoading:()=>bo===jf,setState(u){if(!ne())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(!ne())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Bo.applyArabicShaping!=null&&Bo.processBidirectionalText!=null&&Bo.processStyledBidirectionalText!=null},getPluginURL(){if(!ne())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return el}};class di{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,Bo.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 Ju(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=Hn.parse(p):m.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(v=os.parse(p)):v=Ro.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 bt(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:bt(c))}getTransition(o){return bt(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=bt(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,R=k*T;return 4*(T<.5?R:3*(T-k)+R-.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 bt(this._values[o].value)}setValue(o,c){this._values[o]=new fh(this._values[o].property,c===null?void 0:bt(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 De{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=Oo[this.specification.type];return m?m(o,c,p):o}}class je{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=Oo[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 lc extends je{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 di(Math.floor(c.zoom-1),c)),o.expression.evaluate(new di(Math.floor(c.zoom),c)),o.expression.evaluate(new di(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 fh(p,void 0),v=this.defaultTransitionablePropertyValues[c]=new Xf(p);this.defaultTransitioningPropertyValues[c]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate({})}}}we("DataDrivenProperty",je),we("DataConstantProperty",De),we("CrossFadedDataDrivenProperty",lc),we("CrossFadedProperty",Hf),we("ColorRampProperty",Yf);const Kf="-transition";class us 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 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),_t(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 Ri{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 uc extends Ri{_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}}uc.prototype.bytesPerElement=4,we("StructArrayLayout2i4",uc);class cc extends Ri{_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}}cc.prototype.bytesPerElement=6,we("StructArrayLayout3i6",cc);class Pl extends Ri{_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,we("StructArrayLayout4i8",Pl);class Jf extends Ri{_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,we("StructArrayLayout2i4i12",Jf);class Qf extends Ri{_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,we("StructArrayLayout2i4ub8",Qf);class _u extends Ri{_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,we("StructArrayLayout2f8",_u);class tp extends Ri{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w,E,T,k,R){const F=this.length;return this.resize(F+1),this.emplace(F,o,c,p,m,v,w,E,T,k,R)}emplace(o,c,p,m,v,w,E,T,k,R,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]=R,this.uint16[j+9]=F,o}}tp.prototype.bytesPerElement=20,we("StructArrayLayout10ui20",tp);class ep extends Ri{_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,R,F,j){const X=this.length;return this.resize(X+1),this.emplace(X,o,c,p,m,v,w,E,T,k,R,F,j)}emplace(o,c,p,m,v,w,E,T,k,R,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]=R,this.int16[H+9]=F,this.int16[H+10]=j,this.int16[H+11]=X,o}}ep.prototype.bytesPerElement=24,we("StructArrayLayout4i4ui4i24",ep);class jn extends Ri{_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}}jn.prototype.bytesPerElement=12,we("StructArrayLayout3f12",jn);class y extends Ri{_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,we("StructArrayLayout1ul4",y);class s extends Ri{_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 R=this.length;return this.resize(R+1),this.emplace(R,o,c,p,m,v,w,E,T,k)}emplace(o,c,p,m,v,w,E,T,k,R){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]=R,o}}s.prototype.bytesPerElement=20,we("StructArrayLayout6i1ul2ui20",s);class h extends Ri{_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,we("StructArrayLayout2i2i2i12",h);class d extends Ri{_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,we("StructArrayLayout2f1f2i16",d);class g extends Ri{_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,we("StructArrayLayout2ub2f12",g);class b extends Ri{_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,we("StructArrayLayout3ui6",b);class I extends Ri{_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,R,F,j,X,H,tt,ut,pt){const At=this.length;return this.resize(At+1),this.emplace(At,o,c,p,m,v,w,E,T,k,R,F,j,X,H,tt,ut,pt)}emplace(o,c,p,m,v,w,E,T,k,R,F,j,X,H,tt,ut,pt,At){const Et=24*o,Nt=12*o,Ft=48*o;return this.int16[Et+0]=c,this.int16[Et+1]=p,this.uint16[Et+2]=m,this.uint16[Et+3]=v,this.uint32[Nt+2]=w,this.uint32[Nt+3]=E,this.uint32[Nt+4]=T,this.uint16[Et+10]=k,this.uint16[Et+11]=R,this.uint16[Et+12]=F,this.float32[Nt+7]=j,this.float32[Nt+8]=X,this.uint8[Ft+36]=H,this.uint8[Ft+37]=tt,this.uint8[Ft+38]=ut,this.uint32[Nt+10]=pt,this.int16[Et+22]=At,o}}I.prototype.bytesPerElement=48,we("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",I);class C extends Ri{_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,R,F,j,X,H,tt,ut,pt,At,Et,Nt,Ft,Jt,ve,Me,_e,me,ue,Se){const he=this.length;return this.resize(he+1),this.emplace(he,o,c,p,m,v,w,E,T,k,R,F,j,X,H,tt,ut,pt,At,Et,Nt,Ft,Jt,ve,Me,_e,me,ue,Se)}emplace(o,c,p,m,v,w,E,T,k,R,F,j,X,H,tt,ut,pt,At,Et,Nt,Ft,Jt,ve,Me,_e,me,ue,Se,he){const re=32*o,ze=16*o;return this.int16[re+0]=c,this.int16[re+1]=p,this.int16[re+2]=m,this.int16[re+3]=v,this.int16[re+4]=w,this.int16[re+5]=E,this.int16[re+6]=T,this.int16[re+7]=k,this.uint16[re+8]=R,this.uint16[re+9]=F,this.uint16[re+10]=j,this.uint16[re+11]=X,this.uint16[re+12]=H,this.uint16[re+13]=tt,this.uint16[re+14]=ut,this.uint16[re+15]=pt,this.uint16[re+16]=At,this.uint16[re+17]=Et,this.uint16[re+18]=Nt,this.uint16[re+19]=Ft,this.uint16[re+20]=Jt,this.uint16[re+21]=ve,this.uint16[re+22]=Me,this.uint32[ze+12]=_e,this.float32[ze+13]=me,this.float32[ze+14]=ue,this.uint16[re+30]=Se,this.uint16[re+31]=he,o}}C.prototype.bytesPerElement=64,we("StructArrayLayout8i15ui1ul2f2ui64",C);class M extends Ri{_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,we("StructArrayLayout1f4",M);class N extends Ri{_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,we("StructArrayLayout1ui2f12",N);class O extends Ri{_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,we("StructArrayLayout1ul2ui8",O);class z extends Ri{_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,we("StructArrayLayout2ui4",z);class W extends Ri{_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,we("StructArrayLayout1ui2",W);class nt extends Ri{_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,we("StructArrayLayout4f16",nt);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)}}we("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 Tt extends I{get(o){return new Q(this,o)}}we("PlacedSymbolArray",Tt);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)}}we("SymbolInstanceArray",ct);class Pt extends M{getoffsetX(o){return this.float32[1*o+0]}}we("GlyphOffsetArray",Pt);class Bt extends cc{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}we("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)}}we("TextAnchorOffsetArray",Yt);class ie 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]}}ie.prototype.size=8;class te extends O{get(o){return new ie(this,o)}}we("FeatureIndexArray",te);class ae extends uc{}class Le extends uc{}class wn extends uc{}class de extends Jf{}class qe extends Qf{}class Pe extends _u{}class Yn extends tp{}class vn extends ep{}class hn extends jn{}class Sn extends y{}class Gi extends h{}class ai extends g{}class Or extends b{}class pr extends z{}const Yi=Ti([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vo}=Yi;class mi{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,m){let v=this.segments[this.segments.length-1];return o>mi.MAX_VERTEX_ARRAY_LENGTH&&kt(`Max vertices per segment is ${mi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>mi.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 mi([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:m,vaos:{},sortKey:0}])}}function Zs(u,o){return 256*(u=mt(Math.floor(u),0,255))+mt(Math.floor(o),0,255)}mi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,we("SegmentVector",mi);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 zr=yu,ao=$r.exports;nl.exports=zr,nl.exports.murmur3=zr,nl.exports.murmur2=ao;var Al=x(nl.exports);class ji{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 ji;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;qi(u,v,w),qi(o,3*v,3*w),qi(o,3*v+1,3*w+1),qi(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 di(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 di(this.zoom),c,{},m,[],v),E=this.expression.evaluate(new di(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 ji,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 Dw(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:nt},number:{source:M,composite:_u}},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]}we("ConstantBinder",Ws),we("CrossFadedConstantBinder",Dl),we("SourceExpressionBinder",Xs),we("CrossFadedCompositeBinder",Hs),we("CompositeExpressionBinder",cs),we("ProgramConfiguration",ip,{omit:["_buffers"]}),we("ProgramConfigurationSet",Pa);const rr=8192,t_=Math.pow(2,14)-1,s0=-t_-1;function hc(u){const o=rr/u.extent,c=u.loadGeometry();for(let p=0;pw.x+1||Tw.y+1)&&kt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function fc(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?hc(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 Or,this.segments=new mi,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:R,sourceLayerIndex:F}of o){const j=this.layers[0]._featureFilter.needGeometry,X=fc(T,j);if(!this.layers[0]._featureFilter.filter(new di(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:R,geometry:j?X.geometry:hc(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:R,sourceLayerIndex:F}=T,j=o[R].feature;this.addFeature(T,k,R,p),c.featureIndex.insert(j,k,R,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,Vo),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),R=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(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+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 Fw(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(ut,tt))}(k,T),X=F?R*E:R;for(const H of m)for(const tt of H){const ut=F?tt:d0(tt,T);let pt=X;const At=cm([],[tt.x,tt.y,0,1],T);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=At[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=w.cameraToCenterDistance/At[3]),Rw(j,ut,pt))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;we("HeatmapBucket",m0,{omit:["layers"]});var Gw={get paint(){return g0=g0||new Hi({"heatmap-radius":new je($t.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je($t.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new De($t.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yf($t.paint_heatmap["heatmap-color"]),"heatmap-opacity":new De($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 pc(u,o){if(!u)return u;o||(o=u);var c,p=u;do if(c=!1,p.steiner||!fm(p,p.next)&&Ki(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(R,F,j,X){var H=R;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!==R);H.prevZ.nextZ=null,H.prevZ=null,function(tt){var ut,pt,At,Et,Nt,Ft,Jt,ve,Me=1;do{for(pt=tt,tt=null,Nt=null,Ft=0;pt;){for(Ft++,At=pt,Jt=0,ut=0;ut0||ve>0&&At;)Jt!==0&&(ve===0||!At||pt.z<=At.z)?(Et=pt,pt=pt.nextZ,Jt--):(Et=At,At=At.nextZ,ve--),Nt?Nt.nextZ=Et:tt=Et,Et.prevZ=Nt,Nt=Et;pt=At}Nt.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?Hw(u,p,m,v):Xw(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=Yw(pc(u),o,c),o,c,p,m,v,2):w===2&&Kw(u,o,c,p,m,v):ap(pc(u),o,c,p,m,v,1);break}}}function Xw(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,k=p.y,R=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>=R&&H.x<=j&&H.y>=F&&H.y<=X&&_h(m,E,v,T,w,k,H.x,H.y)&&Ki(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function Hw(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,k=w.x,R=m.y,F=v.y,j=w.y,X=ET?E>k?E:k:T>k?T:k,ut=R>F?R>j?R:j:F>j?F:j,pt=l_(X,H,o,c,p),At=l_(tt,ut,o,c,p),Et=u.prevZ,Nt=u.nextZ;Et&&Et.z>=pt&&Nt&&Nt.z<=At;){if(Et.x>=X&&Et.x<=tt&&Et.y>=H&&Et.y<=ut&&Et!==m&&Et!==w&&_h(E,R,T,F,k,j,Et.x,Et.y)&&Ki(Et.prev,Et,Et.next)>=0||(Et=Et.prevZ,Nt.x>=X&&Nt.x<=tt&&Nt.y>=H&&Nt.y<=ut&&Nt!==m&&Nt!==w&&_h(E,R,T,F,k,j,Nt.x,Nt.y)&&Ki(Nt.prev,Nt,Nt.next)>=0))return!1;Nt=Nt.nextZ}for(;Et&&Et.z>=pt;){if(Et.x>=X&&Et.x<=tt&&Et.y>=H&&Et.y<=ut&&Et!==m&&Et!==w&&_h(E,R,T,F,k,j,Et.x,Et.y)&&Ki(Et.prev,Et,Et.next)>=0)return!1;Et=Et.prevZ}for(;Nt&&Nt.z<=At;){if(Nt.x>=X&&Nt.x<=tt&&Nt.y>=H&&Nt.y<=ut&&Nt!==m&&Nt!==w&&_h(E,R,T,F,k,j,Nt.x,Nt.y)&&Ki(Nt.prev,Nt,Nt.next)>=0)return!1;Nt=Nt.nextZ}return!0}function Yw(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 pc(p)}function Kw(u,o,c,p,m,v){var w=u;do{for(var E=w.next.next;E!==w.prev;){if(w.i!==E.i&&n2(w,E)){var T=w0(w,E);return w=pc(w,w.next),T=pc(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 Jw(u,o){return u.x-o.x}function Qw(u,o){var c=function(m,v){var w,E=v,T=m.x,k=m.y,R=-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>R&&(R=F,w=E.x=E.x&&E.x>=H&&T!==E.x&&_h(kw.x||E.x===w.x&&t2(w,E)))&&(w=E,ut=j)),E=E.next;while(E!==X);return w}(u,o);if(!c)return o;var p=w0(c,u);return pc(p,p.next),pc(c,c.next)}function t2(u,o){return Ki(u.prev,u,o.prev)<0&&Ki(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 e2(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 n2(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)&&(Ki(u.prev,u,o.prev)||Ki(u,o.prev,o))||fm(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 fm(u,o){return u.x===o.x&&u.y===o.y}function x0(u,o,c,p){var m=dm(Ki(u,o,c)),v=dm(Ki(u,o,p)),w=dm(Ki(c,p,u)),E=dm(Ki(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 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 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 i2(u,o,c,p,m){I0(u,o,c||0,p||u.length-1,m||r2)}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 R=u[o],F=c,j=p;for(cp(u,c,o),m(u[p],R)>0&&cp(u,c,p);F0;)j--}m(u[c],R)===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 r2(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 wn,this.indexArray=new Or,this.indexArray2=new pr,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new mi,this.segments2=new mi,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:R}of o){const F=this.layers[0]._featureFilter.needGeometry,j=fc(E,F);if(!this.layers[0]._featureFilter.filter(new di(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:R,index:k,geometry:F?j.geometry:hc(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:R}=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,R,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,Ww),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,R=[],F=[];for(const X of w){if(X.length===0)continue;X!==w[0]&&F.push(R.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),R.push(X[0].x),R.push(X[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 h2(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 R(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 d2(this._pbf,o,this.extent,this._keys,this._values)};var g2=M0;function _2(u,o,c){if(u===3){var p=new g2(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}vu.VectorTile=function(u,o){this.layers=u.readFields(_2,{},o)},vu.VectorTileFeature=L0,vu.VectorTileLayer=M0;const y2=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 de,this.centroidVertexArray=new ae,this.indexArray=new Or,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new mi,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=fc(m,T);if(!this.layers[0]._featureFilter.filter(new di(this.zoom),k,p))continue;const R={id:v,sourceLayerIndex:E,index:w,geometry:T?k.geometry:hc(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(p_("fill-extrusion",this.layers,R,this.zoom,c)):this.addFeature(R,R.geometry,w,p,{}),c.featureIndex.insert(m,R.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,c2),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,u2.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||b2(H))continue;let tt=0;for(let ut=0;ut=1){const At=H[ut-1];if(!v2(pt,At)){k.vertexLength+4>mi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Et=pt.sub(At)._perp()._unit(),Nt=At.dist(pt);tt+Nt>32768&&(tt=0),hp(this.layoutVertexArray,pt.x,pt.y,Et.x,Et.y,0,0,tt),hp(this.layoutVertexArray,pt.x,pt.y,Et.x,Et.y,0,1,tt),w.x+=2*pt.x,w.y+=2*pt.y,w.vertexCount+=2,tt+=Nt,hp(this.layoutVertexArray,At.x,At.y,Et.x,Et.y,0,0,tt),hp(this.layoutVertexArray,At.x,At.y,Et.x,Et.y,0,1,tt),w.x+=2*At.x,w.y+=2*At.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>mi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),y2[o.type]!=="Polygon")continue;const R=[],F=[],j=k.vertexLength;for(const H of E)if(H.length!==0){H!==E[0]&&F.push(R.length/2);for(let tt=0;ttrr)||u.y===o.y&&(u.y<0||u.y>rr)}function b2(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;we("FillExtrusionBucket",g_,{omit:["layers","features"]});var x2={get paint(){return k0=k0||new Hi({"fill-extrusion-opacity":new De($t["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je($t["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new De($t["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new De($t["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new lc($t["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je($t["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je($t["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new De($t["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class w2 extends us{constructor(o){super(o,x2)}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),R=this.paint.get("fill-extrusion-height").evaluate(c,p),F=this.paint.get("fill-extrusion-base").evaluate(c,p),j=function(H,tt,ut,pt){const At=[];for(const Et of H){const Nt=[Et.x,Et.y,0,1];cm(Nt,Nt,tt),At.push(new A(Nt[0]/Nt[3],Nt[1]/Nt[3]))}return At}(k,T),X=function(H,tt,ut,pt){const At=[],Et=[],Nt=pt[8]*tt,Ft=pt[9]*tt,Jt=pt[10]*tt,ve=pt[11]*tt,Me=pt[8]*ut,_e=pt[9]*ut,me=pt[10]*ut,ue=pt[11]*ut;for(const Se of H){const he=[],re=[];for(const ze of Se){const Ae=ze.x,gn=ze.y,gi=pt[0]*Ae+pt[4]*gn+pt[12],bi=pt[1]*Ae+pt[5]*gn+pt[13],gr=pt[2]*Ae+pt[6]*gn+pt[14],hs=pt[3]*Ae+pt[7]*gn+pt[15],So=gr+Jt,or=hs+ve,Fr=gi+Me,Xr=bi+_e,Eo=gr+me,Io=hs+ue,_r=new A((gi+Nt)/or,(bi+Ft)/or);_r.z=So/or,he.push(_r);const yr=new A(Fr/Io,Xr/Io);yr.z=Eo/Io,re.push(yr)}At.push(he),Et.push(re)}return[At,Et]}(m,F,R,T);return function(H,tt,ut){let pt=1/0;l0(ut,tt)&&(pt=A0(ut,tt[0]));for(let At=0;Atc.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 qe,this.layoutVertexArray2=new Pe,this.indexArray=new Or,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new mi,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:R}of o){const F=this.layers[0]._featureFilter.needGeometry,j=fc(E,F);if(!this.layers[0]._featureFilter.filter(new di(this.zoom),j,p))continue;const X=v?m.evaluate(j,{},p):void 0,H={id:T,properties:E.properties,type:E.type,sourceLayerIndex:R,index:k,geometry:F?j.geometry:hc(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:R}=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,R,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,C2)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,E2),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"),R=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const F of c)this.addLine(F,o,E,T,k,R);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 k=0;for(;k0;if(ve&&pt>k){const ue=j.dist(X);if(ue>2*R){const Se=j.sub(j.sub(X)._mult(R/ue)._round());this.updateDistance(X,Se),this.addCurrentVertex(Se,tt,0,0,F),X=Se}}const _e=X&&H;let me=_e?p:E?"butt":m;if(_e&&me==="round"&&(Ftv&&(me="bevel"),me==="bevel"&&(Ft>2&&(me="flipbevel"),Ft100)At=ut.mult(-1);else{const ue=Ft*tt.add(ut).mag()/tt.sub(ut).mag();At._perp()._mult(ue*(Me?-1:1))}this.addCurrentVertex(j,At,0,0,F),this.addCurrentVertex(j,At.mult(-1),0,0,F)}else if(me==="bevel"||me==="fakeround"){const ue=-Math.sqrt(Ft*Ft-1),Se=Me?ue:0,he=Me?0:ue;if(X&&this.addCurrentVertex(j,tt,Se,he,F),me==="fakeround"){const re=Math.round(180*Jt/Math.PI/20);for(let ze=1;ze2*R){const Se=j.add(H.sub(j)._mult(R/ue)._round());this.updateDistance(j,Se),this.addCurrentVertex(Se,ut,0,0,F),j=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>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 R=T.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),T.primitiveLength++),w?this.e2=R:this.e1=R}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;we("LineBucket",__,{omit:["layers","patternFeatures"]});var O0={get paint(){return R0=R0||new Hi({"line-opacity":new je($t.paint_line["line-opacity"]),"line-color":new je($t.paint_line["line-color"]),"line-translate":new De($t.paint_line["line-translate"]),"line-translate-anchor":new De($t.paint_line["line-translate-anchor"]),"line-width":new je($t.paint_line["line-width"]),"line-gap-width":new je($t.paint_line["line-gap-width"]),"line-offset":new je($t.paint_line["line-offset"]),"line-blur":new je($t.paint_line["line-blur"]),"line-dasharray":new Hf($t.paint_line["line-dasharray"]),"line-pattern":new lc($t.paint_line["line-pattern"]),"line-gradient":new Yf($t.paint_line["line-gradient"])})},get layout(){return D0=D0||new Hi({"line-cap":new De($t.layout_line["line-cap"]),"line-join":new je($t.layout_line["line-join"]),"line-miter-limit":new De($t.layout_line["line-miter-limit"]),"line-round-limit":new De($t.layout_line["line-round-limit"]),"line-sort-key":new je($t.layout_line["line-sort-key"])})}};class M2 extends je{possiblyEvaluate(o,c){return c=new di(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 P2 extends us{constructor(o){super(o,O0),this.gradientVersion=0,mm||(mm=new M2(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)),R=this.paint.get("line-offset").evaluate(c,p);return R&&(m=function(F,j){const X=[];for(let H=0;H=3){for(let ut=0;ut0?o+2*u:u}const k2=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),A2=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const N2=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),D2=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function R2(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()),Bo.applyArabicShaping&&(m=Bo.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,R=-7,F=c?m-1:0,j=c?-1:1,X=u[o+F];for(F+=j,v=X&(1<<-R)-1,X>>=-R,R+=E;R>0;v=256*v+u[o+F],F+=j,R-=8);for(w=v&(1<<-R)-1,v>>=-R,R+=p;R>0;w=256*w+u[o+F],F+=j,R-=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,R=(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=R):(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>=R?(E=0,w=R):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 O2(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:R>223?3:R>191?2:1;if(w+j>m)break;j===1?R<128&&(F=R):j===2?(192&(E=c[w+1]))==128&&(F=(31&R)<<6|63&E)<=127&&(F=null):j===3?(T=c[w+2],(192&(E=c[w+1]))==128&&(192&T)==128&&((F=(15&R)<<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&R)<<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,O2,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,z2,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,V2,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,F2,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,B2,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,U2,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,G2,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,j2,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,q2,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 Z2(u,o,c){u===1&&c.readMessage($2,o)}function $2(u,o,c){if(u===3){const{id:p,bitmap:m,width:v,height:w,left:E,top:T,advance:k}=c.readMessage(W2,{});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 W2(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,R,F,j,X,H,tt){const ut=xh.fromFeature(u,m);let pt;F===a.ai.vertical&&ut.verticalizePunctuation();const{processBidirectionalText:At,processStyledBidirectionalText:Et}=Bo;if(At&&ut.sections.length===1){pt=[];const Jt=At(ut.toString(),w_(ut,k,v,o,p,X,H));for(const ve of Jt){const Me=new xh;Me.text=ve,Me.sections=ut.sections;for(let _e=0;_e0&&zl>Go&&(Go=zl)}else{const Cs=Me[In.fontStack],qo=Cs&&Cs[Hr];if(qo&&qo.rect)ka=qo.rect,Ys=qo.metrics;else{const zl=ve[In.fontStack],bp=zl&&zl[Hr];if(!bp)continue;Ys=bp.metrics}br=(yr-In.scale)*mr}Ks?(Jt.verticalizable=!0,uo.push({glyph:Hr,imageName:Aa,x:gi,y:bi+br,vertical:Ks,scale:In.scale,fontStack:In.fontStack,sectionIndex:co,metrics:Ys,rect:ka}),gi+=Ol*In.scale+ze):(uo.push({glyph:Hr,imageName:Aa,x:gi,y:bi+br,vertical:Ks,scale:In.scale,fontStack:In.fontStack,sectionIndex:co,metrics:Ys,rect:ka}),gi+=Ys.advance*In.scale+ze)}uo.length!==0&&(gr=Math.max(gi-ze,gr),Y2(uo,0,uo.length-1,So,Go)),gi=0;const jo=ue*yr+Go;Co.lineOffset=Math.max(Go,lo),bi+=jo,hs=Math.max(jo,hs),++or}var Fr;const Xr=bi-dp,{horizontalAlign:Eo,verticalAlign:Io}=S_(Se);(function(_r,yr,lo,Co,uo,Go,jo,vr,In){const co=(yr-lo)*uo;let Hr=0;Hr=Go!==jo?-vr*Co-dp:(-Co*In+.5)*jo;for(const br of _r)for(const Ys of br.positionedGlyphs)Ys.x+=co,Ys.y+=Hr})(Jt.positionedLines,So,Eo,Io,gr,hs,ue,Xr,me.length),Jt.top+=-Io*Xr,Jt.bottom=Jt.top+Xr,Jt.left+=-Eo*gr,Jt.right=Jt.left+gr}(Ft,o,c,p,pt,w,E,T,F,k,j,tt),!function(Jt){for(const ve of Jt)if(ve.positionedGlyphs.length!==0)return!1;return!0}(Nt)&&Ft}const ym={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},X2={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 R=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),R=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,F=v.get("symbol-sort-key");if(this.features=[],!k&&!R)return;const j=c.iconDependencies,X=c.glyphDependencies,H=c.availableImages,tt=new di(this.zoom);for(const{feature:ut,id:pt,index:At,sourceLayerIndex:Et}of o){const Nt=m._featureFilter.needGeometry,Ft=fc(ut,Nt);if(!m._featureFilter.filter(tt,Ft,p))continue;let Jt,ve;if(Nt||(Ft.geometry=hc(ut)),k){const _e=m.getValueAndResolveTokens("text-field",Ft,p,H),me=Zr.factory(_e);tS(me)&&(this.hasRTLText=!0),(!this.hasRTLText||Wf()==="unavailable"||this.hasRTLText&&Bo.isParsed())&&(Jt=R2(me,m,Ft))}if(R){const _e=m.getValueAndResolveTokens("icon-image",Ft,p,H);ve=_e instanceof Rr?_e:Rr.fromString(_e)}if(!Jt&&!ve)continue;const Me=this.sortFeaturesByKey?F.evaluate(Ft,{},p):void 0;if(this.features.push({id:pt,text:Jt,icon:ve,index:At,sourceLayerIndex:Et,geometry:Ft.geometry,properties:ut.properties,type:J2[ut.type],sortKey:Me}),ve&&(j[ve.name]=!0),Jt){const _e=w.evaluate(Ft,{},p).join(","),me=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ai.vertical)>=0;for(const ue of Jt.sections)if(ue.image)j[ue.image.name]=!0;else{const Se=Bf(Jt.toString()),he=ue.fontStack||_e,re=X[he]=X[he]||{};this.calculateGlyphDependencies(ue.text,re,me,this.allowVerticalPlacement,Se)}}}v.get("symbol-placement")==="line"&&(this.features=function(ut){const pt={},At={},Et=[];let Nt=0;function Ft(_e){Et.push(ut[_e]),Nt++}function Jt(_e,me,ue){const Se=At[_e];return delete At[_e],At[me]=Se,Et[Se].geometry[0].pop(),Et[Se].geometry[0]=Et[Se].geometry[0].concat(ue[0]),Se}function ve(_e,me,ue){const Se=pt[me];return delete pt[me],pt[_e]=Se,Et[Se].geometry[0].shift(),Et[Se].geometry[0]=ue[0].concat(Et[Se].geometry[0]),Se}function Me(_e,me,ue){const Se=ue?me[0][me[0].length-1]:me[0][0];return`${_e}:${Se.x}:${Se.y}`}for(let _e=0;_e_e.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 ev,nv;we("SymbolBucket",wh,{omit:["layers","collisionBoxArray","features","compareText"]}),wh.MAX_GLYPHS=65535,wh.addDynamicAttributes=I_;var L_={get paint(){return nv=nv||new Hi({"icon-opacity":new je($t.paint_symbol["icon-opacity"]),"icon-color":new je($t.paint_symbol["icon-color"]),"icon-halo-color":new je($t.paint_symbol["icon-halo-color"]),"icon-halo-width":new je($t.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je($t.paint_symbol["icon-halo-blur"]),"icon-translate":new De($t.paint_symbol["icon-translate"]),"icon-translate-anchor":new De($t.paint_symbol["icon-translate-anchor"]),"text-opacity":new je($t.paint_symbol["text-opacity"]),"text-color":new je($t.paint_symbol["text-color"],{runtimeType:Nr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new je($t.paint_symbol["text-halo-color"]),"text-halo-width":new je($t.paint_symbol["text-halo-width"]),"text-halo-blur":new je($t.paint_symbol["text-halo-blur"]),"text-translate":new De($t.paint_symbol["text-translate"]),"text-translate-anchor":new De($t.paint_symbol["text-translate-anchor"])})},get layout(){return ev=ev||new Hi({"symbol-placement":new De($t.layout_symbol["symbol-placement"]),"symbol-spacing":new De($t.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new De($t.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je($t.layout_symbol["symbol-sort-key"]),"symbol-z-order":new De($t.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new De($t.layout_symbol["icon-allow-overlap"]),"icon-overlap":new De($t.layout_symbol["icon-overlap"]),"icon-ignore-placement":new De($t.layout_symbol["icon-ignore-placement"]),"icon-optional":new De($t.layout_symbol["icon-optional"]),"icon-rotation-alignment":new De($t.layout_symbol["icon-rotation-alignment"]),"icon-size":new je($t.layout_symbol["icon-size"]),"icon-text-fit":new De($t.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new De($t.layout_symbol["icon-text-fit-padding"]),"icon-image":new je($t.layout_symbol["icon-image"]),"icon-rotate":new je($t.layout_symbol["icon-rotate"]),"icon-padding":new je($t.layout_symbol["icon-padding"]),"icon-keep-upright":new De($t.layout_symbol["icon-keep-upright"]),"icon-offset":new je($t.layout_symbol["icon-offset"]),"icon-anchor":new je($t.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new De($t.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new De($t.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new De($t.layout_symbol["text-rotation-alignment"]),"text-field":new je($t.layout_symbol["text-field"]),"text-font":new je($t.layout_symbol["text-font"]),"text-size":new je($t.layout_symbol["text-size"]),"text-max-width":new je($t.layout_symbol["text-max-width"]),"text-line-height":new De($t.layout_symbol["text-line-height"]),"text-letter-spacing":new je($t.layout_symbol["text-letter-spacing"]),"text-justify":new je($t.layout_symbol["text-justify"]),"text-radial-offset":new je($t.layout_symbol["text-radial-offset"]),"text-variable-anchor":new De($t.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new je($t.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new je($t.layout_symbol["text-anchor"]),"text-max-angle":new De($t.layout_symbol["text-max-angle"]),"text-writing-mode":new De($t.layout_symbol["text-writing-mode"]),"text-rotate":new je($t.layout_symbol["text-rotate"]),"text-padding":new De($t.layout_symbol["text-padding"]),"text-keep-upright":new De($t.layout_symbol["text-keep-upright"]),"text-transform":new je($t.layout_symbol["text-transform"]),"text-offset":new je($t.layout_symbol["text-offset"]),"text-allow-overlap":new De($t.layout_symbol["text-allow-overlap"]),"text-overlap":new De($t.layout_symbol["text-overlap"]),"text-ignore-placement":new De($t.layout_symbol["text-ignore-placement"]),"text-optional":new De($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}}we("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,R)=>E&&R in E?String(E[R]):"")}(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 eS={get paint(){return rv=rv||new Hi({"background-color":new De($t.paint_background["background-color"]),"background-pattern":new Hf($t.paint_background["background-pattern"]),"background-opacity":new De($t.paint_background["background-opacity"])})}};class nS extends us{constructor(o){super(o,eS)}}let ov;var iS={get paint(){return ov=ov||new Hi({"raster-opacity":new De($t.paint_raster["raster-opacity"]),"raster-hue-rotate":new De($t.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new De($t.paint_raster["raster-brightness-min"]),"raster-brightness-max":new De($t.paint_raster["raster-brightness-max"]),"raster-saturation":new De($t.paint_raster["raster-saturation"]),"raster-contrast":new De($t.paint_raster["raster-contrast"]),"raster-resampling":new De($t.paint_raster["raster-resampling"]),"raster-fade-duration":new De($t.paint_raster["raster-fade-duration"])})}};class rS extends us{constructor(o){super(o,iS)}}class oS 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 sS{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(ht(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 R=function(F,j,X){let H,tt="";for(let ut=F;ut>0;ut--)H=1<1?"@2x":"").replace(/{quadkey}/g,R).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 R=w;R=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,R=vv(T),F=this.grid.query(R.minX-k,R.minY-k,R.maxX+k,R.maxY+k),j=vv(o.cameraQueryGeometry),X=this.grid3D.query(j.minX-k,j.minY-k,j.maxX+k,j.maxY+k,(ut,pt,At,Et)=>function(Nt,Ft,Jt,ve,Me){for(const me of Nt)if(Ft<=me.x&&Jt<=me.y&&ve>=me.x&&Me>=me.y)return!0;const _e=[new A(Ft,Jt),new A(Ft,Me),new A(ve,Me),new A(ve,Jt)];if(Nt.length>2){for(const me of _e)if(mh(Nt,me))return!0}for(let me=0;me(Et||(Et=hc(Nt)),Ft.queryIntersectsFeature(T,Nt,Jt,Et,this.z,o.transform,w,o.pixelPosMatrix)))}return H}loadMatchingFeature(o,c,p,m,v,w,E,T,k,R,F){const j=this.bucketLayerIDs[c];if(w&&!function(ut,pt){for(let At=0;At=0)return!0;return!1}(w,j))return;const X=this.sourceLayerCoder.decode(p),H=this.vtLayers[X].feature(m);if(v.needGeometry){const ut=fc(H,!0);if(!v.filter(new di(this.tileID.overscaledZ),ut,this.tileID.canonical))return}else if(!v.filter(new di(this.tileID.overscaledZ),H))return;const tt=this.getId(H,X);for(let ut=0;ut{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 aS(u,o){return o-u}function bv(u,o,c,p,m){const v=[];for(let w=0;w=p&&F.x>=p||(R.x>=p?R=new A(p,R.y+(p-R.x)/(F.x-R.x)*(F.y-R.y))._round():F.x>=p&&(F=new A(p,R.y+(p-R.x)/(F.x-R.x)*(F.y-R.y))._round()),R.y>=m&&F.y>=m||(R.y>=m?R=new A(R.x+(m-R.y)/(F.y-R.y)*(F.x-R.x),m)._round():F.y>=m&&(F=new A(R.x+(m-R.y)/(F.y-R.y)*(F.x-R.x),m)._round()),T&&R.equals(T[T.length-1])||(T=[R],v.push(T)),T.push(F)))))}}return v}we("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+=R.dist(F)}return!0}function wv(u){let o=0;for(let c=0;ck){const H=(k-T)/X,tt=Oo.number(F.x,j.x,H),ut=Oo.number(F.y,j.y,H),pt=new Su(tt,ut,j.angleTo(F),R);return pt._round(),!w||xv(u,pt,E,w,o)?pt:void 0}T+=X}}function uS(u,o,c,p,m,v,w,E,T){const k=Sv(p,v,w),R=Ev(p,m),F=R*w,j=u[0].x===0||u[0].x===T||u[0].y===0||u[0].y===T;return o-F=0&&Nt=0&&Ft=0&&j+k<=R){const Jt=new Su(Nt,Ft,At,H);Jt._round(),p&&!xv(u,Jt,v,p,m)||X.push(Jt)}}F+=pt}return E||X.length||w||(X=Iv(u,F/2,c,p,m,v,w,!0,T)),X}we("Anchor",Su);const Sh=Uo;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,R=u.bottom-u.top,F=v.stretchX||[[0,E]],j=v.stretchY||[[0,T]],X=(ue,Se)=>ue+Se[1]-Se[0],H=F.reduce(X,0),tt=j.reduce(X,0),ut=E-H,pt=T-tt;let At=0,Et=H,Nt=0,Ft=tt,Jt=0,ve=ut,Me=0,_e=pt;if(v.content&&p){const ue=v.content;At=wm(F,0,ue[0]),Nt=wm(j,0,ue[1]),Et=wm(F,ue[0],ue[2]),Ft=wm(j,ue[1],ue[3]),Jt=ue[0]-At,Me=ue[1]-Nt,ve=ue[2]-ue[0]-Et,_e=ue[3]-ue[1]-Ft}const me=(ue,Se,he,re)=>{const ze=Sm(ue.stretch-At,Et,k,u.left),Ae=Em(ue.fixed-Jt,ve,ue.stretch,H),gn=Sm(Se.stretch-Nt,Ft,R,u.top),gi=Em(Se.fixed-Me,_e,Se.stretch,tt),bi=Sm(he.stretch-At,Et,k,u.left),gr=Em(he.fixed-Jt,ve,he.stretch,H),hs=Sm(re.stretch-Nt,Ft,R,u.top),So=Em(re.fixed-Me,_e,re.stretch,tt),or=new A(ze,gn),Fr=new A(bi,gn),Xr=new A(bi,hs),Eo=new A(ze,hs),Io=new A(Ae/w,gi/w),_r=new A(gr/w,So/w),yr=o*Math.PI/180;if(yr){const uo=Math.sin(yr),Go=Math.cos(yr),jo=[Go,-uo,uo,Go];or._matMult(jo),Fr._matMult(jo),Eo._matMult(jo),Xr._matMult(jo)}const lo=ue.stretch+ue.fixed,Co=Se.stretch+Se.fixed;return{tl:or,tr:Fr,bl:Eo,br:Xr,tex:{x:v.paddedRect.x+Sh+lo,y:v.paddedRect.y+Sh+Co,w:he.stretch+he.fixed-lo,h:re.stretch+re.fixed-Co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Io,pixelOffsetBR:_r,minFontScaleX:ve/w/k,minFontScaleY:_e/w/R,isSDF:c}};if(p&&(v.stretchX||v.stretchY)){const ue=Tv(F,ut,H),Se=Tv(j,pt,tt);for(let he=0;he0&&(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),R){const ut=new A(X,F),pt=new A(H,F),At=new A(X,j),Et=new A(H,j),Nt=R*Math.PI/180;ut._rotate(Nt),pt._rotate(Nt),At._rotate(Nt),Et._rotate(Nt),X=Math.min(ut.x,pt.x,At.x,Et.x),H=Math.max(ut.x,pt.x,At.x,Et.x),F=Math.min(ut.y,pt.y,At.y,Et.y),j=Math.max(ut.y,pt.y,At.y,Et.y)}o.emplaceBack(c.x,c.y,X,F,H,j,p,m,v)}this.boxEndIndex=o.length}}class cS{constructor(o=[],c=hS){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 hS(u,o){return uo?1:0}function fS(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 R=new cS([],pS);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,R.push(new Eh(X.p.x-k,X.p.y-k,k,u)),R.push(new Eh(X.p.x+k,X.p.y-k,k,u)),R.push(new Eh(X.p.x-k,X.p.y+k,k,u)),R.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 pS(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);R.startsWith("top")?F[1]-=Eu:R.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 dS(u,o,c,p,m,v,w,E,T,k,R){let F=v.textMaxSize.evaluate(o,{});F===void 0&&(F=w);const j=u.layers[0].layout,X=j.get("icon-offset").evaluate(o,{},R),H=kv(c.horizontal),tt=w/24,ut=u.tilePixelRatio*tt,pt=u.tilePixelRatio*F/24,At=u.tilePixelRatio*E,Et=u.tilePixelRatio*j.get("symbol-spacing"),Nt=j.get("text-padding")*u.tilePixelRatio,Ft=function(re,ze,Ae,gn=1){const gi=re.get("icon-padding").evaluate(ze,{},Ae),bi=gi&&gi.values;return[bi[0]*gn,bi[1]*gn,bi[2]*gn,bi[3]*gn]}(j,o,R,u.tilePixelRatio),Jt=j.get("text-max-angle")/180*Math.PI,ve=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",Me=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",_e=j.get("symbol-placement"),me=Et/2,ue=j.get("icon-text-fit");let Se;p&&ue!=="none"&&(u.allowVerticalPlacement&&c.vertical&&(Se=Q0(p,c.vertical,ue,j.get("icon-text-fit-padding"),X,tt)),H&&(p=Q0(p,H,ue,j.get("icon-text-fit-padding"),X,tt)));const he=(re,ze)=>{ze.x<0||ze.x>=rr||ze.y<0||ze.y>=rr||function(Ae,gn,gi,bi,gr,hs,So,or,Fr,Xr,Eo,Io,_r,yr,lo,Co,uo,Go,jo,vr,In,co,Hr,br,Ys){const ka=Ae.addToLineVertexArray(gn,gi);let Aa,Ol,Ks,Cs,qo=0,zl=0,bp=0,Rv=0,U_=-1,G_=-1;const Fl={};let Ov=Al("");if(Ae.allowVerticalPlacement&&bi.vertical){const ho=or.layout.get("text-rotate").evaluate(In,{},br)+90;Ks=new Im(Fr,gn,Xr,Eo,Io,bi.vertical,_r,yr,lo,ho),So&&(Cs=new Im(Fr,gn,Xr,Eo,Io,So,uo,Go,lo,ho))}if(gr){const ho=or.layout.get("icon-rotate").evaluate(In,{}),Ts=or.layout.get("icon-text-fit")!=="none",dc=Cv(gr,ho,Hr,Ts),Da=So?Cv(So,ho,Hr,Ts):void 0;Ol=new Im(Fr,gn,Xr,Eo,Io,gr,uo,Go,!1,ho),qo=4*dc.length;const mc=Ae.iconSizeData;let rl=null;mc.kind==="source"?(rl=[il*or.layout.get("icon-size").evaluate(In,{})],rl[0]>xu&&kt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${gp}. Reduce your "icon-size".`)):mc.kind==="composite"&&(rl=[il*co.compositeIconSizes[0].evaluate(In,{},br),il*co.compositeIconSizes[1].evaluate(In,{},br)],(rl[0]>xu||rl[1]>xu)&&kt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${gp}. Reduce your "icon-size".`)),Ae.addSymbols(Ae.icon,dc,rl,vr,jo,In,a.ai.none,gn,ka.lineStartIndex,ka.lineLength,-1,br),U_=Ae.icon.placedSymbolArray.length-1,Da&&(zl=4*Da.length,Ae.addSymbols(Ae.icon,Da,rl,vr,jo,In,a.ai.vertical,gn,ka.lineStartIndex,ka.lineLength,-1,br),G_=Ae.icon.placedSymbolArray.length-1)}const zv=Object.keys(bi.horizontal);for(const ho of zv){const Ts=bi.horizontal[ho];if(!Aa){Ov=Al(Ts.text);const Da=or.layout.get("text-rotate").evaluate(In,{},br);Aa=new Im(Fr,gn,Xr,Eo,Io,Ts,_r,yr,lo,Da)}const dc=Ts.positionedLines.length===1;if(bp+=Pv(Ae,gn,Ts,hs,or,lo,In,Co,ka,bi.vertical?a.ai.horizontal:a.ai.horizontalOnly,dc?zv:[ho],Fl,U_,co,br),dc)break}bi.vertical&&(Rv+=Pv(Ae,gn,bi.vertical,hs,or,lo,In,Co,ka,a.ai.vertical,["vertical"],Fl,G_,co,br));const _S=Aa?Aa.boxStartIndex:Ae.collisionBoxArray.length,yS=Aa?Aa.boxEndIndex:Ae.collisionBoxArray.length,vS=Ks?Ks.boxStartIndex:Ae.collisionBoxArray.length,bS=Ks?Ks.boxEndIndex:Ae.collisionBoxArray.length,xS=Ol?Ol.boxStartIndex:Ae.collisionBoxArray.length,wS=Ol?Ol.boxEndIndex:Ae.collisionBoxArray.length,SS=Cs?Cs.boxStartIndex:Ae.collisionBoxArray.length,ES=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&&kt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),In.sortKey!==void 0&&Ae.addToSortKeyRanges(Ae.symbolInstances.length,In.sortKey);const IS=Mv(or,In,br),[CS,TS]=function(ho,Ts){const dc=ho.length,Da=Ts==null?void 0:Ts.values;if((Da==null?void 0:Da.length)>0)for(let mc=0;mc=0?Fl.right:-1,Fl.center>=0?Fl.center:-1,Fl.left>=0?Fl.left:-1,Fl.vertical||-1,U_,G_,Ov,_S,yS,vS,bS,xS,wS,SS,ES,Xr,bp,Rv,qo,zl,Fv,0,_r,Na,CS,TS)}(u,ze,re,c,p,m,Se,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ut,[Nt,Nt,Nt,Nt],ve,T,At,Ft,Me,X,o,v,k,R,w)};if(_e==="line")for(const re of bv(o.geometry,0,0,rr,rr)){const ze=uS(re,Et,Jt,c.vertical||H,p,24,pt,u.overscaling,rr);for(const Ae of ze)H&&mS(u,H.text,me,Ae)||he(re,Ae)}else if(_e==="line-center"){for(const re of o.geometry)if(re.length>1){const ze=lS(re,Jt,c.vertical||H,p,24,pt);ze&&he(re,ze)}}else if(o.type==="Polygon")for(const re of h_(o.geometry,0)){const ze=fS(re,16);he(re[0],new Su(ze.x,ze.y,0))}else if(o.type==="LineString")for(const re of o.geometry)he(re,new Su(re[0].x,re[0].y,0));else if(o.type==="Point")for(const re of o.geometry)for(const ze of re)he([ze],new Su(ze.x,ze.y,0))}function Pv(u,o,c,p,m,v,w,E,T,k,R,F,j,X,H){const tt=function(At,Et,Nt,Ft,Jt,ve,Me,_e){const me=Ft.layout.get("text-rotate").evaluate(ve,{})*Math.PI/180,ue=[];for(const Se of Et.positionedLines)for(const he of Se.positionedGlyphs){if(!he.rect)continue;const re=he.rect||{};let ze=$0+1,Ae=!0,gn=1,gi=0;const bi=(Jt||_e)&&he.vertical,gr=he.metrics.advance*he.scale/2;if(_e&&Et.verticalizable&&(gi=Se.lineOffset/2-(he.imageName?-(mr-he.metrics.width*he.scale)/2:(he.scale-1)*mr)),he.imageName){const vr=Me[he.imageName];Ae=vr.sdf,gn=vr.pixelRatio,ze=Uo/gn}const hs=Jt?[he.x+gr,he.y]:[0,0];let So=Jt?[0,0]:[he.x+gr+Nt[0],he.y+Nt[1]-gi],or=[0,0];bi&&(or=So,So=[0,0]);const Fr=he.metrics.isDoubleResolution?2:1,Xr=(he.metrics.left-ze)*he.scale-gr+So[0],Eo=(-he.metrics.top-ze)*he.scale+So[1],Io=Xr+re.w/Fr*he.scale/gn,_r=Eo+re.h/Fr*he.scale/gn,yr=new A(Xr,Eo),lo=new A(Io,Eo),Co=new A(Xr,_r),uo=new A(Io,_r);if(bi){const vr=new A(-gr,gr-dp),In=-Math.PI/2,co=mr/2-gr,Hr=new A(5-dp-co,-(he.imageName?co:0)),br=new A(...or);yr._rotateAround(In,vr)._add(Hr)._add(br),lo._rotateAround(In,vr)._add(Hr)._add(br),Co._rotateAround(In,vr)._add(Hr)._add(br),uo._rotateAround(In,vr)._add(Hr)._add(br)}if(me){const vr=Math.sin(me),In=Math.cos(me),co=[In,-vr,vr,In];yr._matMult(co),lo._matMult(co),Co._matMult(co),uo._matMult(co)}const Go=new A(0,0),jo=new A(0,0);ue.push({tl:yr,tr:lo,bl:Co,br:uo,tex:re,writingMode:Et.writingMode,glyphOffset:hs,sectionIndex:he.sectionIndex,isSDF:Ae,pixelOffsetTL:Go,pixelOffsetBR:jo,minFontScaleX:0,minFontScaleY:0})}return ue}(0,c,E,m,v,w,p,u.allowVerticalPlacement),ut=u.textSizeData;let pt=null;ut.kind==="source"?(pt=[il*m.layout.get("text-size").evaluate(w,{})],pt[0]>xu&&kt(`${u.layerIds[0]}: Value for "text-size" is >= ${gp}. Reduce your "text-size".`)):ut.kind==="composite"&&(pt=[il*X.compositeTextSizes[0].evaluate(w,{},H),il*X.compositeTextSizes[1].evaluate(w,{},H)],(pt[0]>xu||pt[1]>xu)&&kt(`${u.layerIds[0]}: Value for "text-size" is >= ${gp}. Reduce your "text-size".`)),u.addSymbols(u.text,tt,pt,E,v,w,k,o,T.lineStartIndex,T.lineLength,j,H);for(const At of R)F[At]=u.text.placedSymbolArray.length-1;return 4*tt.length}function kv(u){for(const o in u)return u[o];return null}function mS(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 R=T.pop()||0,F=T.pop()||0,j=T.pop()||0;if(F-j<=E){for(let ut=j;ut<=F;ut++){const pt=w[2*ut],At=w[2*ut+1];pt>=o&&pt<=p&&At>=c&&At<=m&&k.push(v[ut])}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]),(R===0?o<=H:c<=tt)&&(T.push(j),T.push(X-1),T.push(1-R)),(R===0?p>=H:m>=tt)&&(T.push(X+1),T.push(F),T.push(1-R))}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 R=E.pop()||0,F=E.pop()||0,j=E.pop()||0;if(F-j<=w){for(let ut=j;ut<=F;ut++)Dv(v[2*ut],v[2*ut+1],o,c)<=k&&T.push(m[ut]);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]),(R===0?o-p<=H:c-p<=tt)&&(E.push(j),E.push(X-1),E.push(1-R)),(R===0?o+p>=H:c+p>=tt)&&(E.push(X+1),E.push(F),E.push(1-R))}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,R=c-p+1,F=Math.log(k),j=.5*Math.exp(2*F/3),X=.5*Math.sqrt(F*j*(k-j)/k)*(R-k/2<0?-1:1);Nv(u,o,c,Math.max(p,Math.floor(c-R*j/k+X)),Math.min(m,Math.floor(c+(k-R)*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",gS={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,R,F,j,X,H,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],k=o[6],R=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]=R,u[8]=F,u[9]=j,u[10]=X,u[11]=H,u[12]=p*tt+E*ut+F*pt+o[12],u[13]=m*tt+T*ut+j*pt+o[13],u[14]=v*tt+k*ut+X*pt+o[14],u[15]=w*tt+R*ut+H*pt+o[15]),u},a.A=gh,a.B=Oo,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 ne()||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 sS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ne()?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=De,a.E=Xi,a.F=function(u,o){const c={};for(let p=0;p{}}},a.Y=le,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=bn,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 lt++},a.a3=at,a.a4=wh,a.a5=function(){Bo.isLoading()||Bo.isLoaded()||Wf()!=="deferred"||tm()},a.a6=Of,a.a7=fc,a.a8=di,a.a9=gv,a.aA=sc,a.aB=function(u){u=u.slice();const o=Object.create(null);for(let c=0;c{p[w.source]?c.push({command:Tn.removeLayer,args:[w.id]}):v.push(w)}),c=c.concat(m),function(w,E,T){E=E||[];const k=(w=w||[]).map(js),R=E.map(js),F=w.reduce(Sa,{}),j=E.reduce(Sa,{}),X=k.slice(),H=Object.create(null);let tt,ut,pt,At,Et,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(Ie==null){const o=u.navigator?u.navigator.userAgent:null;Ie=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Ie},a.ad=mt,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],R=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+R*p,u[2]=E*m+F*p,u[3]=T*m+j*p,u[4]=k*m-v*p,u[5]=R*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?mt(zo.interpolationFactor(m,o,v,w),0,1):0;u.kind==="camera"?p=Oo.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"?Oo.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],R=o[8],F=o[9],j=o[10],X=o[11],H=o[12],tt=o[13],ut=o[14],pt=o[15],At=c*E-p*w,Et=c*T-m*w,Nt=c*k-v*w,Ft=p*T-m*E,Jt=p*k-v*E,ve=m*k-v*T,Me=R*tt-F*H,_e=R*ut-j*H,me=R*pt-X*H,ue=F*ut-j*tt,Se=F*pt-X*tt,he=j*pt-X*ut,re=At*he-Et*Se+Nt*ue+Ft*me-Jt*_e+ve*Me;return re?(u[0]=(E*he-T*Se+k*ue)*(re=1/re),u[1]=(m*Se-p*he-v*ue)*re,u[2]=(tt*ve-ut*Jt+pt*Ft)*re,u[3]=(j*Jt-F*ve-X*Ft)*re,u[4]=(T*me-w*he-k*_e)*re,u[5]=(c*he-m*me+v*_e)*re,u[6]=(ut*Nt-H*ve-pt*Et)*re,u[7]=(R*ve-j*Nt+X*Et)*re,u[8]=(w*Se-E*me+k*Me)*re,u[9]=(p*me-c*Se-v*Me)*re,u[10]=(H*Jt-tt*Nt+pt*At)*re,u[11]=(F*Nt-R*Jt-X*At)*re,u[12]=(E*_e-w*ue-T*Me)*re,u[13]=(c*ue-p*_e+m*Me)*re,u[14]=(tt*Et-H*Ft-ut*At)*re,u[15]=(R*Ft-F*Et+j*At)*re,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=Tn,a.ay=Yd,a.az=pn,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=Or,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],R=u[8],F=u[9],j=u[10],X=u[11],H=u[12],tt=u[13],ut=u[14],pt=u[15],At=o[0],Et=o[1],Nt=o[2],Ft=o[3],Jt=o[4],ve=o[5],Me=o[6],_e=o[7],me=o[8],ue=o[9],Se=o[10],he=o[11],re=o[12],ze=o[13],Ae=o[14],gn=o[15];return Math.abs(c-At)<=wo*Math.max(1,Math.abs(c),Math.abs(At))&&Math.abs(p-Et)<=wo*Math.max(1,Math.abs(p),Math.abs(Et))&&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-Jt)<=wo*Math.max(1,Math.abs(w),Math.abs(Jt))&&Math.abs(E-ve)<=wo*Math.max(1,Math.abs(E),Math.abs(ve))&&Math.abs(T-Me)<=wo*Math.max(1,Math.abs(T),Math.abs(Me))&&Math.abs(k-_e)<=wo*Math.max(1,Math.abs(k),Math.abs(_e))&&Math.abs(R-me)<=wo*Math.max(1,Math.abs(R),Math.abs(me))&&Math.abs(F-ue)<=wo*Math.max(1,Math.abs(F),Math.abs(ue))&&Math.abs(j-Se)<=wo*Math.max(1,Math.abs(j),Math.abs(Se))&&Math.abs(X-he)<=wo*Math.max(1,Math.abs(X),Math.abs(he))&&Math.abs(H-re)<=wo*Math.max(1,Math.abs(H),Math.abs(re))&&Math.abs(tt-ze)<=wo*Math.max(1,Math.abs(tt),Math.abs(ze))&&Math.abs(ut-Ae)<=wo*Math.max(1,Math.abs(ut),Math.abs(Ae))&&Math.abs(pt-gn)<=wo*Math.max(1,Math.abs(pt),Math.abs(gn))},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=ht,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],R=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+R*p,u[6]=E*m+F*p,u[7]=T*m+j*p,u[8]=k*m-v*p,u[9]=R*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=Bo,a.ba=K,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 cc{},a.be=M_,a.bf=hv,a.bg=gS,a.bi=Ge,a.bj=function(u,o,c=!1){if(bo===Gf||bo===jf||bo===qf)throw new Error("setRTLTextPlugin cannot be called multiple times.");el=xn.resolveURL(u),bo=Gf,Zf=o,$f(),c||tm()},a.bk=Wf,a.bl=function(u,o){const c={};for(let m=0;mre*mr)}let _e=w?"center":c.get("text-justify").evaluate(k,{},u.canonical);const me=c.get("symbol-placement"),ue=me==="point"?c.get("text-max-width").evaluate(k,{},u.canonical)*mr:0,Se=()=>{u.bucket.allowVerticalPlacement&&Bf(Nt)&&(H.vertical=_m(tt,u.glyphMap,u.glyphPositions,u.imagePositions,R,ue,v,ve,"left",Jt,pt,a.ai.vertical,!0,me,j,F))};if(!w&&Me){const he=new Set;if(_e==="auto")for(let ze=0;ze{o(null,c),URL.revokeObjectURL(c.src),c.onload=null,window.requestAnimationFrame(()=>{c.src=Zn})},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):Zn},a.e=gt,a.f=function(u,o){return Ai(gt(u,{type:"json"}),o)},a.g=Bn,a.h=xn,a.i=ne,a.j=mn,a.k=un,a.l=Lt,a.m=Ai,a.n=function(u){return new v_(u).readFields(Z2,[])},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=Hi,a.s=ke,a.t=Hg,a.u=ye,a.v=$t,a.w=kt,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 $ of G){this._layerConfigs[$.id]=$;const ot=this._layers[$.id]=a.aC($);ot._featureFilter=a.a6(ot.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of q)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const J=a.bl(Object.values(this._layerConfigs),this.keyCache);for(const $ of J){const ot=$.map(Ht=>this._layers[Ht.id]),Mt=ot[0];if(Mt.visibility==="none")continue;const xt=Mt.source||"";let rt=this.familiesBySource[xt];rt||(rt=this.familiesBySource[xt]={});const Ct=Mt.sourceLayer||"_geojsonTileLayer";let Wt=rt[Ct];Wt||(Wt=rt[Ct]=[]),Wt.push(ot)}}}class x{constructor(G){const q={},J=[];for(const xt in G){const rt=G[xt],Ct=q[xt]={};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),Ct[Wt]={rect:Kt,metrics:Ht.metrics}}}const{w:$,h:ot}=a.p(J),Mt=new a.q({width:$||1,height:ot||1});for(const xt in G){const rt=G[xt];for(const Ct in rt){const Wt=rt[+Ct];if(!Wt||Wt.bitmap.width===0||Wt.bitmap.height===0)continue;const Ht=q[xt][Ct].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,$,ot){this.status="parsing",this.data=G,this.collisionBoxArray=new a.a3;const Mt=new a.bn(Object.keys(G.layers).sort()),xt=new a.bo(this.tileID,this.promoteId);xt.bucketLayerIDs=[];const rt={},Ct={featureIndex:xt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Wt=q.familiesBySource[this.source];for(const Nn in Wt){const An=G.layers[Nn];if(!An)continue;An.version===1&&a.w(`Vector tile source "${this.source}" layer "${Nn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qr=Mt.encode(Nn),si=[];for(let ir=0;ir=Dr.maxzoom||Dr.visibility!=="none"&&(L(ir,this.zoom,J),(rt[Dr.id]=Dr.createBucket({index:xt.bucketLayerIDs.length,layers:ir,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qr,sourceID:this.source})).populate(si,Ct,this.tileID.canonical),xt.bucketLayerIDs.push(ir.map(rs=>rs.id)))}}let Ht,Kt,Ne,Ye;const Te=a.aH(Ct.glyphDependencies,Nn=>Object.keys(Nn).map(Number));this.inFlightDependencies.forEach(Nn=>Nn==null?void 0:Nn.cancel()),this.inFlightDependencies=[];const Fe=++this.dependencySentinel;Object.keys(Te).length?this.inFlightDependencies.push($.send("getGlyphs",{uid:this.uid,stacks:Te,source:this.source,tileID:this.tileID,type:"glyphs"},(Nn,An)=>{Fe===this.dependencySentinel&&(Ht||(Ht=Nn,Kt=An,Jn.call(this)))})):Kt={};const on=Object.keys(Ct.iconDependencies);on.length?this.inFlightDependencies.push($.send("getImages",{icons:on,source:this.source,tileID:this.tileID,type:"icons"},(Nn,An)=>{Fe===this.dependencySentinel&&(Ht||(Ht=Nn,Ne=An,Jn.call(this)))})):Ne={};const $n=Object.keys(Ct.patternDependencies);function Jn(){if(Ht)return ot(Ht);if(Kt&&Ne&&Ye){const Nn=new x(Kt),An=new a.bp(Ne,Ye);for(const qr in rt){const si=rt[qr];si instanceof a.a4?(L(si.layers,this.zoom,J),a.bq({bucket:si,glyphMap:Kt,glyphPositions:Nn.positions,imageMap:Ne,imagePositions:An.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):si.hasPattern&&(si instanceof a.br||si instanceof a.bs||si instanceof a.bt)&&(L(si.layers,this.zoom,J),si.addFeatures(Ct,this.tileID.canonical,An.patternPositions))}this.status="done",ot(null,{buckets:Object.values(rt).filter(qr=>!qr.isEmpty()),featureIndex:xt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Nn.image,imageAtlas:An,glyphMap:this.returnDependencies?Kt:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?Nn.positions:null})}}$n.length?this.inFlightDependencies.push($.send("getImages",{icons:$n,source:this.source,tileID:this.tileID,type:"patterns"},(Nn,An)=>{Fe===this.dependencySentinel&&(Ht||(Ht=Nn,Ye=An,Jn.call(this)))})):Ye={},Jn.call(this)}}function L(st,G,q){const J=new a.a8(G);for(const $ of st)$.recalculate(J,q)}function A(st,G){const q=a.l(st.request,(J,$,ot,Mt)=>{if(J)G(J);else if($)try{const xt=new a.bw.VectorTile(new a.bv($));G(null,{vectorTile:xt,rawData:$,cacheControl:ot,expires:Mt})}catch(xt){const rt=new Uint8Array($);let Ct=`Unable to parse the tile at ${st.request.url}, `;Ct+=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: ${xt.messge}`,G(new Error(Ct))}});return()=>{q.cancel(),G()}}class P{constructor(G,q,J,$){this.actor=G,this.layerIndex=q,this.availableImages=J,this.loadVectorData=$||A,this.fetching={},this.loading={},this.loaded={}}loadTile(G,q){const J=G.uid;this.loading||(this.loading={});const $=!!(G&&G.request&&G.request.collectResourceTiming)&&new a.bu(G.request),ot=this.loading[J]=new S(G);ot.abort=this.loadVectorData(G,(Mt,xt)=>{if(delete this.loading[J],Mt||!xt)return ot.status="done",this.loaded[J]=ot,q(Mt);const rt=xt.rawData,Ct={};xt.expires&&(Ct.expires=xt.expires),xt.cacheControl&&(Ct.cacheControl=xt.cacheControl);const Wt={};if($){const Ht=$.finish();Ht&&(Wt.resourceTiming=JSON.parse(JSON.stringify(Ht)))}ot.vectorTile=xt.vectorTile,ot.parse(xt.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,Ct,Wt))}),this.loaded=this.loaded||{},this.loaded[J]=ot,this.fetching[J]={rawTileData:rt,cacheControl:Ct,resourceTiming:Wt}})}reloadTile(G,q){const J=this.loaded,$=G.uid;if(J&&J[$]){const ot=J[$];ot.showCollisionBoxes=G.showCollisionBoxes,ot.status==="parsing"?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,(Mt,xt)=>{if(Mt||!xt)return q(Mt,xt);let rt;if(this.fetching[$]){const{rawTileData:Ct,cacheControl:Wt,resourceTiming:Ht}=this.fetching[$];delete this.fetching[$],rt=a.e({rawTileData:Ct.slice(0)},xt,Wt,Ht)}else rt=xt;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,$=G.uid;J&&J[$]&&J[$].abort&&(J[$].abort(),delete J[$]),q()}removeTile(G,q){const J=this.loaded,$=G.uid;J&&J[$]&&delete J[$],q()}}class D{constructor(){this.loaded={}}loadTile(G,q){return a._(this,void 0,void 0,function*(){const{uid:J,encoding:$,rawImageData:ot,redFactor:Mt,greenFactor:xt,blueFactor:rt,baseShift:Ct}=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,$,Mt,xt,rt,Ct);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(xt)?q-rt+xt:xt-rt+q,q=rt}q+J>=0!=!!G&&st.reverse()}var Y=a.bz(function st(G,q){var J,$=G&&G.type;if($==="FeatureCollection")for(J=0;J>31}function ne(st,G){for(var q=st.loadGeometry(),J=st.type,$=0,ot=0,Mt=q.length,xt=0;xtst},en=Math.fround||(Be=new Float32Array(1),st=>(Be[0]=+st,Be[0]));var Be;const Ve=3,dn=5,Fn=6;class xn{constructor(G){this.options=Object.assign(Object.create(Zn),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:$}=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 Ct=+Date.now();xt=this.trees[rt]=this._createTree(this._cluster(xt,rt)),q&&console.log("z%d: %d clusters in %dms",rt,xt.numItems,+Date.now()-Ct)}return q&&console.timeEnd("total time"),this}getClusters(G,q){let J=((G[0]+180)%360+360)%360-180;const $=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,$,180,Mt],q),Kt=this.getClusters([-180,$,ot,Mt],q);return Ht.concat(Kt)}const xt=this.trees[this._limitZoom(q)],rt=xt.range(pn(J),Bn(Mt),pn(ot),Bn($)),Ct=xt.data,Wt=[];for(const Ht of rt){const Kt=this.stride*Ht;Wt.push(Ct[Kt+dn]>1?oe(Ct,Kt,this.clusterProps):this.points[Ct[Kt+Ve]])}return Wt}getChildren(G){const q=this._getOriginId(G),J=this._getOriginZoom(G),$="No cluster with the specified id.",ot=this.trees[J];if(!ot)throw new Error($);const Mt=ot.data;if(q*this.stride>=Mt.length)throw new Error($);const xt=this.options.radius/(this.options.extent*Math.pow(2,J-1)),rt=ot.within(Mt[q*this.stride],Mt[q*this.stride+1],xt),Ct=[];for(const Wt of rt){const Ht=Wt*this.stride;Mt[Ht+4]===G&&Ct.push(Mt[Ht+dn]>1?oe(Mt,Ht,this.clusterProps):this.points[Mt[Ht+Ve]])}if(Ct.length===0)throw new Error($);return Ct}getLeaves(G,q,J){const $=[];return this._appendLeaves($,G,q=q||10,J=J||0,0),$}getTile(G,q,J){const $=this.trees[this._limitZoom(G)],ot=Math.pow(2,G),{extent:Mt,radius:xt}=this.options,rt=xt/Mt,Ct=(J-rt)/ot,Wt=(J+1+rt)/ot,Ht={features:[]};return this._addTileFeatures($.range((q-rt)/ot,Ct,(q+1+rt)/ot,Wt),$.data,q,J,ot,Ht),q===0&&this._addTileFeatures($.range(1-rt/ot,Ct,1,Wt),$.data,ot,J,ot,Ht),q===ot-1&&this._addTileFeatures($.range(0,Ct,rt/ot,Wt),$.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,$,ot){const Mt=this.getChildren(q);for(const xt of Mt){const rt=xt.properties;if(rt&&rt.cluster?ot+rt.point_count<=$?ot+=rt.point_count:ot=this._appendLeaves(G,rt.cluster_id,J,$,ot):ot<$?ot++:G.push(xt),G.length===J)break}return ot}_createTree(G){const q=new a.av(G.length/this.stride|0,this.options.nodeSize,Float32Array);for(let J=0;J1;let Wt,Ht,Kt;if(Ct)Wt=Ge(q,rt,this.clusterProps),Ht=q[rt],Kt=q[rt+1];else{const Te=this.points[q[rt+Ve]];Wt=Te.properties;const[Fe,on]=Te.geometry.coordinates;Ht=pn(Fe),Kt=Bn(on)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(Ht*ot-J)),Math.round(this.options.extent*(Kt*ot-$))]],tags:Wt};let Ye;Ye=Ct||this.options.generateId?q[rt+Ve]:this.points[q[rt+Ve]].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:$,reduce:ot,minPoints:Mt}=this.options,xt=J/($*Math.pow(2,q)),rt=G.data,Ct=[],Wt=this.stride;for(let Ht=0;Htq&&(Fe+=rt[$n+dn])}if(Fe>Te&&Fe>=Mt){let on,$n=Kt*Te,Jn=Ne*Te,Nn=-1;const An=((Ht/Wt|0)<<5)+(q+1)+this.points.length;for(const qr of Ye){const si=qr*Wt;if(rt[si+2]<=q)continue;rt[si+2]=q;const ir=rt[si+dn];$n+=rt[si]*ir,Jn+=rt[si+1]*ir,rt[si+4]=An,ot&&(on||(on=this._map(rt,Ht,!0),Nn=this.clusterProps.length,this.clusterProps.push(on)),ot(on,this._map(rt,si)))}rt[Ht+4]=An,Ct.push($n/Fe,Jn/Fe,1/0,An,-1,Fe),ot&&Ct.push(Nn)}else{for(let on=0;on1)for(const on of Ye){const $n=on*Wt;if(!(rt[$n+2]<=q)){rt[$n+2]=q;for(let Jn=0;Jn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,q,J){if(G[q+dn]>1){const Mt=this.clusterProps[G[q+Fn]];return J?Object.assign({},Mt):Mt}const $=this.points[G[q+Ve]].properties,ot=this.options.map($);return J&&ot===$?Object.assign({},ot):ot}}function oe(st,G,q){return{type:"Feature",id:st[G+Ve],properties:Ge(st,G,q),geometry:{type:"Point",coordinates:[(J=st[G],360*(J-.5)),yi(st[G+1])]}};var J}function Ge(st,G,q){const J=st[G+dn],$=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,ot=st[G+Fn],Mt=ot===-1?{}:Object.assign({},q[ot]);return Object.assign(Mt,{cluster:!0,cluster_id:st[G+Ve],point_count:J,point_count_abbreviated:$})}function pn(st){return st/360+.5}function Bn(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 yi(st){const G=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function Ai(st,G,q,J){for(var $,ot=J,Mt=q-G>>1,xt=q-G,rt=st[G],Ct=st[G+1],Wt=st[q],Ht=st[q+1],Kt=G+3;Ktot)$=Kt,ot=Ne;else if(Ne===ot){var Ye=Math.abs(Kt-Mt);YeJ&&($-G>3&&Ai(st,G,$,J),st[$+2]=ot,q-$>3&&Ai(st,$,q,J))}function Lt(st,G,q,J,$,ot){var Mt=$-q,xt=ot-J;if(Mt!==0||xt!==0){var rt=((st-q)*Mt+(G-J)*xt)/(Mt*Mt+xt*xt);rt>1?(q=$,J=ot):rt>0&&(q+=Mt*rt,J+=xt*rt)}return(Mt=st-q)*Mt+(xt=G-J)*xt}function ke(st,G,q,J){var $={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,xt=ot.type;if(xt==="Point"||xt==="MultiPoint"||xt==="LineString")xe(ot,Mt);else if(xt==="Polygon"||xt==="MultiLineString")for(var rt=0;rt0&&(Mt+=J?($*Ct-rt*ot)/2:Math.sqrt(Math.pow(rt-$,2)+Math.pow(Ct-ot,2))),$=rt,ot=Ct}var Wt=G.length-3;G[2]=1,Ai(G,0,Wt,q),G[Wt+2]=1,G.size=Math.abs(Mt),G.start=0,G.end=G.size}function Xi(st,G,q,J){for(var $=0;$1?1:q}function fr(st,G,q,J,$,ot,Mt,xt){if(J/=G,ot>=(q/=G)&&Mt=J)return null;for(var rt=[],Ct=0;Ct=q&&Ye=J)){var Te=[];if(Kt==="Point"||Kt==="MultiPoint")Vn(Ht,Te,q,J,$);else if(Kt==="LineString")Tn(Ht,Te,q,J,$,!1,xt.lineMetrics);else if(Kt==="MultiLineString")oo(Ht,Te,q,J,$,!1);else if(Kt==="Polygon")oo(Ht,Te,q,J,$,!0);else if(Kt==="MultiPolygon")for(var Fe=0;Fe=q&&Mt<=J&&(G.push(st[ot]),G.push(st[ot+1]),G.push(st[ot+2]))}}function Tn(st,G,q,J,$,ot,Mt){for(var xt,rt,Ct=es(st),Wt=$===0?Ha:Gs,Ht=st.start,Kt=0;Ktq&&(rt=Wt(Ct,Ne,Ye,Fe,on,q),Mt&&(Ct.start=Ht+xt*rt)):$n>J?Jn=q&&(rt=Wt(Ct,Ne,Ye,Fe,on,q),Nn=!0),Jn>J&&$n<=J&&(rt=Wt(Ct,Ne,Ye,Fe,on,J),Nn=!0),!ot&&Nn&&(Mt&&(Ct.end=Ht+xt*rt),G.push(Ct),Ct=es(st)),Mt&&(Ht+=xt)}var An=st.length-3;Ne=st[An],Ye=st[An+1],Te=st[An+2],($n=$===0?Ne:Ye)>=q&&$n<=J&&ns(Ct,Ne,Ye,Te),An=Ct.length-3,ot&&An>=3&&(Ct[An]!==Ct[0]||Ct[An+1]!==Ct[1])&&ns(Ct,Ct[0],Ct[1],Ct[2]),Ct.length&&G.push(Ct)}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,$,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 $=G.geometry,ot=G.type,Mt=[];if(ot==="Point"||ot==="MultiPoint")for(var xt=0;xt<$.length;xt+=3)Mt.push($[xt]),Mt.push($[xt+1]),st.numPoints++,st.numSimplified++;else if(ot==="LineString")ws(Mt,$,st,q,!1,!1);else if(ot==="MultiLineString"||ot==="Polygon")for(xt=0;xt<$.length;xt++)ws(Mt,$[xt],st,q,ot==="Polygon",xt===0);else if(ot==="MultiPolygon")for(var rt=0;rt<$.length;rt++){var Ct=$[rt];for(xt=0;xt0&&G.size<($?Mt:J))q.numPoints+=G.length/3;else{for(var xt=[],rt=0;rtMt)&&(q.numSimplified++,xt.push(G[rt]),xt.push(G[rt+1])),q.numPoints++;$&&function(Ct,Wt){for(var Ht=0,Kt=0,Ne=Ct.length,Ye=Ne-2;Kt0===Wt)for(Kt=0,Ne=Ct.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($,ot){var Mt=[];if($.type==="FeatureCollection")for(var xt=0;xt<$.features.length;xt++)rn(Mt,$.features[xt],ot,xt);else rn(Mt,$.type==="Feature"?$:{geometry:$},ot);return Mt}(st,G);this.tiles={},this.tileCoords=[],q&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",G.indexMaxZoom,G.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function($,ot){var Mt=ot.buffer/ot.extent,xt=$,rt=fr($,1,-1-Mt,Mt,0,-1,2,ot),Ct=fr($,1,1-Mt,2+Mt,0,-1,2,ot);return(rt||Ct)&&(xt=fr($,1,-Mt,1+Mt,0,-1,2,ot)||[],rt&&(xt=js(rt,1).concat(xt)),Ct&&(xt=xt.concat(js(Ct,-1)))),xt}(J,G),J.length&&this.splitTile(J,0,0,0),q&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function cn(st,G,q){return 32*((1<1&&console.time("creation"),Kt=this.tiles[Ht]=oi(st,G,q,J,rt),this.tileCoords.push({z:G,x:q,y:J}),Ct)){Ct>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,$){if(G===rt.maxZoom||G===$)continue;var Ye=1<<$-G;if(q!==Math.floor(ot/Ye)||J!==Math.floor(Mt/Ye))continue}else if(G===rt.indexMaxZoom||Kt.numPoints<=rt.indexMaxPoints)continue;if(Kt.source=null,st.length!==0){Ct>1&&console.time("clipping");var Te,Fe,on,$n,Jn,Nn,An=.5*rt.buffer/rt.extent,qr=.5-An,si=.5+An,ir=1+An;Te=Fe=on=$n=null,Jn=fr(st,Wt,q-An,q+si,0,Kt.minX,Kt.maxX,rt),Nn=fr(st,Wt,q+qr,q+ir,0,Kt.minX,Kt.maxX,rt),st=null,Jn&&(Te=fr(Jn,Wt,J-An,J+si,1,Kt.minY,Kt.maxY,rt),Fe=fr(Jn,Wt,J+qr,J+ir,1,Kt.minY,Kt.maxY,rt),Jn=null),Nn&&(on=fr(Nn,Wt,J-An,J+si,1,Kt.minY,Kt.maxY,rt),$n=fr(Nn,Wt,J+qr,J+ir,1,Kt.minY,Kt.maxY,rt),Nn=null),Ct>1&&console.timeEnd("clipping"),xt.push(Te||[],G+1,2*q,2*J),xt.push(Fe||[],G+1,2*q,2*J+1),xt.push(on||[],G+1,2*q+1,2*J),xt.push($n||[],G+1,2*q+1,2*J+1)}}},ce.prototype.getTile=function(st,G,q){var J=this.options,$=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,Ct=st,Wt=G,Ht=q;!rt&&Ct>0;)Ct--,Wt=Math.floor(Wt/2),Ht=Math.floor(Ht/2),rt=this.tiles[cn(Ct,Wt,Ht)];return rt&&rt.source?(ot>1&&console.log("found parent tile z%d-%d-%d",Ct,Wt,Ht),ot>1&&console.time("drilling down"),this.splitTile(rt.source,Ct,Wt,Ht,st,G,q),ot>1&&console.timeEnd("drilling down"),this.tiles[xt]?le(this.tiles[xt],$):null):null};class sn extends P{constructor(G,q,J,$){super(G,q,J),this._dataUpdateable=new Map,this.loadGeoJSON=(ot,Mt)=>{const{promoteId:xt}=ot;if(ot.request)return a.f(ot.request,(rt,Ct,Wt,Ht)=>{this._dataUpdateable=Nr(Ct,xt)?is(Ct,xt):void 0,Mt(rt,Ct,Wt,Ht)});if(typeof ot.data=="string")try{const rt=JSON.parse(ot.data);this._dataUpdateable=Nr(rt,xt)?is(rt,xt):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,Ct,Wt){var Ht,Kt,Ne,Ye;if(Ct.removeAll&&rt.clear(),Ct.remove)for(const Te of Ct.remove)rt.delete(Te);if(Ct.add)for(const Te of Ct.add){const Fe=Ke(Te,Wt);Fe!=null&&rt.set(Fe,Te)}if(Ct.update)for(const Te of Ct.update){let Fe=rt.get(Te.id);if(Fe==null)continue;const on=!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||on)&&(Fe=Object.assign({},Fe),rt.set(Te.id,Fe),on&&(Fe.properties=Object.assign({},Fe.properties))),Te.newGeometry&&(Fe.geometry=Te.newGeometry),Te.removeAllProperties)Fe.properties={};else if(((Ne=Te.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const $n of Te.removeProperties)Object.prototype.hasOwnProperty.call(Fe.properties,$n)&&delete Fe.properties[$n];if(((Ye=Te.addOrUpdateProperties)===null||Ye===void 0?void 0:Ye.length)>0)for(const{key:$n,value:Jn}of Te.addOrUpdateProperties)Fe.properties[$n]=Jn}}(this._dataUpdateable,ot.dataDiff,xt),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,$&&(this.loadGeoJSON=$)}loadGeoJSONTile(G,q){const J=G.tileID.canonical;if(!this._geoJSONIndex)return q(null,null);const $=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!$)return q(null,null);const ot=new class{constructor(xt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.N,this.length=xt.length,this._features=xt}feature(xt){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 Ct of this._feature.geometry)rt.push([new a.P(Ct[0],Ct[1])]);return rt}{const rt=[];for(const Ct of this._feature.geometry){const Wt=[];for(const Ht of Ct)Wt.push(new a.P(Ht[0],Ht[1]));rt.push(Wt)}return rt}}toGeoJSON(rt,Ct,Wt){return V.call(this,rt,Ct,Wt)}}(this._features[xt])}}($.features);let Mt=bn(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 $=!!(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 xn(function({superclusterOptions:rt,clusterProperties:Ct}){if(!Ct||!rt)return rt;const Wt={},Ht={},Kt={accumulated:null,zoom:0},Ne={properties:null},Ye=Object.keys(Ct);for(const Te of Ye){const[Fe,on]=Ct[Te],$n=a.bC(on),Jn=a.bC(typeof Fe=="string"?[Fe,["accumulated"],["get",Te]]:Fe);Wt[Te]=$n.value,Ht[Te]=Jn.value}return rt.map=Te=>{Ne.properties=Te;const Fe={};for(const on of Ye)Fe[on]=Wt[on].evaluate(Kt,Ne);return Fe},rt.reduce=(Te,Fe)=>{Ne.properties=Fe;for(const on of Ye)Kt.accumulated=Te[on],Te[on]=Ht[on].evaluate(Kt,Ne)},rt}(G)).load(Mt.features):function(rt,Ct){return new ce(rt,Ct)}(Mt,G.geojsonVtOptions)}catch(rt){return q(rt)}this.loaded={};const xt={};if($){const rt=$.finish();rt&&(xt.resourceTiming={},xt.resourceTiming[G.source]=JSON.parse(JSON.stringify(rt)))}q(null,xt)}})}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:sn},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 $ in this.workerSources[G]){const ot=this.workerSources[G][$];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 $=this.workerSources[G][q.type][q.source];delete this.workerSources[G][q.type][q.source],$.removeSource!==void 0?$.removeSource(q,J):J()}loadWorkerSource(G,q,J){try{this.self.importScripts(q.url),J()}catch($){J($.toString())}}syncRTLPluginState(G,q,J){try{a.bD.setState(q);const $=a.bD.getPluginURL();if(a.bD.isLoaded()&&!a.bD.isParsed()&&$!=null){this.self.importScripts($);const ot=a.bD.isParsed();J(ot?void 0:new Error(`RTL Text Plugin failed to import scripts from ${$}`),ot)}}catch($){J($.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:($,ot,Mt)=>{this.actor.send($,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 D),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 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,Q)=>{I(N,W,nt,et,at,Q)})},I=(N,O,z,W,nt,et)=>{z?O(z):W instanceof HTMLImageElement||a.a(W)?O(null,W):W&&((at,Q)=>{typeof createImageBitmap=="function"?a.b(at,Q):a.d(at,Q)})(W,(at,Q)=>{at!=null?O(at):Q!=null&&O(null,Q,{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=""}}}}(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(Z);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 Z=/^(\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 it,mt=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 ht=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 lt(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:Q,stretchY:Tt,content:Ot}=M[N];b[I][N]={data:null,pixelRatio:at,sdf:et,stretchX:Q,stretchY:Tt,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 It{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 _t(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class bt 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]=ee}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]=[],Qt.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 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 O={};for(const z of a.n(N))O[z.id]=z;g(null,O)}})},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,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:Q,gridOuter:Tt}=this;et.clearRect(at,at,C,M),et.fillText(y,at,at+I);const Ot=et.getImageData(at,at,C,M);Tt.fill(ee,0,z),Q.fill(0,0,z);for(let ct=0;ct0?Yt*Yt:0,Q[Vt]=Yt<0?Yt*Yt:0}}kt(Tt,0,0,N,O,N,this.f,this.v,this.z),kt(Q,at,at,C,M,N,this.f,this.v,this.z);for(let ct=0;ct1&&(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 Be(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 Ve{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 Ve))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ve.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 Ve?s:s&&new Ve(s)}static fromLngLat(s,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Ve(new a.L(s.lng-g,s.lat-d),new a.L(s.lng+g,s.lat+d))}}class dn{constructor(s,h,d){this.bounds=Ve.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=Be(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 dn(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 xn 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=Be(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 dn(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 It(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 oe extends xn{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,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),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 pn=a.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Bn 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,pn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new It(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 yi extends Bn{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,pn.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 It(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 Ai extends Bn{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,pn.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 It(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 Lt={},ke=y=>{switch(y){case"geojson":return Ge;case"image":return Bn;case"raster":return xn;case"raster-dem":return oe;case"vector":return Fn;case"video":return yi;case"canvas":return Ai}return Lt[y]};function xe(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 rn(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(un);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,xe(y.transform,z.tileID))});const O=function(z){const W={},nt={};for(const et of z){const at=et.queryResults,Q=et.wrappedTileID,Tt=nt[Q]=nt[Q]||{};for(const Ot in at){const ct=at[Ot],Pt=Tt[Ot]=Tt[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 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 un(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 mn{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 It(s,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new It(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 $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 Ui 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(ke(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 $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(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-Ui.maxOverzooming,this._source.minzoom),I=Math.max(g+Ui.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(Vn(this._source.type)){const O={},z={},W=Object.keys(M),nt=a.h.now();for(const et of W){const at=M[et],Q=this._tiles[et];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=nt)continue;const Tt=this.findLoadedParent(at,b);Tt&&(this._addTile(Tt.tileID),O[Tt.tileID.key]=Tt.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 Q of d)this._tiles[Q.key].hasData()?et[Q.key]=Q:at[Q.key]=Q;for(const Q in at){const Tt=at[Q].children(this._source.maxzoom);this._tiles[Tt[0].key]&&this._tiles[Tt[1].key]&&this._tiles[Tt[2].key]&&this._tiles[Tt[3].key]&&(et[Tt[0].key]=M[Tt[0].key]=Tt[0],et[Tt[1].key]=M[Tt[1].key]=Tt[1],et[Tt[2].key]=M[Tt[2].key]=Tt[2],et[Tt[3].key]=M[Tt[3].key]=Tt[3],delete at[Q])}for(const Q in at){const Tt=this.findLoadedParent(at[Q],this._source.minzoom);if(Tt){et[Tt.tileID.key]=M[Tt.tileID.key]=Tt.tileID;for(const Ot in et)et[Ot].isChildOf(Tt.tileID)&&delete et[Ot]}}for(const Q in this._tiles)et[Q]||(this._coveredTiles[Q]=!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-Ui.maxOverzooming,this._source.minzoom),I=Math.max(h+Ui.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 mn(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&&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:Tt})}}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(Vn(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 Vn(y){return y==="raster"||y==="image"||y==="video"}Ui.maxOverzooming=10,Ui.maxUnderzooming=3;const Tn="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[Tn]}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 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 Q=4*at,Tt=this.boxKeys[at];if(s<=et[Q+2]&&h<=et[Q+3]&&d>=et[Q+0]&&g>=et[Q+1]&&(!M||M(Tt))&&(!O||!js(z,Tt.overlapMode))&&(I.push({key:Tt,x1:et[Q],y1:et[Q+1],x2:et[Q+2],y2:et[Q+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 Q=3*at,Tt=this.circleKeys[at];if(this._circleAndRectCollide(et[Q],et[Q+1],et[Q+2],s,h,d,g)&&(!M||M(Tt))&&(!O||!js(z,Tt.overlapMode))){const Ot=et[Q],ct=et[Q+1],Pt=et[Q+2];if(I.push({key:Tt,x1:Ot-Pt,y1:ct-Pt,x2:Ot+Pt,y2:ct+Pt}),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 Q=4*at,Tt=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(Tt))&&!js(z,Tt.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 Q=3*at,Tt=this.circleKeys[at];if(this._circlesCollide(et[Q],et[Q+1],et[Q+2],N.x,N.y,N.radius)&&(!M||M(Tt))&&!js(z,Tt.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 le(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 oi(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],$(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 ce(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,Q=h.transform.width/h.transform.height;let Tt=!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 Nr(y,s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at){const Q=s/24,Tt=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=cn(Q,C,Tt,Ot,h,O,z,y,M,b,W,et,at);if(!Yt)return{notEnoughRoom:!0};const ie=oi(Yt.first.point,I,at).point,te=oi(Yt.last.point,I,at).point;if(d&&!h){const ae=Ke(y.writingMode,ie,te,nt);if(ae)return ae}ct=[Yt.first];for(let ae=y.glyphStartIndex+1;ae0?ie.point:is(z,Yt,Bt,1,g,at),ae=Ke(y.writingMode,Bt,te,nt);if(ae)return ae}const Pt=G(Q*C.getoffsetX(y.glyphStartIndex),Tt,Ot,h,O,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=oi(y.add(y.sub(s)._unit()),g,b).point,C=h.sub(I);return h.add(C._mult(d/C.mag()))}function sn(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=oi(z,g,C);if(W.signedDistanceFromCamera>0)return h.projections[y]=W.point,W.point;const nt=y-N;return is(I===0?b:new a.P(d.getx(nt),d.gety(nt)),z,M,O-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 O=h.add(s);if(y+N=g)return M.offsets[y]=O,O;const z=sn(y+N,C),W=Ss(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 G(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,Q=0;d&&(at*=-1,Q=Math.PI),at<0&&(Q+=Math.PI);let Tt,Ot,ct=at>0?C+I:C+I+1,Pt=g,Bt=g,Vt=0,Yt=0;const ie=Math.abs(et),te=[];let ae;for(;Vt+Yt<=ie;){if(ct+=at,ct=M)return null;Vt+=Yt,Bt=Pt,Ot=Tt;const de={projectionCache:z,lineVertexArray:N,labelPlaneMatrix:O,tileAnchorPoint:b,distanceFromAnchor:Vt,getElevation:nt,previousVertex:Bt,direction:at,absOffsetX:ie};if(Pt=sn(ct,de),h===0)te.push(Bt),ae=Pt.sub(Bt);else{let qe;const Pe=Pt.sub(Bt);qe=Pe.mag()===0?Ss(sn(ct+at,de).sub(Pt),h,at):Ss(Pe,h,at),Ot||(Ot=Bt.add(qe)),Tt=st(ct,qe,Pt,C,M,Ot,h,de),te.push(Ot),ae=Tt.sub(Ot)}Yt=ae.mag()}const Le=ae._mult((ie-Vt)/Yt)._add(Ot||Bt),wn=Q+Math.atan2(Pt.y-Bt.y,Pt.x-Bt.x);return te.push(Le),{point:Le,angle:W?wn: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;hn--)Pe.push(de.path[hn]);for(let hn=1;hnoi(Sn,M,et));Pe=hn.some(Sn=>Sn.signedDistanceFromCamera<=0)?[]:hn.map(Sn=>Sn.point)}let vn=[];if(Pe.length>0){const hn=Pe[0].clone(),Sn=Pe[0].clone();for(let Gi=1;Gi=ae.x&&Sn.x<=Le.x&&hn.y>=ae.y&&Sn.y<=Le.y?[Pe]:Sn.xLe.x||Sn.yLe.y?[]:a.am([Pe],ae.x,ae.y,Le.x,Le.y)}for(const hn of vn){wn.reset(hn,.25*te);let Sn=0;Sn=wn.length<=.5*te?1:Math.ceil(wn.paddedLength/Yn)+1;for(let Gi=0;Gi=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: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 Fe{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),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=xt(d,1,this.transform.zoom),at=le(z,W,nt,this.transform,et);let Q=null;if(W){const Ot=yo(z,W,nt,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 Tt={bucket:b,layout:M,posMatrix:z,textLabelPlaneMatrix:at,labelToScreenMatrix:Q,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:ct,symbolInstanceStart:Pt,symbolInstanceEnd:Bt}=Ot;s.push({sortKey:ct,symbolInstanceStart:Pt,symbolInstanceEnd:Bt,parameters:Tt})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Tt})}attemptAnchorPlacement(s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at,Q){const Tt=a.aq[s.textAnchor],Ot=[s.textOffset0,s.textOffset1],ct=Ye(Tt,d,g,Ot,b),Pt=this.collisionIndex.placeCollisionBox(Te(h,ct.x,ct.y,I,C,this.transform.angle),z,M,N,O.predicate,Q);if((!at||this.collisionIndex.placeCollisionBox(Te(at,ct.x,ct.y,I,C,this.transform.angle),z,M,N,O.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:Tt,textBoxScale:b,prevAnchor:Bt},this.markUsedJustification(nt,Tt,W,et),nt.allowVerticalPlacement&&(this.markUsedOrientation(nt,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:O,collisionBoxArray:z,partiallyEvaluatedTextSize:W,collisionGroup:nt}=s.parameters,et=b.get("text-optional"),at=b.get("icon-optional"),Q=a.ar(b,"text-overlap","text-allow-overlap"),Tt=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",ie=Tt&&(ct||!g.hasIconData()||at),te=ct&&(Tt||!g.hasTextData()||et);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const ae=this.retainedQueryData[g.bucketInstanceId].tileID,Le=this.terrain?(de,qe)=>this.terrain.getElevation(ae,de,qe):null,wn=(de,qe)=>{var Pe,Yn;if(h[de.crossTileID])return;if(O)return void(this.placements[de.crossTileID]=new Wt(!1,!1,!1));let vn=!1,hn=!1,Sn=!0,Gi=null,ai={box:null,offscreen:null},Or={box:null,offscreen:null},pr=null,Yi=null,Vo=null,mi=0,Zs=0,$s=0;qe.textFeatureIndex?mi=qe.textFeatureIndex:de.useRuntimeCollisionCircles&&(mi=de.featureIndex),qe.verticalTextFeatureIndex&&(Zs=qe.verticalTextFeatureIndex);const nl=qe.textBox;if(nl){const $r=ji=>{let dr=a.ai.horizontal;if(g.allowVerticalPlacement&&!ji&&this.prevPlacement){const xo=this.prevPlacement.placedOrientations[de.crossTileID];xo&&(this.placedOrientations[de.crossTileID]=xo,dr=xo,this.markUsedOrientation(g,dr,de))}return dr},zr=(ji,dr)=>{if(g.allowVerticalPlacement&&de.numVerticalGlyphVertices>0&&qe.verticalTextBox){for(const xo of g.writingModes)if(xo===a.ai.vertical?(ai=dr(),Or=ai):ai=ji(),ai&&ai.box&&ai.box.length)break}else ai=ji()},ao=de.textAnchorOffsetStartIndex,Al=de.textAnchorOffsetEndIndex;if(Al===ao){const ji=(dr,xo)=>{const qi=this.collisionIndex.placeCollisionBox(dr,Q,N,I,nt.predicate,Le);return qi&&qi.box&&qi.box.length&&(this.markUsedOrientation(g,xo,de),this.placedOrientations[de.crossTileID]=xo),qi};zr(()=>ji(nl,a.ai.horizontal),()=>{const dr=qe.verticalTextBox;return g.allowVerticalPlacement&&de.numVerticalGlyphVertices>0&&dr?ji(dr,a.ai.vertical):{box:null,offscreen:null}}),$r(ai&&ai.box&&ai.box.length)}else{let ji=a.aq[(Yn=(Pe=this.prevPlacement)===null||Pe===void 0?void 0:Pe.variableOffsets[de.crossTileID])===null||Yn===void 0?void 0:Yn.anchor];const dr=(qi,Nl,dh)=>{const om=qi.x2-qi.x1,sm=qi.y2-qi.y1,Qg=de.textBoxScale,np=Vt&&Ot==="never"?Nl:null;let Ws={box:[],offscreen:!1},Dl=Q==="never"?1:2,Xs="never";ji&&Dl++;for(let cs=0;csdr(nl,qe.iconBox,a.ai.horizontal),()=>{const qi=qe.verticalTextBox;return g.allowVerticalPlacement&&!(ai&&ai.box&&ai.box.length)&&de.numVerticalGlyphVertices>0&&qi?dr(qi,qe.verticalIconBox,a.ai.vertical):{box:null,offscreen:null}}),ai&&(vn=ai.box,Sn=ai.offscreen);const xo=$r(ai&&ai.box);if(!vn&&this.prevPlacement){const qi=this.prevPlacement.variableOffsets[de.crossTileID];qi&&(this.variableOffsets[de.crossTileID]=qi,this.markUsedJustification(g,qi.anchor,de,xo))}}}if(pr=ai,vn=pr&&pr.box&&pr.box.length>0,Sn=pr&&pr.offscreen,de.useRuntimeCollisionCircles){const $r=g.text.placedSymbolArray.get(de.centerJustifiedTextSymbolIndex),zr=a.aj(g.textSizeData,W,$r),ao=b.get("text-padding");Yi=this.collisionIndex.placeCollisionCircles(Q,$r,g.lineVertexArray,g.glyphOffsetArray,zr,I,C,M,d,Bt,nt.predicate,de.collisionCircleDiameter,ao,Le),Yi.circles.length&&Yi.collisionDetected&&!d&&a.w("Collisions detected, but collision boxes are not shown"),vn=Tt||Yi.circles.length>0&&!Yi.collisionDetected,Sn=Sn&&Yi.offscreen}if(qe.iconFeatureIndex&&($s=qe.iconFeatureIndex),qe.iconBox){const $r=zr=>{const ao=Vt&&Gi?Te(zr,Gi.x,Gi.y,Pt,Bt,this.transform.angle):zr;return this.collisionIndex.placeCollisionBox(ao,Ot,N,I,nt.predicate,Le)};Or&&Or.box&&Or.box.length&&qe.verticalIconBox?(Vo=$r(qe.verticalIconBox),hn=Vo.box.length>0):(Vo=$r(qe.iconBox),hn=Vo.box.length>0),Sn=Sn&&Vo.offscreen}const kl=et||de.numHorizontalGlyphVertices===0&&de.numVerticalGlyphVertices===0,yu=at||de.numIconVertices===0;if(kl||yu?yu?kl||(hn=hn&&vn):vn=hn&&vn:hn=vn=hn&&vn,vn&&pr&&pr.box&&this.collisionIndex.insertCollisionBox(pr.box,Q,b.get("text-ignore-placement"),g.bucketInstanceId,Or&&Or.box&&Zs?Zs:mi,nt.ID),hn&&Vo&&this.collisionIndex.insertCollisionBox(Vo.box,Ot,b.get("icon-ignore-placement"),g.bucketInstanceId,$s,nt.ID),Yi&&(vn&&this.collisionIndex.insertCollisionCircles(Yi.circles,Q,b.get("text-ignore-placement"),g.bucketInstanceId,mi,nt.ID),d)){const $r=g.bucketInstanceId;let zr=this.collisionCircleArrays[$r];zr===void 0&&(zr=this.collisionCircleArrays[$r]=new Ht);for(let ao=0;ao=0;--qe){const Pe=de[qe];wn(g.symbolInstances.get(Pe),g.collisionArrays[Pe])}}else for(let de=s.symbolInstanceStart;de=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 Ct(O,g,N.text,N.icon),d=d||N.text!==O.text.placed||N.icon!==O.icon.placed):(this.opacities[M]=new Ct(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 Ct(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 Ct(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 Ct(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,Tt)=>{for(let Ot=0;Ot0,Vt=this.placedOrientations[Q.crossTileID],Yt=Vt===a.ai.vertical,ie=Vt===a.ai.horizontal||Vt===a.ai.horizontalOnly;if(Tt>0||Ot>0){const te=Dr(Pt.text);et(s.text,Tt,Yt?rs:te),et(s.text,Ot,ie?rs:te);const ae=Pt.text.isHidden();[Q.rightJustifiedTextSymbolIndex,Q.centerJustifiedTextSymbolIndex,Q.leftJustifiedTextSymbolIndex].forEach(de=>{de>=0&&(s.text.placedSymbolArray.get(de).hidden=ae||Yt?1:0)}),Q.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(Q.verticalPlacedTextSymbolIndex).hidden=ae||ie?1:0);const Le=this.variableOffsets[Q.crossTileID];Le&&this.markUsedJustification(s,Le.anchor,Q,Vt);const wn=this.placedOrientations[Q.crossTileID];wn&&(this.markUsedJustification(s,"left",Q,wn),this.markUsedOrientation(s,wn,Q))}if(Bt){const te=Dr(Pt.icon),ae=!(W&&Q.verticalPlacedIconSymbolIndex&&Yt);Q.placedIconSymbolIndex>=0&&(et(s.icon,Q.numIconVertices,ae?te:rs),s.icon.placedSymbolArray.get(Q.placedIconSymbolIndex).hidden=Pt.icon.isHidden()),Q.verticalPlacedIconSymbolIndex>=0&&(et(s.icon,Q.numVerticalIconVertices,ae?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 ae=new a.P(0,0);if(te.textBox||te.verticalTextBox){let wn=!0;if(N){const de=this.variableOffsets[ct];de?(ae=Ye(de.anchor,de.width,de.height,de.textOffset,de.textBoxScale),O&&ae._rotate(z?this.transform.angle:-this.transform.angle)):wn=!1}te.textBox&&on(s.textCollisionBox.collisionVertexArray,Pt.text.placed,!wn||Yt,ae.x,ae.y),te.verticalTextBox&&on(s.textCollisionBox.collisionVertexArray,Pt.text.placed,!wn||ie,ae.x,ae.y)}const Le=!!(!ie&&te.verticalIconBox);te.iconBox&&on(s.iconCollisionBox.collisionVertexArray,Pt.icon.placed,Le,W?ae.x:0,W?ae.y:0),te.verticalIconBox&&on(s.iconCollisionBox.collisionVertexArray,Pt.icon.placed,!Le,W?ae.x:0,W?ae.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 on(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 $n=Math.pow(2,25),Jn=Math.pow(2,24),Nn=Math.pow(2,17),An=Math.pow(2,16),qr=Math.pow(2,9),si=Math.pow(2,8),ir=Math.pow(2,1);function Dr(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*$n+s*Jn+h*Nn+s*An+h*qr+s*si+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: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=su/Math.pow(2,M-b),O=(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(O-z)}}findMatches(s,h,d){const g=this.tileID.canonical.zs)}}class Hn{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")),Ro=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 Rr extends a.E{constructor(s,h={}){super(),this.map=s,this.dispatcher=new en(Ha(),this,s._getMapId()),this.imageManager=new bt,this.imageManager.setEventedParent(this),this.glyphManager=new Qt(s._requestManager,h.localIdeographFontFamily),this.lineAtlas=new Zn(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=Rr.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 bn(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,O=I>1?"@2x":"",z={},W={},nt={};for(const{id:et,url:at}of M){const Q=b.transformRequest(b.normalizeSpriteURL(at,O,".json"),Y.SpriteJSON),Tt=`${et}_${Q.url}`;z[Tt]=a.f(Q,(Pt,Bt)=>{delete z[Tt],W[et]=Bt,lt(C,W,nt,Pt,N)});const Ot=b.transformRequest(b.normalizeSpriteURL(at,O,".png"),Y.SpriteImage),ct=`${et}_${Ot.url}`;z[ct]=U.getImage(Ot,(Pt,Bt)=>{delete z[ct],nt[et]=Bt,lt(C,W,nt,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 Ro));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 Ui(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 ie=Tt.featureSortOrder;if(ie){const te=ie.indexOf(Vt.featureIndex);return ie.indexOf(Yt.featureIndex)-te}return Yt.featureIndex-Vt.featureIndex});for(const Vt of Bt)Pt.push(Vt)}}for(const Tt in et)et[Tt].forEach(Ot=>{const ct=Ot.feature,Pt=N[C[Tt].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{Lt[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 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 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=[...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)))}}Rr.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:Un(`#ifdef GL_ES +${e.stack}`:i}function rE(e,t){const n=t(e.length*1,1)>>>0;return Fp().set(e,n/1),Pu=e.length,n}function Z_(e,t){try{return e.apply(this,t)}catch(n){Xe.__wbindgen_exn_store(Br(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=rE(t,Xe.__wbindgen_malloc),a=Pu;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,Br(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,Br(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,Br(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 oE(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 sE(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const i=Gl(t,n);return Br(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 Br(i)},e.wbg.__wbindgen_is_object=function(t){const n=Pn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return Pn(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return Pn(t)in Pn(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=Pn(n),r=typeof i=="number"?i:void 0;nE()[t/8+1]=q_(r)?0:r,Li()[t/4+0]=!q_(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=Pn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_object_clone_ref=function(t){const n=Pn(t);return Br(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return Pn(t)==Pn(n)},e.wbg.__wbindgen_string_get=function(t,n){const i=Pn(n),r=typeof i=="string"?i:void 0;var l=q_(r)?0:Mm(r,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),f=Pu;Li()[t/4+1]=f,Li()[t/4+0]=l},e.wbg.__wbg_String_4370c5505c674d30=function(t,n){const i=String(Pn(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Pu;Li()[t/4+1]=l,Li()[t/4+0]=r},e.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(t,n){const i=Pn(t)[Pn(n)];return Br(i)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Br(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=Pn(n).stack,r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Pu;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(Pn(t))},e.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(Pn(t))},e.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(Pn(t))},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(Pn(t))},e.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(Pn(t))},e.wbg.__wbg_get_44be0491f933a435=function(t,n){const i=Pn(t)[n>>>0];return Br(i)},e.wbg.__wbg_length_fff51ee6522a1a18=function(t){return Pn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof Pn(t)=="function"},e.wbg.__wbg_next_526fc47e980da008=function(t){const n=Pn(t).next;return Br(n)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return Z_(function(t){const n=Pn(t).next();return Br(n)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Pn(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){const n=Pn(t).value;return Br(n)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Br(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return Z_(function(t,n){const i=Reflect.get(Pn(t),Pn(n));return Br(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return Z_(function(t,n){const i=Pn(t).call(Pn(n));return Br(i)},arguments)},e.wbg.__wbg_isArray_4c24b343cb13cfb1=function(t){return Array.isArray(Pn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let n;try{n=Pn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const n=Pn(t).buffer;return Br(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){const n=new Uint8Array(Pn(t));return Br(n)},e.wbg.__wbg_set_5cf90238115182c3=function(t,n,i){Pn(t).set(Pn(n),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Pn(t).length},e.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let n;try{n=Pn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const i=iy(Pn(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),l=Pu;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 Br(t)},e}function aE(e,t){return Xe=e.exports,Qb.__wbindgen_wasm_module=t,kp=null,Ap=null,Pp=null,Xe}async function Qb(e){if(Xe!==void 0)return Xe;typeof e>"u"&&(e="/ltn/assets/route_snapper_bg.wasm");const t=sE();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await oE(await e,t);return aE(n,i)}const Ch=[];function $_(e,t){return{subscribe:ui(e,t).subscribe}}function ui(e,t=Me){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 lE=Date.now();function of(e){return`${e}-${lE++}`}const Ly=Symbol.for("svelte-maplibre");function sf(){return OS(Ly)}function uE(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 cE(){let e=new Map;return qb(Ly,{map:ui(null),source:$_(null),layer:$_(null),popupTarget:$_(null),cluster:ui(),loadedImages:ui(new Set),minzoom:ui(0),maxzoom:ui(24),layerEvent:ui(null),layerInfo:e,eventTopMost:uE(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=ui(null),f=Vv(l),a={...r,[e]:Vv(l)};if(t&&(a.popupTarget=f),i){let _=ui(null);a.layerEvent=_,r.layerEvent=_}return n&&(a.cluster=ui()),qb(Ly,a),{...r,self:l}}function hE(){return My({key:"source",setCluster:!0})}function fE(e=!0){return My({key:"layer",setPopupTarget:e,setMouseEvent:e})}function pE(){return My({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function dE(e){return"layerType"in e&&e.layerType==="deckgl"}var tx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ex(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nx(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 ix={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(tx,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(R){v(R)}}function E(k){try{T(p.throw(k))}catch(R){v(R)}}function T(k){var R;k.done?m(k.value):(R=k.value,R instanceof c?R:new c(function(B){B(R)})).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=D;function D(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}D.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 F=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 Z(){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 F(u,o,c,p);return function(v){return m.solve(v)}}const it=K(.25,.1,.25,1);function mt(u,o,c){return Math.min(c,Math.max(o,u))}function ft(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 lt=1;function It(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 bt(u){return Array.isArray(u)?u.map(bt):typeof u=="object"&&u?It(u,bt):u}const ee={};function kt(u){ee[u]||(typeof console<"u"&&console.warn(u),ee[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,R,B,j,X){const H=4*Math.max(-R,0),tt=(Math.max(0,B)-B)*j*4+H,ut=4*j,pt=Math.max(0,R),At=Math.max(0,B);return{rect:{x:pt,y:At,width:Math.min(k.width,R+j)-pt,height:Math.min(k.height,B+X)-At},layout:[{offset:tt,stride:ut}]}}(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=>(dn||(dn=document.createElement("a")),dn.href=u,dn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Fn==null&&(Fn=matchMedia("(prefers-reduced-motion: reduce)")),Fn.matches)}},oe={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class je 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 pn=ne()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Bn=u=>oe.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf("://"))];function yi(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:pn(),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 je(w.status,w.statusText,u.url,E)))).catch(w=>{w.code!==20&&o(new Error(w.message))}),{cancel:()=>{v=!0,m||c.abort()}}}const Ai=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(ne()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,o);if(!ne())return(Bn(u.url)||yi)(u,o)}if(!(/^file:/.test(c=u.url)||/^file:/.test(pn())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return yi(u,o);if(ne()&&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 je(v.status,v.statusText,p.url,w))}},v.send(p.body),{cancel:()=>v.abort()}}(u,o)},Lt=function(u,o){return Ai(gt(u,{type:"arrayBuffer"}),o)};function ke(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 xe(u,o,c){c[u]&&c[u].indexOf(o)!==-1||(c[u]=c[u]||[],c[u].push(o))}function rn(u,o,c){if(c&&c[u]){const p=c[u].indexOf(o);p!==-1&&c[u].splice(p,1)}}class un{constructor(o,c={}){gt(this,c),this.type=o}}class mn extends un{constructor(o,c={}){super("error",gt({error:o},c))}}class Xi{on(o,c){return this._listeners=this._listeners||{},xe(o,c,this._listeners),this}off(o,c){return rn(o,c,this._listeners),rn(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},xe(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new un(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)rn(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 mn&&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 Ui=["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 Ui.forEach(p=>{p in o&&(c[p]=o[p])}),c}function Vn(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,ce,cn,Ke,Nr,st,is,$(sn),G,q,J];function xt(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!xt(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(!xt(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 Ct(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 Xt(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,Ce=3*Ye*Ye,Fe=Ye*Ye*Ye,on=Math.PI/180,$n=180/Math.PI;function Jn(u){return(u%=360)<0&&(u+=360),u}function Nn([u,o,c,p]){let m,v;const w=qr((.2225045*(u=An(u))+.7168786*(o=An(o))+.0606169*(c=An(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 An(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function qr(u){return u>Fe?Math.pow(u,1/3):u/Ce+Ne}function si([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*Dr(m),v=Ht*Dr(v),w=Kt*Dr(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 Dr(u){return u>Ye?u*u*u:Ce*(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 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=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,R,B,j,X,H,tt,ut,pt,At]=w,Et=[R||" ",X||" ",ut].join("");if(Et===" "||Et===" /"||Et===",,"||Et===",,,"){const Nt=[k,j,tt].join(""),Ft=Nt==="%%%"?100:Nt===""?255:0;if(Ft){const Jt=[ou(+T/Ft,0,1),ou(+B/Ft,0,1),ou(+H/Ft,0,1),pt?xd(+pt,At):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,R,B,j,X,H]=v,tt=[T||" ",R||" ",j].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ut=[+E,ou(+k,0,100),ou(+B,0,100),X?xd(+X,H):1];if(su(ut))return function([pt,At,Et,Nt]){function Ft(Jt){const ve=(Jt+pt/30)%12,Le=At*Math.min(Et,1-Et);return Et-Le*Math.max(-1,Math.min(ve-3,9-ve,1))}return pt=Jn(pt),At/=100,Et/=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]=Nn(o),w=Math.sqrt(p*p+m*m);return[Math.round(1e4*w)?Jn(Math.atan2(m,p)*$n):NaN,w,c,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Nn(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 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 Ro{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Ro)return o;if(typeof o=="number")return new Ro([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 Ro(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 Hn||u instanceof mf||u instanceof Zr||u instanceof Ro||u instanceof os||u instanceof Rr)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 cn;if(typeof u=="boolean")return Ke;if(typeof u=="number")return ce;if(u instanceof Hn)return Nr;if(u instanceof mf)return Ss;if(u instanceof Zr)return st;if(u instanceof Ro)return G;if(u instanceof os)return J;if(u instanceof Rr)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=sn;break}c=m}return $(c||sn,o)}return is}function Un(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Hn||u instanceof Zr||u instanceof Ro||u instanceof os||u instanceof Rr?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 Ni{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Gc={string:cn,number:ce,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=sn;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=$(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":Nr,"to-number":ce,"to-string":cn};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 Hn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new Ni(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=Ro.parse(c);if(m)return m}throw new Ni(`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 Ni(`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 Ni(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Zr.fromString(Un(this.args[0].evaluate(o)));case"resolvedImage":return Rr.fromString(Un(this.args[0].evaluate(o)));default:return Un(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]=Hn.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 oi(p,o))}checkSubtype(o,c){const p=xt(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,cn),!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 Hu(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 R=0;Rc[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 R of T){const B=[R.x+v[0],R.y+v[1]];yf(o,B),k.push(B)}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,R]of E){T=new jc(c.registry,Wc,c.path,null,c.scope);const B=[];let j=!1;for(let X=1;X{return j=B,Array.isArray(j)?`(${j.map(ot).join(", ")})`:`(${ot(j.type)}...)`;var j}).join(" | "),R=[];for(let B=1;B{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 Yu(u){if(u instanceof as&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(c=>{o&&!Yu(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 Ni("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,ce);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 B=c.parse(T,R,v);if(!B)return null;v=v||B.type,m.push([E,B])}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 Ln(u,o,c){return u+c*(o-u)}function Yc(u,o,c){return u.map((p,m)=>Ln(p,o[m],c))}const Oo={number:Ln,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,k,R,B]=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,R!==1&&R!==0||(X=v));else{let At=T-m;T>m&&At>180?At-=360:T180&&(At+=360),j=m+c*At}const[H,tt,ut,pt]=function([At,Et,Nt,Ft]){return At=isNaN(At)?0:At*on,si([Nt,Math.cos(At)*Et,Math.sin(At)*Et,Ft])}([j,X??Ln(v,k,c),Ln(w,R,c),Ln(E,B,c)]);return new Hn(H,tt,ut,pt,!1)}case"lab":{const[m,v,w,E]=si(Yc(u.lab,o.lab,c));return new Hn(m,v,w,E,!1)}}},array:Yc,padding:function(u,o,c){return new Ro(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 Ni(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;wtypeof R!="number"||R<0||R>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,ce),!v)return null;const E=[];let T=null;p==="interpolate-hcl"||p==="interpolate-lab"?T=Nr:c.expectedType&&c.expectedType.kind!=="value"&&(T=c.expectedType);for(let k=0;k=R)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const H=c.parse(B,X,T);if(!H)return null;T=T||H.type,E.push([R,H])}return Xt(T,ce)||Xt(T,Nr)||Xt(T,G)||Xt(T,J)||Xt(T,$(ce))?new zo(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=zo.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 Oo[this.type.kind](T,k,E);case"interpolate-hcl":return Oo.color(T,k,E,"hcl");case"interpolate-lab":return Oo.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=>xt(m,E.type));return new Kc(w?sn: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 Rr&&!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 Ni(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new Ni(`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,sn),m=c.parse(o[2],2,sn);return p&&m?rt(p.type,[Ke,cn,ce,ws,sn])?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(!Ct(c,["boolean","string","number","null"]))throw new Ni(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Ei(c))} instead.`);if(!Ct(p,["string","array"]))throw new Ni(`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=ce,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,sn),m=c.parse(o[2],2,sn);if(!p||!m)return null;if(!rt(p.type,[Ke,cn,ce,ws,sn]))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,ce);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(!Ct(c,["boolean","string","number","null"]))throw new Ni(`Expected first argument to be of type boolean, string, number or null, but found ${ot(Ei(c))} instead.`);if(!Ct(p,["string","array"]))throw new Ni(`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(B,k,m);if(!X)return null;m=m||X.type,w.push(X)}const E=c.parse(o[1],1,sn);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,sn),m=c.parse(o[2],2,ce);if(!p||!m)return null;if(!rt(p.type,[$(sn),cn,sn]))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,ce);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(!Ct(c,["string","array"]))throw new Ni(`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 rx{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,sn);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,sn);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 R=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(R=w.parse(v[3],3,Ss),!R)return null}return new rx(T,k,R)}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 Ni(`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=cn,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,ce);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,cn),!v))return null;let w=null;if(m.currency&&(w=c.parse(m.currency,1,cn),!w))return null;let E=null;if(m["min-fraction-digits"]&&(E=c.parse(m["min-fraction-digits"],1,ce),!E))return null;let T=null;return m["max-fraction-digits"]&&(T=c.parse(m["max-fraction-digits"],1,ce),!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,ce),!T))return null;let k=null;if(E["text-font"]&&(k=c.parse(E["text-font"],1,$(cn)),!k))return null;let R=null;if(E["text-color"]&&(R=c.parse(E["text-color"],1,Nr),!R))return null;const B=m[m.length-1];B.scale=T,B.font=k,B.textColor=R}else{const T=c.parse(o[w],1,sn);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(Un(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,cn);return p?new Mf(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=Rr.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=ce,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 Ni(`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:zo,"interpolate-hcl":zo,"interpolate-lab":zo,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 Ni(w);return new Hn(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 Gn(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 Mn(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 R=c?Hn.parse:Ro.parse;(u=vo({},u)).stops&&(u.stops=u.stops.map(B=>[B[0],R(B[1])])),u.default=R(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=Ku;else if(v==="interval")E=vi;else if(v==="categorical"){E=Ci,T=Object.create(null);for(const R of u.stops)T[R[0]]=R[1];k=typeof u.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Rd}if(p){const R={},B=[];for(let H=0;HH[0]),evaluate:({zoom:H},tt)=>Ku({stops:j,base:u.base},o,H).evaluate(H,tt)}}if(m){const R=v==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:zo.interpolationFactor.bind(void 0,R),zoomStops:u.stops.map(B=>B[0]),evaluate:({zoom:B})=>E(u,o,B,T,k)}}return{kind:"source",evaluate(R,B){const j=B&&B.properties?B.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 vi(u,o,c){if(Gn(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 Ku(u,o,c){const p=u.base!==void 0?u.base:1;if(Gn(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(R=>R[0]),c),w=function(R,B,j,X){const H=X-j,tt=R-j;return H===0?0:B===1?tt/H:(Math.pow(B,tt)-1)/(Math.pow(B,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=Oo[o.type]||$g;return typeof E.evaluate=="function"?{evaluate(...R){const B=E.evaluate.apply(void 0,R),j=T.evaluate.apply(void 0,R);if(B!==void 0&&j!==void 0)return k(B,j,w,u.colorSpace)}}:k(E,T,w,u.colorSpace)}function Rd(u,o,c){switch(o.type){case"color":c=Hn.parse(c);break;case"formatted":c=Zr.fromString(c.toString());break;case"resolvedImage":c=Rr.fromString(c.toString());break;case"padding":c=Ro.parse(c);break;default:Gn(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"},[cn],(u,[o])=>{throw new Ni(o.evaluate(u))}],typeof:[cn,[sn],(u,[o])=>ot(Ei(o.evaluate(u)))],"to-rgba":[$(ce,4),[Nr],(u,[o])=>{const[c,p,m,v]=o.evaluate(u).rgb;return[255*c,255*p,255*m,v]}],rgb:[Nr,[ce,ce,ce],kd],rgba:[Nr,[ce,ce,ce,ce],kd],has:{type:Ke,overloads:[[[cn],(u,[o])=>Ad(o.evaluate(u),u.properties())],[[cn,is],(u,[o,c])=>Ad(o.evaluate(u),c.evaluate(u))]]},get:{type:sn,overloads:[[[cn],(u,[o])=>kf(o.evaluate(u),u.properties())],[[cn,is],(u,[o,c])=>kf(o.evaluate(u),c.evaluate(u))]]},"feature-state":[sn,[cn],(u,[o])=>kf(o.evaluate(u),u.featureState||{})],properties:[is,[],u=>u.properties()],"geometry-type":[cn,[],u=>u.geometryType()],id:[sn,[],u=>u.id()],zoom:[ce,[],u=>u.globals.zoom],"heatmap-density":[ce,[],u=>u.globals.heatmapDensity||0],"line-progress":[ce,[],u=>u.globals.lineProgress||0],accumulated:[sn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ce,Il(ce),(u,o)=>{let c=0;for(const p of o)c+=p.evaluate(u);return c}],"*":[ce,Il(ce),(u,o)=>{let c=1;for(const p of o)c*=p.evaluate(u);return c}],"-":{type:ce,overloads:[[[ce,ce],(u,[o,c])=>o.evaluate(u)-c.evaluate(u)],[[ce],(u,[o])=>-o.evaluate(u)]]},"/":[ce,[ce,ce],(u,[o,c])=>o.evaluate(u)/c.evaluate(u)],"%":[ce,[ce,ce],(u,[o,c])=>o.evaluate(u)%c.evaluate(u)],ln2:[ce,[],()=>Math.LN2],pi:[ce,[],()=>Math.PI],e:[ce,[],()=>Math.E],"^":[ce,[ce,ce],(u,[o,c])=>Math.pow(o.evaluate(u),c.evaluate(u))],sqrt:[ce,[ce],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ce,[ce],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ce,[ce],(u,[o])=>Math.log(o.evaluate(u))],log2:[ce,[ce],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ce,[ce],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ce,[ce],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ce,[ce],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ce,[ce],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ce,[ce],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ce,[ce],(u,[o])=>Math.atan(o.evaluate(u))],min:[ce,Il(ce),(u,o)=>Math.min(...o.map(c=>c.evaluate(u)))],max:[ce,Il(ce),(u,o)=>Math.max(...o.map(c=>c.evaluate(u)))],abs:[ce,[ce],(u,[o])=>Math.abs(o.evaluate(u))],round:[ce,[ce],(u,[o])=>{const c=o.evaluate(u);return c<0?-Math.round(-c):Math.round(c)}],floor:[ce,[ce],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ce,[ce],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[Ke,[cn,sn],(u,[o,c])=>u.properties()[o.value]===c.value],"filter-id-==":[Ke,[sn],(u,[o])=>u.id()===o.value],"filter-type-==":[Ke,[cn],(u,[o])=>u.geometryType()===o.value],"filter-<":[Ke,[cn,sn],(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,[cn,sn],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>m}],"filter-id->":[Ke,[sn],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ke,[cn,sn],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p<=m}],"filter-id-<=":[Ke,[sn],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ke,[cn,sn],(u,[o,c])=>{const p=u.properties()[o.value],m=c.value;return typeof p==typeof m&&p>=m}],"filter-id->=":[Ke,[sn],(u,[o])=>{const c=u.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ke,[sn],(u,[o])=>o.value in u.properties()],"filter-has-id":[Ke,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[Ke,[$(cn)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[Ke,[$(sn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[Ke,[cn,$(sn)],(u,[o,c])=>c.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[Ke,[cn,$(sn)],(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,[cn],(u,[o])=>{const c=u.globals&&u.globals.isSupportedScript;return!c||c(o.evaluate(u))}],upcase:[cn,[cn],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[cn,[cn],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[cn,Il(sn),(u,o)=>o.map(c=>Un(c.evaluate(u))).join("")],"resolved-locale":[cn,[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 Hn(0,0,0,0):p.type==="color"?Hn.parse(p.default)||null:p.type==="padding"?Ro.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 Ni(`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:Nr,string:cn,number:ce,enum:cn,boolean:Ke,formatted:st,padding:G,resolvedImage:q,variableAnchorOffsetCollection:J};return m.type==="array"?$(v[m.value]||sn,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"&&!Yu(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"&&!Yu(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?zo.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 oi("","data expressions not supported")]);const v=Hc(p,["zoom"]);if(!v&&!Dd(o))return Qa([new oi("","zoom expressions not supported")]);const w=Qu(p);return w||v?w instanceof oi?Qa([w]):w instanceof zo&&!Af(o)?Qa([new oi("",'"interpolate" expressions cannot be used with this property')]):Nd(w?new rh(m?"camera":"composite",c.value,w.labels,w instanceof zo?w.interpolation:void 0):new Df(m?"constant":"source",c.value)):Qa([new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ju{constructor(o,c){this._parameters=o,this._specification=c,vo(this,Mn(this._parameters,this._specification))}static deserialize(o){return new Ju(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Qu(u){let o=null;if(u instanceof Jc)o=Qu(u.result);else if(u instanceof Kc){for(const c of u.args)if(o=Qu(c),o)break}else(u instanceof Ja||u instanceof zo)&&u.input instanceof as&&u.input.name==="zoom"&&(o=u);return o instanceof oi||u.eachChild(c=>{const p=Qu(c);p instanceof oi?o=p:!o&&p?o=new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function tc(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(!tc(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};tc(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(ec)):o==="in"?zd(u[1],u.slice(2)):o==="!in"?ec(zd(u[1],u.slice(2))):o==="has"?Fd(u[1]):o==="!has"?ec(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 ec(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 le(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function lh(u){const o=u.valueSpec,c=Di(u.value.type);let p,m,v,w={};const E=c!=="categorical"&&u.value.property===void 0,T=!E,k=Gn(u.value.stops)==="array"&&Gn(u.value.stops[0])==="array"&&Gn(u.value.stops[0][0])==="object",R=bo({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 le(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:B})),Gn(tt)==="array"&&tt.length===0&&H.push(new le(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&&R.push(new le(u.key,u.value,'missing required property "property"')),c==="identity"||u.value.stops||R.push(new le(u.key,u.value,'missing required property "stops"')),c==="exponential"&&u.valueSpec.expression&&!Af(u.valueSpec)&&R.push(new le(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(T&&!hu(u.valueSpec)?R.push(new le(u.key,u.value,"property functions not supported")):E&&!Dd(u.valueSpec)&&R.push(new le(u.key,u.value,"zoom functions not supported"))),c!=="categorical"&&!k||u.value.property!==void 0||R.push(new le(u.key,u.value,'"property" property is required')),R;function B(X){let H=[];const tt=X.value,ut=X.key;if(Gn(tt)!=="array")return[new le(ut,tt,`array expected, ${Gn(tt)} found`)];if(tt.length!==2)return[new le(ut,tt,`array length 2 expected, length ${tt.length} found`)];if(k){if(Gn(tt[0])!=="object")return[new le(ut,tt,`object expected, ${Gn(tt[0])} found`)];if(tt[0].zoom===void 0)return[new le(ut,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new le(ut,tt,"object stop key must have value")];if(v&&v>Di(tt[0].zoom))return[new le(ut,tt[0].zoom,"stop zoom values must appear in ascending order")];Di(tt[0].zoom)!==v&&(v=Di(tt[0].zoom),m=void 0,w={}),H=H.concat(bo({key:`${ut}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,objectElementValidators:{zoom:nc,value:j}}))}else H=H.concat(j({key:`${ut}[0]`,value:tt[0],valueSpec:{},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec},tt));return nh(Tl(tt[1]))?H.concat([new le(`${ut}[1]`,tt[1],"expressions are not allowed in function stops.")]):H.concat(X.validateSpec({key:`${ut}[1]`,value:tt[1],valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec}))}function j(X,H){const tt=Gn(X.value),ut=Di(X.value),pt=X.value!==null?X.value:H;if(p){if(tt!==p)return[new le(X.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 le(X.key,pt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let At=`number expected, ${tt} found`;return hu(o)&&c===void 0&&(At+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new le(X.key,pt,At)]}return c!=="categorical"||tt!=="number"||isFinite(ut)&&Math.floor(ut)===ut?c!=="categorical"&&tt==="number"&&m!==void 0&&utnew le(`${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 le(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"&&!Yu(c))return[new le(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!Yu(c))return[new le(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 le(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Xc(c))return[new le(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ic(u){const o=u.key,c=u.value,p=u.valueSpec,m=[];return Array.isArray(p.values)?p.values.indexOf(Di(c))===-1&&m.push(new le(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(Di(c))===-1&&m.push(new le(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),m}function pu(u){return tc(Tl(u.value))?Ll(vo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Vd(u)}function Vd(u){const o=u.value,c=u.key;if(Gn(o)!=="array")return[new le(c,o,`array expected, ${Gn(o)} found`)];const p=u.styleSpec;let m,v=[];if(o.length<1)return[new le(c,o,"filter array must have at least 1 element")];switch(v=v.concat(ic({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Di(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Di(o[1])==="$type"&&v.push(new le(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new le(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(m=Gn(o[1]),m!=="string"&&v.push(new le(`${c}[1]`,o[1],`string expected, ${m} found`)));for(let w=2;w{k in c&&o.push(new le(p,c[k],`"${k}" is prohibited for ref layers`))}),m.layers.forEach(k=>{Di(k.id)===E&&(T=k)}),T?T.ref?o.push(new le(p,c.ref,"ref cannot reference another ref layer")):w=Di(T.type):o.push(new le(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&&Di(T.type);T?k==="vector"&&w==="raster"?o.push(new le(p,c.source,`layer "${c.id}" requires a raster source`)):k!=="raster-dem"&&w==="hillshade"?o.push(new le(p,c.source,`layer "${c.id}" requires a raster-dem source`)):k==="raster"&&w!=="raster"?o.push(new le(p,c.source,`layer "${c.id}" requires a vector source`)):k!=="vector"||c["source-layer"]?k==="raster-dem"&&w!=="hillshade"?o.push(new le(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 le(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new le(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new le(p,c.source,`source "${c.source}" not found`))}else o.push(new le(p,c,'missing required property "source"'));return o=o.concat(bo({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=>bo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":k=>jd(vo({layerType:w},k))}}),paint:T=>bo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":k=>Gd(vo({layerType:w},k))}})}})),o}function qs(u){const o=u.value,c=u.key,p=Gn(o);return p!=="string"?[new le(c,o,`string expected, ${p} found`)]:[]}const rc={promoteId:function({key:u,value:o}){if(Gn(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 Fo(u){const o=u.value,c=u.key,p=u.styleSpec,m=u.style,v=u.validateSpec;if(!o.type)return[new le(c,o,'"type" is required')];const w=Di(o.type);let E;switch(w){case"vector":case"raster":return E=bo({key:c,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:rc,validateSpec:v}),E;case"raster-dem":return E=function(T){var k;const R=(k=T.sourceName)!==null&&k!==void 0?k:"",B=T.value,j=T.styleSpec,X=j.source_raster_dem,H=T.style;let tt=[];const ut=Gn(B);if(B===void 0)return tt;if(ut!=="object")return tt.push(new le("source_raster_dem",B,`object expected, ${ut} found`)),tt;const pt=Di(B.encoding)==="custom",At=["redFactor","greenFactor","blueFactor","baseShift"],Et=T.value.encoding?`"${T.value.encoding}"`:"Default";for(const Nt in B)!pt&&At.includes(Nt)?tt.push(new le(Nt,B[Nt],`In "${R}": "${Nt}" is only valid when "encoding" is set to "custom". ${Et} encoding found`)):X[Nt]?tt=tt.concat(T.validateSpec({key:Nt,value:B[Nt],valueSpec:X[Nt],validateSpec:T.validateSpec,style:H,styleSpec:j})):tt.push(new le(Nt,B[Nt],`unknown property "${Nt}"`));return tt}({sourceName:c,value:o,style:u.style,styleSpec:p,validateSpec:v}),E;case"geojson":if(E=bo({key:c,value:o,valueSpec:p.source_geojson,style:m,styleSpec:p,validateSpec:v,objectElementValidators:rc}),o.cluster)for(const T in o.clusterProperties){const[k,R]=o.clusterProperties[T],B=typeof k=="string"?[k,["accumulated"],["get",T]]:k;E.push(...Ll({key:`${c}.${T}.map`,value:R,validateSpec:v,expressionContext:"cluster-map"})),E.push(...Ll({key:`${c}.${T}.reduce`,value:B,validateSpec:v,expressionContext:"cluster-reduce"}))}return E;case"video":return bo({key:c,value:o,valueSpec:p.source_video,style:m,validateSpec:v,styleSpec:p});case"image":return bo({key:c,value:o,valueSpec:p.source_image,style:m,validateSpec:v,styleSpec:p});case"canvas":return[new le(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ic({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:p})}}function oc(u){const o=u.value,c=u.styleSpec,p=c.light,m=u.style;let v=[];const w=Gn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new le("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 le(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=Gn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new le("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 le(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 le(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 le(p,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),v.push(c[w].url),o=o.concat(bo({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=Gn(o);return p!=="boolean"?[new le(c,o,`boolean expected, ${p} found`)]:[]},number:nc,color:function(u){const o=u.key,c=u.value,p=Gn(c);return p!=="string"?[new le(o,c,`color expected, ${p} found`)]:Hn.parse(String(c))?[]:[new le(o,c,`color expected, "${c}" found`)]},constants:Bd,enum:ic,filter:pu,function:lh,layer:qd,object:bo,source:Fo,light:oc,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(Gn(c)==="array"){if(c.length<1||c.length>4)return[new le(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(Fo)),ls.sprite=Ta(Ca($d)),ls.glyphs=Ta(Ca(Xd)),ls.light=Ta(Ca(oc)),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 mn(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=B[H+0]&&m>=B[H+1])?(E[X]=!0,w.push(R[X])):E[X]=!1}}}}_forEachCell(o,c,p,m,v,w,E,T){const k=this._convertToCellCoord(o),R=this._convertToCellCoord(c),B=this._convertToCellCoord(p),j=this._convertToCellCoord(m);for(let X=k;X<=B;X++)for(let H=R;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)||bn(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!(ye.Arabic(u)||ye["Arabic Supplement"](u)||ye["Arabic Extended-A"](u)||ye["Arabic Presentation Forms-A"](u)||ye["Arabic Presentation Forms-B"](u))}function Uf(u){return!(u!==746&&u!==747&&(u<4352||!(ye["Bopomofo Extended"](u)||ye.Bopomofo(u)||ye["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||ye["CJK Compatibility Ideographs"](u)||ye["CJK Compatibility"](u)||ye["CJK Radicals Supplement"](u)||ye["CJK Strokes"](u)||!(!ye["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||ye["CJK Unified Ideographs Extension A"](u)||ye["CJK Unified Ideographs"](u)||ye["Enclosed CJK Letters and Months"](u)||ye["Hangul Compatibility Jamo"](u)||ye["Hangul Jamo Extended-A"](u)||ye["Hangul Jamo Extended-B"](u)||ye["Hangul Jamo"](u)||ye["Hangul Syllables"](u)||ye.Hiragana(u)||ye["Ideographic Description Characters"](u)||ye.Kanbun(u)||ye["Kangxi Radicals"](u)||ye["Katakana Phonetic Extensions"](u)||ye.Katakana(u)&&u!==12540||!(!ye["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)||!(!ye["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||ye["Unified Canadian Aboriginal Syllabics"](u)||ye["Unified Canadian Aboriginal Syllabics Extended"](u)||ye["Vertical Forms"](u)||ye["Yijing Hexagram Symbols"](u)||ye["Yi Syllables"](u)||ye["Yi Radicals"](u))))}function Kd(u){return!(Uf(u)||function(o){return!!(ye["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||ye["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)||ye["Letterlike Symbols"](o)||ye["Number Forms"](o)||ye["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)||ye["Control Pictures"](o)&&o!==9251||ye["Optical Character Recognition"](o)||ye["Enclosed Alphanumerics"](o)||ye["Geometric Shapes"](o)||ye["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||ye["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||ye["CJK Symbols and Punctuation"](o)||ye.Katakana(o)||ye["Private Use Area"](o)||ye["CJK Compatibility Forms"](o)||ye["Small Form Variants"](o)||ye["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||ye["Arabic Presentation Forms-A"](u)||ye["Arabic Presentation Forms-B"](u)}function Qd(u,o){return!(!o&&Jd(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||ye.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,xo="unavailable",el=null;const sc=function(u){u&&typeof u=="string"&&u.indexOf("NetworkError")>-1&&(xo="error"),Zf&&Zf(u)};function $f(){ac.fire(new un("pluginStateChange",{pluginStatus:xo,pluginURL:el}))}const ac=new Xi,Wf=function(){return xo},tm=function(){if(xo!==Gf||!el)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");xo=jf,$f(),el&&Lt({url:el},u=>{u?sc(u):(xo=qf,$f())})},Bo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>xo===qf||Bo.applyArabicShaping!=null,isLoading:()=>xo===jf,setState(u){if(!ne())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");xo=u.pluginStatus,el=u.pluginURL},isParsed(){if(!ne())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Bo.applyArabicShaping!=null&&Bo.processBidirectionalText!=null&&Bo.processStyledBidirectionalText!=null},getPluginURL(){if(!ne())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return el}};class di{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,Bo.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 Ju(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=Hn.parse(p):m.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(v=os.parse(p)):v=Ro.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 bt(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:bt(c))}getTransition(o){return bt(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=bt(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,R=k*T;return 4*(T<.5?R:3*(T-k)+R-.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 bt(this._values[o].value)}setValue(o,c){this._values[o]=new fh(this._values[o].property,c===null?void 0:bt(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 De{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=Oo[this.specification.type];return m?m(o,c,p):o}}class qe{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=Oo[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 lc extends qe{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 di(Math.floor(c.zoom-1),c)),o.expression.evaluate(new di(Math.floor(c.zoom),c)),o.expression.evaluate(new di(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 fh(p,void 0),v=this.defaultTransitionablePropertyValues[c]=new Xf(p);this.defaultTransitioningPropertyValues[c]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate({})}}}we("DataDrivenProperty",qe),we("DataConstantProperty",De),we("CrossFadedDataDrivenProperty",lc),we("CrossFadedProperty",Hf),we("ColorRampProperty",Yf);const Kf="-transition";class us 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 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 Ri{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 uc extends Ri{_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}}uc.prototype.bytesPerElement=4,we("StructArrayLayout2i4",uc);class cc extends Ri{_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}}cc.prototype.bytesPerElement=6,we("StructArrayLayout3i6",cc);class Pl extends Ri{_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,we("StructArrayLayout4i8",Pl);class Jf extends Ri{_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,we("StructArrayLayout2i4i12",Jf);class Qf extends Ri{_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,we("StructArrayLayout2i4ub8",Qf);class _u extends Ri{_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,we("StructArrayLayout2f8",_u);class tp extends Ri{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,m,v,w,E,T,k,R){const B=this.length;return this.resize(B+1),this.emplace(B,o,c,p,m,v,w,E,T,k,R)}emplace(o,c,p,m,v,w,E,T,k,R,B){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]=R,this.uint16[j+9]=B,o}}tp.prototype.bytesPerElement=20,we("StructArrayLayout10ui20",tp);class ep extends Ri{_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,R,B,j){const X=this.length;return this.resize(X+1),this.emplace(X,o,c,p,m,v,w,E,T,k,R,B,j)}emplace(o,c,p,m,v,w,E,T,k,R,B,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]=R,this.int16[H+9]=B,this.int16[H+10]=j,this.int16[H+11]=X,o}}ep.prototype.bytesPerElement=24,we("StructArrayLayout4i4ui4i24",ep);class jn extends Ri{_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}}jn.prototype.bytesPerElement=12,we("StructArrayLayout3f12",jn);class y extends Ri{_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,we("StructArrayLayout1ul4",y);class s extends Ri{_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 R=this.length;return this.resize(R+1),this.emplace(R,o,c,p,m,v,w,E,T,k)}emplace(o,c,p,m,v,w,E,T,k,R){const B=10*o,j=5*o;return this.int16[B+0]=c,this.int16[B+1]=p,this.int16[B+2]=m,this.int16[B+3]=v,this.int16[B+4]=w,this.int16[B+5]=E,this.uint32[j+3]=T,this.uint16[B+8]=k,this.uint16[B+9]=R,o}}s.prototype.bytesPerElement=20,we("StructArrayLayout6i1ul2ui20",s);class h extends Ri{_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,we("StructArrayLayout2i2i2i12",h);class d extends Ri{_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,we("StructArrayLayout2f1f2i16",d);class g extends Ri{_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,we("StructArrayLayout2ub2f12",g);class b extends Ri{_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,we("StructArrayLayout3ui6",b);class I extends Ri{_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,R,B,j,X,H,tt,ut,pt){const At=this.length;return this.resize(At+1),this.emplace(At,o,c,p,m,v,w,E,T,k,R,B,j,X,H,tt,ut,pt)}emplace(o,c,p,m,v,w,E,T,k,R,B,j,X,H,tt,ut,pt,At){const Et=24*o,Nt=12*o,Ft=48*o;return this.int16[Et+0]=c,this.int16[Et+1]=p,this.uint16[Et+2]=m,this.uint16[Et+3]=v,this.uint32[Nt+2]=w,this.uint32[Nt+3]=E,this.uint32[Nt+4]=T,this.uint16[Et+10]=k,this.uint16[Et+11]=R,this.uint16[Et+12]=B,this.float32[Nt+7]=j,this.float32[Nt+8]=X,this.uint8[Ft+36]=H,this.uint8[Ft+37]=tt,this.uint8[Ft+38]=ut,this.uint32[Nt+10]=pt,this.int16[Et+22]=At,o}}I.prototype.bytesPerElement=48,we("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",I);class C extends Ri{_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,R,B,j,X,H,tt,ut,pt,At,Et,Nt,Ft,Jt,ve,Le,_e,me,ue,Se){const he=this.length;return this.resize(he+1),this.emplace(he,o,c,p,m,v,w,E,T,k,R,B,j,X,H,tt,ut,pt,At,Et,Nt,Ft,Jt,ve,Le,_e,me,ue,Se)}emplace(o,c,p,m,v,w,E,T,k,R,B,j,X,H,tt,ut,pt,At,Et,Nt,Ft,Jt,ve,Le,_e,me,ue,Se,he){const re=32*o,ze=16*o;return this.int16[re+0]=c,this.int16[re+1]=p,this.int16[re+2]=m,this.int16[re+3]=v,this.int16[re+4]=w,this.int16[re+5]=E,this.int16[re+6]=T,this.int16[re+7]=k,this.uint16[re+8]=R,this.uint16[re+9]=B,this.uint16[re+10]=j,this.uint16[re+11]=X,this.uint16[re+12]=H,this.uint16[re+13]=tt,this.uint16[re+14]=ut,this.uint16[re+15]=pt,this.uint16[re+16]=At,this.uint16[re+17]=Et,this.uint16[re+18]=Nt,this.uint16[re+19]=Ft,this.uint16[re+20]=Jt,this.uint16[re+21]=ve,this.uint16[re+22]=Le,this.uint32[ze+12]=_e,this.float32[ze+13]=me,this.float32[ze+14]=ue,this.uint16[re+30]=Se,this.uint16[re+31]=he,o}}C.prototype.bytesPerElement=64,we("StructArrayLayout8i15ui1ul2f2ui64",C);class M extends Ri{_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,we("StructArrayLayout1f4",M);class N extends Ri{_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,we("StructArrayLayout1ui2f12",N);class O extends Ri{_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,we("StructArrayLayout1ul2ui8",O);class z extends Ri{_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,we("StructArrayLayout2ui4",z);class W extends Ri{_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,we("StructArrayLayout1ui2",W);class nt extends Ri{_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,we("StructArrayLayout4f16",nt);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)}}we("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 Tt extends I{get(o){return new Q(this,o)}}we("PlacedSymbolArray",Tt);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)}}we("SymbolInstanceArray",ct);class Pt extends M{getoffsetX(o){return this.float32[1*o+0]}}we("GlyphOffsetArray",Pt);class Bt extends cc{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}we("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)}}we("TextAnchorOffsetArray",Yt);class ie 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]}}ie.prototype.size=8;class te extends O{get(o){return new ie(this,o)}}we("FeatureIndexArray",te);class ae extends uc{}class Te extends uc{}class wn extends uc{}class de extends Jf{}class Ze extends Qf{}class Pe extends _u{}class Yn extends tp{}class vn extends ep{}class hn extends jn{}class Sn extends y{}class Gi extends h{}class ai extends g{}class Or extends b{}class pr extends z{}const Yi=Ti([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vo}=Yi;class mi{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,m){let v=this.segments[this.segments.length-1];return o>mi.MAX_VERTEX_ARRAY_LENGTH&&kt(`Max vertices per segment is ${mi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>mi.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 mi([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:m,vaos:{},sortKey:0}])}}function Zs(u,o){return 256*(u=mt(Math.floor(u),0,255))+mt(Math.floor(o),0,255)}mi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,we("SegmentVector",mi);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 zr=yu,ao=$r.exports;nl.exports=zr,nl.exports.murmur3=zr,nl.exports.murmur2=ao;var Al=x(nl.exports);class ji{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 wo(p,m,0,p.length-1),c&&c.push(p.buffer,m.buffer),{ids:p,positions:m}}static deserialize(o){const c=new ji;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 wo(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;qi(u,v,w),qi(o,3*v,3*w),qi(o,3*v+1,3*w+1),qi(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 di(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 di(this.zoom),c,{},m,[],v),E=this.expression.evaluate(new di(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 ji,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 Dw(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:nt},number:{source:M,composite:_u}},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]}we("ConstantBinder",Ws),we("CrossFadedConstantBinder",Dl),we("SourceExpressionBinder",Xs),we("CrossFadedCompositeBinder",Hs),we("CompositeExpressionBinder",cs),we("ProgramConfiguration",ip,{omit:["_buffers"]}),we("ProgramConfigurationSet",Pa);const rr=8192,t_=Math.pow(2,14)-1,s0=-t_-1;function hc(u){const o=rr/u.extent,c=u.loadGeometry();for(let p=0;pw.x+1||Tw.y+1)&&kt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function fc(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?hc(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 Te,this.indexArray=new Or,this.segments=new mi,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:R,sourceLayerIndex:B}of o){const j=this.layers[0]._featureFilter.needGeometry,X=fc(T,j);if(!this.layers[0]._featureFilter.filter(new di(this.zoom),X,p))continue;const H=E?w.evaluate(X,{},p):void 0,tt={id:k,properties:T.properties,type:T.type,sourceLayerIndex:B,index:R,geometry:j?X.geometry:hc(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:R,sourceLayerIndex:B}=T,j=o[R].feature;this.addFeature(T,k,R,p),c.featureIndex.insert(j,k,R,B,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,Vo),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),R=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(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+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 Fw(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(ut,tt))}(k,T),X=B?R*E:R;for(const H of m)for(const tt of H){const ut=B?tt:d0(tt,T);let pt=X;const At=cm([],[tt.x,tt.y,0,1],T);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=At[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=w.cameraToCenterDistance/At[3]),Rw(j,ut,pt))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;we("HeatmapBucket",m0,{omit:["layers"]});var Gw={get paint(){return g0=g0||new Hi({"heatmap-radius":new qe($t.paint_heatmap["heatmap-radius"]),"heatmap-weight":new qe($t.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new De($t.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yf($t.paint_heatmap["heatmap-color"]),"heatmap-opacity":new De($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 pc(u,o){if(!u)return u;o||(o=u);var c,p=u;do if(c=!1,p.steiner||!fm(p,p.next)&&Ki(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(R,B,j,X){var H=R;do H.z===0&&(H.z=l_(H.x,H.y,B,j,X)),H.prevZ=H.prev,H.nextZ=H.next,H=H.next;while(H!==R);H.prevZ.nextZ=null,H.prevZ=null,function(tt){var ut,pt,At,Et,Nt,Ft,Jt,ve,Le=1;do{for(pt=tt,tt=null,Nt=null,Ft=0;pt;){for(Ft++,At=pt,Jt=0,ut=0;ut0||ve>0&&At;)Jt!==0&&(ve===0||!At||pt.z<=At.z)?(Et=pt,pt=pt.nextZ,Jt--):(Et=At,At=At.nextZ,ve--),Nt?Nt.nextZ=Et:tt=Et,Et.prevZ=Nt,Nt=Et;pt=At}Nt.nextZ=null,Le*=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?Hw(u,p,m,v):Xw(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=Yw(pc(u),o,c),o,c,p,m,v,2):w===2&&Kw(u,o,c,p,m,v):ap(pc(u),o,c,p,m,v,1);break}}}function Xw(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,k=p.y,R=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>=R&&H.x<=j&&H.y>=B&&H.y<=X&&_h(m,E,v,T,w,k,H.x,H.y)&&Ki(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function Hw(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,k=w.x,R=m.y,B=v.y,j=w.y,X=ET?E>k?E:k:T>k?T:k,ut=R>B?R>j?R:j:B>j?B:j,pt=l_(X,H,o,c,p),At=l_(tt,ut,o,c,p),Et=u.prevZ,Nt=u.nextZ;Et&&Et.z>=pt&&Nt&&Nt.z<=At;){if(Et.x>=X&&Et.x<=tt&&Et.y>=H&&Et.y<=ut&&Et!==m&&Et!==w&&_h(E,R,T,B,k,j,Et.x,Et.y)&&Ki(Et.prev,Et,Et.next)>=0||(Et=Et.prevZ,Nt.x>=X&&Nt.x<=tt&&Nt.y>=H&&Nt.y<=ut&&Nt!==m&&Nt!==w&&_h(E,R,T,B,k,j,Nt.x,Nt.y)&&Ki(Nt.prev,Nt,Nt.next)>=0))return!1;Nt=Nt.nextZ}for(;Et&&Et.z>=pt;){if(Et.x>=X&&Et.x<=tt&&Et.y>=H&&Et.y<=ut&&Et!==m&&Et!==w&&_h(E,R,T,B,k,j,Et.x,Et.y)&&Ki(Et.prev,Et,Et.next)>=0)return!1;Et=Et.prevZ}for(;Nt&&Nt.z<=At;){if(Nt.x>=X&&Nt.x<=tt&&Nt.y>=H&&Nt.y<=ut&&Nt!==m&&Nt!==w&&_h(E,R,T,B,k,j,Nt.x,Nt.y)&&Ki(Nt.prev,Nt,Nt.next)>=0)return!1;Nt=Nt.nextZ}return!0}function Yw(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 pc(p)}function Kw(u,o,c,p,m,v){var w=u;do{for(var E=w.next.next;E!==w.prev;){if(w.i!==E.i&&n2(w,E)){var T=w0(w,E);return w=pc(w,w.next),T=pc(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 Jw(u,o){return u.x-o.x}function Qw(u,o){var c=function(m,v){var w,E=v,T=m.x,k=m.y,R=-1/0;do{if(k<=E.y&&k>=E.next.y&&E.next.y!==E.y){var B=E.x+(k-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(B<=T&&B>R&&(R=B,w=E.x=E.x&&E.x>=H&&T!==E.x&&_h(kw.x||E.x===w.x&&t2(w,E)))&&(w=E,ut=j)),E=E.next;while(E!==X);return w}(u,o);if(!c)return o;var p=w0(c,u);return pc(p,p.next),pc(c,c.next)}function t2(u,o){return Ki(u.prev,u,o.prev)<0&&Ki(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 e2(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 n2(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)&&(Ki(u.prev,u,o.prev)||Ki(u,o.prev,o))||fm(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 fm(u,o){return u.x===o.x&&u.y===o.y}function x0(u,o,c,p){var m=dm(Ki(u,o,c)),v=dm(Ki(u,o,p)),w=dm(Ki(c,p,u)),E=dm(Ki(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 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 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 i2(u,o,c,p,m){I0(u,o,c||0,p||u.length-1,m||r2)}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 R=u[o],B=c,j=p;for(cp(u,c,o),m(u[p],R)>0&&cp(u,c,p);B0;)j--}m(u[c],R)===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 r2(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 wn,this.indexArray=new Or,this.indexArray2=new pr,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new mi,this.segments2=new mi,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:R}of o){const B=this.layers[0]._featureFilter.needGeometry,j=fc(E,B);if(!this.layers[0]._featureFilter.filter(new di(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:R,index:k,geometry:B?j.geometry:hc(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:R}=E;if(this.hasPattern){const B=p_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(B)}else this.addFeature(E,T,k,p,{});c.featureIndex.insert(o[k].feature,T,k,R,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,Ww),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,R=[],B=[];for(const X of w){if(X.length===0)continue;X!==w[0]&&B.push(R.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),R.push(X[0].x),R.push(X[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 h2(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 R(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 d2(this._pbf,o,this.extent,this._keys,this._values)};var g2=M0;function _2(u,o,c){if(u===3){var p=new g2(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}vu.VectorTile=function(u,o){this.layers=u.readFields(_2,{},o)},vu.VectorTileFeature=L0,vu.VectorTileLayer=M0;const y2=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 de,this.centroidVertexArray=new ae,this.indexArray=new Or,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new mi,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=fc(m,T);if(!this.layers[0]._featureFilter.filter(new di(this.zoom),k,p))continue;const R={id:v,sourceLayerIndex:E,index:w,geometry:T?k.geometry:hc(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(p_("fill-extrusion",this.layers,R,this.zoom,c)):this.addFeature(R,R.geometry,w,p,{}),c.featureIndex.insert(m,R.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,c2),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,u2.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||b2(H))continue;let tt=0;for(let ut=0;ut=1){const At=H[ut-1];if(!v2(pt,At)){k.vertexLength+4>mi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Et=pt.sub(At)._perp()._unit(),Nt=At.dist(pt);tt+Nt>32768&&(tt=0),hp(this.layoutVertexArray,pt.x,pt.y,Et.x,Et.y,0,0,tt),hp(this.layoutVertexArray,pt.x,pt.y,Et.x,Et.y,0,1,tt),w.x+=2*pt.x,w.y+=2*pt.y,w.vertexCount+=2,tt+=Nt,hp(this.layoutVertexArray,At.x,At.y,Et.x,Et.y,0,0,tt),hp(this.layoutVertexArray,At.x,At.y,Et.x,Et.y,0,1,tt),w.x+=2*At.x,w.y+=2*At.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>mi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),y2[o.type]!=="Polygon")continue;const R=[],B=[],j=k.vertexLength;for(const H of E)if(H.length!==0){H!==E[0]&&B.push(R.length/2);for(let tt=0;ttrr)||u.y===o.y&&(u.y<0||u.y>rr)}function b2(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;we("FillExtrusionBucket",g_,{omit:["layers","features"]});var x2={get paint(){return k0=k0||new Hi({"fill-extrusion-opacity":new De($t["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qe($t["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new De($t["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new De($t["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new lc($t["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new qe($t["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qe($t["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new De($t["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class w2 extends us{constructor(o){super(o,x2)}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),R=this.paint.get("fill-extrusion-height").evaluate(c,p),B=this.paint.get("fill-extrusion-base").evaluate(c,p),j=function(H,tt,ut,pt){const At=[];for(const Et of H){const Nt=[Et.x,Et.y,0,1];cm(Nt,Nt,tt),At.push(new A(Nt[0]/Nt[3],Nt[1]/Nt[3]))}return At}(k,T),X=function(H,tt,ut,pt){const At=[],Et=[],Nt=pt[8]*tt,Ft=pt[9]*tt,Jt=pt[10]*tt,ve=pt[11]*tt,Le=pt[8]*ut,_e=pt[9]*ut,me=pt[10]*ut,ue=pt[11]*ut;for(const Se of H){const he=[],re=[];for(const ze of Se){const Ae=ze.x,gn=ze.y,gi=pt[0]*Ae+pt[4]*gn+pt[12],bi=pt[1]*Ae+pt[5]*gn+pt[13],gr=pt[2]*Ae+pt[6]*gn+pt[14],hs=pt[3]*Ae+pt[7]*gn+pt[15],Eo=gr+Jt,or=hs+ve,Fr=gi+Le,Xr=bi+_e,Io=gr+me,Co=hs+ue,_r=new A((gi+Nt)/or,(bi+Ft)/or);_r.z=Eo/or,he.push(_r);const yr=new A(Fr/Co,Xr/Co);yr.z=Io/Co,re.push(yr)}At.push(he),Et.push(re)}return[At,Et]}(m,B,R,T);return function(H,tt,ut){let pt=1/0;l0(ut,tt)&&(pt=A0(ut,tt[0]));for(let At=0;Atc.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 Ze,this.layoutVertexArray2=new Pe,this.indexArray=new Or,this.programConfigurations=new Pa(o.layers,o.zoom),this.segments=new mi,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:R}of o){const B=this.layers[0]._featureFilter.needGeometry,j=fc(E,B);if(!this.layers[0]._featureFilter.filter(new di(this.zoom),j,p))continue;const X=v?m.evaluate(j,{},p):void 0,H={id:T,properties:E.properties,type:E.type,sourceLayerIndex:R,index:k,geometry:B?j.geometry:hc(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:R}=E;if(this.hasPattern){const B=p_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(B)}else this.addFeature(E,T,k,p,{});c.featureIndex.insert(o[k].feature,T,k,R,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,C2)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,E2),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"),R=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const B of c)this.addLine(B,o,E,T,k,R);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 k=0;for(;k0;if(ve&&pt>k){const ue=j.dist(X);if(ue>2*R){const Se=j.sub(j.sub(X)._mult(R/ue)._round());this.updateDistance(X,Se),this.addCurrentVertex(Se,tt,0,0,B),X=Se}}const _e=X&&H;let me=_e?p:E?"butt":m;if(_e&&me==="round"&&(Ftv&&(me="bevel"),me==="bevel"&&(Ft>2&&(me="flipbevel"),Ft100)At=ut.mult(-1);else{const ue=Ft*tt.add(ut).mag()/tt.sub(ut).mag();At._perp()._mult(ue*(Le?-1:1))}this.addCurrentVertex(j,At,0,0,B),this.addCurrentVertex(j,At.mult(-1),0,0,B)}else if(me==="bevel"||me==="fakeround"){const ue=-Math.sqrt(Ft*Ft-1),Se=Le?ue:0,he=Le?0:ue;if(X&&this.addCurrentVertex(j,tt,Se,he,B),me==="fakeround"){const re=Math.round(180*Jt/Math.PI/20);for(let ze=1;ze2*R){const Se=j.add(H.sub(j)._mult(R/ue)._round());this.updateDistance(j,Se),this.addCurrentVertex(Se,ut,0,0,B),j=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>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 R=T.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),T.primitiveLength++),w?this.e2=R:this.e1=R}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;we("LineBucket",__,{omit:["layers","patternFeatures"]});var O0={get paint(){return R0=R0||new Hi({"line-opacity":new qe($t.paint_line["line-opacity"]),"line-color":new qe($t.paint_line["line-color"]),"line-translate":new De($t.paint_line["line-translate"]),"line-translate-anchor":new De($t.paint_line["line-translate-anchor"]),"line-width":new qe($t.paint_line["line-width"]),"line-gap-width":new qe($t.paint_line["line-gap-width"]),"line-offset":new qe($t.paint_line["line-offset"]),"line-blur":new qe($t.paint_line["line-blur"]),"line-dasharray":new Hf($t.paint_line["line-dasharray"]),"line-pattern":new lc($t.paint_line["line-pattern"]),"line-gradient":new Yf($t.paint_line["line-gradient"])})},get layout(){return D0=D0||new Hi({"line-cap":new De($t.layout_line["line-cap"]),"line-join":new qe($t.layout_line["line-join"]),"line-miter-limit":new De($t.layout_line["line-miter-limit"]),"line-round-limit":new De($t.layout_line["line-round-limit"]),"line-sort-key":new qe($t.layout_line["line-sort-key"])})}};class M2 extends qe{possiblyEvaluate(o,c){return c=new di(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 P2 extends us{constructor(o){super(o,O0),this.gradientVersion=0,mm||(mm=new M2(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)),R=this.paint.get("line-offset").evaluate(c,p);return R&&(m=function(B,j){const X=[];for(let H=0;H=3){for(let ut=0;ut0?o+2*u:u}const k2=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),A2=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const N2=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),D2=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function R2(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()),Bo.applyArabicShaping&&(m=Bo.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,R=-7,B=c?m-1:0,j=c?-1:1,X=u[o+B];for(B+=j,v=X&(1<<-R)-1,X>>=-R,R+=E;R>0;v=256*v+u[o+B],B+=j,R-=8);for(w=v&(1<<-R)-1,v>>=-R,R+=p;R>0;w=256*w+u[o+B],B+=j,R-=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,R=(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=R):(w=Math.floor(Math.log(o)/Math.LN2),o*(T=Math.pow(2,-w))<1&&(w--,T*=2),(o+=w+B>=1?j/T:j*Math.pow(2,1-B))*T>=2&&(w++,T/=2),w+B>=R?(E=0,w=R):w+B>=1?(E=(o*T-1)*Math.pow(2,m),w+=B):(E=o*Math.pow(2,B-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 O2(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:R>223?3:R>191?2:1;if(w+j>m)break;j===1?R<128&&(B=R):j===2?(192&(E=c[w+1]))==128&&(B=(31&R)<<6|63&E)<=127&&(B=null):j===3?(T=c[w+2],(192&(E=c[w+1]))==128&&(192&T)==128&&((B=(15&R)<<12|(63&E)<<6|63&T)<=2047||B>=55296&&B<=57343)&&(B=null)):j===4&&(T=c[w+2],k=c[w+3],(192&(E=c[w+1]))==128&&(192&T)==128&&(192&k)==128&&((B=(15&R)<<18|(63&E)<<12|(63&T)<<6|63&k)<=65535||B>=1114112)&&(B=null)),B===null?(B=65533,j=1):B>65535&&(B-=65536,v+=String.fromCharCode(B>>>10&1023|55296),B=56320|1023&B),v+=String.fromCharCode(B),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,O2,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,z2,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,V2,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,F2,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,B2,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,U2,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,G2,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,j2,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,q2,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 Z2(u,o,c){u===1&&c.readMessage($2,o)}function $2(u,o,c){if(u===3){const{id:p,bitmap:m,width:v,height:w,left:E,top:T,advance:k}=c.readMessage(W2,{});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 W2(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,R,B,j,X,H,tt){const ut=xh.fromFeature(u,m);let pt;B===a.ai.vertical&&ut.verticalizePunctuation();const{processBidirectionalText:At,processStyledBidirectionalText:Et}=Bo;if(At&&ut.sections.length===1){pt=[];const Jt=At(ut.toString(),w_(ut,k,v,o,p,X,H));for(const ve of Jt){const Le=new xh;Le.text=ve,Le.sections=ut.sections;for(let _e=0;_e0&&zl>Go&&(Go=zl)}else{const Cs=Le[In.fontStack],qo=Cs&&Cs[Hr];if(qo&&qo.rect)ka=qo.rect,Ys=qo.metrics;else{const zl=ve[In.fontStack],bp=zl&&zl[Hr];if(!bp)continue;Ys=bp.metrics}br=(yr-In.scale)*mr}Ks?(Jt.verticalizable=!0,uo.push({glyph:Hr,imageName:Aa,x:gi,y:bi+br,vertical:Ks,scale:In.scale,fontStack:In.fontStack,sectionIndex:co,metrics:Ys,rect:ka}),gi+=Ol*In.scale+ze):(uo.push({glyph:Hr,imageName:Aa,x:gi,y:bi+br,vertical:Ks,scale:In.scale,fontStack:In.fontStack,sectionIndex:co,metrics:Ys,rect:ka}),gi+=Ys.advance*In.scale+ze)}uo.length!==0&&(gr=Math.max(gi-ze,gr),Y2(uo,0,uo.length-1,Eo,Go)),gi=0;const jo=ue*yr+Go;To.lineOffset=Math.max(Go,lo),bi+=jo,hs=Math.max(jo,hs),++or}var Fr;const Xr=bi-dp,{horizontalAlign:Io,verticalAlign:Co}=S_(Se);(function(_r,yr,lo,To,uo,Go,jo,vr,In){const co=(yr-lo)*uo;let Hr=0;Hr=Go!==jo?-vr*To-dp:(-To*In+.5)*jo;for(const br of _r)for(const Ys of br.positionedGlyphs)Ys.x+=co,Ys.y+=Hr})(Jt.positionedLines,Eo,Io,Co,gr,hs,ue,Xr,me.length),Jt.top+=-Co*Xr,Jt.bottom=Jt.top+Xr,Jt.left+=-Io*gr,Jt.right=Jt.left+gr}(Ft,o,c,p,pt,w,E,T,B,k,j,tt),!function(Jt){for(const ve of Jt)if(ve.positionedGlyphs.length!==0)return!1;return!0}(Nt)&&Ft}const ym={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},X2={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 R=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),R=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,B=v.get("symbol-sort-key");if(this.features=[],!k&&!R)return;const j=c.iconDependencies,X=c.glyphDependencies,H=c.availableImages,tt=new di(this.zoom);for(const{feature:ut,id:pt,index:At,sourceLayerIndex:Et}of o){const Nt=m._featureFilter.needGeometry,Ft=fc(ut,Nt);if(!m._featureFilter.filter(tt,Ft,p))continue;let Jt,ve;if(Nt||(Ft.geometry=hc(ut)),k){const _e=m.getValueAndResolveTokens("text-field",Ft,p,H),me=Zr.factory(_e);tS(me)&&(this.hasRTLText=!0),(!this.hasRTLText||Wf()==="unavailable"||this.hasRTLText&&Bo.isParsed())&&(Jt=R2(me,m,Ft))}if(R){const _e=m.getValueAndResolveTokens("icon-image",Ft,p,H);ve=_e instanceof Rr?_e:Rr.fromString(_e)}if(!Jt&&!ve)continue;const Le=this.sortFeaturesByKey?B.evaluate(Ft,{},p):void 0;if(this.features.push({id:pt,text:Jt,icon:ve,index:At,sourceLayerIndex:Et,geometry:Ft.geometry,properties:ut.properties,type:J2[ut.type],sortKey:Le}),ve&&(j[ve.name]=!0),Jt){const _e=w.evaluate(Ft,{},p).join(","),me=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ai.vertical)>=0;for(const ue of Jt.sections)if(ue.image)j[ue.image.name]=!0;else{const Se=Bf(Jt.toString()),he=ue.fontStack||_e,re=X[he]=X[he]||{};this.calculateGlyphDependencies(ue.text,re,me,this.allowVerticalPlacement,Se)}}}v.get("symbol-placement")==="line"&&(this.features=function(ut){const pt={},At={},Et=[];let Nt=0;function Ft(_e){Et.push(ut[_e]),Nt++}function Jt(_e,me,ue){const Se=At[_e];return delete At[_e],At[me]=Se,Et[Se].geometry[0].pop(),Et[Se].geometry[0]=Et[Se].geometry[0].concat(ue[0]),Se}function ve(_e,me,ue){const Se=pt[me];return delete pt[me],pt[_e]=Se,Et[Se].geometry[0].shift(),Et[Se].geometry[0]=ue[0].concat(Et[Se].geometry[0]),Se}function Le(_e,me,ue){const Se=ue?me[0][me[0].length-1]:me[0][0];return`${_e}:${Se.x}:${Se.y}`}for(let _e=0;_e_e.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 ev,nv;we("SymbolBucket",wh,{omit:["layers","collisionBoxArray","features","compareText"]}),wh.MAX_GLYPHS=65535,wh.addDynamicAttributes=I_;var L_={get paint(){return nv=nv||new Hi({"icon-opacity":new qe($t.paint_symbol["icon-opacity"]),"icon-color":new qe($t.paint_symbol["icon-color"]),"icon-halo-color":new qe($t.paint_symbol["icon-halo-color"]),"icon-halo-width":new qe($t.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qe($t.paint_symbol["icon-halo-blur"]),"icon-translate":new De($t.paint_symbol["icon-translate"]),"icon-translate-anchor":new De($t.paint_symbol["icon-translate-anchor"]),"text-opacity":new qe($t.paint_symbol["text-opacity"]),"text-color":new qe($t.paint_symbol["text-color"],{runtimeType:Nr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new qe($t.paint_symbol["text-halo-color"]),"text-halo-width":new qe($t.paint_symbol["text-halo-width"]),"text-halo-blur":new qe($t.paint_symbol["text-halo-blur"]),"text-translate":new De($t.paint_symbol["text-translate"]),"text-translate-anchor":new De($t.paint_symbol["text-translate-anchor"])})},get layout(){return ev=ev||new Hi({"symbol-placement":new De($t.layout_symbol["symbol-placement"]),"symbol-spacing":new De($t.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new De($t.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new qe($t.layout_symbol["symbol-sort-key"]),"symbol-z-order":new De($t.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new De($t.layout_symbol["icon-allow-overlap"]),"icon-overlap":new De($t.layout_symbol["icon-overlap"]),"icon-ignore-placement":new De($t.layout_symbol["icon-ignore-placement"]),"icon-optional":new De($t.layout_symbol["icon-optional"]),"icon-rotation-alignment":new De($t.layout_symbol["icon-rotation-alignment"]),"icon-size":new qe($t.layout_symbol["icon-size"]),"icon-text-fit":new De($t.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new De($t.layout_symbol["icon-text-fit-padding"]),"icon-image":new qe($t.layout_symbol["icon-image"]),"icon-rotate":new qe($t.layout_symbol["icon-rotate"]),"icon-padding":new qe($t.layout_symbol["icon-padding"]),"icon-keep-upright":new De($t.layout_symbol["icon-keep-upright"]),"icon-offset":new qe($t.layout_symbol["icon-offset"]),"icon-anchor":new qe($t.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new De($t.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new De($t.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new De($t.layout_symbol["text-rotation-alignment"]),"text-field":new qe($t.layout_symbol["text-field"]),"text-font":new qe($t.layout_symbol["text-font"]),"text-size":new qe($t.layout_symbol["text-size"]),"text-max-width":new qe($t.layout_symbol["text-max-width"]),"text-line-height":new De($t.layout_symbol["text-line-height"]),"text-letter-spacing":new qe($t.layout_symbol["text-letter-spacing"]),"text-justify":new qe($t.layout_symbol["text-justify"]),"text-radial-offset":new qe($t.layout_symbol["text-radial-offset"]),"text-variable-anchor":new De($t.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new qe($t.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new qe($t.layout_symbol["text-anchor"]),"text-max-angle":new De($t.layout_symbol["text-max-angle"]),"text-writing-mode":new De($t.layout_symbol["text-writing-mode"]),"text-rotate":new qe($t.layout_symbol["text-rotate"]),"text-padding":new De($t.layout_symbol["text-padding"]),"text-keep-upright":new De($t.layout_symbol["text-keep-upright"]),"text-transform":new qe($t.layout_symbol["text-transform"]),"text-offset":new qe($t.layout_symbol["text-offset"]),"text-allow-overlap":new De($t.layout_symbol["text-allow-overlap"]),"text-overlap":new De($t.layout_symbol["text-overlap"]),"text-ignore-placement":new De($t.layout_symbol["text-ignore-placement"]),"text-optional":new De($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}}we("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,R)=>E&&R in E?String(E[R]):"")}(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 eS={get paint(){return rv=rv||new Hi({"background-color":new De($t.paint_background["background-color"]),"background-pattern":new Hf($t.paint_background["background-pattern"]),"background-opacity":new De($t.paint_background["background-opacity"])})}};class nS extends us{constructor(o){super(o,eS)}}let ov;var iS={get paint(){return ov=ov||new Hi({"raster-opacity":new De($t.paint_raster["raster-opacity"]),"raster-hue-rotate":new De($t.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new De($t.paint_raster["raster-brightness-min"]),"raster-brightness-max":new De($t.paint_raster["raster-brightness-max"]),"raster-saturation":new De($t.paint_raster["raster-saturation"]),"raster-contrast":new De($t.paint_raster["raster-contrast"]),"raster-resampling":new De($t.paint_raster["raster-resampling"]),"raster-fade-duration":new De($t.paint_raster["raster-fade-duration"])})}};class rS extends us{constructor(o){super(o,iS)}}class oS 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 sS{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(ft(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 R=function(B,j,X){let H,tt="";for(let ut=B;ut>0;ut--)H=1<1?"@2x":"").replace(/{quadkey}/g,R).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=B),B=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 R=w;R=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&&B[3]>=0&&T.insert(E,B[0],B[1],B[2],B[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,R=vv(T),B=this.grid.query(R.minX-k,R.minY-k,R.maxX+k,R.maxY+k),j=vv(o.cameraQueryGeometry),X=this.grid3D.query(j.minX-k,j.minY-k,j.maxX+k,j.maxY+k,(ut,pt,At,Et)=>function(Nt,Ft,Jt,ve,Le){for(const me of Nt)if(Ft<=me.x&&Jt<=me.y&&ve>=me.x&&Le>=me.y)return!0;const _e=[new A(Ft,Jt),new A(Ft,Le),new A(ve,Le),new A(ve,Jt)];if(Nt.length>2){for(const me of _e)if(mh(Nt,me))return!0}for(let me=0;me(Et||(Et=hc(Nt)),Ft.queryIntersectsFeature(T,Nt,Jt,Et,this.z,o.transform,w,o.pixelPosMatrix)))}return H}loadMatchingFeature(o,c,p,m,v,w,E,T,k,R,B){const j=this.bucketLayerIDs[c];if(w&&!function(ut,pt){for(let At=0;At=0)return!0;return!1}(w,j))return;const X=this.sourceLayerCoder.decode(p),H=this.vtLayers[X].feature(m);if(v.needGeometry){const ut=fc(H,!0);if(!v.filter(new di(this.tileID.overscaledZ),ut,this.tileID.canonical))return}else if(!v.filter(new di(this.tileID.overscaledZ),H))return;const tt=this.getId(H,X);for(let ut=0;ut{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 aS(u,o){return o-u}function bv(u,o,c,p,m){const v=[];for(let w=0;w=p&&B.x>=p||(R.x>=p?R=new A(p,R.y+(p-R.x)/(B.x-R.x)*(B.y-R.y))._round():B.x>=p&&(B=new A(p,R.y+(p-R.x)/(B.x-R.x)*(B.y-R.y))._round()),R.y>=m&&B.y>=m||(R.y>=m?R=new A(R.x+(m-R.y)/(B.y-R.y)*(B.x-R.x),m)._round():B.y>=m&&(B=new A(R.x+(m-R.y)/(B.y-R.y)*(B.x-R.x),m)._round()),T&&R.equals(T[T.length-1])||(T=[R],v.push(T)),T.push(B)))))}}return v}we("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+=R.dist(B)}return!0}function wv(u){let o=0;for(let c=0;ck){const H=(k-T)/X,tt=Oo.number(B.x,j.x,H),ut=Oo.number(B.y,j.y,H),pt=new Su(tt,ut,j.angleTo(B),R);return pt._round(),!w||xv(u,pt,E,w,o)?pt:void 0}T+=X}}function uS(u,o,c,p,m,v,w,E,T){const k=Sv(p,v,w),R=Ev(p,m),B=R*w,j=u[0].x===0||u[0].x===T||u[0].y===0||u[0].y===T;return o-B=0&&Nt=0&&Ft=0&&j+k<=R){const Jt=new Su(Nt,Ft,At,H);Jt._round(),p&&!xv(u,Jt,v,p,m)||X.push(Jt)}}B+=pt}return E||X.length||w||(X=Iv(u,B/2,c,p,m,v,w,!0,T)),X}we("Anchor",Su);const Sh=Uo;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,R=u.bottom-u.top,B=v.stretchX||[[0,E]],j=v.stretchY||[[0,T]],X=(ue,Se)=>ue+Se[1]-Se[0],H=B.reduce(X,0),tt=j.reduce(X,0),ut=E-H,pt=T-tt;let At=0,Et=H,Nt=0,Ft=tt,Jt=0,ve=ut,Le=0,_e=pt;if(v.content&&p){const ue=v.content;At=wm(B,0,ue[0]),Nt=wm(j,0,ue[1]),Et=wm(B,ue[0],ue[2]),Ft=wm(j,ue[1],ue[3]),Jt=ue[0]-At,Le=ue[1]-Nt,ve=ue[2]-ue[0]-Et,_e=ue[3]-ue[1]-Ft}const me=(ue,Se,he,re)=>{const ze=Sm(ue.stretch-At,Et,k,u.left),Ae=Em(ue.fixed-Jt,ve,ue.stretch,H),gn=Sm(Se.stretch-Nt,Ft,R,u.top),gi=Em(Se.fixed-Le,_e,Se.stretch,tt),bi=Sm(he.stretch-At,Et,k,u.left),gr=Em(he.fixed-Jt,ve,he.stretch,H),hs=Sm(re.stretch-Nt,Ft,R,u.top),Eo=Em(re.fixed-Le,_e,re.stretch,tt),or=new A(ze,gn),Fr=new A(bi,gn),Xr=new A(bi,hs),Io=new A(ze,hs),Co=new A(Ae/w,gi/w),_r=new A(gr/w,Eo/w),yr=o*Math.PI/180;if(yr){const uo=Math.sin(yr),Go=Math.cos(yr),jo=[Go,-uo,uo,Go];or._matMult(jo),Fr._matMult(jo),Io._matMult(jo),Xr._matMult(jo)}const lo=ue.stretch+ue.fixed,To=Se.stretch+Se.fixed;return{tl:or,tr:Fr,bl:Io,br:Xr,tex:{x:v.paddedRect.x+Sh+lo,y:v.paddedRect.y+Sh+To,w:he.stretch+he.fixed-lo,h:re.stretch+re.fixed-To},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Co,pixelOffsetBR:_r,minFontScaleX:ve/w/k,minFontScaleY:_e/w/R,isSDF:c}};if(p&&(v.stretchX||v.stretchY)){const ue=Tv(B,ut,H),Se=Tv(j,pt,tt);for(let he=0;he0&&(H=Math.max(10,H),this.circleDiameter=H)}else{let B=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,B-=tt[1]*E,H+=tt[2]*E,j+=tt[3]*E),R){const ut=new A(X,B),pt=new A(H,B),At=new A(X,j),Et=new A(H,j),Nt=R*Math.PI/180;ut._rotate(Nt),pt._rotate(Nt),At._rotate(Nt),Et._rotate(Nt),X=Math.min(ut.x,pt.x,At.x,Et.x),H=Math.max(ut.x,pt.x,At.x,Et.x),B=Math.min(ut.y,pt.y,At.y,Et.y),j=Math.max(ut.y,pt.y,At.y,Et.y)}o.emplaceBack(c.x,c.y,X,B,H,j,p,m,v)}this.boxEndIndex=o.length}}class cS{constructor(o=[],c=hS){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 hS(u,o){return uo?1:0}function fS(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 R=new cS([],pS);if(T===0)return new A(p,m);for(let X=p;XB.d||!B.d)&&(B=X,c&&console.log("found best %d after %d probes",Math.round(1e4*X.d)/1e4,j)),X.max-B.d<=o||(k=X.h/2,R.push(new Eh(X.p.x-k,X.p.y-k,k,u)),R.push(new Eh(X.p.x+k,X.p.y-k,k,u)),R.push(new Eh(X.p.x-k,X.p.y+k,k,u)),R.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: ${B.d}`)),B.p}function pS(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);R.startsWith("top")?B[1]-=Eu:R.startsWith("bottom")&&(B[1]+=Eu),T[k+1]=B}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 dS(u,o,c,p,m,v,w,E,T,k,R){let B=v.textMaxSize.evaluate(o,{});B===void 0&&(B=w);const j=u.layers[0].layout,X=j.get("icon-offset").evaluate(o,{},R),H=kv(c.horizontal),tt=w/24,ut=u.tilePixelRatio*tt,pt=u.tilePixelRatio*B/24,At=u.tilePixelRatio*E,Et=u.tilePixelRatio*j.get("symbol-spacing"),Nt=j.get("text-padding")*u.tilePixelRatio,Ft=function(re,ze,Ae,gn=1){const gi=re.get("icon-padding").evaluate(ze,{},Ae),bi=gi&&gi.values;return[bi[0]*gn,bi[1]*gn,bi[2]*gn,bi[3]*gn]}(j,o,R,u.tilePixelRatio),Jt=j.get("text-max-angle")/180*Math.PI,ve=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",Le=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",_e=j.get("symbol-placement"),me=Et/2,ue=j.get("icon-text-fit");let Se;p&&ue!=="none"&&(u.allowVerticalPlacement&&c.vertical&&(Se=Q0(p,c.vertical,ue,j.get("icon-text-fit-padding"),X,tt)),H&&(p=Q0(p,H,ue,j.get("icon-text-fit-padding"),X,tt)));const he=(re,ze)=>{ze.x<0||ze.x>=rr||ze.y<0||ze.y>=rr||function(Ae,gn,gi,bi,gr,hs,Eo,or,Fr,Xr,Io,Co,_r,yr,lo,To,uo,Go,jo,vr,In,co,Hr,br,Ys){const ka=Ae.addToLineVertexArray(gn,gi);let Aa,Ol,Ks,Cs,qo=0,zl=0,bp=0,Rv=0,U_=-1,G_=-1;const Fl={};let Ov=Al("");if(Ae.allowVerticalPlacement&&bi.vertical){const ho=or.layout.get("text-rotate").evaluate(In,{},br)+90;Ks=new Im(Fr,gn,Xr,Io,Co,bi.vertical,_r,yr,lo,ho),Eo&&(Cs=new Im(Fr,gn,Xr,Io,Co,Eo,uo,Go,lo,ho))}if(gr){const ho=or.layout.get("icon-rotate").evaluate(In,{}),Ts=or.layout.get("icon-text-fit")!=="none",dc=Cv(gr,ho,Hr,Ts),Da=Eo?Cv(Eo,ho,Hr,Ts):void 0;Ol=new Im(Fr,gn,Xr,Io,Co,gr,uo,Go,!1,ho),qo=4*dc.length;const mc=Ae.iconSizeData;let rl=null;mc.kind==="source"?(rl=[il*or.layout.get("icon-size").evaluate(In,{})],rl[0]>xu&&kt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${gp}. Reduce your "icon-size".`)):mc.kind==="composite"&&(rl=[il*co.compositeIconSizes[0].evaluate(In,{},br),il*co.compositeIconSizes[1].evaluate(In,{},br)],(rl[0]>xu||rl[1]>xu)&&kt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${gp}. Reduce your "icon-size".`)),Ae.addSymbols(Ae.icon,dc,rl,vr,jo,In,a.ai.none,gn,ka.lineStartIndex,ka.lineLength,-1,br),U_=Ae.icon.placedSymbolArray.length-1,Da&&(zl=4*Da.length,Ae.addSymbols(Ae.icon,Da,rl,vr,jo,In,a.ai.vertical,gn,ka.lineStartIndex,ka.lineLength,-1,br),G_=Ae.icon.placedSymbolArray.length-1)}const zv=Object.keys(bi.horizontal);for(const ho of zv){const Ts=bi.horizontal[ho];if(!Aa){Ov=Al(Ts.text);const Da=or.layout.get("text-rotate").evaluate(In,{},br);Aa=new Im(Fr,gn,Xr,Io,Co,Ts,_r,yr,lo,Da)}const dc=Ts.positionedLines.length===1;if(bp+=Pv(Ae,gn,Ts,hs,or,lo,In,To,ka,bi.vertical?a.ai.horizontal:a.ai.horizontalOnly,dc?zv:[ho],Fl,U_,co,br),dc)break}bi.vertical&&(Rv+=Pv(Ae,gn,bi.vertical,hs,or,lo,In,To,ka,a.ai.vertical,["vertical"],Fl,G_,co,br));const _S=Aa?Aa.boxStartIndex:Ae.collisionBoxArray.length,yS=Aa?Aa.boxEndIndex:Ae.collisionBoxArray.length,vS=Ks?Ks.boxStartIndex:Ae.collisionBoxArray.length,bS=Ks?Ks.boxEndIndex:Ae.collisionBoxArray.length,xS=Ol?Ol.boxStartIndex:Ae.collisionBoxArray.length,wS=Ol?Ol.boxEndIndex:Ae.collisionBoxArray.length,SS=Cs?Cs.boxStartIndex:Ae.collisionBoxArray.length,ES=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&&kt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),In.sortKey!==void 0&&Ae.addToSortKeyRanges(Ae.symbolInstances.length,In.sortKey);const IS=Mv(or,In,br),[CS,TS]=function(ho,Ts){const dc=ho.length,Da=Ts==null?void 0:Ts.values;if((Da==null?void 0:Da.length)>0)for(let mc=0;mc=0?Fl.right:-1,Fl.center>=0?Fl.center:-1,Fl.left>=0?Fl.left:-1,Fl.vertical||-1,U_,G_,Ov,_S,yS,vS,bS,xS,wS,SS,ES,Xr,bp,Rv,qo,zl,Fv,0,_r,Na,CS,TS)}(u,ze,re,c,p,m,Se,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ut,[Nt,Nt,Nt,Nt],ve,T,At,Ft,Le,X,o,v,k,R,w)};if(_e==="line")for(const re of bv(o.geometry,0,0,rr,rr)){const ze=uS(re,Et,Jt,c.vertical||H,p,24,pt,u.overscaling,rr);for(const Ae of ze)H&&mS(u,H.text,me,Ae)||he(re,Ae)}else if(_e==="line-center"){for(const re of o.geometry)if(re.length>1){const ze=lS(re,Jt,c.vertical||H,p,24,pt);ze&&he(re,ze)}}else if(o.type==="Polygon")for(const re of h_(o.geometry,0)){const ze=fS(re,16);he(re[0],new Su(ze.x,ze.y,0))}else if(o.type==="LineString")for(const re of o.geometry)he(re,new Su(re[0].x,re[0].y,0));else if(o.type==="Point")for(const re of o.geometry)for(const ze of re)he([ze],new Su(ze.x,ze.y,0))}function Pv(u,o,c,p,m,v,w,E,T,k,R,B,j,X,H){const tt=function(At,Et,Nt,Ft,Jt,ve,Le,_e){const me=Ft.layout.get("text-rotate").evaluate(ve,{})*Math.PI/180,ue=[];for(const Se of Et.positionedLines)for(const he of Se.positionedGlyphs){if(!he.rect)continue;const re=he.rect||{};let ze=$0+1,Ae=!0,gn=1,gi=0;const bi=(Jt||_e)&&he.vertical,gr=he.metrics.advance*he.scale/2;if(_e&&Et.verticalizable&&(gi=Se.lineOffset/2-(he.imageName?-(mr-he.metrics.width*he.scale)/2:(he.scale-1)*mr)),he.imageName){const vr=Le[he.imageName];Ae=vr.sdf,gn=vr.pixelRatio,ze=Uo/gn}const hs=Jt?[he.x+gr,he.y]:[0,0];let Eo=Jt?[0,0]:[he.x+gr+Nt[0],he.y+Nt[1]-gi],or=[0,0];bi&&(or=Eo,Eo=[0,0]);const Fr=he.metrics.isDoubleResolution?2:1,Xr=(he.metrics.left-ze)*he.scale-gr+Eo[0],Io=(-he.metrics.top-ze)*he.scale+Eo[1],Co=Xr+re.w/Fr*he.scale/gn,_r=Io+re.h/Fr*he.scale/gn,yr=new A(Xr,Io),lo=new A(Co,Io),To=new A(Xr,_r),uo=new A(Co,_r);if(bi){const vr=new A(-gr,gr-dp),In=-Math.PI/2,co=mr/2-gr,Hr=new A(5-dp-co,-(he.imageName?co:0)),br=new A(...or);yr._rotateAround(In,vr)._add(Hr)._add(br),lo._rotateAround(In,vr)._add(Hr)._add(br),To._rotateAround(In,vr)._add(Hr)._add(br),uo._rotateAround(In,vr)._add(Hr)._add(br)}if(me){const vr=Math.sin(me),In=Math.cos(me),co=[In,-vr,vr,In];yr._matMult(co),lo._matMult(co),To._matMult(co),uo._matMult(co)}const Go=new A(0,0),jo=new A(0,0);ue.push({tl:yr,tr:lo,bl:To,br:uo,tex:re,writingMode:Et.writingMode,glyphOffset:hs,sectionIndex:he.sectionIndex,isSDF:Ae,pixelOffsetTL:Go,pixelOffsetBR:jo,minFontScaleX:0,minFontScaleY:0})}return ue}(0,c,E,m,v,w,p,u.allowVerticalPlacement),ut=u.textSizeData;let pt=null;ut.kind==="source"?(pt=[il*m.layout.get("text-size").evaluate(w,{})],pt[0]>xu&&kt(`${u.layerIds[0]}: Value for "text-size" is >= ${gp}. Reduce your "text-size".`)):ut.kind==="composite"&&(pt=[il*X.compositeTextSizes[0].evaluate(w,{},H),il*X.compositeTextSizes[1].evaluate(w,{},H)],(pt[0]>xu||pt[1]>xu)&&kt(`${u.layerIds[0]}: Value for "text-size" is >= ${gp}. Reduce your "text-size".`)),u.addSymbols(u.text,tt,pt,E,v,w,k,o,T.lineStartIndex,T.lineLength,j,H);for(const At of R)B[At]=u.text.placedSymbolArray.length-1;return 4*tt.length}function kv(u){for(const o in u)return u[o];return null}function mS(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 R=T.pop()||0,B=T.pop()||0,j=T.pop()||0;if(B-j<=E){for(let ut=j;ut<=B;ut++){const pt=w[2*ut],At=w[2*ut+1];pt>=o&&pt<=p&&At>=c&&At<=m&&k.push(v[ut])}continue}const X=j+B>>1,H=w[2*X],tt=w[2*X+1];H>=o&&H<=p&&tt>=c&&tt<=m&&k.push(v[X]),(R===0?o<=H:c<=tt)&&(T.push(j),T.push(X-1),T.push(1-R)),(R===0?p>=H:m>=tt)&&(T.push(X+1),T.push(B),T.push(1-R))}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 R=E.pop()||0,B=E.pop()||0,j=E.pop()||0;if(B-j<=w){for(let ut=j;ut<=B;ut++)Dv(v[2*ut],v[2*ut+1],o,c)<=k&&T.push(m[ut]);continue}const X=j+B>>1,H=v[2*X],tt=v[2*X+1];Dv(H,tt,o,c)<=k&&T.push(m[X]),(R===0?o-p<=H:c-p<=tt)&&(E.push(j),E.push(X-1),E.push(1-R)),(R===0?o+p>=H:c+p>=tt)&&(E.push(X+1),E.push(B),E.push(1-R))}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,R=c-p+1,B=Math.log(k),j=.5*Math.exp(2*B/3),X=.5*Math.sqrt(B*j*(k-j)/k)*(R-k/2<0?-1:1);Nv(u,o,c,Math.max(p,Math.floor(c-R*j/k+X)),Math.min(m,Math.floor(c+(k-R)*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",gS={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,R,B,j,X,H,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],k=o[6],R=o[7],B=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]=R,u[8]=B,u[9]=j,u[10]=X,u[11]=H,u[12]=p*tt+E*ut+B*pt+o[12],u[13]=m*tt+T*ut+j*pt+o[13],u[14]=v*tt+k*ut+X*pt+o[14],u[15]=w*tt+R*ut+H*pt+o[15]),u},a.A=gh,a.B=Oo,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 ne()||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 sS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ne()?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=De,a.E=Xi,a.F=function(u,o){const c={};for(let p=0;p{}}},a.Y=le,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=bn,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 lt++},a.a3=at,a.a4=wh,a.a5=function(){Bo.isLoading()||Bo.isLoaded()||Wf()!=="deferred"||tm()},a.a6=Of,a.a7=fc,a.a8=di,a.a9=gv,a.aA=sc,a.aB=function(u){u=u.slice();const o=Object.create(null);for(let c=0;c{p[w.source]?c.push({command:Tn.removeLayer,args:[w.id]}):v.push(w)}),c=c.concat(m),function(w,E,T){E=E||[];const k=(w=w||[]).map(js),R=E.map(js),B=w.reduce(Sa,{}),j=E.reduce(Sa,{}),X=k.slice(),H=Object.create(null);let tt,ut,pt,At,Et,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(Ie==null){const o=u.navigator?u.navigator.userAgent:null;Ie=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Ie},a.ad=mt,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],R=o[5],B=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+R*p,u[2]=E*m+B*p,u[3]=T*m+j*p,u[4]=k*m-v*p,u[5]=R*m-w*p,u[6]=B*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?mt(zo.interpolationFactor(m,o,v,w),0,1):0;u.kind==="camera"?p=Oo.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"?Oo.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],R=o[8],B=o[9],j=o[10],X=o[11],H=o[12],tt=o[13],ut=o[14],pt=o[15],At=c*E-p*w,Et=c*T-m*w,Nt=c*k-v*w,Ft=p*T-m*E,Jt=p*k-v*E,ve=m*k-v*T,Le=R*tt-B*H,_e=R*ut-j*H,me=R*pt-X*H,ue=B*ut-j*tt,Se=B*pt-X*tt,he=j*pt-X*ut,re=At*he-Et*Se+Nt*ue+Ft*me-Jt*_e+ve*Le;return re?(u[0]=(E*he-T*Se+k*ue)*(re=1/re),u[1]=(m*Se-p*he-v*ue)*re,u[2]=(tt*ve-ut*Jt+pt*Ft)*re,u[3]=(j*Jt-B*ve-X*Ft)*re,u[4]=(T*me-w*he-k*_e)*re,u[5]=(c*he-m*me+v*_e)*re,u[6]=(ut*Nt-H*ve-pt*Et)*re,u[7]=(R*ve-j*Nt+X*Et)*re,u[8]=(w*Se-E*me+k*Le)*re,u[9]=(p*me-c*Se-v*Le)*re,u[10]=(H*Jt-tt*Nt+pt*At)*re,u[11]=(B*Nt-R*Jt-X*At)*re,u[12]=(E*_e-w*ue-T*Le)*re,u[13]=(c*ue-p*_e+m*Le)*re,u[14]=(tt*Et-H*Ft-ut*At)*re,u[15]=(R*Ft-B*Et+j*At)*re,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=Tn,a.ay=Yd,a.az=pn,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=Or,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],R=u[8],B=u[9],j=u[10],X=u[11],H=u[12],tt=u[13],ut=u[14],pt=u[15],At=o[0],Et=o[1],Nt=o[2],Ft=o[3],Jt=o[4],ve=o[5],Le=o[6],_e=o[7],me=o[8],ue=o[9],Se=o[10],he=o[11],re=o[12],ze=o[13],Ae=o[14],gn=o[15];return Math.abs(c-At)<=So*Math.max(1,Math.abs(c),Math.abs(At))&&Math.abs(p-Et)<=So*Math.max(1,Math.abs(p),Math.abs(Et))&&Math.abs(m-Nt)<=So*Math.max(1,Math.abs(m),Math.abs(Nt))&&Math.abs(v-Ft)<=So*Math.max(1,Math.abs(v),Math.abs(Ft))&&Math.abs(w-Jt)<=So*Math.max(1,Math.abs(w),Math.abs(Jt))&&Math.abs(E-ve)<=So*Math.max(1,Math.abs(E),Math.abs(ve))&&Math.abs(T-Le)<=So*Math.max(1,Math.abs(T),Math.abs(Le))&&Math.abs(k-_e)<=So*Math.max(1,Math.abs(k),Math.abs(_e))&&Math.abs(R-me)<=So*Math.max(1,Math.abs(R),Math.abs(me))&&Math.abs(B-ue)<=So*Math.max(1,Math.abs(B),Math.abs(ue))&&Math.abs(j-Se)<=So*Math.max(1,Math.abs(j),Math.abs(Se))&&Math.abs(X-he)<=So*Math.max(1,Math.abs(X),Math.abs(he))&&Math.abs(H-re)<=So*Math.max(1,Math.abs(H),Math.abs(re))&&Math.abs(tt-ze)<=So*Math.max(1,Math.abs(tt),Math.abs(ze))&&Math.abs(ut-Ae)<=So*Math.max(1,Math.abs(ut),Math.abs(Ae))&&Math.abs(pt-gn)<=So*Math.max(1,Math.abs(pt),Math.abs(gn))},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=ft,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],R=o[9],B=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+R*p,u[6]=E*m+B*p,u[7]=T*m+j*p,u[8]=k*m-v*p,u[9]=R*m-w*p,u[10]=B*m-E*p,u[11]=j*m-T*p,u},a.bA=S,a.bB=B0,a.bC=ih,a.bD=Bo,a.ba=K,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 cc{},a.be=M_,a.bf=hv,a.bg=gS,a.bi=je,a.bj=function(u,o,c=!1){if(xo===Gf||xo===jf||xo===qf)throw new Error("setRTLTextPlugin cannot be called multiple times.");el=xn.resolveURL(u),xo=Gf,Zf=o,$f(),c||tm()},a.bk=Wf,a.bl=function(u,o){const c={};for(let m=0;mre*mr)}let _e=w?"center":c.get("text-justify").evaluate(k,{},u.canonical);const me=c.get("symbol-placement"),ue=me==="point"?c.get("text-max-width").evaluate(k,{},u.canonical)*mr:0,Se=()=>{u.bucket.allowVerticalPlacement&&Bf(Nt)&&(H.vertical=_m(tt,u.glyphMap,u.glyphPositions,u.imagePositions,R,ue,v,ve,"left",Jt,pt,a.ai.vertical,!0,me,j,B))};if(!w&&Le){const he=new Set;if(_e==="auto")for(let ze=0;ze{o(null,c),URL.revokeObjectURL(c.src),c.onload=null,window.requestAnimationFrame(()=>{c.src=Zn})},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):Zn},a.e=gt,a.f=function(u,o){return Ai(gt(u,{type:"json"}),o)},a.g=Bn,a.h=xn,a.i=ne,a.j=mn,a.k=un,a.l=Lt,a.m=Ai,a.n=function(u){return new v_(u).readFields(Z2,[])},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=Hi,a.s=ke,a.t=Hg,a.u=ye,a.v=$t,a.w=kt,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 $ of G){this._layerConfigs[$.id]=$;const ot=this._layers[$.id]=a.aC($);ot._featureFilter=a.a6(ot.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of q)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const J=a.bl(Object.values(this._layerConfigs),this.keyCache);for(const $ of J){const ot=$.map(Ht=>this._layers[Ht.id]),Mt=ot[0];if(Mt.visibility==="none")continue;const xt=Mt.source||"";let rt=this.familiesBySource[xt];rt||(rt=this.familiesBySource[xt]={});const Ct=Mt.sourceLayer||"_geojsonTileLayer";let Xt=rt[Ct];Xt||(Xt=rt[Ct]=[]),Xt.push(ot)}}}class x{constructor(G){const q={},J=[];for(const xt in G){const rt=G[xt],Ct=q[xt]={};for(const Xt in rt){const Ht=rt[+Xt];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),Ct[Xt]={rect:Kt,metrics:Ht.metrics}}}const{w:$,h:ot}=a.p(J),Mt=new a.q({width:$||1,height:ot||1});for(const xt in G){const rt=G[xt];for(const Ct in rt){const Xt=rt[+Ct];if(!Xt||Xt.bitmap.width===0||Xt.bitmap.height===0)continue;const Ht=q[xt][Ct].rect;a.q.copy(Xt.bitmap,Mt,{x:0,y:0},{x:Ht.x+1,y:Ht.y+1},Xt.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,$,ot){this.status="parsing",this.data=G,this.collisionBoxArray=new a.a3;const Mt=new a.bn(Object.keys(G.layers).sort()),xt=new a.bo(this.tileID,this.promoteId);xt.bucketLayerIDs=[];const rt={},Ct={featureIndex:xt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Xt=q.familiesBySource[this.source];for(const Nn in Xt){const An=G.layers[Nn];if(!An)continue;An.version===1&&a.w(`Vector tile source "${this.source}" layer "${Nn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qr=Mt.encode(Nn),si=[];for(let ir=0;ir=Dr.maxzoom||Dr.visibility!=="none"&&(L(ir,this.zoom,J),(rt[Dr.id]=Dr.createBucket({index:xt.bucketLayerIDs.length,layers:ir,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qr,sourceID:this.source})).populate(si,Ct,this.tileID.canonical),xt.bucketLayerIDs.push(ir.map(rs=>rs.id)))}}let Ht,Kt,Ne,Ye;const Ce=a.aH(Ct.glyphDependencies,Nn=>Object.keys(Nn).map(Number));this.inFlightDependencies.forEach(Nn=>Nn==null?void 0:Nn.cancel()),this.inFlightDependencies=[];const Fe=++this.dependencySentinel;Object.keys(Ce).length?this.inFlightDependencies.push($.send("getGlyphs",{uid:this.uid,stacks:Ce,source:this.source,tileID:this.tileID,type:"glyphs"},(Nn,An)=>{Fe===this.dependencySentinel&&(Ht||(Ht=Nn,Kt=An,Jn.call(this)))})):Kt={};const on=Object.keys(Ct.iconDependencies);on.length?this.inFlightDependencies.push($.send("getImages",{icons:on,source:this.source,tileID:this.tileID,type:"icons"},(Nn,An)=>{Fe===this.dependencySentinel&&(Ht||(Ht=Nn,Ne=An,Jn.call(this)))})):Ne={};const $n=Object.keys(Ct.patternDependencies);function Jn(){if(Ht)return ot(Ht);if(Kt&&Ne&&Ye){const Nn=new x(Kt),An=new a.bp(Ne,Ye);for(const qr in rt){const si=rt[qr];si instanceof a.a4?(L(si.layers,this.zoom,J),a.bq({bucket:si,glyphMap:Kt,glyphPositions:Nn.positions,imageMap:Ne,imagePositions:An.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):si.hasPattern&&(si instanceof a.br||si instanceof a.bs||si instanceof a.bt)&&(L(si.layers,this.zoom,J),si.addFeatures(Ct,this.tileID.canonical,An.patternPositions))}this.status="done",ot(null,{buckets:Object.values(rt).filter(qr=>!qr.isEmpty()),featureIndex:xt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Nn.image,imageAtlas:An,glyphMap:this.returnDependencies?Kt:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?Nn.positions:null})}}$n.length?this.inFlightDependencies.push($.send("getImages",{icons:$n,source:this.source,tileID:this.tileID,type:"patterns"},(Nn,An)=>{Fe===this.dependencySentinel&&(Ht||(Ht=Nn,Ye=An,Jn.call(this)))})):Ye={},Jn.call(this)}}function L(st,G,q){const J=new a.a8(G);for(const $ of st)$.recalculate(J,q)}function A(st,G){const q=a.l(st.request,(J,$,ot,Mt)=>{if(J)G(J);else if($)try{const xt=new a.bw.VectorTile(new a.bv($));G(null,{vectorTile:xt,rawData:$,cacheControl:ot,expires:Mt})}catch(xt){const rt=new Uint8Array($);let Ct=`Unable to parse the tile at ${st.request.url}, `;Ct+=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: ${xt.messge}`,G(new Error(Ct))}});return()=>{q.cancel(),G()}}class P{constructor(G,q,J,$){this.actor=G,this.layerIndex=q,this.availableImages=J,this.loadVectorData=$||A,this.fetching={},this.loading={},this.loaded={}}loadTile(G,q){const J=G.uid;this.loading||(this.loading={});const $=!!(G&&G.request&&G.request.collectResourceTiming)&&new a.bu(G.request),ot=this.loading[J]=new S(G);ot.abort=this.loadVectorData(G,(Mt,xt)=>{if(delete this.loading[J],Mt||!xt)return ot.status="done",this.loaded[J]=ot,q(Mt);const rt=xt.rawData,Ct={};xt.expires&&(Ct.expires=xt.expires),xt.cacheControl&&(Ct.cacheControl=xt.cacheControl);const Xt={};if($){const Ht=$.finish();Ht&&(Xt.resourceTiming=JSON.parse(JSON.stringify(Ht)))}ot.vectorTile=xt.vectorTile,ot.parse(xt.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,Ct,Xt))}),this.loaded=this.loaded||{},this.loaded[J]=ot,this.fetching[J]={rawTileData:rt,cacheControl:Ct,resourceTiming:Xt}})}reloadTile(G,q){const J=this.loaded,$=G.uid;if(J&&J[$]){const ot=J[$];ot.showCollisionBoxes=G.showCollisionBoxes,ot.status==="parsing"?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,(Mt,xt)=>{if(Mt||!xt)return q(Mt,xt);let rt;if(this.fetching[$]){const{rawTileData:Ct,cacheControl:Xt,resourceTiming:Ht}=this.fetching[$];delete this.fetching[$],rt=a.e({rawTileData:Ct.slice(0)},xt,Xt,Ht)}else rt=xt;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,$=G.uid;J&&J[$]&&J[$].abort&&(J[$].abort(),delete J[$]),q()}removeTile(G,q){const J=this.loaded,$=G.uid;J&&J[$]&&delete J[$],q()}}class D{constructor(){this.loaded={}}loadTile(G,q){return a._(this,void 0,void 0,function*(){const{uid:J,encoding:$,rawImageData:ot,redFactor:Mt,greenFactor:xt,blueFactor:rt,baseShift:Ct}=G,Xt=ot.width+2,Ht=ot.height+2,Kt=a.a(ot)?new a.R({width:Xt,height:Ht},yield a.bx(ot,-1,-1,Xt,Ht)):ot,Ne=new a.by(J,Kt,$,Mt,xt,rt,Ct);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 F(st,G){if(st.length!==0){U(st[0],G);for(var q=1;q=Math.abs(xt)?q-rt+xt:xt-rt+q,q=rt}q+J>=0!=!!G&&st.reverse()}var Y=a.bz(function st(G,q){var J,$=G&&G.type;if($==="FeatureCollection")for(J=0;J>31}function ne(st,G){for(var q=st.loadGeometry(),J=st.type,$=0,ot=0,Mt=q.length,xt=0;xtst},en=Math.fround||(Be=new Float32Array(1),st=>(Be[0]=+st,Be[0]));var Be;const Ve=3,dn=5,Fn=6;class xn{constructor(G){this.options=Object.assign(Object.create(Zn),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:$}=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 Ct=+Date.now();xt=this.trees[rt]=this._createTree(this._cluster(xt,rt)),q&&console.log("z%d: %d clusters in %dms",rt,xt.numItems,+Date.now()-Ct)}return q&&console.timeEnd("total time"),this}getClusters(G,q){let J=((G[0]+180)%360+360)%360-180;const $=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,$,180,Mt],q),Kt=this.getClusters([-180,$,ot,Mt],q);return Ht.concat(Kt)}const xt=this.trees[this._limitZoom(q)],rt=xt.range(pn(J),Bn(Mt),pn(ot),Bn($)),Ct=xt.data,Xt=[];for(const Ht of rt){const Kt=this.stride*Ht;Xt.push(Ct[Kt+dn]>1?oe(Ct,Kt,this.clusterProps):this.points[Ct[Kt+Ve]])}return Xt}getChildren(G){const q=this._getOriginId(G),J=this._getOriginZoom(G),$="No cluster with the specified id.",ot=this.trees[J];if(!ot)throw new Error($);const Mt=ot.data;if(q*this.stride>=Mt.length)throw new Error($);const xt=this.options.radius/(this.options.extent*Math.pow(2,J-1)),rt=ot.within(Mt[q*this.stride],Mt[q*this.stride+1],xt),Ct=[];for(const Xt of rt){const Ht=Xt*this.stride;Mt[Ht+4]===G&&Ct.push(Mt[Ht+dn]>1?oe(Mt,Ht,this.clusterProps):this.points[Mt[Ht+Ve]])}if(Ct.length===0)throw new Error($);return Ct}getLeaves(G,q,J){const $=[];return this._appendLeaves($,G,q=q||10,J=J||0,0),$}getTile(G,q,J){const $=this.trees[this._limitZoom(G)],ot=Math.pow(2,G),{extent:Mt,radius:xt}=this.options,rt=xt/Mt,Ct=(J-rt)/ot,Xt=(J+1+rt)/ot,Ht={features:[]};return this._addTileFeatures($.range((q-rt)/ot,Ct,(q+1+rt)/ot,Xt),$.data,q,J,ot,Ht),q===0&&this._addTileFeatures($.range(1-rt/ot,Ct,1,Xt),$.data,ot,J,ot,Ht),q===ot-1&&this._addTileFeatures($.range(0,Ct,rt/ot,Xt),$.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,$,ot){const Mt=this.getChildren(q);for(const xt of Mt){const rt=xt.properties;if(rt&&rt.cluster?ot+rt.point_count<=$?ot+=rt.point_count:ot=this._appendLeaves(G,rt.cluster_id,J,$,ot):ot<$?ot++:G.push(xt),G.length===J)break}return ot}_createTree(G){const q=new a.av(G.length/this.stride|0,this.options.nodeSize,Float32Array);for(let J=0;J1;let Xt,Ht,Kt;if(Ct)Xt=je(q,rt,this.clusterProps),Ht=q[rt],Kt=q[rt+1];else{const Ce=this.points[q[rt+Ve]];Xt=Ce.properties;const[Fe,on]=Ce.geometry.coordinates;Ht=pn(Fe),Kt=Bn(on)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(Ht*ot-J)),Math.round(this.options.extent*(Kt*ot-$))]],tags:Xt};let Ye;Ye=Ct||this.options.generateId?q[rt+Ve]:this.points[q[rt+Ve]].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:$,reduce:ot,minPoints:Mt}=this.options,xt=J/($*Math.pow(2,q)),rt=G.data,Ct=[],Xt=this.stride;for(let Ht=0;Htq&&(Fe+=rt[$n+dn])}if(Fe>Ce&&Fe>=Mt){let on,$n=Kt*Ce,Jn=Ne*Ce,Nn=-1;const An=((Ht/Xt|0)<<5)+(q+1)+this.points.length;for(const qr of Ye){const si=qr*Xt;if(rt[si+2]<=q)continue;rt[si+2]=q;const ir=rt[si+dn];$n+=rt[si]*ir,Jn+=rt[si+1]*ir,rt[si+4]=An,ot&&(on||(on=this._map(rt,Ht,!0),Nn=this.clusterProps.length,this.clusterProps.push(on)),ot(on,this._map(rt,si)))}rt[Ht+4]=An,Ct.push($n/Fe,Jn/Fe,1/0,An,-1,Fe),ot&&Ct.push(Nn)}else{for(let on=0;on1)for(const on of Ye){const $n=on*Xt;if(!(rt[$n+2]<=q)){rt[$n+2]=q;for(let Jn=0;Jn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,q,J){if(G[q+dn]>1){const Mt=this.clusterProps[G[q+Fn]];return J?Object.assign({},Mt):Mt}const $=this.points[G[q+Ve]].properties,ot=this.options.map($);return J&&ot===$?Object.assign({},ot):ot}}function oe(st,G,q){return{type:"Feature",id:st[G+Ve],properties:je(st,G,q),geometry:{type:"Point",coordinates:[(J=st[G],360*(J-.5)),yi(st[G+1])]}};var J}function je(st,G,q){const J=st[G+dn],$=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,ot=st[G+Fn],Mt=ot===-1?{}:Object.assign({},q[ot]);return Object.assign(Mt,{cluster:!0,cluster_id:st[G+Ve],point_count:J,point_count_abbreviated:$})}function pn(st){return st/360+.5}function Bn(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 yi(st){const G=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function Ai(st,G,q,J){for(var $,ot=J,Mt=q-G>>1,xt=q-G,rt=st[G],Ct=st[G+1],Xt=st[q],Ht=st[q+1],Kt=G+3;Ktot)$=Kt,ot=Ne;else if(Ne===ot){var Ye=Math.abs(Kt-Mt);YeJ&&($-G>3&&Ai(st,G,$,J),st[$+2]=ot,q-$>3&&Ai(st,$,q,J))}function Lt(st,G,q,J,$,ot){var Mt=$-q,xt=ot-J;if(Mt!==0||xt!==0){var rt=((st-q)*Mt+(G-J)*xt)/(Mt*Mt+xt*xt);rt>1?(q=$,J=ot):rt>0&&(q+=Mt*rt,J+=xt*rt)}return(Mt=st-q)*Mt+(xt=G-J)*xt}function ke(st,G,q,J){var $={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,xt=ot.type;if(xt==="Point"||xt==="MultiPoint"||xt==="LineString")xe(ot,Mt);else if(xt==="Polygon"||xt==="MultiLineString")for(var rt=0;rt0&&(Mt+=J?($*Ct-rt*ot)/2:Math.sqrt(Math.pow(rt-$,2)+Math.pow(Ct-ot,2))),$=rt,ot=Ct}var Xt=G.length-3;G[2]=1,Ai(G,0,Xt,q),G[Xt+2]=1,G.size=Math.abs(Mt),G.start=0,G.end=G.size}function Xi(st,G,q,J){for(var $=0;$1?1:q}function fr(st,G,q,J,$,ot,Mt,xt){if(J/=G,ot>=(q/=G)&&Mt=J)return null;for(var rt=[],Ct=0;Ct=q&&Ye=J)){var Ce=[];if(Kt==="Point"||Kt==="MultiPoint")Vn(Ht,Ce,q,J,$);else if(Kt==="LineString")Tn(Ht,Ce,q,J,$,!1,xt.lineMetrics);else if(Kt==="MultiLineString")oo(Ht,Ce,q,J,$,!1);else if(Kt==="Polygon")oo(Ht,Ce,q,J,$,!0);else if(Kt==="MultiPolygon")for(var Fe=0;Fe=q&&Mt<=J&&(G.push(st[ot]),G.push(st[ot+1]),G.push(st[ot+2]))}}function Tn(st,G,q,J,$,ot,Mt){for(var xt,rt,Ct=es(st),Xt=$===0?Ha:Gs,Ht=st.start,Kt=0;Ktq&&(rt=Xt(Ct,Ne,Ye,Fe,on,q),Mt&&(Ct.start=Ht+xt*rt)):$n>J?Jn=q&&(rt=Xt(Ct,Ne,Ye,Fe,on,q),Nn=!0),Jn>J&&$n<=J&&(rt=Xt(Ct,Ne,Ye,Fe,on,J),Nn=!0),!ot&&Nn&&(Mt&&(Ct.end=Ht+xt*rt),G.push(Ct),Ct=es(st)),Mt&&(Ht+=xt)}var An=st.length-3;Ne=st[An],Ye=st[An+1],Ce=st[An+2],($n=$===0?Ne:Ye)>=q&&$n<=J&&ns(Ct,Ne,Ye,Ce),An=Ct.length-3,ot&&An>=3&&(Ct[An]!==Ct[0]||Ct[An+1]!==Ct[1])&&ns(Ct,Ct[0],Ct[1],Ct[2]),Ct.length&&G.push(Ct)}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,$,ot){for(var Mt=0;MtMt.maxX&&(Mt.maxX=Xt),Ht>Mt.maxY&&(Mt.maxY=Ht)}return Mt}function Ea(st,G,q,J){var $=G.geometry,ot=G.type,Mt=[];if(ot==="Point"||ot==="MultiPoint")for(var xt=0;xt<$.length;xt+=3)Mt.push($[xt]),Mt.push($[xt+1]),st.numPoints++,st.numSimplified++;else if(ot==="LineString")ws(Mt,$,st,q,!1,!1);else if(ot==="MultiLineString"||ot==="Polygon")for(xt=0;xt<$.length;xt++)ws(Mt,$[xt],st,q,ot==="Polygon",xt===0);else if(ot==="MultiPolygon")for(var rt=0;rt<$.length;rt++){var Ct=$[rt];for(xt=0;xt0&&G.size<($?Mt:J))q.numPoints+=G.length/3;else{for(var xt=[],rt=0;rtMt)&&(q.numSimplified++,xt.push(G[rt]),xt.push(G[rt+1])),q.numPoints++;$&&function(Ct,Xt){for(var Ht=0,Kt=0,Ne=Ct.length,Ye=Ne-2;Kt0===Xt)for(Kt=0,Ne=Ct.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($,ot){var Mt=[];if($.type==="FeatureCollection")for(var xt=0;xt<$.features.length;xt++)rn(Mt,$.features[xt],ot,xt);else rn(Mt,$.type==="Feature"?$:{geometry:$},ot);return Mt}(st,G);this.tiles={},this.tileCoords=[],q&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",G.indexMaxZoom,G.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function($,ot){var Mt=ot.buffer/ot.extent,xt=$,rt=fr($,1,-1-Mt,Mt,0,-1,2,ot),Ct=fr($,1,1-Mt,2+Mt,0,-1,2,ot);return(rt||Ct)&&(xt=fr($,1,-Mt,1+Mt,0,-1,2,ot)||[],rt&&(xt=js(rt,1).concat(xt)),Ct&&(xt=xt.concat(js(Ct,-1)))),xt}(J,G),J.length&&this.splitTile(J,0,0,0),q&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function cn(st,G,q){return 32*((1<1&&console.time("creation"),Kt=this.tiles[Ht]=oi(st,G,q,J,rt),this.tileCoords.push({z:G,x:q,y:J}),Ct)){Ct>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,$){if(G===rt.maxZoom||G===$)continue;var Ye=1<<$-G;if(q!==Math.floor(ot/Ye)||J!==Math.floor(Mt/Ye))continue}else if(G===rt.indexMaxZoom||Kt.numPoints<=rt.indexMaxPoints)continue;if(Kt.source=null,st.length!==0){Ct>1&&console.time("clipping");var Ce,Fe,on,$n,Jn,Nn,An=.5*rt.buffer/rt.extent,qr=.5-An,si=.5+An,ir=1+An;Ce=Fe=on=$n=null,Jn=fr(st,Xt,q-An,q+si,0,Kt.minX,Kt.maxX,rt),Nn=fr(st,Xt,q+qr,q+ir,0,Kt.minX,Kt.maxX,rt),st=null,Jn&&(Ce=fr(Jn,Xt,J-An,J+si,1,Kt.minY,Kt.maxY,rt),Fe=fr(Jn,Xt,J+qr,J+ir,1,Kt.minY,Kt.maxY,rt),Jn=null),Nn&&(on=fr(Nn,Xt,J-An,J+si,1,Kt.minY,Kt.maxY,rt),$n=fr(Nn,Xt,J+qr,J+ir,1,Kt.minY,Kt.maxY,rt),Nn=null),Ct>1&&console.timeEnd("clipping"),xt.push(Ce||[],G+1,2*q,2*J),xt.push(Fe||[],G+1,2*q,2*J+1),xt.push(on||[],G+1,2*q+1,2*J),xt.push($n||[],G+1,2*q+1,2*J+1)}}},ce.prototype.getTile=function(st,G,q){var J=this.options,$=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,Ct=st,Xt=G,Ht=q;!rt&&Ct>0;)Ct--,Xt=Math.floor(Xt/2),Ht=Math.floor(Ht/2),rt=this.tiles[cn(Ct,Xt,Ht)];return rt&&rt.source?(ot>1&&console.log("found parent tile z%d-%d-%d",Ct,Xt,Ht),ot>1&&console.time("drilling down"),this.splitTile(rt.source,Ct,Xt,Ht,st,G,q),ot>1&&console.timeEnd("drilling down"),this.tiles[xt]?le(this.tiles[xt],$):null):null};class sn extends P{constructor(G,q,J,$){super(G,q,J),this._dataUpdateable=new Map,this.loadGeoJSON=(ot,Mt)=>{const{promoteId:xt}=ot;if(ot.request)return a.f(ot.request,(rt,Ct,Xt,Ht)=>{this._dataUpdateable=Nr(Ct,xt)?is(Ct,xt):void 0,Mt(rt,Ct,Xt,Ht)});if(typeof ot.data=="string")try{const rt=JSON.parse(ot.data);this._dataUpdateable=Nr(rt,xt)?is(rt,xt):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,Ct,Xt){var Ht,Kt,Ne,Ye;if(Ct.removeAll&&rt.clear(),Ct.remove)for(const Ce of Ct.remove)rt.delete(Ce);if(Ct.add)for(const Ce of Ct.add){const Fe=Ke(Ce,Xt);Fe!=null&&rt.set(Fe,Ce)}if(Ct.update)for(const Ce of Ct.update){let Fe=rt.get(Ce.id);if(Fe==null)continue;const on=!Ce.removeAllProperties&&(((Ht=Ce.removeProperties)===null||Ht===void 0?void 0:Ht.length)>0||((Kt=Ce.addOrUpdateProperties)===null||Kt===void 0?void 0:Kt.length)>0);if((Ce.newGeometry||Ce.removeAllProperties||on)&&(Fe=Object.assign({},Fe),rt.set(Ce.id,Fe),on&&(Fe.properties=Object.assign({},Fe.properties))),Ce.newGeometry&&(Fe.geometry=Ce.newGeometry),Ce.removeAllProperties)Fe.properties={};else if(((Ne=Ce.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const $n of Ce.removeProperties)Object.prototype.hasOwnProperty.call(Fe.properties,$n)&&delete Fe.properties[$n];if(((Ye=Ce.addOrUpdateProperties)===null||Ye===void 0?void 0:Ye.length)>0)for(const{key:$n,value:Jn}of Ce.addOrUpdateProperties)Fe.properties[$n]=Jn}}(this._dataUpdateable,ot.dataDiff,xt),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,$&&(this.loadGeoJSON=$)}loadGeoJSONTile(G,q){const J=G.tileID.canonical;if(!this._geoJSONIndex)return q(null,null);const $=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!$)return q(null,null);const ot=new class{constructor(xt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.N,this.length=xt.length,this._features=xt}feature(xt){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 Ct of this._feature.geometry)rt.push([new a.P(Ct[0],Ct[1])]);return rt}{const rt=[];for(const Ct of this._feature.geometry){const Xt=[];for(const Ht of Ct)Xt.push(new a.P(Ht[0],Ht[1]));rt.push(Xt)}return rt}}toGeoJSON(rt,Ct,Xt){return V.call(this,rt,Ct,Xt)}}(this._features[xt])}}($.features);let Mt=bn(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 $=!!(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(Xt=>`${Xt.key}: ${Xt.message}`).join(", "));Mt={type:"FeatureCollection",features:Mt.features.filter(Xt=>rt.value.evaluate({zoom:0},Xt))}}this._geoJSONIndex=G.cluster?new xn(function({superclusterOptions:rt,clusterProperties:Ct}){if(!Ct||!rt)return rt;const Xt={},Ht={},Kt={accumulated:null,zoom:0},Ne={properties:null},Ye=Object.keys(Ct);for(const Ce of Ye){const[Fe,on]=Ct[Ce],$n=a.bC(on),Jn=a.bC(typeof Fe=="string"?[Fe,["accumulated"],["get",Ce]]:Fe);Xt[Ce]=$n.value,Ht[Ce]=Jn.value}return rt.map=Ce=>{Ne.properties=Ce;const Fe={};for(const on of Ye)Fe[on]=Xt[on].evaluate(Kt,Ne);return Fe},rt.reduce=(Ce,Fe)=>{Ne.properties=Fe;for(const on of Ye)Kt.accumulated=Ce[on],Ce[on]=Ht[on].evaluate(Kt,Ne)},rt}(G)).load(Mt.features):function(rt,Ct){return new ce(rt,Ct)}(Mt,G.geojsonVtOptions)}catch(rt){return q(rt)}this.loaded={};const xt={};if($){const rt=$.finish();rt&&(xt.resourceTiming={},xt.resourceTiming[G.source]=JSON.parse(JSON.stringify(rt)))}q(null,xt)}})}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:sn},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 $ in this.workerSources[G]){const ot=this.workerSources[G][$];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 $=this.workerSources[G][q.type][q.source];delete this.workerSources[G][q.type][q.source],$.removeSource!==void 0?$.removeSource(q,J):J()}loadWorkerSource(G,q,J){try{this.self.importScripts(q.url),J()}catch($){J($.toString())}}syncRTLPluginState(G,q,J){try{a.bD.setState(q);const $=a.bD.getPluginURL();if(a.bD.isLoaded()&&!a.bD.isParsed()&&$!=null){this.self.importScripts($);const ot=a.bD.isParsed();J(ot?void 0:new Error(`RTL Text Plugin failed to import scripts from ${$}`),ot)}}catch($){J($.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:($,ot,Mt)=>{this.actor.send($,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 D),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 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,Q)=>{I(N,W,nt,et,at,Q)})},I=(N,O,z,W,nt,et)=>{z?O(z):W instanceof HTMLImageElement||a.a(W)?O(null,W):W&&((at,Q)=>{typeof createImageBitmap=="function"?a.b(at,Q):a.d(at,Q)})(W,(at,Q)=>{at!=null?O(at):Q!=null&&O(null,Q,{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=""}}}}(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(Z);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 Z=/^(\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 it,mt=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 ft=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 lt(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:Q,stretchY:Tt,content:Ot}=M[N];b[I][N]={data:null,pixelRatio:at,sdf:et,stretchX:Q,stretchY:Tt,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 It{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 yt(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class bt 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]=ee}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]=[],Qt.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 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 O={};for(const z of a.n(N))O[z.id]=z;g(null,O)}})},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,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:Q,gridOuter:Tt}=this;et.clearRect(at,at,C,M),et.fillText(y,at,at+I);const Ot=et.getImageData(at,at,C,M);Tt.fill(ee,0,z),Q.fill(0,0,z);for(let ct=0;ct0?Yt*Yt:0,Q[Vt]=Yt<0?Yt*Yt:0}}kt(Tt,0,0,N,O,N,this.f,this.v,this.z),kt(Q,at,at,C,M,N,this.f,this.v,this.z);for(let ct=0;ct1&&(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 Be(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 Ve{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 Ve))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ve.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 Ve?s:s&&new Ve(s)}static fromLngLat(s,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Ve(new a.L(s.lng-g,s.lat-d),new a.L(s.lng+g,s.lat+d))}}class dn{constructor(s,h,d){this.bounds=Ve.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=Be(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 dn(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 xn 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=Be(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 dn(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 It(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 oe extends xn{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,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),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 pn=a.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Bn 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,pn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new It(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 yi extends Bn{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,pn.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 It(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 Ai extends Bn{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,pn.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 It(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 Lt={},ke=y=>{switch(y){case"geojson":return je;case"image":return Bn;case"raster":return xn;case"raster-dem":return oe;case"vector":return Fn;case"video":return yi;case"canvas":return Ai}return Lt[y]};function xe(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 rn(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(un);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,xe(y.transform,z.tileID))});const O=function(z){const W={},nt={};for(const et of z){const at=et.queryResults,Q=et.wrappedTileID,Tt=nt[Q]=nt[Q]||{};for(const Ot in at){const ct=at[Ot],Pt=Tt[Ot]=Tt[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 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 un(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 mn{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 It(s,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new It(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 $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 Ui 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(ke(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 $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(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-Ui.maxOverzooming,this._source.minzoom),I=Math.max(g+Ui.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(Vn(this._source.type)){const O={},z={},W=Object.keys(M),nt=a.h.now();for(const et of W){const at=M[et],Q=this._tiles[et];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=nt)continue;const Tt=this.findLoadedParent(at,b);Tt&&(this._addTile(Tt.tileID),O[Tt.tileID.key]=Tt.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 Q of d)this._tiles[Q.key].hasData()?et[Q.key]=Q:at[Q.key]=Q;for(const Q in at){const Tt=at[Q].children(this._source.maxzoom);this._tiles[Tt[0].key]&&this._tiles[Tt[1].key]&&this._tiles[Tt[2].key]&&this._tiles[Tt[3].key]&&(et[Tt[0].key]=M[Tt[0].key]=Tt[0],et[Tt[1].key]=M[Tt[1].key]=Tt[1],et[Tt[2].key]=M[Tt[2].key]=Tt[2],et[Tt[3].key]=M[Tt[3].key]=Tt[3],delete at[Q])}for(const Q in at){const Tt=this.findLoadedParent(at[Q],this._source.minzoom);if(Tt){et[Tt.tileID.key]=M[Tt.tileID.key]=Tt.tileID;for(const Ot in et)et[Ot].isChildOf(Tt.tileID)&&delete et[Ot]}}for(const Q in this._tiles)et[Q]||(this._coveredTiles[Q]=!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-Ui.maxOverzooming,this._source.minzoom),I=Math.max(h+Ui.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 mn(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&&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:Tt})}}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(Vn(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 Vn(y){return y==="raster"||y==="image"||y==="video"}Ui.maxOverzooming=10,Ui.maxUnderzooming=3;const Tn="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[Tn]}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 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 Q=4*at,Tt=this.boxKeys[at];if(s<=et[Q+2]&&h<=et[Q+3]&&d>=et[Q+0]&&g>=et[Q+1]&&(!M||M(Tt))&&(!O||!js(z,Tt.overlapMode))&&(I.push({key:Tt,x1:et[Q],y1:et[Q+1],x2:et[Q+2],y2:et[Q+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 Q=3*at,Tt=this.circleKeys[at];if(this._circleAndRectCollide(et[Q],et[Q+1],et[Q+2],s,h,d,g)&&(!M||M(Tt))&&(!O||!js(z,Tt.overlapMode))){const Ot=et[Q],ct=et[Q+1],Pt=et[Q+2];if(I.push({key:Tt,x1:Ot-Pt,y1:ct-Pt,x2:Ot+Pt,y2:ct+Pt}),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 Q=4*at,Tt=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(Tt))&&!js(z,Tt.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 Q=3*at,Tt=this.circleKeys[at];if(this._circlesCollide(et[Q],et[Q+1],et[Q+2],N.x,N.y,N.radius)&&(!M||M(Tt))&&!js(z,Tt.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 le(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 vo(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 oi(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],$(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 ce(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,Q=h.transform.width/h.transform.height;let Tt=!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 Nr(y,s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at){const Q=s/24,Tt=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=cn(Q,C,Tt,Ot,h,O,z,y,M,b,W,et,at);if(!Yt)return{notEnoughRoom:!0};const ie=oi(Yt.first.point,I,at).point,te=oi(Yt.last.point,I,at).point;if(d&&!h){const ae=Ke(y.writingMode,ie,te,nt);if(ae)return ae}ct=[Yt.first];for(let ae=y.glyphStartIndex+1;ae0?ie.point:is(z,Yt,Bt,1,g,at),ae=Ke(y.writingMode,Bt,te,nt);if(ae)return ae}const Pt=G(Q*C.getoffsetX(y.glyphStartIndex),Tt,Ot,h,O,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=oi(y.add(y.sub(s)._unit()),g,b).point,C=h.sub(I);return h.add(C._mult(d/C.mag()))}function sn(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=oi(z,g,C);if(W.signedDistanceFromCamera>0)return h.projections[y]=W.point,W.point;const nt=y-N;return is(I===0?b:new a.P(d.getx(nt),d.gety(nt)),z,M,O-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 O=h.add(s);if(y+N=g)return M.offsets[y]=O,O;const z=sn(y+N,C),W=Ss(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 G(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,Q=0;d&&(at*=-1,Q=Math.PI),at<0&&(Q+=Math.PI);let Tt,Ot,ct=at>0?C+I:C+I+1,Pt=g,Bt=g,Vt=0,Yt=0;const ie=Math.abs(et),te=[];let ae;for(;Vt+Yt<=ie;){if(ct+=at,ct=M)return null;Vt+=Yt,Bt=Pt,Ot=Tt;const de={projectionCache:z,lineVertexArray:N,labelPlaneMatrix:O,tileAnchorPoint:b,distanceFromAnchor:Vt,getElevation:nt,previousVertex:Bt,direction:at,absOffsetX:ie};if(Pt=sn(ct,de),h===0)te.push(Bt),ae=Pt.sub(Bt);else{let Ze;const Pe=Pt.sub(Bt);Ze=Pe.mag()===0?Ss(sn(ct+at,de).sub(Pt),h,at):Ss(Pe,h,at),Ot||(Ot=Bt.add(Ze)),Tt=st(ct,Ze,Pt,C,M,Ot,h,de),te.push(Ot),ae=Tt.sub(Ot)}Yt=ae.mag()}const Te=ae._mult((ie-Vt)/Yt)._add(Ot||Bt),wn=Q+Math.atan2(Pt.y-Bt.y,Pt.x-Bt.x);return te.push(Te),{point:Te,angle:W?wn: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;hn--)Pe.push(de.path[hn]);for(let hn=1;hnoi(Sn,M,et));Pe=hn.some(Sn=>Sn.signedDistanceFromCamera<=0)?[]:hn.map(Sn=>Sn.point)}let vn=[];if(Pe.length>0){const hn=Pe[0].clone(),Sn=Pe[0].clone();for(let Gi=1;Gi=ae.x&&Sn.x<=Te.x&&hn.y>=ae.y&&Sn.y<=Te.y?[Pe]:Sn.xTe.x||Sn.yTe.y?[]:a.am([Pe],ae.x,ae.y,Te.x,Te.y)}for(const hn of vn){wn.reset(hn,.25*te);let Sn=0;Sn=wn.length<=.5*te?1:Math.ceil(wn.paddedLength/Yn)+1;for(let Gi=0;Gi=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 Ce(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 Fe{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),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=xt(d,1,this.transform.zoom),at=le(z,W,nt,this.transform,et);let Q=null;if(W){const Ot=vo(z,W,nt,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 Tt={bucket:b,layout:M,posMatrix:z,textLabelPlaneMatrix:at,labelToScreenMatrix:Q,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:ct,symbolInstanceStart:Pt,symbolInstanceEnd:Bt}=Ot;s.push({sortKey:ct,symbolInstanceStart:Pt,symbolInstanceEnd:Bt,parameters:Tt})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Tt})}attemptAnchorPlacement(s,h,d,g,b,I,C,M,N,O,z,W,nt,et,at,Q){const Tt=a.aq[s.textAnchor],Ot=[s.textOffset0,s.textOffset1],ct=Ye(Tt,d,g,Ot,b),Pt=this.collisionIndex.placeCollisionBox(Ce(h,ct.x,ct.y,I,C,this.transform.angle),z,M,N,O.predicate,Q);if((!at||this.collisionIndex.placeCollisionBox(Ce(at,ct.x,ct.y,I,C,this.transform.angle),z,M,N,O.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:Tt,textBoxScale:b,prevAnchor:Bt},this.markUsedJustification(nt,Tt,W,et),nt.allowVerticalPlacement&&(this.markUsedOrientation(nt,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:O,collisionBoxArray:z,partiallyEvaluatedTextSize:W,collisionGroup:nt}=s.parameters,et=b.get("text-optional"),at=b.get("icon-optional"),Q=a.ar(b,"text-overlap","text-allow-overlap"),Tt=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",ie=Tt&&(ct||!g.hasIconData()||at),te=ct&&(Tt||!g.hasTextData()||et);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const ae=this.retainedQueryData[g.bucketInstanceId].tileID,Te=this.terrain?(de,Ze)=>this.terrain.getElevation(ae,de,Ze):null,wn=(de,Ze)=>{var Pe,Yn;if(h[de.crossTileID])return;if(O)return void(this.placements[de.crossTileID]=new Xt(!1,!1,!1));let vn=!1,hn=!1,Sn=!0,Gi=null,ai={box:null,offscreen:null},Or={box:null,offscreen:null},pr=null,Yi=null,Vo=null,mi=0,Zs=0,$s=0;Ze.textFeatureIndex?mi=Ze.textFeatureIndex:de.useRuntimeCollisionCircles&&(mi=de.featureIndex),Ze.verticalTextFeatureIndex&&(Zs=Ze.verticalTextFeatureIndex);const nl=Ze.textBox;if(nl){const $r=ji=>{let dr=a.ai.horizontal;if(g.allowVerticalPlacement&&!ji&&this.prevPlacement){const wo=this.prevPlacement.placedOrientations[de.crossTileID];wo&&(this.placedOrientations[de.crossTileID]=wo,dr=wo,this.markUsedOrientation(g,dr,de))}return dr},zr=(ji,dr)=>{if(g.allowVerticalPlacement&&de.numVerticalGlyphVertices>0&&Ze.verticalTextBox){for(const wo of g.writingModes)if(wo===a.ai.vertical?(ai=dr(),Or=ai):ai=ji(),ai&&ai.box&&ai.box.length)break}else ai=ji()},ao=de.textAnchorOffsetStartIndex,Al=de.textAnchorOffsetEndIndex;if(Al===ao){const ji=(dr,wo)=>{const qi=this.collisionIndex.placeCollisionBox(dr,Q,N,I,nt.predicate,Te);return qi&&qi.box&&qi.box.length&&(this.markUsedOrientation(g,wo,de),this.placedOrientations[de.crossTileID]=wo),qi};zr(()=>ji(nl,a.ai.horizontal),()=>{const dr=Ze.verticalTextBox;return g.allowVerticalPlacement&&de.numVerticalGlyphVertices>0&&dr?ji(dr,a.ai.vertical):{box:null,offscreen:null}}),$r(ai&&ai.box&&ai.box.length)}else{let ji=a.aq[(Yn=(Pe=this.prevPlacement)===null||Pe===void 0?void 0:Pe.variableOffsets[de.crossTileID])===null||Yn===void 0?void 0:Yn.anchor];const dr=(qi,Nl,dh)=>{const om=qi.x2-qi.x1,sm=qi.y2-qi.y1,Qg=de.textBoxScale,np=Vt&&Ot==="never"?Nl:null;let Ws={box:[],offscreen:!1},Dl=Q==="never"?1:2,Xs="never";ji&&Dl++;for(let cs=0;csdr(nl,Ze.iconBox,a.ai.horizontal),()=>{const qi=Ze.verticalTextBox;return g.allowVerticalPlacement&&!(ai&&ai.box&&ai.box.length)&&de.numVerticalGlyphVertices>0&&qi?dr(qi,Ze.verticalIconBox,a.ai.vertical):{box:null,offscreen:null}}),ai&&(vn=ai.box,Sn=ai.offscreen);const wo=$r(ai&&ai.box);if(!vn&&this.prevPlacement){const qi=this.prevPlacement.variableOffsets[de.crossTileID];qi&&(this.variableOffsets[de.crossTileID]=qi,this.markUsedJustification(g,qi.anchor,de,wo))}}}if(pr=ai,vn=pr&&pr.box&&pr.box.length>0,Sn=pr&&pr.offscreen,de.useRuntimeCollisionCircles){const $r=g.text.placedSymbolArray.get(de.centerJustifiedTextSymbolIndex),zr=a.aj(g.textSizeData,W,$r),ao=b.get("text-padding");Yi=this.collisionIndex.placeCollisionCircles(Q,$r,g.lineVertexArray,g.glyphOffsetArray,zr,I,C,M,d,Bt,nt.predicate,de.collisionCircleDiameter,ao,Te),Yi.circles.length&&Yi.collisionDetected&&!d&&a.w("Collisions detected, but collision boxes are not shown"),vn=Tt||Yi.circles.length>0&&!Yi.collisionDetected,Sn=Sn&&Yi.offscreen}if(Ze.iconFeatureIndex&&($s=Ze.iconFeatureIndex),Ze.iconBox){const $r=zr=>{const ao=Vt&&Gi?Ce(zr,Gi.x,Gi.y,Pt,Bt,this.transform.angle):zr;return this.collisionIndex.placeCollisionBox(ao,Ot,N,I,nt.predicate,Te)};Or&&Or.box&&Or.box.length&&Ze.verticalIconBox?(Vo=$r(Ze.verticalIconBox),hn=Vo.box.length>0):(Vo=$r(Ze.iconBox),hn=Vo.box.length>0),Sn=Sn&&Vo.offscreen}const kl=et||de.numHorizontalGlyphVertices===0&&de.numVerticalGlyphVertices===0,yu=at||de.numIconVertices===0;if(kl||yu?yu?kl||(hn=hn&&vn):vn=hn&&vn:hn=vn=hn&&vn,vn&&pr&&pr.box&&this.collisionIndex.insertCollisionBox(pr.box,Q,b.get("text-ignore-placement"),g.bucketInstanceId,Or&&Or.box&&Zs?Zs:mi,nt.ID),hn&&Vo&&this.collisionIndex.insertCollisionBox(Vo.box,Ot,b.get("icon-ignore-placement"),g.bucketInstanceId,$s,nt.ID),Yi&&(vn&&this.collisionIndex.insertCollisionCircles(Yi.circles,Q,b.get("text-ignore-placement"),g.bucketInstanceId,mi,nt.ID),d)){const $r=g.bucketInstanceId;let zr=this.collisionCircleArrays[$r];zr===void 0&&(zr=this.collisionCircleArrays[$r]=new Ht);for(let ao=0;ao=0;--Ze){const Pe=de[Ze];wn(g.symbolInstances.get(Pe),g.collisionArrays[Pe])}}else for(let de=s.symbolInstanceStart;de=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 Ct(O,g,N.text,N.icon),d=d||N.text!==O.text.placed||N.icon!==O.icon.placed):(this.opacities[M]=new Ct(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 Ct(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 Ct(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 Ct(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,Tt)=>{for(let Ot=0;Ot0,Vt=this.placedOrientations[Q.crossTileID],Yt=Vt===a.ai.vertical,ie=Vt===a.ai.horizontal||Vt===a.ai.horizontalOnly;if(Tt>0||Ot>0){const te=Dr(Pt.text);et(s.text,Tt,Yt?rs:te),et(s.text,Ot,ie?rs:te);const ae=Pt.text.isHidden();[Q.rightJustifiedTextSymbolIndex,Q.centerJustifiedTextSymbolIndex,Q.leftJustifiedTextSymbolIndex].forEach(de=>{de>=0&&(s.text.placedSymbolArray.get(de).hidden=ae||Yt?1:0)}),Q.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(Q.verticalPlacedTextSymbolIndex).hidden=ae||ie?1:0);const Te=this.variableOffsets[Q.crossTileID];Te&&this.markUsedJustification(s,Te.anchor,Q,Vt);const wn=this.placedOrientations[Q.crossTileID];wn&&(this.markUsedJustification(s,"left",Q,wn),this.markUsedOrientation(s,wn,Q))}if(Bt){const te=Dr(Pt.icon),ae=!(W&&Q.verticalPlacedIconSymbolIndex&&Yt);Q.placedIconSymbolIndex>=0&&(et(s.icon,Q.numIconVertices,ae?te:rs),s.icon.placedSymbolArray.get(Q.placedIconSymbolIndex).hidden=Pt.icon.isHidden()),Q.verticalPlacedIconSymbolIndex>=0&&(et(s.icon,Q.numVerticalIconVertices,ae?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 ae=new a.P(0,0);if(te.textBox||te.verticalTextBox){let wn=!0;if(N){const de=this.variableOffsets[ct];de?(ae=Ye(de.anchor,de.width,de.height,de.textOffset,de.textBoxScale),O&&ae._rotate(z?this.transform.angle:-this.transform.angle)):wn=!1}te.textBox&&on(s.textCollisionBox.collisionVertexArray,Pt.text.placed,!wn||Yt,ae.x,ae.y),te.verticalTextBox&&on(s.textCollisionBox.collisionVertexArray,Pt.text.placed,!wn||ie,ae.x,ae.y)}const Te=!!(!ie&&te.verticalIconBox);te.iconBox&&on(s.iconCollisionBox.collisionVertexArray,Pt.icon.placed,Te,W?ae.x:0,W?ae.y:0),te.verticalIconBox&&on(s.iconCollisionBox.collisionVertexArray,Pt.icon.placed,!Te,W?ae.x:0,W?ae.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 on(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 $n=Math.pow(2,25),Jn=Math.pow(2,24),Nn=Math.pow(2,17),An=Math.pow(2,16),qr=Math.pow(2,9),si=Math.pow(2,8),ir=Math.pow(2,1);function Dr(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*$n+s*Jn+h*Nn+s*An+h*qr+s*si+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: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=su/Math.pow(2,M-b),O=(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(O-z)}}findMatches(s,h,d){const g=this.tileID.canonical.zs)}}class Hn{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")),Ro=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 Rr extends a.E{constructor(s,h={}){super(),this.map=s,this.dispatcher=new en(Ha(),this,s._getMapId()),this.imageManager=new bt,this.imageManager.setEventedParent(this),this.glyphManager=new Qt(s._requestManager,h.localIdeographFontFamily),this.lineAtlas=new Zn(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=Rr.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 bn(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,O=I>1?"@2x":"",z={},W={},nt={};for(const{id:et,url:at}of M){const Q=b.transformRequest(b.normalizeSpriteURL(at,O,".json"),Y.SpriteJSON),Tt=`${et}_${Q.url}`;z[Tt]=a.f(Q,(Pt,Bt)=>{delete z[Tt],W[et]=Bt,lt(C,W,nt,Pt,N)});const Ot=b.transformRequest(b.normalizeSpriteURL(at,O,".png"),Y.SpriteImage),ct=`${et}_${Ot.url}`;z[ct]=U.getImage(Ot,(Pt,Bt)=>{delete z[ct],nt[et]=Bt,lt(C,W,nt,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 Ro));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 Ui(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 ie=Tt.featureSortOrder;if(ie){const te=ie.indexOf(Vt.featureIndex);return ie.indexOf(Yt.featureIndex)-te}return Yt.featureIndex-Vt.featureIndex});for(const Vt of Bt)Pt.push(Vt)}}for(const Tt in et)et[Tt].forEach(Ot=>{const ct=Ot.feature,Pt=N[C[Tt].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{Lt[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 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 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=[...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)))}}Rr.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:Un(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -576,11 +576,11 @@ uniform ${O} ${z} u_${W}; #endif `}),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 O=this.boundPaintVertexBuffers.length!==g.length;for(let z=0;!O&&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,O,z,W,nt,et,at,Q,Tt,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,nt,{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,O,at?at.getPaintVertexBuffers():[],z,Bt.vertexOffset,Q,Tt,Ot),ct.drawElements(h,Bt.primitiveLength*Pt,ct.UNSIGNED_SHORT,Bt.primitiveOffset*Pt*2)}}}function ss(y,s,h){const d=1/xt(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,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(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=xt(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=xt(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}},Hu=(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:xt(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/xt(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/xt(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),O=I.getDash(d.to,M),z=N.width*g.fromScale,W=O.width*g.toScale;return a.e(bf(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 Cd(y,s){return 1/xt(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 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}},wf=(y,s,h,d,g,b,I,C,M,N,O)=>{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:+O})},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 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,Q=at*(N.tileID.canonical.x+N.tileID.wrap*et),Tt=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/xt(N,1,M.transform.tileZoom),u_pixel_coord_upper:[Q>>16,Tt>>16],u_pixel_coord_lower:[65535&Q,65535&Tt]}}(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 Yu={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 ae=a.Z(),Le=Yt;a.aU(ae,Vt.placementInvProjMatrix,y.transform.glCoordMatrix),a.aU(ae,ae,Vt.placementViewportMatrix),O.push({circleArray:te,circleOffset:W,transform:Le,invTransform:ae,coord:Pt}),z+=te.length/4,W=z}ie&&N.draw(C,M.LINES,Mn.disabled,Ci.disabled,y.colorModeForRenderPass(),vi.disabled,yf(Yt,y.transform,Bt),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pt),h.id,ie.layoutVertexBuffer,ie.indexBuffer,ie.segments,null,y.transform.zoom,null,null,ie.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 ct of O)for(let Pt=0;Pt=0&&(et[Q.associatedIconIndex]={shiftedAnchor:wn,angle:de})}else J(Q.numGlyphs,W)}if(N){nt.clear();const at=y.icon.placedSymbolArray;for(let Q=0;Qy.style.map.terrain.getElevation(ie,xo,qi):null,dr=h.layout.get("text-rotation-alignment")==="map";ce(ae,ie.posMatrix,y,g,mi,Zs,Q,N,dr,ji)}const kl=y.translatePosMatrix(ie.posMatrix,te,b,I),yu=Tt||g&&Vt||nl?Nf:mi,$r=y.translatePosMatrix(Zs,te,b,I,!0),zr=de&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ao;ao=de?ae.iconsInText?El(qe.kind,vn,Ot,Q,y,kl,yu,$r,Sn,pr):wf(qe.kind,vn,Ot,Q,y,kl,yu,$r,g,Sn,!0):xf(qe.kind,vn,Ot,Q,y,kl,yu,$r,g,Sn);const Al={program:Yn,buffers:Le,uniformValues:ao,atlasTexture:Gi,atlasTextureIcon:Yi,atlasInterpolation:ai,atlasInterpolationIcon:Or,isSDF:de,hasHalo:zr};if(ct&&ae.canOverlap){Pt=!0;const ji=Le.segments.get();for(const dr of ji)Yt.push({segments:new a.S([dr]),sortKey:dr.sortKey,state:Al,terrainData:hn})}else Yt.push({segments:Le.segments,sortKey:0,state:Al,terrainData:hn})}Pt&&Yt.sort((ie,te)=>ie.sortKey-te.sortKey);for(const ie of Yt){const te=ie.state;if(W.activeTexture.set(nt.TEXTURE0),te.atlasTexture.bind(te.atlasInterpolation,nt.CLAMP_TO_EDGE),te.atlasTextureIcon&&(W.activeTexture.set(nt.TEXTURE1),te.atlasTextureIcon&&te.atlasTextureIcon.bind(te.atlasInterpolationIcon,nt.CLAMP_TO_EDGE)),te.isSDF){const ae=te.uniformValues;te.hasHalo&&(ae.u_is_halo=1,Rf(te.buffers,ie.segments,h,y,te.program,Bt,O,z,ae,ie.terrainData)),ae.u_is_halo=0}Rf(te.buffers,ie.segments,h,y,te.program,Bt,O,z,te.uniformValues,ie.terrainData)}}function Rf(y,s,h,d,g,b,I,C,M,N){const O=d.context;g.draw(O,O.gl.TRIANGLES,b,I,C,vi.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 Ju(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 Qu(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,Q;I?(nt=O&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=C.LINES):(nt=O?"fillPattern":"fill",W=C.TRIANGLES);const Tt=N.constantOr(null);for(const Ot of d){const ct=s.getTile(Ot);if(O&&!ct.patternsLoaded())continue;const Pt=ct.getBucket(h);if(!Pt)continue;const Bt=Pt.programConfigurations.get(h.id),Vt=y.useProgram(nt,Bt),Yt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ot);O&&(y.context.activeTexture.set(C.TEXTURE0),ct.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Bt.updatePaintBuffers(z)),Ju(Bt,M,Tt,ct,h);const ie=Yt?Ot:null,te=y.translatePosMatrix(ie?ie.posMatrix:Ot.posMatrix,ct,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(I){at=Pt.indexBuffer2,Q=Pt.segments2;const ae=[C.drawingBufferWidth,C.drawingBufferHeight];et=nt==="fillOutlinePattern"&&O?qc(te,y,z,ct,ae):jc(te,ae)}else at=Pt.indexBuffer,Q=Pt.segments,et=O?_f(te,y,z,ct):wd(te);Vt.draw(y.context,W,g,y.stencilModeForClipping(Ot),b,vi.disabled,et,Yt,h.id,Pt.layoutVertexBuffer,at,Q,h.paint,y.transform.zoom,Bt)}}function tc(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 Q=s.getTile(at),Tt=Q.getBucket(h);if(!Tt)continue;const Ot=y.style.map.terrain&&y.style.map.terrain.getTerrainData(at),ct=Tt.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)),Ju(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,nt,at,W,Q):gf(Bt,y,Vt,nt);Pt.draw(C,C.gl.TRIANGLES,g,b,I,vi.backCCW,Yt,Ot,h.id,Tt.layoutVertexBuffer,Tt.indexBuffer,Tt.segments,h.paint,y.transform.zoom,ct,y.style.map.terrain&&Tt.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,vi.disabled,((W,nt,et,at)=>{const Q=et.paint.get("hillshade-shadow-color"),Tt=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(nt.tileID.toUnwrapped(),Pt),u_image:0,u_latrange:vf(0,nt.tileID),u_light:[et.paint.get("hillshade-exaggeration"),ct],u_shadow:Q,u_highlight:Tt,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,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 It(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 It(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,vi.disabled,((nt,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: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 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 ec(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=Mn.disabled,M=Ci.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 Q=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(Q+=` => ${h.overscaledZ}`),function(Tt,Ot){Tt.initDebugOverlayCanvas();const ct=Tt.debugOverlayCanvas,Pt=Tt.context.gl,Bt=Tt.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),Tt.debugOverlayTexture.update(ct),Tt.debugOverlayTexture.bind(Pt.LINEAR,Pt.CLAMP_TO_EDGE)}(y,`${Q} ${nt}kB`),I.draw(d,g.TRIANGLES,C,M,Ii.alphaBlended,vi.disabled,Hu(b,a.aT.transparent,at),null,O,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),I.draw(d,g.LINE_STRIP,C,M,N,vi.disabled,Hu(b,a.aT.red),z,O,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Di(y,s,h){const d=y.context,g=d.gl,b=y.colorModeForRenderPass(),I=new Mn(g.LEQUAL,Mn.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,Ci.disabled,b,vi.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=Ui.maxUnderzooming+Ui.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,pn.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,Mn.disabled,this.stencilClearMode,Ii.disabled,vi.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(Mn.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,Mn.disabled,new Ci({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),Ii.disabled,vi.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],O=b[M.source];this._renderTileClippingMasks(M,O),this.renderLayer(this,N,M,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerQ.source&&!Q.isHidden(O)?[N.sourceCaches[Q.source]]:[]),nt=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,O,z){for(let W=0;Wnt.style.map.terrain.getElevation(Vt,qe,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"),O,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"),O,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"),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,Mn.ReadOnly),Q=Ci.disabled,Tt=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:ie,terrainData:te}=ct.state;Bt.draw(nt,et.TRIANGLES,at,Q,Tt,vi.disabled,ie,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,O=N.gl,z=Ci.disabled,W=new Ii([O.ONE,O.ONE],a.aT.transparent,[!0,!0,!0,!0]);(function(nt,et,at){const Q=nt.gl;nt.activeTexture.set(Q.TEXTURE1),nt.viewport.set([0,0,et.width/4,et.height/4]);let Tt=at.heatmapFbo;if(Tt)Q.bindTexture(Q.TEXTURE_2D,Tt.colorAttachment.get()),nt.bindFramebuffer.set(Tt.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),Tt=at.heatmapFbo=nt.createFramebuffer(et.width/4,et.height/4,!1,!1),function(ct,Pt,Bt,Vt){var Yt,ie;const te=ct.gl,ae=(Yt=ct.HALF_FLOAT)!==null&&Yt!==void 0?Yt:te.UNSIGNED_BYTE,Le=(ie=ct.RGBA16F)!==null&&ie!==void 0?ie:te.RGBA;te.texImage2D(te.TEXTURE_2D,0,Le,Pt.width/4,Pt.height/4,0,te.RGBA,ae,null),Vt.colorAttachment.set(Bt)}(nt,et,Ot,Tt)}})(N,b,C),N.clear({color:a.aT.transparent});for(let nt=0;nt{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,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,Mn.ReadOnly),W=b.colorModeForRenderPass(),nt=C.paint.get("line-dasharray"),et=C.paint.get("line-pattern"),at=et.constantOr(1),Q=C.paint.get("line-gradient"),Tt=C.getCrossfadeParameters(),Ot=at?"linePattern":nt?"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 ie=Yt.getBucket(C);if(!ie)continue;const te=ie.programConfigurations.get(C.id),ae=b.context.program.get(),Le=b.useProgram(Ot,te),wn=Bt||Le.program!==ae,de=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Vt),qe=et.constantOr(null);if(qe&&Yt.imageAtlas){const vn=Yt.imageAtlas,hn=vn.patternPositions[qe.to.toString()],Sn=vn.patternPositions[qe.from.toString()];hn&&Sn&&te.setConstantPatternPositions(hn,Sn)}const Pe=de?Vt:null,Yn=at?Bg(b,Yt,C,Tt,Pe):nt?Id(b,Yt,C,nt,Tt,Pe):Q?Ed(b,Yt,C,ie.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(Tt);else if(nt&&(wn||b.lineAtlas.dirty))ct.activeTexture.set(Pt.TEXTURE0),b.lineAtlas.bind(ct);else if(Q){const vn=ie.gradients[C.id];let hn=vn.texture;if(C.gradientVersion!==vn.version){let Sn=256;if(C.stepInterpolant){const Gi=I.getSource().maxzoom,ai=Vt.canonical.z===Gi?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 It(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],Q=nt[2],Tt=et*et+at*at+Q*Q;return Tt>0&&(Tt=1/Math.sqrt(Tt)),W[0]=nt[0]*Tt,W[1]=nt[1]*Tt,W[2]=nt[2]*Tt,W}([],function(W,nt,et){var at=nt[0],Q=nt[1],Tt=nt[2],Ot=et[0],ct=et[1],Pt=et[2];return W[0]=Q*Pt-Tt*ct,W[1]=Tt*Ot-at*Pt,W[2]=at*ct-Q*Ot,W}([],mt([],b[C[0]],b[C[1]]),mt([],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 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 nc{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 nc(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 nc,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],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=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=[],Tt=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:O,ie=ct.aabb.distanceX(Yt),te=ct.aabb.distanceY(Yt),ae=Math.max(Math.abs(ie),Math.abs(te));if(ct.zoom===Tt||ae>nt+(1<=W){const Le=Tt-ct.zoom,wn=N[0]-.5-(Pt<>1),qe=ct.zoom+1;let Pe=ct.aabb.quadrant(Le);if(s.terrain){const Yn=new a.O(qe,ct.wrap,qe,wn,de),vn=s.terrain.getMinMaxElevation(Yn),hn=(h=vn.minElevation)!==null&&h!==void 0?h:this.elevation,Sn=(d=vn.maxElevation)!==null&&d!==void 0?d:this.elevation;Pe=new fu([Pe.min[0],Pe.min[1],hn],[Pe.max[0],Pe.max[1],Sn])}at.push({aabb:Pe,zoom:qe,x:wn,y:de,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,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 Ve().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 Ve([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),Q=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),Tt=this.height/50;g=new Float64Array(16),a.b8(g,this._fov,this.width/this.height,Tt,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,ie=new Float64Array(g);if(a.$(ie,ie,[Vt>.5?Vt-1:Vt,Yt>.5?Yt-1:Yt,0]),this.alignedProjMatrix=ie,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 ic{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 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 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=rc(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=rc(h.zoom,d,Ud);g.zoom=this._map.transform.zoom+b.amount,qs(g,b)}if(h.bearing){const b=rc(h.bearing,d,Gd);g.bearing=this._map.transform.bearing+a.ad(b.amount,-179,179),qs(g,b)}if(h.pitch){const b=rc(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,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 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 Fo(s.type,this._map,s))}mouseup(s){this._map.fire(new Fo(s.type,this._map,s))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Fo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Fo(s.type,this._map,s))}mouseover(s){this._map.fire(new Fo(s.type,this._map,s))}mouseout(s){this._map.fire(new Fo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new oc(s.type,this._map,s))}touchmove(s){this._map.fire(new oc(s.type,this._map,s))}touchend(s){this._map.fire(new oc(s.type,this._map,s))}touchcancel(s){this._map.fire(new oc(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 Fo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Fo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Fo(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 we{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 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 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 sc=y=>y.zoom||y.drag||y.pitch||y.rotate;class $f extends a.k{}function ac(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:Q,allowed:Tt}of this._handlers){if(!Q.isEnabled())continue;let Ot;this._blockedByActive(N,Tt,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 nt={};for(const at in this._previousActiveHandlers)N[at]||(nt[at]=I);this._previousActiveHandlers=N,(Object.keys(nt).length||ac(C))&&(this._changes.push([C,M,nt]),this._triggerRenderFrame()),(Object.keys(N).length||ac(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),O=Ma(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:Tt,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:Tt,assignEvents:ch})})(s),W=new we(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 nt=new Bf,et=new Yd;h.touchZoomRotate=new el(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 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!!sc(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(!(ac(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=sc(this._eventsInProgress),b=sc(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=sc(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 $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,O,Vt)),this._padding&&(d.interpolatePadding(C,z,Vt),nt=d.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Vt),ct)d.setLocationAtPoint(ct,Pt);else{const Yt=d.zoomScale(d.zoom-g),ie=M>g?Math.min(2,Ot):Math.max(.5,Ot),te=Math.pow(ie,1-Vt),ae=d.unproject(Q.add(Tt.mult(Vt*te)).mult(Yt));d.setLocationAtPoint(d.renderWorldCopies?ae.wrap():ae,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),Q=a.L.convert(s.center||at);this._normalizeCenter(Q);const Tt=d.project(at),Ot=d.project(Q).sub(Tt);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),Yn=Pt/d.zoomScale(Pe-g);ct=Math.sqrt(Yn/Vt*2)}const Yt=ct*ct;function ie(Pe){const Yn=(Bt*Bt-Pt*Pt+(Pe?-1:1)*Yt*Yt*Vt*Vt)/(2*(Pe?Bt:Pt)*Yt*Vt);return Math.log(Math.sqrt(Yn*Yn+1)-Yn)}function te(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function ae(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}const Le=ie(!1);let wn=function(Pe){return ae(Le)/ae(Le+ct*Pe)},de=function(Pe){return Pt*((ae(Le)*(te(Yn=Le+ct*Pe)/ae(Yn))-te(Le))/Yt)/Vt;var Yn},qe=(ie(!0)-Le)/ct;if(Math.abs(Vt)<1e-6||!isFinite(qe)){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=O!==I,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(Q),this._ease(Pe=>{const Yn=Pe*qe,vn=1/wn(Yn);d.zoom=Pe===1?M:g+d.scaleZoom(vn),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 hn=Pe===1?Q:d.unproject(Tt.add(Ot.mult(de(Yn))).mult(vn));d.setLocationAtPoint(d.renderWorldCopies?hn.wrap():hn,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 Bo{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 di{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 mn(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 It(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 It(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()&&(Di(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:(O,z)=>({bearingDelta:(z.x-O.x)*M}),moveStateManager:N,enable:I,assignEvents:lc})})({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:(O,z)=>({pitchDelta:(z.y-O.y)*M}),moveStateManager:N,enable:I,assignEvents:lc})})({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 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 Tt 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",Tt.rx),Ot.setAttributeNS(null,"ry",Tt.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 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(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()}),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 Ri={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ti=0,gu=!1;const uc={maxWidth:100,unit:"metric"};function cc(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 jn{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 jn.Map=class extends tm{constructor(y){if(a.bg.mark(a.bh.create),(y=a.e({},je,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 ic(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 Bo({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new di,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(Ve.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 Fo(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 Fo(y,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,h.call(this,new Fo(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 Rr(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 Rr(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: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){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=` +`),ct=C.createShader(C.FRAGMENT_SHADER);if(C.isContextLost())return void(this.failedToCreate=!0);if(C.shaderSource(ct,Tt),C.compileShader(ct),!C.getShaderParameter(ct,C.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${C.getShaderInfoLog(ct)}`);C.attachShader(this.program,ct);const Pt=C.createShader(C.VERTEX_SHADER);if(C.isContextLost())return void(this.failedToCreate=!0);if(C.shaderSource(Pt,Ot),C.compileShader(Pt),!C.getShaderParameter(Pt,C.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${C.getShaderInfoLog(Pt)}`);C.attachShader(this.program,Pt),this.attributes={};const Bt={};this.numAttributes=O.length;for(let Vt=0;Vt({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,O,z,W,nt,et,at,Q,Tt,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,nt,{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,O,at?at.getPaintVertexBuffers():[],z,Bt.vertexOffset,Q,Tt,Ot),ct.drawElements(h,Bt.primitiveLength*Pt,ct.UNSIGNED_SHORT,Bt.primitiveOffset*Pt*2)}}}function ss(y,s,h){const d=1/xt(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,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(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=xt(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=xt(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}},Hu=(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:xt(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/xt(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/xt(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),O=I.getDash(d.to,M),z=N.width*g.fromScale,W=O.width*g.toScale;return a.e(bf(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 Cd(y,s){return 1/xt(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 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}},wf=(y,s,h,d,g,b,I,C,M,N,O)=>{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:+O})},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 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,Q=at*(N.tileID.canonical.x+N.tileID.wrap*et),Tt=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/xt(N,1,M.transform.tileZoom),u_pixel_coord_upper:[Q>>16,Tt>>16],u_pixel_coord_lower:[65535&Q,65535&Tt]}}(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 Yu={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 ae=a.Z(),Te=Yt;a.aU(ae,Vt.placementInvProjMatrix,y.transform.glCoordMatrix),a.aU(ae,ae,Vt.placementViewportMatrix),O.push({circleArray:te,circleOffset:W,transform:Te,invTransform:ae,coord:Pt}),z+=te.length/4,W=z}ie&&N.draw(C,M.LINES,Mn.disabled,Ci.disabled,y.colorModeForRenderPass(),vi.disabled,yf(Yt,y.transform,Bt),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pt),h.id,ie.layoutVertexBuffer,ie.indexBuffer,ie.segments,null,y.transform.zoom,null,null,ie.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 ct of O)for(let Pt=0;Pt=0&&(et[Q.associatedIconIndex]={shiftedAnchor:wn,angle:de})}else J(Q.numGlyphs,W)}if(N){nt.clear();const at=y.icon.placedSymbolArray;for(let Q=0;Qy.style.map.terrain.getElevation(ie,wo,qi):null,dr=h.layout.get("text-rotation-alignment")==="map";ce(ae,ie.posMatrix,y,g,mi,Zs,Q,N,dr,ji)}const kl=y.translatePosMatrix(ie.posMatrix,te,b,I),yu=Tt||g&&Vt||nl?Nf:mi,$r=y.translatePosMatrix(Zs,te,b,I,!0),zr=de&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ao;ao=de?ae.iconsInText?El(Ze.kind,vn,Ot,Q,y,kl,yu,$r,Sn,pr):wf(Ze.kind,vn,Ot,Q,y,kl,yu,$r,g,Sn,!0):xf(Ze.kind,vn,Ot,Q,y,kl,yu,$r,g,Sn);const Al={program:Yn,buffers:Te,uniformValues:ao,atlasTexture:Gi,atlasTextureIcon:Yi,atlasInterpolation:ai,atlasInterpolationIcon:Or,isSDF:de,hasHalo:zr};if(ct&&ae.canOverlap){Pt=!0;const ji=Te.segments.get();for(const dr of ji)Yt.push({segments:new a.S([dr]),sortKey:dr.sortKey,state:Al,terrainData:hn})}else Yt.push({segments:Te.segments,sortKey:0,state:Al,terrainData:hn})}Pt&&Yt.sort((ie,te)=>ie.sortKey-te.sortKey);for(const ie of Yt){const te=ie.state;if(W.activeTexture.set(nt.TEXTURE0),te.atlasTexture.bind(te.atlasInterpolation,nt.CLAMP_TO_EDGE),te.atlasTextureIcon&&(W.activeTexture.set(nt.TEXTURE1),te.atlasTextureIcon&&te.atlasTextureIcon.bind(te.atlasInterpolationIcon,nt.CLAMP_TO_EDGE)),te.isSDF){const ae=te.uniformValues;te.hasHalo&&(ae.u_is_halo=1,Rf(te.buffers,ie.segments,h,y,te.program,Bt,O,z,ae,ie.terrainData)),ae.u_is_halo=0}Rf(te.buffers,ie.segments,h,y,te.program,Bt,O,z,te.uniformValues,ie.terrainData)}}function Rf(y,s,h,d,g,b,I,C,M,N){const O=d.context;g.draw(O,O.gl.TRIANGLES,b,I,C,vi.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 Ju(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 Qu(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,Q;I?(nt=O&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=C.LINES):(nt=O?"fillPattern":"fill",W=C.TRIANGLES);const Tt=N.constantOr(null);for(const Ot of d){const ct=s.getTile(Ot);if(O&&!ct.patternsLoaded())continue;const Pt=ct.getBucket(h);if(!Pt)continue;const Bt=Pt.programConfigurations.get(h.id),Vt=y.useProgram(nt,Bt),Yt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ot);O&&(y.context.activeTexture.set(C.TEXTURE0),ct.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Bt.updatePaintBuffers(z)),Ju(Bt,M,Tt,ct,h);const ie=Yt?Ot:null,te=y.translatePosMatrix(ie?ie.posMatrix:Ot.posMatrix,ct,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(I){at=Pt.indexBuffer2,Q=Pt.segments2;const ae=[C.drawingBufferWidth,C.drawingBufferHeight];et=nt==="fillOutlinePattern"&&O?qc(te,y,z,ct,ae):jc(te,ae)}else at=Pt.indexBuffer,Q=Pt.segments,et=O?_f(te,y,z,ct):wd(te);Vt.draw(y.context,W,g,y.stencilModeForClipping(Ot),b,vi.disabled,et,Yt,h.id,Pt.layoutVertexBuffer,at,Q,h.paint,y.transform.zoom,Bt)}}function tc(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 Q=s.getTile(at),Tt=Q.getBucket(h);if(!Tt)continue;const Ot=y.style.map.terrain&&y.style.map.terrain.getTerrainData(at),ct=Tt.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)),Ju(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,nt,at,W,Q):gf(Bt,y,Vt,nt);Pt.draw(C,C.gl.TRIANGLES,g,b,I,vi.backCCW,Yt,Ot,h.id,Tt.layoutVertexBuffer,Tt.indexBuffer,Tt.segments,h.paint,y.transform.zoom,ct,y.style.map.terrain&&Tt.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,vi.disabled,((W,nt,et,at)=>{const Q=et.paint.get("hillshade-shadow-color"),Tt=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(nt.tileID.toUnwrapped(),Pt),u_image:0,u_latrange:vf(0,nt.tileID),u_light:[et.paint.get("hillshade-exaggeration"),ct],u_shadow:Q,u_highlight:Tt,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,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 It(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 It(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,vi.disabled,((nt,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: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 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 ec(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=Mn.disabled,M=Ci.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 Q=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(Q+=` => ${h.overscaledZ}`),function(Tt,Ot){Tt.initDebugOverlayCanvas();const ct=Tt.debugOverlayCanvas,Pt=Tt.context.gl,Bt=Tt.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),Tt.debugOverlayTexture.update(ct),Tt.debugOverlayTexture.bind(Pt.LINEAR,Pt.CLAMP_TO_EDGE)}(y,`${Q} ${nt}kB`),I.draw(d,g.TRIANGLES,C,M,Ii.alphaBlended,vi.disabled,Hu(b,a.aT.transparent,at),null,O,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),I.draw(d,g.LINE_STRIP,C,M,N,vi.disabled,Hu(b,a.aT.red),z,O,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Di(y,s,h){const d=y.context,g=d.gl,b=y.colorModeForRenderPass(),I=new Mn(g.LEQUAL,Mn.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,Ci.disabled,b,vi.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=Ui.maxUnderzooming+Ui.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,pn.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,Mn.disabled,this.stencilClearMode,Ii.disabled,vi.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(Mn.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,Mn.disabled,new Ci({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),Ii.disabled,vi.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],O=b[M.source];this._renderTileClippingMasks(M,O),this.renderLayer(this,N,M,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerQ.source&&!Q.isHidden(O)?[N.sourceCaches[Q.source]]:[]),nt=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,O,z){for(let W=0;Wnt.style.map.terrain.getElevation(Vt,Ze,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"),O,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"),O,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"),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,Mn.ReadOnly),Q=Ci.disabled,Tt=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:ie,terrainData:te}=ct.state;Bt.draw(nt,et.TRIANGLES,at,Q,Tt,vi.disabled,ie,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,O=N.gl,z=Ci.disabled,W=new Ii([O.ONE,O.ONE],a.aT.transparent,[!0,!0,!0,!0]);(function(nt,et,at){const Q=nt.gl;nt.activeTexture.set(Q.TEXTURE1),nt.viewport.set([0,0,et.width/4,et.height/4]);let Tt=at.heatmapFbo;if(Tt)Q.bindTexture(Q.TEXTURE_2D,Tt.colorAttachment.get()),nt.bindFramebuffer.set(Tt.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),Tt=at.heatmapFbo=nt.createFramebuffer(et.width/4,et.height/4,!1,!1),function(ct,Pt,Bt,Vt){var Yt,ie;const te=ct.gl,ae=(Yt=ct.HALF_FLOAT)!==null&&Yt!==void 0?Yt:te.UNSIGNED_BYTE,Te=(ie=ct.RGBA16F)!==null&&ie!==void 0?ie:te.RGBA;te.texImage2D(te.TEXTURE_2D,0,Te,Pt.width/4,Pt.height/4,0,te.RGBA,ae,null),Vt.colorAttachment.set(Bt)}(nt,et,Ot,Tt)}})(N,b,C),N.clear({color:a.aT.transparent});for(let nt=0;nt{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,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,Mn.ReadOnly),W=b.colorModeForRenderPass(),nt=C.paint.get("line-dasharray"),et=C.paint.get("line-pattern"),at=et.constantOr(1),Q=C.paint.get("line-gradient"),Tt=C.getCrossfadeParameters(),Ot=at?"linePattern":nt?"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 ie=Yt.getBucket(C);if(!ie)continue;const te=ie.programConfigurations.get(C.id),ae=b.context.program.get(),Te=b.useProgram(Ot,te),wn=Bt||Te.program!==ae,de=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Vt),Ze=et.constantOr(null);if(Ze&&Yt.imageAtlas){const vn=Yt.imageAtlas,hn=vn.patternPositions[Ze.to.toString()],Sn=vn.patternPositions[Ze.from.toString()];hn&&Sn&&te.setConstantPatternPositions(hn,Sn)}const Pe=de?Vt:null,Yn=at?Bg(b,Yt,C,Tt,Pe):nt?Id(b,Yt,C,nt,Tt,Pe):Q?Ed(b,Yt,C,ie.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(Tt);else if(nt&&(wn||b.lineAtlas.dirty))ct.activeTexture.set(Pt.TEXTURE0),b.lineAtlas.bind(ct);else if(Q){const vn=ie.gradients[C.id];let hn=vn.texture;if(C.gradientVersion!==vn.version){let Sn=256;if(C.stepInterpolant){const Gi=I.getSource().maxzoom,ai=Vt.canonical.z===Gi?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 It(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 bo{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],Q=nt[2],Tt=et*et+at*at+Q*Q;return Tt>0&&(Tt=1/Math.sqrt(Tt)),W[0]=nt[0]*Tt,W[1]=nt[1]*Tt,W[2]=nt[2]*Tt,W}([],function(W,nt,et){var at=nt[0],Q=nt[1],Tt=nt[2],Ot=et[0],ct=et[1],Pt=et[2];return W[0]=Q*Pt-Tt*ct,W[1]=Tt*Ot-at*Pt,W[2]=at*ct-Q*Ot,W}([],mt([],b[C[0]],b[C[1]]),mt([],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 bo(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 nc{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 nc(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 nc,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],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=bo.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=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=[],Tt=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 Te=ct.aabb.intersects(z);if(Te===0)continue;Vt=Te===2}const Yt=s.terrain?N:O,ie=ct.aabb.distanceX(Yt),te=ct.aabb.distanceY(Yt),ae=Math.max(Math.abs(ie),Math.abs(te));if(ct.zoom===Tt||ae>nt+(1<=W){const Te=Tt-ct.zoom,wn=N[0]-.5-(Pt<>1),Ze=ct.zoom+1;let Pe=ct.aabb.quadrant(Te);if(s.terrain){const Yn=new a.O(Ze,ct.wrap,Ze,wn,de),vn=s.terrain.getMinMaxElevation(Yn),hn=(h=vn.minElevation)!==null&&h!==void 0?h:this.elevation,Sn=(d=vn.maxElevation)!==null&&d!==void 0?d:this.elevation;Pe=new fu([Pe.min[0],Pe.min[1],hn],[Pe.max[0],Pe.max[1],Sn])}at.push({aabb:Pe,zoom:Ze,x:wn,y:de,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,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 Ve().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 Ve([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),Q=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),Tt=this.height/50;g=new Float64Array(16),a.b8(g,this._fov,this.width/this.height,Tt,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,ie=new Float64Array(g);if(a.$(ie,ie,[Vt>.5?Vt-1:Vt,Yt>.5?Yt-1:Yt,0]),this.alignedProjMatrix=ie,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 ic{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 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 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=rc(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=rc(h.zoom,d,Ud);g.zoom=this._map.transform.zoom+b.amount,qs(g,b)}if(h.bearing){const b=rc(h.bearing,d,Gd);g.bearing=this._map.transform.bearing+a.ad(b.amount,-179,179),qs(g,b)}if(h.pitch){const b=rc(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,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 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 Fo(s.type,this._map,s))}mouseup(s){this._map.fire(new Fo(s.type,this._map,s))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Fo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Fo(s.type,this._map,s))}mouseover(s){this._map.fire(new Fo(s.type,this._map,s))}mouseout(s){this._map.fire(new Fo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new oc(s.type,this._map,s))}touchmove(s){this._map.fire(new oc(s.type,this._map,s))}touchend(s){this._map.fire(new oc(s.type,this._map,s))}touchcancel(s){this._map.fire(new oc(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 Fo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Fo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Fo(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 we{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 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 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 xo{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 sc=y=>y.zoom||y.drag||y.pitch||y.rotate;class $f extends a.k{}function ac(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:Q,allowed:Tt}of this._handlers){if(!Q.isEnabled())continue;let Ot;this._blockedByActive(N,Tt,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 nt={};for(const at in this._previousActiveHandlers)N[at]||(nt[at]=I);this._previousActiveHandlers=N,(Object.keys(nt).length||ac(C))&&(this._changes.push([C,M,nt]),this._triggerRenderFrame()),(Object.keys(N).length||ac(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),O=Ma(s);h.dragRotate=new xo(s,N,O),this._add("mouseRotate",N,["mousePitch"]),this._add("mousePitch",O,["mouseRotate"]),s.interactive&&s.dragRotate&&h.dragRotate.enable();const z=(({enable:Tt,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:Tt,assignEvents:ch})})(s),W=new we(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 nt=new Bf,et=new Yd;h.touchZoomRotate=new el(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 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!!sc(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(!(ac(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=sc(this._eventsInProgress),b=sc(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=sc(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 $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,O,Vt)),this._padding&&(d.interpolatePadding(C,z,Vt),nt=d.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Vt),ct)d.setLocationAtPoint(ct,Pt);else{const Yt=d.zoomScale(d.zoom-g),ie=M>g?Math.min(2,Ot):Math.max(.5,Ot),te=Math.pow(ie,1-Vt),ae=d.unproject(Q.add(Tt.mult(Vt*te)).mult(Yt));d.setLocationAtPoint(d.renderWorldCopies?ae.wrap():ae,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),Q=a.L.convert(s.center||at);this._normalizeCenter(Q);const Tt=d.project(at),Ot=d.project(Q).sub(Tt);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),Yn=Pt/d.zoomScale(Pe-g);ct=Math.sqrt(Yn/Vt*2)}const Yt=ct*ct;function ie(Pe){const Yn=(Bt*Bt-Pt*Pt+(Pe?-1:1)*Yt*Yt*Vt*Vt)/(2*(Pe?Bt:Pt)*Yt*Vt);return Math.log(Math.sqrt(Yn*Yn+1)-Yn)}function te(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function ae(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}const Te=ie(!1);let wn=function(Pe){return ae(Te)/ae(Te+ct*Pe)},de=function(Pe){return Pt*((ae(Te)*(te(Yn=Te+ct*Pe)/ae(Yn))-te(Te))/Yt)/Vt;var Yn},Ze=(ie(!0)-Te)/ct;if(Math.abs(Vt)<1e-6||!isFinite(Ze)){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=O!==I,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(Q),this._ease(Pe=>{const Yn=Pe*Ze,vn=1/wn(Yn);d.zoom=Pe===1?M:g+d.scaleZoom(vn),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 hn=Pe===1?Q:d.unproject(Tt.add(Ot.mult(de(Yn))).mult(vn));d.setLocationAtPoint(d.renderWorldCopies?hn.wrap():hn,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 Bo{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 di{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 mn(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 It(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 It(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()&&(Di(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:(O,z)=>({bearingDelta:(z.x-O.x)*M}),moveStateManager:N,enable:I,assignEvents:lc})})({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:(O,z)=>({pitchDelta:(z.y-O.y)*M}),moveStateManager:N,enable:I,assignEvents:lc})})({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 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 Tt 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",Tt.rx),Ot.setAttributeNS(null,"ry",Tt.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 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(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()}),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 Ri={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ti=0,gu=!1;const uc={maxWidth:100,unit:"metric"};function cc(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 jn{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 jn.Map=class extends tm{constructor(y){if(a.bg.mark(a.bh.create),(y=a.e({},qe,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 ic(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 Bo({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new di,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(Ve.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 Fo(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 Fo(y,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,h.call(this,new Fo(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 Rr(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 Rr(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: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){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 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 De}getCameraTargetElevation(){return this.transform.elevation}},jn.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}},jn.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=Ve.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({},Ri,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,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)}},jn.AttributionControl=Bo,jn.LogoControl=di,jn.ScaleControl=class{constructor(y){this._onMove=()=>{cc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,cc(this._map,this._container,this.options)},this.options=a.e({},uc,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}},jn.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()}},jn.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}},jn.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()}},jn.Marker=Ml,jn.Style=Rr,jn.LngLat=a.L,jn.LngLatBounds=Ve,jn.Point=a.P,jn.MercatorCoordinate=a.U,jn.Evented=a.E,jn.AJAXError=a.bi,jn.config=a.c,jn.CanvasSource=Ai,jn.GeoJSONSource=Ge,jn.ImageSource=Bn,jn.RasterDEMTileSource=oe,jn.RasterTileSource=xn,jn.VectorTileSource=Fn,jn.VideoSource=yi,jn.setRTLTextPlugin=a.bj,jn.getRTLTextPluginStatus=a.bk,jn.prewarm=function(){Ha().acquire(Tn)},jn.clearPrewarmedResources=function(){const y=ns;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Tn),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(jn,{isSafari:a.ac,getPerformanceMetrics:a.bg.getPerformanceMetrics}),jn});var f=r;return f})})(ix);var mg=ix.exports;const Ms=ex(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 mE(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 gE(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=_E;function _E(e){var t,n,i;if(e){if(Array.isArray(e)){for(t=[],n=e.length,i=0;i{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function vE(e,t,n){let i,r,l,f,a,_,x,S,L,A,P,D,{$$slots:B={},$$scope:U}=t,{id:Y=of("layer")}=t,{source:V=void 0}=t,{sourceLayer:Z=void 0}=t,{beforeId:K=void 0}=t,{beforeLayerType:it=void 0}=t,{type:mt}=t,{paint:ht=void 0}=t,{layout:gt=void 0}=t,{filter:lt=void 0}=t,{applyToClusters:It=void 0}=t,{minzoom:_t=void 0}=t,{maxzoom:bt=void 0}=t,{manageHoverState:ee=!1}=t,{hovered:kt=null}=t,{interactive:Gt=!0}=t,{hoverCursor:Qt=void 0}=t,{eventsIfTopMost:ne=!1}=t;const Ie=Dc(),{map:bn,source:Zn,self:en,minzoom:Be,maxzoom:Ve,eventTopMost:dn,layerInfo:Fn}=fE();Ee(e,bn,Lt=>n(31,L=Lt)),Ee(e,Zn,Lt=>n(32,A=Lt)),Ee(e,en,Lt=>n(0,S=Lt)),Ee(e,Be,Lt=>n(34,D=Lt)),Ee(e,Ve,Lt=>n(33,P=Lt)),aa(()=>{S&&L&&(Fn.delete(S),L==null||L.removeLayer(S))});let xn;function oe(Lt){var un,mn;if(!Gt||!S||!L||ne&&dn(Lt)!==S)return;let ke=Lt.features??[],xe=(mn=(un=ke[0])==null?void 0:un.properties)==null?void 0:mn.cluster_id,rn={event:Lt,map:L,clusterId:xe,layer:S,source:a,features:ke};Ie(Lt.type,rn)}function Ge(Lt){var un,mn;if(!Gt||!S||!L||ne&&dn(Lt)!==S)return;Qt&&(L.getCanvas().style.cursor=Qt);let ke=Lt.features??[];n(6,kt=ke[0]??null);let xe=(mn=(un=ke[0])==null?void 0:un.properties)==null?void 0:mn.cluster_id;Ie("mouseenter",{event:Lt,map:L,clusterId:xe,layer:S,source:a,features:ke})}function pn(Lt){var un,mn,Xi;if(!Gt||!L)return;if(ne&&dn(Lt)!==S){n(6,kt=null),ee&&xn!==void 0&&(L==null||L.setFeatureState({source:a,sourceLayer:Z,id:xn},{hover:!1}),xn=void 0);return}L.getCanvas().style.cursor=Qt;let ke=Lt.features??[],xe=(mn=(un=ke[0])==null?void 0:un.properties)==null?void 0:mn.cluster_id,rn=(Xi=ke[0])==null?void 0:Xi.id;rn!==xn&&(ee&&(xn!==void 0&&(L==null||L.setFeatureState({source:a,id:xn,sourceLayer:Z},{hover:!1})),L==null||L.setFeatureState({source:a,id:rn,sourceLayer:Z},{hover:!0})),xn=rn,n(6,kt=ke[0]??null)),Ie("mousemove",{event:Lt,map:L,clusterId:xe,layer:S,source:a,features:ke})}function Bn(Lt){if(!(!Gt||!S||!L)){if(Qt&&(L.getCanvas().style.cursor=""),n(6,kt=null),ee&&xn!==void 0){const ke={source:a,id:xn,sourceLayer:Z};L==null||L.setFeatureState(ke,{hover:!1}),xn=void 0}Ie("mouseleave",{map:L,layer:S,source:a})}}let yi=!0;function Ai(Lt){L&&(L.off("click",Lt,oe),L.off("dblclick",Lt,oe),L.off("contextmenu",Lt,oe),L.off("mouseenter",Lt,Ge),L.off("mousemove",Lt,pn),L.off("mouseleave",Lt,Bn))}return aa(()=>{L&&S&&Ai(S)}),e.$$set=Lt=>{"id"in Lt&&n(7,Y=Lt.id),"source"in Lt&&n(8,V=Lt.source),"sourceLayer"in Lt&&n(9,Z=Lt.sourceLayer),"beforeId"in Lt&&n(10,K=Lt.beforeId),"beforeLayerType"in Lt&&n(11,it=Lt.beforeLayerType),"type"in Lt&&n(12,mt=Lt.type),"paint"in Lt&&n(13,ht=Lt.paint),"layout"in Lt&&n(14,gt=Lt.layout),"filter"in Lt&&n(15,lt=Lt.filter),"applyToClusters"in Lt&&n(16,It=Lt.applyToClusters),"minzoom"in Lt&&n(17,_t=Lt.minzoom),"maxzoom"in Lt&&n(18,bt=Lt.maxzoom),"manageHoverState"in Lt&&n(19,ee=Lt.manageHoverState),"hovered"in Lt&&n(6,kt=Lt.hovered),"interactive"in Lt&&n(20,Gt=Lt.interactive),"hoverCursor"in Lt&&n(21,Qt=Lt.hoverCursor),"eventsIfTopMost"in Lt&&n(22,ne=Lt.eventsIfTopMost),"$$scope"in Lt&&n(35,U=Lt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,i=gE(It)),e.$$.dirty[0]&1073774592&&n(24,r=mE("all",i,lt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=_t??D),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,f=bt??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&&(Ai(S),Fn.delete(S));let Lt=K;if(!K&&it){let ke=L.getStyle().layers,xe=typeof it=="function"?it:un=>un.type===it,rn=ke==null?void 0:ke.find(xe);rn&&(Lt=rn.id)}Ue(en,S=Y,S),L.addLayer(Xm({id:S,type:mt,source:a,"source-layer":Z,filter:r,paint:ht,layout:gt,minzoom:l,maxzoom:f}),Lt),n(23,yi=!0),L.on("click",S,oe),L.on("dblclick",S,oe),L.on("contextmenu",S,oe),L.on("mouseenter",S,Ge),L.on("mousemove",S,pn),L.on("mouseleave",S,Bn)}e.$$.dirty[0]&1048577&&S&&Fn.set(S,{interactive:Gt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,_=S?Uv((Lt,ke)=>L==null?void 0:L.setPaintProperty(S,Lt,ke)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,x=S?Uv((Lt,ke)=>L==null?void 0:L.setLayoutProperty(S,Lt,ke)):void 0),e.$$.dirty[0]&268443648&&(_==null||_(ht)),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&&(yi?n(23,yi=!1):L==null||L.setFilter(S,r))},[S,bn,Zn,en,Be,Ve,kt,Y,V,Z,K,it,mt,ht,gt,lt,It,_t,bt,ee,Gt,Qt,ne,yi,r,f,l,x,_,a,i,L,A,P,D,U,B]}class gg extends tn{constructor(t){super(),Qe(this,t,vE,yE,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 bE(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function xE(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:[bE]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function wE(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:D=void 0}=t,{maxzoom:B=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:Z=!1}=t,{interactive:K=!0}=t;function it(bt){V=bt,n(0,V)}function mt(bt){ii.call(this,e,bt)}function ht(bt){ii.call(this,e,bt)}function gt(bt){ii.call(this,e,bt)}function lt(bt){ii.call(this,e,bt)}function It(bt){ii.call(this,e,bt)}function _t(bt){ii.call(this,e,bt)}return e.$$set=bt=>{"id"in bt&&n(1,l=bt.id),"source"in bt&&n(2,f=bt.source),"sourceLayer"in bt&&n(3,a=bt.sourceLayer),"beforeId"in bt&&n(4,_=bt.beforeId),"beforeLayerType"in bt&&n(5,x=bt.beforeLayerType),"paint"in bt&&n(6,S=bt.paint),"layout"in bt&&n(7,L=bt.layout),"filter"in bt&&n(8,A=bt.filter),"applyToClusters"in bt&&n(9,P=bt.applyToClusters),"minzoom"in bt&&n(10,D=bt.minzoom),"maxzoom"in bt&&n(11,B=bt.maxzoom),"hoverCursor"in bt&&n(12,U=bt.hoverCursor),"manageHoverState"in bt&&n(13,Y=bt.manageHoverState),"hovered"in bt&&n(0,V=bt.hovered),"eventsIfTopMost"in bt&&n(14,Z=bt.eventsIfTopMost),"interactive"in bt&&n(15,K=bt.interactive),"$$scope"in bt&&n(24,r=bt.$$scope)},[V,l,f,a,_,x,S,L,A,P,D,B,U,Y,Z,K,i,it,mt,ht,gt,lt,It,_t,r]}class hd extends tn{constructor(t){super(),Qe(this,t,wE,xE,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 SE(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function EE(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:[SE]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function IE(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:D=void 0}=t,{hoverCursor:B=void 0}=t,{manageHoverState:U=!1}=t,{hovered:Y=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:Z=!0}=t;function K(_t){Y=_t,n(0,Y)}function it(_t){ii.call(this,e,_t)}function mt(_t){ii.call(this,e,_t)}function ht(_t){ii.call(this,e,_t)}function gt(_t){ii.call(this,e,_t)}function lt(_t){ii.call(this,e,_t)}function It(_t){ii.call(this,e,_t)}return e.$$set=_t=>{"id"in _t&&n(1,l=_t.id),"source"in _t&&n(2,f=_t.source),"sourceLayer"in _t&&n(3,a=_t.sourceLayer),"beforeId"in _t&&n(4,_=_t.beforeId),"beforeLayerType"in _t&&n(5,x=_t.beforeLayerType),"paint"in _t&&n(6,S=_t.paint),"layout"in _t&&n(7,L=_t.layout),"filter"in _t&&n(8,A=_t.filter),"minzoom"in _t&&n(9,P=_t.minzoom),"maxzoom"in _t&&n(10,D=_t.maxzoom),"hoverCursor"in _t&&n(11,B=_t.hoverCursor),"manageHoverState"in _t&&n(12,U=_t.manageHoverState),"hovered"in _t&&n(0,Y=_t.hovered),"eventsIfTopMost"in _t&&n(13,V=_t.eventsIfTopMost),"interactive"in _t&&n(14,Z=_t.interactive),"$$scope"in _t&&n(23,r=_t.$$scope)},[Y,l,f,a,_,x,S,L,A,P,D,B,U,V,Z,i,K,it,mt,ht,gt,lt,It,r]}class af extends tn{constructor(t){super(),Qe(this,t,IE,EE,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 CE(e,t,n){let i;const{map:r}=sf();Ee(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 TE extends tn{constructor(t){super(),Qe(this,t,CE,null,He,{position:1,container:2})}}function LE(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 ME(e,t,n){zS().then(()=>{let i=Ub(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=Do()},m(l,f){r.m(l,f),St(l,n,f),i=!0},p(l,f){f&1&&He(t,t=l[0])?(hi(),vt(r,1,1,Ce),fi(),r=Zv(l),r.c(),dt(r,1),r.m(n.parentNode,n)):r.p(l,f)},i(l){i||(dt(r),i=!0)},o(l){vt(r),i=!1},d(l){l&&wt(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function PE(e){let t,n,i=e[0]&&qv(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=qv(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function kE(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:D=void 0}=t;const{map:B,cluster:U,self:Y}=hE();Ee(e,B,K=>n(13,r=K)),Ee(e,U,K=>n(16,l=K)),Ee(e,Y,K=>n(0,i=K));let V,Z=!0;return aa(()=>{i&&V&&r&&(ME(B,i,V),Ue(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,D=K.cluster),"$$scope"in K&&n(14,a=K.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Ue(U,l=D,l),e.$$.dirty&12273&&r&&i!==_&&(Ue(Y,i=_,i),LE(r,i,Xm({type:"geojson",data:x,filter:A,lineMetrics:P,generateId:S,promoteId:L,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),K=>r&&K===i,()=>{i&&(n(11,V=r==null?void 0:r.getSource(i)),n(12,Z=!0))})),e.$$.dirty&8208&&(r==null||r.on("style.load",()=>{n(11,V=r==null?void 0:r.getSource(_))})),e.$$.dirty&6176&&V&&(Z?n(12,Z=!1):V.setData(x)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Xm({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[i,B,U,Y,_,x,S,L,A,P,D,V,Z,r,a,f]}class Ps extends tn{constructor(t){super(),Qe(this,t,kE,PE,He,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function AE(e,t,n){let i;const{map:r}=sf();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 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 NE extends tn{constructor(t){super(),Qe(this,t,AE,null,He,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function DE(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function RE(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:[DE]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function OE(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:D=void 0}=t,{hoverCursor:B=void 0}=t,{manageHoverState:U=!1}=t,{hovered:Y=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:Z=!0}=t;function K(_t){Y=_t,n(0,Y)}function it(_t){ii.call(this,e,_t)}function mt(_t){ii.call(this,e,_t)}function ht(_t){ii.call(this,e,_t)}function gt(_t){ii.call(this,e,_t)}function lt(_t){ii.call(this,e,_t)}function It(_t){ii.call(this,e,_t)}return e.$$set=_t=>{"id"in _t&&n(1,l=_t.id),"source"in _t&&n(2,f=_t.source),"sourceLayer"in _t&&n(3,a=_t.sourceLayer),"beforeId"in _t&&n(4,_=_t.beforeId),"beforeLayerType"in _t&&n(5,x=_t.beforeLayerType),"paint"in _t&&n(6,S=_t.paint),"layout"in _t&&n(7,L=_t.layout),"filter"in _t&&n(8,A=_t.filter),"minzoom"in _t&&n(9,P=_t.minzoom),"maxzoom"in _t&&n(10,D=_t.maxzoom),"hoverCursor"in _t&&n(11,B=_t.hoverCursor),"manageHoverState"in _t&&n(12,U=_t.manageHoverState),"hovered"in _t&&n(0,Y=_t.hovered),"eventsIfTopMost"in _t&&n(13,V=_t.eventsIfTopMost),"interactive"in _t&&n(14,Z=_t.interactive),"$$scope"in _t&&n(23,r=_t.$$scope)},[Y,l,f,a,_,x,S,L,A,P,D,B,U,V,Z,i,K,it,mt,ht,gt,lt,It,r]}class ru extends tn{constructor(t){super(),Qe(this,t,OE,RE,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 zE(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 FE(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]"?VE(e,t):BE(e,t)}function BE(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 GE extends tn{constructor(t){super(),Qe(this,t,UE,null,He,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function jE(e,t,n){let i;const{map:r}=sf();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 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 qE extends tn{constructor(t){super(),Qe(this,t,jE,null,He,{position:1,maxWidth:2,unit:3})}}const ZE=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),St(f,t,a),l&&l.m(f,a),n=!0},p(f,a){f[2]?i?(i.p(f,a),a[0]&4&&dt(i,1)):(i=Hv(f),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi()),l&&l.p&&(!n||a[0]&56|a[1]&4)&&lr(l,r,f,f[33],n?ar(r,f[33],a,ZE):ur(f[33]),Wv)},i(f){n||(dt(i),dt(l,f),n=!0)},o(f){vt(i),vt(l,f),n=!1},d(f){f&&wt(t),i&&i.d(f),l&&l.d(f)}}}function Hv(e){let t,n,i,r,l,f,a,_;return t=new GE({props:{position:e[6]}}),i=new NE({props:{position:e[6],fitBoundsOptions:{maxZoom:12}}}),l=new TE({props:{position:e[6]}}),a=new qE({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),St(x,n,S),jt(i,x,S),St(x,r,S),jt(l,x,S),St(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 D={};S[0]&64&&(D.position=x[6]),a.$set(D)},i(x){_||(dt(t.$$.fragment,x),dt(i.$$.fragment,x),dt(l.$$.fragment,x),dt(a.$$.fragment,x),_=!0)},o(x){vt(t.$$.fragment,x),vt(i.$$.fragment,x),vt(l.$$.fragment,x),vt(a.$$.fragment,x),_=!1},d(x){x&&(wt(n),wt(r),wt(f)),qt(t,x),qt(i,x),qt(l,x),qt(a,x)}}}function $E(e){let t,n,i,r,l,f=e[3]&&e[0]&&Xv(e);return{c(){t=yt("div"),f&&f.c(),Rt(t,"class",n=Zm(e[1])+" svelte-p00lfq"),hl(t,"expand-map",!e[1])},m(a,_){St(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&&dt(f,1)):(f=Xv(a),f.c(),dt(f,1),f.m(t,null)):f&&(hi(),vt(f,1,1,()=>{f=null}),fi()),(!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||(dt(f),i=!0)},o(a){vt(f),i=!1},d(a){a&&wt(t),f&&f.d(),r=!1,l()}}}function WE(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:D=void 0}=t,{pitch:B=0}=t,{bearing:U=0}=t,{bounds:Y=void 0}=t,{hash:V=!1}=t,{loaded:Z=!1}=t,{minZoom:K=0}=t,{maxZoom:it=22}=t,{zoomOnDoubleClick:mt=!0}=t,{interactive:ht=!0}=t,{attributionControl:gt=!0}=t,{cooperativeGestures:lt=!1}=t,{preserveDrawingBuffer:It=!1}=t,{maxBounds:_t=void 0}=t,{images:bt=[]}=t,{standardControls:ee=!1}=t,{filterLayers:kt=void 0}=t,{transformRequest:Gt=void 0}=t;const Qt=Dc(),{map:ne,loadedImages:Ie}=cE();Ee(e,ne,oe=>n(3,l=oe)),Ee(e,Ie,oe=>n(4,f=oe));let bn=new Set;function Zn(oe){l!=null&&l.loaded()&&("url"in oe?(bn.add(oe.id),l.loadImage(oe.url,(Ge,pn)=>{bn.delete(oe.id),Ge?Qt("error",Ge):pn&&(l==null||l.addImage(oe.id,pn,oe.options),f.add(oe.id),Ie.set(f))})):(l.addImage(oe.id,oe.data,oe.options),f.add(oe.id),Ie.set(f)))}let en,Be,Ve,dn;function Fn(oe){if(V){let Ge=FE(window.location.hash);Ge.length>=3&&(n(11,D=Ge[0]),n(10,P=[Ge[2],Ge[1]])),Ge.length==5&&(n(15,U=Ge[3]),n(14,B=Ge[4]))}return Ue(ne,l=new Ms.Map(Xm({container:oe,style:L,center:P,zoom:D,pitch:B,bearing:U,minZoom:K,maxZoom:it,interactive:ht,preserveDrawingBuffer:It,maxBounds:_t,bounds:Y,attributionControl:gt,transformRequest:Gt,cooperativeGestures:lt})),l),l.on("load",Ge=>{n(0,Z=!0),Qt("load",l)}),l.on("error",Ge=>Qt("error",{...Ge,map:l})),l.on("movestart",Ge=>Qt("movestart",{...Ge,map:l})),l.on("moveend",Ge=>{if(n(10,P=Ge.target.getCenter()),n(11,D=Ge.target.getZoom()),n(12,Y=Ge.target.getBounds()),Qt("moveend",{...Ge,map:l}),V){let pn=window.location.href.replace(/(#.+)?$/,zE(l));window.history.replaceState(window.history.state,"",pn)}}),l.on("zoomstart",Ge=>Qt("zoomstart",{...Ge,map:l})),l.on("zoom",Ge=>{n(11,D=Ge.target.getZoom()),Qt("zoom",{...Ge,map:l})}),l.on("zoomend",Ge=>{n(11,D=Ge.target.getZoom()),Qt("zoomend",{...Ge,map:l})}),l.on("style.load",()=>{if(l){const Ge=l.getStyle();if(n(30,en=Ge.layers.map(pn=>pn.id)),n(31,Be=Object.keys(Ge.sources)),dn)for(const[pn,Bn]of Object.entries(dn))l.addSource(pn,Bn);if(Ve)for(const pn of Ve)l.addLayer(pn)}}),l.on("styledata",Ge=>{if(l&&kt){const pn=l.getStyle().layers;if(pn)for(let Bn of pn)kt(Bn)||l.setLayoutProperty(Bn.id,"visibility","none")}Qt("styledata",{...Ge,map:l})}),{destroy(){n(0,Z=!1),l==null||l.remove(),Ue(ne,l=null,l)}}}let xn=L;return e.$$set=oe=>{"map"in oe&&n(13,x=oe.map),"class"in oe&&n(1,S=oe.class),"style"in oe&&n(16,L=oe.style),"diffStyleUpdates"in oe&&n(17,A=oe.diffStyleUpdates),"center"in oe&&n(10,P=oe.center),"zoom"in oe&&n(11,D=oe.zoom),"pitch"in oe&&n(14,B=oe.pitch),"bearing"in oe&&n(15,U=oe.bearing),"bounds"in oe&&n(12,Y=oe.bounds),"hash"in oe&&n(18,V=oe.hash),"loaded"in oe&&n(0,Z=oe.loaded),"minZoom"in oe&&n(19,K=oe.minZoom),"maxZoom"in oe&&n(20,it=oe.maxZoom),"zoomOnDoubleClick"in oe&&n(21,mt=oe.zoomOnDoubleClick),"interactive"in oe&&n(22,ht=oe.interactive),"attributionControl"in oe&&n(23,gt=oe.attributionControl),"cooperativeGestures"in oe&&n(24,lt=oe.cooperativeGestures),"preserveDrawingBuffer"in oe&&n(25,It=oe.preserveDrawingBuffer),"maxBounds"in oe&&n(26,_t=oe.maxBounds),"images"in oe&&n(27,bt=oe.images),"standardControls"in oe&&n(2,ee=oe.standardControls),"filterLayers"in oe&&n(28,kt=oe.filterLayers),"transformRequest"in oe&&n(29,Gt=oe.transformRequest),"$$scope"in oe&&n(33,_=oe.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&4&&n(6,i=typeof ee=="boolean"?void 0:ee),e.$$.dirty[0]&8&&n(13,x=l),e.$$.dirty[0]&134217737&&Z&&l!=null&&l.loaded())for(let oe of bt)!bn.has(oe.id)&&!l.hasImage(oe.id)&&Zn(oe);if(e.$$.dirty[0]&134217744&&n(5,r=bt.every(oe=>f.has(oe.id))),e.$$.dirty[0]&1073938440|e.$$.dirty[1]&3&&l&&!Pm(L,xn)){const oe=l.getStyle();if(en&&(Ve=oe.layers.filter(Ge=>!en.includes(Ge.id))),Be){const Ge=Object.keys(oe.sources).filter(pn=>!Be.includes(pn));dn={};for(const pn of Ge)dn[pn]=oe.sources[pn]}n(32,xn=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&&D&&!Pm(D,l==null?void 0:l.getZoom())&&(l==null||l.zoomTo(D)),e.$$.dirty[0]&4104&&Y&&!Pm(Y,l==null?void 0:l.getBounds())&&(l==null||l.fitBounds(Y)),e.$$.dirty[0]&2097160&&(mt?l==null||l.doubleClickZoom.enable():l==null||l.doubleClickZoom.disable())},[Z,S,ee,l,f,r,i,ne,Ie,Fn,P,D,Y,x,B,U,L,A,V,K,it,mt,ht,gt,lt,It,_t,bt,kt,Gt,en,Be,xn,_,a]}class XE extends tn{constructor(t){super(),Qe(this,t,WE,$E,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 HE(e){let t,n,i,r,l,f,a;const _=e[17].default,x=sr(_,e,e[16],null);return{c(){t=yt("div"),x&&x.c(),Rt(t,"tabindex",n=e[1]?0:void 0),Rt(t,"role",i=e[1]?"button":void 0),ri(t,"z-index",e[2])},m(S,L){St(S,t,L),x&&x.m(t,null),l=!0,f||(a=[Q_(e[6].call(null,t)),Q_(r=YE.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&&ri(t,"z-index",S[2])},i(S){l||(dt(x,S),l=!0)},o(S){vt(x,S),l=!1},d(S){S&&wt(t),x&&x.d(S),f=!1,No(a)}}}function YE(e,t){const n=e.className;function i(r){r?e.className=`${n} ${r}`:e.className=n}return i(t),{update:i}}function KE(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:D=void 0}=t,{zIndex:B=void 0}=t,{rotation:U=0}=t;const Y=Dc(),{map:V,layerEvent:Z,self:K}=pE();Ee(e,V,Gt=>n(25,l=Gt)),Ee(e,Z,Gt=>n(24,i=Gt)),Ee(e,K,Gt=>n(15,r=Gt));function it(Gt){Ue(K,r=new Ms.Marker({element:Gt,rotation:U,draggable:A,offset:D}).setLngLat(_).addTo(l),r);const Qt=()=>gt("dragstart"),ne=()=>{mt(),gt("drag")},Ie=()=>{mt(),gt("dragend")};return A&&(r.on("dragstart",Qt),r.on("drag",ne),r.on("dragend",Ie)),{destroy(){A&&(r==null||r.off("dragstart",Qt),r==null||r.off("drag",ne),r==null||r.off("dragend",Ie)),r==null||r.remove()}}}function mt(){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 ht(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 ne=[Qt.lng,Qt.lat];let Ie={map:l,marker:r,lngLat:ne,features:[{type:"Feature",properties:(P==null?void 0:P.properties)??{},geometry:{type:"Point",coordinates:ne}}]};Ue(Z,i={...Ie,layerType:"marker",type:Gt},i),Y(Gt,Ie)}const lt=()=>gt("click"),It=()=>gt("dblclick"),_t=()=>gt("contextmenu"),bt=Gt=>{gt("mouseenter")},ee=()=>{gt("mouseleave")},kt=()=>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,D=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(D??[0,0])),e.$$.dirty&49152&&(r==null||r.setRotation(U))},[x,L,B,V,Z,K,it,ht,gt,_,S,A,P,D,U,r,a,f,lt,It,_t,bt,ee,kt]}class Yv extends tn{constructor(t){super(),Qe(this,t,KE,HE,He,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14})}}const JE=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=yt("div"),i&&i.c()},m(r,l){St(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&&dt(i,1)):(i=Qv(r),i.c(),dt(i,1),i.m(t,null)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(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,JE):ur(r[29]),Kv)},i(r){t||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function QE(e){let t,n,i=e[9].default&&Jv(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,l){r[9].default?i?(i.p(r,l),l[0]&512&&dt(i,1)):(i=Jv(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function tI(e,t,n){let i,r,l,f,a,_,{$$slots:x={},$$scope:S}=t;const L=kS(x);let{closeButton:A=void 0}=t,{closeOnClickOutside:P=!0}=t,{closeOnClickInside:D=!1}=t,{closeOnMove:B=!1}=t,{openOn:U="click"}=t,{openIfTopMost:Y=!0}=t,{focusAfterOpen:V=!0}=t,{anchor:Z=void 0}=t,{offset:K=void 0}=t,{popupClass:it=void 0}=t,{maxWidth:mt=void 0}=t,{lngLat:ht=void 0}=t,{html:gt=void 0}=t,{open:lt=!1}=t;const{map:It,popupTarget:_t,layerEvent:bt,layer:ee,eventTopMost:kt}=sf();Ee(e,It,Lt=>n(2,l=Lt)),Ee(e,_t,Lt=>n(3,a=Lt)),Ee(e,bt,Lt=>n(28,f=Lt)),Ee(e,ee,Lt=>n(35,_=Lt));const Gt=["click","dblclick","contextmenu"];let Qt,ne=!1,Ie;function bn(){if(!Qt)return;let Lt=Qt.getElement();!Lt||Lt===Ie||(Ie=Lt,U==="hover"&&(Ie.style.pointerEvents="none"),Ie.addEventListener("mouseenter",()=>{n(24,ne=!0)},{passive:!0}),Ie.addEventListener("mouseleave",()=>{n(24,ne=!1)},{passive:!0}),Ie.addEventListener("click",()=>{D&&n(0,lt=!1)},{passive:!0}))}dg(()=>{if(l)return l.on("click",pn),l.on("contextmenu",pn),typeof a=="string"&&(l.on("click",a,Ve),l.on("dblclick",a,Ve),l.on("contextmenu",a,Ve),l.on("mousemove",a,Ge),l.on("mouseleave",a,oe),l.on("touchstart",a,Fn),l.on("touchend",a,xn)),()=>{l!=null&&l.loaded()&&(Qt==null||Qt.remove(),l.off("click",pn),l.off("contextmenu",pn),a instanceof Ms.Marker?a.getPopup()===Qt&&a.setPopup(void 0):typeof a=="string"&&(l.off("click",a,Ve),l.off("dblclick",a,Ve),l.off("contextmenu",a,Ve),l.off("mousemove",a,Ge),l.off("mouseleave",a,oe),l.off("touchstart",a,Fn),l.off("touchend",a,xn)))}});function Zn(Lt){return Y?!("marker"in Lt)&&!dE(Lt)&&kt(Lt)!==_:!1}let en=null,Be="normal";function Ve(Lt){Lt.type===U&&(Zn(Lt)||("layerType"in Lt?Lt.layerType==="deckgl"?(n(10,ht=Lt.coordinate),n(4,en=Lt.object?[Lt.object]:null)):(n(10,ht=Lt.lngLat),n(4,en=Lt.features??[])):(n(10,ht=Lt.lngLat),n(4,en=Lt.features??[])),setTimeout(()=>n(0,lt=!0))))}let dn=null;function Fn(Lt){dn=Lt.point}function xn(Lt){if(!dn||U!=="hover")return;let ke=dn.dist(Lt.point);dn=null,ke<3&&(n(10,ht=Lt.lngLat),n(4,en=Lt.features??[]),Qt.isOpen()?n(25,Be="justOpened"):(n(25,Be="opening"),n(0,lt=!0)))}function oe(Lt){U!=="hover"||dn||Be!=="normal"||(n(0,lt=!1),n(4,en=null))}function Ge(Lt){if(!(U!=="hover"||dn||Be!=="normal")){if(Zn(Lt)){n(0,lt=!1),n(4,en=null);return}n(0,lt=!0),n(4,en=Lt.features??[]),n(10,ht=Lt.lngLat)}}function pn(Lt){if(Be==="justOpened"){n(25,Be="normal");return}if(!P)return;let ke=[Ie,a instanceof Ms.Marker?a==null?void 0:a.getElement():null];lt&&Qt.isOpen()&&!ke.some(xe=>xe==null?void 0:xe.contains(Lt.originalEvent.target))&&(Lt.type==="contextmenu"&&U==="contextmenu"||Lt.type!=="contextmenu")&&n(0,lt=!1)}aa(()=>{l&&(Qt!=null&&Qt.isOpen())&&Qt.remove()});let Bn;const yi=()=>n(0,lt=!1);function Ai(Lt){cr[Lt?"unshift":"push"](()=>{Bn=Lt,n(1,Bn)})}return e.$$set=Lt=>{"closeButton"in Lt&&n(11,A=Lt.closeButton),"closeOnClickOutside"in Lt&&n(12,P=Lt.closeOnClickOutside),"closeOnClickInside"in Lt&&n(13,D=Lt.closeOnClickInside),"closeOnMove"in Lt&&n(14,B=Lt.closeOnMove),"openOn"in Lt&&n(15,U=Lt.openOn),"openIfTopMost"in Lt&&n(16,Y=Lt.openIfTopMost),"focusAfterOpen"in Lt&&n(17,V=Lt.focusAfterOpen),"anchor"in Lt&&n(18,Z=Lt.anchor),"offset"in Lt&&n(19,K=Lt.offset),"popupClass"in Lt&&n(20,it=Lt.popupClass),"maxWidth"in Lt&&n(21,mt=Lt.maxWidth),"lngLat"in Lt&&n(10,ht=Lt.lngLat),"html"in Lt&&n(22,gt=Lt.html),"open"in Lt&&n(0,lt=Lt.open),"$$scope"in Lt&&n(29,S=Lt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,i=A??(!P&&!D)),e.$$.dirty[0]&146685952&&(Qt||(n(23,Qt=new Ms.Popup({closeButton:i,closeOnClick:!1,closeOnMove:B,focusAfterOpen:V,maxWidth:mt,className:it,anchor:Z,offset:K})),Ie=Qt.getElement(),Qt.on("open",()=>{n(0,lt=!0),bn()}),Qt.on("close",Lt=>{n(0,lt=!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&&(Ve(f),Ue(bt,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"&&bt&&(r&&f&&(f.layerType==="deckgl"?(n(10,ht=f.coordinate),n(4,en=f.object?[f.object]:null)):(n(10,ht=f.lngLat),n(4,en=f.features??[]))),n(0,lt=(r||ne)??!1)),e.$$.dirty[0]&12582914&&(Bn?Qt.setDOMContent(Bn):gt&&Qt.setHTML(gt)),e.$$.dirty[0]&8389632&&ht&&Qt.setLngLat(ht),e.$$.dirty[0]&41943045&&l){let Lt=Qt.isOpen();lt&&!Lt?(Qt.addTo(l),Be==="opening"&&n(25,Be="justOpened")):!lt&&Lt&&Qt.remove()}},[lt,Bn,l,a,en,It,_t,bt,ee,L,ht,A,P,D,B,U,Y,V,Z,K,it,mt,gt,Qt,ne,Be,r,i,f,S,x,yi,Ai]}class eI extends tn{constructor(t){super(),Qe(this,t,tI,QE,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 nI(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function iI(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:[nI]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function rI(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:D=void 0}=t,{maxzoom:B=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:Z=!1}=t,{interactive:K=!0}=t;function it(bt){V=bt,n(0,V)}function mt(bt){ii.call(this,e,bt)}function ht(bt){ii.call(this,e,bt)}function gt(bt){ii.call(this,e,bt)}function lt(bt){ii.call(this,e,bt)}function It(bt){ii.call(this,e,bt)}function _t(bt){ii.call(this,e,bt)}return e.$$set=bt=>{"id"in bt&&n(1,l=bt.id),"source"in bt&&n(2,f=bt.source),"sourceLayer"in bt&&n(3,a=bt.sourceLayer),"beforeId"in bt&&n(4,_=bt.beforeId),"beforeLayerType"in bt&&n(5,x=bt.beforeLayerType),"paint"in bt&&n(6,S=bt.paint),"layout"in bt&&n(7,L=bt.layout),"filter"in bt&&n(8,A=bt.filter),"applyToClusters"in bt&&n(9,P=bt.applyToClusters),"minzoom"in bt&&n(10,D=bt.minzoom),"maxzoom"in bt&&n(11,B=bt.maxzoom),"hoverCursor"in bt&&n(12,U=bt.hoverCursor),"manageHoverState"in bt&&n(13,Y=bt.manageHoverState),"hovered"in bt&&n(0,V=bt.hovered),"eventsIfTopMost"in bt&&n(14,Z=bt.eventsIfTopMost),"interactive"in bt&&n(15,K=bt.interactive),"$$scope"in bt&&n(24,r=bt.$$scope)},[V,l,f,a,_,x,S,L,A,P,D,B,U,Y,Z,K,i,it,mt,ht,gt,lt,It,_t,r]}class ox extends tn{constructor(t){super(),Qe(this,t,rI,iI,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,sx=Uint16Array,oI=Int32Array,sI=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]),aI=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]),ax=function(e,t){for(var n=new sx(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,cI[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,hI=new fd(32);for(ni=0;ni<32;++ni)hI[ni]=5;var ni,fI=new fd(0),pI=typeof TextDecoder<"u"&&new TextDecoder,dI=0;try{pI.decode(fI,{stream:!0}),dI=1}catch{}const ux=ui({type:"FeatureCollection",features:[]}),mI=ui(!0),cx=ui(0),gI=30;class _I{constructor(t,n){Wn(this,"map");Wn(this,"inner");Wn(this,"active");Wn(this,"eventListenersSuccess");Wn(this,"eventListenersUpdated");Wn(this,"eventListenersFailure");Wn(this,"onMouseMove",t=>{if(!this.active)return;const n=[t.point.x-gI,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())});Wn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});Wn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.inner.onClick(),this.finish())});Wn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});Wn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});Wn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});Wn(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());ux.set(t),this.map.getCanvas().style.cursor=t.cursor,mI.set(t.snap_mode),cx.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 Ru=ui(null),hx=ui(`https://api.maptiler.com/maps/dataviz/style.json?key=${ky}`),ku=ui(""),Hm=ui(!0),oy=ui(null),sy=ui(null),ay=ui(null),Xo=ui(null),qp=ui(null),Ym=ui(new mg.LngLat(0,0)),Km=ui(new mg.LngLat(0,0)),Lu=ui(1),En=ui({mode:"title"}),ly=ui("walk_cycle_only");function yI(e){let t,n,i,r,l,f,a,_,x;return{c(){t=yt("label"),n=ge(`Basemap: - `),i=yt("select"),r=yt("option"),r.textContent="MapTiler Dataviz",l=yt("option"),l.textContent="MapTiler Streets",f=yt("option"),f.textContent="MapTiler Satellite",a=yt("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){St(S,t,L),ft(t,n),ft(t,i),ft(i,r),ft(i,l),ft(i,f),ft(i,a),$m(i,e[0],!0),_||(x=Ze(i,"change",e[1]),_=!0)},p(S,[L]){L&1&&$m(i,S[0])},i:Ce,o:Ce,d(S){S&&wt(t),_=!1,x()}}}function vI(e,t,n){let i="dataviz";function r(){i=jb(this),n(0,i)}return e.$$.update=()=>{e.$$.dirty&1&&hx.set(`https://api.maptiler.com/maps/${i}/style.json?key=${ky}`)},[i,r]}class bI extends tn{constructor(t){super(),Qe(this,t,vI,yI,He,{})}}var xI=Object.defineProperty,wI=(e,t,n)=>t in e?xI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t1=(e,t,n)=>(wI(e,typeof t!="symbol"?t+"":t,n),n);function Zp(){}function fx(e){return e()}function e1(){return Object.create(null)}function yg(e){e.forEach(fx)}function px(e){return typeof e=="function"}function SI(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function EI(e){return Object.keys(e).length===0}function II(e,t){e.appendChild(t)}function CI(e,t,n){e.insertBefore(t,n||null)}function dx(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 TI(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=[],LI=Promise.resolve();let uy=!1;function MI(){uy||(uy=!0,LI.then(mx))}function cy(e){Rh.push(e)}const W_=new Set;let Th=0;function mx(){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 AI=new Set;function NI(e,t){e&&e.i&&(AI.delete(e),e.i(t))}function DI(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),cy(()=>{const l=e.$$.on_mount.map(fx).filter(px);e.$$.on_destroy?e.$$.on_destroy.push(...l):yg(l),e.$$.on_mount=[]}),r.forEach(cy)}function RI(e,t){const n=e.$$;n.fragment!==null&&(kI(n.after_update),yg(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function OI(e,t){e.$$.dirty[0]===-1&&(kh.push(e),MI(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const D=P.length?P[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=D)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](D),S&&OI(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=TI(t.target);x.fragment&&x.fragment.l(L),L.forEach(dx)}else x.fragment&&x.fragment.c();t.intro&&NI(e.$$.fragment),DI(e,t.target,t.anchor),mx()}Vp(_)}class FI{constructor(){t1(this,"$$"),t1(this,"$$set")}$destroy(){RI(this,1),this.$destroy=Zp}$on(t,n){if(!px(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&&!EI(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const BI="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(BI);function VI(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){CI(r,t,l),II(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&&dx(t)}}}function UI(e,t,n){let{displayIn:i}=t;return e.$$set=r=>{"displayIn"in r&&n(0,i=r.displayIn)},[i]}class GI extends FI{constructor(t){super(),zI(this,t,UI,VI,SI,{displayIn:0})}}const jI=[{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"}],qI={decimalLatitude:40.123,decimalLongitude:-74.123},ZI=[{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}],$I=[{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 WI(){const e=[];return jI.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...qI})}),[...e,...ZI,...$I]}const XI=WI();XI.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 De}getCameraTargetElevation(){return this.transform.elevation}},jn.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}},jn.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=Ve.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({},Ri,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,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)}},jn.AttributionControl=Bo,jn.LogoControl=di,jn.ScaleControl=class{constructor(y){this._onMove=()=>{cc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,cc(this._map,this._container,this.options)},this.options=a.e({},uc,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}},jn.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()}},jn.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}},jn.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()}},jn.Marker=Ml,jn.Style=Rr,jn.LngLat=a.L,jn.LngLatBounds=Ve,jn.Point=a.P,jn.MercatorCoordinate=a.U,jn.Evented=a.E,jn.AJAXError=a.bi,jn.config=a.c,jn.CanvasSource=Ai,jn.GeoJSONSource=je,jn.ImageSource=Bn,jn.RasterDEMTileSource=oe,jn.RasterTileSource=xn,jn.VectorTileSource=Fn,jn.VideoSource=yi,jn.setRTLTextPlugin=a.bj,jn.getRTLTextPluginStatus=a.bk,jn.prewarm=function(){Ha().acquire(Tn)},jn.clearPrewarmedResources=function(){const y=ns;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Tn),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(jn,{isSafari:a.ac,getPerformanceMetrics:a.bg.getPerformanceMetrics}),jn});var f=r;return f})})(ix);var mg=ix.exports;const Ms=ex(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 mE(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 gE(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=_E;function _E(e){var t,n,i;if(e){if(Array.isArray(e)){for(t=[],n=e.length,i=0;i{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function vE(e,t,n){let i,r,l,f,a,_,x,S,L,A,P,D,{$$slots:F={},$$scope:U}=t,{id:Y=of("layer")}=t,{source:V=void 0}=t,{sourceLayer:Z=void 0}=t,{beforeId:K=void 0}=t,{beforeLayerType:it=void 0}=t,{type:mt}=t,{paint:ft=void 0}=t,{layout:gt=void 0}=t,{filter:lt=void 0}=t,{applyToClusters:It=void 0}=t,{minzoom:yt=void 0}=t,{maxzoom:bt=void 0}=t,{manageHoverState:ee=!1}=t,{hovered:kt=null}=t,{interactive:Gt=!0}=t,{hoverCursor:Qt=void 0}=t,{eventsIfTopMost:ne=!1}=t;const Ie=Dc(),{map:bn,source:Zn,self:en,minzoom:Be,maxzoom:Ve,eventTopMost:dn,layerInfo:Fn}=fE();Ee(e,bn,Lt=>n(31,L=Lt)),Ee(e,Zn,Lt=>n(32,A=Lt)),Ee(e,en,Lt=>n(0,S=Lt)),Ee(e,Be,Lt=>n(34,D=Lt)),Ee(e,Ve,Lt=>n(33,P=Lt)),aa(()=>{S&&L&&(Fn.delete(S),L==null||L.removeLayer(S))});let xn;function oe(Lt){var un,mn;if(!Gt||!S||!L||ne&&dn(Lt)!==S)return;let ke=Lt.features??[],xe=(mn=(un=ke[0])==null?void 0:un.properties)==null?void 0:mn.cluster_id,rn={event:Lt,map:L,clusterId:xe,layer:S,source:a,features:ke};Ie(Lt.type,rn)}function je(Lt){var un,mn;if(!Gt||!S||!L||ne&&dn(Lt)!==S)return;Qt&&(L.getCanvas().style.cursor=Qt);let ke=Lt.features??[];n(6,kt=ke[0]??null);let xe=(mn=(un=ke[0])==null?void 0:un.properties)==null?void 0:mn.cluster_id;Ie("mouseenter",{event:Lt,map:L,clusterId:xe,layer:S,source:a,features:ke})}function pn(Lt){var un,mn,Xi;if(!Gt||!L)return;if(ne&&dn(Lt)!==S){n(6,kt=null),ee&&xn!==void 0&&(L==null||L.setFeatureState({source:a,sourceLayer:Z,id:xn},{hover:!1}),xn=void 0);return}L.getCanvas().style.cursor=Qt;let ke=Lt.features??[],xe=(mn=(un=ke[0])==null?void 0:un.properties)==null?void 0:mn.cluster_id,rn=(Xi=ke[0])==null?void 0:Xi.id;rn!==xn&&(ee&&(xn!==void 0&&(L==null||L.setFeatureState({source:a,id:xn,sourceLayer:Z},{hover:!1})),L==null||L.setFeatureState({source:a,id:rn,sourceLayer:Z},{hover:!0})),xn=rn,n(6,kt=ke[0]??null)),Ie("mousemove",{event:Lt,map:L,clusterId:xe,layer:S,source:a,features:ke})}function Bn(Lt){if(!(!Gt||!S||!L)){if(Qt&&(L.getCanvas().style.cursor=""),n(6,kt=null),ee&&xn!==void 0){const ke={source:a,id:xn,sourceLayer:Z};L==null||L.setFeatureState(ke,{hover:!1}),xn=void 0}Ie("mouseleave",{map:L,layer:S,source:a})}}let yi=!0;function Ai(Lt){L&&(L.off("click",Lt,oe),L.off("dblclick",Lt,oe),L.off("contextmenu",Lt,oe),L.off("mouseenter",Lt,je),L.off("mousemove",Lt,pn),L.off("mouseleave",Lt,Bn))}return aa(()=>{L&&S&&Ai(S)}),e.$$set=Lt=>{"id"in Lt&&n(7,Y=Lt.id),"source"in Lt&&n(8,V=Lt.source),"sourceLayer"in Lt&&n(9,Z=Lt.sourceLayer),"beforeId"in Lt&&n(10,K=Lt.beforeId),"beforeLayerType"in Lt&&n(11,it=Lt.beforeLayerType),"type"in Lt&&n(12,mt=Lt.type),"paint"in Lt&&n(13,ft=Lt.paint),"layout"in Lt&&n(14,gt=Lt.layout),"filter"in Lt&&n(15,lt=Lt.filter),"applyToClusters"in Lt&&n(16,It=Lt.applyToClusters),"minzoom"in Lt&&n(17,yt=Lt.minzoom),"maxzoom"in Lt&&n(18,bt=Lt.maxzoom),"manageHoverState"in Lt&&n(19,ee=Lt.manageHoverState),"hovered"in Lt&&n(6,kt=Lt.hovered),"interactive"in Lt&&n(20,Gt=Lt.interactive),"hoverCursor"in Lt&&n(21,Qt=Lt.hoverCursor),"eventsIfTopMost"in Lt&&n(22,ne=Lt.eventsIfTopMost),"$$scope"in Lt&&n(35,U=Lt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,i=gE(It)),e.$$.dirty[0]&1073774592&&n(24,r=mE("all",i,lt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=yt??D),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,f=bt??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&&(Ai(S),Fn.delete(S));let Lt=K;if(!K&&it){let ke=L.getStyle().layers,xe=typeof it=="function"?it:un=>un.type===it,rn=ke==null?void 0:ke.find(xe);rn&&(Lt=rn.id)}Ue(en,S=Y,S),L.addLayer(Xm({id:S,type:mt,source:a,"source-layer":Z,filter:r,paint:ft,layout:gt,minzoom:l,maxzoom:f}),Lt),n(23,yi=!0),L.on("click",S,oe),L.on("dblclick",S,oe),L.on("contextmenu",S,oe),L.on("mouseenter",S,je),L.on("mousemove",S,pn),L.on("mouseleave",S,Bn)}e.$$.dirty[0]&1048577&&S&&Fn.set(S,{interactive:Gt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,_=S?Uv((Lt,ke)=>L==null?void 0:L.setPaintProperty(S,Lt,ke)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,x=S?Uv((Lt,ke)=>L==null?void 0:L.setLayoutProperty(S,Lt,ke)):void 0),e.$$.dirty[0]&268443648&&(_==null||_(ft)),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&&(yi?n(23,yi=!1):L==null||L.setFilter(S,r))},[S,bn,Zn,en,Be,Ve,kt,Y,V,Z,K,it,mt,ft,gt,lt,It,yt,bt,ee,Gt,Qt,ne,yi,r,f,l,x,_,a,i,L,A,P,D,U,F]}class gg extends tn{constructor(t){super(),Qe(this,t,vE,yE,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 bE(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function xE(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:[bE]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function wE(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:D=void 0}=t,{maxzoom:F=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:Z=!1}=t,{interactive:K=!0}=t;function it(bt){V=bt,n(0,V)}function mt(bt){ii.call(this,e,bt)}function ft(bt){ii.call(this,e,bt)}function gt(bt){ii.call(this,e,bt)}function lt(bt){ii.call(this,e,bt)}function It(bt){ii.call(this,e,bt)}function yt(bt){ii.call(this,e,bt)}return e.$$set=bt=>{"id"in bt&&n(1,l=bt.id),"source"in bt&&n(2,f=bt.source),"sourceLayer"in bt&&n(3,a=bt.sourceLayer),"beforeId"in bt&&n(4,_=bt.beforeId),"beforeLayerType"in bt&&n(5,x=bt.beforeLayerType),"paint"in bt&&n(6,S=bt.paint),"layout"in bt&&n(7,L=bt.layout),"filter"in bt&&n(8,A=bt.filter),"applyToClusters"in bt&&n(9,P=bt.applyToClusters),"minzoom"in bt&&n(10,D=bt.minzoom),"maxzoom"in bt&&n(11,F=bt.maxzoom),"hoverCursor"in bt&&n(12,U=bt.hoverCursor),"manageHoverState"in bt&&n(13,Y=bt.manageHoverState),"hovered"in bt&&n(0,V=bt.hovered),"eventsIfTopMost"in bt&&n(14,Z=bt.eventsIfTopMost),"interactive"in bt&&n(15,K=bt.interactive),"$$scope"in bt&&n(24,r=bt.$$scope)},[V,l,f,a,_,x,S,L,A,P,D,F,U,Y,Z,K,i,it,mt,ft,gt,lt,It,yt,r]}class hd extends tn{constructor(t){super(),Qe(this,t,wE,xE,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 SE(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function EE(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:[SE]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function IE(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:D=void 0}=t,{hoverCursor:F=void 0}=t,{manageHoverState:U=!1}=t,{hovered:Y=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:Z=!0}=t;function K(yt){Y=yt,n(0,Y)}function it(yt){ii.call(this,e,yt)}function mt(yt){ii.call(this,e,yt)}function ft(yt){ii.call(this,e,yt)}function gt(yt){ii.call(this,e,yt)}function lt(yt){ii.call(this,e,yt)}function It(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,D=yt.maxzoom),"hoverCursor"in yt&&n(11,F=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,Z=yt.interactive),"$$scope"in yt&&n(23,r=yt.$$scope)},[Y,l,f,a,_,x,S,L,A,P,D,F,U,V,Z,i,K,it,mt,ft,gt,lt,It,r]}class af extends tn{constructor(t){super(),Qe(this,t,IE,EE,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 CE(e,t,n){let i;const{map:r}=sf();Ee(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 TE extends tn{constructor(t){super(),Qe(this,t,CE,null,He,{position:1,container:2})}}function LE(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 ME(e,t,n){zS().then(()=>{let i=Ub(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=Do()},m(l,f){r.m(l,f),St(l,n,f),i=!0},p(l,f){f&1&&He(t,t=l[0])?(hi(),vt(r,1,1,Me),fi(),r=Zv(l),r.c(),dt(r,1),r.m(n.parentNode,n)):r.p(l,f)},i(l){i||(dt(r),i=!0)},o(l){vt(r),i=!1},d(l){l&&wt(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function PE(e){let t,n,i=e[0]&&qv(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=qv(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function kE(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:D=void 0}=t;const{map:F,cluster:U,self:Y}=hE();Ee(e,F,K=>n(13,r=K)),Ee(e,U,K=>n(16,l=K)),Ee(e,Y,K=>n(0,i=K));let V,Z=!0;return aa(()=>{i&&V&&r&&(ME(F,i,V),Ue(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,D=K.cluster),"$$scope"in K&&n(14,a=K.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Ue(U,l=D,l),e.$$.dirty&12273&&r&&i!==_&&(Ue(Y,i=_,i),LE(r,i,Xm({type:"geojson",data:x,filter:A,lineMetrics:P,generateId:S,promoteId:L,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),K=>r&&K===i,()=>{i&&(n(11,V=r==null?void 0:r.getSource(i)),n(12,Z=!0))})),e.$$.dirty&8208&&(r==null||r.on("style.load",()=>{n(11,V=r==null?void 0:r.getSource(_))})),e.$$.dirty&6176&&V&&(Z?n(12,Z=!1):V.setData(x)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Xm({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[i,F,U,Y,_,x,S,L,A,P,D,V,Z,r,a,f]}class Ps extends tn{constructor(t){super(),Qe(this,t,kE,PE,He,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function AE(e,t,n){let i;const{map:r}=sf();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 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 NE extends tn{constructor(t){super(),Qe(this,t,AE,null,He,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function DE(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function RE(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:[DE]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function OE(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:D=void 0}=t,{hoverCursor:F=void 0}=t,{manageHoverState:U=!1}=t,{hovered:Y=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:Z=!0}=t;function K(yt){Y=yt,n(0,Y)}function it(yt){ii.call(this,e,yt)}function mt(yt){ii.call(this,e,yt)}function ft(yt){ii.call(this,e,yt)}function gt(yt){ii.call(this,e,yt)}function lt(yt){ii.call(this,e,yt)}function It(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,D=yt.maxzoom),"hoverCursor"in yt&&n(11,F=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,Z=yt.interactive),"$$scope"in yt&&n(23,r=yt.$$scope)},[Y,l,f,a,_,x,S,L,A,P,D,F,U,V,Z,i,K,it,mt,ft,gt,lt,It,r]}class ru extends tn{constructor(t){super(),Qe(this,t,OE,RE,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 zE(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 FE(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]"?VE(e,t):BE(e,t)}function BE(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 GE extends tn{constructor(t){super(),Qe(this,t,UE,null,He,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function jE(e,t,n){let i;const{map:r}=sf();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 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 qE extends tn{constructor(t){super(),Qe(this,t,jE,null,He,{position:1,maxWidth:2,unit:3})}}const ZE=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=Wt(),l&&l.c()},m(f,a){i&&i.m(f,a),St(f,t,a),l&&l.m(f,a),n=!0},p(f,a){f[2]?i?(i.p(f,a),a[0]&4&&dt(i,1)):(i=Hv(f),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi()),l&&l.p&&(!n||a[0]&56|a[1]&4)&&lr(l,r,f,f[33],n?ar(r,f[33],a,ZE):ur(f[33]),Wv)},i(f){n||(dt(i),dt(l,f),n=!0)},o(f){vt(i),vt(l,f),n=!1},d(f){f&&wt(t),i&&i.d(f),l&&l.d(f)}}}function Hv(e){let t,n,i,r,l,f,a,_;return t=new GE({props:{position:e[6]}}),i=new NE({props:{position:e[6],fitBoundsOptions:{maxZoom:12}}}),l=new TE({props:{position:e[6]}}),a=new qE({props:{position:e[6]}}),{c(){Zt(t.$$.fragment),n=Wt(),Zt(i.$$.fragment),r=Wt(),Zt(l.$$.fragment),f=Wt(),Zt(a.$$.fragment)},m(x,S){jt(t,x,S),St(x,n,S),jt(i,x,S),St(x,r,S),jt(l,x,S),St(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 D={};S[0]&64&&(D.position=x[6]),a.$set(D)},i(x){_||(dt(t.$$.fragment,x),dt(i.$$.fragment,x),dt(l.$$.fragment,x),dt(a.$$.fragment,x),_=!0)},o(x){vt(t.$$.fragment,x),vt(i.$$.fragment,x),vt(l.$$.fragment,x),vt(a.$$.fragment,x),_=!1},d(x){x&&(wt(n),wt(r),wt(f)),qt(t,x),qt(i,x),qt(l,x),qt(a,x)}}}function $E(e){let t,n,i,r,l,f=e[3]&&e[0]&&Xv(e);return{c(){t=_t("div"),f&&f.c(),Rt(t,"class",n=Zm(e[1])+" svelte-p00lfq"),hl(t,"expand-map",!e[1])},m(a,_){St(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&&dt(f,1)):(f=Xv(a),f.c(),dt(f,1),f.m(t,null)):f&&(hi(),vt(f,1,1,()=>{f=null}),fi()),(!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||(dt(f),i=!0)},o(a){vt(f),i=!1},d(a){a&&wt(t),f&&f.d(),r=!1,l()}}}function WE(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:D=void 0}=t,{pitch:F=0}=t,{bearing:U=0}=t,{bounds:Y=void 0}=t,{hash:V=!1}=t,{loaded:Z=!1}=t,{minZoom:K=0}=t,{maxZoom:it=22}=t,{zoomOnDoubleClick:mt=!0}=t,{interactive:ft=!0}=t,{attributionControl:gt=!0}=t,{cooperativeGestures:lt=!1}=t,{preserveDrawingBuffer:It=!1}=t,{maxBounds:yt=void 0}=t,{images:bt=[]}=t,{standardControls:ee=!1}=t,{filterLayers:kt=void 0}=t,{transformRequest:Gt=void 0}=t;const Qt=Dc(),{map:ne,loadedImages:Ie}=cE();Ee(e,ne,oe=>n(3,l=oe)),Ee(e,Ie,oe=>n(4,f=oe));let bn=new Set;function Zn(oe){l!=null&&l.loaded()&&("url"in oe?(bn.add(oe.id),l.loadImage(oe.url,(je,pn)=>{bn.delete(oe.id),je?Qt("error",je):pn&&(l==null||l.addImage(oe.id,pn,oe.options),f.add(oe.id),Ie.set(f))})):(l.addImage(oe.id,oe.data,oe.options),f.add(oe.id),Ie.set(f)))}let en,Be,Ve,dn;function Fn(oe){if(V){let je=FE(window.location.hash);je.length>=3&&(n(11,D=je[0]),n(10,P=[je[2],je[1]])),je.length==5&&(n(15,U=je[3]),n(14,F=je[4]))}return Ue(ne,l=new Ms.Map(Xm({container:oe,style:L,center:P,zoom:D,pitch:F,bearing:U,minZoom:K,maxZoom:it,interactive:ft,preserveDrawingBuffer:It,maxBounds:yt,bounds:Y,attributionControl:gt,transformRequest:Gt,cooperativeGestures:lt})),l),l.on("load",je=>{n(0,Z=!0),Qt("load",l)}),l.on("error",je=>Qt("error",{...je,map:l})),l.on("movestart",je=>Qt("movestart",{...je,map:l})),l.on("moveend",je=>{if(n(10,P=je.target.getCenter()),n(11,D=je.target.getZoom()),n(12,Y=je.target.getBounds()),Qt("moveend",{...je,map:l}),V){let pn=window.location.href.replace(/(#.+)?$/,zE(l));window.history.replaceState(window.history.state,"",pn)}}),l.on("zoomstart",je=>Qt("zoomstart",{...je,map:l})),l.on("zoom",je=>{n(11,D=je.target.getZoom()),Qt("zoom",{...je,map:l})}),l.on("zoomend",je=>{n(11,D=je.target.getZoom()),Qt("zoomend",{...je,map:l})}),l.on("style.load",()=>{if(l){const je=l.getStyle();if(n(30,en=je.layers.map(pn=>pn.id)),n(31,Be=Object.keys(je.sources)),dn)for(const[pn,Bn]of Object.entries(dn))l.addSource(pn,Bn);if(Ve)for(const pn of Ve)l.addLayer(pn)}}),l.on("styledata",je=>{if(l&&kt){const pn=l.getStyle().layers;if(pn)for(let Bn of pn)kt(Bn)||l.setLayoutProperty(Bn.id,"visibility","none")}Qt("styledata",{...je,map:l})}),{destroy(){n(0,Z=!1),l==null||l.remove(),Ue(ne,l=null,l)}}}let xn=L;return e.$$set=oe=>{"map"in oe&&n(13,x=oe.map),"class"in oe&&n(1,S=oe.class),"style"in oe&&n(16,L=oe.style),"diffStyleUpdates"in oe&&n(17,A=oe.diffStyleUpdates),"center"in oe&&n(10,P=oe.center),"zoom"in oe&&n(11,D=oe.zoom),"pitch"in oe&&n(14,F=oe.pitch),"bearing"in oe&&n(15,U=oe.bearing),"bounds"in oe&&n(12,Y=oe.bounds),"hash"in oe&&n(18,V=oe.hash),"loaded"in oe&&n(0,Z=oe.loaded),"minZoom"in oe&&n(19,K=oe.minZoom),"maxZoom"in oe&&n(20,it=oe.maxZoom),"zoomOnDoubleClick"in oe&&n(21,mt=oe.zoomOnDoubleClick),"interactive"in oe&&n(22,ft=oe.interactive),"attributionControl"in oe&&n(23,gt=oe.attributionControl),"cooperativeGestures"in oe&&n(24,lt=oe.cooperativeGestures),"preserveDrawingBuffer"in oe&&n(25,It=oe.preserveDrawingBuffer),"maxBounds"in oe&&n(26,yt=oe.maxBounds),"images"in oe&&n(27,bt=oe.images),"standardControls"in oe&&n(2,ee=oe.standardControls),"filterLayers"in oe&&n(28,kt=oe.filterLayers),"transformRequest"in oe&&n(29,Gt=oe.transformRequest),"$$scope"in oe&&n(33,_=oe.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&4&&n(6,i=typeof ee=="boolean"?void 0:ee),e.$$.dirty[0]&8&&n(13,x=l),e.$$.dirty[0]&134217737&&Z&&l!=null&&l.loaded())for(let oe of bt)!bn.has(oe.id)&&!l.hasImage(oe.id)&&Zn(oe);if(e.$$.dirty[0]&134217744&&n(5,r=bt.every(oe=>f.has(oe.id))),e.$$.dirty[0]&1073938440|e.$$.dirty[1]&3&&l&&!Pm(L,xn)){const oe=l.getStyle();if(en&&(Ve=oe.layers.filter(je=>!en.includes(je.id))),Be){const je=Object.keys(oe.sources).filter(pn=>!Be.includes(pn));dn={};for(const pn of je)dn[pn]=oe.sources[pn]}n(32,xn=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&&D&&!Pm(D,l==null?void 0:l.getZoom())&&(l==null||l.zoomTo(D)),e.$$.dirty[0]&4104&&Y&&!Pm(Y,l==null?void 0:l.getBounds())&&(l==null||l.fitBounds(Y)),e.$$.dirty[0]&2097160&&(mt?l==null||l.doubleClickZoom.enable():l==null||l.doubleClickZoom.disable())},[Z,S,ee,l,f,r,i,ne,Ie,Fn,P,D,Y,x,F,U,L,A,V,K,it,mt,ft,gt,lt,It,yt,bt,kt,Gt,en,Be,xn,_,a]}class XE extends tn{constructor(t){super(),Qe(this,t,WE,$E,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 HE(e){let t,n,i,r,l,f,a;const _=e[17].default,x=sr(_,e,e[16],null);return{c(){t=_t("div"),x&&x.c(),Rt(t,"tabindex",n=e[1]?0:void 0),Rt(t,"role",i=e[1]?"button":void 0),ri(t,"z-index",e[2])},m(S,L){St(S,t,L),x&&x.m(t,null),l=!0,f||(a=[Q_(e[6].call(null,t)),Q_(r=YE.call(null,t,e[0])),Ge(t,"click",e[18]),Ge(t,"dblclick",e[19]),Ge(t,"contextmenu",e[20]),Ge(t,"mouseenter",e[21]),Ge(t,"mouseleave",e[22]),Ge(t,"mousemove",e[23]),Ge(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&&ri(t,"z-index",S[2])},i(S){l||(dt(x,S),l=!0)},o(S){vt(x,S),l=!1},d(S){S&&wt(t),x&&x.d(S),f=!1,yo(a)}}}function YE(e,t){const n=e.className;function i(r){r?e.className=`${n} ${r}`:e.className=n}return i(t),{update:i}}function KE(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:D=void 0}=t,{zIndex:F=void 0}=t,{rotation:U=0}=t;const Y=Dc(),{map:V,layerEvent:Z,self:K}=pE();Ee(e,V,Gt=>n(25,l=Gt)),Ee(e,Z,Gt=>n(24,i=Gt)),Ee(e,K,Gt=>n(15,r=Gt));function it(Gt){Ue(K,r=new Ms.Marker({element:Gt,rotation:U,draggable:A,offset:D}).setLngLat(_).addTo(l),r);const Qt=()=>gt("dragstart"),ne=()=>{mt(),gt("drag")},Ie=()=>{mt(),gt("dragend")};return A&&(r.on("dragstart",Qt),r.on("drag",ne),r.on("dragend",Ie)),{destroy(){A&&(r==null||r.off("dragstart",Qt),r==null||r.off("drag",ne),r==null||r.off("dragend",Ie)),r==null||r.remove()}}}function mt(){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 ft(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 ne=[Qt.lng,Qt.lat];let Ie={map:l,marker:r,lngLat:ne,features:[{type:"Feature",properties:(P==null?void 0:P.properties)??{},geometry:{type:"Point",coordinates:ne}}]};Ue(Z,i={...Ie,layerType:"marker",type:Gt},i),Y(Gt,Ie)}const lt=()=>gt("click"),It=()=>gt("dblclick"),yt=()=>gt("contextmenu"),bt=Gt=>{gt("mouseenter")},ee=()=>{gt("mouseleave")},kt=()=>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,D=Gt.offset),"zIndex"in Gt&&n(2,F=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(D??[0,0])),e.$$.dirty&49152&&(r==null||r.setRotation(U))},[x,L,F,V,Z,K,it,ft,gt,_,S,A,P,D,U,r,a,f,lt,It,yt,bt,ee,kt]}class Yv extends tn{constructor(t){super(),Qe(this,t,KE,HE,He,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14})}}const JE=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=_t("div"),i&&i.c()},m(r,l){St(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&&dt(i,1)):(i=Qv(r),i.c(),dt(i,1),i.m(t,null)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(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,JE):ur(r[29]),Kv)},i(r){t||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function QE(e){let t,n,i=e[9].default&&Jv(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,l){r[9].default?i?(i.p(r,l),l[0]&512&&dt(i,1)):(i=Jv(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function tI(e,t,n){let i,r,l,f,a,_,{$$slots:x={},$$scope:S}=t;const L=kS(x);let{closeButton:A=void 0}=t,{closeOnClickOutside:P=!0}=t,{closeOnClickInside:D=!1}=t,{closeOnMove:F=!1}=t,{openOn:U="click"}=t,{openIfTopMost:Y=!0}=t,{focusAfterOpen:V=!0}=t,{anchor:Z=void 0}=t,{offset:K=void 0}=t,{popupClass:it=void 0}=t,{maxWidth:mt=void 0}=t,{lngLat:ft=void 0}=t,{html:gt=void 0}=t,{open:lt=!1}=t;const{map:It,popupTarget:yt,layerEvent:bt,layer:ee,eventTopMost:kt}=sf();Ee(e,It,Lt=>n(2,l=Lt)),Ee(e,yt,Lt=>n(3,a=Lt)),Ee(e,bt,Lt=>n(28,f=Lt)),Ee(e,ee,Lt=>n(35,_=Lt));const Gt=["click","dblclick","contextmenu"];let Qt,ne=!1,Ie;function bn(){if(!Qt)return;let Lt=Qt.getElement();!Lt||Lt===Ie||(Ie=Lt,U==="hover"&&(Ie.style.pointerEvents="none"),Ie.addEventListener("mouseenter",()=>{n(24,ne=!0)},{passive:!0}),Ie.addEventListener("mouseleave",()=>{n(24,ne=!1)},{passive:!0}),Ie.addEventListener("click",()=>{D&&n(0,lt=!1)},{passive:!0}))}dg(()=>{if(l)return l.on("click",pn),l.on("contextmenu",pn),typeof a=="string"&&(l.on("click",a,Ve),l.on("dblclick",a,Ve),l.on("contextmenu",a,Ve),l.on("mousemove",a,je),l.on("mouseleave",a,oe),l.on("touchstart",a,Fn),l.on("touchend",a,xn)),()=>{l!=null&&l.loaded()&&(Qt==null||Qt.remove(),l.off("click",pn),l.off("contextmenu",pn),a instanceof Ms.Marker?a.getPopup()===Qt&&a.setPopup(void 0):typeof a=="string"&&(l.off("click",a,Ve),l.off("dblclick",a,Ve),l.off("contextmenu",a,Ve),l.off("mousemove",a,je),l.off("mouseleave",a,oe),l.off("touchstart",a,Fn),l.off("touchend",a,xn)))}});function Zn(Lt){return Y?!("marker"in Lt)&&!dE(Lt)&&kt(Lt)!==_:!1}let en=null,Be="normal";function Ve(Lt){Lt.type===U&&(Zn(Lt)||("layerType"in Lt?Lt.layerType==="deckgl"?(n(10,ft=Lt.coordinate),n(4,en=Lt.object?[Lt.object]:null)):(n(10,ft=Lt.lngLat),n(4,en=Lt.features??[])):(n(10,ft=Lt.lngLat),n(4,en=Lt.features??[])),setTimeout(()=>n(0,lt=!0))))}let dn=null;function Fn(Lt){dn=Lt.point}function xn(Lt){if(!dn||U!=="hover")return;let ke=dn.dist(Lt.point);dn=null,ke<3&&(n(10,ft=Lt.lngLat),n(4,en=Lt.features??[]),Qt.isOpen()?n(25,Be="justOpened"):(n(25,Be="opening"),n(0,lt=!0)))}function oe(Lt){U!=="hover"||dn||Be!=="normal"||(n(0,lt=!1),n(4,en=null))}function je(Lt){if(!(U!=="hover"||dn||Be!=="normal")){if(Zn(Lt)){n(0,lt=!1),n(4,en=null);return}n(0,lt=!0),n(4,en=Lt.features??[]),n(10,ft=Lt.lngLat)}}function pn(Lt){if(Be==="justOpened"){n(25,Be="normal");return}if(!P)return;let ke=[Ie,a instanceof Ms.Marker?a==null?void 0:a.getElement():null];lt&&Qt.isOpen()&&!ke.some(xe=>xe==null?void 0:xe.contains(Lt.originalEvent.target))&&(Lt.type==="contextmenu"&&U==="contextmenu"||Lt.type!=="contextmenu")&&n(0,lt=!1)}aa(()=>{l&&(Qt!=null&&Qt.isOpen())&&Qt.remove()});let Bn;const yi=()=>n(0,lt=!1);function Ai(Lt){cr[Lt?"unshift":"push"](()=>{Bn=Lt,n(1,Bn)})}return e.$$set=Lt=>{"closeButton"in Lt&&n(11,A=Lt.closeButton),"closeOnClickOutside"in Lt&&n(12,P=Lt.closeOnClickOutside),"closeOnClickInside"in Lt&&n(13,D=Lt.closeOnClickInside),"closeOnMove"in Lt&&n(14,F=Lt.closeOnMove),"openOn"in Lt&&n(15,U=Lt.openOn),"openIfTopMost"in Lt&&n(16,Y=Lt.openIfTopMost),"focusAfterOpen"in Lt&&n(17,V=Lt.focusAfterOpen),"anchor"in Lt&&n(18,Z=Lt.anchor),"offset"in Lt&&n(19,K=Lt.offset),"popupClass"in Lt&&n(20,it=Lt.popupClass),"maxWidth"in Lt&&n(21,mt=Lt.maxWidth),"lngLat"in Lt&&n(10,ft=Lt.lngLat),"html"in Lt&&n(22,gt=Lt.html),"open"in Lt&&n(0,lt=Lt.open),"$$scope"in Lt&&n(29,S=Lt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,i=A??(!P&&!D)),e.$$.dirty[0]&146685952&&(Qt||(n(23,Qt=new Ms.Popup({closeButton:i,closeOnClick:!1,closeOnMove:F,focusAfterOpen:V,maxWidth:mt,className:it,anchor:Z,offset:K})),Ie=Qt.getElement(),Qt.on("open",()=>{n(0,lt=!0),bn()}),Qt.on("close",Lt=>{n(0,lt=!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&&(Ve(f),Ue(bt,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"&&bt&&(r&&f&&(f.layerType==="deckgl"?(n(10,ft=f.coordinate),n(4,en=f.object?[f.object]:null)):(n(10,ft=f.lngLat),n(4,en=f.features??[]))),n(0,lt=(r||ne)??!1)),e.$$.dirty[0]&12582914&&(Bn?Qt.setDOMContent(Bn):gt&&Qt.setHTML(gt)),e.$$.dirty[0]&8389632&&ft&&Qt.setLngLat(ft),e.$$.dirty[0]&41943045&&l){let Lt=Qt.isOpen();lt&&!Lt?(Qt.addTo(l),Be==="opening"&&n(25,Be="justOpened")):!lt&&Lt&&Qt.remove()}},[lt,Bn,l,a,en,It,yt,bt,ee,L,ft,A,P,D,F,U,Y,V,Z,K,it,mt,gt,Qt,ne,Be,r,i,f,S,x,yi,Ai]}class eI extends tn{constructor(t){super(),Qe(this,t,tI,QE,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 nI(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function iI(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:[nI]},$$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||(dt(t.$$.fragment,f),i=!0)},o(f){vt(t.$$.fragment,f),i=!1},d(f){qt(t,f)}}}function rI(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:D=void 0}=t,{maxzoom:F=void 0}=t,{hoverCursor:U=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:Z=!1}=t,{interactive:K=!0}=t;function it(bt){V=bt,n(0,V)}function mt(bt){ii.call(this,e,bt)}function ft(bt){ii.call(this,e,bt)}function gt(bt){ii.call(this,e,bt)}function lt(bt){ii.call(this,e,bt)}function It(bt){ii.call(this,e,bt)}function yt(bt){ii.call(this,e,bt)}return e.$$set=bt=>{"id"in bt&&n(1,l=bt.id),"source"in bt&&n(2,f=bt.source),"sourceLayer"in bt&&n(3,a=bt.sourceLayer),"beforeId"in bt&&n(4,_=bt.beforeId),"beforeLayerType"in bt&&n(5,x=bt.beforeLayerType),"paint"in bt&&n(6,S=bt.paint),"layout"in bt&&n(7,L=bt.layout),"filter"in bt&&n(8,A=bt.filter),"applyToClusters"in bt&&n(9,P=bt.applyToClusters),"minzoom"in bt&&n(10,D=bt.minzoom),"maxzoom"in bt&&n(11,F=bt.maxzoom),"hoverCursor"in bt&&n(12,U=bt.hoverCursor),"manageHoverState"in bt&&n(13,Y=bt.manageHoverState),"hovered"in bt&&n(0,V=bt.hovered),"eventsIfTopMost"in bt&&n(14,Z=bt.eventsIfTopMost),"interactive"in bt&&n(15,K=bt.interactive),"$$scope"in bt&&n(24,r=bt.$$scope)},[V,l,f,a,_,x,S,L,A,P,D,F,U,Y,Z,K,i,it,mt,ft,gt,lt,It,yt,r]}class ox extends tn{constructor(t){super(),Qe(this,t,rI,iI,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,sx=Uint16Array,oI=Int32Array,sI=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]),aI=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]),ax=function(e,t){for(var n=new sx(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,cI[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,hI=new fd(32);for(ni=0;ni<32;++ni)hI[ni]=5;var ni,fI=new fd(0),pI=typeof TextDecoder<"u"&&new TextDecoder,dI=0;try{pI.decode(fI,{stream:!0}),dI=1}catch{}const ux=ui({type:"FeatureCollection",features:[]}),mI=ui(!0),cx=ui(0),gI=30;class _I{constructor(t,n){Wn(this,"map");Wn(this,"inner");Wn(this,"active");Wn(this,"eventListenersSuccess");Wn(this,"eventListenersUpdated");Wn(this,"eventListenersFailure");Wn(this,"onMouseMove",t=>{if(!this.active)return;const n=[t.point.x-gI,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())});Wn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});Wn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.inner.onClick(),this.finish())});Wn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});Wn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});Wn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});Wn(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());ux.set(t),this.map.getCanvas().style.cursor=t.cursor,mI.set(t.snap_mode),cx.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 Ru=ui(null),hx=ui(`https://api.maptiler.com/maps/dataviz/style.json?key=${ky}`),ku=ui(""),Hm=ui(!0),oy=ui(null),sy=ui(null),ay=ui(null),Xo=ui(null),qp=ui(null),Ym=ui(new mg.LngLat(0,0)),Km=ui(new mg.LngLat(0,0)),Lu=ui(1),En=ui({mode:"title"}),ly=ui("walk_cycle_only");function yI(e){let t,n,i,r,l,f,a,_,x;return{c(){t=_t("label"),n=ge(`Basemap: + `),i=_t("select"),r=_t("option"),r.textContent="MapTiler Dataviz",l=_t("option"),l.textContent="MapTiler Streets",f=_t("option"),f.textContent="MapTiler Satellite",a=_t("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){St(S,t,L),ht(t,n),ht(t,i),ht(i,r),ht(i,l),ht(i,f),ht(i,a),$m(i,e[0],!0),_||(x=Ge(i,"change",e[1]),_=!0)},p(S,[L]){L&1&&$m(i,S[0])},i:Me,o:Me,d(S){S&&wt(t),_=!1,x()}}}function vI(e,t,n){let i="dataviz";function r(){i=jb(this),n(0,i)}return e.$$.update=()=>{e.$$.dirty&1&&hx.set(`https://api.maptiler.com/maps/${i}/style.json?key=${ky}`)},[i,r]}class bI extends tn{constructor(t){super(),Qe(this,t,vI,yI,He,{})}}var xI=Object.defineProperty,wI=(e,t,n)=>t in e?xI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t1=(e,t,n)=>(wI(e,typeof t!="symbol"?t+"":t,n),n);function Zp(){}function fx(e){return e()}function e1(){return Object.create(null)}function yg(e){e.forEach(fx)}function px(e){return typeof e=="function"}function SI(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function EI(e){return Object.keys(e).length===0}function II(e,t){e.appendChild(t)}function CI(e,t,n){e.insertBefore(t,n||null)}function dx(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 TI(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=[],LI=Promise.resolve();let uy=!1;function MI(){uy||(uy=!0,LI.then(mx))}function cy(e){Rh.push(e)}const W_=new Set;let Th=0;function mx(){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 AI=new Set;function NI(e,t){e&&e.i&&(AI.delete(e),e.i(t))}function DI(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),cy(()=>{const l=e.$$.on_mount.map(fx).filter(px);e.$$.on_destroy?e.$$.on_destroy.push(...l):yg(l),e.$$.on_mount=[]}),r.forEach(cy)}function RI(e,t){const n=e.$$;n.fragment!==null&&(kI(n.after_update),yg(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function OI(e,t){e.$$.dirty[0]===-1&&(kh.push(e),MI(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const D=P.length?P[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=D)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](D),S&&OI(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=TI(t.target);x.fragment&&x.fragment.l(L),L.forEach(dx)}else x.fragment&&x.fragment.c();t.intro&&NI(e.$$.fragment),DI(e,t.target,t.anchor),mx()}Vp(_)}class FI{constructor(){t1(this,"$$"),t1(this,"$$set")}$destroy(){RI(this,1),this.$destroy=Zp}$on(t,n){if(!px(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&&!EI(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const BI="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(BI);function VI(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){CI(r,t,l),II(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&&dx(t)}}}function UI(e,t,n){let{displayIn:i}=t;return e.$$set=r=>{"displayIn"in r&&n(0,i=r.displayIn)},[i]}class GI extends FI{constructor(t){super(),zI(this,t,UI,VI,SI,{displayIn:0})}}const jI=[{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"}],qI={decimalLatitude:40.123,decimalLongitude:-74.123},ZI=[{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}],$I=[{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 WI(){const e=[];return jI.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...qI})}),[...e,...ZI,...$I]}const XI=WI();XI.map(e=>e.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -601,10 +601,10 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function HI(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 Ou(e,t);if(n===null)return r.left=r.right=null,r;n=Mu(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=Mu(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 KI(e,t,n){return t===null?e:(e===null||(t=Mu(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=YI),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 Ou(t,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,l=Mu(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=Mu(t,n,i);var l=i(t,n.key);return l===0?(n.left===null?r=n.right:(r=Mu(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=Mu(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=Mu(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 QI(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=tC(this.toList(),JI(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=KI(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 HI(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 Ou(f,a);return _.left=fy(e,t,n,l),_.right=fy(e,t,l+1,i),_}return null}function JI(e,t){for(var n=new Ou(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 tC(e,t,n){for(var i=new Ou(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 Ho(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}(),sC=0,Qm=function(){Ho(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 D=t.comparePoint(n.rightSE.point);return D<0?1:D>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,Z=S-_,K=f-r;if(Y>V&&ZK)return-1}return l>f?1:lS?1:t.idn.id?1:0}}]);function e(t,n,i,r){ba(this,e),this.id=++sC,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 Ho(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 Ho(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 Ho(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 Ho(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 Ho(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 Ho(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 lt=this._splitSafely(a,gt),It=0,_t=lt.length;It<_t;It++)i.push(lt[It]);if(!_.isAnEndpoint(gt))for(var bt=this._splitSafely(_,gt),ee=0,kt=bt.length;eed1)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 cC(D),it=D.size,mt=D.pop();mt;){var ht=mt.key;if(D.size===it){var gt=ht.segment;throw new Error("Unable to pop() ".concat(ht.isLeft?"left":"right"," SweepEvent ")+"[".concat(ht.point.x,", ").concat(ht.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(D.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>hC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var lt=K.process(ht),It=0,_t=lt.length;It<_t;It++){var bt=lt[It];bt.consumedBy===void 0&&D.insert(bt)}it=D.size,mt=D.pop()}$p.reset();var ee=lC.factory(K.segments),kt=new uC(ee);return kt.getGeom()}}]),e}(),Oa=new fC,pC=function(e){for(var t=arguments.length,n=new Array(t>1?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=nn.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 nn.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 _i("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:nn.isNaN(e)?nn.isNaN(t)?0:-1:nn.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 _i("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},Yo=function(){},Ex={LOG_10:{configurable:!0}};Yo.prototype.interfaces_=function(){return[]};Yo.prototype.getClass=function(){return Yo};Yo.log10=function(e){var t=Math.log(e);return nn.isInfinite(t)||nn.isNaN(t)?t:t/Yo.LOG_10};Yo.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}};Yo.wrap=function(e,t){return e<0?t- -e%t:e%t};Yo.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),_}};Yo.average=function(e,t){return(e+t)/2};Ex.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Yo,Ex);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 nn.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,D=null,B=null,U=null,Y=null;D=this._hi+_,A=this._lo+x,U=D-this._hi,Y=A-this._lo,B=D-U,P=A-Y,B=_-U+(this._hi-B),P=x-Y+(this._lo-P),U=B+A,S=D+U,L=U+(D-S),U=P+L;var V=S+U,Z=U+(S-V);return this._hi=V,this._lo=Z,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 nn.isNaN(t)?Ut.createNaN():Ut.copy(this).selfMultiply(t,0)}};Ut.prototype.isNaN=function(){return nn.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 D=Ut.TEN.pow(P);A=l.divide(D)}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(nn.NaN,nn.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};Ix.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(po,Ix);var kn=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};kn.prototype.setOrdinate=function(e,t,n){};kn.prototype.size=function(){};kn.prototype.getOrdinate=function(e,t){};kn.prototype.getCoordinate=function(){};kn.prototype.getCoordinateCopy=function(e){};kn.prototype.getDimension=function(){};kn.prototype.getX=function(e){};kn.prototype.clone=function(){};kn.prototype.expandEnvelope=function(e){};kn.prototype.copy=function(){};kn.prototype.getY=function(e){};kn.prototype.toCoordinateArray=function(){};kn.prototype.interfaces_=function(){return[bg]};kn.prototype.getClass=function(){return kn};Object.defineProperties(kn,dd);var Cx=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}(Cx),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}};Re.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Re){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))}};Re.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};Re.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Re.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Re.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Re.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Re.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Re.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()}};Re.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Re){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)}};Re.prototype.centre=function(){return this.isNull()?null:new Dt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Re.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 Re){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)};Re.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};Re.prototype.interfaces_=function(){return[bs,xs]};Re.prototype.getClass=function(){return Re};Re.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 ln.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 ln.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 $u=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 Re(this._inputLines[0][0],this._inputLines[0][1]),r=new Re(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,Re.intersects(i,r,n)&&be.orientationIndex(i,r,n)===0&&be.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=Re.intersects(n,i,r),a=Re.intersects(n,i,l),_=Re.intersects(r,l,n),x=Re.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,D=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 _=be.orientationIndex(r,l,n),x=be.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=be.distancePointLine(n,r,l),_=be.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],kn)){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?Yo.min(be.distancePointLine(e,n,i),be.distancePointLine(t,n,i),be.distancePointLine(n,e,t),be.distancePointLine(i,e,t)):0};be.isPointInRing=function(e,t){return be.locatePointInRing(e,t)!==zt.EXTERIOR};be.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=be.computeOrientation(_,n,x),L=!1;return S===0?L=_.x>x.x:L=S>0,L};be.locatePointInRing=function(e,t){return oa.locatePointInRing(e,t)};be.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)};be.computeOrientation=function(e,t,n){return be.orientationIndex(e,t,n)};be.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new _i("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(_)}};be.isOnLine=function(e,t){for(var n=new $u,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 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 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}(Ji);function cf(e){this.message=e||""}cf.prototype=new Error;cf.prototype.name="NoSuchElementException";var fe=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 wC(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],D=arguments[2];if(D)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],Z=arguments[2];if(!Z){var K=this.size();if(K>0){if(Y>0){var it=this.get(Y-1);if(it.equals2D(V))return null}if(YIt&&(_t=-1);for(var bt=lt;bt!==It;bt+=_t)i.add(ht[bt],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}(fe),yn=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)};yn.prototype.interfaces_=function(){return[]};yn.prototype.getClass=function(){return yn};yn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};yn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};yn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};yn.extract=function(e,t,n){t=Yo.clamp(t,0,e.length),n=Yo.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=yn.compare(n,i),l=yn.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=yn.increasingDirection(n),l=yn.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 fe,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 Lx(){}Lx.prototype=new Sg;function ca(){this.array_=[],arguments[0]instanceof Ji&&this.addAll(arguments[0])}ca.prototype=new Lx;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()}};Bi.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Bi.createClosedRing(e,t,4);var i=t.getOrdinate(0,kn.X)===t.getOrdinate(n-1,kn.X)&&t.getOrdinate(0,kn.Y)===t.getOrdinate(n-1,kn.Y);return i?t:Bi.createClosedRing(e,t,n+1)};Bi.createClosedRing=function(e,t,n){var i=e.create(n,t.getDimension()),r=t.size();Bi.copy(t,0,i,0,r);for(var l=r;l0&&Bi.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?Dn.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 be.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();Bi.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 Oi=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 Oi(n):new Oi(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 Px=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 fe,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),On=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}};On.prototype.equals=function(e){if(!(e instanceof On))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};On.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return new ua(n).compareTo(new ua(i))};On.prototype.getScale=function(){return this._scale};On.prototype.isFloating=function(){return this._modelType===On.FLOATING||this._modelType===On.FLOATING_SINGLE};On.prototype.getType=function(){return this._modelType};On.prototype.toString=function(){var e="UNKNOWN";return this._modelType===On.FLOATING?e="Floating":this._modelType===On.FLOATING_SINGLE?e="Floating-Single":this._modelType===On.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};On.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(nn.isNaN(e))return e;if(this._modelType===On.FLOATING_SINGLE){var t=e;return t}return this._modelType===On.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Dt){var n=arguments[0];if(this._modelType===On.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};On.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===On.FLOATING?e=16:this._modelType===On.FLOATING_SINGLE?e=6:this._modelType===On.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};On.prototype.setScale=function(e){this._scale=Math.abs(e)};On.prototype.interfaces_=function(){return[xs,bs]};On.prototype.getClass=function(){return On};On.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(On,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 Px};Object.defineProperties(fa,Vy);On.Type=fa;On.FIXED=new fa("FIXED");On.FLOATING=new fa("FLOATING");On.FLOATING_SINGLE=new fa("FLOATING SINGLE");var _n=function e(){this._precisionModel=new On,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?We(arguments[0],zh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof On&&(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]))},kx={serialVersionUID:{configurable:!0}};_n.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)};_n.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new Pi(this.getCoordinateSequenceFactory().create(e),this);if(We(e,kn))return new Pi(e,this)}else return new Pi(this.getCoordinateSequenceFactory().create([]),this)};_n.prototype.createMultiLineString=function(){if(arguments.length===0)return new zu(null,this);if(arguments.length===1){var e=arguments[0];return new zu(e,this)}};_n.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(_n.toGeometryArray(e));var a=e.iterator().next(),_=e.size()>1;if(_){if(a instanceof nr)return this.createMultiPolygon(_n.toPolygonArray(e));if(a instanceof Pi)return this.createMultiLineString(_n.toLineStringArray(e));if(a instanceof Mo)return this.createMultiPoint(_n.toPointArray(e));ln.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a};_n.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};_n.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],kn)){var t=arguments[0];return new Mo(t,this)}}};_n.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};_n.prototype.createPolygon=function(){if(arguments.length===0)return new nr(null,null,this);if(arguments.length===1){if(We(arguments[0],kn)){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 nr(i,r,this)}};_n.prototype.getSRID=function(){return this._SRID};_n.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)}};_n.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)}}})};_n.prototype.getPrecisionModel=function(){return this._precisionModel};_n.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],kn)){var t=arguments[0];return new Va(t,this)}}};_n.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)}};_n.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],kn)){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===be.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=se.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)}ln.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===se.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 fe,this._nodes=new fe,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(se.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(se.RIGHT)>=1&&t.getDepth(se.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 Re,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[se.ON]=this.location[se.ON],n[se.LEFT]=zt.NONE,n[se.RIGHT]=zt.NONE,this.location=n}for(var i=0;i1&&e.append(zt.toLocationSymbol(this.location[se.LEFT])),e.append(zt.toLocationSymbol(this.location[se.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[se.RIGHT])),e.toString()};ei.prototype.setLocations=function(e,t,n){this.location[se.ON]=e,this.location[se.LEFT]=t,this.location[se.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};Wi.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[_])}};Wi.prototype.isHole=function(){return this._isHole};Wi.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Wi.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!be.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};Wi.prototype.addHole=function(e){this._holes.add(e)};Wi.prototype.isShell=function(){return this._shell===null};Wi.prototype.getLabel=function(){return this._label};Wi.prototype.getEdges=function(){return this._edges};Wi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Wi.prototype.getShell=function(){return this._shell};Wi.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,se.RIGHT);if(i===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,i),null}};Wi.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Wi.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)};Ko.prototype.isInResult=function(){return this._isInResult};Ko.prototype.isVisited=function(){return this._isVisited};Ko.prototype.interfaces_=function(){return[]};Ko.prototype.getClass=function(){return Ko};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 qn(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 qn(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 qn)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}(Ko),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 fe,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 Xn=function(){},_d={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Xn.prototype.interfaces_=function(){return[]};Xn.prototype.getClass=function(){return Xn};Xn.isNorthern=function(e){return e===Xn.NE||e===Xn.NW};Xn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Xn.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};Xn.isInHalfPlane=function(e,t){return t===Xn.SE?e===Xn.SE||e===Xn.SW:e===t||e===t+1};Xn.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 _i("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Xn.NE:Xn.SE:t>=0?Xn.NW:Xn.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 _i("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Xn.NE:Xn.SE:i.y>=n.y?Xn.NW:Xn.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(Xn,_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 fe,i=e.iterator();i.hasNext();){var r=i.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var l=new NC(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)&&be.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 ln.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 fe,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 fe,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 er=function(){if(this._childBoundables=new fe,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},Nx={serialVersionUID:{configurable:!0}};er.prototype.getLevel=function(){return this._level};er.prototype.size=function(){return this._childBoundables.size()};er.prototype.getChildBoundables=function(){return this._childBoundables};er.prototype.addChildBoundable=function(e){ln.isTrue(this._bounds===null),this._childBoundables.add(e)};er.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};er.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};er.prototype.interfaces_=function(){return[Zh,xs]};er.prototype.getClass=function(){return er};Nx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(er,Nx);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?Nu.sort(n,t):Nu.sort(n);for(var i=e.iterator(),r=0,l=n.length;rZi.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 _i("neither boundable is composite")};Zi.prototype.isLeaves=function(){return!(Zi.isComposite(this._boundable1)||Zi.isComposite(this._boundable2))};Zi.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Zi.prototype.expand=function(e,t,n,i){for(var r=this,l=e.getChildBoundables(),f=l.iterator();f.hasNext();){var a=f.next(),_=new Zi(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}};wr.prototype.getNodeCapacity=function(){return this._nodeCapacity};wr.prototype.lastNode=function(e){return e.get(e.size()-1)};wr.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 er?n+=e.size(r):r instanceof Rs&&(n+=1)}return n}};wr.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};wr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new fe:t}else if(arguments.length===1){for(var n=arguments[0],i=new fe,r=n.getChildBoundables().iterator();r.hasNext();){var l=r.next();if(l instanceof er){var f=e.itemsTree(l);f!==null&&i.add(f)}else l instanceof Rs?i.add(l.getItem()):ln.shouldNeverReachHere()}return i.size()<=0?null:i}};wr.prototype.insert=function(e,t){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Rs(e,t))};wr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new fe;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];if(ln.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 er?e.boundablesAtLevel(i,a,l):(ln.isTrue(a instanceof Rs),i===-1&&l.add(a))}return null}};wr.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new fe;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 er)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 er?e.query(l,S,a):S instanceof Rs?a.visitItem(S.getItem()):ln.shouldNeverReachHere())}else if(We(arguments[2],As)&&arguments[0]instanceof Object&&arguments[1]instanceof er)for(var L=arguments[0],A=arguments[1],P=arguments[2],D=A.getChildBoundables(),B=0;Bn&&(n=l)}}return n+1}};wr.prototype.createParentBoundables=function(e,t){var n=this;ln.isTrue(!e.isEmpty());var i=new fe;i.add(this.createNode(t));var r=new fe(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};wr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};wr.prototype.interfaces_=function(){return[xs]};wr.prototype.getClass=function(){return wr};wr.compareDoubles=function(e,t){return e>t?1:e0);for(var f=new fe,a=0;a0;){var D=P.poll(),B=D.getDistance();if(B>=L)break;D.isLeaves()?(L=B,A=D):D.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],Z=new Rs(U,Y),K=new Zi(this.getRoot(),Z,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}(wr),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 Re(r.getBounds()):n.expandToInclude(r.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(er),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 ln.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 fe;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 _i("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 Vi=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};Vi.prototype.getCoordinates=function(){return this._pts};Vi.prototype.size=function(){return this._pts.length};Vi.prototype.getCoordinate=function(e){return this._pts[e]};Vi.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Vi.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Vi.prototype.setData=function(e){this._data=e};Vi.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Sc.octant(e,t)};Vi.prototype.getData=function(){return this._data};Vi.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)}};Vi.prototype.toString=function(){return Ns.toLineString(new Oi(this._pts))};Vi.prototype.getNodeList=function(){return this._nodeList};Vi.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 be.orientationIndex(this.p0,this.p1,i)}};Oe.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Oe.prototype.isVertical=function(){return this.p0.x===this.p1.x};Oe.prototype.equals=function(e){if(!(e instanceof Oe))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Oe.prototype.intersection=function(e){var t=new $u;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Oe.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 Oe){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 Oe(f,a)}};Oe.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Oe.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Oe.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Oe.prototype.distancePerpendicular=function(e){return be.distancePointLinePerpendicular(e,this.p0,this.p1)};Oe.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Oe.prototype.midPoint=function(){return Oe.midPoint(this.p0,this.p1)};Oe.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 nn.NaN;var r=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i;return r};Oe.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=nn.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||nn.isNaN(t))&&(t=1),t};Oe.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Oe.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Oe.prototype.distance=function(){if(arguments[0]instanceof Oe){var e=arguments[0];return be.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Dt){var t=arguments[0];return be.distancePointLine(t,this.p0,this.p1)}};Oe.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};Oe.prototype.hashCode=function(){var e=nn.doubleToLongBits(this.p0.x);e^=nn.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=nn.doubleToLongBits(this.p1.x);n^=nn.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return t^i};Oe.prototype.interfaces_=function(){return[bs,xs]};Oe.prototype.getClass=function(){return Oe};Oe.midPoint=function(e,t){return new Dt((e.x+t.x)/2,(e.y+t.y)/2)};Rx.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Oe,Rx);var ed=function(){this.tempEnv1=new Re,this.tempEnv2=new Re,this._overlapSeg1=new Oe,this._overlapSeg2=new Oe};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=Xn.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),Rn=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}};Rn.prototype.getEndCapStyle=function(){return this._endCapStyle};Rn.prototype.isSingleSided=function(){return this._isSingleSided};Rn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Rn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Rn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Rn.JOIN_ROUND&&(this._quadrantSegments=Rn.DEFAULT_QUADRANT_SEGMENTS)};Rn.prototype.getJoinStyle=function(){return this._joinStyle};Rn.prototype.setJoinStyle=function(e){this._joinStyle=e};Rn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Rn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Rn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Rn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Rn.prototype.getMitreLimit=function(){return this._mitreLimit};Rn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Rn.prototype.setSingleSided=function(e){this._isSingleSided=e};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.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(Rn,xl);var ki=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=be.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])};Jo.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-=Cn.PI_TIMES_2;for(;e<=-Math.PI;)e+=Cn.PI_TIMES_2;return e};Cn.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)}};Cn.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};Cn.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};Cn.interiorAngle=function(e,t,n){var i=Cn.angle(t,e),r=Cn.angle(t,n);return Math.abs(r-i)};Cn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=Cn.PI_TIMES_2;e>=Cn.PI_TIMES_2&&(e=0)}else{for(;e>=Cn.PI_TIMES_2;)e-=Cn.PI_TIMES_2;e<0&&(e=0)}return e};Cn.angleBetween=function(e,t,n){var i=Cn.angle(t,e),r=Cn.angle(t,n);return Cn.diff(i,r)};Cn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};Cn.toRadians=function(e){return e*Math.PI/180};Cn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?Cn.COUNTERCLOCKWISE:n<0?Cn.CLOCKWISE:Cn.NONE};Cn.angleBetweenOriented=function(e,t,n){var i=Cn.angle(t,e),r=Cn.angle(t,n),l=r-i;return l<=-Math.PI?l+Cn.PI_TIMES_2:l>Math.PI?l-Cn.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 be.COUNTERCLOCKWISE};Bc.CLOCKWISE.get=function(){return be.CLOCKWISE};Bc.NONE.get=function(){return be.COLLINEAR};Object.defineProperties(Cn,Bc);var pi=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 Oe,this._seg1=new Oe,this._offset0=new Oe,this._offset1=new Oe,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 $u,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Rn.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}};pi.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=be.computeOrientation(this._s0,this._s1,this._s2),i=n===be.CLOCKWISE&&this._side===se.LEFT||n===be.COUNTERCLOCKWISE&&this._side===se.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};pi.prototype.addLineEndCap=function(e,t){var n=new Oe(e,t),i=new Oe;this.computeOffsetSegment(n,se.LEFT,this._distance,i);var r=new Oe;this.computeOffsetSegment(n,se.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 Rn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(t,a+Math.PI/2,a-Math.PI/2,be.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Rn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Rn.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}};pi.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};pi.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())};pi.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===be.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)};pi.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)}};pi.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()};pi.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};pi.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Jo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*pi.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};pi.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()===Rn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Rn.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,be.CLOCKWISE,this._distance))};pi.prototype.closeRing=function(){this._segList.closeRing()};pi.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};pi.prototype.interfaces_=function(){return[]};pi.prototype.getClass=function(){return pi};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(pi,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&&yn.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],se.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],se.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===se.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],se.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],se.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 Rn.CAP_ROUND:t.createCircle(e);break;case Rn.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],se.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],se.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment()};mo.prototype.getSegGen=function(e){return new pi(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)&&be.computeOrientation(e._seg.p0,e._seg.p1,f)!==be.RIGHT){var A=a.getDepth(se.LEFT);e._seg.p0.equals(x[S])||(A=a.getDepth(se.RIGHT));var P=new Bu(e._seg,A);_.add(P)}}else if(We(arguments[2],As)&&arguments[0]instanceof Dt&&We(arguments[1],As))for(var D=arguments[0],B=arguments[1],U=arguments[2],Y=B.iterator();Y.hasNext();){var V=Y.next();V.isForward()&&e.findStabbedSegments(D,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};zx.DepthSegment.get=function(){return Bu};Object.defineProperties(Ec,zx);var Bu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Oe(e),this._leftDepth=t};Bu.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)};Bu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Bu.prototype.toString=function(){return this._upwardSeg.toString()};Bu.prototype.interfaces_=function(){return[bs]};Bu.prototype.getClass=function(){return Bu};var zn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};zn.prototype.area=function(){return zn.area(this.p0,this.p1,this.p2)};zn.prototype.signedArea=function(){return zn.signedArea(this.p0,this.p1,this.p2)};zn.prototype.interpolateZ=function(e){if(e===null)throw new _i("Supplied point is null.");return zn.interpolateZ(e,this.p0,this.p1,this.p2)};zn.prototype.longestSideLength=function(){return zn.longestSideLength(this.p0,this.p1,this.p2)};zn.prototype.isAcute=function(){return zn.isAcute(this.p0,this.p1,this.p2)};zn.prototype.circumcentre=function(){return zn.circumcentre(this.p0,this.p1,this.p2)};zn.prototype.area3D=function(){return zn.area3D(this.p0,this.p1,this.p2)};zn.prototype.centroid=function(){return zn.centroid(this.p0,this.p1,this.p2)};zn.prototype.inCentre=function(){return zn.inCentre(this.p0,this.p1,this.p2)};zn.prototype.interfaces_=function(){return[]};zn.prototype.getClass=function(){return zn};zn.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)};zn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};zn.det=function(e,t,n,i){return e*i-t*n};zn.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,D=(-_*L+f*A)/S,B=t.z+P*(n.z-t.z)+D*(i.z-t.z);return B};zn.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};zn.isAcute=function(e,t,n){return!(!Cn.isAcute(e,t,n)||!Cn.isAcute(t,n,e)||!Cn.isAcute(n,e,t))};zn.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*zn.det(l,f,a,_),S=zn.det(f,l*l+f*f,_,a*a+_*_),L=zn.det(l,l*l+f*f,a,a*a+_*_),A=i-S/x,P=r+L/x;return new Dt(A,P)};zn.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)};zn.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 _};zn.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};zn.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)};zn.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 fe;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=se.LEFT;this._distance<0&&(n=-this._distance,i=se.RIGHT);var r=e.getExteriorRing(),l=yn.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,se.opposite(i),zt.INTERIOR,zt.EXTERIOR)}};vs.prototype.isTriangleErodedCompletely=function(e,t){var n=new zn(e[0],e[1],e[2]),i=n.inCentre(),r=be.distancePointLine(i,n.p0,n.p1);return r=Va.MINIMUM_VALID_SIZE&&be.isCCW(e)&&(l=r,f=i,n=se.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 nr?this.addPolygon(e):e instanceof Pi?this.addLineString(e):e instanceof Mo?this.addPoint(e):e instanceof jh?this.addCollection(e):e instanceof zu?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 Wo=function(){this._geom=null;var e=arguments[0];this._geom=e};Wo.prototype.locate=function(e){return Wo.locate(e,this._geom)};Wo.prototype.interfaces_=function(){return[Wh]};Wo.prototype.getClass=function(){return Wo};Wo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?be.isPointInRing(e,t.getCoordinates()):!1};Wo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Wo.isPointInRing(e,n))return!1;for(var i=0;i0&&(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=Mu(t,n,i);var l=i(t,n.key);return l===0?(n.left===null?r=n.right:(r=Mu(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=Mu(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=Mu(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 QI(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=tC(this.toList(),JI(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=KI(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 HI(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 Ou(f,a);return _.left=fy(e,t,n,l),_.right=fy(e,t,l+1,i),_}return null}function JI(e,t){for(var n=new Ou(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 tC(e,t,n){for(var i=new Ou(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 Ho(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}(),sC=0,Qm=function(){Ho(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 D=t.comparePoint(n.rightSE.point);return D<0?1:D>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,Z=S-_,K=f-r;if(Y>V&&ZK)return-1}return l>f?1:lS?1:t.idn.id?1:0}}]);function e(t,n,i,r){ba(this,e),this.id=++sC,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 Ho(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 Ho(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 Ho(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 Ho(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 Ho(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 Ho(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 lt=this._splitSafely(a,gt),It=0,yt=lt.length;Itd1)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 cC(D),it=D.size,mt=D.pop();mt;){var ft=mt.key;if(D.size===it){var gt=ft.segment;throw new Error("Unable to pop() ".concat(ft.isLeft?"left":"right"," SweepEvent ")+"[".concat(ft.point.x,", ").concat(ft.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(D.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>hC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var lt=K.process(ft),It=0,yt=lt.length;It1?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=nn.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 nn.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 _i("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:nn.isNaN(e)?nn.isNaN(t)?0:-1:nn.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 _i("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},Yo=function(){},Ex={LOG_10:{configurable:!0}};Yo.prototype.interfaces_=function(){return[]};Yo.prototype.getClass=function(){return Yo};Yo.log10=function(e){var t=Math.log(e);return nn.isInfinite(t)||nn.isNaN(t)?t:t/Yo.LOG_10};Yo.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}};Yo.wrap=function(e,t){return e<0?t- -e%t:e%t};Yo.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),_}};Yo.average=function(e,t){return(e+t)/2};Ex.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Yo,Ex);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 nn.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,D=null,F=null,U=null,Y=null;D=this._hi+_,A=this._lo+x,U=D-this._hi,Y=A-this._lo,F=D-U,P=A-Y,F=_-U+(this._hi-F),P=x-Y+(this._lo-P),U=F+A,S=D+U,L=U+(D-S),U=P+L;var V=S+U,Z=U+(S-V);return this._hi=V,this._lo=Z,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 nn.isNaN(t)?Ut.createNaN():Ut.copy(this).selfMultiply(t,0)}};Ut.prototype.isNaN=function(){return nn.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 D=Ut.TEN.pow(P);A=l.divide(D)}else if(P<0){var F=Ut.TEN.pow(-P);A=l.multiply(F)}return i?A.negate():A};Ut.createNaN=function(){return new Ut(nn.NaN,nn.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};Ix.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(po,Ix);var kn=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};kn.prototype.setOrdinate=function(e,t,n){};kn.prototype.size=function(){};kn.prototype.getOrdinate=function(e,t){};kn.prototype.getCoordinate=function(){};kn.prototype.getCoordinateCopy=function(e){};kn.prototype.getDimension=function(){};kn.prototype.getX=function(e){};kn.prototype.clone=function(){};kn.prototype.expandEnvelope=function(e){};kn.prototype.copy=function(){};kn.prototype.getY=function(e){};kn.prototype.toCoordinateArray=function(){};kn.prototype.interfaces_=function(){return[bg]};kn.prototype.getClass=function(){return kn};Object.defineProperties(kn,dd);var Cx=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}(Cx),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}};Re.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Re){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))}};Re.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};Re.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Re.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Re.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Re.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Re.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Re.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()}};Re.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Re){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)}};Re.prototype.centre=function(){return this.isNull()?null:new Dt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Re.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 Re){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)};Re.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};Re.prototype.interfaces_=function(){return[bs,xs]};Re.prototype.getClass=function(){return Re};Re.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 ln.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 ln.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 $u=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 Re(this._inputLines[0][0],this._inputLines[0][1]),r=new Re(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,Re.intersects(i,r,n)&&be.orientationIndex(i,r,n)===0&&be.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=Re.intersects(n,i,r),a=Re.intersects(n,i,l),_=Re.intersects(r,l,n),x=Re.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,D=r.y>l.y?r.y:l.y,F=a>L?a:L,U=xA?_:A,V=S0&&a>0||f<0&&a<0)return e.NO_INTERSECTION;var _=be.orientationIndex(r,l,n),x=be.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=be.distancePointLine(n,r,l),_=be.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],kn)){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?Yo.min(be.distancePointLine(e,n,i),be.distancePointLine(t,n,i),be.distancePointLine(n,e,t),be.distancePointLine(i,e,t)):0};be.isPointInRing=function(e,t){return be.locatePointInRing(e,t)!==zt.EXTERIOR};be.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=be.computeOrientation(_,n,x),L=!1;return S===0?L=_.x>x.x:L=S>0,L};be.locatePointInRing=function(e,t){return oa.locatePointInRing(e,t)};be.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)};be.computeOrientation=function(e,t,n){return be.orientationIndex(e,t,n)};be.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new _i("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(_)}};be.isOnLine=function(e,t){for(var n=new $u,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 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 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}(Ji);function cf(e){this.message=e||""}cf.prototype=new Error;cf.prototype.name="NoSuchElementException";var fe=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 wC(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],D=arguments[2];if(D)for(var F=0;F=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],Z=arguments[2];if(!Z){var K=this.size();if(K>0){if(Y>0){var it=this.get(Y-1);if(it.equals2D(V))return null}if(YIt&&(yt=-1);for(var bt=lt;bt!==It;bt+=yt)i.add(ft[bt],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}(fe),yn=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)};yn.prototype.interfaces_=function(){return[]};yn.prototype.getClass=function(){return yn};yn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};yn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};yn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};yn.extract=function(e,t,n){t=Yo.clamp(t,0,e.length),n=Yo.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=yn.compare(n,i),l=yn.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=yn.increasingDirection(n),l=yn.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 fe,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 Lx(){}Lx.prototype=new Sg;function ca(){this.array_=[],arguments[0]instanceof Ji&&this.addAll(arguments[0])}ca.prototype=new Lx;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()}};Bi.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Bi.createClosedRing(e,t,4);var i=t.getOrdinate(0,kn.X)===t.getOrdinate(n-1,kn.X)&&t.getOrdinate(0,kn.Y)===t.getOrdinate(n-1,kn.Y);return i?t:Bi.createClosedRing(e,t,n+1)};Bi.createClosedRing=function(e,t,n){var i=e.create(n,t.getDimension()),r=t.size();Bi.copy(t,0,i,0,r);for(var l=r;l0&&Bi.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?Dn.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 be.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();Bi.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 Po?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Qp.prototype.interfaces_=function(){return[ys.GeometryEditorOperation]};Qp.prototype.getClass=function(){return Qp};var Oi=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 Oi(n):new Oi(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 Px=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 fe,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),On=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}};On.prototype.equals=function(e){if(!(e instanceof On))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};On.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return new ua(n).compareTo(new ua(i))};On.prototype.getScale=function(){return this._scale};On.prototype.isFloating=function(){return this._modelType===On.FLOATING||this._modelType===On.FLOATING_SINGLE};On.prototype.getType=function(){return this._modelType};On.prototype.toString=function(){var e="UNKNOWN";return this._modelType===On.FLOATING?e="Floating":this._modelType===On.FLOATING_SINGLE?e="Floating-Single":this._modelType===On.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};On.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(nn.isNaN(e))return e;if(this._modelType===On.FLOATING_SINGLE){var t=e;return t}return this._modelType===On.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Dt){var n=arguments[0];if(this._modelType===On.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};On.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===On.FLOATING?e=16:this._modelType===On.FLOATING_SINGLE?e=6:this._modelType===On.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};On.prototype.setScale=function(e){this._scale=Math.abs(e)};On.prototype.interfaces_=function(){return[xs,bs]};On.prototype.getClass=function(){return On};On.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(On,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 Px};Object.defineProperties(fa,Vy);On.Type=fa;On.FIXED=new fa("FIXED");On.FLOATING=new fa("FLOATING");On.FLOATING_SINGLE=new fa("FLOATING SINGLE");var _n=function e(){this._precisionModel=new On,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?We(arguments[0],zh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof On&&(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]))},kx={serialVersionUID:{configurable:!0}};_n.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)};_n.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new Pi(this.getCoordinateSequenceFactory().create(e),this);if(We(e,kn))return new Pi(e,this)}else return new Pi(this.getCoordinateSequenceFactory().create([]),this)};_n.prototype.createMultiLineString=function(){if(arguments.length===0)return new zu(null,this);if(arguments.length===1){var e=arguments[0];return new zu(e,this)}};_n.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(_n.toGeometryArray(e));var a=e.iterator().next(),_=e.size()>1;if(_){if(a instanceof nr)return this.createMultiPolygon(_n.toPolygonArray(e));if(a instanceof Pi)return this.createMultiLineString(_n.toLineStringArray(e));if(a instanceof Po)return this.createMultiPoint(_n.toPointArray(e));ln.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a};_n.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};_n.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],kn)){var t=arguments[0];return new Po(t,this)}}};_n.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};_n.prototype.createPolygon=function(){if(arguments.length===0)return new nr(null,null,this);if(arguments.length===1){if(We(arguments[0],kn)){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 nr(i,r,this)}};_n.prototype.getSRID=function(){return this._SRID};_n.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)}};_n.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)}}})};_n.prototype.getPrecisionModel=function(){return this._precisionModel};_n.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],kn)){var t=arguments[0];return new Va(t,this)}}};_n.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)}};_n.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],kn)){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===be.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=se.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)}ln.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===se.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 fe,this._nodes=new fe,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(se.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(se.RIGHT)>=1&&t.getDepth(se.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 Re,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[se.ON]=this.location[se.ON],n[se.LEFT]=zt.NONE,n[se.RIGHT]=zt.NONE,this.location=n}for(var i=0;i1&&e.append(zt.toLocationSymbol(this.location[se.LEFT])),e.append(zt.toLocationSymbol(this.location[se.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[se.RIGHT])),e.toString()};ei.prototype.setLocations=function(e,t,n){this.location[se.ON]=e,this.location[se.LEFT]=t,this.location[se.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};Wi.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[_])}};Wi.prototype.isHole=function(){return this._isHole};Wi.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Wi.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!be.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};Wi.prototype.addHole=function(e){this._holes.add(e)};Wi.prototype.isShell=function(){return this._shell===null};Wi.prototype.getLabel=function(){return this._label};Wi.prototype.getEdges=function(){return this._edges};Wi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Wi.prototype.getShell=function(){return this._shell};Wi.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,se.RIGHT);if(i===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,i),null}};Wi.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Wi.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)};Ko.prototype.isInResult=function(){return this._isInResult};Ko.prototype.isVisited=function(){return this._isVisited};Ko.prototype.interfaces_=function(){return[]};Ko.prototype.getClass=function(){return Ko};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 qn(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 qn(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 qn)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}(Ko),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 fe,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 Xn=function(){},_d={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Xn.prototype.interfaces_=function(){return[]};Xn.prototype.getClass=function(){return Xn};Xn.isNorthern=function(e){return e===Xn.NE||e===Xn.NW};Xn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Xn.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};Xn.isInHalfPlane=function(e,t){return t===Xn.SE?e===Xn.SE||e===Xn.SW:e===t||e===t+1};Xn.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 _i("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Xn.NE:Xn.SE:t>=0?Xn.NW:Xn.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 _i("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Xn.NE:Xn.SE:i.y>=n.y?Xn.NW:Xn.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(Xn,_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};ko.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};ko.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new fe,i=e.iterator();i.hasNext();){var r=i.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var l=new NC(r,t._geometryFactory);n.add(l),l.setInResult()}}return n};ko.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}};ko.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};ko.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)&&be.isPointInRing(r,x.getCoordinates())&&(L=!0),L&&(l===null||f.contains(S))&&(l=_)}return l};ko.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 ln.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};ko.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 fe,l=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(l,this._shellList,r),this.placeFreeHoles(this._shellList,r)}};ko.prototype.interfaces_=function(){return[]};ko.prototype.getClass=function(){return ko};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 fe,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 er=function(){if(this._childBoundables=new fe,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},Nx={serialVersionUID:{configurable:!0}};er.prototype.getLevel=function(){return this._level};er.prototype.size=function(){return this._childBoundables.size()};er.prototype.getChildBoundables=function(){return this._childBoundables};er.prototype.addChildBoundable=function(e){ln.isTrue(this._bounds===null),this._childBoundables.add(e)};er.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};er.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};er.prototype.interfaces_=function(){return[Zh,xs]};er.prototype.getClass=function(){return er};Nx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(er,Nx);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?Nu.sort(n,t):Nu.sort(n);for(var i=e.iterator(),r=0,l=n.length;rZi.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 _i("neither boundable is composite")};Zi.prototype.isLeaves=function(){return!(Zi.isComposite(this._boundable1)||Zi.isComposite(this._boundable2))};Zi.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Zi.prototype.expand=function(e,t,n,i){for(var r=this,l=e.getChildBoundables(),f=l.iterator();f.hasNext();){var a=f.next(),_=new Zi(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}};wr.prototype.getNodeCapacity=function(){return this._nodeCapacity};wr.prototype.lastNode=function(e){return e.get(e.size()-1)};wr.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 er?n+=e.size(r):r instanceof Rs&&(n+=1)}return n}};wr.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};wr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new fe:t}else if(arguments.length===1){for(var n=arguments[0],i=new fe,r=n.getChildBoundables().iterator();r.hasNext();){var l=r.next();if(l instanceof er){var f=e.itemsTree(l);f!==null&&i.add(f)}else l instanceof Rs?i.add(l.getItem()):ln.shouldNeverReachHere()}return i.size()<=0?null:i}};wr.prototype.insert=function(e,t){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Rs(e,t))};wr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new fe;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],l=arguments[2];if(ln.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 er?e.boundablesAtLevel(i,a,l):(ln.isTrue(a instanceof Rs),i===-1&&l.add(a))}return null}};wr.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new fe;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 er)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 er?e.query(l,S,a):S instanceof Rs?a.visitItem(S.getItem()):ln.shouldNeverReachHere())}else if(We(arguments[2],As)&&arguments[0]instanceof Object&&arguments[1]instanceof er)for(var L=arguments[0],A=arguments[1],P=arguments[2],D=A.getChildBoundables(),F=0;Fn&&(n=l)}}return n+1}};wr.prototype.createParentBoundables=function(e,t){var n=this;ln.isTrue(!e.isEmpty());var i=new fe;i.add(this.createNode(t));var r=new fe(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};wr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};wr.prototype.interfaces_=function(){return[xs]};wr.prototype.getClass=function(){return wr};wr.compareDoubles=function(e,t){return e>t?1:e0);for(var f=new fe,a=0;a0;){var D=P.poll(),F=D.getDistance();if(F>=L)break;D.isLeaves()?(L=F,A=D):D.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],Z=new Rs(U,Y),K=new Zi(this.getRoot(),Z,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}(wr),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 Re(r.getBounds()):n.expandToInclude(r.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(er),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 ln.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 fe;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 _i("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 Vi=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};Vi.prototype.getCoordinates=function(){return this._pts};Vi.prototype.size=function(){return this._pts.length};Vi.prototype.getCoordinate=function(e){return this._pts[e]};Vi.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Vi.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Vi.prototype.setData=function(e){this._data=e};Vi.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Sc.octant(e,t)};Vi.prototype.getData=function(){return this._data};Vi.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)}};Vi.prototype.toString=function(){return Ns.toLineString(new Oi(this._pts))};Vi.prototype.getNodeList=function(){return this._nodeList};Vi.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 be.orientationIndex(this.p0,this.p1,i)}};Oe.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Oe.prototype.isVertical=function(){return this.p0.x===this.p1.x};Oe.prototype.equals=function(e){if(!(e instanceof Oe))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Oe.prototype.intersection=function(e){var t=new $u;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Oe.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 Oe){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 Oe(f,a)}};Oe.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Oe.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Oe.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Oe.prototype.distancePerpendicular=function(e){return be.distancePointLinePerpendicular(e,this.p0,this.p1)};Oe.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Oe.prototype.midPoint=function(){return Oe.midPoint(this.p0,this.p1)};Oe.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 nn.NaN;var r=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i;return r};Oe.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=nn.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||nn.isNaN(t))&&(t=1),t};Oe.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Oe.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Oe.prototype.distance=function(){if(arguments[0]instanceof Oe){var e=arguments[0];return be.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Dt){var t=arguments[0];return be.distancePointLine(t,this.p0,this.p1)}};Oe.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};Oe.prototype.hashCode=function(){var e=nn.doubleToLongBits(this.p0.x);e^=nn.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=nn.doubleToLongBits(this.p1.x);n^=nn.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return t^i};Oe.prototype.interfaces_=function(){return[bs,xs]};Oe.prototype.getClass=function(){return Oe};Oe.midPoint=function(e,t){return new Dt((e.x+t.x)/2,(e.y+t.y)/2)};Rx.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Oe,Rx);var ed=function(){this.tempEnv1=new Re,this.tempEnv2=new Re,this._overlapSeg1=new Oe,this._overlapSeg2=new Oe};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 Ao=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};Ao.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Ao.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=Xn.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),Rn=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}};Rn.prototype.getEndCapStyle=function(){return this._endCapStyle};Rn.prototype.isSingleSided=function(){return this._isSingleSided};Rn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Rn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Rn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Rn.JOIN_ROUND&&(this._quadrantSegments=Rn.DEFAULT_QUADRANT_SEGMENTS)};Rn.prototype.getJoinStyle=function(){return this._joinStyle};Rn.prototype.setJoinStyle=function(e){this._joinStyle=e};Rn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Rn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Rn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Rn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Rn.prototype.getMitreLimit=function(){return this._mitreLimit};Rn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Rn.prototype.setSingleSided=function(e){this._isSingleSided=e};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.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(Rn,xl);var ki=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=be.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])};Jo.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-=Cn.PI_TIMES_2;for(;e<=-Math.PI;)e+=Cn.PI_TIMES_2;return e};Cn.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)}};Cn.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};Cn.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};Cn.interiorAngle=function(e,t,n){var i=Cn.angle(t,e),r=Cn.angle(t,n);return Math.abs(r-i)};Cn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=Cn.PI_TIMES_2;e>=Cn.PI_TIMES_2&&(e=0)}else{for(;e>=Cn.PI_TIMES_2;)e-=Cn.PI_TIMES_2;e<0&&(e=0)}return e};Cn.angleBetween=function(e,t,n){var i=Cn.angle(t,e),r=Cn.angle(t,n);return Cn.diff(i,r)};Cn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};Cn.toRadians=function(e){return e*Math.PI/180};Cn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?Cn.COUNTERCLOCKWISE:n<0?Cn.CLOCKWISE:Cn.NONE};Cn.angleBetweenOriented=function(e,t,n){var i=Cn.angle(t,e),r=Cn.angle(t,n),l=r-i;return l<=-Math.PI?l+Cn.PI_TIMES_2:l>Math.PI?l-Cn.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 be.COUNTERCLOCKWISE};Bc.CLOCKWISE.get=function(){return be.CLOCKWISE};Bc.NONE.get=function(){return be.COLLINEAR};Object.defineProperties(Cn,Bc);var pi=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 Oe,this._seg1=new Oe,this._offset0=new Oe,this._offset1=new Oe,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 $u,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Rn.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}};pi.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=be.computeOrientation(this._s0,this._s1,this._s2),i=n===be.CLOCKWISE&&this._side===se.LEFT||n===be.COUNTERCLOCKWISE&&this._side===se.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};pi.prototype.addLineEndCap=function(e,t){var n=new Oe(e,t),i=new Oe;this.computeOffsetSegment(n,se.LEFT,this._distance,i);var r=new Oe;this.computeOffsetSegment(n,se.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 Rn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(t,a+Math.PI/2,a-Math.PI/2,be.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Rn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Rn.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}};pi.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};pi.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())};pi.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===be.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)};pi.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)}};pi.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()};pi.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};pi.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Jo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*pi.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};pi.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()===Rn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Rn.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,be.CLOCKWISE,this._distance))};pi.prototype.closeRing=function(){this._segList.closeRing()};pi.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};pi.prototype.interfaces_=function(){return[]};pi.prototype.getClass=function(){return pi};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(pi,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&&yn.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],se.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],se.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===se.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],se.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],se.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 Rn.CAP_ROUND:t.createCircle(e);break;case Rn.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],se.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],se.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment()};mo.prototype.getSegGen=function(e){return new pi(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)&&be.computeOrientation(e._seg.p0,e._seg.p1,f)!==be.RIGHT){var A=a.getDepth(se.LEFT);e._seg.p0.equals(x[S])||(A=a.getDepth(se.RIGHT));var P=new Bu(e._seg,A);_.add(P)}}else if(We(arguments[2],As)&&arguments[0]instanceof Dt&&We(arguments[1],As))for(var D=arguments[0],F=arguments[1],U=arguments[2],Y=F.iterator();Y.hasNext();){var V=Y.next();V.isForward()&&e.findStabbedSegments(D,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};zx.DepthSegment.get=function(){return Bu};Object.defineProperties(Ec,zx);var Bu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Oe(e),this._leftDepth=t};Bu.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)};Bu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Bu.prototype.toString=function(){return this._upwardSeg.toString()};Bu.prototype.interfaces_=function(){return[bs]};Bu.prototype.getClass=function(){return Bu};var zn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};zn.prototype.area=function(){return zn.area(this.p0,this.p1,this.p2)};zn.prototype.signedArea=function(){return zn.signedArea(this.p0,this.p1,this.p2)};zn.prototype.interpolateZ=function(e){if(e===null)throw new _i("Supplied point is null.");return zn.interpolateZ(e,this.p0,this.p1,this.p2)};zn.prototype.longestSideLength=function(){return zn.longestSideLength(this.p0,this.p1,this.p2)};zn.prototype.isAcute=function(){return zn.isAcute(this.p0,this.p1,this.p2)};zn.prototype.circumcentre=function(){return zn.circumcentre(this.p0,this.p1,this.p2)};zn.prototype.area3D=function(){return zn.area3D(this.p0,this.p1,this.p2)};zn.prototype.centroid=function(){return zn.centroid(this.p0,this.p1,this.p2)};zn.prototype.inCentre=function(){return zn.inCentre(this.p0,this.p1,this.p2)};zn.prototype.interfaces_=function(){return[]};zn.prototype.getClass=function(){return zn};zn.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)};zn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};zn.det=function(e,t,n,i){return e*i-t*n};zn.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,D=(-_*L+f*A)/S,F=t.z+P*(n.z-t.z)+D*(i.z-t.z);return F};zn.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};zn.isAcute=function(e,t,n){return!(!Cn.isAcute(e,t,n)||!Cn.isAcute(t,n,e)||!Cn.isAcute(n,e,t))};zn.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*zn.det(l,f,a,_),S=zn.det(f,l*l+f*f,_,a*a+_*_),L=zn.det(l,l*l+f*f,a,a*a+_*_),A=i-S/x,P=r+L/x;return new Dt(A,P)};zn.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)};zn.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 _};zn.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};zn.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)};zn.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 fe;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=se.LEFT;this._distance<0&&(n=-this._distance,i=se.RIGHT);var r=e.getExteriorRing(),l=yn.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,se.opposite(i),zt.INTERIOR,zt.EXTERIOR)}};vs.prototype.isTriangleErodedCompletely=function(e,t){var n=new zn(e[0],e[1],e[2]),i=n.inCentre(),r=be.distancePointLine(i,n.p0,n.p1);return r=Va.MINIMUM_VALID_SIZE&&be.isCCW(e)&&(l=r,f=i,n=se.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 nr?this.addPolygon(e):e instanceof Pi?this.addLineString(e):e instanceof Po?this.addPoint(e):e instanceof jh?this.addCollection(e):e instanceof zu?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 Wo=function(){this._geom=null;var e=arguments[0];this._geom=e};Wo.prototype.locate=function(e){return Wo.locate(e,this._geom)};Wo.prototype.interfaces_=function(){return[Wh]};Wo.prototype.getClass=function(){return Wo};Wo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?be.isPointInRing(e,t.getCoordinates()):!1};Wo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Wo.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(se.LEFT),f=i.getDepth(se.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&&(ln.isTrue(r!==null,"found null for first outgoing dirEdge"),ln.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 qn(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),Fx=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 RC)},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 yn.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 fe,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 qn(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 Uu=function(){};Uu.prototype.getChainStartIndices=function(e){var t=this,n=0,i=new fe;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}}};Tr.prototype.getDelta=function(e){return this._depth[e][se.RIGHT]-this._depth[e][se.LEFT]};Tr.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Tr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Tr.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]=Tr.depthAtLocation(r):e._depth[n][i]+=Tr.depthAtLocation(r))}else if(arguments.length===3){var l=arguments[0],f=arguments[1],a=arguments[2];a===zt.INTERIOR&&this._depth[l][f]++}};Tr.prototype.interfaces_=function(){return[]};Tr.prototype.getClass=function(){return Tr};Tr.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Tr.NULL_VALUE};Bx.NULL_VALUE.get=function(){return-1};Object.defineProperties(Tr,Bx);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 Tr,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,qn.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 Re;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 ln.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 Re(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};Ux.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(go,Ux);var id=function(){this.tempEnv1=new Re,this.selectedSegment=new Oe};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},Gx={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 jx(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};Gx.HotPixelSnapAction.get=function(){return jx};Object.defineProperties(Xh,Gx);var jx=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 fe};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=Cr.precisionScaleFactor(this._argGeom,this._distance,n),r=new On(i);this.bufferFixedPrecision(r)}};Cr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===On.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};Cr.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};Cr.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{}};Cr.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};Cr.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};Cr.prototype.interfaces_=function(){return[]};Cr.prototype.getClass=function(){return Cr};Cr.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new Cr(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 Cr(r);a.setQuadrantSegments(f);var _=a.getResultGeometry(l);return _}else if(arguments[2]instanceof Rn&&arguments[0]instanceof $e&&typeof arguments[1]=="number"){var x=arguments[0],S=arguments[1],L=arguments[2],A=new Cr(x,L),P=A.getResultGeometry(S);return P}}else if(arguments.length===4){var D=arguments[0],B=arguments[1],U=arguments[2],Y=arguments[3],V=new Cr(D);V.setQuadrantSegments(U),V.setEndCapStyle(Y);var Z=V.getResultGeometry(B);return Z}};Cr.precisionScaleFactor=function(e,t,n){var i=e.getEnvelopeInternal(),r=Yo.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 Rn.CAP_ROUND};hf.CAP_BUTT.get=function(){return Rn.CAP_FLAT};hf.CAP_FLAT.get=function(){return Rn.CAP_FLAT};hf.CAP_SQUARE.get=function(){return Rn.CAP_SQUARE};hf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Cr,hf);var Kr=function(){this._pt=[new Dt,new Dt],this._distance=nn.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 Oe,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}},qx={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};qx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Jr,qx);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 fe)}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 nr)&&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 fe;return e.apply(new Tc(t)),t};var Pr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Fs,this._minDistanceLocation=null,this._minDistance=nn.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}};Pr.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(),D=L.getCoordinates(),B=0;Bthis._distance&&this.initialize(t,n,i)}};Vr.prototype.interfaces_=function(){return[]};Vr.prototype.getClass=function(){return Vr};var na=function(){};na.prototype.interfaces_=function(){return[]};na.prototype.getClass=function(){return na};na.computeDistance=function(){if(arguments[2]instanceof Vr&&arguments[0]instanceof Pi&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=new Oe,r=e.getCoordinates(),l=0;l1||e<=0)throw new _i("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 Vr,this._minPtDist=new Vr,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 Vr,this._minPtDist=new Vr,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 nr||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 Pr(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")};kr.prototype.report=function(e){if(!kr.VERBOSE)return null;Lr.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};kr.prototype.getErrorMessage=function(){return this._errorMsg};kr.prototype.interfaces_=function(){return[]};kr.prototype.getClass=function(){return kr};kr.isValidMsg=function(e,t,n){var i=new kr(e,t,n);return i.isValid()?null:i.getErrorMessage()};kr.isValid=function(e,t,n){var i=new kr(e,t,n);return!!i.isValid()};$y.VERBOSE.get=function(){return!1};$y.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(kr,$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 Oi(this._pts))};_a.prototype.interfaces_=function(){return[Ga]};_a.prototype.getClass=function(){return _a};var Sr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new fe,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};Sr.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Sr.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};Sr.prototype.getIntersectionSegments=function(){return this._intSegments};Sr.prototype.count=function(){return this._intersectionCount};Sr.prototype.getIntersections=function(){return this._intersections};Sr.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Sr.prototype.setKeepIntersections=function(e){this._keepIntersections=e};Sr.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++)};Sr.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};Sr.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Sr.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Sr.prototype.interfaces_=function(){return[Vu]};Sr.prototype.getClass=function(){return Sr};Sr.createAllIntersectionsFinder=function(e){var t=new Sr(e);return t.setFindAllIntersections(!0),t};Sr.createAnyIntersectionFinder=function(e){return new Sr(e)};Sr.createIntersectionCounter=function(e){var t=new Sr(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Bs=function(){this._li=new $u,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 Sr(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 ju=function e(){this._nv=null;var t=arguments[0];this._nv=new Bs(e.toSegmentStrings(t))};ju.prototype.checkValid=function(){this._nv.checkValid()};ju.prototype.interfaces_=function(){return[]};ju.prototype.getClass=function(){return ju};ju.toSegmentStrings=function(e){for(var t=new fe,n=e.iterator();n.hasNext();){var i=n.next();t.add(new _a(i.getCoordinates(),i))}return t};ju.checkValid=function(e){var t=new ju(e);t.checkValid()};var Mc=function(e){this._mapOp=e};Mc.prototype.map=function(e){for(var t=this,n=new fe,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 Oe,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=nn.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(zi.computeOverlaySnapTolerance(r),zi.computeOverlaySnapTolerance(l))}};zi.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),i=n*zi.SNAP_PRECISION_FACTOR;return i};zi.snapToSelf=function(e,t,n){var i=new zi(e);return i.snapToSelf(t,n)};Zx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(zi,Zx);var $x=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 nn.longBitsToDouble(this._commonBits)};Yr.prototype.add=function(e){var t=nn.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=nn.longBitsToDouble(e),n=nn.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 Er=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()};Er.prototype.selfSnap=function(e){var t=new zi(e),n=t.snapTo(e,this._snapTolerance);return n};Er.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};Er.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};Er.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=an.overlayOp(t[0],t[1],e);return this.prepareResult(n)};Er.prototype.checkValid=function(e){e.isValid()||Lr.out.println("Snapped geometry is invalid")};Er.prototype.computeSnapTolerance=function(){this._snapTolerance=zi.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};Er.prototype.snap=function(e){var t=this.removeCommonBits(e),n=zi.snap(t[0],t[1],this._snapTolerance);return n};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Er.overlayOp=function(e,t,n){var i=new Er(e,t);return i.getResultGeometry(n)};Er.union=function(e,t){return Er.overlayOp(e,t,an.UNION)};Er.intersection=function(e,t){return Er.overlayOp(e,t,an.INTERSECTION)};Er.symDifference=function(e,t){return Er.overlayOp(e,t,an.SYMDIFFERENCE)};Er.difference=function(e,t){return Er.overlayOp(e,t,an.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=an.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=Er.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,an.UNION)};ro.intersection=function(e,t){return ro.overlayOp(e,t,an.INTERSECTION)};ro.symDifference=function(e,t){return ro.overlayOp(e,t,an.SYMDIFFERENCE)};ro.difference=function(e,t){return ro.overlayOp(e,t,an.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 Ar=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};Ar.prototype.isTrivialIntersection=function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(Ar.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};Ar.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Ar.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Ar.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Ar.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};Ar.prototype.hasProperIntersection=function(){return this._hasProper};Ar.prototype.hasIntersection=function(){return this._hasIntersection};Ar.prototype.isDone=function(){return this._isDone};Ar.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Ar.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Ar.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))))};Ar.prototype.interfaces_=function(){return[]};Ar.prototype.getClass=function(){return Ar};Ar.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var OC=function(e){function t(){e.call(this),this.events=new fe,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 zC=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),FC=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 fe,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 fe;;){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 zC(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=yn.removeRepeatedPoints(n.getCoordinates());if(l.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var f=i,a=r;be.isCCW(l)&&(f=r,a=i);var _=new ig(l,new qn(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 qn(n,r):f.setLocation(n,r)},t.prototype.createEdgeSetIntersector=function(){return new OC},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 nr)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 zu)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 $u,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 Du=function(){};Du.prototype.interfaces_=function(){return[]};Du.prototype.getClass=function(){return Du};Du.map=function(){if(arguments[0]instanceof $e&&We(arguments[1],Du.MapOp)){for(var e=arguments[0],t=arguments[1],n=new fe,i=0;i=e.size()?null:e.get(t)};$i.union=function(e){var t=new $i(e);return t.union()};Hx.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties($i,Hx);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 an.createEmptyResult(an.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,an.UNION)};function Wu(){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,Kn=Math.PI,fl=Kn/2,w1=Kn/4,vl=Kn*2,Tu=180/Kn,Qs=Kn/180,Qr=Math.abs,BC=Math.atan,tf=Math.atan2,Qi=Math.cos,tr=Math.sin,ff=Math.sqrt;function Yx(e){return e>1?0:e<-1?Kn: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;++iKn?e-vl:e<-Kn?e+vl:e,t]}Sy.invert=Sy;function UC(e,t,n){return(e%=vl)?t||n?Kx(T1(e),L1(t,n)):T1(e):t||n?L1(t,n):Sy}function C1(e){return function(t,n){return t+=e,[t>Kn?t-vl:t<-Kn?t+vl:t,n]}}function T1(e){var t=C1(e);return t.invert=C1(-e),t}function L1(e,t){var n=Qi(e),i=tr(e),r=Qi(t),l=tr(t);function f(a,_){var x=Qi(_),S=Qi(a)*x,L=tr(a)*x,A=tr(_),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=Qi(_),S=Qi(a)*x,L=tr(a)*x,A=tr(_),P=A*r-L*l;return[tf(L*r+A*l,S*n+P*i),Ac(P*n-S*i)]},f}function GC(e,t,n,i,r,l){if(n){var f=Qi(t),a=tr(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 jC(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,D;if(D=n-f,!(!A&&D>0)){if(D/=A,A<0){if(D0){if(D>L)return;D>S&&(S=D)}if(D=r-f,!(!A&&D<0)){if(D/=A,A<0){if(D>L)return;D>S&&(S=D)}else if(A>0){if(D0)){if(D/=P,P<0){if(D0){if(D>L)return;D>S&&(S=D)}if(D=l-a,!(!P&&D<0)){if(D/=P,P<0){if(D>L)return;D>S&&(S=D)}else if(P>0){if(D0&&(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 qC(e){return e.length===1&&(e=ZC(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 ZC(e){return function(t,n){return tw(e(t),n)}}qC(tw);function ew(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 $C(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,D=0;if(x==null||(P=f(x,L))!==(D=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)!==D);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=Jx(),A,P,D,B,U,Y,V,Z,K,it,mt,ht={point:gt,lineStart:bt,lineEnd:ee,polygonStart:It,polygonEnd:_t};function gt(Gt,Qt){r(Gt,Qt)&&S.point(Gt,Qt)}function lt(){for(var Gt=0,Qt=0,ne=P.length;Qti&&(dn-Be)*(i-Ve)>(Fn-Ve)*(e-Be)&&++Gt:Fn<=i&&(dn-Be)*(i-Ve)<(Fn-Ve)*(e-Be)&&--Gt;return Gt}function It(){S=L,A=[],P=[],mt=!0}function _t(){var Gt=lt(),Qt=mt&&Gt,ne=(A=ew(A)).length;(Qt||ne)&&(x.polygonStart(),Qt&&(x.lineStart(),l(null,null,1,x),x.lineEnd()),ne&&Qx(A,a,Gt,l,x),x.polygonEnd()),S=x,A=P=D=null}function bt(){ht.point=kt,P&&P.push(D=[]),it=!0,K=!1,V=Z=NaN}function ee(){A&&(kt(B,U),Y&&K&&L.rejoin(),A.push(L.result())),ht.point=gt,K&&S.lineEnd()}function kt(Gt,Qt){var ne=r(Gt,Qt);if(P&&D.push([Gt,Qt]),it)B=Gt,U=Qt,Y=ne,it=!1,ne&&(S.lineStart(),S.point(Gt,Qt));else if(ne&&K)S.point(Gt,Qt);else{var Ie=[V=Math.max(Om,Math.min(Dp,V)),Z=Math.max(Om,Math.min(Dp,Z))],bn=[Gt=Math.max(Om,Math.min(Dp,Gt)),Qt=Math.max(Om,Math.min(Dp,Qt))];jC(Ie,bn,e,t,n,i)?(K||(S.lineStart(),S.point(Ie[0],Ie[1])),S.point(bn[0],bn[1]),ne||S.lineEnd(),mt=!1):ne&&(S.lineStart(),S.point(Gt,Qt),mt=!1)}V=Gt,Z=Qt,K=ne}return ht}}var K_=Wu();function WC(e,t){var n=t[0],i=t[1],r=[tr(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],P=L[1]/2+w1,D=tr(P),B=Qi(P),U=0;U=0?1:-1,gt=ht*mt,lt=gt>Kn,It=D*K;if(K_.add(tf(It*ht*tr(gt),B*it+It*Qi(gt))),l+=lt?mt+ht*vl:mt,lt^A>=n^V>=n){var _t=lg(ef(L),ef(Y));wy(_t);var bt=lg(r,_t);wy(bt);var ee=(lt^mt>=0?-1:1)*Ac(bt[2]);(i>ee||i===ee&&(_t[0]||_t[1]))&&(f+=lt^mt>=0?1:-1)}}return(l<-Mi||lsd&&(sd=e),tcg&&(cg=t)}Wu();function nw(e,t,n,i){return function(r,l){var f=t(l),a=r.invert(i[0],i[1]),_=Jx(),x=t(_),S=!1,L,A,P,D={point:B,lineStart:Y,lineEnd:V,polygonStart:function(){D.point=Z,D.lineStart=K,D.lineEnd=it,A=[],L=[]},polygonEnd:function(){D.point=B,D.lineStart=Y,D.lineEnd=V,A=ew(A);var mt=WC(L,a);A.length?(S||(l.polygonStart(),S=!0),Qx(A,YC,mt,n,l)):mt&&(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(mt,ht){var gt=r(mt,ht);e(mt=gt[0],ht=gt[1])&&l.point(mt,ht)}function U(mt,ht){var gt=r(mt,ht);f.point(gt[0],gt[1])}function Y(){D.point=U,f.lineStart()}function V(){D.point=B,f.lineEnd()}function Z(mt,ht){P.push([mt,ht]);var gt=r(mt,ht);x.point(gt[0],gt[1])}function K(){x.lineStart(),P=[]}function it(){Z(P[0][0],P[0][1]),x.lineEnd();var mt=x.clean(),ht=_.result(),gt,lt=ht.length,It,_t,bt;if(P.pop(),L.push(P),P=null,!!lt){if(mt&1){if(_t=ht[0],(It=_t.length-1)>0){for(S||(l.polygonStart(),S=!0),l.lineStart(),gt=0;gt1&&mt&2&&ht.push(ht.pop().concat(ht.shift())),A.push(ht.filter(HC))}}return D}}function HC(e){return e.length>1}function YC(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=nw(function(){return!0},KC,QC,[-Kn,-fl]);function KC(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,_=Qr(l-t);Qr(_-Kn)0?fl:-fl),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(l,n),r=0):i!==a&&_>=Kn&&(Qr(t-i)Mi?BC((tr(t)*(l=Qi(i))*tr(n)-tr(i)*(r=Qi(t))*tr(e))/(r*l*f)):(t+i)/2}function QC(e,t,n,i){var r;if(e==null)r=n*fl,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(Qr(e[0]-t[0])>Mi){var l=e[0]0,r=Qr(n)>Mi;function l(S,L,A,P){GC(P,e,t,A,S,L)}function f(S,L){return Qi(S)*Qi(L)>n}function a(S){var L,A,P,D,B;return{lineStart:function(){D=P=!1,B=1},point:function(U,Y){var V=[U,Y],Z,K=f(U,Y),it=i?K?0:x(U,Y):K?x(U+(U<0?Kn:-Kn),Y):0;if(!L&&(D=P=K)&&S.lineStart(),K!==P&&(Z=_(L,V),(!Z||jm(L,Z)||jm(V,Z))&&(V[0]+=Mi,V[1]+=Mi,K=f(V[0],V[1]))),K!==P)B=0,K?(S.lineStart(),Z=_(V,L),S.point(Z[0],Z[1])):(Z=_(L,V),S.point(Z[0],Z[1]),S.lineEnd()),L=Z;else if(r&&L&&i^K){var mt;!(it&A)&&(mt=_(V,L,!0))&&(B=0,i?(S.lineStart(),S.point(mt[0][0],mt[0][1]),S.point(mt[1][0],mt[1][1]),S.lineEnd()):(S.point(mt[1][0],mt[1][1]),S.lineEnd(),S.lineStart(),S.point(mt[0][0],mt[0][1])))}K&&(!L||!jm(L,V))&&S.point(V[0],V[1]),L=V,P=K,A=it},lineEnd:function(){P&&S.lineEnd(),L=null},clean:function(){return B|(D&&P)<<1}}}function _(S,L,A){var P=ef(S),D=ef(L),B=[1,0,0],U=lg(P,D),Y=Nm(U,U),V=U[0],Z=Y-V*V;if(!Z)return!A&&S;var K=n*Y/Z,it=-n*V/Z,mt=lg(B,U),ht=Dm(B,K),gt=Dm(U,it);Y_(ht,gt);var lt=mt,It=Nm(ht,lt),_t=Nm(lt,lt),bt=It*It-_t*(Nm(ht,ht)-1);if(!(bt<0)){var ee=ff(bt),kt=Dm(lt,(-It-ee)/_t);if(Y_(kt,ht),kt=xy(kt),!A)return kt;var Gt=S[0],Qt=L[0],ne=S[1],Ie=L[1],bn;Qt0^kt[1]<(Qr(kt[0]-Gt)Kn^(Gt<=kt[0]&&kt[0]<=Qt)){var Ve=Dm(lt,(-It+ee)/_t);return Y_(Ve,ht),[kt,xy(Ve)]}}}function x(S,L){var A=i?e:Kn-e,P=0;return S<-A?P|=1:S>A&&(P|=2),L<-A?P|=4:L>A&&(P|=8),P}return nw(f,a,l,i?[0,-e]:[-Kn,e-Kn])}function iw(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 rw(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),VC(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 eT(e,t,n){return rw(e,[[0,0],t],n)}var D1=16,nT=Qi(30*Qs);function R1(e,t){return+t?rT(e,t):iT(e)}function iT(e){return iw({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function rT(e,t){function n(i,r,l,f,a,_,x,S,L,A,P,D,B,U){var Y=x-i,V=S-r,Z=Y*Y+V*V;if(Z>4*t&&B--){var K=f+A,it=a+P,mt=_+D,ht=ff(K*K+it*it+mt*mt),gt=Ac(mt/=ht),lt=Qr(Qr(mt)-1)t||Qr((Y*ee+V*kt)/Z-.5)>.3||f*A+a*P+_*D2?kt[2]%360*Qs:0,bt()):[x*Tu,S*Tu,L*Tu]},lt.precision=function(kt){return arguments.length?(mt=R1(_t,it=kt*kt),ee()):ff(it)},lt.fitExtent=function(kt,Gt){return rw(lt,kt,Gt)},lt.fitSize=function(kt,Gt){return eT(lt,kt,Gt)};function bt(){P=Kx(A=UC(x,S,L),t);var kt=t(a,_);return l=i-kt[0]*n,f=r+kt[1]*n,ee()}function ee(){return ht=gt=null,lt}return function(){return t=e.apply(this,arguments),lt.invert=t.invert&&It,bt()}}function ow(e){return function(t,n){var i=Qi(t),r=Qi(n),l=e(i*r);return[l*r*tr(t),l*tr(n)]}}function sw(e){return function(t,n){var i=ff(t*t+n*n),r=e(i),l=tr(r),f=Qi(r);return[tf(t*l,i*f),Ac(i&&n*l/i)]}}var lT=ow(function(e){return ff(2/(1+e))});lT.invert=sw(function(e){return 2*Ac(e/2)});var aw=ow(function(e){return(e=Yx(e))&&e/tr(e)});aw.invert=sw(function(e){return e});function uT(){return sT(aw).scale(79.4188).clipAngle(180-.001)}function O1(e,t){return[e,t]}O1.invert=O1;function cT(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 wx(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 wx(e,function(B){var U=qm(B,t,n,i);U&&f.push(U)}),_y(f)}var a=hT(l),_={type:l.type,coordinates:uw(l.coordinates,a)},x=new Uy,S=x.read(_),L=yC(vC(t,n),"meters"),A=Cr.bufferOp(S,L,i),P=new Ax;if(A=P.write(A),!lw(A.coordinates)){var D={type:A.type,coordinates:cw(A.coordinates,a)};return vg(D,r)}}function lw(e){return Array.isArray(e[0])?lw(e[0]):isNaN(e[0])}function uw(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return uw(n,t)})}function cw(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return cw(n,t)})}function hT(e){var t=xC(e).geometry.coordinates,n=[-t[0],-t[1]];return uT().rotate(n).scale(Zo)}function fT(e,t){var n=tg(e),i=tg(t),r=e.properties||{},l=_x.difference(n.coordinates,i.coordinates);return l.length===0?null:l.length===1?vx(l[0],r):bx(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=fT({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const i=cT(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 pT(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=D=>{a==null||a({type:"mapClick",coordinates:[D.lngLat.lng,D.lngLat.lat]})};function P(D=!1){if(!t)throw new Error;const B=document.createElement("div");return D&&B.classList.add("marker-interactive"),new GI({props:{displayIn:"maplibre"},target:B}),new t.Marker({element:B,offset:[1,-13]})}return{setEventHandler(D){D?(a=D,e.on("click",A)):(a=void 0,e.off("click",A))},flyTo(D,B){e.flyTo({center:D,zoom:B,...r})},fitBounds(D,B,U){e.fitBounds([[D[0],D[1]],[D[2],D[3]]],{padding:B,maxZoom:U,...l})},indicateReverse(D){e.getCanvasContainer().style.cursor=D?"crosshair":""},setReverseMarker(D){!t||!n||(S?D?S.setLngLat(D):(S.remove(),S=void 0):D&&(S=(typeof n=="object"?new t.Marker(n):P()).setLngLat(D).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(D,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(Z=>Z.type==="Polygon"||Z.type==="MultiPolygon");if(V.length>0){let Z=V.pop();for(const K of V)Z=bC(Z,K);F1({...B,geometry:Z},U),Y=!0}else{const Z=B.geometry.geometries.filter(K=>K.type==="LineString"||K.type==="MultiLineString");Z.length>0&&(U({...B,geometry:{type:"GeometryCollection",geometries:Z}}),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 D??[]){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),Z=V.getElement();Z.addEventListener("click",K=>{K.stopPropagation(),a==null||a({type:"markerClick",id:Y.id})}),Z.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:Y.id}),V.togglePopup()}),Z.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:Y.id}),V.togglePopup()}),_.push(V)}}},setSelectedMarker(D){x&&x.getElement().classList.toggle("marker-selected",!1),x=D>-1?_[D]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const D=e.getCenter();return[e.getZoom(),D.lng,D.lat]}}}function dT(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){St(i,t,r),ft(t,n)},p:Ce,i:Ce,o:Ce,d(i){i&&wt(t)}}}class hw extends tn{constructor(t){super(),Qe(this,t,null,dT,He,{})}}function mT(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){St(i,t,r),ft(t,n)},p:Ce,i:Ce,o:Ce,d(i){i&&wt(t)}}}class fw extends tn{constructor(t){super(),Qe(this,t,null,mT,He,{})}}function gT(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function _T(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function yT(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function vT(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function bT(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function xT(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function wT(e){let t,n;return{c(){t=yt("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){St(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&&wt(t)}}}function ST(e){let t,n,i,r;return{c(){t=yt("img"),hr(t.src,n=e[5])||Rt(t,"src",n),Rt(t,"alt",e[4]),Rt(t,"class","svelte-ltkwvy")},m(l,f){St(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&&wt(t),i=!1,r()}}}function V1(e){let t,n;return{c(){t=yt("span"),n=ge(e[6]),Rt(t,"class","secondary svelte-ltkwvy")},m(i,r){St(i,t,r),ft(t,n)},p(i,r){r&64&&Fi(n,i[6])},d(i){i&&wt(t)}}}function ET(e){var ht,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&&((ht=e[0].properties)==null?void 0:ht.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,D,B=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",U,Y,V;function Z(lt,It){var _t,bt;return It&1&&(n=null),It&1&&(i=null),It&1&&(r=null),lt[5]?ST:lt[0].address?wT:((_t=lt[0].properties)==null?void 0:_t.kind)==="road"||((bt=lt[0].properties)==null?void 0:bt.kind)==="road_relation"?xT:(n==null&&(n=!!lt[0].id.startsWith("address.")),n?bT:(i==null&&(i=!!lt[0].id.startsWith("postal_code.")),i?vT:(r==null&&(r=!!lt[0].id.startsWith("poi.")),r?yT:lt[7]?_T:gT)))}let K=Z(e,-1),it=K(e),mt=A&&V1(e);return{c(){t=yt("li"),it.c(),l=Xt(),f=yt("span"),a=yt("span"),_=yt("span"),S=ge(x),L=Xt(),mt&&mt.c(),P=Xt(),D=yt("span"),U=ge(B),Rt(_,"class","primary svelte-ltkwvy"),Rt(a,"class","svelte-ltkwvy"),Rt(D,"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(lt,It){St(lt,t,It),it.m(t,null),ft(t,l),ft(t,f),ft(f,a),ft(a,_),ft(_,S),ft(a,L),mt&&mt.m(a,null),ft(f,P),ft(f,D),ft(D,U),Y||(V=[Ze(t,"mouseenter",e[12]),Ze(t,"focus",e[13])],Y=!0)},p(lt,[It]){var _t,bt;K===(K=Z(lt,It))&&it?it.p(lt,It):(it.d(1),it=K(lt),it&&(it.c(),it.m(t,l))),It&1&&x!==(x=(lt[7]?lt[0].place_name:lt[0].place_name.replace(/,.*/,""))+"")&&Fi(S,x),It&37&&(A=lt[2]==="always"||lt[2]&&!lt[0].address&&((_t=lt[0].properties)==null?void 0:_t.kind)!=="road"&&((bt=lt[0].properties)==null?void 0:bt.kind)!=="road_relation"&&!lt[0].id.startsWith("address.")&&!lt[0].id.startsWith("postal_code.")&&(!lt[0].id.startsWith("poi.")||!lt[5])&&!lt[7]),A?mt?mt.p(lt,It):(mt=V1(lt),mt.c(),mt.m(a,null)):mt&&(mt.d(1),mt=null),It&1&&B!==(B=(lt[7]?"":lt[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Fi(U,B),It&2&&Rt(t,"data-selected",lt[1]),It&2&&hl(t,"selected",lt[1])},i:Ce,o:Ce,d(lt){lt&&wt(t),it.d(),mt&&mt.d(),Y=!1,No(V)}}}function IT(e,t,n){var Z;let i,r,{feature:l}=t,{selected:f=!1}=t,{showPlaceType:a}=t,{missingIconsCache:_}=t,{iconsBaseUrl:x}=t;const S=(Z=l.properties)==null?void 0:Z.categories;let L,A,P=0,D=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,it,mt,ht;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=(K=l.properties)==null?void 0:K.categories)==null?void 0:it.join(", "):((ht=(mt=l.properties)==null?void 0:mt.place_type_name)==null?void 0:ht[0])??l.place_type[0])},n(11,i=(S==null?void 0:S.length)??0),[l,f,a,x,L,A,r,D,B,_,P,i,U,Y,V]}class CT extends tn{constructor(t){super(),Qe(this,t,IT,ET,He,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function TT(e){let t;return{c(){t=yt("div"),t.innerHTML='',Rt(t,"class","svelte-7cmwmc")},m(n,i){St(n,t,i)},p:Ce,i:Ce,o:Ce,d(n){n&&wt(t)}}}class LT extends tn{constructor(t){super(),Qe(this,t,null,TT,He,{})}}function MT(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){St(i,t,r),ft(t,n)},p:Ce,i:Ce,o:Ce,d(i){i&&wt(t)}}}class PT extends tn{constructor(t){super(),Qe(this,t,null,MT,He,{})}}function kT(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"),ri(n,"stroke-width","1.875"),ri(n,"fill","none"),Rt(i,"d","M12.063 12.063 7.635 7.635"),ri(i,"stroke-width","1.875"),ri(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){St(r,t,l),ft(t,n),ft(t,i)},p:Ce,i:Ce,o:Ce,d(r){r&&wt(t)}}}class AT extends tn{constructor(t){super(),Qe(this,t,null,kT,He,{})}}function NT(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 RT(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=OT(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 OT(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,Z=0;for(;V<=U;)Y=x.indexOf(P[V],Z),Z=Y+1,V++;S=x.substring(0,Y).trim(),L=x.substring(Y+1).trim()}}const D=S.split(".");if(D.length==2&&D[1]==0&&D[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:zT,toCoordinateFormat:RT})}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,...VT})}),[...e,...UT,...GT]}const qT=jT();Yy.formats=qT.map(e=>e.verbatimCoordinates);const ZT=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 LT({}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Y1(e){let t,n,i,r,l;return n=new PT({}),{c(){t=yt("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){St(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||(dt(n.$$.fragment,f),i=!0)},o(f){vt(n.$$.fragment,f),i=!1},d(f){f&&wt(t),qt(n),r=!1,l()}}}function $T(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{ht=null}),fi()),(!Z||Gt[0]&2)&&hl(x,"displayable",kt[1]!==""),kt[5]===!0?gt?(gt.p(kt,Gt),Gt[0]&32&&dt(gt,1)):(gt=Y1(kt),gt.c(),dt(gt,1),gt.m(i,D)):gt&&(hi(),vt(gt,1,1,()=>{gt=null}),fi()),It&&It.p&&(!Z||Gt[1]&134217728)&&lr(It,lt,kt,kt[58],Z?ar(lt,kt[58],Gt,null):ur(kt[58]),null);let Qt=U;U=ee(kt),U===Qt?~U&&bt[U].p(kt,Gt):(Y&&(hi(),vt(bt[Qt],1,1,()=>{bt[Qt]=null}),fi()),~U?(Y=bt[U],Y?Y.p(kt,Gt):(Y=bt[U]=_t[U](kt),Y.c()),dt(Y,1),Y.m(n,null)):Y=null),(!Z||Gt[0]&4&&V!==(V=Zm(kt[2])+" svelte-zh3kmv"))&&Rt(n,"class",V),(!Z||Gt[0]&22)&&hl(n,"can-collapse",kt[4]&&kt[1]==="")},i(kt){Z||(dt(mt),dt(l.$$.fragment,kt),dt(L.$$.fragment,kt),dt(ht),dt(gt),dt(It,kt),dt(Y),Z=!0)},o(kt){vt(mt),vt(l.$$.fragment,kt),vt(L.$$.fragment,kt),vt(ht),vt(gt),vt(It,kt),vt(Y),Z=!1},d(kt){kt&&(wt(t),wt(n)),qt(l),e[61](null),qt(L),ht&&ht.d(),gt&>.d(),It&&It.d(kt),~U&&bt[U].d(),K=!1,No(it)}}}function KT(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:D=!1}=t,{errorMessage:B="Something went wrong…"}=t,{filter:U=()=>!0}=t,{flyTo:Y=!0}=t,{fuzzyMatch:V=!0}=t,{language:Z=void 0}=t,{limit:K=void 0}=t,{mapController:it=void 0}=t,{minLength:mt=2}=t,{noResultsMessage:ht="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:lt=[{type:"server-geolocation"}]}=t,{reverseActive:It=D==="always"}=t,{reverseButtonTitle:_t="toggle reverse geocoding"}=t,{searchValue:bt=""}=t,{showFullGeometry:ee=!0}=t,{showPlaceType:kt="ifNeeded"}=t,{showResultsWhileTyping:Gt=!0}=t,{selectFirst:Qt=!0}=t,{flyToSelected:ne=!1}=t,{markerOnSelected:Ie=!0}=t,{types:bn=void 0}=t,{excludeTypes:Zn=!1}=t,{zoom:en=16}=t,{maxZoom:Be=18}=t,{apiUrl:Ve="https://api.maptiler.com/geocoding"}=t,{fetchParameters:dn={}}=t,{iconsBaseUrl:Fn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.1/icons/"}=t,{adjustUrlQuery:xn=$=>{}}=t;function oe(){un.focus()}function Ge(){un.blur()}function pn($,ot=!0){n(1,bt=$),ot?(n(15,mn=-1),ns()):(yo(),setTimeout(()=>{un.focus(),un.select()}))}function Bn(){n(14,Lt=void 0),n(55,xe=void 0),n(15,mn=-1)}function yi(){n(54,ke=[]),n(55,xe=void 0)}let Ai=!1,Lt,ke,xe,rn="",un,mn=-1,Xi,$t=[],Ui,fr,Vn,Tn;const es=new Set,oo=Dc();aa(()=>{it&&(it.setEventHandler(void 0),it.indicateReverse(!1),it.setSelectedMarker(-1),it.setMarkers(void 0,void 0))});function ns($){if(fr&&(clearTimeout(fr),fr=void 0),mn>-1&&Lt)n(55,xe=Lt[mn]),n(1,bt=xe.place_type[0]==="reverse"?xe.place_name:xe.place_name.replace(/,.*/,"")),n(18,Xi=void 0),n(54,ke=void 0),n(15,mn=-1);else if(bt){const ot=$||!Ha(bt);Gs(bt,{exact:!0}).then(()=>{n(54,ke=Lt),n(55,xe=void 0),ot&&js()}).catch(Mt=>n(18,Xi=Mt))}}function Ha($){try{return ZT($,6)}catch{return!1}}async function Gs($,{byId:ot=!1,exact:Mt=!1}={}){n(18,Xi=void 0),Ui==null||Ui.abort();const xt=new AbortController;n(19,Ui=xt);try{const rt=Ha($),Ct=new URLSearchParams;if(Z!==void 0&&Ct.set("language",Array.isArray(Z)?Z.join(","):Z??""),bn&&Ct.set("types",bn.join(",")),Zn&&Ct.set("excludeTypes",String(Zn)),_&&Ct.set("bbox",_.map(Ne=>Ne.toFixed(6)).join(",")),A&&Ct.set("country",Array.isArray(A)?A.join(","):A),!ot&&!rt){const Ne=await DT(it,lt,xt);Ne&&Ct.set("proximity",Ne),(Mt||!Gt)&&Ct.set("autocomplete","false"),Ct.set("fuzzyMatch",String(V))}K!==void 0&&(!rt||(bn==null?void 0:bn.length)===1)&&Ct.set("limit",String(K)),Ct.set("key",a),xn(Ct);const Wt=Ve+"/"+encodeURIComponent(rt?rt.decimalLongitude+","+rt.decimalLatitude:$)+".json?"+Ct.toString();if(Wt===rn){ot?(n(14,Lt=void 0),n(55,xe=$t[0])):n(14,Lt=$t);return}rn=Wt;const Ht=await fetch(Wt,{signal:xt.signal,...dn});if(!Ht.ok)throw new Error(await Ht.text());const Kt=await Ht.json();oo("response",{url:Wt,featureCollection:Kt}),ot?(n(14,Lt=void 0),n(55,xe=Kt.features[0]),$t=[xe]):(n(14,Lt=Kt.features.filter(U)),rt&&Lt.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=Lt,rt&&un.focus())}catch(rt){if(rt&&typeof rt=="object"&&"name"in rt&&rt.name==="AbortError")return;throw rt}finally{xt===Ui&&n(19,Ui=void 0)}}function js(){var Mt;if(!(ke!=null&&ke.length)||!Y)return;const $=[180,90,-180,-90],ot=!ke.some(xt=>!xt.matching_text);for(const xt of ke)if(ot||!xt.matching_text)for(const rt of[0,1,2,3])$[rt]=Math[rt<2?"min":"max"]($[rt],((Mt=xt.bbox)==null?void 0:Mt[rt])??xt.center[rt%2]);it&&ke.length>0&&(xe&&$[0]===$[2]&&$[1]===$[3]?it.flyTo(xe.center,en):it.fitBounds(U1($),50,Be))}function Sa($){n(0,It=D==="always"),n(14,Lt=void 0),n(55,xe=void 0),n(15,mn=-1),pn($[1].toFixed(6)+", "+NT($[0],[-180,180],!0).toFixed(6),!1)}function le($){if(!Lt)return;let ot=$.key==="ArrowDown"?1:$.key==="ArrowUp"?-1:0;ot&&(mn===(Qt?0:-1)&&ot===-1&&n(15,mn=Lt.length),n(15,mn+=ot),mn>=Lt.length&&n(15,mn=-1),mn<0&&Qt&&n(15,mn=0),$.preventDefault())}function yo($=!0){if(n(18,Xi=void 0),Gt){if(fr&&clearTimeout(fr),bt.length{Gs(ot).catch(Mt=>n(18,Xi=Mt))},$?P:0)}else n(14,Lt=void 0),n(18,Xi=void 0)}function oi($){n(55,xe=$),n(1,bt=$.place_name),n(15,mn=-1)}const Ea=()=>un.focus();function ws($){cr[$?"unshift":"push"](()=>{un=$,n(17,un)})}function ce(){bt=this.value,n(1,bt),n(13,Ai),n(27,S)}const cn=()=>n(13,Ai=!0),Ke=()=>n(13,Ai=!1),Nr=()=>yo(),is=()=>{n(1,bt=""),un.focus()},sn=()=>n(0,It=!It),Ss=()=>n(18,Xi=void 0),st=$=>n(15,mn=$),G=$=>oi($),q=()=>{Qt||n(15,mn=-1)},J=()=>{};return e.$$set=$=>{"class"in $&&n(2,f=$.class),"apiKey"in $&&n(25,a=$.apiKey),"bbox"in $&&n(26,_=$.bbox),"clearButtonTitle"in $&&n(3,x=$.clearButtonTitle),"clearOnBlur"in $&&n(27,S=$.clearOnBlur),"collapsed"in $&&n(4,L=$.collapsed),"country"in $&&n(28,A=$.country),"debounceSearch"in $&&n(29,P=$.debounceSearch),"enableReverse"in $&&n(5,D=$.enableReverse),"errorMessage"in $&&n(6,B=$.errorMessage),"filter"in $&&n(30,U=$.filter),"flyTo"in $&&n(31,Y=$.flyTo),"fuzzyMatch"in $&&n(32,V=$.fuzzyMatch),"language"in $&&n(33,Z=$.language),"limit"in $&&n(34,K=$.limit),"mapController"in $&&n(35,it=$.mapController),"minLength"in $&&n(36,mt=$.minLength),"noResultsMessage"in $&&n(7,ht=$.noResultsMessage),"placeholder"in $&&n(8,gt=$.placeholder),"proximity"in $&&n(37,lt=$.proximity),"reverseActive"in $&&n(0,It=$.reverseActive),"reverseButtonTitle"in $&&n(9,_t=$.reverseButtonTitle),"searchValue"in $&&n(1,bt=$.searchValue),"showFullGeometry"in $&&n(38,ee=$.showFullGeometry),"showPlaceType"in $&&n(10,kt=$.showPlaceType),"showResultsWhileTyping"in $&&n(39,Gt=$.showResultsWhileTyping),"selectFirst"in $&&n(11,Qt=$.selectFirst),"flyToSelected"in $&&n(40,ne=$.flyToSelected),"markerOnSelected"in $&&n(41,Ie=$.markerOnSelected),"types"in $&&n(42,bn=$.types),"excludeTypes"in $&&n(43,Zn=$.excludeTypes),"zoom"in $&&n(44,en=$.zoom),"maxZoom"in $&&n(45,Be=$.maxZoom),"apiUrl"in $&&n(46,Ve=$.apiUrl),"fetchParameters"in $&&n(47,dn=$.fetchParameters),"iconsBaseUrl"in $&&n(12,Fn=$.iconsBaseUrl),"adjustUrlQuery"in $&&n(48,xn=$.adjustUrlQuery),"$$scope"in $&&n(58,l=$.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,Vn=Ai),S&&!Ai&&n(1,bt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&bt.lengthn(18,Xi=$)),e.$$.dirty[1]&50356241&&(it&&xe&&xe.id!==Tn&&Y&&(!xe.bbox||xe.bbox[0]===xe.bbox[2]&&xe.bbox[1]===xe.bbox[3]?it.flyTo(xe.center,xe.id.startsWith("poi.")||xe.id.startsWith("address.")?Be:en):it.fitBounds(U1(xe.bbox),50,Be),n(14,Lt=void 0),n(54,ke=void 0),n(15,mn=-1)),n(56,Tn=xe==null?void 0:xe.id)),e.$$.dirty[0]&18432&&Qt&&Lt!=null&&Lt.length&&n(15,mn=0),e.$$.dirty[0]&2050&&(Qt||n(15,mn=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&ke!==Lt&&n(54,ke=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&it&&it.setEventHandler($=>{switch($.type){case"mapClick":It&&Sa($.coordinates);break;case"markerClick":{const ot=Lt==null?void 0:Lt.find(Mt=>Mt.id===$.id);ot&&oi(ot)}break;case"markerMouseEnter":ke&&n(15,mn=Vn?(Lt==null?void 0:Lt.findIndex(ot=>ot.id===$.id))??-1:-1);break;case"markerMouseLeave":ke&&n(15,mn=-1);break}}),e.$$.dirty[0]&49152&&n(57,i=Lt==null?void 0:Lt[mn]),e.$$.dirty[1]&67133969&&it&&i&&Y&&ne&&it.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Be:en),e.$$.dirty[1]&1040&&(Ie||it==null||it.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&it&&Ie&&!ke&&(it.setMarkers(i?[i]:void 0,void 0),it.setSelectedMarker(i?0:-1)),e.$$.dirty[1]&25165840&&it&&it.setMarkers(ke,xe),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&ke&&it&&it.setSelectedMarker(mn),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&it){const $=Ha(bt);it.setReverseMarker($?[$.decimalLongitude,$.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&oo("select",i),e.$$.dirty[1]&16777216&&oo("pick",xe),e.$$.dirty[0]&81920&&oo("optionsVisibilityChange",Vn&&!!Lt),e.$$.dirty[0]&16384&&oo("featuresListed",Lt),e.$$.dirty[1]&8388608&&oo("featuresMarked",ke),e.$$.dirty[0]&1&&oo("reverseToggle",It),e.$$.dirty[0]&2&&oo("queryChange",bt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&it&&it.indicateReverse(It)},[It,bt,f,x,L,D,B,ht,gt,_t,kt,Qt,Fn,Ai,Lt,mn,Vn,un,Xi,Ui,es,ns,le,yo,oi,a,_,S,A,P,U,Y,V,Z,K,it,mt,lt,ee,Gt,ne,Ie,bn,Zn,en,Be,Ve,dn,xn,oe,Ge,pn,Bn,yi,ke,xe,Tn,i,l,r,Ea,ws,ce,cn,Ke,Nr,is,sn,Ss,st,G,q,J]}class JT extends tn{constructor(t){super(),Qe(this,t,KT,YT,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 JT({props:{mapController:e[0],apiKey:ky}}),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"class","svelte-ixhnie")},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function QT(e){let t,n,i=e[0]&&J1(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=J1(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function tL(e,t,n){let i,r;return Ee(e,Ru,l=>n(1,r=l)),e.$$.update=()=>{e.$$.dirty&2&&n(0,i=r?pT(r,Ms):null)},[i,r]}class eL extends tn{constructor(t){super(),Qe(this,t,tL,QT,He,{})}}const nL=e=>({}),Q1=e=>({}),iL=e=>({}),tb=e=>({}),rL=e=>({}),eb=e=>({});function oL(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=yt("div"),_&&_.c(),n=Xt(),i=yt("div"),S&&S.c(),r=Xt(),l=yt("div"),A&&A.c(),Rt(t,"class","top svelte-3nmiww"),Rt(i,"class","left svelte-3nmiww"),Rt(l,"class","main svelte-3nmiww")},m(P,D){St(P,t,D),_&&_.m(t,null),St(P,n,D),St(P,i,D),S&&S.m(i,null),St(P,r,D),St(P,l,D),A&&A.m(l,null),f=!0},p(P,[D]){_&&_.p&&(!f||D&1)&&lr(_,a,P,P[0],f?ar(a,P[0],D,rL):ur(P[0]),eb),S&&S.p&&(!f||D&1)&&lr(S,x,P,P[0],f?ar(x,P[0],D,iL):ur(P[0]),tb),A&&A.p&&(!f||D&1)&&lr(A,L,P,P[0],f?ar(L,P[0],D,nL):ur(P[0]),Q1)},i(P){f||(dt(_,P),dt(S,P),dt(A,P),f=!0)},o(P){vt(_,P),vt(S,P),vt(A,P),f=!1},d(P){P&&(wt(t),wt(n),wt(i),wt(r),wt(l)),_&&_.d(P),S&&S.d(P),A&&A.d(P)}}}function sL(e,t,n){let{$$slots:i={},$$scope:r}=t;return e.$$set=l=>{"$$scope"in l&&n(0,r=l.$$scope)},[r,i]}class aL extends tn{constructor(t){super(),Qe(this,t,sL,oL,He,{})}}function lL(e){let t,n,i,r;const l=e[1].default,f=sr(l,e,e[0],null);return{c(){t=yt("a"),f&&f.c(),Rt(t,"href","#")},m(a,_){St(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||(dt(f,a),n=!0)},o(a){vt(f,a),n=!1},d(a){a&&wt(t),f&&f.d(a),i=!1,r()}}}function uL(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 xi extends tn{constructor(t){super(),Qe(this,t,uL,lL,He,{})}}function nb(e){let t,n;return{c(){t=yt("div"),n=ge(e[0]),Rt(t,"class","svelte-1uuov7f")},m(i,r){St(i,t,r),ft(t,n)},p(i,r){r&1&&Fi(n,i[0])},d(i){i&&wt(t)}}}function cL(e){let t,n=e[0]&&nb(e);return{c(){n&&n.c(),t=Do()},m(i,r){n&&n.m(i,r),St(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:Ce,o:Ce,d(i){i&&wt(t),n&&n.d(i)}}}function hL(e,t,n){let{msg:i=null}=t;return e.$$set=r=>{"msg"in r&&n(0,i=r.msg)},[i]}class pw extends tn{constructor(t){super(),Qe(this,t,hL,cL,He,{msg:0})}}const fL=e=>({dialog:e&1}),ib=e=>({dialog:e[0]});function pL(e){let t,n,i,r,l;const f=e[4].default,a=sr(f,e,e[3],ib);return{c(){t=yt("dialog"),n=yt("article"),a&&a.c(),t.open=!0},m(_,x){St(_,t,x),ft(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,fL):ur(_[3]),ib)},i(_){i||(dt(a,_),i=!0)},o(_){vt(a,_),i=!1},d(_){_&&wt(t),a&&a.d(_),e[6](null),r=!1,No(l)}}}function dL(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 tn{constructor(t){super(),Qe(this,t,dL,pL,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},mL={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 gL(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 mw(t).geometry;case"MultiLineString":return dw(t).geometry;case"MultiPolygon":return gw(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 _L(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 wL(e,t){return ad(Ag(e,t))}function SL(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 EL(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 IL(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 CL(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 TL(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 LL=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Iy,bearingToAzimuth:SL,convertArea:IL,convertLength:EL,degreesToRadians:ra,earthRadius:To,factors:Jy,feature:va,featureCollection:Nc,geometry:gL,geometryCollection:bL,isNumber:hg,isObject:e0,lengthToDegrees:wL,lengthToRadians:Ag,lineString:ia,lineStrings:vL,multiLineString:dw,multiPoint:mw,multiPolygon:gw,point:ps,points:_L,polygon:Qy,polygons:yL,radiansToDegrees:ad,radiansToLength:t0,round:xL,unitsFactors:mL,validateBBox:CL,validateId:TL},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 _w(e,t,n){if(n===void 0&&(n={}),n.final===!0)return ML(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 ML(e,t){var n=_w(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,D=P==="FeatureCollection",B=P==="Feature",U=D?e.features.length:1,Y=0;Y_||D>x||B>S){a=L,_=i,x=D,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 OL(e,t,n){var i=n,r=!1;return vw(e,function(l,f,a,_,x){r===!1&&n===void 0?i=l:i=t(i,l,f,a,_,x),r=!0}),i}function bw(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:{}},xw={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(tx,function(){function n(V,Z,K,it,mt){(function ht(gt,lt,It,_t,bt){for(;_t>It;){if(_t-It>600){var ee=_t-It+1,kt=lt-It+1,Gt=Math.log(ee),Qt=.5*Math.exp(2*Gt/3),ne=.5*Math.sqrt(Gt*Qt*(ee-Qt)/ee)*(kt-ee/2<0?-1:1),Ie=Math.max(It,Math.floor(lt-kt*Qt/ee+ne)),bn=Math.min(_t,Math.floor(lt+(ee-kt)*Qt/ee+ne));ht(gt,lt,Ie,bn,bt)}var Zn=gt[lt],en=It,Be=_t;for(i(gt,It,lt),bt(gt[_t],Zn)>0&&i(gt,It,_t);en0;)Be--}bt(gt[It],Zn)===0?i(gt,It,Be):i(gt,++Be,_t),Be<=lt&&(It=Be+1),lt<=Be&&(_t=Be-1)}})(V,Z,K||0,it||V.length-1,mt||r)}function i(V,Z,K){var it=V[Z];V[Z]=V[K],V[K]=it}function r(V,Z){return VZ?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,Z,K){if(!K)return Z.indexOf(V);for(var it=0;it=V.minX&&Z.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,Z,K,it,mt){for(var ht=[Z,K];ht.length;)if(!((K=ht.pop())-(Z=ht.pop())<=it)){var gt=Z+Math.ceil((K-Z)/it/2)*it;n(V,gt,Z,K,mt),ht.push(Z,gt,gt,K)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(V){var Z=this.data,K=[];if(!B(V,Z))return K;for(var it=this.toBBox,mt=[];Z;){for(var ht=0;ht=0&&mt[Z].children.length>this._maxEntries;)this._split(mt,Z),Z--;this._adjustParentBBoxes(it,mt,Z)},l.prototype._split=function(V,Z){var K=V[Z],it=K.children.length,mt=this._minEntries;this._chooseSplitAxis(K,mt,it);var ht=this._chooseSplitIndex(K,mt,it),gt=U(K.children.splice(ht,K.children.length-ht));gt.height=K.height,gt.leaf=K.leaf,a(K,this.toBBox),a(gt,this.toBBox),Z?V[Z-1].children.push(gt):this._splitRoot(K,gt)},l.prototype._splitRoot=function(V,Z){this.data=U([V,Z]),this.data.height=V.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(V,Z,K){for(var it,mt,ht,gt,lt,It,_t,bt=1/0,ee=1/0,kt=Z;kt<=K-Z;kt++){var Gt=_(V,0,kt,this.toBBox),Qt=_(V,kt,K,this.toBBox),ne=(mt=Gt,ht=Qt,gt=void 0,lt=void 0,It=void 0,_t=void 0,gt=Math.max(mt.minX,ht.minX),lt=Math.max(mt.minY,ht.minY),It=Math.min(mt.maxX,ht.maxX),_t=Math.min(mt.maxY,ht.maxY),Math.max(0,It-gt)*Math.max(0,_t-lt)),Ie=A(Gt)+A(Qt);ne=Z;bt--){var ee=V.children[bt];x(gt,V.leaf?mt(ee):ee),lt+=P(gt)}return lt},l.prototype._adjustParentBBoxes=function(V,Z,K){for(var it=K;it>=0;it--)x(Z[it],V)},l.prototype._condense=function(V){for(var Z=V.length-1,K=void 0;Z>=0;Z--)V[Z].children.length===0?Z>0?(K=V[Z-1].children).splice(K.indexOf(V[Z]),1):this.clear():a(V[Z],this.toBBox)},l})})(xw);var qL=xw.exports;const ZL=nx(LL),ww=nx(VL);var r0={};Object.defineProperty(r0,"__esModule",{value:!0});var $L=ww;function Cy(e){var t=[1/0,1/0,-1/0,-1/0];return $L.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-_),D=(f-r)*(l-x)-(a-l)*(r-_);if(A===0)return null;var B=P/A,U=D/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 KL(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()}});Wn(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(lb(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))});Wn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=J_(t.lngLat.toArray()),this.onClick(t),this.finish())});Wn(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Wn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Wn(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});Wn(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)),Cw.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,Tw.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(kw),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 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 tM(e){let t,n,i;return{c(){t=ge("Undo ("),n=ge(e[1]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l&2&&Fi(n,r[1])},d(r){r&&(wt(t),wt(n),wt(i))}}}function eM(e){let t;return{c(){t=ge("Undo")},m(n,i){St(n,t,i)},p:Ce,d(n){n&&wt(t)}}}function nM(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?eM:tM}let _=a(e),x=_(e);return{c(){t=yt("button"),x.c(),i=Xt(),r=yt("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 RC=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(se.LEFT),f=i.getDepth(se.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&&(ln.isTrue(r!==null,"found null for first outgoing dirEdge"),ln.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 qn(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),Fx=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 RC)},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 yn.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 fe,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 qn(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 Uu=function(){};Uu.prototype.getChainStartIndices=function(e){var t=this,n=0,i=new fe;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}}};Tr.prototype.getDelta=function(e){return this._depth[e][se.RIGHT]-this._depth[e][se.LEFT]};Tr.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Tr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Tr.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]=Tr.depthAtLocation(r):e._depth[n][i]+=Tr.depthAtLocation(r))}else if(arguments.length===3){var l=arguments[0],f=arguments[1],a=arguments[2];a===zt.INTERIOR&&this._depth[l][f]++}};Tr.prototype.interfaces_=function(){return[]};Tr.prototype.getClass=function(){return Tr};Tr.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Tr.NULL_VALUE};Bx.NULL_VALUE.get=function(){return-1};Object.defineProperties(Tr,Bx);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 Tr,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,qn.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 Re;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 ln.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 Re(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};Ux.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(go,Ux);var id=function(){this.tempEnv1=new Re,this.selectedSegment=new Oe};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},Gx={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 jx(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};Gx.HotPixelSnapAction.get=function(){return jx};Object.defineProperties(Xh,Gx);var jx=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 fe};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=Cr.precisionScaleFactor(this._argGeom,this._distance,n),r=new On(i);this.bufferFixedPrecision(r)}};Cr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===On.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};Cr.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};Cr.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{}};Cr.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};Cr.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};Cr.prototype.interfaces_=function(){return[]};Cr.prototype.getClass=function(){return Cr};Cr.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new Cr(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 Cr(r);a.setQuadrantSegments(f);var _=a.getResultGeometry(l);return _}else if(arguments[2]instanceof Rn&&arguments[0]instanceof $e&&typeof arguments[1]=="number"){var x=arguments[0],S=arguments[1],L=arguments[2],A=new Cr(x,L),P=A.getResultGeometry(S);return P}}else if(arguments.length===4){var D=arguments[0],F=arguments[1],U=arguments[2],Y=arguments[3],V=new Cr(D);V.setQuadrantSegments(U),V.setEndCapStyle(Y);var Z=V.getResultGeometry(F);return Z}};Cr.precisionScaleFactor=function(e,t,n){var i=e.getEnvelopeInternal(),r=Yo.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 Rn.CAP_ROUND};hf.CAP_BUTT.get=function(){return Rn.CAP_FLAT};hf.CAP_FLAT.get=function(){return Rn.CAP_FLAT};hf.CAP_SQUARE.get=function(){return Rn.CAP_SQUARE};hf.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Cr,hf);var Kr=function(){this._pt=[new Dt,new Dt],this._distance=nn.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 Oe,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}},qx={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};qx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Jr,qx);var Wl=function(e){this._pts=e||null};Wl.prototype.filter=function(e){e instanceof Po&&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 Po?Os.singletonList(e):Wl.getPoints(e,new fe)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Po?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 Po||e instanceof Pi||e instanceof nr)&&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 fe;return e.apply(new Tc(t)),t};var Pr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Fs,this._minDistanceLocation=null,this._minDistance=nn.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}};Pr.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(),D=L.getCoordinates(),F=0;Fthis._distance&&this.initialize(t,n,i)}};Vr.prototype.interfaces_=function(){return[]};Vr.prototype.getClass=function(){return Vr};var na=function(){};na.prototype.interfaces_=function(){return[]};na.prototype.getClass=function(){return na};na.computeDistance=function(){if(arguments[2]instanceof Vr&&arguments[0]instanceof Pi&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=new Oe,r=e.getCoordinates(),l=0;l1||e<=0)throw new _i("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 Vr,this._minPtDist=new Vr,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 Vr,this._minPtDist=new Vr,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])+")"}};Mo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=Mo.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(),Mo.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)};Mo.prototype.checkNegativeValid=function(){if(!(this._input instanceof nr||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)};Mo.prototype.getErrorIndicator=function(){return this._errorIndicator};Mo.prototype.checkMinimumDistance=function(e,t,n){var i=new Pr(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")};kr.prototype.report=function(e){if(!kr.VERBOSE)return null;Lr.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};kr.prototype.getErrorMessage=function(){return this._errorMsg};kr.prototype.interfaces_=function(){return[]};kr.prototype.getClass=function(){return kr};kr.isValidMsg=function(e,t,n){var i=new kr(e,t,n);return i.isValid()?null:i.getErrorMessage()};kr.isValid=function(e,t,n){var i=new kr(e,t,n);return!!i.isValid()};$y.VERBOSE.get=function(){return!1};$y.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(kr,$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 Oi(this._pts))};_a.prototype.interfaces_=function(){return[Ga]};_a.prototype.getClass=function(){return _a};var Sr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new fe,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};Sr.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Sr.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};Sr.prototype.getIntersectionSegments=function(){return this._intSegments};Sr.prototype.count=function(){return this._intersectionCount};Sr.prototype.getIntersections=function(){return this._intersections};Sr.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Sr.prototype.setKeepIntersections=function(e){this._keepIntersections=e};Sr.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++)};Sr.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};Sr.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Sr.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Sr.prototype.interfaces_=function(){return[Vu]};Sr.prototype.getClass=function(){return Sr};Sr.createAllIntersectionsFinder=function(e){var t=new Sr(e);return t.setFindAllIntersections(!0),t};Sr.createAnyIntersectionFinder=function(e){return new Sr(e)};Sr.createIntersectionCounter=function(e){var t=new Sr(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Bs=function(){this._li=new $u,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 Sr(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 ju=function e(){this._nv=null;var t=arguments[0];this._nv=new Bs(e.toSegmentStrings(t))};ju.prototype.checkValid=function(){this._nv.checkValid()};ju.prototype.interfaces_=function(){return[]};ju.prototype.getClass=function(){return ju};ju.toSegmentStrings=function(e){for(var t=new fe,n=e.iterator();n.hasNext();){var i=n.next();t.add(new _a(i.getCoordinates(),i))}return t};ju.checkValid=function(e){var t=new ju(e);t.checkValid()};var Mc=function(e){this._mapOp=e};Mc.prototype.map=function(e){for(var t=this,n=new fe,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 Oe,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=nn.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(zi.computeOverlaySnapTolerance(r),zi.computeOverlaySnapTolerance(l))}};zi.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),i=n*zi.SNAP_PRECISION_FACTOR;return i};zi.snapToSelf=function(e,t,n){var i=new zi(e);return i.snapToSelf(t,n)};Zx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(zi,Zx);var $x=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 nn.longBitsToDouble(this._commonBits)};Yr.prototype.add=function(e){var t=nn.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=nn.longBitsToDouble(e),n=nn.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 Er=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()};Er.prototype.selfSnap=function(e){var t=new zi(e),n=t.snapTo(e,this._snapTolerance);return n};Er.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};Er.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};Er.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=an.overlayOp(t[0],t[1],e);return this.prepareResult(n)};Er.prototype.checkValid=function(e){e.isValid()||Lr.out.println("Snapped geometry is invalid")};Er.prototype.computeSnapTolerance=function(){this._snapTolerance=zi.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};Er.prototype.snap=function(e){var t=this.removeCommonBits(e),n=zi.snap(t[0],t[1],this._snapTolerance);return n};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Er.overlayOp=function(e,t,n){var i=new Er(e,t);return i.getResultGeometry(n)};Er.union=function(e,t){return Er.overlayOp(e,t,an.UNION)};Er.intersection=function(e,t){return Er.overlayOp(e,t,an.INTERSECTION)};Er.symDifference=function(e,t){return Er.overlayOp(e,t,an.SYMDIFFERENCE)};Er.difference=function(e,t){return Er.overlayOp(e,t,an.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=an.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=Er.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,an.UNION)};ro.intersection=function(e,t){return ro.overlayOp(e,t,an.INTERSECTION)};ro.symDifference=function(e,t){return ro.overlayOp(e,t,an.SYMDIFFERENCE)};ro.difference=function(e,t){return ro.overlayOp(e,t,an.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 No=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}};No.prototype.isDelete=function(){return this._eventType===No.DELETE};No.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};No.prototype.getObject=function(){return this._obj};No.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};No.prototype.getInsertEvent=function(){return this._insertEvent};No.prototype.isInsert=function(){return this._eventType===No.INSERT};No.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};No.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};No.prototype.interfaces_=function(){return[bs]};No.prototype.getClass=function(){return No};Xy.INSERT.get=function(){return 1};Xy.DELETE.get=function(){return 2};Object.defineProperties(No,Xy);var rg=function(){};rg.prototype.interfaces_=function(){return[]};rg.prototype.getClass=function(){return rg};var Ar=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};Ar.prototype.isTrivialIntersection=function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(Ar.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};Ar.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Ar.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Ar.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Ar.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};Ar.prototype.hasProperIntersection=function(){return this._hasProper};Ar.prototype.hasIntersection=function(){return this._hasIntersection};Ar.prototype.isDone=function(){return this._isDone};Ar.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Ar.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Ar.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))))};Ar.prototype.interfaces_=function(){return[]};Ar.prototype.getClass=function(){return Ar};Ar.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var OC=function(e){function t(){e.call(this),this.events=new fe,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 zC=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),FC=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 fe,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 fe;;){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 zC(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=yn.removeRepeatedPoints(n.getCoordinates());if(l.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var f=i,a=r;be.isCCW(l)&&(f=r,a=i);var _=new ig(l,new qn(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 qn(n,r):f.setLocation(n,r)},t.prototype.createEdgeSetIntersector=function(){return new OC},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 nr)this.addPolygon(n);else if(n instanceof Pi)this.addLineString(n);else if(n instanceof Po)this.addPoint(n);else if(n instanceof jh)this.addCollection(n);else if(n instanceof zu)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 $u,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 Du=function(){};Du.prototype.interfaces_=function(){return[]};Du.prototype.getClass=function(){return Du};Du.map=function(){if(arguments[0]instanceof $e&&We(arguments[1],Du.MapOp)){for(var e=arguments[0],t=arguments[1],n=new fe,i=0;i=e.size()?null:e.get(t)};$i.union=function(e){var t=new $i(e);return t.union()};Hx.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties($i,Hx);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 an.createEmptyResult(an.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,an.UNION)};function Wu(){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,Kn=Math.PI,fl=Kn/2,w1=Kn/4,vl=Kn*2,Tu=180/Kn,Qs=Kn/180,Qr=Math.abs,BC=Math.atan,tf=Math.atan2,Qi=Math.cos,tr=Math.sin,ff=Math.sqrt;function Yx(e){return e>1?0:e<-1?Kn: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;++iKn?e-vl:e<-Kn?e+vl:e,t]}Sy.invert=Sy;function UC(e,t,n){return(e%=vl)?t||n?Kx(T1(e),L1(t,n)):T1(e):t||n?L1(t,n):Sy}function C1(e){return function(t,n){return t+=e,[t>Kn?t-vl:t<-Kn?t+vl:t,n]}}function T1(e){var t=C1(e);return t.invert=C1(-e),t}function L1(e,t){var n=Qi(e),i=tr(e),r=Qi(t),l=tr(t);function f(a,_){var x=Qi(_),S=Qi(a)*x,L=tr(a)*x,A=tr(_),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=Qi(_),S=Qi(a)*x,L=tr(a)*x,A=tr(_),P=A*r-L*l;return[tf(L*r+A*l,S*n+P*i),Ac(P*n-S*i)]},f}function GC(e,t,n,i,r,l){if(n){var f=Qi(t),a=tr(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 jC(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,D;if(D=n-f,!(!A&&D>0)){if(D/=A,A<0){if(D0){if(D>L)return;D>S&&(S=D)}if(D=r-f,!(!A&&D<0)){if(D/=A,A<0){if(D>L)return;D>S&&(S=D)}else if(A>0){if(D0)){if(D/=P,P<0){if(D0){if(D>L)return;D>S&&(S=D)}if(D=l-a,!(!P&&D<0)){if(D/=P,P<0){if(D>L)return;D>S&&(S=D)}else if(P>0){if(D0&&(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 qC(e){return e.length===1&&(e=ZC(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 ZC(e){return function(t,n){return tw(e(t),n)}}qC(tw);function ew(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 $C(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,D=0;if(x==null||(P=f(x,L))!==(D=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)!==D);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=Jx(),A,P,D,F,U,Y,V,Z,K,it,mt,ft={point:gt,lineStart:bt,lineEnd:ee,polygonStart:It,polygonEnd:yt};function gt(Gt,Qt){r(Gt,Qt)&&S.point(Gt,Qt)}function lt(){for(var Gt=0,Qt=0,ne=P.length;Qti&&(dn-Be)*(i-Ve)>(Fn-Ve)*(e-Be)&&++Gt:Fn<=i&&(dn-Be)*(i-Ve)<(Fn-Ve)*(e-Be)&&--Gt;return Gt}function It(){S=L,A=[],P=[],mt=!0}function yt(){var Gt=lt(),Qt=mt&&Gt,ne=(A=ew(A)).length;(Qt||ne)&&(x.polygonStart(),Qt&&(x.lineStart(),l(null,null,1,x),x.lineEnd()),ne&&Qx(A,a,Gt,l,x),x.polygonEnd()),S=x,A=P=D=null}function bt(){ft.point=kt,P&&P.push(D=[]),it=!0,K=!1,V=Z=NaN}function ee(){A&&(kt(F,U),Y&&K&&L.rejoin(),A.push(L.result())),ft.point=gt,K&&S.lineEnd()}function kt(Gt,Qt){var ne=r(Gt,Qt);if(P&&D.push([Gt,Qt]),it)F=Gt,U=Qt,Y=ne,it=!1,ne&&(S.lineStart(),S.point(Gt,Qt));else if(ne&&K)S.point(Gt,Qt);else{var Ie=[V=Math.max(Om,Math.min(Dp,V)),Z=Math.max(Om,Math.min(Dp,Z))],bn=[Gt=Math.max(Om,Math.min(Dp,Gt)),Qt=Math.max(Om,Math.min(Dp,Qt))];jC(Ie,bn,e,t,n,i)?(K||(S.lineStart(),S.point(Ie[0],Ie[1])),S.point(bn[0],bn[1]),ne||S.lineEnd(),mt=!1):ne&&(S.lineStart(),S.point(Gt,Qt),mt=!1)}V=Gt,Z=Qt,K=ne}return ft}}var K_=Wu();function WC(e,t){var n=t[0],i=t[1],r=[tr(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],P=L[1]/2+w1,D=tr(P),F=Qi(P),U=0;U=0?1:-1,gt=ft*mt,lt=gt>Kn,It=D*K;if(K_.add(tf(It*ft*tr(gt),F*it+It*Qi(gt))),l+=lt?mt+ft*vl:mt,lt^A>=n^V>=n){var yt=lg(ef(L),ef(Y));wy(yt);var bt=lg(r,yt);wy(bt);var ee=(lt^mt>=0?-1:1)*Ac(bt[2]);(i>ee||i===ee&&(yt[0]||yt[1]))&&(f+=lt^mt>=0?1:-1)}}return(l<-Mi||lsd&&(sd=e),tcg&&(cg=t)}Wu();function nw(e,t,n,i){return function(r,l){var f=t(l),a=r.invert(i[0],i[1]),_=Jx(),x=t(_),S=!1,L,A,P,D={point:F,lineStart:Y,lineEnd:V,polygonStart:function(){D.point=Z,D.lineStart=K,D.lineEnd=it,A=[],L=[]},polygonEnd:function(){D.point=F,D.lineStart=Y,D.lineEnd=V,A=ew(A);var mt=WC(L,a);A.length?(S||(l.polygonStart(),S=!0),Qx(A,YC,mt,n,l)):mt&&(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 F(mt,ft){var gt=r(mt,ft);e(mt=gt[0],ft=gt[1])&&l.point(mt,ft)}function U(mt,ft){var gt=r(mt,ft);f.point(gt[0],gt[1])}function Y(){D.point=U,f.lineStart()}function V(){D.point=F,f.lineEnd()}function Z(mt,ft){P.push([mt,ft]);var gt=r(mt,ft);x.point(gt[0],gt[1])}function K(){x.lineStart(),P=[]}function it(){Z(P[0][0],P[0][1]),x.lineEnd();var mt=x.clean(),ft=_.result(),gt,lt=ft.length,It,yt,bt;if(P.pop(),L.push(P),P=null,!!lt){if(mt&1){if(yt=ft[0],(It=yt.length-1)>0){for(S||(l.polygonStart(),S=!0),l.lineStart(),gt=0;gt1&&mt&2&&ft.push(ft.pop().concat(ft.shift())),A.push(ft.filter(HC))}}return D}}function HC(e){return e.length>1}function YC(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=nw(function(){return!0},KC,QC,[-Kn,-fl]);function KC(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,_=Qr(l-t);Qr(_-Kn)0?fl:-fl),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(l,n),r=0):i!==a&&_>=Kn&&(Qr(t-i)Mi?BC((tr(t)*(l=Qi(i))*tr(n)-tr(i)*(r=Qi(t))*tr(e))/(r*l*f)):(t+i)/2}function QC(e,t,n,i){var r;if(e==null)r=n*fl,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(Qr(e[0]-t[0])>Mi){var l=e[0]0,r=Qr(n)>Mi;function l(S,L,A,P){GC(P,e,t,A,S,L)}function f(S,L){return Qi(S)*Qi(L)>n}function a(S){var L,A,P,D,F;return{lineStart:function(){D=P=!1,F=1},point:function(U,Y){var V=[U,Y],Z,K=f(U,Y),it=i?K?0:x(U,Y):K?x(U+(U<0?Kn:-Kn),Y):0;if(!L&&(D=P=K)&&S.lineStart(),K!==P&&(Z=_(L,V),(!Z||jm(L,Z)||jm(V,Z))&&(V[0]+=Mi,V[1]+=Mi,K=f(V[0],V[1]))),K!==P)F=0,K?(S.lineStart(),Z=_(V,L),S.point(Z[0],Z[1])):(Z=_(L,V),S.point(Z[0],Z[1]),S.lineEnd()),L=Z;else if(r&&L&&i^K){var mt;!(it&A)&&(mt=_(V,L,!0))&&(F=0,i?(S.lineStart(),S.point(mt[0][0],mt[0][1]),S.point(mt[1][0],mt[1][1]),S.lineEnd()):(S.point(mt[1][0],mt[1][1]),S.lineEnd(),S.lineStart(),S.point(mt[0][0],mt[0][1])))}K&&(!L||!jm(L,V))&&S.point(V[0],V[1]),L=V,P=K,A=it},lineEnd:function(){P&&S.lineEnd(),L=null},clean:function(){return F|(D&&P)<<1}}}function _(S,L,A){var P=ef(S),D=ef(L),F=[1,0,0],U=lg(P,D),Y=Nm(U,U),V=U[0],Z=Y-V*V;if(!Z)return!A&&S;var K=n*Y/Z,it=-n*V/Z,mt=lg(F,U),ft=Dm(F,K),gt=Dm(U,it);Y_(ft,gt);var lt=mt,It=Nm(ft,lt),yt=Nm(lt,lt),bt=It*It-yt*(Nm(ft,ft)-1);if(!(bt<0)){var ee=ff(bt),kt=Dm(lt,(-It-ee)/yt);if(Y_(kt,ft),kt=xy(kt),!A)return kt;var Gt=S[0],Qt=L[0],ne=S[1],Ie=L[1],bn;Qt0^kt[1]<(Qr(kt[0]-Gt)Kn^(Gt<=kt[0]&&kt[0]<=Qt)){var Ve=Dm(lt,(-It+ee)/yt);return Y_(Ve,ft),[kt,xy(Ve)]}}}function x(S,L){var A=i?e:Kn-e,P=0;return S<-A?P|=1:S>A&&(P|=2),L<-A?P|=4:L>A&&(P|=8),P}return nw(f,a,l,i?[0,-e]:[-Kn,e-Kn])}function iw(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 rw(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),VC(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 eT(e,t,n){return rw(e,[[0,0],t],n)}var D1=16,nT=Qi(30*Qs);function R1(e,t){return+t?rT(e,t):iT(e)}function iT(e){return iw({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function rT(e,t){function n(i,r,l,f,a,_,x,S,L,A,P,D,F,U){var Y=x-i,V=S-r,Z=Y*Y+V*V;if(Z>4*t&&F--){var K=f+A,it=a+P,mt=_+D,ft=ff(K*K+it*it+mt*mt),gt=Ac(mt/=ft),lt=Qr(Qr(mt)-1)t||Qr((Y*ee+V*kt)/Z-.5)>.3||f*A+a*P+_*D2?kt[2]%360*Qs:0,bt()):[x*Tu,S*Tu,L*Tu]},lt.precision=function(kt){return arguments.length?(mt=R1(yt,it=kt*kt),ee()):ff(it)},lt.fitExtent=function(kt,Gt){return rw(lt,kt,Gt)},lt.fitSize=function(kt,Gt){return eT(lt,kt,Gt)};function bt(){P=Kx(A=UC(x,S,L),t);var kt=t(a,_);return l=i-kt[0]*n,f=r+kt[1]*n,ee()}function ee(){return ft=gt=null,lt}return function(){return t=e.apply(this,arguments),lt.invert=t.invert&&It,bt()}}function ow(e){return function(t,n){var i=Qi(t),r=Qi(n),l=e(i*r);return[l*r*tr(t),l*tr(n)]}}function sw(e){return function(t,n){var i=ff(t*t+n*n),r=e(i),l=tr(r),f=Qi(r);return[tf(t*l,i*f),Ac(i&&n*l/i)]}}var lT=ow(function(e){return ff(2/(1+e))});lT.invert=sw(function(e){return 2*Ac(e/2)});var aw=ow(function(e){return(e=Yx(e))&&e/tr(e)});aw.invert=sw(function(e){return e});function uT(){return sT(aw).scale(79.4188).clipAngle(180-.001)}function O1(e,t){return[e,t]}O1.invert=O1;function cT(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 wx(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 wx(e,function(F){var U=qm(F,t,n,i);U&&f.push(U)}),_y(f)}var a=hT(l),_={type:l.type,coordinates:uw(l.coordinates,a)},x=new Uy,S=x.read(_),L=yC(vC(t,n),"meters"),A=Cr.bufferOp(S,L,i),P=new Ax;if(A=P.write(A),!lw(A.coordinates)){var D={type:A.type,coordinates:cw(A.coordinates,a)};return vg(D,r)}}function lw(e){return Array.isArray(e[0])?lw(e[0]):isNaN(e[0])}function uw(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return uw(n,t)})}function cw(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return cw(n,t)})}function hT(e){var t=xC(e).geometry.coordinates,n=[-t[0],-t[1]];return uT().rotate(n).scale(Zo)}function fT(e,t){var n=tg(e),i=tg(t),r=e.properties||{},l=_x.difference(n.coordinates,i.coordinates);return l.length===0?null:l.length===1?vx(l[0],r):bx(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=fT({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const i=cT(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 pT(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=D=>{a==null||a({type:"mapClick",coordinates:[D.lngLat.lng,D.lngLat.lat]})};function P(D=!1){if(!t)throw new Error;const F=document.createElement("div");return D&&F.classList.add("marker-interactive"),new GI({props:{displayIn:"maplibre"},target:F}),new t.Marker({element:F,offset:[1,-13]})}return{setEventHandler(D){D?(a=D,e.on("click",A)):(a=void 0,e.off("click",A))},flyTo(D,F){e.flyTo({center:D,zoom:F,...r})},fitBounds(D,F,U){e.fitBounds([[D[0],D[1]],[D[2],D[3]]],{padding:F,maxZoom:U,...l})},indicateReverse(D){e.getCanvasContainer().style.cursor=D?"crosshair":""},setReverseMarker(D){!t||!n||(S?D?S.setLngLat(D):(S.remove(),S=void 0):D&&(S=(typeof n=="object"?new t.Marker(n):P()).setLngLat(D).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(D,F){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(F){let Y=!1;if(F.geometry.type==="GeometryCollection"){const V=F.geometry.geometries.filter(Z=>Z.type==="Polygon"||Z.type==="MultiPolygon");if(V.length>0){let Z=V.pop();for(const K of V)Z=bC(Z,K);F1({...F,geometry:Z},U),Y=!0}else{const Z=F.geometry.geometries.filter(K=>K.type==="LineString"||K.type==="MultiLineString");Z.length>0&&(U({...F,geometry:{type:"GeometryCollection",geometries:Z}}),Y=!0)}}if(!Y){if(F.geometry.type==="Polygon"||F.geometry.type==="MultiPolygon")F1(F,U);else if(F.geometry.type==="LineString"||F.geometry.type==="MultiLineString"){U(F);return}}n&&_.push((typeof n=="object"?new t.Marker(n):P()).setLngLat(F.center).addTo(e))}if(i)for(const Y of D??[]){if(Y===F)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),Z=V.getElement();Z.addEventListener("click",K=>{K.stopPropagation(),a==null||a({type:"markerClick",id:Y.id})}),Z.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:Y.id}),V.togglePopup()}),Z.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:Y.id}),V.togglePopup()}),_.push(V)}}},setSelectedMarker(D){x&&x.getElement().classList.toggle("marker-selected",!1),x=D>-1?_[D]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const D=e.getCenter();return[e.getZoom(),D.lng,D.lat]}}}function dT(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){St(i,t,r),ht(t,n)},p:Me,i:Me,o:Me,d(i){i&&wt(t)}}}class hw extends tn{constructor(t){super(),Qe(this,t,null,dT,He,{})}}function mT(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){St(i,t,r),ht(t,n)},p:Me,i:Me,o:Me,d(i){i&&wt(t)}}}class fw extends tn{constructor(t){super(),Qe(this,t,null,mT,He,{})}}function gT(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function _T(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function yT(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function vT(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function bT(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function xT(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function wT(e){let t,n;return{c(){t=_t("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){St(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&&wt(t)}}}function ST(e){let t,n,i,r;return{c(){t=_t("img"),hr(t.src,n=e[5])||Rt(t,"src",n),Rt(t,"alt",e[4]),Rt(t,"class","svelte-ltkwvy")},m(l,f){St(l,t,f),i||(r=Ge(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&&wt(t),i=!1,r()}}}function V1(e){let t,n;return{c(){t=_t("span"),n=ge(e[6]),Rt(t,"class","secondary svelte-ltkwvy")},m(i,r){St(i,t,r),ht(t,n)},p(i,r){r&64&&Fi(n,i[6])},d(i){i&&wt(t)}}}function ET(e){var ft,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&&((ft=e[0].properties)==null?void 0:ft.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,D,F=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",U,Y,V;function Z(lt,It){var yt,bt;return It&1&&(n=null),It&1&&(i=null),It&1&&(r=null),lt[5]?ST:lt[0].address?wT:((yt=lt[0].properties)==null?void 0:yt.kind)==="road"||((bt=lt[0].properties)==null?void 0:bt.kind)==="road_relation"?xT:(n==null&&(n=!!lt[0].id.startsWith("address.")),n?bT:(i==null&&(i=!!lt[0].id.startsWith("postal_code.")),i?vT:(r==null&&(r=!!lt[0].id.startsWith("poi.")),r?yT:lt[7]?_T:gT)))}let K=Z(e,-1),it=K(e),mt=A&&V1(e);return{c(){t=_t("li"),it.c(),l=Wt(),f=_t("span"),a=_t("span"),_=_t("span"),S=ge(x),L=Wt(),mt&&mt.c(),P=Wt(),D=_t("span"),U=ge(F),Rt(_,"class","primary svelte-ltkwvy"),Rt(a,"class","svelte-ltkwvy"),Rt(D,"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(lt,It){St(lt,t,It),it.m(t,null),ht(t,l),ht(t,f),ht(f,a),ht(a,_),ht(_,S),ht(a,L),mt&&mt.m(a,null),ht(f,P),ht(f,D),ht(D,U),Y||(V=[Ge(t,"mouseenter",e[12]),Ge(t,"focus",e[13])],Y=!0)},p(lt,[It]){var yt,bt;K===(K=Z(lt,It))&&it?it.p(lt,It):(it.d(1),it=K(lt),it&&(it.c(),it.m(t,l))),It&1&&x!==(x=(lt[7]?lt[0].place_name:lt[0].place_name.replace(/,.*/,""))+"")&&Fi(S,x),It&37&&(A=lt[2]==="always"||lt[2]&&!lt[0].address&&((yt=lt[0].properties)==null?void 0:yt.kind)!=="road"&&((bt=lt[0].properties)==null?void 0:bt.kind)!=="road_relation"&&!lt[0].id.startsWith("address.")&&!lt[0].id.startsWith("postal_code.")&&(!lt[0].id.startsWith("poi.")||!lt[5])&&!lt[7]),A?mt?mt.p(lt,It):(mt=V1(lt),mt.c(),mt.m(a,null)):mt&&(mt.d(1),mt=null),It&1&&F!==(F=(lt[7]?"":lt[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Fi(U,F),It&2&&Rt(t,"data-selected",lt[1]),It&2&&hl(t,"selected",lt[1])},i:Me,o:Me,d(lt){lt&&wt(t),it.d(),mt&&mt.d(),Y=!1,yo(V)}}}function IT(e,t,n){var Z;let i,r,{feature:l}=t,{selected:f=!1}=t,{showPlaceType:a}=t,{missingIconsCache:_}=t,{iconsBaseUrl:x}=t;const S=(Z=l.properties)==null?void 0:Z.categories;let L,A,P=0,D=l.place_type[0]==="reverse";function F(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=>F(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,it,mt,ft;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=(K=l.properties)==null?void 0:K.categories)==null?void 0:it.join(", "):((ft=(mt=l.properties)==null?void 0:mt.place_type_name)==null?void 0:ft[0])??l.place_type[0])},n(11,i=(S==null?void 0:S.length)??0),[l,f,a,x,L,A,r,D,F,_,P,i,U,Y,V]}class CT extends tn{constructor(t){super(),Qe(this,t,IT,ET,He,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function TT(e){let t;return{c(){t=_t("div"),t.innerHTML='',Rt(t,"class","svelte-7cmwmc")},m(n,i){St(n,t,i)},p:Me,i:Me,o:Me,d(n){n&&wt(t)}}}class LT extends tn{constructor(t){super(),Qe(this,t,null,TT,He,{})}}function MT(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){St(i,t,r),ht(t,n)},p:Me,i:Me,o:Me,d(i){i&&wt(t)}}}class PT extends tn{constructor(t){super(),Qe(this,t,null,MT,He,{})}}function kT(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"),ri(n,"stroke-width","1.875"),ri(n,"fill","none"),Rt(i,"d","M12.063 12.063 7.635 7.635"),ri(i,"stroke-width","1.875"),ri(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){St(r,t,l),ht(t,n),ht(t,i)},p:Me,i:Me,o:Me,d(r){r&&wt(t)}}}class AT extends tn{constructor(t){super(),Qe(this,t,null,kT,He,{})}}function NT(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 RT(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=OT(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 OT(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,Z=0;for(;V<=U;)Y=x.indexOf(P[V],Z),Z=Y+1,V++;S=x.substring(0,Y).trim(),L=x.substring(Y+1).trim()}}const D=S.split(".");if(D.length==2&&D[1]==0&&D[1].length!=2)throw new Error("invalid coordinates format");const F=L.split(".");if(F.length==2&&F[1]==0&&F[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:zT,toCoordinateFormat:RT})}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,...VT})}),[...e,...UT,...GT]}const qT=jT();Yy.formats=qT.map(e=>e.verbatimCoordinates);const ZT=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 LT({}),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Y1(e){let t,n,i,r,l;return n=new PT({}),{c(){t=_t("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){St(f,t,a),jt(n,t,null),i=!0,r||(l=Ge(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||(dt(n.$$.fragment,f),i=!0)},o(f){vt(n.$$.fragment,f),i=!1},d(f){f&&wt(t),qt(n),r=!1,l()}}}function $T(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{ft=null}),fi()),(!Z||Gt[0]&2)&&hl(x,"displayable",kt[1]!==""),kt[5]===!0?gt?(gt.p(kt,Gt),Gt[0]&32&&dt(gt,1)):(gt=Y1(kt),gt.c(),dt(gt,1),gt.m(i,D)):gt&&(hi(),vt(gt,1,1,()=>{gt=null}),fi()),It&&It.p&&(!Z||Gt[1]&134217728)&&lr(It,lt,kt,kt[58],Z?ar(lt,kt[58],Gt,null):ur(kt[58]),null);let Qt=U;U=ee(kt),U===Qt?~U&&bt[U].p(kt,Gt):(Y&&(hi(),vt(bt[Qt],1,1,()=>{bt[Qt]=null}),fi()),~U?(Y=bt[U],Y?Y.p(kt,Gt):(Y=bt[U]=yt[U](kt),Y.c()),dt(Y,1),Y.m(n,null)):Y=null),(!Z||Gt[0]&4&&V!==(V=Zm(kt[2])+" svelte-zh3kmv"))&&Rt(n,"class",V),(!Z||Gt[0]&22)&&hl(n,"can-collapse",kt[4]&&kt[1]==="")},i(kt){Z||(dt(mt),dt(l.$$.fragment,kt),dt(L.$$.fragment,kt),dt(ft),dt(gt),dt(It,kt),dt(Y),Z=!0)},o(kt){vt(mt),vt(l.$$.fragment,kt),vt(L.$$.fragment,kt),vt(ft),vt(gt),vt(It,kt),vt(Y),Z=!1},d(kt){kt&&(wt(t),wt(n)),qt(l),e[61](null),qt(L),ft&&ft.d(),gt&>.d(),It&&It.d(kt),~U&&bt[U].d(),K=!1,yo(it)}}}function KT(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:D=!1}=t,{errorMessage:F="Something went wrong…"}=t,{filter:U=()=>!0}=t,{flyTo:Y=!0}=t,{fuzzyMatch:V=!0}=t,{language:Z=void 0}=t,{limit:K=void 0}=t,{mapController:it=void 0}=t,{minLength:mt=2}=t,{noResultsMessage:ft="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:lt=[{type:"server-geolocation"}]}=t,{reverseActive:It=D==="always"}=t,{reverseButtonTitle:yt="toggle reverse geocoding"}=t,{searchValue:bt=""}=t,{showFullGeometry:ee=!0}=t,{showPlaceType:kt="ifNeeded"}=t,{showResultsWhileTyping:Gt=!0}=t,{selectFirst:Qt=!0}=t,{flyToSelected:ne=!1}=t,{markerOnSelected:Ie=!0}=t,{types:bn=void 0}=t,{excludeTypes:Zn=!1}=t,{zoom:en=16}=t,{maxZoom:Be=18}=t,{apiUrl:Ve="https://api.maptiler.com/geocoding"}=t,{fetchParameters:dn={}}=t,{iconsBaseUrl:Fn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.1/icons/"}=t,{adjustUrlQuery:xn=$=>{}}=t;function oe(){un.focus()}function je(){un.blur()}function pn($,ot=!0){n(1,bt=$),ot?(n(15,mn=-1),ns()):(vo(),setTimeout(()=>{un.focus(),un.select()}))}function Bn(){n(14,Lt=void 0),n(55,xe=void 0),n(15,mn=-1)}function yi(){n(54,ke=[]),n(55,xe=void 0)}let Ai=!1,Lt,ke,xe,rn="",un,mn=-1,Xi,$t=[],Ui,fr,Vn,Tn;const es=new Set,oo=Dc();aa(()=>{it&&(it.setEventHandler(void 0),it.indicateReverse(!1),it.setSelectedMarker(-1),it.setMarkers(void 0,void 0))});function ns($){if(fr&&(clearTimeout(fr),fr=void 0),mn>-1&&Lt)n(55,xe=Lt[mn]),n(1,bt=xe.place_type[0]==="reverse"?xe.place_name:xe.place_name.replace(/,.*/,"")),n(18,Xi=void 0),n(54,ke=void 0),n(15,mn=-1);else if(bt){const ot=$||!Ha(bt);Gs(bt,{exact:!0}).then(()=>{n(54,ke=Lt),n(55,xe=void 0),ot&&js()}).catch(Mt=>n(18,Xi=Mt))}}function Ha($){try{return ZT($,6)}catch{return!1}}async function Gs($,{byId:ot=!1,exact:Mt=!1}={}){n(18,Xi=void 0),Ui==null||Ui.abort();const xt=new AbortController;n(19,Ui=xt);try{const rt=Ha($),Ct=new URLSearchParams;if(Z!==void 0&&Ct.set("language",Array.isArray(Z)?Z.join(","):Z??""),bn&&Ct.set("types",bn.join(",")),Zn&&Ct.set("excludeTypes",String(Zn)),_&&Ct.set("bbox",_.map(Ne=>Ne.toFixed(6)).join(",")),A&&Ct.set("country",Array.isArray(A)?A.join(","):A),!ot&&!rt){const Ne=await DT(it,lt,xt);Ne&&Ct.set("proximity",Ne),(Mt||!Gt)&&Ct.set("autocomplete","false"),Ct.set("fuzzyMatch",String(V))}K!==void 0&&(!rt||(bn==null?void 0:bn.length)===1)&&Ct.set("limit",String(K)),Ct.set("key",a),xn(Ct);const Xt=Ve+"/"+encodeURIComponent(rt?rt.decimalLongitude+","+rt.decimalLatitude:$)+".json?"+Ct.toString();if(Xt===rn){ot?(n(14,Lt=void 0),n(55,xe=$t[0])):n(14,Lt=$t);return}rn=Xt;const Ht=await fetch(Xt,{signal:xt.signal,...dn});if(!Ht.ok)throw new Error(await Ht.text());const Kt=await Ht.json();oo("response",{url:Xt,featureCollection:Kt}),ot?(n(14,Lt=void 0),n(55,xe=Kt.features[0]),$t=[xe]):(n(14,Lt=Kt.features.filter(U)),rt&&Lt.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=Lt,rt&&un.focus())}catch(rt){if(rt&&typeof rt=="object"&&"name"in rt&&rt.name==="AbortError")return;throw rt}finally{xt===Ui&&n(19,Ui=void 0)}}function js(){var Mt;if(!(ke!=null&&ke.length)||!Y)return;const $=[180,90,-180,-90],ot=!ke.some(xt=>!xt.matching_text);for(const xt of ke)if(ot||!xt.matching_text)for(const rt of[0,1,2,3])$[rt]=Math[rt<2?"min":"max"]($[rt],((Mt=xt.bbox)==null?void 0:Mt[rt])??xt.center[rt%2]);it&&ke.length>0&&(xe&&$[0]===$[2]&&$[1]===$[3]?it.flyTo(xe.center,en):it.fitBounds(U1($),50,Be))}function Sa($){n(0,It=D==="always"),n(14,Lt=void 0),n(55,xe=void 0),n(15,mn=-1),pn($[1].toFixed(6)+", "+NT($[0],[-180,180],!0).toFixed(6),!1)}function le($){if(!Lt)return;let ot=$.key==="ArrowDown"?1:$.key==="ArrowUp"?-1:0;ot&&(mn===(Qt?0:-1)&&ot===-1&&n(15,mn=Lt.length),n(15,mn+=ot),mn>=Lt.length&&n(15,mn=-1),mn<0&&Qt&&n(15,mn=0),$.preventDefault())}function vo($=!0){if(n(18,Xi=void 0),Gt){if(fr&&clearTimeout(fr),bt.length{Gs(ot).catch(Mt=>n(18,Xi=Mt))},$?P:0)}else n(14,Lt=void 0),n(18,Xi=void 0)}function oi($){n(55,xe=$),n(1,bt=$.place_name),n(15,mn=-1)}const Ea=()=>un.focus();function ws($){cr[$?"unshift":"push"](()=>{un=$,n(17,un)})}function ce(){bt=this.value,n(1,bt),n(13,Ai),n(27,S)}const cn=()=>n(13,Ai=!0),Ke=()=>n(13,Ai=!1),Nr=()=>vo(),is=()=>{n(1,bt=""),un.focus()},sn=()=>n(0,It=!It),Ss=()=>n(18,Xi=void 0),st=$=>n(15,mn=$),G=$=>oi($),q=()=>{Qt||n(15,mn=-1)},J=()=>{};return e.$$set=$=>{"class"in $&&n(2,f=$.class),"apiKey"in $&&n(25,a=$.apiKey),"bbox"in $&&n(26,_=$.bbox),"clearButtonTitle"in $&&n(3,x=$.clearButtonTitle),"clearOnBlur"in $&&n(27,S=$.clearOnBlur),"collapsed"in $&&n(4,L=$.collapsed),"country"in $&&n(28,A=$.country),"debounceSearch"in $&&n(29,P=$.debounceSearch),"enableReverse"in $&&n(5,D=$.enableReverse),"errorMessage"in $&&n(6,F=$.errorMessage),"filter"in $&&n(30,U=$.filter),"flyTo"in $&&n(31,Y=$.flyTo),"fuzzyMatch"in $&&n(32,V=$.fuzzyMatch),"language"in $&&n(33,Z=$.language),"limit"in $&&n(34,K=$.limit),"mapController"in $&&n(35,it=$.mapController),"minLength"in $&&n(36,mt=$.minLength),"noResultsMessage"in $&&n(7,ft=$.noResultsMessage),"placeholder"in $&&n(8,gt=$.placeholder),"proximity"in $&&n(37,lt=$.proximity),"reverseActive"in $&&n(0,It=$.reverseActive),"reverseButtonTitle"in $&&n(9,yt=$.reverseButtonTitle),"searchValue"in $&&n(1,bt=$.searchValue),"showFullGeometry"in $&&n(38,ee=$.showFullGeometry),"showPlaceType"in $&&n(10,kt=$.showPlaceType),"showResultsWhileTyping"in $&&n(39,Gt=$.showResultsWhileTyping),"selectFirst"in $&&n(11,Qt=$.selectFirst),"flyToSelected"in $&&n(40,ne=$.flyToSelected),"markerOnSelected"in $&&n(41,Ie=$.markerOnSelected),"types"in $&&n(42,bn=$.types),"excludeTypes"in $&&n(43,Zn=$.excludeTypes),"zoom"in $&&n(44,en=$.zoom),"maxZoom"in $&&n(45,Be=$.maxZoom),"apiUrl"in $&&n(46,Ve=$.apiUrl),"fetchParameters"in $&&n(47,dn=$.fetchParameters),"iconsBaseUrl"in $&&n(12,Fn=$.iconsBaseUrl),"adjustUrlQuery"in $&&n(48,xn=$.adjustUrlQuery),"$$scope"in $&&n(58,l=$.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,Vn=Ai),S&&!Ai&&n(1,bt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&bt.lengthn(18,Xi=$)),e.$$.dirty[1]&50356241&&(it&&xe&&xe.id!==Tn&&Y&&(!xe.bbox||xe.bbox[0]===xe.bbox[2]&&xe.bbox[1]===xe.bbox[3]?it.flyTo(xe.center,xe.id.startsWith("poi.")||xe.id.startsWith("address.")?Be:en):it.fitBounds(U1(xe.bbox),50,Be),n(14,Lt=void 0),n(54,ke=void 0),n(15,mn=-1)),n(56,Tn=xe==null?void 0:xe.id)),e.$$.dirty[0]&18432&&Qt&&Lt!=null&&Lt.length&&n(15,mn=0),e.$$.dirty[0]&2050&&(Qt||n(15,mn=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&ke!==Lt&&n(54,ke=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&it&&it.setEventHandler($=>{switch($.type){case"mapClick":It&&Sa($.coordinates);break;case"markerClick":{const ot=Lt==null?void 0:Lt.find(Mt=>Mt.id===$.id);ot&&oi(ot)}break;case"markerMouseEnter":ke&&n(15,mn=Vn?(Lt==null?void 0:Lt.findIndex(ot=>ot.id===$.id))??-1:-1);break;case"markerMouseLeave":ke&&n(15,mn=-1);break}}),e.$$.dirty[0]&49152&&n(57,i=Lt==null?void 0:Lt[mn]),e.$$.dirty[1]&67133969&&it&&i&&Y&&ne&&it.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Be:en),e.$$.dirty[1]&1040&&(Ie||it==null||it.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&it&&Ie&&!ke&&(it.setMarkers(i?[i]:void 0,void 0),it.setSelectedMarker(i?0:-1)),e.$$.dirty[1]&25165840&&it&&it.setMarkers(ke,xe),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&ke&&it&&it.setSelectedMarker(mn),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&it){const $=Ha(bt);it.setReverseMarker($?[$.decimalLongitude,$.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&oo("select",i),e.$$.dirty[1]&16777216&&oo("pick",xe),e.$$.dirty[0]&81920&&oo("optionsVisibilityChange",Vn&&!!Lt),e.$$.dirty[0]&16384&&oo("featuresListed",Lt),e.$$.dirty[1]&8388608&&oo("featuresMarked",ke),e.$$.dirty[0]&1&&oo("reverseToggle",It),e.$$.dirty[0]&2&&oo("queryChange",bt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&it&&it.indicateReverse(It)},[It,bt,f,x,L,D,F,ft,gt,yt,kt,Qt,Fn,Ai,Lt,mn,Vn,un,Xi,Ui,es,ns,le,vo,oi,a,_,S,A,P,U,Y,V,Z,K,it,mt,lt,ee,Gt,ne,Ie,bn,Zn,en,Be,Ve,dn,xn,oe,je,pn,Bn,yi,ke,xe,Tn,i,l,r,Ea,ws,ce,cn,Ke,Nr,is,sn,Ss,st,G,q,J]}class JT extends tn{constructor(t){super(),Qe(this,t,KT,YT,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 JT({props:{mapController:e[0],apiKey:ky}}),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"class","svelte-ixhnie")},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function QT(e){let t,n,i=e[0]&&J1(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=J1(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function tL(e,t,n){let i,r;return Ee(e,Ru,l=>n(1,r=l)),e.$$.update=()=>{e.$$.dirty&2&&n(0,i=r?pT(r,Ms):null)},[i,r]}class eL extends tn{constructor(t){super(),Qe(this,t,tL,QT,He,{})}}const nL=e=>({}),Q1=e=>({}),iL=e=>({}),tb=e=>({}),rL=e=>({}),eb=e=>({});function oL(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=_t("div"),_&&_.c(),n=Wt(),i=_t("div"),S&&S.c(),r=Wt(),l=_t("div"),A&&A.c(),Rt(t,"class","top svelte-3nmiww"),Rt(i,"class","left svelte-3nmiww"),Rt(l,"class","main svelte-3nmiww")},m(P,D){St(P,t,D),_&&_.m(t,null),St(P,n,D),St(P,i,D),S&&S.m(i,null),St(P,r,D),St(P,l,D),A&&A.m(l,null),f=!0},p(P,[D]){_&&_.p&&(!f||D&1)&&lr(_,a,P,P[0],f?ar(a,P[0],D,rL):ur(P[0]),eb),S&&S.p&&(!f||D&1)&&lr(S,x,P,P[0],f?ar(x,P[0],D,iL):ur(P[0]),tb),A&&A.p&&(!f||D&1)&&lr(A,L,P,P[0],f?ar(L,P[0],D,nL):ur(P[0]),Q1)},i(P){f||(dt(_,P),dt(S,P),dt(A,P),f=!0)},o(P){vt(_,P),vt(S,P),vt(A,P),f=!1},d(P){P&&(wt(t),wt(n),wt(i),wt(r),wt(l)),_&&_.d(P),S&&S.d(P),A&&A.d(P)}}}function sL(e,t,n){let{$$slots:i={},$$scope:r}=t;return e.$$set=l=>{"$$scope"in l&&n(0,r=l.$$scope)},[r,i]}class aL extends tn{constructor(t){super(),Qe(this,t,sL,oL,He,{})}}function lL(e){let t,n,i,r;const l=e[1].default,f=sr(l,e,e[0],null);return{c(){t=_t("a"),f&&f.c(),Rt(t,"href","#")},m(a,_){St(a,t,_),f&&f.m(t,null),n=!0,i||(r=Ge(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||(dt(f,a),n=!0)},o(a){vt(f,a),n=!1},d(a){a&&wt(t),f&&f.d(a),i=!1,r()}}}function uL(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 xi extends tn{constructor(t){super(),Qe(this,t,uL,lL,He,{})}}function nb(e){let t,n;return{c(){t=_t("div"),n=ge(e[0]),Rt(t,"class","svelte-1uuov7f")},m(i,r){St(i,t,r),ht(t,n)},p(i,r){r&1&&Fi(n,i[0])},d(i){i&&wt(t)}}}function cL(e){let t,n=e[0]&&nb(e);return{c(){n&&n.c(),t=Do()},m(i,r){n&&n.m(i,r),St(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:Me,o:Me,d(i){i&&wt(t),n&&n.d(i)}}}function hL(e,t,n){let{msg:i=null}=t;return e.$$set=r=>{"msg"in r&&n(0,i=r.msg)},[i]}class pw extends tn{constructor(t){super(),Qe(this,t,hL,cL,He,{msg:0})}}const fL=e=>({dialog:e&1}),ib=e=>({dialog:e[0]});function pL(e){let t,n,i,r,l;const f=e[4].default,a=sr(f,e,e[3],ib);return{c(){t=_t("dialog"),n=_t("article"),a&&a.c(),t.open=!0},m(_,x){St(_,t,x),ht(t,n),a&&a.m(n,null),e[6](t),i=!0,r||(l=[Ge(window,"click",e[1]),Ge(window,"keydown",e[2]),Ge(t,"close",e[5])],r=!0)},p(_,[x]){a&&a.p&&(!i||x&9)&&lr(a,f,_,_[3],i?ar(f,_[3],x,fL):ur(_[3]),ib)},i(_){i||(dt(a,_),i=!0)},o(_){vt(a,_),i=!1},d(_){_&&wt(t),a&&a.d(_),e[6](null),r=!1,yo(l)}}}function dL(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 tn{constructor(t){super(),Qe(this,t,dL,pL,He,{})}}var Lo=63710088e-1,Jy={centimeters:Lo*100,centimetres:Lo*100,degrees:Lo/111325,feet:Lo*3.28084,inches:Lo*39.37,kilometers:Lo/1e3,kilometres:Lo/1e3,meters:Lo,metres:Lo,miles:Lo/1609.344,millimeters:Lo*1e3,millimetres:Lo*1e3,nauticalmiles:Lo/1852,radians:1,yards:Lo*1.0936},mL={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/Lo,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 gL(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 mw(t).geometry;case"MultiLineString":return dw(t).geometry;case"MultiPolygon":return gw(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 _L(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 wL(e,t){return ad(Ag(e,t))}function SL(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 EL(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 IL(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 CL(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 TL(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 LL=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Iy,bearingToAzimuth:SL,convertArea:IL,convertLength:EL,degreesToRadians:ra,earthRadius:Lo,factors:Jy,feature:va,featureCollection:Nc,geometry:gL,geometryCollection:bL,isNumber:hg,isObject:e0,lengthToDegrees:wL,lengthToRadians:Ag,lineString:ia,lineStrings:vL,multiLineString:dw,multiPoint:mw,multiPolygon:gw,point:ps,points:_L,polygon:Qy,polygons:yL,radiansToDegrees:ad,radiansToLength:t0,round:xL,unitsFactors:mL,validateBBox:CL,validateId:TL},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 _w(e,t,n){if(n===void 0&&(n={}),n.final===!0)return ML(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 ML(e,t){var n=_w(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,D=P==="FeatureCollection",F=P==="Feature",U=D?e.features.length:1,Y=0;Y_||D>x||F>S){a=L,_=i,x=D,S=F,l=0;return}var U=ia([a,L],n.properties);if(t(U,i,r,F,l)===!1)return!1;l++,a=L})===!1)return!1}}})}function OL(e,t,n){var i=n,r=!1;return vw(e,function(l,f,a,_,x){r===!1&&n===void 0?i=l:i=t(i,l,f,a,_,x),r=!0}),i}function bw(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:{}},xw={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(tx,function(){function n(V,Z,K,it,mt){(function ft(gt,lt,It,yt,bt){for(;yt>It;){if(yt-It>600){var ee=yt-It+1,kt=lt-It+1,Gt=Math.log(ee),Qt=.5*Math.exp(2*Gt/3),ne=.5*Math.sqrt(Gt*Qt*(ee-Qt)/ee)*(kt-ee/2<0?-1:1),Ie=Math.max(It,Math.floor(lt-kt*Qt/ee+ne)),bn=Math.min(yt,Math.floor(lt+(ee-kt)*Qt/ee+ne));ft(gt,lt,Ie,bn,bt)}var Zn=gt[lt],en=It,Be=yt;for(i(gt,It,lt),bt(gt[yt],Zn)>0&&i(gt,It,yt);en0;)Be--}bt(gt[It],Zn)===0?i(gt,It,Be):i(gt,++Be,yt),Be<=lt&&(It=Be+1),lt<=Be&&(yt=Be-1)}})(V,Z,K||0,it||V.length-1,mt||r)}function i(V,Z,K){var it=V[Z];V[Z]=V[K],V[K]=it}function r(V,Z){return VZ?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,Z,K){if(!K)return Z.indexOf(V);for(var it=0;it=V.minX&&Z.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,Z,K,it,mt){for(var ft=[Z,K];ft.length;)if(!((K=ft.pop())-(Z=ft.pop())<=it)){var gt=Z+Math.ceil((K-Z)/it/2)*it;n(V,gt,Z,K,mt),ft.push(Z,gt,gt,K)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(V){var Z=this.data,K=[];if(!F(V,Z))return K;for(var it=this.toBBox,mt=[];Z;){for(var ft=0;ft=0&&mt[Z].children.length>this._maxEntries;)this._split(mt,Z),Z--;this._adjustParentBBoxes(it,mt,Z)},l.prototype._split=function(V,Z){var K=V[Z],it=K.children.length,mt=this._minEntries;this._chooseSplitAxis(K,mt,it);var ft=this._chooseSplitIndex(K,mt,it),gt=U(K.children.splice(ft,K.children.length-ft));gt.height=K.height,gt.leaf=K.leaf,a(K,this.toBBox),a(gt,this.toBBox),Z?V[Z-1].children.push(gt):this._splitRoot(K,gt)},l.prototype._splitRoot=function(V,Z){this.data=U([V,Z]),this.data.height=V.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(V,Z,K){for(var it,mt,ft,gt,lt,It,yt,bt=1/0,ee=1/0,kt=Z;kt<=K-Z;kt++){var Gt=_(V,0,kt,this.toBBox),Qt=_(V,kt,K,this.toBBox),ne=(mt=Gt,ft=Qt,gt=void 0,lt=void 0,It=void 0,yt=void 0,gt=Math.max(mt.minX,ft.minX),lt=Math.max(mt.minY,ft.minY),It=Math.min(mt.maxX,ft.maxX),yt=Math.min(mt.maxY,ft.maxY),Math.max(0,It-gt)*Math.max(0,yt-lt)),Ie=A(Gt)+A(Qt);ne=Z;bt--){var ee=V.children[bt];x(gt,V.leaf?mt(ee):ee),lt+=P(gt)}return lt},l.prototype._adjustParentBBoxes=function(V,Z,K){for(var it=K;it>=0;it--)x(Z[it],V)},l.prototype._condense=function(V){for(var Z=V.length-1,K=void 0;Z>=0;Z--)V[Z].children.length===0?Z>0?(K=V[Z-1].children).splice(K.indexOf(V[Z]),1):this.clear():a(V[Z],this.toBBox)},l})})(xw);var qL=xw.exports;const ZL=nx(LL),ww=nx(VL);var r0={};Object.defineProperty(r0,"__esModule",{value:!0});var $L=ww;function Cy(e){var t=[1/0,1/0,-1/0,-1/0];return $L.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-_),D=(f-r)*(l-x)-(a-l)*(r-_);if(A===0)return null;var F=P/A,U=D/A;if(F>=0&&F<=1&&U>=0&&U<=1){var Y=r+F*(f-r),V=l+F*(a-l);return ps([Y,V])}return null}function KL(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=F.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()}});Wn(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(lb(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))});Wn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=J_(t.lngLat.toArray()),this.onClick(t),this.finish())});Wn(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Wn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Wn(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});Wn(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)),Cw.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,Tw.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(kw),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 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 tM(e){let t,n,i;return{c(){t=ge("Undo ("),n=ge(e[1]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l&2&&Fi(n,r[1])},d(r){r&&(wt(t),wt(n),wt(i))}}}function eM(e){let t;return{c(){t=ge("Undo")},m(n,i){St(n,t,i)},p:Me,d(n){n&&wt(t)}}}function nM(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?eM:tM}let _=a(e),x=_(e);return{c(){t=_t("button"),x.c(),i=Wt(),r=_t("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,22 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,t.disabled=n=e[1]==0},m(S,L){St(S,t,L),x.m(t,null),St(S,i,L),St(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:Ce,o:Ce,d(S){S&&(wt(t),wt(i),wt(r)),x.d(),l=!1,f()}}}function iM(e,t,n){let i;Ee(e,Tw,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 rM extends tn{constructor(t){super(),Qe(this,t,iM,nM,He,{polygonTool:0})}}function oM(e){let t,n,i,r,l,f,a;return{c(){t=yt("button"),t.textContent="Import current view",n=Xt(),i=yt("i"),i.textContent="or...",r=Xt(),l=yt("button"),l.textContent="Draw an area to import on the map",Rt(t,"type","button"),Rt(l,"type","button")},m(_,x){St(_,t,x),St(_,n,x),St(_,i,x),St(_,r,x),St(_,l,x),f||(a=[Ze(t,"click",e[1]),Ze(l,"click",e[2])],f=!0)},p:Ce,i:Ce,o:Ce,d(_){_&&(wt(t),wt(n),wt(i),wt(r),wt(l)),f=!1,No(a)}}}function sM(e){let t,n;return t=new rM({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function aM(e){let t,n,i,r;const l=[sM,oM],f=[];function a(_,x){return _[0]?0:1}return t=a(e),n=f[t]=l[t](e),{c(){n.c(),i=Do()},m(_,x){f[t].m(_,x),St(_,i,x),r=!0},p(_,[x]){let S=t;t=a(_),t===S?f[t].p(_,x):(hi(),vt(f[S],1,1,()=>{f[S]=null}),fi(),n=f[t],n?n.p(_,x):(n=f[t]=l[t](_),n.c()),dt(n,1),n.m(i.parentNode,i))},i(_){r||(dt(n),r=!0)},o(_){vt(n),r=!1},d(_){_&&wt(i),f[t].d(_)}}}function Ip(e){return[e.lng,e.lat]}function lM(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(Aw(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 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 uM extends tn{constructor(t){super(),Qe(this,t,lM,aM,He,{map:3})}}const cM=e=>({props:e&8}),ub=e=>({props:pM(e[3])});function hM(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,cM):ur(r[2]),ub)},i(r){t||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function fM(e){let t,n;return t=new eI({props:{openOn:e[0],$$slots:{default:[hM,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function pM(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function dM(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 tn{constructor(t){super(),Qe(this,t,dM,fM,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=yt("tr"),n=yt("td"),r=ge(i),l=Xt(),f=yt("td"),_=ge(a),x=Xt()},m(S,L){St(S,t,L),ft(t,n),ft(n,r),ft(t,l),ft(t,f),ft(f,_),ft(t,x)},p(S,L){L&1&&i!==(i=S[1]+"")&&Fi(r,i),L&1&&a!==(a=S[2]+"")&&Fi(_,a)},d(S){S&&wt(t)}}}function mM(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 tn{constructor(t){super(),Qe(this,t,gM,mM,He,{properties:0})}}function Mr(e){return{id:e,beforeId:_M(e)}}function _M(e){let t=Ub(Ru);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","one-ways","Road labels","modal-filters","boundary","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"],Lw=["==",["geometry-type"],"Polygon"],Mw=["==",["geometry-type"],"LineString"],Pw=["==",["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 yM(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 ci(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:kw(e)}}}function kw(e){return[Math.round(e[0]*1e7)/1e7,Math.round(e[1]*1e7)/1e7]}function Aw(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 vM(e){let t;return{c(){t=ge("Back")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function bM(e){let t,n,i,r;return t=new xi({props:{$$slots:{default:[vM]},$$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||(dt(t.$$.fragment,l),n=!0)},o(l){vt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function xM(e){let t=Dc();function n(r){r.key=="Escape"&&(r.stopPropagation(),t("click"))}return[t,n,()=>t("click")]}class Ng extends tn{constructor(t){super(),Qe(this,t,xM,bM,He,{})}}function wM(e){let t,n;const i=[Mr("one-ways"),{filter:["all",["==",["get","kind"],"interior_road"],["!=",["get","direction"],"both"]]},{layout:{"icon-image":"oneway","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["==",["get","direction"],"forwards"],0,180]}},{paint:{"icon-opacity":["case",["get","direction_edited"],1,.5]}}];let r={};for(let l=0;l({}),pb=e=>({}),IM=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,IM):ur(r[7]),db)},i(r){t||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function CM(e){let t,n,i=e[0]&&mb(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,l){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=mb(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function TM(e){let t,n,i,r,l,f,a;const _=[Mr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let x={};for(let D=0;D<_.length;D+=1)x=xr(x,_[D]);t=new af({props:x});const S=[Mr("interior-roads"),{filter:["==",["get","kind"],"interior_road"]},{paint:{"line-width":5,"line-color":["interpolate-hcl",["linear"],["get","shortcuts"],0,"white",1,"#F19A93",e[2],"#A32015"]}},{hoverCursor:e[0]?"pointer":void 0}];let L={$$slots:{default:[CM]},$$scope:{ctx:e}};for(let D=0;D{}}=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 tn{constructor(t){super(),Qe(this,t,MM,LM,He,{gjInput:4,interactive:0,onClickLine:1})}}const PM=e=>({}),gb=e=>({}),kM=e=>({}),_b=e=>({}),AM=e=>({}),yb=e=>({});function NM(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=yt("div"),_&&_.c(),n=Xt(),i=yt("div"),S&&S.c(),r=Xt(),l=yt("div"),A&&A.c()},m(P,D){St(P,t,D),_&&_.m(t,null),e[5](t),St(P,n,D),St(P,i,D),S&&S.m(i,null),e[6](i),St(P,r,D),St(P,l,D),A&&A.m(l,null),e[7](l),f=!0},p(P,[D]){_&&_.p&&(!f||D&8)&&lr(_,a,P,P[3],f?ar(a,P[3],D,AM):ur(P[3]),yb),S&&S.p&&(!f||D&8)&&lr(S,x,P,P[3],f?ar(x,P[3],D,kM):ur(P[3]),_b),A&&A.p&&(!f||D&8)&&lr(A,L,P,P[3],f?ar(L,P[3],D,PM):ur(P[3]),gb)},i(P){f||(dt(_,P),dt(S,P),dt(A,P),f=!0)},o(P){vt(_,P),vt(S,P),vt(A,P),f=!1},d(P){P&&(wt(t),wt(n),wt(i),wt(r),wt(l)),_&&_.d(P),e[5](null),S&&S.d(P),e[6](null),A&&A.d(P),e[7](null)}}}function DM(e,t,n){let i,r,l;Ee(e,oy,L=>n(0,i=L)),Ee(e,sy,L=>n(1,r=L)),Ee(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 Xu extends tn{constructor(t){super(),Qe(this,t,DM,NM,He,{})}}function RM(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function OM(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function zM(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function FM(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;return l=new xi({props:{$$slots:{default:[RM]},$$scope:{ctx:e}}}),l.$on("click",e[4]),_=new xi({props:{$$slots:{default:[OM]},$$scope:{ctx:e}}}),_.$on("click",e[5]),L=new xi({props:{$$slots:{default:[zM]},$$scope:{ctx:e}}}),L.$on("click",e[6]),{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),Zt(_.$$.fragment),x=Xt(),S=yt("li"),Zt(L.$$.fragment),A=Xt(),P=yt("li"),P.textContent="Debug mode",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(B,U){St(B,t,U),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),jt(_,a,null),ft(i,x),ft(i,S),jt(L,S,null),ft(i,A),ft(i,P),D=!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 Z={};U&256&&(Z.$$scope={dirty:U,ctx:B}),L.$set(Z)},i(B){D||(dt(l.$$.fragment,B),dt(_.$$.fragment,B),dt(L.$$.fragment,B),D=!0)},o(B){vt(l.$$.fragment,B),vt(_.$$.fragment,B),vt(L.$$.fragment,B),D=!1},d(B){B&&wt(t),qt(l),qt(_),qt(L)}}}function BM(e){let t,n,i;return n=new Ng({}),n.$on("click",e[3]),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","sidebar")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Ce,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function VM(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function UM(e){let t,n,i;return n=new wl({props:{openOn:"hover",$$slots:{default:[VM,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:e}}}),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function GM(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function jM(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[GM,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function qM(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function ZM(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[qM,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function $M(e){let t,n,i,r;const l=[Mr("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let f={$$slots:{default:[jM]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function HM(e){let t,n;const i=[Mr("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let r={$$slots:{default:[XM]},$$scope:{ctx:e}};for(let l=0;ln(0,i=S)),Ee(e,En,S=>n(1,r=S)),[i,r,S=>window.open(ci(S.properties).way,"_blank"),()=>Ue(En,r={mode:"neighbourhood"},r),()=>Ue(En,r={mode:"title"},r),()=>Ue(En,r={mode:"network"},r),()=>Ue(En,r={mode:"neighbourhood"},r)]}class QM extends tn{constructor(t){super(),Qe(this,t,JM,KM,He,{})}}function tP(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function eP(e){let t,n,i,r,l,f,a,_;return l=new xi({props:{$$slots:{default:[tP]},$$scope:{ctx:e}}}),l.$on("click",e[3]),{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),a.textContent="Debug route snapper",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(x,S){St(x,t,S),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),_=!0},p(x,S){const L={};S&32&&(L.$$scope={dirty:S,ctx:x}),l.$set(L)},i(x){_||(dt(l.$$.fragment,x),_=!0)},o(x){vt(l.$$.fragment,x),_=!1},d(x){x&&wt(t),qt(l)}}}function nP(e){let t,n,i;return n=new Ng({}),n.$on("click",e[2]),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","sidebar")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Ce,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function iP(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function rP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[iP,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function oP(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function sP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[oP,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function aP(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:[rP]},$$scope:{ctx:e}}}),i=new hd({props:{manageHoverState:!0,paint:{"circle-radius":10,"circle-color":"black","circle-opacity":ry(.5,1)},$$slots:{default:[sP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment),n=Xt(),Zt(i.$$.fragment)},m(l,f){jt(t,l,f),St(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||(dt(t.$$.fragment,l),dt(i.$$.fragment,l),r=!0)},o(l){vt(t.$$.fragment,l),vt(i.$$.fragment,l),r=!1},d(l){l&&wt(n),qt(t,l),qt(i,l)}}}function lP(e){let t,n,i;return n=new Ps({props:{data:JSON.parse(ci(e[0]).toRouteSnapperGj()),generateId:!0,$$slots:{default:[aP]},$$scope:{ctx:e}}}),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&1&&(f.data=JSON.parse(ci(r[0]).toRouteSnapperGj())),l&32&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function uP(e){let t,n;return t=new Xu({props:{$$slots:{map:[lP],sidebar:[nP],top:[eP]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function cP(e,t,n){let i,r;return Ee(e,Xo,a=>n(0,i=a)),Ee(e,En,a=>n(1,r=a)),[i,r,()=>Ue(En,r={mode:"network"},r),()=>Ue(En,r={mode:"title"},r)]}class hP extends tn{constructor(t){super(),Qe(this,t,cP,uP,He,{})}}function fP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D,B,U,Y,V;return B=new pw({props:{msg:e[0]}}),{c(){t=yt("details"),n=yt("summary"),n.textContent="Save / load project",i=Xt(),r=yt("button"),r.textContent="Save to GJ",l=Xt(),f=yt("label"),a=ge(`Load edits from GJ - `),_=yt("input"),x=Xt(),S=yt("div"),L=yt("button"),L.textContent="Save to local storage",A=Xt(),P=yt("button"),P.textContent="Load from local storage",D=Xt(),Zt(B.$$.fragment),Rt(_,"type","file"),ri(S,"display","flex"),ri(S,"justify-content","space-between")},m(Z,K){St(Z,t,K),ft(t,n),ft(t,i),ft(t,r),ft(t,l),ft(t,f),ft(f,a),ft(f,_),e[7](_),ft(t,x),ft(t,S),ft(S,L),ft(S,A),ft(S,P),St(Z,D,K),jt(B,Z,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(Z,[K]){const it={};K&1&&(it.msg=Z[0]),B.$set(it)},i(Z){U||(dt(B.$$.fragment,Z),U=!0)},o(Z){vt(B.$$.fragment,Z),U=!1},d(Z){Z&&(wt(t),wt(D)),e[7](null),qt(B,Z),Y=!1,No(V)}}}function pP(e,t,n){let i,r,l,f;Ee(e,Xo,B=>n(9,r=B)),Ee(e,En,B=>n(10,l=B)),Ee(e,ku,B=>n(6,f=B));let a=null;function _(){yM(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()),window.alert("Saved")}function P(B){r.loadSavefile(JSON.parse(B)),Ue(En,l={mode:"network"},l),Xo.set(r)}function D(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,D]}class Nw extends tn{constructor(t){super(),Qe(this,t,pP,fP,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=yt("button"),n=yt("img"),r=Xt(),l=yt("br"),f=Xt(),_=ge(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"),ri(t,"width","100%"),t.disabled=S=e[0]==e[7]},m(D,B){St(D,t,B),ft(t,n),ft(t,r),ft(t,l),ft(t,f),ft(t,_),ft(t,x),L||(A=Ze(t,"click",P),L=!0)},p(D,B){e=D,B&1&&S!==(S=e[0]==e[7])&&(t.disabled=S)},d(D){D&&wt(t),L=!1,A()}}}function dP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P=e[1][2]+"",D,B,U,Y,V,Z,K=la(e[2]),it=[];for(let ht=0;ht({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function gP(e,t,n){let i,r;Ee(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=>Ue(ly,r=x,r),a=x=>ci(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 _P extends tn{constructor(t){super(),Qe(this,t,gP,mP,He,{})}}function xb(e){let t,n;return t=new Ps({props:{data:e[0],$$slots:{default:[yP]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function yP(e){let t,n;const i=[Mr("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let r={};for(let l=0;l{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function bP(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 xP extends tn{constructor(t){super(),Qe(this,t,bP,vP,He,{map:1})}}function wP(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function SP(e){let t,n;const i=[Mr("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}},{paint:{"icon-opacity":["case",["get","edited"],1,.5]}}];let r={$$slots:{default:[wP]},$$scope:{ctx:e}};for(let l=0;ln(1,r=x)),Ee(e,Lu,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 tn{constructor(t){super(),Qe(this,t,IP,EP,He,{})}}function CP(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function TP(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function LP(e){let t;return{c(){t=ge("View shortcuts")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function MP(e){let t;return{c(){t=ge("Route")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function PP(e){let t;return{c(){t=ge("Change this boundary")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function kP(e){let t;return{c(){t=ge("Debug")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function AP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D,B,U,Y,V,Z,K,it,mt,ht,gt,lt;return l=new xi({props:{$$slots:{default:[CP]},$$scope:{ctx:e}}}),l.$on("click",e[21]),_=new xi({props:{$$slots:{default:[TP]},$$scope:{ctx:e}}}),_.$on("click",e[22]),B=new xi({props:{$$slots:{default:[LP]},$$scope:{ctx:e}}}),B.$on("click",e[23]),V=new xi({props:{$$slots:{default:[MP]},$$scope:{ctx:e}}}),V.$on("click",e[24]),it=new xi({props:{$$slots:{default:[PP]},$$scope:{ctx:e}}}),it.$on("click",e[25]),gt=new xi({props:{$$slots:{default:[kP]},$$scope:{ctx:e}}}),gt.$on("click",e[26]),{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),Zt(_.$$.fragment),x=Xt(),S=yt("li"),S.textContent="Editing",L=Xt(),A=yt("nav"),P=yt("ul"),D=yt("li"),Zt(B.$$.fragment),U=Xt(),Y=yt("li"),Zt(V.$$.fragment),Z=Xt(),K=yt("li"),Zt(it.$$.fragment),mt=Xt(),ht=yt("li"),Zt(gt.$$.fragment),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top"),ri(t,"display","flex"),ri(t,"justify-content","space-between")},m(It,_t){St(It,t,_t),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),jt(_,a,null),ft(i,x),ft(i,S),ft(t,L),ft(t,A),ft(A,P),ft(P,D),jt(B,D,null),ft(P,U),ft(P,Y),jt(V,Y,null),ft(P,Z),ft(P,K),jt(it,K,null),ft(P,mt),ft(P,ht),jt(gt,ht,null),lt=!0},p(It,_t){const bt={};_t[1]&1&&(bt.$$scope={dirty:_t,ctx:It}),l.$set(bt);const ee={};_t[1]&1&&(ee.$$scope={dirty:_t,ctx:It}),_.$set(ee);const kt={};_t[1]&1&&(kt.$$scope={dirty:_t,ctx:It}),B.$set(kt);const Gt={};_t[1]&1&&(Gt.$$scope={dirty:_t,ctx:It}),V.$set(Gt);const Qt={};_t[1]&1&&(Qt.$$scope={dirty:_t,ctx:It}),it.$set(Qt);const ne={};_t[1]&1&&(ne.$$scope={dirty:_t,ctx:It}),gt.$set(ne)},i(It){lt||(dt(l.$$.fragment,It),dt(_.$$.fragment,It),dt(B.$$.fragment,It),dt(V.$$.fragment,It),dt(it.$$.fragment,It),dt(gt.$$.fragment,It),lt=!0)},o(It){vt(l.$$.fragment,It),vt(_.$$.fragment,It),vt(B.$$.fragment,It),vt(V.$$.fragment,It),vt(it.$$.fragment,It),vt(gt.$$.fragment,It),lt=!1},d(It){It&&wt(t),qt(l),qt(_),qt(B),qt(V),qt(it),qt(gt)}}}function NP(e){let t,n,i;return{c(){t=ge("Undo ("),n=ge(e[3]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l[0]&8&&Fi(n,r[3])},d(r){r&&(wt(t),wt(n),wt(i))}}}function DP(e){let t;return{c(){t=ge("Undo")},m(n,i){St(n,t,i)},p:Ce,d(n){n&&wt(t)}}}function RP(e){let t,n,i;return{c(){t=ge("Redo ("),n=ge(e[4]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l[0]&16&&Fi(n,r[4])},d(r){r&&(wt(t),wt(n),wt(i))}}}function OP(e){let t;return{c(){t=ge("Redo")},m(n,i){St(n,t,i)},p:Ce,d(n){n&&wt(t)}}}function wb(e){let t,n;return t=new _P({}),t.$on("close",e[20]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p:Ce,i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function zP(e){let t,n,i,r,l=ci(ci(e[5]).properties).name+"",f,a,_,x,S,L,A,P,D,B,U,Y,V,Z,K,it,mt,ht,gt,lt,It,_t,bt,ee,kt,Gt,Qt,ne,Ie,bn,Zn,en,Be,Ve,dn,Fn,xn,oe,Ge;function pn(rn,un){return rn[3]==0?DP:NP}let Bn=pn(e),yi=Bn(e);function Ai(rn,un){return rn[4]==0?OP:RP}let Lt=Ai(e),ke=Lt(e),xe=e[2]&&wb(e);return Fn=new Nw({}),{c(){t=yt("div"),n=yt("p"),i=ge("Editing neighbourhood "),r=yt("u"),f=ge(l),a=Xt(),_=yt("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){St(S,t,L),x.m(t,null),St(S,i,L),St(S,r,L),l||(f=Ge(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:Me,o:Me,d(S){S&&(wt(t),wt(i),wt(r)),x.d(),l=!1,f()}}}function iM(e,t,n){let i;Ee(e,Tw,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 rM extends tn{constructor(t){super(),Qe(this,t,iM,nM,He,{polygonTool:0})}}function oM(e){let t,n,i,r,l,f,a;return{c(){t=_t("button"),t.textContent="Import current view",n=Wt(),i=_t("i"),i.textContent="or...",r=Wt(),l=_t("button"),l.textContent="Draw an area to import on the map",Rt(t,"type","button"),Rt(l,"type","button")},m(_,x){St(_,t,x),St(_,n,x),St(_,i,x),St(_,r,x),St(_,l,x),f||(a=[Ge(t,"click",e[1]),Ge(l,"click",e[2])],f=!0)},p:Me,i:Me,o:Me,d(_){_&&(wt(t),wt(n),wt(i),wt(r),wt(l)),f=!1,yo(a)}}}function sM(e){let t,n;return t=new rM({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function aM(e){let t,n,i,r;const l=[sM,oM],f=[];function a(_,x){return _[0]?0:1}return t=a(e),n=f[t]=l[t](e),{c(){n.c(),i=Do()},m(_,x){f[t].m(_,x),St(_,i,x),r=!0},p(_,[x]){let S=t;t=a(_),t===S?f[t].p(_,x):(hi(),vt(f[S],1,1,()=>{f[S]=null}),fi(),n=f[t],n?n.p(_,x):(n=f[t]=l[t](_),n.c()),dt(n,1),n.m(i.parentNode,i))},i(_){r||(dt(n),r=!0)},o(_){vt(n),r=!1},d(_){_&&wt(i),f[t].d(_)}}}function Ip(e){return[e.lng,e.lat]}function lM(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(Aw(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 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 uM extends tn{constructor(t){super(),Qe(this,t,lM,aM,He,{map:3})}}const cM=e=>({props:e&8}),ub=e=>({props:pM(e[3])});function hM(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,cM):ur(r[2]),ub)},i(r){t||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function fM(e){let t,n;return t=new eI({props:{openOn:e[0],$$slots:{default:[hM,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function pM(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function dM(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 tn{constructor(t){super(),Qe(this,t,dM,fM,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=_t("tr"),n=_t("td"),r=ge(i),l=Wt(),f=_t("td"),_=ge(a),x=Wt()},m(S,L){St(S,t,L),ht(t,n),ht(n,r),ht(t,l),ht(t,f),ht(f,_),ht(t,x)},p(S,L){L&1&&i!==(i=S[1]+"")&&Fi(r,i),L&1&&a!==(a=S[2]+"")&&Fi(_,a)},d(S){S&&wt(t)}}}function mM(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 tn{constructor(t){super(),Qe(this,t,gM,mM,He,{properties:0})}}function Mr(e){return{id:e,beforeId:_M(e)}}function _M(e){let t=Ub(Ru);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","one-ways","Road labels","modal-filters","boundary","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"],Lw=["==",["geometry-type"],"Polygon"],Mw=["==",["geometry-type"],"LineString"],Pw=["==",["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 yM(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 ci(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:kw(e)}}}function kw(e){return[Math.round(e[0]*1e7)/1e7,Math.round(e[1]*1e7)/1e7]}function Aw(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 vM(e){let t;return{c(){t=ge("Back")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function bM(e){let t,n,i,r;return t=new xi({props:{$$slots:{default:[vM]},$$scope:{ctx:e}}}),t.$on("click",e[2]),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ge(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||(dt(t.$$.fragment,l),n=!0)},o(l){vt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function xM(e){let t=Dc();function n(r){r.key=="Escape"&&(r.stopPropagation(),t("click"))}return[t,n,()=>t("click")]}class Ng extends tn{constructor(t){super(),Qe(this,t,xM,bM,He,{})}}function wM(e){let t,n;const i=[Mr("one-ways"),{filter:["all",["==",["get","kind"],"interior_road"],["!=",["get","direction"],"both"]]},{layout:{"icon-image":"oneway","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["==",["get","direction"],"forwards"],0,180]}},{paint:{"icon-opacity":["case",["get","direction_edited"],1,.5]}}];let r={};for(let l=0;l({}),pb=e=>({}),IM=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,IM):ur(r[7]),db)},i(r){t||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function CM(e){let t,n,i=e[0]&&mb(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,l){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=mb(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function TM(e){let t,n,i,r,l,f,a;const _=[Mr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let x={};for(let D=0;D<_.length;D+=1)x=xr(x,_[D]);t=new af({props:x});const S=[Mr("interior-roads"),{filter:["==",["get","kind"],"interior_road"]},{paint:{"line-width":5,"line-color":["interpolate-hcl",["linear"],["get","shortcuts"],0,"white",1,"#F19A93",e[2],"#A32015"]}},{hoverCursor:e[0]?"pointer":void 0}];let L={$$slots:{default:[CM]},$$scope:{ctx:e}};for(let D=0;D{}}=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 tn{constructor(t){super(),Qe(this,t,MM,LM,He,{gjInput:4,interactive:0,onClickLine:1})}}const PM=e=>({}),gb=e=>({}),kM=e=>({}),_b=e=>({}),AM=e=>({}),yb=e=>({});function NM(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=_t("div"),_&&_.c(),n=Wt(),i=_t("div"),S&&S.c(),r=Wt(),l=_t("div"),A&&A.c()},m(P,D){St(P,t,D),_&&_.m(t,null),e[5](t),St(P,n,D),St(P,i,D),S&&S.m(i,null),e[6](i),St(P,r,D),St(P,l,D),A&&A.m(l,null),e[7](l),f=!0},p(P,[D]){_&&_.p&&(!f||D&8)&&lr(_,a,P,P[3],f?ar(a,P[3],D,AM):ur(P[3]),yb),S&&S.p&&(!f||D&8)&&lr(S,x,P,P[3],f?ar(x,P[3],D,kM):ur(P[3]),_b),A&&A.p&&(!f||D&8)&&lr(A,L,P,P[3],f?ar(L,P[3],D,PM):ur(P[3]),gb)},i(P){f||(dt(_,P),dt(S,P),dt(A,P),f=!0)},o(P){vt(_,P),vt(S,P),vt(A,P),f=!1},d(P){P&&(wt(t),wt(n),wt(i),wt(r),wt(l)),_&&_.d(P),e[5](null),S&&S.d(P),e[6](null),A&&A.d(P),e[7](null)}}}function DM(e,t,n){let i,r,l;Ee(e,oy,L=>n(0,i=L)),Ee(e,sy,L=>n(1,r=L)),Ee(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 Xu extends tn{constructor(t){super(),Qe(this,t,DM,NM,He,{})}}function RM(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function OM(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function zM(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function FM(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;return l=new xi({props:{$$slots:{default:[RM]},$$scope:{ctx:e}}}),l.$on("click",e[4]),_=new xi({props:{$$slots:{default:[OM]},$$scope:{ctx:e}}}),_.$on("click",e[5]),L=new xi({props:{$$slots:{default:[zM]},$$scope:{ctx:e}}}),L.$on("click",e[6]),{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),Zt(_.$$.fragment),x=Wt(),S=_t("li"),Zt(L.$$.fragment),A=Wt(),P=_t("li"),P.textContent="Debug mode",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(F,U){St(F,t,U),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),jt(_,a,null),ht(i,x),ht(i,S),jt(L,S,null),ht(i,A),ht(i,P),D=!0},p(F,U){const Y={};U&256&&(Y.$$scope={dirty:U,ctx:F}),l.$set(Y);const V={};U&256&&(V.$$scope={dirty:U,ctx:F}),_.$set(V);const Z={};U&256&&(Z.$$scope={dirty:U,ctx:F}),L.$set(Z)},i(F){D||(dt(l.$$.fragment,F),dt(_.$$.fragment,F),dt(L.$$.fragment,F),D=!0)},o(F){vt(l.$$.fragment,F),vt(_.$$.fragment,F),vt(L.$$.fragment,F),D=!1},d(F){F&&wt(t),qt(l),qt(_),qt(L)}}}function BM(e){let t,n,i;return n=new Ng({}),n.$on("click",e[3]),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","sidebar")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Me,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function VM(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function UM(e){let t,n,i;return n=new wl({props:{openOn:"hover",$$slots:{default:[VM,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:e}}}),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function GM(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function jM(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[GM,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function qM(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function ZM(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[qM,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function $M(e){let t,n,i,r;const l=[Mr("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let f={$$slots:{default:[jM]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function HM(e){let t,n;const i=[Mr("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let r={$$slots:{default:[XM]},$$scope:{ctx:e}};for(let l=0;ln(0,i=S)),Ee(e,En,S=>n(1,r=S)),[i,r,S=>window.open(ci(S.properties).way,"_blank"),()=>Ue(En,r={mode:"neighbourhood"},r),()=>Ue(En,r={mode:"title"},r),()=>Ue(En,r={mode:"network"},r),()=>Ue(En,r={mode:"neighbourhood"},r)]}class QM extends tn{constructor(t){super(),Qe(this,t,JM,KM,He,{})}}function tP(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function eP(e){let t,n,i,r,l,f,a,_;return l=new xi({props:{$$slots:{default:[tP]},$$scope:{ctx:e}}}),l.$on("click",e[3]),{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),a.textContent="Debug route snapper",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(x,S){St(x,t,S),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),_=!0},p(x,S){const L={};S&32&&(L.$$scope={dirty:S,ctx:x}),l.$set(L)},i(x){_||(dt(l.$$.fragment,x),_=!0)},o(x){vt(l.$$.fragment,x),_=!1},d(x){x&&wt(t),qt(l)}}}function nP(e){let t,n,i;return n=new Ng({}),n.$on("click",e[2]),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","sidebar")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Me,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function iP(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function rP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[iP,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function oP(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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function sP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[oP,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function aP(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:[rP]},$$scope:{ctx:e}}}),i=new hd({props:{manageHoverState:!0,paint:{"circle-radius":10,"circle-color":"black","circle-opacity":ry(.5,1)},$$slots:{default:[sP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment),n=Wt(),Zt(i.$$.fragment)},m(l,f){jt(t,l,f),St(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||(dt(t.$$.fragment,l),dt(i.$$.fragment,l),r=!0)},o(l){vt(t.$$.fragment,l),vt(i.$$.fragment,l),r=!1},d(l){l&&wt(n),qt(t,l),qt(i,l)}}}function lP(e){let t,n,i;return n=new Ps({props:{data:JSON.parse(ci(e[0]).toRouteSnapperGj()),generateId:!0,$$slots:{default:[aP]},$$scope:{ctx:e}}}),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l&1&&(f.data=JSON.parse(ci(r[0]).toRouteSnapperGj())),l&32&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function uP(e){let t,n;return t=new Xu({props:{$$slots:{map:[lP],sidebar:[nP],top:[eP]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function cP(e,t,n){let i,r;return Ee(e,Xo,a=>n(0,i=a)),Ee(e,En,a=>n(1,r=a)),[i,r,()=>Ue(En,r={mode:"network"},r),()=>Ue(En,r={mode:"title"},r)]}class hP extends tn{constructor(t){super(),Qe(this,t,cP,uP,He,{})}}function fP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D,F,U,Y,V;return F=new pw({props:{msg:e[0]}}),{c(){t=_t("details"),n=_t("summary"),n.textContent="Save / load project",i=Wt(),r=_t("button"),r.textContent="Save to GJ",l=Wt(),f=_t("label"),a=ge(`Load edits from GJ + `),_=_t("input"),x=Wt(),S=_t("div"),L=_t("button"),L.textContent="Save to local storage",A=Wt(),P=_t("button"),P.textContent="Load from local storage",D=Wt(),Zt(F.$$.fragment),Rt(_,"type","file"),ri(S,"display","flex"),ri(S,"justify-content","space-between")},m(Z,K){St(Z,t,K),ht(t,n),ht(t,i),ht(t,r),ht(t,l),ht(t,f),ht(f,a),ht(f,_),e[7](_),ht(t,x),ht(t,S),ht(S,L),ht(S,A),ht(S,P),St(Z,D,K),jt(F,Z,K),U=!0,Y||(V=[Ge(r,"click",e[2]),Ge(_,"change",e[3]),Ge(L,"click",e[5]),Ge(P,"click",e[4])],Y=!0)},p(Z,[K]){const it={};K&1&&(it.msg=Z[0]),F.$set(it)},i(Z){U||(dt(F.$$.fragment,Z),U=!0)},o(Z){vt(F.$$.fragment,Z),U=!1},d(Z){Z&&(wt(t),wt(D)),e[7](null),qt(F,Z),Y=!1,yo(V)}}}function pP(e,t,n){let i,r,l,f;Ee(e,Xo,F=>n(9,r=F)),Ee(e,En,F=>n(10,l=F)),Ee(e,ku,F=>n(6,f=F));let a=null;function _(){yM(i,r.toSavefile())}let x;async function S(F){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 F=window.localStorage.getItem(i);F?P(F):window.alert("Nothing was saved in local storage")}catch(F){window.alert(`Couldn't load from local storage: ${F}`)}n(0,a=null)}function A(){window.localStorage.setItem(i,r.toSavefile()),window.alert("Saved")}function P(F){r.loadSavefile(JSON.parse(F)),Ue(En,l={mode:"network"},l),Xo.set(r)}function D(F){cr[F?"unshift":"push"](()=>{x=F,n(1,x)})}return e.$$.update=()=>{e.$$.dirty&64&&(i=`ltn_${f||"custom"}.geojson`)},[a,x,_,S,L,A,f,D]}class Nw extends tn{constructor(t){super(),Qe(this,t,pP,fP,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=_t("button"),n=_t("img"),r=Wt(),l=_t("br"),f=Wt(),_=ge(a),x=Wt(),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"),ri(t,"width","100%"),t.disabled=S=e[0]==e[7]},m(D,F){St(D,t,F),ht(t,n),ht(t,r),ht(t,l),ht(t,f),ht(t,_),ht(t,x),L||(A=Ge(t,"click",P),L=!0)},p(D,F){e=D,F&1&&S!==(S=e[0]==e[7])&&(t.disabled=S)},d(D){D&&wt(t),L=!1,A()}}}function dP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P=e[1][2]+"",D,F,U,Y,V,Z,K=la(e[2]),it=[];for(let ft=0;ft({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function gP(e,t,n){let i,r;Ee(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=>Ue(ly,r=x,r),a=x=>ci(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 _P extends tn{constructor(t){super(),Qe(this,t,gP,mP,He,{})}}function xb(e){let t,n;return t=new Ps({props:{data:e[0],$$slots:{default:[yP]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function yP(e){let t,n;const i=[Mr("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let r={};for(let l=0;l{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function bP(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 xP extends tn{constructor(t){super(),Qe(this,t,bP,vP,He,{map:1})}}function wP(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||(dt(i,r),t=!0)},o(r){vt(i,r),t=!1},d(r){i&&i.d(r)}}}function SP(e){let t,n;const i=[Mr("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}},{paint:{"icon-opacity":["case",["get","edited"],1,.5]}}];let r={$$slots:{default:[wP]},$$scope:{ctx:e}};for(let l=0;ln(1,r=x)),Ee(e,Lu,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 tn{constructor(t){super(),Qe(this,t,IP,EP,He,{})}}function CP(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function TP(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function LP(e){let t;return{c(){t=ge("View shortcuts")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function MP(e){let t;return{c(){t=ge("Route")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function PP(e){let t;return{c(){t=ge("Change this boundary")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function kP(e){let t;return{c(){t=ge("Debug")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function AP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D,F,U,Y,V,Z,K,it,mt,ft,gt,lt;return l=new xi({props:{$$slots:{default:[CP]},$$scope:{ctx:e}}}),l.$on("click",e[21]),_=new xi({props:{$$slots:{default:[TP]},$$scope:{ctx:e}}}),_.$on("click",e[22]),F=new xi({props:{$$slots:{default:[LP]},$$scope:{ctx:e}}}),F.$on("click",e[23]),V=new xi({props:{$$slots:{default:[MP]},$$scope:{ctx:e}}}),V.$on("click",e[24]),it=new xi({props:{$$slots:{default:[PP]},$$scope:{ctx:e}}}),it.$on("click",e[25]),gt=new xi({props:{$$slots:{default:[kP]},$$scope:{ctx:e}}}),gt.$on("click",e[26]),{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),Zt(_.$$.fragment),x=Wt(),S=_t("li"),S.textContent="Editing",L=Wt(),A=_t("nav"),P=_t("ul"),D=_t("li"),Zt(F.$$.fragment),U=Wt(),Y=_t("li"),Zt(V.$$.fragment),Z=Wt(),K=_t("li"),Zt(it.$$.fragment),mt=Wt(),ft=_t("li"),Zt(gt.$$.fragment),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top"),ri(t,"display","flex"),ri(t,"justify-content","space-between")},m(It,yt){St(It,t,yt),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),jt(_,a,null),ht(i,x),ht(i,S),ht(t,L),ht(t,A),ht(A,P),ht(P,D),jt(F,D,null),ht(P,U),ht(P,Y),jt(V,Y,null),ht(P,Z),ht(P,K),jt(it,K,null),ht(P,mt),ht(P,ft),jt(gt,ft,null),lt=!0},p(It,yt){const bt={};yt[1]&1&&(bt.$$scope={dirty:yt,ctx:It}),l.$set(bt);const ee={};yt[1]&1&&(ee.$$scope={dirty:yt,ctx:It}),_.$set(ee);const kt={};yt[1]&1&&(kt.$$scope={dirty:yt,ctx:It}),F.$set(kt);const Gt={};yt[1]&1&&(Gt.$$scope={dirty:yt,ctx:It}),V.$set(Gt);const Qt={};yt[1]&1&&(Qt.$$scope={dirty:yt,ctx:It}),it.$set(Qt);const ne={};yt[1]&1&&(ne.$$scope={dirty:yt,ctx:It}),gt.$set(ne)},i(It){lt||(dt(l.$$.fragment,It),dt(_.$$.fragment,It),dt(F.$$.fragment,It),dt(V.$$.fragment,It),dt(it.$$.fragment,It),dt(gt.$$.fragment,It),lt=!0)},o(It){vt(l.$$.fragment,It),vt(_.$$.fragment,It),vt(F.$$.fragment,It),vt(V.$$.fragment,It),vt(it.$$.fragment,It),vt(gt.$$.fragment,It),lt=!1},d(It){It&&wt(t),qt(l),qt(_),qt(F),qt(V),qt(it),qt(gt)}}}function NP(e){let t,n,i;return{c(){t=ge("Undo ("),n=ge(e[3]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l[0]&8&&Fi(n,r[3])},d(r){r&&(wt(t),wt(n),wt(i))}}}function DP(e){let t;return{c(){t=ge("Undo")},m(n,i){St(n,t,i)},p:Me,d(n){n&&wt(t)}}}function RP(e){let t,n,i;return{c(){t=ge("Redo ("),n=ge(e[4]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l[0]&16&&Fi(n,r[4])},d(r){r&&(wt(t),wt(n),wt(i))}}}function OP(e){let t;return{c(){t=ge("Redo")},m(n,i){St(n,t,i)},p:Me,d(n){n&&wt(t)}}}function wb(e){let t,n;return t=new _P({}),t.$on("close",e[20]),{c(){Zt(t.$$.fragment)},m(i,r){jt(t,i,r),n=!0},p:Me,i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function zP(e){let t,n,i,r,l=ci(ci(e[5]).properties).name+"",f,a,_,x,S,L,A,P,D,F,U,Y,V,Z,K,it,mt,ft,gt,lt,It,yt,bt,ee,kt,Gt,Qt,ne,Ie,bn,Zn,en,Be,Ve,dn,Fn,xn,oe,je;function pn(rn,un){return rn[3]==0?DP:NP}let Bn=pn(e),yi=Bn(e);function Ai(rn,un){return rn[4]==0?OP:RP}let Lt=Ai(e),ke=Lt(e),xe=e[2]&&wb(e);return Fn=new Nw({}),{c(){t=_t("div"),n=_t("p"),i=ge("Editing neighbourhood "),r=_t("u"),f=ge(l),a=Wt(),_=_t("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=Xt(),S=yt("hr"),L=Xt(),A=yt("div"),P=yt("button"),D=yt("img"),U=ge(` - Add a modal filter`),V=Xt(),Z=yt("button"),K=ge("Add many modal filters along line"),mt=Xt(),ht=yt("button"),gt=ge("Reverse directions"),It=Xt(),_t=yt("button"),_t.textContent="Change modal filter type",bt=Xt(),ee=yt("div"),kt=yt("button"),yi.c(),Qt=Xt(),ne=yt("button"),ke.c(),bn=Xt(),xe&&xe.c(),Zn=Xt(),en=yt("hr"),Be=Xt(),Ve=yt("hr"),dn=Xt(),Zt(Fn.$$.fragment),hr(D.src,B=`/ltn//filters/${e[7]}_icon.gif`)||Rt(D,"src",B),Rt(D,"width","30"),Rt(D,"alt","Add a modal filter"),P.disabled=Y=e[0]=="filter",Z.disabled=it=e[0]=="freehand-filters",ht.disabled=lt=e[0]=="oneway",ri(A,"display","flex"),ri(A,"justify-content","space-between"),kt.disabled=Gt=e[3]==0,ne.disabled=Ie=e[4]==0,ri(ee,"display","flex"),ri(ee,"justify-content","space-between"),Rt(t,"slot","sidebar")},m(rn,un){St(rn,t,un),ft(t,n),ft(n,i),ft(n,r),ft(r,f),ft(t,a),ft(t,_),ft(t,x),ft(t,S),ft(t,L),ft(t,A),ft(A,P),ft(P,D),ft(P,U),ft(A,V),ft(A,Z),ft(Z,K),ft(A,mt),ft(A,ht),ft(ht,gt),ft(t,It),ft(t,_t),ft(t,bt),ft(t,ee),ft(ee,kt),yi.m(kt,null),ft(ee,Qt),ft(ee,ne),ke.m(ne,null),ft(t,bn),xe&&xe.m(t,null),ft(t,Zn),ft(t,en),ft(t,Be),ft(t,Ve),ft(t,dn),jt(Fn,t,null),xn=!0,oe||(Ge=[Ze(P,"click",e[16]),Ze(Z,"click",e[17]),Ze(ht,"click",e[18]),Ze(_t,"click",e[19]),Ze(kt,"click",e[12]),Ze(ne,"click",e[13])],oe=!0)},p(rn,un){(!xn||un[0]&32)&&l!==(l=ci(ci(rn[5]).properties).name+"")&&Fi(f,l),(!xn||un[0]&128&&!hr(D.src,B=`/ltn//filters/${rn[7]}_icon.gif`))&&Rt(D,"src",B),(!xn||un[0]&1&&Y!==(Y=rn[0]=="filter"))&&(P.disabled=Y),(!xn||un[0]&1&&it!==(it=rn[0]=="freehand-filters"))&&(Z.disabled=it),(!xn||un[0]&1&<!==(lt=rn[0]=="oneway"))&&(ht.disabled=lt),Bn===(Bn=pn(rn))&&yi?yi.p(rn,un):(yi.d(1),yi=Bn(rn),yi&&(yi.c(),yi.m(kt,null))),(!xn||un[0]&8&&Gt!==(Gt=rn[3]==0))&&(kt.disabled=Gt),Lt===(Lt=Ai(rn))&&ke?ke.p(rn,un):(ke.d(1),ke=Lt(rn),ke&&(ke.c(),ke.m(ne,null))),(!xn||un[0]&16&&Ie!==(Ie=rn[4]==0))&&(ne.disabled=Ie),rn[2]?xe?(xe.p(rn,un),un[0]&4&&dt(xe,1)):(xe=wb(rn),xe.c(),dt(xe,1),xe.m(t,Zn)):xe&&(hi(),vt(xe,1,1,()=>{xe=null}),fi())},i(rn){xn||(dt(xe),dt(Fn.$$.fragment,rn),xn=!0)},o(rn){vt(xe),vt(Fn.$$.fragment,rn),xn=!1},d(rn){rn&&wt(t),yi.d(),ke.d(),xe&&xe.d(),qt(Fn),oe=!1,No(Ge)}}}function Sb(e){let t;return{c(){t=yt("p"),t.textContent="Click to change direction"},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function FP(e){let t,n=e[30].shortcuts+"",i,r,l=(e[30].name??"unnamed road")+"",f,a,_,x=e[0]=="oneway"&&Sb();return{c(){t=yt("p"),i=ge(n),r=ge(" shortcuts through "),f=ge(l),a=Xt(),x&&x.c(),_=Do()},m(S,L){St(S,t,L),ft(t,i),ft(t,r),ft(t,f),St(S,a,L),x&&x.m(S,L),St(S,_,L)},p(S,L){L[0]&1073741824&&n!==(n=S[30].shortcuts+"")&&Fi(i,n),L[0]&1073741824&&l!==(l=(S[30].name??"unnamed road")+"")&&Fi(f,l),S[0]=="oneway"?x||(x=Sb(),x.c(),x.m(_.parentNode,_)):x&&(x.d(1),x=null)},d(S){S&&(wt(t),wt(a),wt(_)),x&&x.d(S)}}}function BP(e){let t,n,i;return n=new wl({props:{openOn:"hover",$$slots:{default:[FP,({props:r})=>({30:r}),({props:r})=>[r?1073741824:0]]},$$scope:{ctx:e}}}),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l[0]&1073741825|l[1]&1&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function VP(e){let t;return{c(){t=ge("Click to delete")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function UP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[VP]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Eb(e){let t,n;return t=new xP({props:{map:ci(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=ci(i[1])),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function GP(e){let t,n,i,r,l,f;n=new Dg({props:{gjInput:e[6],interactive:e[0]=="oneway",onClickLine:e[9],$$slots:{"line-popup":[BP]},$$scope:{ctx:e}}}),r=new Rg({props:{$$slots:{default:[UP]},$$scope:{ctx:e}}}),r.$on("click",e[10]);let a=e[0]=="freehand-filters"&&Eb(e);return{c(){t=yt("div"),Zt(n.$$.fragment),i=Xt(),Zt(r.$$.fragment),l=Xt(),a&&a.c(),Rt(t,"slot","map")},m(_,x){St(_,t,x),jt(n,t,null),ft(t,i),jt(r,t,null),ft(t,l),a&&a.m(t,null),f=!0},p(_,x){const S={};x[0]&64&&(S.gjInput=_[6]),x[0]&1&&(S.interactive=_[0]=="oneway"),x[0]&1|x[1]&1&&(S.$$scope={dirty:x,ctx:_}),n.$set(S);const L={};x[1]&1&&(L.$$scope={dirty:x,ctx:_}),r.$set(L),_[0]=="freehand-filters"?a?(a.p(_,x),x[0]&1&&dt(a,1)):(a=Eb(_),a.c(),dt(a,1),a.m(t,null)):a&&(hi(),vt(a,1,1,()=>{a=null}),fi())},i(_){f||(dt(n.$$.fragment,_),dt(r.$$.fragment,_),dt(a),f=!0)},o(_){vt(n.$$.fragment,_),vt(r.$$.fragment,_),vt(a),f=!1},d(_){_&&wt(t),qt(n),qt(r),a&&a.d()}}}function jP(e){let t,n,i,r;return t=new Xu({props:{$$slots:{map:[GP],sidebar:[zP],top:[AP]},$$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]&511|f[1]&1&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(dt(t.$$.fragment,l),n=!0)},o(l){vt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function qP(e,t,n){let i,r,l,f,a;Ee(e,Lu,ne=>n(15,i=ne)),Ee(e,ly,ne=>n(7,r=ne)),Ee(e,Xo,ne=>n(27,l=ne)),Ee(e,Ru,ne=>n(1,f=ne)),Ee(e,En,ne=>n(8,a=ne));let _="filter",x=!1,S=0,L=0,A,P;f.on("click",B),aa(()=>{f.off("click",B),f.doubleClickZoom.enable()});function D(ne){n(6,P=JSON.parse(l.renderNeighbourhood())),n(5,A=P.features.find(Ie=>Ie.properties.kind=="boundary")),n(3,S=P.undo_length),n(4,L=P.redo_length)}function B(ne){_=="filter"&&(l.addModalFilter(ne.lngLat,r),Ue(Lu,i++,i))}function U(ne){_=="oneway"&&(l.toggleDirection(ne.properties.road),Ue(Lu,i++,i))}function Y(ne){let Ie=ne.detail.features[0];l.deleteModalFilter(Ie.properties.road),Ue(Lu,i++,i)}function V(ne){ne.target.tagName!="INPUT"&&(ne.ctrlKey&&ne.key=="z"&&Z(),ne.ctrlKey&&ne.key=="y"&&K(),ne.key=="1"&&n(0,_="filter"),ne.key=="2"&&n(0,_="freehand-filters"),ne.key=="3"&&n(0,_="oneway"))}function Z(){l.undo(),Ue(Lu,i++,i)}function K(){l.redo(),Ue(Lu,i++,i)}function it(ne){let Ie=ne.detail;Ie&&(l.addManyModalFilters(Ie,r),Ue(Lu,i++,i)),n(0,_="filter")}const mt=()=>n(0,_="filter"),ht=()=>n(0,_="freehand-filters"),gt=()=>n(0,_="oneway"),lt=()=>n(2,x=!0),It=()=>n(2,x=!1),_t=()=>Ue(En,a={mode:"title"},a),bt=()=>Ue(En,a={mode:"network"},a),ee=()=>Ue(En,a={mode:"view-shortcuts"},a),kt=()=>Ue(En,a={mode:"route",prevMode:"neighbourhood"},a),Gt=()=>Ue(En,a={mode:"set-boundary",name:ci(ci(A).properties).name,existing:A},a),Qt=()=>Ue(En,a={mode:"debug"},a);return e.$$.update=()=>{e.$$.dirty[0]&3&&(_=="oneway"?f.doubleClickZoom.disable():f.doubleClickZoom.enable()),e.$$.dirty[0]&32768&&D()},[_,f,x,S,L,A,P,r,a,U,Y,V,Z,K,it,i,mt,ht,gt,lt,It,_t,bt,ee,kt,Gt,Qt]}class ZP extends tn{constructor(t){super(),Qe(this,t,qP,jP,He,{},null,[-1,-1])}}function Ib(e,t,n){const i=e.slice();return i[14]=t[n],i}function $P(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function WP(e){let t;return{c(){t=ge("Route")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function XP(e){let t;return{c(){t=ge("Debug route snapper")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function HP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D,B,U;return l=new xi({props:{$$slots:{default:[$P]},$$scope:{ctx:e}}}),l.$on("click",e[10]),A=new xi({props:{$$slots:{default:[WP]},$$scope:{ctx:e}}}),A.$on("click",e[11]),B=new xi({props:{$$slots:{default:[XP]},$$scope:{ctx:e}}}),B.$on("click",e[12]),{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),a.textContent="Pick neighbourhood",_=Xt(),x=yt("nav"),S=yt("ul"),L=yt("li"),Zt(A.$$.fragment),P=Xt(),D=yt("li"),Zt(B.$$.fragment),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top"),ri(t,"display","flex"),ri(t,"justify-content","space-between")},m(Y,V){St(Y,t,V),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),ft(t,_),ft(t,x),ft(x,S),ft(S,L),jt(A,L,null),ft(S,P),ft(S,D),jt(B,D,null),U=!0},p(Y,V){const Z={};V&131072&&(Z.$$scope={dirty:V,ctx:Y}),l.$set(Z);const K={};V&131072&&(K.$$scope={dirty:V,ctx:Y}),A.$set(K);const it={};V&131072&&(it.$$scope={dirty:V,ctx:Y}),B.$set(it)},i(Y){U||(dt(l.$$.fragment,Y),dt(A.$$.fragment,Y),dt(B.$$.fragment,Y),U=!0)},o(Y){vt(l.$$.fragment,Y),vt(A.$$.fragment,Y),vt(B.$$.fragment,Y),U=!1},d(Y){Y&&wt(t),qt(l),qt(A),qt(B)}}}function YP(e){let t;return{c(){t=ge("Draw a new boundary")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function KP(e){let t=e[14]+"",n;return{c(){n=ge(t)},m(i,r){St(i,n,r)},p(i,r){r&2&&t!==(t=i[14]+"")&&Fi(n,t)},d(i){i&&wt(n)}}}function Cb(e){let t,n,i,r,l,f,a,_,x;function S(){return e[8](e[14])}i=new xi({props:{$$slots:{default:[KP]},$$scope:{ctx:e}}}),i.$on("click",S);function L(){return e[9](e[14])}return{c(){t=yt("li"),n=yt("span"),Zt(i.$$.fragment),r=Xt(),l=yt("button"),l.textContent="X",f=Xt(),Rt(l,"class","secondary outline"),ri(n,"display","flex"),ri(n,"justify-content","space-between")},m(A,P){St(A,t,P),ft(t,n),jt(i,n,null),ft(n,r),ft(n,l),ft(t,f),a=!0,_||(x=Ze(l,"click",L),_=!0)},p(A,P){e=A;const D={};P&131074&&(D.$$scope={dirty:P,ctx:e}),i.$set(D)},i(A){a||(dt(i.$$.fragment,A),a=!0)},o(A){vt(i.$$.fragment,A),a=!1},d(A){A&&wt(t),qt(i),_=!1,x()}}}function JP(e){let t,n,i,r,l,f,a,_,x,S,L;r=new xi({props:{$$slots:{default:[YP]},$$scope:{ctx:e}}}),r.$on("click",e[5]);let A=la(e[1]),P=[];for(let B=0;Bvt(P[B],1,1,()=>{P[B]=null});return S=new Nw({}),{c(){t=yt("div"),n=yt("p"),n.textContent=`Inside the neighbourhood you define, the goal is to eliminate (or + what's reachable for drivers without leaving the boundary you've drawn.`,x=Wt(),S=_t("hr"),L=Wt(),A=_t("div"),P=_t("button"),D=_t("img"),U=ge(` + Add a modal filter`),V=Wt(),Z=_t("button"),K=ge("Add many modal filters along line"),mt=Wt(),ft=_t("button"),gt=ge("Reverse directions"),It=Wt(),yt=_t("button"),yt.textContent="Change modal filter type",bt=Wt(),ee=_t("div"),kt=_t("button"),yi.c(),Qt=Wt(),ne=_t("button"),ke.c(),bn=Wt(),xe&&xe.c(),Zn=Wt(),en=_t("hr"),Be=Wt(),Ve=_t("hr"),dn=Wt(),Zt(Fn.$$.fragment),hr(D.src,F=`/ltn//filters/${e[7]}_icon.gif`)||Rt(D,"src",F),Rt(D,"width","30"),Rt(D,"alt","Add a modal filter"),P.disabled=Y=e[0]=="filter",Z.disabled=it=e[0]=="freehand-filters",ft.disabled=lt=e[0]=="oneway",ri(A,"display","flex"),ri(A,"justify-content","space-between"),kt.disabled=Gt=e[3]==0,ne.disabled=Ie=e[4]==0,ri(ee,"display","flex"),ri(ee,"justify-content","space-between"),Rt(t,"slot","sidebar")},m(rn,un){St(rn,t,un),ht(t,n),ht(n,i),ht(n,r),ht(r,f),ht(t,a),ht(t,_),ht(t,x),ht(t,S),ht(t,L),ht(t,A),ht(A,P),ht(P,D),ht(P,U),ht(A,V),ht(A,Z),ht(Z,K),ht(A,mt),ht(A,ft),ht(ft,gt),ht(t,It),ht(t,yt),ht(t,bt),ht(t,ee),ht(ee,kt),yi.m(kt,null),ht(ee,Qt),ht(ee,ne),ke.m(ne,null),ht(t,bn),xe&&xe.m(t,null),ht(t,Zn),ht(t,en),ht(t,Be),ht(t,Ve),ht(t,dn),jt(Fn,t,null),xn=!0,oe||(je=[Ge(P,"click",e[16]),Ge(Z,"click",e[17]),Ge(ft,"click",e[18]),Ge(yt,"click",e[19]),Ge(kt,"click",e[12]),Ge(ne,"click",e[13])],oe=!0)},p(rn,un){(!xn||un[0]&32)&&l!==(l=ci(ci(rn[5]).properties).name+"")&&Fi(f,l),(!xn||un[0]&128&&!hr(D.src,F=`/ltn//filters/${rn[7]}_icon.gif`))&&Rt(D,"src",F),(!xn||un[0]&1&&Y!==(Y=rn[0]=="filter"))&&(P.disabled=Y),(!xn||un[0]&1&&it!==(it=rn[0]=="freehand-filters"))&&(Z.disabled=it),(!xn||un[0]&1&<!==(lt=rn[0]=="oneway"))&&(ft.disabled=lt),Bn===(Bn=pn(rn))&&yi?yi.p(rn,un):(yi.d(1),yi=Bn(rn),yi&&(yi.c(),yi.m(kt,null))),(!xn||un[0]&8&&Gt!==(Gt=rn[3]==0))&&(kt.disabled=Gt),Lt===(Lt=Ai(rn))&&ke?ke.p(rn,un):(ke.d(1),ke=Lt(rn),ke&&(ke.c(),ke.m(ne,null))),(!xn||un[0]&16&&Ie!==(Ie=rn[4]==0))&&(ne.disabled=Ie),rn[2]?xe?(xe.p(rn,un),un[0]&4&&dt(xe,1)):(xe=wb(rn),xe.c(),dt(xe,1),xe.m(t,Zn)):xe&&(hi(),vt(xe,1,1,()=>{xe=null}),fi())},i(rn){xn||(dt(xe),dt(Fn.$$.fragment,rn),xn=!0)},o(rn){vt(xe),vt(Fn.$$.fragment,rn),xn=!1},d(rn){rn&&wt(t),yi.d(),ke.d(),xe&&xe.d(),qt(Fn),oe=!1,yo(je)}}}function Sb(e){let t;return{c(){t=_t("p"),t.textContent="Click to change direction"},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function FP(e){let t,n=e[30].shortcuts+"",i,r,l=(e[30].name??"unnamed road")+"",f,a,_,x=e[0]=="oneway"&&Sb();return{c(){t=_t("p"),i=ge(n),r=ge(" shortcuts through "),f=ge(l),a=Wt(),x&&x.c(),_=Do()},m(S,L){St(S,t,L),ht(t,i),ht(t,r),ht(t,f),St(S,a,L),x&&x.m(S,L),St(S,_,L)},p(S,L){L[0]&1073741824&&n!==(n=S[30].shortcuts+"")&&Fi(i,n),L[0]&1073741824&&l!==(l=(S[30].name??"unnamed road")+"")&&Fi(f,l),S[0]=="oneway"?x||(x=Sb(),x.c(),x.m(_.parentNode,_)):x&&(x.d(1),x=null)},d(S){S&&(wt(t),wt(a),wt(_)),x&&x.d(S)}}}function BP(e){let t,n,i;return n=new wl({props:{openOn:"hover",$$slots:{default:[FP,({props:r})=>({30:r}),({props:r})=>[r?1073741824:0]]},$$scope:{ctx:e}}}),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p(r,l){const f={};l[0]&1073741825|l[1]&1&&(f.$$scope={dirty:l,ctx:r}),n.$set(f)},i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function VP(e){let t;return{c(){t=ge("Click to delete")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function UP(e){let t,n;return t=new wl({props:{openOn:"hover",$$slots:{default:[VP]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Eb(e){let t,n;return t=new xP({props:{map:ci(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=ci(i[1])),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function GP(e){let t,n,i,r,l,f;n=new Dg({props:{gjInput:e[6],interactive:e[0]=="oneway",onClickLine:e[9],$$slots:{"line-popup":[BP]},$$scope:{ctx:e}}}),r=new Rg({props:{$$slots:{default:[UP]},$$scope:{ctx:e}}}),r.$on("click",e[10]);let a=e[0]=="freehand-filters"&&Eb(e);return{c(){t=_t("div"),Zt(n.$$.fragment),i=Wt(),Zt(r.$$.fragment),l=Wt(),a&&a.c(),Rt(t,"slot","map")},m(_,x){St(_,t,x),jt(n,t,null),ht(t,i),jt(r,t,null),ht(t,l),a&&a.m(t,null),f=!0},p(_,x){const S={};x[0]&64&&(S.gjInput=_[6]),x[0]&1&&(S.interactive=_[0]=="oneway"),x[0]&1|x[1]&1&&(S.$$scope={dirty:x,ctx:_}),n.$set(S);const L={};x[1]&1&&(L.$$scope={dirty:x,ctx:_}),r.$set(L),_[0]=="freehand-filters"?a?(a.p(_,x),x[0]&1&&dt(a,1)):(a=Eb(_),a.c(),dt(a,1),a.m(t,null)):a&&(hi(),vt(a,1,1,()=>{a=null}),fi())},i(_){f||(dt(n.$$.fragment,_),dt(r.$$.fragment,_),dt(a),f=!0)},o(_){vt(n.$$.fragment,_),vt(r.$$.fragment,_),vt(a),f=!1},d(_){_&&wt(t),qt(n),qt(r),a&&a.d()}}}function jP(e){let t,n,i,r;return t=new Xu({props:{$$slots:{map:[GP],sidebar:[zP],top:[AP]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ge(window,"keydown",e[11]),i=!0)},p(l,f){const a={};f[0]&511|f[1]&1&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(dt(t.$$.fragment,l),n=!0)},o(l){vt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function qP(e,t,n){let i,r,l,f,a;Ee(e,Lu,ne=>n(15,i=ne)),Ee(e,ly,ne=>n(7,r=ne)),Ee(e,Xo,ne=>n(27,l=ne)),Ee(e,Ru,ne=>n(1,f=ne)),Ee(e,En,ne=>n(8,a=ne));let _="filter",x=!1,S=0,L=0,A,P;f.on("click",F),aa(()=>{f.off("click",F),f.doubleClickZoom.enable()});function D(ne){n(6,P=JSON.parse(l.renderNeighbourhood())),n(5,A=P.features.find(Ie=>Ie.properties.kind=="boundary")),n(3,S=P.undo_length),n(4,L=P.redo_length)}function F(ne){_=="filter"&&(l.addModalFilter(ne.lngLat,r),Ue(Lu,i++,i))}function U(ne){_=="oneway"&&(l.toggleDirection(ne.properties.road),Ue(Lu,i++,i))}function Y(ne){let Ie=ne.detail.features[0];l.deleteModalFilter(Ie.properties.road),Ue(Lu,i++,i)}function V(ne){ne.target.tagName!="INPUT"&&(ne.ctrlKey&&ne.key=="z"&&Z(),ne.ctrlKey&&ne.key=="y"&&K(),ne.key=="1"&&n(0,_="filter"),ne.key=="2"&&n(0,_="freehand-filters"),ne.key=="3"&&n(0,_="oneway"))}function Z(){l.undo(),Ue(Lu,i++,i)}function K(){l.redo(),Ue(Lu,i++,i)}function it(ne){let Ie=ne.detail;Ie&&(l.addManyModalFilters(Ie,r),Ue(Lu,i++,i)),n(0,_="filter")}const mt=()=>n(0,_="filter"),ft=()=>n(0,_="freehand-filters"),gt=()=>n(0,_="oneway"),lt=()=>n(2,x=!0),It=()=>n(2,x=!1),yt=()=>Ue(En,a={mode:"title"},a),bt=()=>Ue(En,a={mode:"network"},a),ee=()=>Ue(En,a={mode:"view-shortcuts"},a),kt=()=>Ue(En,a={mode:"route",prevMode:"neighbourhood"},a),Gt=()=>Ue(En,a={mode:"set-boundary",name:ci(ci(A).properties).name,existing:A},a),Qt=()=>Ue(En,a={mode:"debug"},a);return e.$$.update=()=>{e.$$.dirty[0]&3&&(_=="oneway"?f.doubleClickZoom.disable():f.doubleClickZoom.enable()),e.$$.dirty[0]&32768&&D()},[_,f,x,S,L,A,P,r,a,U,Y,V,Z,K,it,i,mt,ft,gt,lt,It,yt,bt,ee,kt,Gt,Qt]}class ZP extends tn{constructor(t){super(),Qe(this,t,qP,jP,He,{},null,[-1,-1])}}function Ib(e,t,n){const i=e.slice();return i[14]=t[n],i}function $P(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function WP(e){let t;return{c(){t=ge("Route")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function XP(e){let t;return{c(){t=ge("Debug route snapper")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function HP(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D,F,U;return l=new xi({props:{$$slots:{default:[$P]},$$scope:{ctx:e}}}),l.$on("click",e[10]),A=new xi({props:{$$slots:{default:[WP]},$$scope:{ctx:e}}}),A.$on("click",e[11]),F=new xi({props:{$$slots:{default:[XP]},$$scope:{ctx:e}}}),F.$on("click",e[12]),{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),a.textContent="Pick neighbourhood",_=Wt(),x=_t("nav"),S=_t("ul"),L=_t("li"),Zt(A.$$.fragment),P=Wt(),D=_t("li"),Zt(F.$$.fragment),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top"),ri(t,"display","flex"),ri(t,"justify-content","space-between")},m(Y,V){St(Y,t,V),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),ht(t,_),ht(t,x),ht(x,S),ht(S,L),jt(A,L,null),ht(S,P),ht(S,D),jt(F,D,null),U=!0},p(Y,V){const Z={};V&131072&&(Z.$$scope={dirty:V,ctx:Y}),l.$set(Z);const K={};V&131072&&(K.$$scope={dirty:V,ctx:Y}),A.$set(K);const it={};V&131072&&(it.$$scope={dirty:V,ctx:Y}),F.$set(it)},i(Y){U||(dt(l.$$.fragment,Y),dt(A.$$.fragment,Y),dt(F.$$.fragment,Y),U=!0)},o(Y){vt(l.$$.fragment,Y),vt(A.$$.fragment,Y),vt(F.$$.fragment,Y),U=!1},d(Y){Y&&wt(t),qt(l),qt(A),qt(F)}}}function YP(e){let t;return{c(){t=ge("Draw a new boundary")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function KP(e){let t=e[14]+"",n;return{c(){n=ge(t)},m(i,r){St(i,n,r)},p(i,r){r&2&&t!==(t=i[14]+"")&&Fi(n,t)},d(i){i&&wt(n)}}}function Cb(e){let t,n,i,r,l,f,a,_,x;function S(){return e[8](e[14])}i=new xi({props:{$$slots:{default:[KP]},$$scope:{ctx:e}}}),i.$on("click",S);function L(){return e[9](e[14])}return{c(){t=_t("li"),n=_t("span"),Zt(i.$$.fragment),r=Wt(),l=_t("button"),l.textContent="X",f=Wt(),Rt(l,"class","secondary outline"),ri(n,"display","flex"),ri(n,"justify-content","space-between")},m(A,P){St(A,t,P),ht(t,n),jt(i,n,null),ht(n,r),ht(n,l),ht(t,f),a=!0,_||(x=Ge(l,"click",L),_=!0)},p(A,P){e=A;const D={};P&131074&&(D.$$scope={dirty:P,ctx:e}),i.$set(D)},i(A){a||(dt(i.$$.fragment,A),a=!0)},o(A){vt(i.$$.fragment,A),a=!1},d(A){A&&wt(t),qt(i),_=!1,x()}}}function JP(e){let t,n,i,r,l,f,a,_,x,S,L;r=new xi({props:{$$slots:{default:[YP]},$$scope:{ctx:e}}}),r.$on("click",e[5]);let A=la(e[1]),P=[];for(let F=0;Fvt(P[F],1,1,()=>{P[F]=null});return S=new Nw({}),{c(){t=_t("div"),n=_t("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=Xt(),Zt(r.$$.fragment),l=Xt(),f=yt("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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function ek(e){let t,n;const i=[Mr("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":ry(.3,.5)}},{manageHoverState:!0},{hoverCursor:"pointer"}];let r={$$slots:{default:[tk]},$$scope:{ctx:e}};for(let l=0;ln(2,l=U)),Ee(e,Xo,U=>n(6,f=U));function a(U){f.setCurrentNeighbourhood(U),Ue(En,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&&Ue(En,l={mode:"set-boundary",name:U,existing:null},l)}const S=U=>a(ci(U.detail.features[0].properties).name),L=U=>a(U),A=U=>_(U),P=()=>Ue(En,l={mode:"title"},l),D=()=>Ue(En,l={mode:"route",prevMode:"network"},l),B=()=>Ue(En,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,D,B]}class ok extends tn{constructor(t){super(),Qe(this,t,rk,ik,He,{})}}function sk(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function ak(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Tb(e){let t,n,i;return n=new xi({props:{$$slots:{default:[lk]},$$scope:{ctx:e}}}),n.$on("click",e[11]),{c(){t=yt("li"),Zt(n.$$.fragment)},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function lk(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function uk(e){let t,n,i,r,l,f,a,_,x,S,L,A;l=new xi({props:{$$slots:{default:[sk]},$$scope:{ctx:e}}}),l.$on("click",e[9]),_=new xi({props:{$$slots:{default:[ak]},$$scope:{ctx:e}}}),_.$on("click",e[10]);let P=e[0]=="neighbourhood"&&Tb(e);return{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),Zt(_.$$.fragment),x=Xt(),P&&P.c(),S=Xt(),L=yt("li"),L.textContent="Routing",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(D,B){St(D,t,B),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),jt(_,a,null),ft(i,x),P&&P.m(i,null),ft(i,S),ft(i,L),A=!0},p(D,B){const U={};B&4096&&(U.$$scope={dirty:B,ctx:D}),l.$set(U);const Y={};B&4096&&(Y.$$scope={dirty:B,ctx:D}),_.$set(Y),D[0]=="neighbourhood"?P?(P.p(D,B),B&1&&dt(P,1)):(P=Tb(D),P.c(),dt(P,1),P.m(i,S)):P&&(hi(),vt(P,1,1,()=>{P=null}),fi())},i(D){A||(dt(l.$$.fragment,D),dt(_.$$.fragment,D),dt(P),A=!0)},o(D){vt(l.$$.fragment,D),vt(_.$$.fragment,D),vt(P),A=!1},d(D){D&&wt(t),qt(l),qt(_),P&&P.d()}}}function ck(e){let t,n,i,r,l,f,a;return n=new Ng({}),n.$on("click",e[6]),{c(){t=yt("div"),Zt(n.$$.fragment),i=Xt(),r=yt("p"),r.textContent="Drag markers for a route",l=Xt(),f=yt("p"),f.innerHTML=`Route before + boundary may not match the conventional definition of "neighbourhood."`,i=Wt(),Zt(r.$$.fragment),l=Wt(),f=_t("ul");for(let F=0;F({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function ek(e){let t,n;const i=[Mr("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":ry(.3,.5)}},{manageHoverState:!0},{hoverCursor:"pointer"}];let r={$$slots:{default:[tk]},$$scope:{ctx:e}};for(let l=0;ln(2,l=U)),Ee(e,Xo,U=>n(6,f=U));function a(U){f.setCurrentNeighbourhood(U),Ue(En,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&&Ue(En,l={mode:"set-boundary",name:U,existing:null},l)}const S=U=>a(ci(U.detail.features[0].properties).name),L=U=>a(U),A=U=>_(U),P=()=>Ue(En,l={mode:"title"},l),D=()=>Ue(En,l={mode:"route",prevMode:"network"},l),F=()=>Ue(En,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,D,F]}class ok extends tn{constructor(t){super(),Qe(this,t,rk,ik,He,{})}}function sk(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function ak(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Tb(e){let t,n,i;return n=new xi({props:{$$slots:{default:[lk]},$$scope:{ctx:e}}}),n.$on("click",e[11]),{c(){t=_t("li"),Zt(n.$$.fragment)},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function lk(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function uk(e){let t,n,i,r,l,f,a,_,x,S,L,A;l=new xi({props:{$$slots:{default:[sk]},$$scope:{ctx:e}}}),l.$on("click",e[9]),_=new xi({props:{$$slots:{default:[ak]},$$scope:{ctx:e}}}),_.$on("click",e[10]);let P=e[0]=="neighbourhood"&&Tb(e);return{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),Zt(_.$$.fragment),x=Wt(),P&&P.c(),S=Wt(),L=_t("li"),L.textContent="Routing",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(D,F){St(D,t,F),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),jt(_,a,null),ht(i,x),P&&P.m(i,null),ht(i,S),ht(i,L),A=!0},p(D,F){const U={};F&4096&&(U.$$scope={dirty:F,ctx:D}),l.$set(U);const Y={};F&4096&&(Y.$$scope={dirty:F,ctx:D}),_.$set(Y),D[0]=="neighbourhood"?P?(P.p(D,F),F&1&&dt(P,1)):(P=Tb(D),P.c(),dt(P,1),P.m(i,S)):P&&(hi(),vt(P,1,1,()=>{P=null}),fi())},i(D){A||(dt(l.$$.fragment,D),dt(_.$$.fragment,D),dt(P),A=!0)},o(D){vt(l.$$.fragment,D),vt(_.$$.fragment,D),vt(P),A=!1},d(D){D&&wt(t),qt(l),qt(_),P&&P.d()}}}function ck(e){let t,n,i,r,l,f,a;return n=new Ng({}),n.$on("click",e[6]),{c(){t=_t("div"),Zt(n.$$.fragment),i=Wt(),r=_t("p"),r.textContent="Drag markers for a route",l=Wt(),f=_t("p"),f.innerHTML=`Route before , - route after`,Rt(t,"slot","sidebar")},m(_,x){St(_,t,x),jt(n,t,null),ft(t,i),ft(t,r),ft(t,l),ft(t,f),a=!0},p:Ce,i(_){a||(dt(n.$$.fragment,_),a=!0)},o(_){vt(n.$$.fragment,_),a=!1},d(_){_&&wt(t),qt(n)}}}function Lb(e){let t,n;return t=new Dg({props:{gjInput:JSON.parse(ci(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(ci(i[3]).renderNeighbourhood())),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function hk(e){let t,n;const i=[Mr("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",D));function U(V){e[8](V)}let Y={draggable:!0,$$slots:{default:[pk]},$$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=yt("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,Z){St(V,t,Z),P&&P.m(t,null),ft(t,n),jt(i,t,null),ft(t,r),jt(l,t,null),ft(t,f),jt(a,t,null),ft(t,x),jt(S,t,null),A=!0},p(V,Z){V[0]=="neighbourhood"?P?(P.p(V,Z),Z&1&&dt(P,1)):(P=Lb(V),P.c(),dt(P,1),P.m(t,n)):P&&(hi(),vt(P,1,1,()=>{P=null}),fi());const K={};Z&16&&(K.data=V[4]),Z&4096&&(K.$$scope={dirty:Z,ctx:V}),l.$set(K);const it={};Z&4096&&(it.$$scope={dirty:Z,ctx:V}),!_&&Z&4&&(_=!0,it.lngLat=V[2],yc(()=>_=!1)),a.$set(it);const mt={};Z&4096&&(mt.$$scope={dirty:Z,ctx:V}),!L&&Z&2&&(L=!0,mt.lngLat=V[1],yc(()=>L=!1)),S.$set(mt)},i(V){A||(dt(P),dt(i.$$.fragment,V),dt(l.$$.fragment,V),dt(a.$$.fragment,V),dt(S.$$.fragment,V),A=!0)},o(V){vt(P),vt(i.$$.fragment,V),vt(l.$$.fragment,V),vt(a.$$.fragment,V),vt(S.$$.fragment,V),A=!1},d(V){V&&wt(t),P&&P.d(),qt(i),qt(l),qt(a),qt(S)}}}function mk(e){let t,n;return t=new Xu({props:{$$slots:{map:[dk],sidebar:[ck],top:[uk]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function gk(e,t,n){let i,r,l,f,a;Ee(e,En,B=>n(5,r=B)),Ee(e,Km,B=>n(1,l=B)),Ee(e,Ym,B=>n(2,f=B)),Ee(e,Xo,B=>n(3,a=B));let{prevMode:_}=t;function x(){Ue(En,r={mode:_},r)}function S(B){f=B,Ym.set(f)}function L(B){l=B,Km.set(l)}const A=()=>Ue(En,r={mode:"title"},r),P=()=>Ue(En,r={mode:"network"},r),D=()=>Ue(En,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,D]}class _k extends tn{constructor(t){super(),Qe(this,t,gk,mk,He,{prevMode:0})}}const yk="/ltn/assets/settings-342fb430.svg";function Mb(e){let t,n;return t=new Ky({props:{$$slots:{default:[vk]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function vk(e){let t,n,i,r,l,f,a,_,x;return i=new bI({}),{c(){t=yt("h1"),t.textContent="Settings",n=Xt(),Zt(i.$$.fragment),r=Xt(),l=yt("center"),f=yt("button"),f.textContent="Confirm"},m(S,L){St(S,t,L),St(S,n,L),jt(i,S,L),St(S,r,L),St(S,l,L),ft(l,f),a=!0,_||(x=Ze(f,"click",e[2]),_=!0)},p:Ce,i(S){a||(dt(i.$$.fragment,S),a=!0)},o(S){vt(i.$$.fragment,S),a=!1},d(S){S&&(wt(t),wt(n),wt(r),wt(l)),qt(i,S),_=!1,x()}}}function bk(e){let t,n,i,r,l,f,a=e[0]&&Mb(e);return{c(){t=yt("button"),t.innerHTML=`Settings`,n=Xt(),a&&a.c(),i=Do(),Rt(t,"class","outline")},m(_,x){St(_,t,x),St(_,n,x),a&&a.m(_,x),St(_,i,x),r=!0,l||(f=Ze(t,"click",e[1]),l=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&dt(a,1)):(a=Mb(_),a.c(),dt(a,1),a.m(i.parentNode,i)):a&&(hi(),vt(a,1,1,()=>{a=null}),fi())},i(_){r||(dt(a),r=!0)},o(_){vt(a),r=!1},d(_){_&&(wt(t),wt(n),wt(i)),a&&a.d(_),l=!1,f()}}}function xk(e,t,n){let i=!1;return[i,()=>n(0,i=!0),()=>n(0,i=!1),()=>n(0,i=!1)]}class wk extends tn{constructor(t){super(),Qe(this,t,xk,bk,He,{})}}function Sk(e){let t,n,i,r,l,f;const a=[Mr("route-points"),{filter:Pw},{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 Ck extends tn{constructor(t){super(),Qe(this,t,Ik,Ek,He,{})}}function Tk(e){let t,n,i;return{c(){t=ge("Undo ("),n=ge(e[1]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l&2&&Fi(n,r[1])},d(r){r&&(wt(t),wt(n),wt(i))}}}function Lk(e){let t;return{c(){t=ge("Undo")},m(n,i){St(n,t,i)},p:Ce,d(n){n&&wt(t)}}}function Mk(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?Lk:Tk}let _=a(e),x=_(e);return{c(){t=yt("button"),x.c(),i=Xt(),r=yt("ul"),r.innerHTML=`
  • Click + route after`,Rt(t,"slot","sidebar")},m(_,x){St(_,t,x),jt(n,t,null),ht(t,i),ht(t,r),ht(t,l),ht(t,f),a=!0},p:Me,i(_){a||(dt(n.$$.fragment,_),a=!0)},o(_){vt(n.$$.fragment,_),a=!1},d(_){_&&wt(t),qt(n)}}}function Lb(e){let t,n;return t=new Dg({props:{gjInput:JSON.parse(ci(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(ci(i[3]).renderNeighbourhood())),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function hk(e){let t,n;const i=[Mr("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",D));function U(V){e[8](V)}let Y={draggable:!0,$$slots:{default:[pk]},$$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=_t("div"),P&&P.c(),n=Wt(),Zt(i.$$.fragment),r=Wt(),Zt(l.$$.fragment),f=Wt(),Zt(a.$$.fragment),x=Wt(),Zt(S.$$.fragment),Rt(t,"slot","map")},m(V,Z){St(V,t,Z),P&&P.m(t,null),ht(t,n),jt(i,t,null),ht(t,r),jt(l,t,null),ht(t,f),jt(a,t,null),ht(t,x),jt(S,t,null),A=!0},p(V,Z){V[0]=="neighbourhood"?P?(P.p(V,Z),Z&1&&dt(P,1)):(P=Lb(V),P.c(),dt(P,1),P.m(t,n)):P&&(hi(),vt(P,1,1,()=>{P=null}),fi());const K={};Z&16&&(K.data=V[4]),Z&4096&&(K.$$scope={dirty:Z,ctx:V}),l.$set(K);const it={};Z&4096&&(it.$$scope={dirty:Z,ctx:V}),!_&&Z&4&&(_=!0,it.lngLat=V[2],yc(()=>_=!1)),a.$set(it);const mt={};Z&4096&&(mt.$$scope={dirty:Z,ctx:V}),!L&&Z&2&&(L=!0,mt.lngLat=V[1],yc(()=>L=!1)),S.$set(mt)},i(V){A||(dt(P),dt(i.$$.fragment,V),dt(l.$$.fragment,V),dt(a.$$.fragment,V),dt(S.$$.fragment,V),A=!0)},o(V){vt(P),vt(i.$$.fragment,V),vt(l.$$.fragment,V),vt(a.$$.fragment,V),vt(S.$$.fragment,V),A=!1},d(V){V&&wt(t),P&&P.d(),qt(i),qt(l),qt(a),qt(S)}}}function mk(e){let t,n;return t=new Xu({props:{$$slots:{map:[dk],sidebar:[ck],top:[uk]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function gk(e,t,n){let i,r,l,f,a;Ee(e,En,F=>n(5,r=F)),Ee(e,Km,F=>n(1,l=F)),Ee(e,Ym,F=>n(2,f=F)),Ee(e,Xo,F=>n(3,a=F));let{prevMode:_}=t;function x(){Ue(En,r={mode:_},r)}function S(F){f=F,Ym.set(f)}function L(F){l=F,Km.set(l)}const A=()=>Ue(En,r={mode:"title"},r),P=()=>Ue(En,r={mode:"network"},r),D=()=>Ue(En,r={mode:"neighbourhood"},r);return e.$$set=F=>{"prevMode"in F&&n(0,_=F.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,D]}class _k extends tn{constructor(t){super(),Qe(this,t,gk,mk,He,{prevMode:0})}}const yk="/ltn/assets/settings-342fb430.svg";function Mb(e){let t,n;return t=new Ky({props:{$$slots:{default:[vk]},$$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&67&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function vk(e){let t,n,i,r,l,f,a,_,x,S,L,A,P;return i=new bI({}),{c(){t=_t("h1"),t.textContent="Settings",n=Wt(),Zt(i.$$.fragment),r=Wt(),l=_t("label"),f=_t("input"),a=ge(` + Light mode`),_=Wt(),x=_t("center"),S=_t("button"),S.textContent="Confirm",Rt(f,"type","checkbox"),Rt(f,"role","switch")},m(D,F){St(D,t,F),St(D,n,F),jt(i,D,F),St(D,r,F),St(D,l,F),ht(l,f),f.checked=e[0],ht(l,a),St(D,_,F),St(D,x,F),ht(x,S),L=!0,A||(P=[Ge(f,"change",e[3]),Ge(S,"click",e[4])],A=!0)},p(D,F){F&1&&(f.checked=D[0])},i(D){L||(dt(i.$$.fragment,D),L=!0)},o(D){vt(i.$$.fragment,D),L=!1},d(D){D&&(wt(t),wt(n),wt(r),wt(l),wt(_),wt(x)),qt(i,D),A=!1,yo(P)}}}function bk(e){let t,n,i,r,l,f,a=e[1]&&Mb(e);return{c(){t=_t("button"),t.innerHTML=`Settings`,n=Wt(),a&&a.c(),i=Do(),Rt(t,"class","outline")},m(_,x){St(_,t,x),St(_,n,x),a&&a.m(_,x),St(_,i,x),r=!0,l||(f=Ge(t,"click",e[2]),l=!0)},p(_,[x]){_[1]?a?(a.p(_,x),x&2&&dt(a,1)):(a=Mb(_),a.c(),dt(a,1),a.m(i.parentNode,i)):a&&(hi(),vt(a,1,1,()=>{a=null}),fi())},i(_){r||(dt(a),r=!0)},o(_){vt(a),r=!1},d(_){_&&(wt(t),wt(n),wt(i)),a&&a.d(_),l=!1,f()}}}function xk(e,t,n){let i=!1,r=!window.matchMedia("(prefers-color-scheme: dark)").matches;const l=()=>n(1,i=!0);function f(){r=this.checked,n(0,r)}const a=()=>n(1,i=!1),_=()=>n(1,i=!1);return e.$$.update=()=>{e.$$.dirty&1&&document.documentElement.setAttribute("data-theme",r?"light":"dark")},[r,i,l,f,a,_]}class wk extends tn{constructor(t){super(),Qe(this,t,xk,bk,He,{})}}function Sk(e){let t,n,i,r,l,f;const a=[Mr("route-points"),{filter:Pw},{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 Ck extends tn{constructor(t){super(),Qe(this,t,Ik,Ek,He,{})}}function Tk(e){let t,n,i;return{c(){t=ge("Undo ("),n=ge(e[1]),i=ge(")")},m(r,l){St(r,t,l),St(r,n,l),St(r,i,l)},p(r,l){l&2&&Fi(n,r[1])},d(r){r&&(wt(t),wt(n),wt(i))}}}function Lk(e){let t;return{c(){t=ge("Undo")},m(n,i){St(n,t,i)},p:Me,d(n){n&&wt(t)}}}function Mk(e){let t,n,i,r,l,f;function a(S,L){return S[1]==0?Lk:Tk}let _=a(e),x=_(e);return{c(){t=_t("button"),x.c(),i=Wt(),r=_t("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,22 +635,22 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,t.disabled=n=e[1]==0},m(S,L){St(S,t,L),x.m(t,null),St(S,i,L),St(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:Ce,o:Ce,d(S){S&&(wt(t),wt(i),wt(r)),x.d(),l=!1,f()}}}function Pk(e,t,n){let i;Ee(e,cx,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 kk extends tn{constructor(t){super(),Qe(this,t,Pk,Mk,He,{route_tool:0})}}function Ak(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Nk(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Dk(e){let t;return{c(){t=yt("li"),t.textContent="Creating new neighbourhood boundary"},m(n,i){St(n,t,i)},p:Ce,i:Ce,o:Ce,d(n){n&&wt(t)}}}function Rk(e){let t,n,i,r,l;return n=new xi({props:{$$slots:{default:[Ok]},$$scope:{ctx:e}}}),n.$on("click",e[8]),{c(){t=yt("li"),Zt(n.$$.fragment),i=Xt(),r=yt("li"),r.textContent="Changing neighbourhood boundary"},m(f,a){St(f,t,a),jt(n,t,null),St(f,i,a),St(f,r,a),l=!0},p(f,a){const _={};a&1024&&(_.$$scope={dirty:a,ctx:f}),n.$set(_)},i(f){l||(dt(n.$$.fragment,f),l=!0)},o(f){vt(n.$$.fragment,f),l=!1},d(f){f&&(wt(t),wt(i),wt(r)),qt(n)}}}function Ok(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function zk(e){let t,n,i,r,l,f,a,_,x,S,L,A;l=new xi({props:{$$slots:{default:[Ak]},$$scope:{ctx:e}}}),l.$on("click",e[6]),_=new xi({props:{$$slots:{default:[Nk]},$$scope:{ctx:e}}}),_.$on("click",e[7]);const P=[Rk,Dk],D=[];function B(U,Y){return U[1]?0:1}return S=B(e),L=D[S]=P[S](e),{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),Zt(_.$$.fragment),x=Xt(),L.c(),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(U,Y){St(U,t,Y),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),jt(_,a,null),ft(i,x),D[S].m(i,null),A=!0},p(U,Y){const V={};Y&1024&&(V.$$scope={dirty:Y,ctx:U}),l.$set(V);const Z={};Y&1024&&(Z.$$scope={dirty:Y,ctx:U}),_.$set(Z);let K=S;S=B(U),S===K?D[S].p(U,Y):(hi(),vt(D[K],1,1,()=>{D[K]=null}),fi(),L=D[S],L?L.p(U,Y):(L=D[S]=P[S](U),L.c()),dt(L,1),L.m(i,null))},i(U){A||(dt(l.$$.fragment,U),dt(_.$$.fragment,U),dt(L),A=!0)},o(U){vt(l.$$.fragment,U),vt(_.$$.fragment,U),vt(L),A=!1},d(U){U&&wt(t),qt(l),qt(_),D[S].d()}}}function Fk(e){let t;return{c(){t=ge("Finish")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Bk(e){let t;return{c(){t=ge("Cancel")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Vk(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;return a=new xi({props:{$$slots:{default:[Fk]},$$scope:{ctx:e}}}),a.$on("click",e[5]),x=new xi({props:{$$slots:{default:[Bk]},$$scope:{ctx:e}}}),x.$on("click",e[4]),P=new kk({props:{route_tool:ci(e[2])}}),{c(){t=yt("div"),n=yt("h1"),i=ge("Draw your neighbourhood boundary for "),r=ge(e[0]),l=Xt(),f=yt("div"),Zt(a.$$.fragment),_=Xt(),Zt(x.$$.fragment),S=Xt(),L=yt("p"),L.textContent="TODO: maybe move the instructions from the previous screen to here...",A=Xt(),Zt(P.$$.fragment),ri(f,"display","flex"),ri(f,"justify-content","space-between"),Rt(t,"slot","sidebar")},m(B,U){St(B,t,U),ft(t,n),ft(n,i),ft(n,r),ft(t,l),ft(t,f),jt(a,f,null),ft(f,_),jt(x,f,null),ft(t,S),ft(t,L),ft(t,A),jt(P,t,null),D=!0},p(B,U){(!D||U&1)&&Fi(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 Z={};U&4&&(Z.route_tool=ci(B[2])),P.$set(Z)},i(B){D||(dt(a.$$.fragment,B),dt(x.$$.fragment,B),dt(P.$$.fragment,B),D=!0)},o(B){vt(a.$$.fragment,B),vt(x.$$.fragment,B),vt(P.$$.fragment,B),D=!1},d(B){B&&wt(t),qt(a),qt(x),qt(P)}}}function Uk(e){let t,n,i;return n=new Ck({}),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Ce,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function Gk(e){let t,n;return t=new Xu({props:{$$slots:{map:[Uk],sidebar:[Vk],top:[zk]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function jk(e,t,n){let i,r,l;Ee(e,qp,P=>n(2,i=P)),Ee(e,En,P=>n(3,r=P)),Ee(e,Xo,P=>n(9,l=P));let{name:f}=t,{existing:a}=t;a?i.editExistingArea(a):i.startArea();function _(){a?Ue(En,r={mode:"neighbourhood"},r):Ue(En,r={mode:"network"},r),i.clearEventListeners()}i.addEventListenerSuccess(P=>{try{l.setNeighbourhoodBoundary(f,P),l.setCurrentNeighbourhood(f),Ue(En,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=()=>ci(i).finish(),S=()=>Ue(En,r={mode:"title"},r),L=()=>Ue(En,r={mode:"network"},r),A=()=>Ue(En,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 qk extends tn{constructor(t){super(),Qe(this,t,jk,Gk,He,{name:0,existing:1})}}function Zk(e){let t,n,i,r,l,f;const a=[Mr("edit-polygon-fill"),{filter:Lw},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let _={};for(let P=0;Pn(0,i=r)),[i]}class Xk extends tn{constructor(t){super(),Qe(this,t,Wk,$k,He,{})}}function Pb(e){let t,n;return t=new Ky({props:{$$slots:{default:[Hk,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Hk(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;function B(){return e[1](e[3])}return{c(){t=yt("h1"),t.textContent="The Low-traffic neighbourhood (LTN) tool, v2",n=Xt(),i=yt("p"),i.innerHTML=`This is an experimental + to cancel`,t.disabled=n=e[1]==0},m(S,L){St(S,t,L),x.m(t,null),St(S,i,L),St(S,r,L),l||(f=Ge(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:Me,o:Me,d(S){S&&(wt(t),wt(i),wt(r)),x.d(),l=!1,f()}}}function Pk(e,t,n){let i;Ee(e,cx,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 kk extends tn{constructor(t){super(),Qe(this,t,Pk,Mk,He,{route_tool:0})}}function Ak(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Nk(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Dk(e){let t;return{c(){t=_t("li"),t.textContent="Creating new neighbourhood boundary"},m(n,i){St(n,t,i)},p:Me,i:Me,o:Me,d(n){n&&wt(t)}}}function Rk(e){let t,n,i,r,l;return n=new xi({props:{$$slots:{default:[Ok]},$$scope:{ctx:e}}}),n.$on("click",e[8]),{c(){t=_t("li"),Zt(n.$$.fragment),i=Wt(),r=_t("li"),r.textContent="Changing neighbourhood boundary"},m(f,a){St(f,t,a),jt(n,t,null),St(f,i,a),St(f,r,a),l=!0},p(f,a){const _={};a&1024&&(_.$$scope={dirty:a,ctx:f}),n.$set(_)},i(f){l||(dt(n.$$.fragment,f),l=!0)},o(f){vt(n.$$.fragment,f),l=!1},d(f){f&&(wt(t),wt(i),wt(r)),qt(n)}}}function Ok(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function zk(e){let t,n,i,r,l,f,a,_,x,S,L,A;l=new xi({props:{$$slots:{default:[Ak]},$$scope:{ctx:e}}}),l.$on("click",e[6]),_=new xi({props:{$$slots:{default:[Nk]},$$scope:{ctx:e}}}),_.$on("click",e[7]);const P=[Rk,Dk],D=[];function F(U,Y){return U[1]?0:1}return S=F(e),L=D[S]=P[S](e),{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),Zt(_.$$.fragment),x=Wt(),L.c(),Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(U,Y){St(U,t,Y),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),jt(_,a,null),ht(i,x),D[S].m(i,null),A=!0},p(U,Y){const V={};Y&1024&&(V.$$scope={dirty:Y,ctx:U}),l.$set(V);const Z={};Y&1024&&(Z.$$scope={dirty:Y,ctx:U}),_.$set(Z);let K=S;S=F(U),S===K?D[S].p(U,Y):(hi(),vt(D[K],1,1,()=>{D[K]=null}),fi(),L=D[S],L?L.p(U,Y):(L=D[S]=P[S](U),L.c()),dt(L,1),L.m(i,null))},i(U){A||(dt(l.$$.fragment,U),dt(_.$$.fragment,U),dt(L),A=!0)},o(U){vt(l.$$.fragment,U),vt(_.$$.fragment,U),vt(L),A=!1},d(U){U&&wt(t),qt(l),qt(_),D[S].d()}}}function Fk(e){let t;return{c(){t=ge("Finish")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Bk(e){let t;return{c(){t=ge("Cancel")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function Vk(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;return a=new xi({props:{$$slots:{default:[Fk]},$$scope:{ctx:e}}}),a.$on("click",e[5]),x=new xi({props:{$$slots:{default:[Bk]},$$scope:{ctx:e}}}),x.$on("click",e[4]),P=new kk({props:{route_tool:ci(e[2])}}),{c(){t=_t("div"),n=_t("h1"),i=ge("Draw your neighbourhood boundary for "),r=ge(e[0]),l=Wt(),f=_t("div"),Zt(a.$$.fragment),_=Wt(),Zt(x.$$.fragment),S=Wt(),L=_t("p"),L.textContent="TODO: maybe move the instructions from the previous screen to here...",A=Wt(),Zt(P.$$.fragment),ri(f,"display","flex"),ri(f,"justify-content","space-between"),Rt(t,"slot","sidebar")},m(F,U){St(F,t,U),ht(t,n),ht(n,i),ht(n,r),ht(t,l),ht(t,f),jt(a,f,null),ht(f,_),jt(x,f,null),ht(t,S),ht(t,L),ht(t,A),jt(P,t,null),D=!0},p(F,U){(!D||U&1)&&Fi(r,F[0]);const Y={};U&1024&&(Y.$$scope={dirty:U,ctx:F}),a.$set(Y);const V={};U&1024&&(V.$$scope={dirty:U,ctx:F}),x.$set(V);const Z={};U&4&&(Z.route_tool=ci(F[2])),P.$set(Z)},i(F){D||(dt(a.$$.fragment,F),dt(x.$$.fragment,F),dt(P.$$.fragment,F),D=!0)},o(F){vt(a.$$.fragment,F),vt(x.$$.fragment,F),vt(P.$$.fragment,F),D=!1},d(F){F&&wt(t),qt(a),qt(x),qt(P)}}}function Uk(e){let t,n,i;return n=new Ck({}),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Me,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function Gk(e){let t,n;return t=new Xu({props:{$$slots:{map:[Uk],sidebar:[Vk],top:[zk]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function jk(e,t,n){let i,r,l;Ee(e,qp,P=>n(2,i=P)),Ee(e,En,P=>n(3,r=P)),Ee(e,Xo,P=>n(9,l=P));let{name:f}=t,{existing:a}=t;a?i.editExistingArea(a):i.startArea();function _(){a?Ue(En,r={mode:"neighbourhood"},r):Ue(En,r={mode:"network"},r),i.clearEventListeners()}i.addEventListenerSuccess(P=>{try{l.setNeighbourhoodBoundary(f,P),l.setCurrentNeighbourhood(f),Ue(En,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=()=>ci(i).finish(),S=()=>Ue(En,r={mode:"title"},r),L=()=>Ue(En,r={mode:"network"},r),A=()=>Ue(En,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 qk extends tn{constructor(t){super(),Qe(this,t,jk,Gk,He,{name:0,existing:1})}}function Zk(e){let t,n,i,r,l,f;const a=[Mr("edit-polygon-fill"),{filter:Lw},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let _={};for(let P=0;Pn(0,i=r)),[i]}class Xk extends tn{constructor(t){super(),Qe(this,t,Wk,$k,He,{})}}function Pb(e){let t,n;return t=new Ky({props:{$$slots:{default:[Hk,({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Hk(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;function F(){return e[1](e[3])}return{c(){t=_t("h1"),t.textContent="The Low-traffic neighbourhood (LTN) tool, v2",n=Wt(),i=_t("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=Xt(),l=yt("p"),l.textContent="To use this tool, you need to:",f=Xt(),a=yt("ol"),a.innerHTML=`
  • Choose your study area to analyze
  • Define one or more neighbourhood boundaries
  • Optionally, fix the basemap data on existing modal filters, turn + of the tool instead.`,r=Wt(),l=_t("p"),l.textContent="To use this tool, you need to:",f=Wt(),a=_t("ol"),a.innerHTML=`
  • Choose your study area to analyze
  • Define one or more neighbourhood boundaries
  • Optionally, fix the basemap data on existing modal filters, turn restrictions, one-ways, etc
  • Create one or more proposals with new modal filters, and explore their - effects
  • `,_=Xt(),x=yt("p"),x.innerHTML=`This tool is created by Dustin Carlino + effects`,_=Wt(),x=_t("p"),x.innerHTML=`This tool is created by Dustin Carlino and relies heavily on OpenStreetMap - data.`,S=Xt(),L=yt("center"),A=yt("button"),A.textContent="Start!"},m(U,Y){St(U,t,Y),St(U,n,Y),St(U,i,Y),St(U,r,Y),St(U,l,Y),St(U,f,Y),St(U,a,Y),St(U,_,Y),St(U,x,Y),St(U,S,Y),St(U,L,Y),ft(L,A),P||(D=Ze(A,"click",B),P=!0)},p(U,Y){e=U},d(U){U&&(wt(t),wt(n),wt(i),wt(r),wt(l),wt(f),wt(a),wt(_),wt(x),wt(S),wt(L)),P=!1,D()}}}function Yk(e){let t,n,i=e[0]&&Pb(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=Pb(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function Kk(e,t,n){let i;return Ee(e,Hm,f=>n(0,i=f)),[i,f=>ci(f).close(),()=>Ue(Hm,i=!1,i)]}class Jk extends tn{constructor(t){super(),Qe(this,t,Kk,Yk,He,{})}}function kb(e,t,n){const i=e.slice();return i[22]=t[n][0],i[23]=t[n][1],i}function Ab(e,t,n){const i=e.slice();return i[26]=t[n][0],i[27]=t[n][1],i}function Nb(e){let t,n=e[27]+"",i,r;return{c(){t=yt("option"),i=ge(n),t.__value=r=e[26],ql(t,t.__value)},m(l,f){St(l,t,f),ft(t,i)},p(l,f){f&4&&n!==(n=l[27]+"")&&Fi(i,n),f&4&&r!==(r=l[26])&&(t.__value=r,ql(t,t.__value))},d(l){l&&wt(t)}}}function Db(e){let t,n,i=la(e[23]),r=[];for(let l=0;le[9].call(l)),Rt(A,"type","file")},m(mt,ht){jt(t,mt,ht),St(mt,n,ht),St(mt,i,ht),ft(i,r),ft(i,l),ft(l,f);for(let gt=0;gtn(15,i=lt)),Ee(e,ku,lt=>n(4,r=lt)),Ee(e,Km,lt=>n(16,l=lt)),Ee(e,Ym,lt=>n(17,f=lt)),Ee(e,Ru,lt=>n(5,a=lt)),Ee(e,qp,lt=>n(18,_=lt)),Ee(e,En,lt=>n(19,x=lt));let S=null,L=!1,A=[];dg(async()=>{try{let lt=await fetch("/osm/areas.json");if(lt.ok)L=!0,console.log("Using local cache, not od2net.org"),n(2,A=await lt.json());else{let It=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,A=await It.json())}}catch{}});let P;async function D(lt){try{B(await P.files[0].arrayBuffer()),Ue(ku,r="",r)}catch(It){window.alert(`Couldn't open this file: ${It}`)}n(1,S=null)}function B(lt){n(1,S="Building map model from OSM input"),console.time("load"),Ue(Xo,i=new KS(new Uint8Array(lt),r==""?void 0:r),i),console.timeEnd("load");let It=`ltn_${r||"custom"}.geojson`,_t=window.localStorage.getItem(It);if(_t)try{i.loadSavefile(JSON.parse(_t))}catch(bt){window.alert(`Didn't restore from local storage ${It}: ${bt}`)}Ue(En,x={mode:"network"},x),Ue(qp,_=new _I(a,i.toRouteSnapper()),_),a.fitBounds(Array.from(i.getBounds()),{animate:!1}),Ue(Ym,f=Z(),f),Ue(Km,l=Z(),l)}function U(lt){try{B(new TextEncoder().encode(lt.detail)),Ue(ku,r="",r)}catch(It){window.alert(`Couldn't import from Overpass: ${It}`)}n(1,S=null)}async function Y(lt){lt!=""&&(L?await V(`/osm/${lt}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${lt}.pbf`))}async function V(lt){try{n(1,S=`Downloading ${lt}`);let It=await fetch(lt);B(await It.arrayBuffer())}catch(It){window.alert(`Couldn't open from URL ${lt}: ${It}`)}n(1,S=null)}function Z(){let lt=i.getBounds(),It=lt[0]+Math.random()*(lt[2]-lt[0]),_t=lt[1]+Math.random()*(lt[3]-lt[1]);return new mg.LngLat(It,_t)}function K(){r=jb(this),ku.set(r),n(2,A)}const it=()=>Y(r);function mt(lt){cr[lt?"unshift":"push"](()=>{P=lt,n(3,P)})}return[Y,S,A,P,r,a,D,U,B,K,it,mt,lt=>n(1,S=lt.detail),lt=>window.alert(lt.detail)]}class eA extends tn{constructor(t){super(),Qe(this,t,tA,Qk,He,{loadMap:8,loadExample:0})}get loadMap(){return this.$$.ctx[8]}get loadExample(){return this.$$.ctx[0]}}function nA(e){let t;return{c(){t=yt("div"),t.innerHTML='',Rt(t,"slot","top")},m(n,i){St(n,t,i)},p:Ce,d(n){n&&wt(t)}}}function Rb(e){let t,n,i,r,l;return{c(){t=yt("label"),n=ge(`Load a project from a file - `),i=yt("input"),Rt(i,"type","file")},m(f,a){St(f,t,a),ft(t,n),ft(t,i),e[7](i),r||(l=Ze(i,"change",e[5]),r=!0)},p:Ce,d(f){f&&wt(t),e[7](null),r=!1,l()}}}function iA(e){let t;return{c(){t=yt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,i){St(n,t,i)},p:Ce,i:Ce,o:Ce,d(n){n&&wt(t)}}}function rA(e){let t,n,i={};return t=new eA({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||(dt(t.$$.fragment,r),n=!0)},o(r){vt(t.$$.fragment,r),n=!1},d(r){e[8](null),qt(t,r)}}}function oA(e){let t,n,i,r,l,f,a,_,x,S,L,A,P;n=new Jk({});let D=e[1]&&Rb(e);const B=[rA,iA],U=[];function Y(V,Z){return V[4]&&V[0]?0:1}return x=Y(e),S=U[x]=B[x](e),{c(){t=yt("div"),Zt(n.$$.fragment),i=Xt(),r=yt("button"),r.textContent="About the LTN tool",l=Xt(),D&&D.c(),f=Xt(),a=yt("hr"),_=Xt(),S.c(),Rt(t,"slot","sidebar")},m(V,Z){St(V,t,Z),jt(n,t,null),ft(t,i),ft(t,r),ft(t,l),D&&D.m(t,null),ft(t,f),ft(t,a),ft(t,_),U[x].m(t,null),L=!0,A||(P=Ze(r,"click",e[6]),A=!0)},p(V,Z){V[1]?D?D.p(V,Z):(D=Rb(V),D.c(),D.m(t,f)):D&&(D.d(1),D=null);let K=x;x=Y(V),x===K?U[x].p(V,Z):(hi(),vt(U[K],1,1,()=>{U[K]=null}),fi(),S=U[x],S?S.p(V,Z):(S=U[x]=B[x](V),S.c()),dt(S,1),S.m(t,null))},i(V){L||(dt(n.$$.fragment,V),dt(S),L=!0)},o(V){vt(n.$$.fragment,V),vt(S),L=!1},d(V){V&&wt(t),qt(n),D&&D.d(),U[x].d(),A=!1,P()}}}function sA(e){let t,n,i;return n=new Xk({}),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Ce,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function aA(e){let t,n;return t=new Xu({props:{$$slots:{map:[sA],sidebar:[oA],top:[nA]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function lA(e,t,n){let i,r,l,f,a;Ee(e,ku,B=>n(9,i=B)),Ee(e,qp,B=>n(10,r=B)),Ee(e,Xo,B=>n(11,l=B)),Ee(e,Hm,B=>n(3,f=B)),Ee(e,Ru,B=>n(4,a=B));let{wasmReady:_}=t;Ue(Xo,l=null,l),Ue(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)Ue(ku,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{Ue(ku,i="",i);let Y=U.features.find(K=>K.properties.kind=="study_area_boundary"),Z=await(await fetch(Aw(Y))).arrayBuffer();window.localStorage.setItem("ltn_custom.geojson",JSON.stringify(U)),x.loadMap(Z)}}catch(U){window.alert(`Couldn't open this file: ${U}`)}}const A=()=>Ue(Hm,f=!0,f);function P(B){cr[B?"unshift":"push"](()=>{S=B,n(2,S)})}function D(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,D]}class uA extends tn{constructor(t){super(),Qe(this,t,lA,aA,He,{wasmReady:0})}}const{window:cA}=AS;function hA(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function fA(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function pA(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function dA(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;return l=new xi({props:{$$slots:{default:[hA]},$$scope:{ctx:e}}}),l.$on("click",e[9]),_=new xi({props:{$$slots:{default:[fA]},$$scope:{ctx:e}}}),_.$on("click",e[10]),L=new xi({props:{$$slots:{default:[pA]},$$scope:{ctx:e}}}),L.$on("click",e[5]),{c(){t=yt("div"),n=yt("nav"),i=yt("ul"),r=yt("li"),Zt(l.$$.fragment),f=Xt(),a=yt("li"),Zt(_.$$.fragment),x=Xt(),S=yt("li"),Zt(L.$$.fragment),A=Xt(),P=yt("li"),P.textContent="Viewing shortcuts",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(B,U){St(B,t,U),ft(t,n),ft(n,i),ft(i,r),jt(l,r,null),ft(i,f),ft(i,a),jt(_,a,null),ft(i,x),ft(i,S),jt(L,S,null),ft(i,A),ft(i,P),D=!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 Z={};U&8192&&(Z.$$scope={dirty:U,ctx:B}),L.$set(Z)},i(B){D||(dt(l.$$.fragment,B),dt(_.$$.fragment,B),dt(L.$$.fragment,B),D=!0)},o(B){vt(l.$$.fragment,B),vt(_.$$.fragment,B),vt(L.$$.fragment,B),D=!1},d(B){B&&wt(t),qt(l),qt(_),qt(L)}}}function mA(e){let t,n,i,r,l,f,a,_,x,S=e[0].shortcutIndex+1+"",L,A,P=e[0].gj.features.length+"",D,B,U,Y,V,Z,K,it,mt,ht=ci(e[0].gj.features[e[0].shortcutIndex].properties).directness.toFixed(1)+"",gt,lt,It,_t,bt;return{c(){t=yt("p"),t.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. + data.`,S=Wt(),L=_t("center"),A=_t("button"),A.textContent="Start!"},m(U,Y){St(U,t,Y),St(U,n,Y),St(U,i,Y),St(U,r,Y),St(U,l,Y),St(U,f,Y),St(U,a,Y),St(U,_,Y),St(U,x,Y),St(U,S,Y),St(U,L,Y),ht(L,A),P||(D=Ge(A,"click",F),P=!0)},p(U,Y){e=U},d(U){U&&(wt(t),wt(n),wt(i),wt(r),wt(l),wt(f),wt(a),wt(_),wt(x),wt(S),wt(L)),P=!1,D()}}}function Yk(e){let t,n,i=e[0]&&Pb(e);return{c(){i&&i.c(),t=Do()},m(r,l){i&&i.m(r,l),St(r,t,l),n=!0},p(r,[l]){r[0]?i?(i.p(r,l),l&1&&dt(i,1)):(i=Pb(r),i.c(),dt(i,1),i.m(t.parentNode,t)):i&&(hi(),vt(i,1,1,()=>{i=null}),fi())},i(r){n||(dt(i),n=!0)},o(r){vt(i),n=!1},d(r){r&&wt(t),i&&i.d(r)}}}function Kk(e,t,n){let i;return Ee(e,Hm,f=>n(0,i=f)),[i,f=>ci(f).close(),()=>Ue(Hm,i=!1,i)]}class Jk extends tn{constructor(t){super(),Qe(this,t,Kk,Yk,He,{})}}function kb(e,t,n){const i=e.slice();return i[22]=t[n][0],i[23]=t[n][1],i}function Ab(e,t,n){const i=e.slice();return i[26]=t[n][0],i[27]=t[n][1],i}function Nb(e){let t,n=e[27]+"",i,r;return{c(){t=_t("option"),i=ge(n),t.__value=r=e[26],ql(t,t.__value)},m(l,f){St(l,t,f),ht(t,i)},p(l,f){f&4&&n!==(n=l[27]+"")&&Fi(i,n),f&4&&r!==(r=l[26])&&(t.__value=r,ql(t,t.__value))},d(l){l&&wt(t)}}}function Db(e){let t,n,i=la(e[23]),r=[];for(let l=0;le[9].call(l)),Rt(A,"type","file")},m(mt,ft){jt(t,mt,ft),St(mt,n,ft),St(mt,i,ft),ht(i,r),ht(i,l),ht(l,f);for(let gt=0;gtn(15,i=lt)),Ee(e,ku,lt=>n(4,r=lt)),Ee(e,Km,lt=>n(16,l=lt)),Ee(e,Ym,lt=>n(17,f=lt)),Ee(e,Ru,lt=>n(5,a=lt)),Ee(e,qp,lt=>n(18,_=lt)),Ee(e,En,lt=>n(19,x=lt));let S=null,L=!1,A=[];dg(async()=>{try{let lt=await fetch("/osm/areas.json");if(lt.ok)L=!0,console.log("Using local cache, not od2net.org"),n(2,A=await lt.json());else{let It=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,A=await It.json())}}catch{}});let P;async function D(lt){try{F(await P.files[0].arrayBuffer()),Ue(ku,r="",r)}catch(It){window.alert(`Couldn't open this file: ${It}`)}n(1,S=null)}function F(lt){n(1,S="Building map model from OSM input"),console.time("load"),Ue(Xo,i=new KS(new Uint8Array(lt),r==""?void 0:r),i),console.timeEnd("load");let It=`ltn_${r||"custom"}.geojson`,yt=window.localStorage.getItem(It);if(yt)try{i.loadSavefile(JSON.parse(yt))}catch(bt){window.alert(`Didn't restore from local storage ${It}: ${bt}`)}Ue(En,x={mode:"network"},x),Ue(qp,_=new _I(a,i.toRouteSnapper()),_),a.fitBounds(Array.from(i.getBounds()),{animate:!1}),Ue(Ym,f=Z(),f),Ue(Km,l=Z(),l)}function U(lt){try{F(new TextEncoder().encode(lt.detail)),Ue(ku,r="",r)}catch(It){window.alert(`Couldn't import from Overpass: ${It}`)}n(1,S=null)}async function Y(lt){lt!=""&&(L?await V(`/osm/${lt}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${lt}.pbf`))}async function V(lt){try{n(1,S=`Downloading ${lt}`);let It=await fetch(lt);F(await It.arrayBuffer())}catch(It){window.alert(`Couldn't open from URL ${lt}: ${It}`)}n(1,S=null)}function Z(){let lt=i.getBounds(),It=lt[0]+Math.random()*(lt[2]-lt[0]),yt=lt[1]+Math.random()*(lt[3]-lt[1]);return new mg.LngLat(It,yt)}function K(){r=jb(this),ku.set(r),n(2,A)}const it=()=>Y(r);function mt(lt){cr[lt?"unshift":"push"](()=>{P=lt,n(3,P)})}return[Y,S,A,P,r,a,D,U,F,K,it,mt,lt=>n(1,S=lt.detail),lt=>window.alert(lt.detail)]}class eA extends tn{constructor(t){super(),Qe(this,t,tA,Qk,He,{loadMap:8,loadExample:0})}get loadMap(){return this.$$.ctx[8]}get loadExample(){return this.$$.ctx[0]}}function nA(e){let t;return{c(){t=_t("div"),t.innerHTML='',Rt(t,"slot","top")},m(n,i){St(n,t,i)},p:Me,d(n){n&&wt(t)}}}function Rb(e){let t,n,i,r,l;return{c(){t=_t("label"),n=ge(`Load a project from a file + `),i=_t("input"),Rt(i,"type","file")},m(f,a){St(f,t,a),ht(t,n),ht(t,i),e[7](i),r||(l=Ge(i,"change",e[5]),r=!0)},p:Me,d(f){f&&wt(t),e[7](null),r=!1,l()}}}function iA(e){let t;return{c(){t=_t("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,i){St(n,t,i)},p:Me,i:Me,o:Me,d(n){n&&wt(t)}}}function rA(e){let t,n,i={};return t=new eA({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||(dt(t.$$.fragment,r),n=!0)},o(r){vt(t.$$.fragment,r),n=!1},d(r){e[8](null),qt(t,r)}}}function oA(e){let t,n,i,r,l,f,a,_,x,S,L,A,P;n=new Jk({});let D=e[1]&&Rb(e);const F=[rA,iA],U=[];function Y(V,Z){return V[4]&&V[0]?0:1}return x=Y(e),S=U[x]=F[x](e),{c(){t=_t("div"),Zt(n.$$.fragment),i=Wt(),r=_t("button"),r.textContent="About the LTN tool",l=Wt(),D&&D.c(),f=Wt(),a=_t("hr"),_=Wt(),S.c(),Rt(t,"slot","sidebar")},m(V,Z){St(V,t,Z),jt(n,t,null),ht(t,i),ht(t,r),ht(t,l),D&&D.m(t,null),ht(t,f),ht(t,a),ht(t,_),U[x].m(t,null),L=!0,A||(P=Ge(r,"click",e[6]),A=!0)},p(V,Z){V[1]?D?D.p(V,Z):(D=Rb(V),D.c(),D.m(t,f)):D&&(D.d(1),D=null);let K=x;x=Y(V),x===K?U[x].p(V,Z):(hi(),vt(U[K],1,1,()=>{U[K]=null}),fi(),S=U[x],S?S.p(V,Z):(S=U[x]=F[x](V),S.c()),dt(S,1),S.m(t,null))},i(V){L||(dt(n.$$.fragment,V),dt(S),L=!0)},o(V){vt(n.$$.fragment,V),vt(S),L=!1},d(V){V&&wt(t),qt(n),D&&D.d(),U[x].d(),A=!1,P()}}}function sA(e){let t,n,i;return n=new Xk({}),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","map")},m(r,l){St(r,t,l),jt(n,t,null),i=!0},p:Me,i(r){i||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function aA(e){let t,n;return t=new Xu({props:{$$slots:{map:[sA],sidebar:[oA],top:[nA]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function lA(e,t,n){let i,r,l,f,a;Ee(e,ku,F=>n(9,i=F)),Ee(e,qp,F=>n(10,r=F)),Ee(e,Xo,F=>n(11,l=F)),Ee(e,Hm,F=>n(3,f=F)),Ee(e,Ru,F=>n(4,a=F));let{wasmReady:_}=t;Ue(Xo,l=null,l),Ue(qp,r=null,r);let x,S;async function L(F){try{let U=JSON.parse(await S.files[0].text());if(U.study_area_name)Ue(ku,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{Ue(ku,i="",i);let Y=U.features.find(K=>K.properties.kind=="study_area_boundary"),Z=await(await fetch(Aw(Y))).arrayBuffer();window.localStorage.setItem("ltn_custom.geojson",JSON.stringify(U)),x.loadMap(Z)}}catch(U){window.alert(`Couldn't open this file: ${U}`)}}const A=()=>Ue(Hm,f=!0,f);function P(F){cr[F?"unshift":"push"](()=>{S=F,n(2,S)})}function D(F){cr[F?"unshift":"push"](()=>{x=F,n(1,x)})}return e.$$set=F=>{"wasmReady"in F&&n(0,_=F.wasmReady)},[_,x,S,f,a,L,A,P,D]}class uA extends tn{constructor(t){super(),Qe(this,t,lA,aA,He,{wasmReady:0})}}const{window:cA}=AS;function hA(e){let t;return{c(){t=ge("Choose study area")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function fA(e){let t;return{c(){t=ge("Pick neighbourhood")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function pA(e){let t;return{c(){t=ge("Editing")},m(n,i){St(n,t,i)},d(n){n&&wt(t)}}}function dA(e){let t,n,i,r,l,f,a,_,x,S,L,A,P,D;return l=new xi({props:{$$slots:{default:[hA]},$$scope:{ctx:e}}}),l.$on("click",e[9]),_=new xi({props:{$$slots:{default:[fA]},$$scope:{ctx:e}}}),_.$on("click",e[10]),L=new xi({props:{$$slots:{default:[pA]},$$scope:{ctx:e}}}),L.$on("click",e[5]),{c(){t=_t("div"),n=_t("nav"),i=_t("ul"),r=_t("li"),Zt(l.$$.fragment),f=Wt(),a=_t("li"),Zt(_.$$.fragment),x=Wt(),S=_t("li"),Zt(L.$$.fragment),A=Wt(),P=_t("li"),P.textContent="Viewing shortcuts",Rt(n,"aria-label","breadcrumb"),Rt(t,"slot","top")},m(F,U){St(F,t,U),ht(t,n),ht(n,i),ht(i,r),jt(l,r,null),ht(i,f),ht(i,a),jt(_,a,null),ht(i,x),ht(i,S),jt(L,S,null),ht(i,A),ht(i,P),D=!0},p(F,U){const Y={};U&8192&&(Y.$$scope={dirty:U,ctx:F}),l.$set(Y);const V={};U&8192&&(V.$$scope={dirty:U,ctx:F}),_.$set(V);const Z={};U&8192&&(Z.$$scope={dirty:U,ctx:F}),L.$set(Z)},i(F){D||(dt(l.$$.fragment,F),dt(_.$$.fragment,F),dt(L.$$.fragment,F),D=!0)},o(F){vt(l.$$.fragment,F),vt(_.$$.fragment,F),vt(L.$$.fragment,F),D=!1},d(F){F&&wt(t),qt(l),qt(_),qt(L)}}}function mA(e){let t,n,i,r,l,f,a,_,x,S=e[0].shortcutIndex+1+"",L,A,P=e[0].gj.features.length+"",D,F,U,Y,V,Z,K,it,mt,ft=ci(e[0].gj.features[e[0].shortcutIndex].properties).directness.toFixed(1)+"",gt,lt,It,yt,bt;return{c(){t=_t("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=Xt(),i=yt("button"),i.textContent="Pick a different road",r=Xt(),l=yt("div"),f=yt("button"),a=ge("Previous"),x=Xt(),L=ge(S),A=ge(" / "),D=ge(P),B=Xt(),U=yt("button"),Y=ge("Next"),Z=Xt(),K=yt("p"),it=ge("This shortcut is "),mt=yt("b"),gt=ge(ht),lt=ge("x"),It=ge(` - the length of the shortest route using all roads, not just this neighbourhood`),f.disabled=_=e[0].shortcutIndex==0,U.disabled=V=e[0].shortcutIndex==e[0].gj.features.length-1,ri(l,"display","flex"),ri(l,"justify-content","space-between")},m(ee,kt){St(ee,t,kt),St(ee,n,kt),St(ee,i,kt),St(ee,r,kt),St(ee,l,kt),ft(l,f),ft(f,a),ft(l,x),ft(l,L),ft(l,A),ft(l,D),ft(l,B),ft(l,U),ft(U,Y),St(ee,Z,kt),St(ee,K,kt),ft(K,it),ft(K,mt),ft(mt,gt),ft(mt,lt),ft(K,It),_t||(bt=[Ze(i,"click",e[8]),Ze(f,"click",e[6]),Ze(U,"click",e[7])],_t=!0)},p(ee,kt){kt&1&&_!==(_=ee[0].shortcutIndex==0)&&(f.disabled=_),kt&1&&S!==(S=ee[0].shortcutIndex+1+"")&&Fi(L,S),kt&1&&P!==(P=ee[0].gj.features.length+"")&&Fi(D,P),kt&1&&V!==(V=ee[0].shortcutIndex==ee[0].gj.features.length-1)&&(U.disabled=V),kt&1&&ht!==(ht=ci(ee[0].gj.features[ee[0].shortcutIndex].properties).directness.toFixed(1)+"")&&Fi(gt,ht)},d(ee){ee&&(wt(t),wt(n),wt(i),wt(r),wt(l),wt(Z),wt(K)),_t=!1,No(bt)}}}function gA(e){let t;return{c(){t=yt("p"),t.textContent="Click a road to see shortcuts"},m(n,i){St(n,t,i)},p:Ce,d(n){n&&wt(t)}}}function _A(e){let t,n,i,r;n=new Ng({}),n.$on("click",e[5]);function l(_,x){if(_[0].state=="neutral")return gA;if(_[0].state=="chose-road")return mA}let f=l(e),a=f&&f(e);return{c(){t=yt("div"),Zt(n.$$.fragment),i=Xt(),a&&a.c(),Rt(t,"slot","sidebar")},m(_,x){St(_,t,x),jt(n,t,null),ft(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||(dt(n.$$.fragment,_),r=!0)},o(_){vt(n.$$.fragment,_),r=!1},d(_){_&&wt(t),qt(n),a&&a.d()}}}function yA(e){let t,n,i,r,l,f;return t=new Ps({props:{data:Ty(JSON.parse(ci(e[2]).renderNeighbourhood())),$$slots:{default:[bA]},$$scope:{ctx:e}}}),i=new Ps({props:{data:e[0].gj.features[e[0].shortcutIndex],$$slots:{default:[xA]},$$scope:{ctx:e}}}),l=new Ps({props:{data:e[0].roadGj,$$slots:{default:[wA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment),n=Xt(),Zt(i.$$.fragment),r=Xt(),Zt(l.$$.fragment)},m(a,_){jt(t,a,_),St(a,n,_),jt(i,a,_),St(a,r,_),jt(l,a,_),f=!0},p(a,_){const x={};_&4&&(x.data=Ty(JSON.parse(ci(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||(dt(t.$$.fragment,a),dt(i.$$.fragment,a),dt(l.$$.fragment,a),f=!0)},o(a){vt(t.$$.fragment,a),vt(i.$$.fragment,a),vt(l.$$.fragment,a),f=!1},d(a){a&&(wt(n),wt(r)),qt(t,a),qt(i,a),qt(l,a)}}}function vA(e){let t,n;return t=new Dg({props:{gjInput:JSON.parse(ci(e[2]).renderNeighbourhood()),onClickLine:e[3],$$slots:{"line-popup":[EA]},$$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(ci(i[2]).renderNeighbourhood())),r&8192&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function bA(e){let t,n;const i=[Mr("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=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function IA(e){let t,n,i,r,l,f;const a=[vA,yA],_=[];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=yt("div"),i&&i.c(),r=Xt(),Zt(l.$$.fragment),Rt(t,"slot","map")},m(S,L){St(S,t,L),~n&&_[n].m(t,null),ft(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&&(hi(),vt(_[A],1,1,()=>{_[A]=null}),fi()),~n?(i=_[n],i?i.p(S,L):(i=_[n]=a[n](S),i.c()),dt(i,1),i.m(t,r)):i=null)},i(S){f||(dt(i),dt(l.$$.fragment,S),f=!0)},o(S){vt(i),vt(l.$$.fragment,S),f=!1},d(S){S&&wt(t),~n&&_[n].d(),qt(l)}}}function CA(e){let t,n,i,r;return t=new Xu({props:{$$slots:{map:[IA],sidebar:[_A],top:[dA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ze(cA,"keydown",e[4]),i=!0)},p(l,[f]){const a={};f&8199&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(dt(t.$$.fragment,l),n=!0)},o(l){vt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function TA(e,t,n){let i,r,l;Ee(e,En,B=>n(1,i=B)),Ee(e,Ru,B=>n(11,r=B)),Ee(e,Xo,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(){Ue(En,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"}),()=>Ue(En,i={mode:"title"},i),()=>Ue(En,i={mode:"network"},i)]}class LA extends tn{constructor(t){super(),Qe(this,t,TA,CA,He,{})}}function MA(e){let t,n,i,r,l,f,a,_;return l=new wk({}),{c(){t=yt("div"),n=yt("img"),r=Xt(),Zt(l.$$.fragment),f=Xt(),a=yt("span"),hr(n.src,i=qS)||Rt(n,"src",i),ri(n,"height","8vh"),ri(n,"margin-right","20px"),Rt(n,"alt","A/B Street logo"),ri(a,"width","100%"),Rt(t,"slot","top"),ri(t,"display","flex")},m(x,S){St(x,t,S),ft(t,n),ft(t,r),jt(l,t,null),ft(t,f),ft(t,a),e[16](a),_=!0},p:Ce,i(x){_||(dt(l.$$.fragment,x),_=!0)},o(x){vt(l.$$.fragment,x),_=!1},d(x){x&&wt(t),qt(l),e[16](null)}}}function Ob(e){let t,n,i;return{c(){t=yt("button"),t.textContent="Zoom to fit study area",Rt(t,"class","secondary")},m(r,l){St(r,t,l),n||(i=Ze(t,"click",e[8]),n=!0)},p:Ce,d(r){r&&wt(t),n=!1,i()}}}function PA(e){let t,n,i,r,l,f=e[5]&&Ob(e);return{c(){t=yt("div"),n=yt("div"),i=Xt(),r=yt("hr"),l=Xt(),f&&f.c(),Rt(t,"slot","left")},m(a,_){St(a,t,_),ft(t,n),e[15](n),ft(t,i),ft(t,r),ft(t,l),f&&f.m(t,null)},p(a,_){a[5]?f?f.p(a,_):(f=Ob(a),f.c(),f.m(t,null)):f&&(f.d(1),f=null)},d(a){a&&wt(t),e[15](null),f&&f.d()}}}function zb(e){let t,n;return t=new uA({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Fb(e){let t,n,i,r,l,f;t=new Ps({props:{data:JSON.parse(e[5].getInvertedBoundary()),$$slots:{default:[kA]},$$scope:{ctx:e}}});const a=[FA,zA,OA,RA,DA,NA,AA],_=[];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=Do()},m(S,L){jt(t,S,L),St(S,n,L),~i&&_[i].m(S,L),St(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&&(hi(),vt(_[P],1,1,()=>{_[P]=null}),fi()),~i?(r=_[i],r?r.p(S,L):(r=_[i]=a[i](S),r.c()),dt(r,1),r.m(l.parentNode,l)):r=null)},i(S){f||(dt(t.$$.fragment,S),dt(r),f=!0)},o(S){vt(t.$$.fragment,S),vt(r),f=!1},d(S){S&&(wt(n),wt(l)),qt(t,S),~i&&_[i].d(S)}}}function kA(e){let t,n;const i=[Mr("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let r={};for(let l=0;l{_=null}),fi()),S[5]?x?(x.p(S,L),L&32&&dt(x,1)):(x=Fb(S),x.c(),dt(x,1),x.m(f.parentNode,f)):x&&(hi(),vt(x,1,1,()=>{x=null}),fi())},i(S){a||(dt(t.$$.fragment,S),dt(_),dt(x),a=!0)},o(S){vt(t.$$.fragment,S),vt(_),vt(x),a=!1},d(S){S&&(wt(n),wt(i),wt(r),wt(l),wt(f)),qt(t,S),e[12](null),_&&_.d(S),x&&x.d(S)}}}function VA(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:[BA]},$$scope:{ctx:e}};return e[0]!==void 0&&(f.map=e[0]),n=new XE({props:f}),cr.push(()=>vc(n,"map",l)),n.$on("error",e[14]),{c(){t=yt("div"),Zt(n.$$.fragment),Rt(t,"slot","main"),ri(t,"position","relative"),ri(t,"width","100%"),ri(t,"height","100%")},m(a,_){St(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||(dt(n.$$.fragment,a),r=!0)},o(a){vt(n.$$.fragment,a),r=!1},d(a){a&&wt(t),qt(n)}}}function UA(e){let t,n;return t=new aL({props:{$$slots:{main:[VA],left:[PA],top:[MA]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function GA(e,t,n){let i,r,l,f,a,_,x;Ee(e,ay,it=>n(9,i=it)),Ee(e,sy,it=>n(10,r=it)),Ee(e,oy,it=>n(11,l=it)),Ee(e,Xo,it=>n(5,f=it)),Ee(e,Ru,it=>n(17,a=it)),Ee(e,hx,it=>n(6,_=it)),Ee(e,En,it=>n(7,x=it));let S=!1;dg(async()=>{await Kb(),await Qb(),n(4,S=!0)});let L;function A(){a.fitBounds(Array.from(f.getBounds()),{animate:!1})}let P,D,B;function U(it){cr[it?"unshift":"push"](()=>{B=it,n(3,B),n(9,i)})}function Y(it){L=it,n(0,L)}const V=it=>{console.log(it.detail.error)};function Z(it){cr[it?"unshift":"push"](()=>{D=it,n(2,D),n(10,r)})}function K(it){cr[it?"unshift":"push"](()=>{P=it,n(1,P),n(11,l)})}return e.$$.update=()=>{e.$$.dirty&1&&L&&Ru.set(L),e.$$.dirty&2050&&P&&l&&(n(1,P.innerHTML="",P),P.appendChild(l)),e.$$.dirty&1028&&D&&r&&(n(2,D.innerHTML="",D),D.appendChild(r)),e.$$.dirty&520&&B&&i&&(n(3,B.innerHTML="",B),B.appendChild(i))},[L,P,D,B,S,f,_,x,A,i,r,l,U,Y,V,Z,K]}class jA extends tn{constructor(t){super(),Qe(this,t,GA,UA,He,{})}}new jA({target:document.getElementById("app")}); + view lets you understand the limits of this assumption.`,n=Wt(),i=_t("button"),i.textContent="Pick a different road",r=Wt(),l=_t("div"),f=_t("button"),a=ge("Previous"),x=Wt(),L=ge(S),A=ge(" / "),D=ge(P),F=Wt(),U=_t("button"),Y=ge("Next"),Z=Wt(),K=_t("p"),it=ge("This shortcut is "),mt=_t("b"),gt=ge(ft),lt=ge("x"),It=ge(` + the length of the shortest route using all roads, not just this neighbourhood`),f.disabled=_=e[0].shortcutIndex==0,U.disabled=V=e[0].shortcutIndex==e[0].gj.features.length-1,ri(l,"display","flex"),ri(l,"justify-content","space-between")},m(ee,kt){St(ee,t,kt),St(ee,n,kt),St(ee,i,kt),St(ee,r,kt),St(ee,l,kt),ht(l,f),ht(f,a),ht(l,x),ht(l,L),ht(l,A),ht(l,D),ht(l,F),ht(l,U),ht(U,Y),St(ee,Z,kt),St(ee,K,kt),ht(K,it),ht(K,mt),ht(mt,gt),ht(mt,lt),ht(K,It),yt||(bt=[Ge(i,"click",e[8]),Ge(f,"click",e[6]),Ge(U,"click",e[7])],yt=!0)},p(ee,kt){kt&1&&_!==(_=ee[0].shortcutIndex==0)&&(f.disabled=_),kt&1&&S!==(S=ee[0].shortcutIndex+1+"")&&Fi(L,S),kt&1&&P!==(P=ee[0].gj.features.length+"")&&Fi(D,P),kt&1&&V!==(V=ee[0].shortcutIndex==ee[0].gj.features.length-1)&&(U.disabled=V),kt&1&&ft!==(ft=ci(ee[0].gj.features[ee[0].shortcutIndex].properties).directness.toFixed(1)+"")&&Fi(gt,ft)},d(ee){ee&&(wt(t),wt(n),wt(i),wt(r),wt(l),wt(Z),wt(K)),yt=!1,yo(bt)}}}function gA(e){let t;return{c(){t=_t("p"),t.textContent="Click a road to see shortcuts"},m(n,i){St(n,t,i)},p:Me,d(n){n&&wt(t)}}}function _A(e){let t,n,i,r;n=new Ng({}),n.$on("click",e[5]);function l(_,x){if(_[0].state=="neutral")return gA;if(_[0].state=="chose-road")return mA}let f=l(e),a=f&&f(e);return{c(){t=_t("div"),Zt(n.$$.fragment),i=Wt(),a&&a.c(),Rt(t,"slot","sidebar")},m(_,x){St(_,t,x),jt(n,t,null),ht(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||(dt(n.$$.fragment,_),r=!0)},o(_){vt(n.$$.fragment,_),r=!1},d(_){_&&wt(t),qt(n),a&&a.d()}}}function yA(e){let t,n,i,r,l,f;return t=new Ps({props:{data:Ty(JSON.parse(ci(e[2]).renderNeighbourhood())),$$slots:{default:[bA]},$$scope:{ctx:e}}}),i=new Ps({props:{data:e[0].gj.features[e[0].shortcutIndex],$$slots:{default:[xA]},$$scope:{ctx:e}}}),l=new Ps({props:{data:e[0].roadGj,$$slots:{default:[wA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment),n=Wt(),Zt(i.$$.fragment),r=Wt(),Zt(l.$$.fragment)},m(a,_){jt(t,a,_),St(a,n,_),jt(i,a,_),St(a,r,_),jt(l,a,_),f=!0},p(a,_){const x={};_&4&&(x.data=Ty(JSON.parse(ci(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||(dt(t.$$.fragment,a),dt(i.$$.fragment,a),dt(l.$$.fragment,a),f=!0)},o(a){vt(t.$$.fragment,a),vt(i.$$.fragment,a),vt(l.$$.fragment,a),f=!1},d(a){a&&(wt(n),wt(r)),qt(t,a),qt(i,a),qt(l,a)}}}function vA(e){let t,n;return t=new Dg({props:{gjInput:JSON.parse(ci(e[2]).renderNeighbourhood()),onClickLine:e[3],$$slots:{"line-popup":[EA]},$$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(ci(i[2]).renderNeighbourhood())),r&8192&&(l.$$scope={dirty:r,ctx:i}),t.$set(l)},i(i){n||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function bA(e){let t,n;const i=[Mr("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=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","line-popup")},m(r,l){St(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||(dt(n.$$.fragment,r),i=!0)},o(r){vt(n.$$.fragment,r),i=!1},d(r){r&&wt(t),qt(n)}}}function IA(e){let t,n,i,r,l,f;const a=[vA,yA],_=[];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=_t("div"),i&&i.c(),r=Wt(),Zt(l.$$.fragment),Rt(t,"slot","map")},m(S,L){St(S,t,L),~n&&_[n].m(t,null),ht(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&&(hi(),vt(_[A],1,1,()=>{_[A]=null}),fi()),~n?(i=_[n],i?i.p(S,L):(i=_[n]=a[n](S),i.c()),dt(i,1),i.m(t,r)):i=null)},i(S){f||(dt(i),dt(l.$$.fragment,S),f=!0)},o(S){vt(i),vt(l.$$.fragment,S),f=!1},d(S){S&&wt(t),~n&&_[n].d(),qt(l)}}}function CA(e){let t,n,i,r;return t=new Xu({props:{$$slots:{map:[IA],sidebar:[_A],top:[dA]},$$scope:{ctx:e}}}),{c(){Zt(t.$$.fragment)},m(l,f){jt(t,l,f),n=!0,i||(r=Ge(cA,"keydown",e[4]),i=!0)},p(l,[f]){const a={};f&8199&&(a.$$scope={dirty:f,ctx:l}),t.$set(a)},i(l){n||(dt(t.$$.fragment,l),n=!0)},o(l){vt(t.$$.fragment,l),n=!1},d(l){qt(t,l),i=!1,r()}}}function TA(e,t,n){let i,r,l;Ee(e,En,F=>n(1,i=F)),Ee(e,Ru,F=>n(11,r=F)),Ee(e,Xo,F=>n(2,l=F));let f={state:"neutral"};function a(F){let U=JSON.parse(l.getShortcutsCrossingRoad(F.properties.id));if(U.features.length==0){window.alert("No shortcuts here");return}n(0,f={state:"chose-road",roadGj:F,gj:U,shortcutIndex:0})}dg(()=>{r==null||r.keyboard.disable()}),aa(()=>{r==null||r.keyboard.enable()});function _(F){f.state=="chose-road"&&(F.key=="ArrowLeft"&&f.shortcutIndex>0&&(F.stopPropagation(),n(0,f.shortcutIndex--,f)),F.key=="ArrowRight"&&(F.stopPropagation(),f.shortcutIndex!=f.gj.features.length-1&&n(0,f.shortcutIndex++,f)))}function x(){Ue(En,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"}),()=>Ue(En,i={mode:"title"},i),()=>Ue(En,i={mode:"network"},i)]}class LA extends tn{constructor(t){super(),Qe(this,t,TA,CA,He,{})}}function MA(e){let t,n,i,r,l,f,a,_;return l=new wk({}),{c(){t=_t("div"),n=_t("img"),r=Wt(),Zt(l.$$.fragment),f=Wt(),a=_t("span"),hr(n.src,i=qS)||Rt(n,"src",i),ri(n,"height","8vh"),ri(n,"margin-right","20px"),Rt(n,"alt","A/B Street logo"),ri(a,"width","100%"),Rt(t,"slot","top"),ri(t,"display","flex")},m(x,S){St(x,t,S),ht(t,n),ht(t,r),jt(l,t,null),ht(t,f),ht(t,a),e[16](a),_=!0},p:Me,i(x){_||(dt(l.$$.fragment,x),_=!0)},o(x){vt(l.$$.fragment,x),_=!1},d(x){x&&wt(t),qt(l),e[16](null)}}}function Ob(e){let t,n,i;return{c(){t=_t("button"),t.textContent="Zoom to fit study area",Rt(t,"class","secondary")},m(r,l){St(r,t,l),n||(i=Ge(t,"click",e[8]),n=!0)},p:Me,d(r){r&&wt(t),n=!1,i()}}}function PA(e){let t,n,i,r,l,f=e[5]&&Ob(e);return{c(){t=_t("div"),n=_t("div"),i=Wt(),r=_t("hr"),l=Wt(),f&&f.c(),Rt(t,"slot","left")},m(a,_){St(a,t,_),ht(t,n),e[15](n),ht(t,i),ht(t,r),ht(t,l),f&&f.m(t,null)},p(a,_){a[5]?f?f.p(a,_):(f=Ob(a),f.c(),f.m(t,null)):f&&(f.d(1),f=null)},d(a){a&&wt(t),e[15](null),f&&f.d()}}}function zb(e){let t,n;return t=new uA({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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function Fb(e){let t,n,i,r,l,f;t=new Ps({props:{data:JSON.parse(e[5].getInvertedBoundary()),$$slots:{default:[kA]},$$scope:{ctx:e}}});const a=[FA,zA,OA,RA,DA,NA,AA],_=[];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=Wt(),r&&r.c(),l=Do()},m(S,L){jt(t,S,L),St(S,n,L),~i&&_[i].m(S,L),St(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&&(hi(),vt(_[P],1,1,()=>{_[P]=null}),fi()),~i?(r=_[i],r?r.p(S,L):(r=_[i]=a[i](S),r.c()),dt(r,1),r.m(l.parentNode,l)):r=null)},i(S){f||(dt(t.$$.fragment,S),dt(r),f=!0)},o(S){vt(t.$$.fragment,S),vt(r),f=!1},d(S){S&&(wt(n),wt(l)),qt(t,S),~i&&_[i].d(S)}}}function kA(e){let t,n;const i=[Mr("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let r={};for(let l=0;l{_=null}),fi()),S[5]?x?(x.p(S,L),L&32&&dt(x,1)):(x=Fb(S),x.c(),dt(x,1),x.m(f.parentNode,f)):x&&(hi(),vt(x,1,1,()=>{x=null}),fi())},i(S){a||(dt(t.$$.fragment,S),dt(_),dt(x),a=!0)},o(S){vt(t.$$.fragment,S),vt(_),vt(x),a=!1},d(S){S&&(wt(n),wt(i),wt(r),wt(l),wt(f)),qt(t,S),e[12](null),_&&_.d(S),x&&x.d(S)}}}function VA(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:[BA]},$$scope:{ctx:e}};return e[0]!==void 0&&(f.map=e[0]),n=new XE({props:f}),cr.push(()=>vc(n,"map",l)),n.$on("error",e[14]),{c(){t=_t("div"),Zt(n.$$.fragment),Rt(t,"slot","main"),ri(t,"position","relative"),ri(t,"width","100%"),ri(t,"height","100%")},m(a,_){St(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||(dt(n.$$.fragment,a),r=!0)},o(a){vt(n.$$.fragment,a),r=!1},d(a){a&&wt(t),qt(n)}}}function UA(e){let t,n;return t=new aL({props:{$$slots:{main:[VA],left:[PA],top:[MA]},$$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||(dt(t.$$.fragment,i),n=!0)},o(i){vt(t.$$.fragment,i),n=!1},d(i){qt(t,i)}}}function GA(e,t,n){let i,r,l,f,a,_,x;Ee(e,ay,it=>n(9,i=it)),Ee(e,sy,it=>n(10,r=it)),Ee(e,oy,it=>n(11,l=it)),Ee(e,Xo,it=>n(5,f=it)),Ee(e,Ru,it=>n(17,a=it)),Ee(e,hx,it=>n(6,_=it)),Ee(e,En,it=>n(7,x=it));let S=!1;dg(async()=>{await Kb(),await Qb(),n(4,S=!0)});let L;function A(){a.fitBounds(Array.from(f.getBounds()),{animate:!1})}let P,D,F;function U(it){cr[it?"unshift":"push"](()=>{F=it,n(3,F),n(9,i)})}function Y(it){L=it,n(0,L)}const V=it=>{console.log(it.detail.error)};function Z(it){cr[it?"unshift":"push"](()=>{D=it,n(2,D),n(10,r)})}function K(it){cr[it?"unshift":"push"](()=>{P=it,n(1,P),n(11,l)})}return e.$$.update=()=>{e.$$.dirty&1&&L&&Ru.set(L),e.$$.dirty&2050&&P&&l&&(n(1,P.innerHTML="",P),P.appendChild(l)),e.$$.dirty&1028&&D&&r&&(n(2,D.innerHTML="",D),D.appendChild(r)),e.$$.dirty&520&&F&&i&&(n(3,F.innerHTML="",F),F.appendChild(i))},[L,P,D,F,S,f,_,x,A,i,r,l,U,Y,V,Z,K]}class jA extends tn{constructor(t){super(),Qe(this,t,GA,UA,He,{})}}new jA({target:document.getElementById("app")}); diff --git a/index.html b/index.html index a4fbfef..6119b86 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ LTN from scratch - +