From 30a8e717fe54321e296a0b4149877e62e1853e5c Mon Sep 17 00:00:00 2001 From: dabreegster Date: Sun, 8 Dec 2024 16:00:03 +0000 Subject: [PATCH] deploy: 67ecd3fde46cf2ee197e8e11efee58a519d5a90b --- assets/{main-bf56b08d.js => main-fcccaf9d.js} | 144 +++++++++--------- index.html | 2 +- 2 files changed, 73 insertions(+), 73 deletions(-) rename assets/{main-bf56b08d.js => main-fcccaf9d.js} (81%) diff --git a/assets/main-bf56b08d.js b/assets/main-fcccaf9d.js similarity index 81% rename from assets/main-bf56b08d.js rename to assets/main-fcccaf9d.js index 645d82f..a8c40ff 100644 --- a/assets/main-bf56b08d.js +++ b/assets/main-fcccaf9d.js @@ -1,9 +1,9 @@ -var OP=Object.defineProperty;var zP=(t,e,n)=>e in t?OP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ai=(t,e,n)=>(zP(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Ct(){}function oi(t,e){for(const n in e)t[n]=e[n];return t}function PE(t){return t()}function qx(){return Object.create(null)}function Yr(t){t.forEach(PE)}function X_(t){return typeof t=="function"}function Ut(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ng;function ai(t,e){return t===e?!0:(Ng||(Ng=document.createElement("a")),Ng.href=e,t===Ng.href)}function FP(t){return Object.keys(t).length===0}function ME(t,...e){if(t==null){for(const r of e)r(void 0);return Ct}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Fs(t){let e;return ME(t,n=>e=n)(),e}function vt(t,e,n){t.$$.on_destroy.push(ME(e,n))}function gr(t,e,n,r){if(t){const i=AE(t,e,n,r);return t[0](i)}}function AE(t,e,n,r){return t[1]&&r?oi(n.ctx.slice(),t[1](r(e))):n.ctx}function _r(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],c=Math.max(e.dirty.length,i.length);for(let l=0;l32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function kE(t){return function(e){return e.preventDefault(),t.call(this,e)}}function k0(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Le(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function VP(t){let e;return{p(...n){e=n,e.forEach(r=>t.push(r))},r(){e.forEach(n=>t.splice(t.indexOf(n),1))}}}function f1(t){return t===""?null:+t}function UP(t){return Array.from(t.childNodes)}function Hn(t,e){e=""+e,t.data!==e&&(t.data=e)}function vo(t,e){t.value=e??""}function lr(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function h_(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const s=jP(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,s)}),!s.defaultPrevented}return!0}}function p1(t,e){return gm().$$.context.set(t,e),e}function RE(t){return gm().$$.context.get(t)}function gn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const xf=[],si=[];let Tf=[];const fv=[],NE=Promise.resolve();let pv=!1;function OE(){pv||(pv=!0,NE.then(FE))}function zE(){return OE(),NE}function Xd(t){Tf.push(t)}function El(t){fv.push(t)}const D0=new Set;let df=0;function FE(){if(df!==0)return;const t=Zd;do{try{for(;dft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Tf=e}const $g=new Set;let qc;function kn(){qc={r:0,c:[],p:qc}}function Dn(){qc.r||Yr(qc.c),qc=qc.p}function se(t,e){t&&t.i&&($g.delete(t),t.i(e))}function de(t,e,n,r){if(t&&t.o){if($g.has(t))return;$g.add(t),qc.c.push(()=>{$g.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function zo(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function WP(t,e){de(t,1,1,()=>{e.delete(t.key)})}function HP(t,e,n,r,i,s,c,l,d,v,S,E){let C=t.length,M=s.length,k=C;const R={};for(;k--;)R[t[k].key]=k;const N=[],B=new Map,F=new Map,G=[];for(k=M;k--;){const ae=E(i,s,k),le=n(ae);let ve=c.get(le);ve?r&&G.push(()=>ve.p(ae,e)):(ve=v(le,ae),ve.c()),B.set(le,N[k]=ve),le in R&&F.set(le,Math.abs(k-R[le]))}const H=new Set,K=new Set;function _e(ae){se(ae,1),ae.m(l,S),c.set(ae.key,ae),S=ae.first,M--}for(;C&&M;){const ae=N[M-1],le=t[C-1],ve=ae.key,ke=le.key;ae===le?(S=ae.first,C--,M--):B.has(ke)?!c.has(ve)||H.has(ve)?_e(ae):K.has(ke)?C--:F.get(ve)>F.get(ke)?(K.add(ve),_e(ae)):(H.add(ke),C--):(d(le,c),C--)}for(;C--;){const ae=t[C];B.has(ae.key)||d(ae,c)}for(;M;)_e(N[M-1]);return Yr(G),N}function Y_(t,e){const n={},r={},i={$$scope:1};let s=t.length;for(;s--;){const c=t[s],l=e[s];if(l){for(const d in c)d in l||(r[d]=1);for(const d in l)i[d]||(n[d]=l[d],i[d]=1);t[s]=l}else for(const d in c)i[d]=1}for(const c in r)c in n||(n[c]=void 0);return n}function Il(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function je(t){t&&t.c()}function Be(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Xd(()=>{const s=t.$$.on_mount.map(PE).filter(X_);t.$$.on_destroy?t.$$.on_destroy.push(...s):Yr(s),t.$$.on_mount=[]}),i.forEach(Xd)}function Ve(t,e){const n=t.$$;n.fragment!==null&&(qP(n.after_update),Yr(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function ZP(t,e){t.$$.dirty[0]===-1&&(xf.push(t),OE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=M.length?M[0]:C;return v.ctx&&i(v.ctx[E],v.ctx[E]=k)&&(!v.skip_bound&&v.bound[E]&&v.bound[E](k),S&&ZP(t,E)),C}):[],v.update(),S=!0,Yr(v.before_update),v.fragment=r?r(v.ctx):!1,e.target){if(e.hydrate){const E=UP(e.target);v.fragment&&v.fragment.l(E),E.forEach(ye)}else v.fragment&&v.fragment.c();e.intro&&se(t.$$.fragment),Be(t,e.target,e.anchor),FE()}Fd(d)}class Zt{constructor(){Ai(this,"$$");Ai(this,"$$set")}$destroy(){Ve(this,1),this.$destroy=Ct}$on(e,n){if(!X_(n))return Ct;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!FP(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const XP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(XP);function Wx(t){let e,n;return{c(){e=ge("div"),n=nt(t[0]),Le(e,"class","svelte-1uuov7f")},m(r,i){be(r,e,i),te(e,n)},p(r,i){i&1&&Hn(n,r[0])},d(r){r&&ye(e)}}}function $P(t){let e,n=t[0]&&Wx(t);return{c(){n&&n.c(),e=Pi()},m(r,i){n&&n.m(r,i),be(r,e,i)},p(r,[i]){r[0]?n?n.p(r,i):(n=Wx(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:Ct,o:Ct,d(r){r&&ye(e),n&&n.d(r)}}}function YP(t,e,n){let{loading:r}=e;return t.$$set=i=>{"loading"in i&&n(0,r=i.loading)},[r]}class BE extends Zt{constructor(e){super(),Ht(this,e,YP,$P,Ut,{loading:0})}}const KP=t=>({dialog:t&1}),Hx=t=>({dialog:t[0]});function JP(t){let e,n,r,i,s;const c=t[4].default,l=gr(c,t,t[3],Hx);return{c(){e=ge("dialog"),n=ge("article"),l&&l.c(),e.open=!0},m(d,v){be(d,e,v),te(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(s=[Lt(window,"click",t[1]),Lt(window,"keydown",t[2]),Lt(e,"close",t[5])],i=!0)},p(d,[v]){l&&l.p&&(!r||v&9)&&yr(l,c,d,d[3],r?_r(c,d[3],v,KP):vr(d[3]),Hx)},i(d){r||(se(l,d),r=!0)},o(d){de(l,d),r=!1},d(d){d&&ye(e),l&&l.d(d),t[6](null),i=!1,Yr(s)}}}function QP(t,e,n){let{$$slots:r={},$$scope:i}=e,s;function c(S){s.open&&S.target==s&&s.close()}function l(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),s.close())}function d(S){gn.call(this,t,S)}function v(S){si[S?"unshift":"push"](()=>{s=S,n(0,s)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[s,c,l,i,r,d,v]}class K_ extends Zt{constructor(e){super(),Ht(this,e,QP,JP,Ut,{})}}function Zx(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function Xx(t){let e,n,r=t[1]+"",i,s,c,l=t[2]+"",d,v;return{c(){e=ge("tr"),n=ge("td"),i=nt(r),s=We(),c=ge("td"),d=nt(l),v=We()},m(S,E){be(S,e,E),te(e,n),te(n,i),te(e,s),te(e,c),te(c,d),te(e,v)},p(S,E){E&1&&r!==(r=S[1]+"")&&Hn(i,r),E&1&&l!==(l=S[2]+"")&&Hn(d,l)},d(S){S&&ye(e)}}}function eM(t){let e,n,r=zo(Object.entries(t[0])),i=[];for(let s=0;s{"properties"in i&&n(0,r=i.properties)},[r]}class J_ extends Zt{constructor(e){super(),Ht(this,e,tM,eM,Ut,{properties:0})}}function f_(t,e){let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function kr(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}let at;const VE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&VE.decode();let Cd=null;function Lf(){return(Cd===null||Cd.byteLength===0)&&(Cd=new Uint8Array(at.memory.buffer)),Cd}function gs(t,e){return t=t>>>0,VE.decode(Lf().subarray(t,t+e))}const nu=new Array(128).fill(void 0);nu.push(void 0,null,!0,!1);let Bd=nu.length;function ar(t){Bd===nu.length&&nu.push(nu.length+1);const e=Bd;return Bd=nu[e],nu[e]=t,e}function yn(t){return nu[t]}function nM(t){t<132||(nu[t]=Bd,Bd=t)}function Do(t){const e=yn(t);return nM(t),e}let es=0;const Yg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},rM=typeof Yg.encodeInto=="function"?function(t,e){return Yg.encodeInto(t,e)}:function(t,e){const n=Yg.encode(t);return e.set(n),{read:t.length,written:n.length}};function Ba(t,e,n){if(n===void 0){const l=Yg.encode(t),d=e(l.length,1)>>>0;return Lf().subarray(d,d+l.length).set(l),es=l.length,d}let r=t.length,i=e(r,1)>>>0;const s=Lf();let c=0;for(;c127)break;s[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=Lf().subarray(i+c,i+r),d=rM(t,l);c+=d.written}return es=c,i}function wf(t){return t==null}let Td=null;function Wt(){return(Td===null||Td.byteLength===0)&&(Td=new Int32Array(at.memory.buffer)),Td}let Ld=null;function UE(){return(Ld===null||Ld.byteLength===0)&&(Ld=new Float64Array(at.memory.buffer)),Ld}let Pd=null;function iM(){return(Pd===null||Pd.byteLength===0)&&(Pd=new BigInt64Array(at.memory.buffer)),Pd}function dv(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=dv(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +var OP=Object.defineProperty;var zP=(t,e,n)=>e in t?OP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ai=(t,e,n)=>(zP(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Ct(){}function $r(t,e){for(const n in e)t[n]=e[n];return t}function PE(t){return t()}function qx(){return Object.create(null)}function Kr(t){t.forEach(PE)}function X_(t){return typeof t=="function"}function Ut(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ng;function li(t,e){return t===e?!0:(Ng||(Ng=document.createElement("a")),Ng.href=e,t===Ng.href)}function FP(t){return Object.keys(t).length===0}function ME(t,...e){if(t==null){for(const r of e)r(void 0);return Ct}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Fs(t){let e;return ME(t,n=>e=n)(),e}function vt(t,e,n){t.$$.on_destroy.push(ME(e,n))}function gr(t,e,n,r){if(t){const i=AE(t,e,n,r);return t[0](i)}}function AE(t,e,n,r){return t[1]&&r?$r(n.ctx.slice(),t[1](r(e))):n.ctx}function _r(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],c=Math.max(e.dirty.length,i.length);for(let l=0;l32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function kE(t){return function(e){return e.preventDefault(),t.call(this,e)}}function k0(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Le(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function VP(t){let e;return{p(...n){e=n,e.forEach(r=>t.push(r))},r(){e.forEach(n=>t.splice(t.indexOf(n),1))}}}function f1(t){return t===""?null:+t}function UP(t){return Array.from(t.childNodes)}function Hn(t,e){e=""+e,t.data!==e&&(t.data=e)}function vo(t,e){t.value=e??""}function lr(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function h_(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const s=jP(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,s)}),!s.defaultPrevented}return!0}}function p1(t,e){return gm().$$.context.set(t,e),e}function RE(t){return gm().$$.context.get(t)}function gn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const xf=[],si=[];let Tf=[];const fv=[],NE=Promise.resolve();let pv=!1;function OE(){pv||(pv=!0,NE.then(FE))}function zE(){return OE(),NE}function Xd(t){Tf.push(t)}function El(t){fv.push(t)}const D0=new Set;let df=0;function FE(){if(df!==0)return;const t=Zd;do{try{for(;dft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Tf=e}const $g=new Set;let qc;function kn(){qc={r:0,c:[],p:qc}}function Dn(){qc.r||Kr(qc.c),qc=qc.p}function se(t,e){t&&t.i&&($g.delete(t),t.i(e))}function me(t,e,n,r){if(t&&t.o){if($g.has(t))return;$g.add(t),qc.c.push(()=>{$g.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function zo(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function WP(t,e){me(t,1,1,()=>{e.delete(t.key)})}function HP(t,e,n,r,i,s,c,l,d,v,S,E){let C=t.length,M=s.length,k=C;const R={};for(;k--;)R[t[k].key]=k;const F=[],U=new Map,z=new Map,G=[];for(k=M;k--;){const ae=E(i,s,k),le=n(ae);let ye=c.get(le);ye?r&&G.push(()=>ye.p(ae,e)):(ye=v(le,ae),ye.c()),U.set(le,F[k]=ye),le in R&&z.set(le,Math.abs(k-R[le]))}const q=new Set,X=new Set;function de(ae){se(ae,1),ae.m(l,S),c.set(ae.key,ae),S=ae.first,M--}for(;C&&M;){const ae=F[M-1],le=t[C-1],ye=ae.key,ke=le.key;ae===le?(S=ae.first,C--,M--):U.has(ke)?!c.has(ye)||q.has(ye)?de(ae):X.has(ke)?C--:z.get(ye)>z.get(ke)?(X.add(ye),de(ae)):(q.add(ke),C--):(d(le,c),C--)}for(;C--;){const ae=t[C];U.has(ae.key)||d(ae,c)}for(;M;)de(F[M-1]);return Kr(G),F}function Y_(t,e){const n={},r={},i={$$scope:1};let s=t.length;for(;s--;){const c=t[s],l=e[s];if(l){for(const d in c)d in l||(r[d]=1);for(const d in l)i[d]||(n[d]=l[d],i[d]=1);t[s]=l}else for(const d in c)i[d]=1}for(const c in r)c in n||(n[c]=void 0);return n}function Il(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function Ue(t){t&&t.c()}function Be(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Xd(()=>{const s=t.$$.on_mount.map(PE).filter(X_);t.$$.on_destroy?t.$$.on_destroy.push(...s):Kr(s),t.$$.on_mount=[]}),i.forEach(Xd)}function Ve(t,e){const n=t.$$;n.fragment!==null&&(qP(n.after_update),Kr(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function ZP(t,e){t.$$.dirty[0]===-1&&(xf.push(t),OE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=M.length?M[0]:C;return v.ctx&&i(v.ctx[E],v.ctx[E]=k)&&(!v.skip_bound&&v.bound[E]&&v.bound[E](k),S&&ZP(t,E)),C}):[],v.update(),S=!0,Kr(v.before_update),v.fragment=r?r(v.ctx):!1,e.target){if(e.hydrate){const E=UP(e.target);v.fragment&&v.fragment.l(E),E.forEach(ve)}else v.fragment&&v.fragment.c();e.intro&&se(t.$$.fragment),Be(t,e.target,e.anchor),FE()}Fd(d)}class Zt{constructor(){Ai(this,"$$");Ai(this,"$$set")}$destroy(){Ve(this,1),this.$destroy=Ct}$on(e,n){if(!X_(n))return Ct;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!FP(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const XP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(XP);function Wx(t){let e,n;return{c(){e=_e("div"),n=nt(t[0]),Le(e,"class","svelte-1uuov7f")},m(r,i){be(r,e,i),te(e,n)},p(r,i){i&1&&Hn(n,r[0])},d(r){r&&ve(e)}}}function $P(t){let e,n=t[0]&&Wx(t);return{c(){n&&n.c(),e=Pi()},m(r,i){n&&n.m(r,i),be(r,e,i)},p(r,[i]){r[0]?n?n.p(r,i):(n=Wx(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:Ct,o:Ct,d(r){r&&ve(e),n&&n.d(r)}}}function YP(t,e,n){let{loading:r}=e;return t.$$set=i=>{"loading"in i&&n(0,r=i.loading)},[r]}class BE extends Zt{constructor(e){super(),Ht(this,e,YP,$P,Ut,{loading:0})}}const KP=t=>({dialog:t&1}),Hx=t=>({dialog:t[0]});function JP(t){let e,n,r,i,s;const c=t[4].default,l=gr(c,t,t[3],Hx);return{c(){e=_e("dialog"),n=_e("article"),l&&l.c(),e.open=!0},m(d,v){be(d,e,v),te(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(s=[Lt(window,"click",t[1]),Lt(window,"keydown",t[2]),Lt(e,"close",t[5])],i=!0)},p(d,[v]){l&&l.p&&(!r||v&9)&&yr(l,c,d,d[3],r?_r(c,d[3],v,KP):vr(d[3]),Hx)},i(d){r||(se(l,d),r=!0)},o(d){me(l,d),r=!1},d(d){d&&ve(e),l&&l.d(d),t[6](null),i=!1,Kr(s)}}}function QP(t,e,n){let{$$slots:r={},$$scope:i}=e,s;function c(S){s.open&&S.target==s&&s.close()}function l(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),s.close())}function d(S){gn.call(this,t,S)}function v(S){si[S?"unshift":"push"](()=>{s=S,n(0,s)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[s,c,l,i,r,d,v]}class K_ extends Zt{constructor(e){super(),Ht(this,e,QP,JP,Ut,{})}}function Zx(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function Xx(t){let e,n,r=t[1]+"",i,s,c,l=t[2]+"",d,v;return{c(){e=_e("tr"),n=_e("td"),i=nt(r),s=We(),c=_e("td"),d=nt(l),v=We()},m(S,E){be(S,e,E),te(e,n),te(n,i),te(e,s),te(e,c),te(c,d),te(e,v)},p(S,E){E&1&&r!==(r=S[1]+"")&&Hn(i,r),E&1&&l!==(l=S[2]+"")&&Hn(d,l)},d(S){S&&ve(e)}}}function eM(t){let e,n,r=zo(Object.entries(t[0])),i=[];for(let s=0;s{"properties"in i&&n(0,r=i.properties)},[r]}class J_ extends Zt{constructor(e){super(),Ht(this,e,tM,eM,Ut,{properties:0})}}function f_(t,e){let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function kr(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}let at;const VE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&VE.decode();let Cd=null;function Lf(){return(Cd===null||Cd.byteLength===0)&&(Cd=new Uint8Array(at.memory.buffer)),Cd}function gs(t,e){return t=t>>>0,VE.decode(Lf().subarray(t,t+e))}const nu=new Array(128).fill(void 0);nu.push(void 0,null,!0,!1);let Bd=nu.length;function ar(t){Bd===nu.length&&nu.push(nu.length+1);const e=Bd;return Bd=nu[e],nu[e]=t,e}function yn(t){return nu[t]}function nM(t){t<132||(nu[t]=Bd,Bd=t)}function Do(t){const e=yn(t);return nM(t),e}let es=0;const Yg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},rM=typeof Yg.encodeInto=="function"?function(t,e){return Yg.encodeInto(t,e)}:function(t,e){const n=Yg.encode(t);return e.set(n),{read:t.length,written:n.length}};function Ba(t,e,n){if(n===void 0){const l=Yg.encode(t),d=e(l.length,1)>>>0;return Lf().subarray(d,d+l.length).set(l),es=l.length,d}let r=t.length,i=e(r,1)>>>0;const s=Lf();let c=0;for(;c127)break;s[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=Lf().subarray(i+c,i+r),d=rM(t,l);c+=d.written}return es=c,i}function wf(t){return t==null}let Td=null;function Wt(){return(Td===null||Td.byteLength===0)&&(Td=new Int32Array(at.memory.buffer)),Td}let Ld=null;function UE(){return(Ld===null||Ld.byteLength===0)&&(Ld=new Float64Array(at.memory.buffer)),Ld}let Pd=null;function iM(){return(Pd===null||Pd.byteLength===0)&&(Pd=new BigInt64Array(at.memory.buffer)),Pd}function dv(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=dv(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} ${t.stack}`:r}function oM(t,e){const n=e(t.length*1,1)>>>0;return Lf().set(t,n/1),es=t.length,n}function sM(t,e){return t=t>>>0,UE().subarray(t/8,t/8+e)}function aM(t,e){return t=t>>>0,Lf().subarray(t/1,t/1+e)}function Gc(t,e){try{return t.apply(this,e)}catch(n){at.__wbindgen_exn_store(ar(n))}}class jE{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();at.__wbg_ltn_free(e)}constructor(e,n,r){try{const v=at.__wbindgen_add_to_stack_pointer(-16),S=oM(e,at.__wbindgen_malloc),E=es;var i=wf(r)?0:Ba(r,at.__wbindgen_malloc,at.__wbindgen_realloc),s=es;at.ltn_new(v,S,E,ar(n),i,s);var c=Wt()[v/4+0],l=Wt()[v/4+1],d=Wt()[v/4+2];if(d)throw Do(l);return this.__wbg_ptr=c>>>0,this}finally{at.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_getInvertedBoundary(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}getBounds(){try{const i=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_getBounds(i,this.__wbg_ptr);var e=Wt()[i/4+0],n=Wt()[i/4+1],r=sM(e,n).slice();return at.__wbindgen_free(e,n*8,8),r}finally{at.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const i=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_toRouteSnapper(i,this.__wbg_ptr);var e=Wt()[i/4+0],n=Wt()[i/4+1],r=aM(e,n).slice();return at.__wbindgen_free(e,n*1,1),r}finally{at.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_toRouteSnapperGj(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}renderModalFilters(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_renderModalFilters(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}renderNeighbourhood(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_renderNeighbourhood(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}renderAutoBoundaries(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_renderAutoBoundaries(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}setNeighbourhoodBoundary(e,n){try{const s=at.__wbindgen_add_to_stack_pointer(-16),c=Ba(e,at.__wbindgen_malloc,at.__wbindgen_realloc),l=es;at.ltn_setNeighbourhoodBoundary(s,this.__wbg_ptr,c,l,ar(n));var r=Wt()[s/4+0],i=Wt()[s/4+1];if(i)throw Do(r)}finally{at.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(e){const n=Ba(e,at.__wbindgen_malloc,at.__wbindgen_realloc),r=es;at.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,n,r)}renameNeighbourhoodBoundary(e,n){const r=Ba(e,at.__wbindgen_malloc,at.__wbindgen_realloc),i=es,s=Ba(n,at.__wbindgen_malloc,at.__wbindgen_realloc),c=es;at.ltn_renameNeighbourhoodBoundary(this.__wbg_ptr,r,i,s,c)}setCurrentNeighbourhood(e){try{const i=at.__wbindgen_add_to_stack_pointer(-16),s=Ba(e,at.__wbindgen_malloc,at.__wbindgen_realloc),c=es;at.ltn_setCurrentNeighbourhood(i,this.__wbg_ptr,s,c);var n=Wt()[i/4+0],r=Wt()[i/4+1];if(r)throw Do(n)}finally{at.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(e,n){try{const s=at.__wbindgen_add_to_stack_pointer(-16),c=Ba(n,at.__wbindgen_malloc,at.__wbindgen_realloc),l=es;at.ltn_addModalFilter(s,this.__wbg_ptr,ar(e),c,l);var r=Wt()[s/4+0],i=Wt()[s/4+1];if(i)throw Do(r)}finally{at.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(e,n){try{const s=at.__wbindgen_add_to_stack_pointer(-16),c=Ba(n,at.__wbindgen_malloc,at.__wbindgen_realloc),l=es;at.ltn_addManyModalFilters(s,this.__wbg_ptr,ar(e),c,l);var r=Wt()[s/4+0],i=Wt()[s/4+1];if(i)throw Do(r)}finally{at.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(e){at.ltn_deleteModalFilter(this.__wbg_ptr,e)}toggleDirection(e){at.ltn_toggleDirection(this.__wbg_ptr,e)}undo(){at.ltn_undo(this.__wbg_ptr)}redo(){at.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(e){let n,r;try{const S=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,e);var i=Wt()[S/4+0],s=Wt()[S/4+1],c=Wt()[S/4+2],l=Wt()[S/4+3],d=i,v=s;if(l)throw d=0,v=0,Do(c);return n=d,r=v,gs(d,v)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(n,r,1)}}getAllShortcuts(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_getAllShortcuts(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}toSavefile(){let e,n;try{const v=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_toSavefile(v,this.__wbg_ptr);var r=Wt()[v/4+0],i=Wt()[v/4+1],s=Wt()[v/4+2],c=Wt()[v/4+3],l=r,d=i;if(c)throw l=0,d=0,Do(s);return e=l,n=d,gs(l,d)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(e,n,1)}}loadSavefile(e){try{const i=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_loadSavefile(i,this.__wbg_ptr,ar(e));var n=Wt()[i/4+0],r=Wt()[i/4+1];if(r)throw Do(n)}finally{at.__wbindgen_add_to_stack_pointer(16)}}compareRoute(e,n,r,i,s){let c,l;try{const k=at.__wbindgen_add_to_stack_pointer(-16);at.ltn_compareRoute(k,this.__wbg_ptr,e,n,r,i,s);var d=Wt()[k/4+0],v=Wt()[k/4+1],S=Wt()[k/4+2],E=Wt()[k/4+3],C=d,M=v;if(E)throw C=0,M=0,Do(S);return c=C,l=M,gs(C,M)}finally{at.__wbindgen_add_to_stack_pointer(16),at.__wbindgen_free(c,l,1)}}}async function lM(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.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",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function uM(){const t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(gs(e,n));return ar(r)},t.wbg.__wbindgen_object_drop_ref=function(e){Do(e)},t.wbg.__wbindgen_string_get=function(e,n){const r=yn(n),i=typeof r=="string"?r:void 0;var s=wf(i)?0:Ba(i,at.__wbindgen_malloc,at.__wbindgen_realloc),c=es;Wt()[e/4+1]=c,Wt()[e/4+0]=s},t.wbg.__wbindgen_boolean_get=function(e){const n=yn(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_bigint=function(e){return typeof yn(e)=="bigint"},t.wbg.__wbindgen_number_get=function(e,n){const r=yn(n),i=typeof r=="number"?r:void 0;UE()[e/8+1]=wf(i)?0:i,Wt()[e/4+0]=!wf(i)},t.wbg.__wbindgen_is_object=function(e){const n=yn(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_in=function(e,n){return yn(e)in yn(n)},t.wbg.__wbindgen_bigint_from_i64=function(e){return ar(e)},t.wbg.__wbindgen_jsval_eq=function(e,n){return yn(e)===yn(n)},t.wbg.__wbindgen_bigint_from_u64=function(e){const n=BigInt.asUintN(64,e);return ar(n)},t.wbg.__wbindgen_is_undefined=function(e){return yn(e)===void 0},t.wbg.__wbindgen_string_new=function(e,n){const r=gs(e,n);return ar(r)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return yn(e)==yn(n)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=yn(e);return ar(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=yn(e)[yn(n)];return ar(r)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(yn(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(yn(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(yn(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(yn(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(yn(e))},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return ar(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=yn(n).stack,i=Ba(r,at.__wbindgen_malloc,at.__wbindgen_realloc),s=es;Wt()[e/4+1]=s,Wt()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(gs(e,n))}finally{at.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_3f3012faa4463882=function(e){const n=yn(e).performance;return ar(n)},t.wbg.__wbg_now_2fd65358804c9485=function(e){return yn(e).now()},t.wbg.__wbg_get_f01601b5a68d10e3=function(e,n){const r=yn(e)[n>>>0];return ar(r)},t.wbg.__wbg_length_1009b1af0c481d7b=function(e){return yn(e).length},t.wbg.__wbindgen_is_function=function(e){return typeof yn(e)=="function"},t.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(e,n){const r=new Function(gs(e,n));return ar(r)},t.wbg.__wbg_next_9b877f231f476d01=function(e){const n=yn(e).next;return ar(n)},t.wbg.__wbg_next_6529ee0cca8d57ed=function(){return Gc(function(e){const n=yn(e).next();return ar(n)},arguments)},t.wbg.__wbg_done_5fe336b092d60cf2=function(e){return yn(e).done},t.wbg.__wbg_value_0c248a78fdc8e19f=function(e){const n=yn(e).value;return ar(n)},t.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return ar(Symbol.iterator)},t.wbg.__wbg_get_7b48513de5dc5ea4=function(){return Gc(function(e,n){const r=Reflect.get(yn(e),yn(n));return ar(r)},arguments)},t.wbg.__wbg_call_90c26b09837aba1c=function(){return Gc(function(e,n){const r=yn(e).call(yn(n));return ar(r)},arguments)},t.wbg.__wbg_self_f0e34d89f33b99fd=function(){return Gc(function(){const e=self.self;return ar(e)},arguments)},t.wbg.__wbg_window_d3b084224f4774d7=function(){return Gc(function(){const e=window.window;return ar(e)},arguments)},t.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return Gc(function(){const e=globalThis.globalThis;return ar(e)},arguments)},t.wbg.__wbg_global_35dfdd59a4da3e74=function(){return Gc(function(){const e=global.global;return ar(e)},arguments)},t.wbg.__wbg_isArray_74fb723e24f76012=function(e){return Array.isArray(yn(e))},t.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(e){let n;try{n=yn(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(e){return Number.isSafeInteger(yn(e))},t.wbg.__wbg_entries_9e2e2aa45aa5094a=function(e){const n=Object.entries(yn(e));return ar(n)},t.wbg.__wbg_buffer_a448f833075b71ba=function(e){const n=yn(e).buffer;return ar(n)},t.wbg.__wbg_new_8f67e318f15d7254=function(e){const n=new Uint8Array(yn(e));return ar(n)},t.wbg.__wbg_set_2357bf09366ee480=function(e,n,r){yn(e).set(yn(n),r>>>0)},t.wbg.__wbg_length_1d25fa9e4ac21ce7=function(e){return yn(e).length},t.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(e){let n;try{n=yn(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=yn(n),i=typeof r=="bigint"?r:void 0;iM()[e/8+1]=wf(i)?BigInt(0):i,Wt()[e/4+0]=!wf(i)},t.wbg.__wbindgen_debug_string=function(e,n){const r=dv(yn(n)),i=Ba(r,at.__wbindgen_malloc,at.__wbindgen_realloc),s=es;Wt()[e/4+1]=s,Wt()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(gs(e,n))},t.wbg.__wbindgen_memory=function(){const e=at.memory;return ar(e)},t}function cM(t,e){return at=t.exports,GE.__wbindgen_wasm_module=e,Pd=null,Ld=null,Td=null,Cd=null,at}async function GE(t){if(at!==void 0)return at;typeof t>"u"&&(t="/ltn/assets/backend_bg.wasm");const e=uM();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await lM(await t,e);return cM(n,r)}var _m=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Q_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var qE={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.1.3/LICENSE.txt - */(function(t,e){(function(n,r){t.exports=r()})(_m,function(){var n={},r={};function i(c,l,d){if(r[c]=d,c==="index"){var v="var sharedModule = {}; ("+r.shared+")(sharedModule); ("+r.worker+")(sharedModule);",S={};return r.shared(S),r.index(n,S),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([v],{type:"text/javascript"}))),n}}i("shared",["exports"],function(c){function l(u,o,h,p){return new(h||(h=Promise))(function(_,x){function w(D){try{P(p.next(D))}catch(z){x(z)}}function I(D){try{P(p.throw(D))}catch(z){x(z)}}function P(D){var z;D.done?_(D.value):(z=D.value,z instanceof h?z:new h(function(V){V(z)})).then(w,I)}P((p=p.apply(u,o||[])).next())})}function d(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}typeof SuppressedError=="function"&&SuppressedError;var v=S;function S(u,o){this.x=u,this.y=o}S.prototype={clone:function(){return new S(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,h=u.y-this.y;return o*o+h*h},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),h=Math.sin(u),p=h*this.x+o*this.y;return this.x=o*this.x-h*this.y,this.y=p,this},_rotateAround:function(u,o){var h=Math.cos(u),p=Math.sin(u),_=o.y+p*(this.x-o.x)+h*(this.y-o.y);return this.x=o.x+h*(this.x-o.x)-p*(this.y-o.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(u){return u instanceof S?u:Array.isArray(u)?new S(u[0],u[1]):u};var E=d(v),C=M;function M(u,o,h,p){this.cx=3*u,this.bx=3*(h-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=h,this.p2y=p}M.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 h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?w=h:I=h,h=.5*(I-w)+w;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var k=d(C);let R,N;function B(){return R==null&&(R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),R}function F(){if(N==null&&(N=!1,B())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const _=4*p;o.fillStyle=`rgb(${_},${_+1},${_+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){N=!0;break}}}return N||!1}function G(u,o,h,p){const _=new k(u,o,h,p);return function(x){return _.solve(x)}}const H=G(.25,.1,.25,1);function K(u,o,h){return Math.min(h,Math.max(o,u))}function _e(u,o,h){const p=h-o,_=((u-o)%p+p)%p+o;return _===o?h:_}function ae(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let le=1;function ve(u,o,h){const p={};for(const _ in u)p[_]=o.call(h||this,u[_],_,u);return p}function ke(u,o,h){const p={};for(const _ in u)o.call(h||this,u[_],_,u)&&(p[_]=u[_]);return p}function Q(u){return Array.isArray(u)?u.map(Q):typeof u=="object"&&u?ve(u,Q):u}const oe={};function qe(u){oe[u]||(typeof console<"u"&&console.warn(u),oe[u]=!0)}function Pe(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function it(u){let o=0;for(let h,p,_=0,x=u.length,w=x-1;_"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(u,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const I=w.startsWith("BGR"),P=new Uint8ClampedArray(p*_*4);if(yield x.copyTo(P,function(D,z,V,W,X){const Y=4*Math.max(-z,0),ie=(Math.max(0,V)-V)*W*4+Y,fe=4*W,we=Math.max(0,z),Oe=Math.max(0,V);return{rect:{x:we,y:Oe,width:Math.min(D.width,z+W)-we,height:Math.min(D.height,V+X)-Oe},layout:[{offset:ie,stride:fe}]}}(u,o,h,p,_)),I)for(let D=0;Dft(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Jn=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=pn(u.url);if(p)return p(u,o);if(ft(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Nn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test(Nr())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(this,void 0,void 0,function*(){const x=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Nr(),signal:_.signal});p.type==="json"&&x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const D=yield w.blob();throw new En(w.status,w.statusText,p.url,D)}let I;I=p.type==="arrayBuffer"||p.type==="image"?w.arrayBuffer():p.type==="json"?w.json():w.text();const P=yield I;if(_.signal.aborted)throw Rn();return{data:P,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(u,o);if(ft(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Nn},o)}var h;return function(p,_){return new Promise((x,w)=>{const I=new XMLHttpRequest;I.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(I.responseType="arraybuffer");for(const P in p.headers)I.setRequestHeader(P,p.headers[P]);p.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=p.credentials==="include",I.onerror=()=>{w(new Error(I.statusText))},I.onload=()=>{if(!_.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let P=I.response;if(p.type==="json")try{P=JSON.parse(I.response)}catch(D){return void w(D)}x({data:P,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const P=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});w(new En(I.status,I.statusText,p.url,P))}},_.signal.addEventListener("abort",()=>{I.abort(),w(Rn())}),I.send(p.body)})}(u,o)};function On(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function Qn(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function ne(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Ce{constructor(o,h={}){ae(this,h),this.type=o}}class ot extends Ce{constructor(o,h={}){super("error",ae({error:o},h))}}class kt{on(o,h){return this._listeners=this._listeners||{},Qn(o,h,this._listeners),this}off(o,h){return ne(o,h,this._listeners),ne(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Qn(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Ce(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const I of _)I.call(this,o);const x=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const I of x)ne(p,I,this._oneTimeListeners),I.call(this,o);const w=this._eventedParent;w&&(ae(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof ot&&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,h){return this._eventedParent=o,this._eventedParentData=h,this}}var Re={$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"},sky:{type:"sky"},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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 on=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function qr(u,o){const h={};for(const p in u)p!=="ref"&&(h[p]=u[p]);return on.forEach(p=>{p in o&&(h[p]=o[p])}),h}function _n(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let h=0;h`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Te=[ui,pt,un,an,Wr,Kr,cs,J(sn),pe,q,Z];function ee(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!ee(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 h of Te)if(!ee(h,o))return null}}return`Expected ${ue(u)} but found ${ue(o)} instead.`}function Me(u,o){return o.some(h=>h.kind===u.kind)}function Se(u,o){return o.some(h=>h==="null"?u===null:h==="array"?Array.isArray(u):h==="object"?u&&!Array.isArray(u)&&typeof u=="object":h===typeof u)}function Ne(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const He=.96422,Ye=.82521,Je=4/29,Rt=6/29,Ft=3*Rt*Rt,en=Rt*Rt*Rt,nn=Math.PI/180,Tn=180/Math.PI;function er(u){return(u%=360)<0&&(u+=360),u}function xr([u,o,h,p]){let _,x;const w=dn((.2225045*(u=ci(u))+.7168786*(o=ci(o))+.0606169*(h=ci(h)))/1);u===o&&o===h?_=x=w:(_=dn((.4360747*u+.3850649*o+.1430804*h)/He),x=dn((.0139322*u+.0971045*o+.7141733*h)/Ye));const I=116*w-16;return[I<0?0:I,500*(_-w),200*(w-x),p]}function ci(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function dn(u){return u>en?Math.pow(u,1/3):u/Ft+Je}function Or([u,o,h,p]){let _=(u+16)/116,x=isNaN(o)?_:_+o/500,w=isNaN(h)?_:_-h/200;return _=1*uo(_),x=He*uo(x),w=Ye*uo(w),[_i(3.1338561*x-1.6168667*_-.4906146*w),_i(-.9787684*x+1.9161415*_+.033454*w),_i(.0719453*x-.2289914*_+1.4052427*w),p]}function _i(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function uo(u){return u>Rt?u*u*u:Ft*(u-Je)}function Eo(u){return parseInt(u.padEnd(2,u),16)/255}function Mi(u,o){return Js(o?u/100:u,0,1)}function Js(u,o,h){return Math.min(Math.max(o,u),h)}function Mm(u){return!u.some(Number.isNaN)}const Ty={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Xn{constructor(o,h,p,_=1,x=!0){this.r=o,this.g=h,this.b=p,this.a=_,x||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[o,h,p,_]))}static parse(o){if(o instanceof Xn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=Ty[p];if(_){const[w,I,P]=_;return[w/255,I/255,P/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 I=1;return[Eo(p.slice(I,I+=w)),Eo(p.slice(I,I+=w)),Eo(p.slice(I,I+=w)),Eo(p.slice(I,I+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[I,P,D,z,V,W,X,Y,ie,fe,we,Oe]=w,Ee=[z||" ",X||" ",fe].join("");if(Ee===" "||Ee===" /"||Ee===",,"||Ee===",,,"){const Ae=[D,W,ie].join(""),Qe=Ae==="%%%"?100:Ae===""?255:0;if(Qe){const et=[Js(+P/Qe,0,1),Js(+V/Qe,0,1),Js(+Y/Qe,0,1),we?Mi(+we,Oe):1];if(Mm(et))return et}}return}}const x=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,I,P,D,z,V,W,X,Y]=x,ie=[P||" ",z||" ",W].join("");if(ie===" "||ie===" /"||ie===",,"||ie===",,,"){const fe=[+I,Js(+D,0,100),Js(+V,0,100),X?Mi(+X,Y):1];if(Mm(fe))return function([we,Oe,Ee,Ae]){function Qe(et){const St=(et+we/30)%12,Dt=Oe*Math.min(Ee,1-Ee);return Ee-Dt*Math.max(-1,Math.min(St-3,9-St,1))}return we=er(we),Oe/=100,Ee/=100,[Qe(0),Qe(8),Qe(4),Ae]}(fe)}}}(o);return h?new Xn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:_}=this,x=_||1/0;return this.overwriteGetter("rgb",[o/x,h/x,p/x,_])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,_,x]=xr(o),w=Math.sqrt(p*p+_*_);return[Math.round(1e4*w)?er(Math.atan2(_,p)*Tn):NaN,w,h,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",xr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,_]=this.rgb;return`rgba(${[o,h,p].map(x=>Math.round(255*x)).join(",")},${_})`}}Xn.black=new Xn(0,0,0,1),Xn.white=new Xn(1,1,1,1),Xn.transparent=new Xn(0,0,0,0),Xn.red=new Xn(1,0,0,1);class yp{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class vp{constructor(o,h,p,_,x){this.text=o,this.image=h,this.scale=p,this.fontStack=_,this.textColor=x}}class qo{constructor(o){this.sections=o}static fromString(o){return new qo([new vp(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 qo?o:qo.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class Io{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Io)return o;if(typeof o=="number")return new Io([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="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 Io(o)}}toString(){return JSON.stringify(this.values)}}const _c=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class hs{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof hs)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&u<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,h,p]:[u,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function gh(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof Xn||u instanceof yp||u instanceof qo||u instanceof Io||u instanceof hs||u instanceof fs)return!0;if(Array.isArray(u)){for(const o of u)if(!gh(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!gh(u[o]))return!1;return!0}return!1}function hi(u){if(u===null)return ui;if(typeof u=="string")return un;if(typeof u=="boolean")return an;if(typeof u=="number")return pt;if(u instanceof Xn)return Wr;if(u instanceof yp)return Aa;if(u instanceof qo)return Kr;if(u instanceof Io)return pe;if(u instanceof hs)return Z;if(u instanceof fs)return q;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const _=hi(p);if(h){if(h===_)continue;h=sn;break}h=_}return J(h||sn,o)}return cs}function yc(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Xn||u instanceof qo||u instanceof Io||u instanceof hs||u instanceof fs?u.toString():JSON.stringify(u)}class nl{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!gh(o[1]))return h.error("invalid value");const p=o[1];let _=hi(p);const x=h.expectedType;return _.kind!=="array"||_.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(_=x),new nl(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Tr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const _h={string:un,number:pt,boolean:an,object:cs};class Wo{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,_=1;const x=o[0];if(x==="array"){let I,P;if(o.length>2){const D=o[1];if(typeof D!="string"||!(D in _h)||D==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);I=_h[D],_++}else I=sn;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);P=o[2],_++}p=J(I,P)}else{if(!_h[x])throw new Error(`Types doesn't contain name = ${x}`);p=_h[x]}const w=[];for(;_o.outputDefined())}}const yh={"to-boolean":an,"to-color":Wr,"to-number":pt,"to-string":un};class Qs{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!yh[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 h.error("Expected one argument.");const _=yh[p],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:wu(h[0],h[1],h[2],h[3]),!p))return new Xn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new Tr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const _=Io.parse(h);if(_)return _}throw new Tr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const _=hs.parse(h);if(_)return _}throw new Tr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new Tr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return qo.fromString(yc(this.args[0].evaluate(o)));case"resolvedImage":return fs.fromString(yc(this.args[0].evaluate(o)));default:return yc(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const vc=["Unknown","Point","LineString","Polygon"];class $n{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"?vc[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 h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=Xn.parse(o)),h}}class vh{constructor(o,h,p=[],_,x=new Fl,w=[]){this.registry=o,this.path=p,this.key=p.map(I=>`[${I}]`).join(""),this.scope=x,this.errors=w,this.expectedType=_,this._isConstant=h}parse(o,h,p,_,x={}){return h?this.concat(h,p,_)._parse(o,x):this._parse(o,x)}_parse(o,h){function p(_,x,w){return w==="assert"?new Wo(x,[_]):w==="coerce"?new Qs(x,[_]):_}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 _=o[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[_];if(x){let w=x.parse(o,this);if(!w)return null;if(this.expectedType){const I=this.expectedType,P=w.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||P.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(I.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(I,P))return null}else w=p(w,I,h.typeAnnotation||"coerce");else w=p(w,I,h.typeAnnotation||"coerce");else w=p(w,I,h.typeAnnotation||"coerce");else w=p(w,I,h.typeAnnotation||"assert")}if(!(w instanceof nl)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const I=new $n;try{w=new nl(w.type,w.evaluate(I))}catch(P){return this.error(P.message),null}}return w}return this.error(`Unknown expression "${_}". 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,h,p){const _=typeof o=="number"?this.path.concat(o):this.path,x=p?this.scope.concat(p):this.scope;return new vh(this.registry,this._isConstant,_,h||null,x,this.errors)}error(o,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new lo(p,o))}checkSubtype(o,h){const p=ee(o,h);return p&&this.error(p),p}}class Su{constructor(o,h,p){this.type=Aa,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,an);if(!_)return null;const x=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,an);if(!x)return null;let w=null;return p.locale&&(w=h.parse(p.locale,1,un),!w)?null:new Su(_,x,w)}evaluate(o){return new yp(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 rl=8192;function bh(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 bc(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function Ly(u,o){const h=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,_=Math.pow(2,o.z);return[Math.round(h*_*rl),Math.round(p*_*rl)]}function Am(u,o,h){const p=u[0]-o[0],_=u[1]-o[1],x=u[0]-h[0],w=u[1]-h[1];return p*w-x*_==0&&p*x<=0&&_*w<=0}function xh(u,o){let h=!1;for(let w=0,I=o.length;w(p=u)[1]!=(x=P[D+1])[1]>p[1]&&p[0]<(x[0]-_[0])*(p[1]-_[1])/(x[1]-_[1])+_[0]&&(h=!h)}}var p,_,x;return h}function Py(u,o){for(let h=0;h0&&I<0||w<0&&I>0}function My(u,o,h){for(const D of h)for(let z=0;zh[2]){const _=.5*p;let x=u[0]-h[0]>_?-p:h[0]-u[0]>_?p:0;x===0&&(x=u[0]-h[2]>_?-p:h[2]-u[0]>_?p:0),u[0]+=x}bh(o,u)}function Sh(u,o,h,p){const _=Math.pow(2,p.z)*rl,x=[p.x*rl,p.y*rl],w=[];for(const I of u)for(const P of I){const D=[P.x+x[0],P.y+x[1]];Om(D,o,h,_),w.push(D)}return w}function zm(u,o,h,p){const _=Math.pow(2,p.z)*rl,x=[p.x*rl,p.y*rl],w=[];for(const P of u){const D=[];for(const z of P){const V=[z.x+x[0],z.y+x[1]];bh(o,V),D.push(V)}w.push(D)}if(o[2]-o[0]<=_/2){(I=o)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const P of w)for(const D of P)Om(D,o,h,_)}var I;return w}class Bl{constructor(o,h){this.type=an,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(gh(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const _=[];for(const x of p.features){const{type:w,coordinates:I}=x.geometry;w==="Polygon"&&_.push(I),w==="MultiPolygon"&&_.push(...I)}if(_.length)return new Bl(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Bl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Bl(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=h.canonicalID();if(p.type==="Polygon"){const I=wh(p.coordinates,x,w),P=Sh(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!xh(D,I))return!1}if(p.type==="MultiPolygon"){const I=Nm(p.coordinates,x,w),P=Sh(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!Py(D,I))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=h.canonicalID();if(p.type==="Polygon"){const I=wh(p.coordinates,x,w),P=zm(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!Dm(D,I))return!1}if(p.type==="MultiPolygon"){const I=Nm(p.coordinates,x,w),P=zm(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!Rm(D,I))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Eh{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new Eh(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Ho{constructor(o,h,p,_){this.name=o,this.type=h,this._evaluate=p,this.args=_}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],_=Ho.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(_)?_[0]:_.type,w=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,I=w.filter(([D])=>!Array.isArray(D)||D.length===o.length-1);let P=null;for(const[D,z]of I){P=new vh(h.registry,xc,h.path,null,h.scope);const V=[];let W=!1;for(let X=1;X{return W=V,Array.isArray(W)?`(${W.map(ue).join(", ")})`:`(${ue(W.type)}...)`;var W}).join(" | "),z=[];for(let V=1;V{h=o?h&&xc(p):h&&p instanceof nl}),!!h&&Ih(u)&&Sc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ih(u){if(u instanceof Ho&&(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 Bl)return!1;let o=!0;return u.eachChild(h=>{o&&!Ih(h)&&(o=!1)}),o}function wc(u){if(u instanceof Ho&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!wc(h)&&(o=!1)}),o}function Sc(u,o){if(u instanceof Ho&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!Sc(p,o)&&(h=!1)}),h}function Ec(u,o){const h=u.length-1;let p,_,x=0,w=h,I=0;for(;x<=w;)if(I=Math.floor((x+w)/2),p=u[I],_=u[I+1],p<=o){if(I===h||o<_)return I;x=I+1}else{if(!(p>o))throw new Tr("Input is not a number.");w=I-1}return 0}class Ic{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,x]of p)this.labels.push(_),this.outputs.push(x)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,pt);if(!p)return null;const _=[];let x=null;h.expectedType&&h.expectedType.kind!=="value"&&(x=h.expectedType);for(let w=1;w=I)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',D);const V=h.parse(P,z,x);if(!V)return null;x=x||V.type,_.push([I,V])}return new Ic(x,p,_)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const x=h.length;return _>=h[x-1]?p[x-1].evaluate(o):p[Ec(h,_)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Ay(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var ky=Fm;function Fm(u,o,h,p){this.cx=3*u,this.bx=3*(h-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=h,this.p2y=p}Fm.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 h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?w=h:I=h,h=.5*(I-w)+w;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var Dy=Ay(ky);function Vl(u,o,h){return u+h*(o-u)}function Ch(u,o,h){return u.map((p,_)=>Vl(p,o[_],h))}const co={number:Vl,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[_,x,w,I]=Ch(u.rgb,o.rgb,h);return new Xn(_,x,w,I,!1)}case"hcl":{const[_,x,w,I]=u.hcl,[P,D,z,V]=o.hcl;let W,X;if(isNaN(_)||isNaN(P))isNaN(_)?isNaN(P)?W=NaN:(W=P,w!==1&&w!==0||(X=D)):(W=_,z!==1&&z!==0||(X=x));else{let Oe=P-_;P>_&&Oe>180?Oe-=360:P<_&&_-P>180&&(Oe+=360),W=_+h*Oe}const[Y,ie,fe,we]=function([Oe,Ee,Ae,Qe]){return Oe=isNaN(Oe)?0:Oe*nn,Or([Ae,Math.cos(Oe)*Ee,Math.sin(Oe)*Ee,Qe])}([W,X??Vl(x,D,h),Vl(w,z,h),Vl(I,V,h)]);return new Xn(Y,ie,fe,we,!1)}case"lab":{const[_,x,w,I]=Or(Ch(u.lab,o.lab,h));return new Xn(_,x,w,I,!1)}}},array:Ch,padding:function(u,o,h){return new Io(Ch(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,_=o.values;if(p.length!==_.length)throw new Tr(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const x=[];for(let w=0;wtypeof z!="number"||z<0||z>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:D}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(x=h.parse(x,2,pt),!x)return null;const I=[];let P=null;p==="interpolate-hcl"||p==="interpolate-lab"?P=Wr:h.expectedType&&h.expectedType.kind!=="value"&&(P=h.expectedType);for(let D=0;D=z)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',W);const Y=h.parse(V,X,P);if(!Y)return null;P=P||Y.type,I.push([z,Y])}return Ne(P,pt)||Ne(P,Wr)||Ne(P,pe)||Ne(P,Z)||Ne(P,J(pt))?new Zi(P,p,_,x,I):h.error(`Type ${ue(P)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const x=h.length;if(_>=h[x-1])return p[x-1].evaluate(o);const w=Ec(h,_),I=Zi.interpolationFactor(this.interpolation,_,h[w],h[w+1]),P=p[w].evaluate(o),D=p[w+1].evaluate(o);switch(this.operator){case"interpolate":return co[this.type.kind](P,D,I);case"interpolate-hcl":return co.color(P,D,I,"hcl");case"interpolate-lab":return co.color(P,D,I,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Gn(u,o,h,p){const _=p-h,x=u-h;return _===0?0:o===1?x/_:(Math.pow(o,x)-1)/(Math.pow(o,_)-1)}class Th{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const _=h.expectedType;_&&_.kind!=="value"&&(p=_);const x=[];for(const I of o.slice(1)){const P=h.parse(I,1+x.length,p,void 0,{typeAnnotation:"omit"});if(!P)return null;p=p||P.type,x.push(P)}if(!p)throw new Error("No output type");const w=_&&x.some(I=>ee(_,I.type));return new Th(w?sn:p,x)}evaluate(o){let h,p=null,_=0;for(const x of this.args)if(_++,p=x.evaluate(o),p&&p instanceof fs&&!p.available&&(h||(h=p.name),p=null,_===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class Lh{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let x=1;x=p.length)throw new Tr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new Tr(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class xp{constructor(o,h){this.type=an,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,sn),_=h.parse(o[2],2,sn);return p&&_?Me(p.type,[an,un,pt,ui,sn])?new xp(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ue(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!Se(h,["boolean","string","number","null"]))throw new Tr(`Expected first argument to be of type boolean, string, number or null, but found ${ue(hi(h))} instead.`);if(!Se(p,["string","array"]))throw new Tr(`Expected second argument to be of type array or string, but found ${ue(hi(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Ph{constructor(o,h,p){this.type=pt,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,sn),_=h.parse(o[2],2,sn);if(!p||!_)return null;if(!Me(p.type,[an,un,pt,ui,sn]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ue(p.type)} instead`);if(o.length===4){const x=h.parse(o[3],3,pt);return x?new Ph(p,_,x):null}return new Ph(p,_)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!Se(h,["boolean","string","number","null"]))throw new Tr(`Expected first argument to be of type boolean, string, number or null, but found ${ue(hi(h))} instead.`);if(!Se(p,["string","array"]))throw new Tr(`Expected second argument to be of type array or string, but found ${ue(hi(p))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(o);return p.indexOf(h,_)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class wp{constructor(o,h,p,_,x,w){this.inputType=o,this.type=h,this.input=p,this.cases=_,this.outputs=x,this.otherwise=w}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const x={},w=[];for(let D=2;DNumber.MAX_SAFE_INTEGER)return W.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return W.error("Numeric branch labels must be integer values.");if(p){if(W.checkSubtype(p,hi(Y)))return null}else p=hi(Y);if(x[String(Y)]!==void 0)return W.error("Branch labels must be unique.");x[String(Y)]=w.length}const X=h.parse(V,D,_);if(!X)return null;_=_||X.type,w.push(X)}const I=h.parse(o[1],1,sn);if(!I)return null;const P=h.parse(o[o.length-1],o.length-1,_);return P?I.type.kind!=="value"&&h.concat(1).checkSubtype(p,I.type)?null:new wp(p,_,I,x,w,P):null}evaluate(o){const h=this.input.evaluate(o);return(hi(h)===this.inputType&&this.outputs[this.cases[h]]||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 Sp{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const _=[];for(let w=1;wh.outputDefined())&&this.otherwise.outputDefined()}}class Mh{constructor(o,h,p,_){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=_}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,sn),_=h.parse(o[2],2,pt);if(!p||!_)return null;if(!Me(p.type,[J(sn),un,sn]))return h.error(`Expected first argument to be of type array or string, but found ${ue(p.type)} instead`);if(o.length===4){const x=h.parse(o[3],3,pt);return x?new Mh(p.type,p,_,x):null}return new Mh(p.type,p,_)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!Se(h,["string","array"]))throw new Tr(`Expected first argument to be of type array or string, but found ${ue(hi(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(o);return h.slice(p,_)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Bm(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 Vm(u,o,h,p){return p.compare(o,h)===0}function Eu(u,o,h){const p=u!=="=="&&u!=="!=";return class WE{constructor(x,w,I){this.type=an,this.lhs=x,this.rhs=w,this.collator=I,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const I=x[0];let P=w.parse(x[1],1,sn);if(!P)return null;if(!Bm(I,P.type))return w.concat(1).error(`"${I}" comparisons are not supported for type '${ue(P.type)}'.`);let D=w.parse(x[2],2,sn);if(!D)return null;if(!Bm(I,D.type))return w.concat(2).error(`"${I}" comparisons are not supported for type '${ue(D.type)}'.`);if(P.type.kind!==D.type.kind&&P.type.kind!=="value"&&D.type.kind!=="value")return w.error(`Cannot compare types '${ue(P.type)}' and '${ue(D.type)}'.`);p&&(P.type.kind==="value"&&D.type.kind!=="value"?P=new Wo(D.type,[P]):P.type.kind!=="value"&&D.type.kind==="value"&&(D=new Wo(P.type,[D])));let z=null;if(x.length===4){if(P.type.kind!=="string"&&D.type.kind!=="string"&&P.type.kind!=="value"&&D.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(z=w.parse(x[3],3,Aa),!z)return null}return new WE(P,D,z)}evaluate(x){const w=this.lhs.evaluate(x),I=this.rhs.evaluate(x);if(p&&this.hasUntypedArgument){const P=hi(w),D=hi(I);if(P.kind!==D.kind||P.kind!=="string"&&P.kind!=="number")throw new Tr(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${P.kind}, ${D.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const P=hi(w),D=hi(I);if(P.kind!=="string"||D.kind!=="string")return o(x,w,I)}return this.collator?h(x,w,I,this.collator.evaluate(x)):o(x,w,I)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const Ry=Eu("==",function(u,o,h){return o===h},Vm),Ny=Eu("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!Vm(0,o,h,p)}),Oy=Eu("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),Fy=Eu("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),By=Eu(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class Ep{constructor(o,h,p,_,x){this.type=un,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=x}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,pt);if(!p)return null;const _=o[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let x=null;if(_.locale&&(x=h.parse(_.locale,1,un),!x))return null;let w=null;if(_.currency&&(w=h.parse(_.currency,1,un),!w))return null;let I=null;if(_["min-fraction-digits"]&&(I=h.parse(_["min-fraction-digits"],1,pt),!I))return null;let P=null;return _["max-fraction-digits"]&&(P=h.parse(_["max-fraction-digits"],1,pt),!P)?null:new Ep(p,x,w,I,P)}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 Ah{constructor(o){this.type=Kr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const _=[];let x=!1;for(let w=1;w<=o.length-1;++w){const I=o[w];if(x&&typeof I=="object"&&!Array.isArray(I)){x=!1;let P=null;if(I["font-scale"]&&(P=h.parse(I["font-scale"],1,pt),!P))return null;let D=null;if(I["text-font"]&&(D=h.parse(I["text-font"],1,J(un)),!D))return null;let z=null;if(I["text-color"]&&(z=h.parse(I["text-color"],1,Wr),!z))return null;const V=_[_.length-1];V.scale=P,V.font=D,V.textColor=z}else{const P=h.parse(o[w],1,sn);if(!P)return null;const D=P.type.kind;if(D!=="string"&&D!=="value"&&D!=="null"&&D!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,_.push({content:P,scale:null,font:null,textColor:null})}}return new Ah(_)}evaluate(o){return new qo(this.sections.map(h=>{const p=h.content.evaluate(o);return hi(p)===q?new vp("",p,null,null,null):new vp(yc(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class Ip{constructor(o){this.type=q,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,un);return p?new Ip(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=fs.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class Cp{constructor(o){this.type=pt,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${ue(p.type)} instead.`):new Cp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new Tr(`Expected value to be of type string or array, but found ${ue(hi(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const Iu={"==":Ry,"!=":Ny,">":zy,"<":Oy,">=":By,"<=":Fy,array:Wo,at:bp,boolean:Wo,case:Sp,coalesce:Th,collator:Su,format:Ah,image:Ip,in:xp,"index-of":Ph,interpolate:Zi,"interpolate-hcl":Zi,"interpolate-lab":Zi,length:Cp,let:Lh,literal:nl,match:wp,number:Wo,"number-format":Ep,object:Wo,slice:Mh,step:Ic,string:Wo,"to-boolean":Qs,"to-color":Qs,"to-number":Qs,"to-string":Qs,var:Eh,within:Bl};function Um(u,[o,h,p,_]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const x=_?_.evaluate(u):1,w=wu(o,h,p,x);if(w)throw new Tr(w);return new Xn(o/255,h/255,p/255,x,!1)}function jm(u,o){return u in o}function Tp(u,o){const h=o[u];return h===void 0?null:h}function Ul(u){return{type:u}}function Gm(u){return{result:"success",value:u}}function Cu(u){return{result:"error",value:u}}function Tu(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function qm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function Lp(u){return!!u.expression&&u.expression.interpolated}function zn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function kh(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Vy(u){return u}function Wm(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",_=p||!(p||u.property!==void 0),x=u.type||(Lp(o)?"exponential":"interval");if(h||o.type==="padding"){const z=h?Xn.parse:Io.parse;(u=us({},u)).stops&&(u.stops=u.stops.map(V=>[V[0],z(V[1])])),u.default=z(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 I,P,D;if(x==="exponential")I=Ln;else if(x==="interval")I=Uy;else if(x==="categorical"){I=Jr,P=Object.create(null);for(const z of u.stops)P[z[0]]=z[1];D=typeof u.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);I=Pp}if(p){const z={},V=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},ie)=>Ln({stops:W,base:u.base},o,Y).evaluate(Y,ie)}}if(_){const z=x==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:z,interpolationFactor:Zi.interpolationFactor.bind(void 0,z),zoomStops:u.stops.map(V=>V[0]),evaluate:({zoom:V})=>I(u,o,V,P,D)}}return{kind:"source",evaluate(z,V){const W=V&&V.properties?V.properties[u.property]:void 0;return W===void 0?Cc(u.default,o.default):I(u,o,W,P,D)}}}function Cc(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function Jr(u,o,h,p,_){return Cc(typeof h===_?p[h]:void 0,u.default,o.default)}function Uy(u,o,h){if(zn(h)!=="number")return Cc(u.default,o.default);const p=u.stops.length;if(p===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[p-1][0])return u.stops[p-1][1];const _=Ec(u.stops.map(x=>x[0]),h);return u.stops[_][1]}function Ln(u,o,h){const p=u.base!==void 0?u.base:1;if(zn(h)!=="number")return Cc(u.default,o.default);const _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];const x=Ec(u.stops.map(z=>z[0]),h),w=function(z,V,W,X){const Y=X-W,ie=z-W;return Y===0?0:V===1?ie/Y:(Math.pow(V,ie)-1)/(Math.pow(V,Y)-1)}(h,p,u.stops[x][0],u.stops[x+1][0]),I=u.stops[x][1],P=u.stops[x+1][1],D=co[o.type]||Vy;return typeof I.evaluate=="function"?{evaluate(...z){const V=I.evaluate.apply(void 0,z),W=P.evaluate.apply(void 0,z);if(V!==void 0&&W!==void 0)return D(V,W,w,u.colorSpace)}}:D(I,P,w,u.colorSpace)}function Pp(u,o,h){switch(o.type){case"color":h=Xn.parse(h);break;case"formatted":h=qo.fromString(h.toString());break;case"resolvedImage":h=fs.fromString(h.toString());break;case"padding":h=Io.parse(h);break;default:zn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return Cc(h,u.default,o.default)}Ho.register(Iu,{error:[{kind:"error"},[un],(u,[o])=>{throw new Tr(o.evaluate(u))}],typeof:[un,[sn],(u,[o])=>ue(hi(o.evaluate(u)))],"to-rgba":[J(pt,4),[Wr],(u,[o])=>{const[h,p,_,x]=o.evaluate(u).rgb;return[255*h,255*p,255*_,x]}],rgb:[Wr,[pt,pt,pt],Um],rgba:[Wr,[pt,pt,pt,pt],Um],has:{type:an,overloads:[[[un],(u,[o])=>jm(o.evaluate(u),u.properties())],[[un,cs],(u,[o,h])=>jm(o.evaluate(u),h.evaluate(u))]]},get:{type:sn,overloads:[[[un],(u,[o])=>Tp(o.evaluate(u),u.properties())],[[un,cs],(u,[o,h])=>Tp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[sn,[un],(u,[o])=>Tp(o.evaluate(u),u.featureState||{})],properties:[cs,[],u=>u.properties()],"geometry-type":[un,[],u=>u.geometryType()],id:[sn,[],u=>u.id()],zoom:[pt,[],u=>u.globals.zoom],"heatmap-density":[pt,[],u=>u.globals.heatmapDensity||0],"line-progress":[pt,[],u=>u.globals.lineProgress||0],accumulated:[sn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[pt,Ul(pt),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[pt,Ul(pt),(u,o)=>{let h=1;for(const p of o)h*=p.evaluate(u);return h}],"-":{type:pt,overloads:[[[pt,pt],(u,[o,h])=>o.evaluate(u)-h.evaluate(u)],[[pt],(u,[o])=>-o.evaluate(u)]]},"/":[pt,[pt,pt],(u,[o,h])=>o.evaluate(u)/h.evaluate(u)],"%":[pt,[pt,pt],(u,[o,h])=>o.evaluate(u)%h.evaluate(u)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(u,[o,h])=>Math.pow(o.evaluate(u),h.evaluate(u))],sqrt:[pt,[pt],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[pt,[pt],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[pt,[pt],(u,[o])=>Math.log(o.evaluate(u))],log2:[pt,[pt],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[pt,[pt],(u,[o])=>Math.sin(o.evaluate(u))],cos:[pt,[pt],(u,[o])=>Math.cos(o.evaluate(u))],tan:[pt,[pt],(u,[o])=>Math.tan(o.evaluate(u))],asin:[pt,[pt],(u,[o])=>Math.asin(o.evaluate(u))],acos:[pt,[pt],(u,[o])=>Math.acos(o.evaluate(u))],atan:[pt,[pt],(u,[o])=>Math.atan(o.evaluate(u))],min:[pt,Ul(pt),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[pt,Ul(pt),(u,o)=>Math.max(...o.map(h=>h.evaluate(u)))],abs:[pt,[pt],(u,[o])=>Math.abs(o.evaluate(u))],round:[pt,[pt],(u,[o])=>{const h=o.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[pt,[pt],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[pt,[pt],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[an,[un,sn],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[an,[sn],(u,[o])=>u.id()===o.value],"filter-type-==":[an,[un],(u,[o])=>u.geometryType()===o.value],"filter-<":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[an,[sn],(u,[o])=>o.value in u.properties()],"filter-has-id":[an,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[an,[J(un)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[an,[J(sn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[an,[un,J(sn)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[an,[un,J(sn)],(u,[o,h])=>function(p,_,x,w){for(;x<=w;){const I=x+w>>1;if(_[I]===p)return!0;_[I]>p?w=I-1:x=I+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:an,overloads:[[[an,an],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Ul(an),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:an,overloads:[[[an,an],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Ul(an),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[an,[an],(u,[o])=>!o.evaluate(u)],"is-supported-script":[an,[un],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[un,[un],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[un,[un],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[un,Ul(sn),(u,o)=>o.map(h=>yc(h.evaluate(u))).join("")],"resolved-locale":[un,[Aa],(u,[o])=>o.evaluate(u).resolvedLocale()]});class pr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new $n,this._defaultValue=h?(p=h).type==="color"&&kh(p.default)?new Xn(0,0,0,0):p.type==="color"?Xn.parse(p.default)||null:p.type==="padding"?Io.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?hs.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,_,x,w){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,_,x,w){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const I=this.expression.evaluate(this._evaluator);if(I==null||typeof I=="number"&&I!=I)return this._defaultValue;if(this._enumValues&&!(I in this._enumValues))throw new Tr(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(I)} instead.`);return I}catch(I){return this._warningHistory[I.message]||(this._warningHistory[I.message]=!0,typeof console<"u"&&console.warn(I.message)),this._defaultValue}}}function sr(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in Iu}function jl(u,o){const h=new vh(Iu,xc,[],o?function(_){const x={color:Wr,string:un,number:pt,enum:un,boolean:an,formatted:Kr,padding:pe,resolvedImage:q,variableAnchorOffsetCollection:Z};return _.type==="array"?J(x[_.value]||sn,_.length):x[_.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?Gm(new pr(p,o)):Cu(h.errors)}class Dh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!wc(h.expression)}evaluateWithoutErrorHandling(o,h,p,_,x,w){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,x,w)}evaluate(o,h,p,_,x,w){return this._styleExpression.evaluate(o,h,p,_,x,w)}}class Mp{constructor(o,h,p,_){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!wc(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(o,h,p,_,x,w){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,x,w)}evaluate(o,h,p,_,x,w){return this._styleExpression.evaluate(o,h,p,_,x,w)}interpolationFactor(o,h,p){return this.interpolationType?Zi.interpolationFactor(this.interpolationType,o,h,p):0}}function Hm(u,o){const h=jl(u,o);if(h.result==="error")return h;const p=h.value.expression,_=Ih(p);if(!_&&!Tu(o))return Cu([new lo("","data expressions not supported")]);const x=Sc(p,["zoom"]);if(!x&&!qm(o))return Cu([new lo("","zoom expressions not supported")]);const w=Nh(p);return w||x?w instanceof lo?Cu([w]):w instanceof Zi&&!Lp(o)?Cu([new lo("",'"interpolate" expressions cannot be used with this property')]):Gm(w?new Mp(_?"camera":"composite",h.value,w.labels,w instanceof Zi?w.interpolation:void 0):new Dh(_?"constant":"source",h.value)):Cu([new lo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Rh{constructor(o,h){this._parameters=o,this._specification=h,us(this,Wm(this._parameters,this._specification))}static deserialize(o){return new Rh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Nh(u){let o=null;if(u instanceof Lh)o=Nh(u.result);else if(u instanceof Th){for(const h of u.args)if(o=Nh(h),o)break}else(u instanceof Ic||u instanceof Zi)&&u.input instanceof Ho&&u.input.name==="zoom"&&(o=u);return o instanceof lo||u.eachChild(h=>{const p=Nh(h);p instanceof lo?o=p:!o&&p?o=new lo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new lo("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function Oh(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(!Oh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Zm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zh(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Oh(u)||(u=Bh(u));const o=jl(u,Zm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>o.value.evaluate(h,p,{},_),needGeometry:Fh(u)}}function Xm(u,o){return uo?1:0}function Fh(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?Ap(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(Bh))):o==="all"?["all"].concat(u.slice(1).map(Bh)):o==="none"?["all"].concat(u.slice(1).map(Bh).map(Vh)):o==="in"?$m(u[1],u.slice(2)):o==="!in"?Vh($m(u[1],u.slice(2))):o==="has"?Ym(u[1]):o==="!has"?Vh(Ym(u[1])):o!=="within"||u;var h}function Ap(u,o,h){switch(u){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,u,o]}}function $m(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(h=>typeof h!=typeof o[0])?["filter-in-large",u,["literal",o.sort(Xm)]]:["filter-in-small",u,["literal",o]]}}function Ym(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Vh(u){return["!",u]}function kp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let _="[";for(const x of u)_+=`${kp(x)},`;return`${_}]`}const h=Object.keys(u).sort();let p="{";for(let _=0;_p.maximum?[new lt(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Jm(u){const o=u.valueSpec,h=zr(u.value.type);let p,_,x,w={};const I=h!=="categorical"&&u.value.property===void 0,P=!I,D=zn(u.value.stops)==="array"&&zn(u.value.stops[0])==="array"&&zn(u.value.stops[0][0])==="object",z=ho({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(X){if(h==="identity")return[new lt(X.key,X.value,'identity function may not have a "stops" property')];let Y=[];const ie=X.value;return Y=Y.concat(Dp({key:X.key,value:ie,valueSpec:X.valueSpec,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,arrayElementValidator:V})),zn(ie)==="array"&&ie.length===0&&Y.push(new lt(X.key,ie,"array must have at least one stop")),Y},default:function(X){return X.validateSpec({key:X.key,value:X.value,valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec})}}});return h==="identity"&&I&&z.push(new lt(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||z.push(new lt(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!Lp(u.valueSpec)&&z.push(new lt(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(P&&!Tu(u.valueSpec)?z.push(new lt(u.key,u.value,"property functions not supported")):I&&!qm(u.valueSpec)&&z.push(new lt(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!D||u.value.property!==void 0||z.push(new lt(u.key,u.value,'"property" property is required')),z;function V(X){let Y=[];const ie=X.value,fe=X.key;if(zn(ie)!=="array")return[new lt(fe,ie,`array expected, ${zn(ie)} found`)];if(ie.length!==2)return[new lt(fe,ie,`array length 2 expected, length ${ie.length} found`)];if(D){if(zn(ie[0])!=="object")return[new lt(fe,ie,`object expected, ${zn(ie[0])} found`)];if(ie[0].zoom===void 0)return[new lt(fe,ie,"object stop key must have zoom")];if(ie[0].value===void 0)return[new lt(fe,ie,"object stop key must have value")];if(x&&x>zr(ie[0].zoom))return[new lt(fe,ie[0].zoom,"stop zoom values must appear in ascending order")];zr(ie[0].zoom)!==x&&(x=zr(ie[0].zoom),_=void 0,w={}),Y=Y.concat(ho({key:`${fe}[0]`,value:ie[0],valueSpec:{zoom:{}},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,objectElementValidators:{zoom:Uh,value:W}}))}else Y=Y.concat(W({key:`${fe}[0]`,value:ie[0],valueSpec:{},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec},ie));return sr(il(ie[1]))?Y.concat([new lt(`${fe}[1]`,ie[1],"expressions are not allowed in function stops.")]):Y.concat(X.validateSpec({key:`${fe}[1]`,value:ie[1],valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec}))}function W(X,Y){const ie=zn(X.value),fe=zr(X.value),we=X.value!==null?X.value:Y;if(p){if(ie!==p)return[new lt(X.key,we,`${ie} stop domain type must match previous stop domain type ${p}`)]}else p=ie;if(ie!=="number"&&ie!=="string"&&ie!=="boolean")return[new lt(X.key,we,"stop domain value must be a number, string, or boolean")];if(ie!=="number"&&h!=="categorical"){let Oe=`number expected, ${ie} found`;return Tu(o)&&h===void 0&&(Oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new lt(X.key,we,Oe)]}return h!=="categorical"||ie!=="number"||isFinite(fe)&&Math.floor(fe)===fe?h!=="categorical"&&ie==="number"&&_!==void 0&&fe<_?[new lt(X.key,we,"stop domain values must appear in ascending order")]:(_=fe,h==="categorical"&&fe in w?[new lt(X.key,we,"stop domain values must be unique")]:(w[fe]=!0,[])):[new lt(X.key,we,`integer expected, found ${fe}`)]}}function ol(u){const o=(u.expressionContext==="property"?Hm:jl)(il(u.value),u.valueSpec);if(o.result==="error")return o.value.map(p=>new lt(`${u.key}${p.key}`,u.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new lt(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"&&!wc(h))return[new lt(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!wc(h))return[new lt(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!Sc(h,["zoom","feature-state"]))return[new lt(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Ih(h))return[new lt(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function sl(u){const o=u.key,h=u.value,p=u.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(zr(h))===-1&&_.push(new lt(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(zr(h))===-1&&_.push(new lt(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function Lu(u){return Oh(il(u.value))?ol(us({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Rp(u)}function Rp(u){const o=u.value,h=u.key;if(zn(o)!=="array")return[new lt(h,o,`array expected, ${zn(o)} found`)];const p=u.styleSpec;let _,x=[];if(o.length<1)return[new lt(h,o,"filter array must have at least 1 element")];switch(x=x.concat(sl({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),zr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&zr(o[1])==="$type"&&x.push(new lt(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&x.push(new lt(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(_=zn(o[1]),_!=="string"&&x.push(new lt(`${h}[1]`,o[1],`string expected, ${_} found`)));for(let w=2;w{D in h&&o.push(new lt(p,h[D],`"${D}" is prohibited for ref layers`))}),_.layers.forEach(D=>{zr(D.id)===I&&(P=D)}),P?P.ref?o.push(new lt(p,h.ref,"ref cannot reference another ref layer")):w=zr(P.type):o.push(new lt(p,h.ref,`ref layer "${I}" not found`))}else if(w!=="background")if(h.source){const P=_.sources&&_.sources[h.source],D=P&&zr(P.type);P?D==="vector"&&w==="raster"?o.push(new lt(p,h.source,`layer "${h.id}" requires a raster source`)):D!=="raster-dem"&&w==="hillshade"?o.push(new lt(p,h.source,`layer "${h.id}" requires a raster-dem source`)):D==="raster"&&w!=="raster"?o.push(new lt(p,h.source,`layer "${h.id}" requires a vector source`)):D!=="vector"||h["source-layer"]?D==="raster-dem"&&w!=="hillshade"?o.push(new lt(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!h.paint||!h.paint["line-gradient"]||D==="geojson"&&P.lineMetrics||o.push(new lt(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new lt(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new lt(p,h.source,`source "${h.source}" not found`))}else o.push(new lt(p,h,'missing required property "source"'));return o=o.concat(ho({key:p,value:h,valueSpec:x.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:h.type,valueSpec:x.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:Lu,layout:P=>ho({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":D=>Op(us({layerType:w},D))}}),paint:P=>ho({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":D=>Np(us({layerType:w},D))}})}})),o}function Gl(u){const o=u.value,h=u.key,p=zn(o);return p!=="string"?[new lt(h,o,`string expected, ${p} found`)]:[]}const Qm={promoteId:function({key:u,value:o}){if(zn(o)==="string")return Gl({key:u,value:o});{const h=[];for(const p in o)h.push(...Gl({key:`${u}.${p}`,value:o[p]}));return h}}};function eg(u){const o=u.value,h=u.key,p=u.styleSpec,_=u.style,x=u.validateSpec;if(!o.type)return[new lt(h,o,'"type" is required')];const w=zr(o.type);let I;switch(w){case"vector":case"raster":return I=ho({key:h,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:Qm,validateSpec:x}),I;case"raster-dem":return I=function(P){var D;const z=(D=P.sourceName)!==null&&D!==void 0?D:"",V=P.value,W=P.styleSpec,X=W.source_raster_dem,Y=P.style;let ie=[];const fe=zn(V);if(V===void 0)return ie;if(fe!=="object")return ie.push(new lt("source_raster_dem",V,`object expected, ${fe} found`)),ie;const we=zr(V.encoding)==="custom",Oe=["redFactor","greenFactor","blueFactor","baseShift"],Ee=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Ae in V)!we&&Oe.includes(Ae)?ie.push(new lt(Ae,V[Ae],`In "${z}": "${Ae}" is only valid when "encoding" is set to "custom". ${Ee} encoding found`)):X[Ae]?ie=ie.concat(P.validateSpec({key:Ae,value:V[Ae],valueSpec:X[Ae],validateSpec:P.validateSpec,style:Y,styleSpec:W})):ie.push(new lt(Ae,V[Ae],`unknown property "${Ae}"`));return ie}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:x}),I;case"geojson":if(I=ho({key:h,value:o,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:x,objectElementValidators:Qm}),o.cluster)for(const P in o.clusterProperties){const[D,z]=o.clusterProperties[P],V=typeof D=="string"?[D,["accumulated"],["get",P]]:D;I.push(...ol({key:`${h}.${P}.map`,value:z,validateSpec:x,expressionContext:"cluster-map"})),I.push(...ol({key:`${h}.${P}.reduce`,value:V,validateSpec:x,expressionContext:"cluster-reduce"}))}return I;case"video":return ho({key:h,value:o,valueSpec:p.source_video,style:_,validateSpec:x,styleSpec:p});case"image":return ho({key:h,value:o,valueSpec:p.source_image,style:_,validateSpec:x,styleSpec:p});case"canvas":return[new lt(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sl({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:x,styleSpec:p})}}function tg(u){const o=u.value,h=u.styleSpec,p=h.light,_=u.style;let x=[];const w=zn(o);if(o===void 0)return x;if(w!=="object")return x=x.concat([new lt("light",o,`object expected, ${w} found`)]),x;for(const I in o){const P=I.match(/^(.*)-transition$/);x=x.concat(P&&p[P[1]]&&p[P[1]].transition?u.validateSpec({key:I,value:o[I],valueSpec:h.transition,validateSpec:u.validateSpec,style:_,styleSpec:h}):p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new lt(I,o[I],`unknown property "${I}"`)])}return x}function ng(u){const o=u.value,h=u.styleSpec,p=h.sky,_=u.style,x=zn(o);if(o===void 0)return[];if(x!=="object")return[new lt("sky",o,`object expected, ${x} found`)];let w=[];for(const I in o)w=w.concat(p[I]?ea({key:I,value:o[I],valueSpec:p[I],style:_,styleSpec:h}):[new lt(I,o[I],`unknown property "${I}"`)]);return w}function Lc(u){const o=u.value,h=u.styleSpec,p=h.terrain,_=u.style;let x=[];const w=zn(o);if(o===void 0)return x;if(w!=="object")return x=x.concat([new lt("terrain",o,`object expected, ${w} found`)]),x;for(const I in o)x=x.concat(p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new lt(I,o[I],`unknown property "${I}"`)]);return x}function Pc(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const _=[],x=[];for(const w in h)h[w].id&&_.includes(h[w].id)&&o.push(new lt(p,h,`all the sprites' ids must be unique, but ${h[w].id} is duplicated`)),_.push(h[w].id),h[w].url&&x.includes(h[w].url)&&o.push(new lt(p,h,`all the sprites' URLs must be unique, but ${h[w].url} is duplicated`)),x.push(h[w].url),o=o.concat(ho({key:`${p}[${w}]`,value:h[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return Gl({key:p,value:h})}const Co={"*":()=>[],array:Dp,boolean:function(u){const o=u.value,h=u.key,p=zn(o);return p!=="boolean"?[new lt(h,o,`boolean expected, ${p} found`)]:[]},number:Uh,color:function(u){const o=u.key,h=u.value,p=zn(h);return p!=="string"?[new lt(o,h,`color expected, ${p} found`)]:Xn.parse(String(h))?[]:[new lt(o,h,`color expected, "${h}" found`)]},constants:Km,enum:sl,filter:Lu,function:Jm,layer:Tc,object:ho,source:eg,light:tg,sky:ng,terrain:Lc,string:Gl,formatted:function(u){return Gl(u).length===0?[]:ol(u)},resolvedImage:function(u){return Gl(u).length===0?[]:ol(u)},padding:function(u){const o=u.key,h=u.value;if(zn(h)==="array"){if(h.length<1||h.length>4)return[new lt(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let x=0;x[]}})),u.constants&&(h=h.concat(Km({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:ea}))),Pu(h)}function ta(u){return function(o){return u({...o,validateSpec:ea})}}function Pu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function Ps(u){return function(...o){return Pu(u.apply(this,o))}}Ls.source=Ps(ta(eg)),Ls.sprite=Ps(ta(Pc)),Ls.glyphs=Ps(ta(zp)),Ls.light=Ps(ta(tg)),Ls.sky=Ps(ta(ng)),Ls.terrain=Ps(ta(Lc)),Ls.layer=Ps(ta(Tc)),Ls.filter=Ps(ta(Lu)),Ls.paintProperty=Ps(ta(Np)),Ls.layoutProperty=Ps(ta(Op));const ql=Ls,Gy=ql.light,Fp=ql.paintProperty,qy=ql.layoutProperty;function Mu(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new ot(new Error(p.message))),h=!0;return h}class Mc{constructor(o,h,p){const _=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(h=w[1])+2*(p=w[2]);for(let P=0;P=V[Y+0]&&_>=V[Y+1])?(I[X]=!0,w.push(z[X])):I[X]=!1}}}}_forEachCell(o,h,p,_,x,w,I,P){const D=this._convertToCellCoord(o),z=this._convertToCellCoord(h),V=this._convertToCellCoord(p),W=this._convertToCellCoord(_);for(let X=D;X<=V;X++)for(let Y=z;Y<=W;Y++){const ie=this.d*Y+X;if((!P||P(this._convertFromCellCoord(X),this._convertFromCellCoord(Y),this._convertFromCellCoord(X+1),this._convertFromCellCoord(Y+1)))&&x.call(this,o,h,p,_,ie,w,I,P))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,h=3+this.cells.length+1+1;let p=0;for(let w=0;w=0)continue;const w=u[x];_[x]=na[p].shallow.indexOf(x)>=0?w:Au(w,o)}u instanceof Error&&(_.message=u.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(_.$name=p),_}throw new Error("can't serialize object of type "+typeof u)}function ku(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||u instanceof Error||Gh(u)||Mt(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(ku);if(typeof u=="object"){const o=u.$name||"Object";if(!na[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=na[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const _ of Object.keys(u)){if(_==="$name")continue;const x=u[_];p[_]=na[o].shallow.indexOf(_)>=0?x:ku(x)}return p}throw new Error("can't deserialize object of type "+typeof u)}class rg{constructor(){this.first=!0}update(o,h){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=h):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 Du(u){for(const o of u)if(qh(o.charCodeAt(0)))return!0;return!1}function ig(u){for(const o of u)if(!og(o.charCodeAt(0)))return!1;return!0}function og(u){return!(xt.Arabic(u)||xt["Arabic Supplement"](u)||xt["Arabic Extended-A"](u)||xt["Arabic Presentation Forms-A"](u)||xt["Arabic Presentation Forms-B"](u))}function qh(u){return!(u!==746&&u!==747&&(u<4352||!(xt["Bopomofo Extended"](u)||xt.Bopomofo(u)||xt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||xt["CJK Compatibility Ideographs"](u)||xt["CJK Compatibility"](u)||xt["CJK Radicals Supplement"](u)||xt["CJK Strokes"](u)||!(!xt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||xt["CJK Unified Ideographs Extension A"](u)||xt["CJK Unified Ideographs"](u)||xt["Enclosed CJK Letters and Months"](u)||xt["Hangul Compatibility Jamo"](u)||xt["Hangul Jamo Extended-A"](u)||xt["Hangul Jamo Extended-B"](u)||xt["Hangul Jamo"](u)||xt["Hangul Syllables"](u)||xt.Hiragana(u)||xt["Ideographic Description Characters"](u)||xt.Kanbun(u)||xt["Kangxi Radicals"](u)||xt["Katakana Phonetic Extensions"](u)||xt.Katakana(u)&&u!==12540||!(!xt["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)||!(!xt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||xt["Unified Canadian Aboriginal Syllabics"](u)||xt["Unified Canadian Aboriginal Syllabics Extended"](u)||xt["Vertical Forms"](u)||xt["Yijing Hexagram Symbols"](u)||xt["Yi Syllables"](u)||xt["Yi Radicals"](u))))}function Bp(u){return!(qh(u)||function(o){return!!(xt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||xt["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)||xt["Letterlike Symbols"](o)||xt["Number Forms"](o)||xt["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)||xt["Control Pictures"](o)&&o!==9251||xt["Optical Character Recognition"](o)||xt["Enclosed Alphanumerics"](o)||xt["Geometric Shapes"](o)||xt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||xt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||xt["CJK Symbols and Punctuation"](o)||xt.Katakana(o)||xt["Private Use Area"](o)||xt["CJK Compatibility Forms"](o)||xt["Small Form Variants"](o)||xt["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 Wh(u){return u>=1424&&u<=2303||xt["Arabic Presentation Forms-A"](u)||xt["Arabic Presentation Forms-B"](u)}function sg(u,o){return!(!o&&Wh(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||xt.Khmer(u))}function Wy(u){for(const o of u)if(Wh(o.charCodeAt(0)))return!0;return!1}const al=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class wr{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rg,this.transition={})}isSupportedScript(o){return function(h,p){for(const _ of h)if(!sg(_.charCodeAt(0),p))return!1;return!0}(o,al.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Ac{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,_){if(kh(p))return new Rh(p,_);if(sr(p)){const x=Hm(p,_);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=p;return _.type==="color"&&typeof p=="string"?x=Xn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(x=hs.parse(p)):x=Io.parse(p),{kind:"constant",evaluate:()=>x}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class Hh{constructor(o){this.property=o,this.value=new Ac(o,void 0)}transitioned(o,h){return new ag(this.property,this.value,h,ae({},o.transition,this.transition),o.now)}untransitioned(){return new ag(this.property,this.value,null,{},0)}}class Vp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Q(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Hh(this._values[o].property)),this._values[o].value=new Ac(this._values[o].property,h===null?void 0:Q(h))}getTransition(o){return Q(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Hh(this._values[o].property)),this._values[o].transition=Q(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const _=this.getTransition(h);_!==void 0&&(o[`${h}-transition`]=_)}return o}transitioned(o,h){const p=new lg(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(o,h._values[_]);return p}untransitioned(){const o=new lg(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class ag{constructor(o,h,p,_,x){this.property=o,this.value=h,this.begin=x+_.delay||0,this.end=this.begin+_.duration||0,o.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const _=o.now||0,x=this.value.possiblyEvaluate(o,h,p),w=this.prior;if(w){if(_>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(_=1)return 1;const D=P*P,z=D*P;return 4*(P<.5?z:3*(P-D)+z-.75)}(I))}}return x}}class lg{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const _=new kc(this._properties);for(const x of Object.keys(this._values))_._values[x]=this._values[x].possiblyEvaluate(o,h,p);return _}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class ug{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Q(this._values[o].value)}setValue(o,h){this._values[o]=new Ac(this._values[o].property,h===null?void 0:Q(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const _=new kc(this._properties);for(const x of Object.keys(this._values))_._values[x]=this._values[x].possiblyEvaluate(o,h,p);return _}}class Ms{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,_){return this.property.evaluate(this.value,this.parameters,o,h,p,_)}}class kc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Ot{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const _=co[this.specification.type];return _?_(o,h,p):o}}class qt{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,_){return new Ms(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,_)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new Ms(this,{kind:"constant",value:void 0},o.parameters);const _=co[this.specification.type];if(_){const x=_(o.value.value,h.value.value,p);return new Ms(this,{kind:"constant",value:x},o.parameters)}return o}evaluate(o,h,p,_,x,w){return o.kind==="constant"?o.value:o.evaluate(h,p,_,x,w)}}class Zh extends qt{possiblyEvaluate(o,h,p,_){if(o.value===void 0)return new Ms(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const x=o.expression.evaluate(h,null,{},p,_),w=o.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,I=this._calculate(w,w,w,h);return new Ms(this,{kind:"constant",value:I},h)}if(o.expression.kind==="camera"){const x=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new Ms(this,{kind:"constant",value:x},h)}return new Ms(this,o.expression,h)}evaluate(o,h,p,_,x,w){if(o.kind==="source"){const I=o.evaluate(h,p,_,x,w);return this._calculate(I,I,I,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,_),o.evaluate({zoom:Math.floor(h.zoom)},p,_),o.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):o.value}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Dc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){if(o.value!==void 0){if(o.expression.kind==="constant"){const x=o.expression.evaluate(h,null,{},p,_);return this._calculate(x,x,x,h)}return this._calculate(o.expression.evaluate(new wr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new wr(Math.floor(h.zoom),h)),o.expression.evaluate(new wr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Up{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){return!!o.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class To{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new Ac(p,void 0),x=this.defaultTransitionablePropertyValues[h]=new Hh(p);this.defaultTransitioningPropertyValues[h]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}It("DataDrivenProperty",qt),It("DataConstantProperty",Ot),It("CrossFadedDataDrivenProperty",Zh),It("CrossFadedProperty",Dc),It("ColorRampProperty",Up);const jp="-transition";class As extends kt{constructor(o,h){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),h.layout&&(this._unevaluatedLayout=new ug(h.layout)),h.paint)){this._transitionablePaint=new Vp(h.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 kc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(qy,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(jp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(Fp,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(jp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[o],x=_.property.specification["property-type"]==="cross-faded-data-driven",w=_.value.isDataDriven(),I=_.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const P=this._transitionablePaint._values[o].value;return P.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(o,I,P)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,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,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}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),ke(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,_,x={}){return(!x||x.validate!==!1)&&Mu(this,o.call(ql,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:Re,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof Ms&&Tu(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const cg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Rc{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Fr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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 h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Qr(u,o=1){let h=0,p=0;return{members:u.map(_=>{const x=cg[_.type].BYTES_PER_ELEMENT,w=h=hg(h,Math.max(o,x)),I=_.components||1;return p=Math.max(p,x),h+=x*I,{name:_.name,type:_.type,components:I,offset:w}}),size:hg(h,Math.max(p,o)),alignment:o}}function hg(u,o){return Math.ceil(u/o)*o}class Nc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.int16[_+0]=h,this.int16[_+1]=p,o}}Nc.prototype.bytesPerElement=4,It("StructArrayLayout2i4",Nc);class ka extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=_,o}}ka.prototype.bytesPerElement=6,It("StructArrayLayout3i6",ka);class Gp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_)}emplace(o,h,p,_,x){const w=4*o;return this.int16[w+0]=h,this.int16[w+1]=p,this.int16[w+2]=_,this.int16[w+3]=x,o}}Gp.prototype.bytesPerElement=8,It("StructArrayLayout4i8",Gp);class qp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,x,w)}emplace(o,h,p,_,x,w,I){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=x,this.int16[P+4]=w,this.int16[P+5]=I,o}}qp.prototype.bytesPerElement=12,It("StructArrayLayout2i4i12",qp);class Wp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,x,w)}emplace(o,h,p,_,x,w,I){const P=4*o,D=8*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.uint8[D+4]=_,this.uint8[D+5]=x,this.uint8[D+6]=w,this.uint8[D+7]=I,o}}Wp.prototype.bytesPerElement=8,It("StructArrayLayout2i4ub8",Wp);class Oc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.float32[_+0]=h,this.float32[_+1]=p,o}}Oc.prototype.bytesPerElement=8,It("StructArrayLayout2f8",Oc);class Xh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w,I,P,D,z){const V=this.length;return this.resize(V+1),this.emplace(V,o,h,p,_,x,w,I,P,D,z)}emplace(o,h,p,_,x,w,I,P,D,z,V){const W=10*o;return this.uint16[W+0]=h,this.uint16[W+1]=p,this.uint16[W+2]=_,this.uint16[W+3]=x,this.uint16[W+4]=w,this.uint16[W+5]=I,this.uint16[W+6]=P,this.uint16[W+7]=D,this.uint16[W+8]=z,this.uint16[W+9]=V,o}}Xh.prototype.bytesPerElement=20,It("StructArrayLayout10ui20",Xh);class Hp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w,I,P,D,z,V,W){const X=this.length;return this.resize(X+1),this.emplace(X,o,h,p,_,x,w,I,P,D,z,V,W)}emplace(o,h,p,_,x,w,I,P,D,z,V,W,X){const Y=12*o;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=x,this.uint16[Y+4]=w,this.uint16[Y+5]=I,this.uint16[Y+6]=P,this.uint16[Y+7]=D,this.int16[Y+8]=z,this.int16[Y+9]=V,this.int16[Y+10]=W,this.int16[Y+11]=X,o}}Hp.prototype.bytesPerElement=24,It("StructArrayLayout4i4ui4i24",Hp);class Zp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,o}}Zp.prototype.bytesPerElement=12,It("StructArrayLayout3f12",Zp);class Da extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}Da.prototype.bytesPerElement=4,It("StructArrayLayout1ul4",Da);class $h extends Fr{_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,h,p,_,x,w,I,P,D){const z=this.length;return this.resize(z+1),this.emplace(z,o,h,p,_,x,w,I,P,D)}emplace(o,h,p,_,x,w,I,P,D,z){const V=10*o,W=5*o;return this.int16[V+0]=h,this.int16[V+1]=p,this.int16[V+2]=_,this.int16[V+3]=x,this.int16[V+4]=w,this.int16[V+5]=I,this.uint32[W+3]=P,this.uint16[V+8]=D,this.uint16[V+9]=z,o}}$h.prototype.bytesPerElement=20,It("StructArrayLayout6i1ul2ui20",$h);class zc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,x,w)}emplace(o,h,p,_,x,w,I){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=x,this.int16[P+4]=w,this.int16[P+5]=I,o}}zc.prototype.bytesPerElement=12,It("StructArrayLayout2i2i2i12",zc);class Yh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x){const w=this.length;return this.resize(w+1),this.emplace(w,o,h,p,_,x)}emplace(o,h,p,_,x,w){const I=4*o,P=8*o;return this.float32[I+0]=h,this.float32[I+1]=p,this.float32[I+2]=_,this.int16[P+6]=x,this.int16[P+7]=w,o}}Yh.prototype.bytesPerElement=16,It("StructArrayLayout2f1f2i16",Yh);class Fc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_)}emplace(o,h,p,_,x){const w=12*o,I=3*o;return this.uint8[w+0]=h,this.uint8[w+1]=p,this.float32[I+1]=_,this.float32[I+2]=x,o}}Fc.prototype.bytesPerElement=12,It("StructArrayLayout2ub2f12",Fc);class Kh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.uint16[x+0]=h,this.uint16[x+1]=p,this.uint16[x+2]=_,o}}Kh.prototype.bytesPerElement=6,It("StructArrayLayout3ui6",Kh);class Ru extends Fr{_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,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie,fe,we){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,o,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie,fe,we)}emplace(o,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie,fe,we,Oe){const Ee=24*o,Ae=12*o,Qe=48*o;return this.int16[Ee+0]=h,this.int16[Ee+1]=p,this.uint16[Ee+2]=_,this.uint16[Ee+3]=x,this.uint32[Ae+2]=w,this.uint32[Ae+3]=I,this.uint32[Ae+4]=P,this.uint16[Ee+10]=D,this.uint16[Ee+11]=z,this.uint16[Ee+12]=V,this.float32[Ae+7]=W,this.float32[Ae+8]=X,this.uint8[Qe+36]=Y,this.uint8[Qe+37]=ie,this.uint8[Qe+38]=fe,this.uint32[Ae+10]=we,this.int16[Ee+22]=Oe,o}}Ru.prototype.bytesPerElement=48,It("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ru);class Wl extends Fr{_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,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie,fe,we,Oe,Ee,Ae,Qe,et,St,Dt,wt,bt,ht,Pt){const gt=this.length;return this.resize(gt+1),this.emplace(gt,o,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie,fe,we,Oe,Ee,Ae,Qe,et,St,Dt,wt,bt,ht,Pt)}emplace(o,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie,fe,we,Oe,Ee,Ae,Qe,et,St,Dt,wt,bt,ht,Pt,gt){const st=32*o,Gt=16*o;return this.int16[st+0]=h,this.int16[st+1]=p,this.int16[st+2]=_,this.int16[st+3]=x,this.int16[st+4]=w,this.int16[st+5]=I,this.int16[st+6]=P,this.int16[st+7]=D,this.uint16[st+8]=z,this.uint16[st+9]=V,this.uint16[st+10]=W,this.uint16[st+11]=X,this.uint16[st+12]=Y,this.uint16[st+13]=ie,this.uint16[st+14]=fe,this.uint16[st+15]=we,this.uint16[st+16]=Oe,this.uint16[st+17]=Ee,this.uint16[st+18]=Ae,this.uint16[st+19]=Qe,this.uint16[st+20]=et,this.uint16[st+21]=St,this.uint16[st+22]=Dt,this.uint32[Gt+12]=wt,this.float32[Gt+13]=bt,this.float32[Gt+14]=ht,this.uint16[st+30]=Pt,this.uint16[st+31]=gt,o}}Wl.prototype.bytesPerElement=64,It("StructArrayLayout8i15ui1ul2f2ui64",Wl);class Jh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Jh.prototype.bytesPerElement=4,It("StructArrayLayout1f4",Jh);class Qh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.uint16[6*o+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,o}}Qh.prototype.bytesPerElement=12,It("StructArrayLayout1ui2f12",Qh);class Hl extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=4*o;return this.uint32[2*o+0]=h,this.uint16[x+2]=p,this.uint16[x+3]=_,o}}Hl.prototype.bytesPerElement=8,It("StructArrayLayout1ul2ui8",Hl);class Xp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.uint16[_+0]=h,this.uint16[_+1]=p,o}}Xp.prototype.bytesPerElement=4,It("StructArrayLayout2ui4",Xp);class $p extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}$p.prototype.bytesPerElement=2,It("StructArrayLayout1ui2",$p);class ef extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_)}emplace(o,h,p,_,x){const w=4*o;return this.float32[w+0]=h,this.float32[w+1]=p,this.float32[w+2]=_,this.float32[w+3]=x,o}}ef.prototype.bytesPerElement=16,It("StructArrayLayout4f16",ef);class fg extends Rc{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 E(this.anchorPointX,this.anchorPointY)}}fg.prototype.size=20;class y extends $h{get(o){return new fg(this,o)}}It("CollisionBoxArray",y);class a extends Rc{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]}}a.prototype.size=48;class f extends Ru{get(o){return new a(this,o)}}It("PlacedSymbolArray",f);class m extends Rc{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]}}m.prototype.size=64;class g extends Wl{get(o){return new m(this,o)}}It("SymbolInstanceArray",g);class b extends Jh{getoffsetX(o){return this.float32[1*o+0]}}It("GlyphOffsetArray",b);class T extends ka{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}It("SymbolLineVertexArray",T);class L extends Rc{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]}}L.prototype.size=12;class A extends Qh{get(o){return new L(this,o)}}It("TextAnchorOffsetArray",A);class O extends Rc{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]}}O.prototype.size=8;class U extends Hl{get(o){return new O(this,o)}}It("FeatureIndexArray",U);class j extends Nc{}class $ extends Nc{}class he extends Nc{}class ce extends qp{}class me extends Wp{}class re extends Oc{}class Ie extends Xh{}class Ue extends Hp{}class xe extends Zp{}class De extends Da{}class Ge extends zc{}class Ze extends Fc{}class Ke extends Kh{}class rt extends Xp{}const tt=Qr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ct}=tt;class dt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,_){let x=this.segments[this.segments.length-1];return o>dt.MAX_VERTEX_ARRAY_LENGTH&&qe(`Max vertices per segment is ${dt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!x||x.vertexLength+o>dt.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==_)&&(x={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(x.sortKey=_),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,_){return new dt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function cn(u,o){return 256*(u=K(Math.floor(u),0,255))+K(Math.floor(o),0,255)}dt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,It("SegmentVector",dt);const mt=Qr([{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 Xt={exports:{}},hn={exports:{}};hn.exports=function(u,o){var h,p,_,x,w,I,P,D;for(p=u.length-(h=3&u.length),_=o,w=3432918353,I=461845907,D=0;D>>16)*w&65535)<<16)&4294967295)<<15|P>>>17))*I+(((P>>>16)*I&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(P=0,h){case 3:P^=(255&u.charCodeAt(D+2))<<16;case 2:P^=(255&u.charCodeAt(D+1))<<8;case 1:_^=P=(65535&(P=(P=(65535&(P^=255&u.charCodeAt(D)))*w+(((P>>>16)*w&65535)<<16)&4294967295)<<15|P>>>17))*I+(((P>>>16)*I&65535)<<16)&4294967295}return _^=u.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var Pn=hn.exports,Qt={exports:{}};Qt.exports=function(u,o){for(var h,p=u.length,_=o^p,x=0;p>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(x)|(255&u.charCodeAt(++x))<<8|(255&u.charCodeAt(++x))<<16|(255&u.charCodeAt(++x))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++x;switch(p){case 3:_^=(255&u.charCodeAt(x+2))<<16;case 2:_^=(255&u.charCodeAt(x+1))<<8;case 1:_=1540483477*(65535&(_^=255&u.charCodeAt(x)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var mn=Pn,vn=Qt.exports;Xt.exports=mn,Xt.exports.murmur3=mn,Xt.exports.murmur2=vn;var Br=d(Xt.exports);class Yn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,_){this.ids.push(Zo(o)),this.positions.push(h,p,_)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=Zo(o);let p=0,_=this.ids.length-1;for(;p<_;){const w=p+_>>1;this.ids[w]>=h?_=w:p=w+1}const x=[];for(;this.ids[p]===h;)x.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return x}static serialize(o,h){const p=new Float64Array(o.ids),_=new Uint32Array(o.positions);return yi(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(o){const h=new Yn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function Zo(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Br(String(u))}function yi(u,o,h,p){for(;h>1];let x=h-1,w=p+1;for(;;){do x++;while(u[x]<_);do w--;while(u[w]>_);if(x>=w)break;Lr(u,x,w),Lr(o,3*x,3*w),Lr(o,3*x+1,3*w+1),Lr(o,3*x+2,3*w+2)}w-h`u_${_}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new ll(o,h):new Xo(o,h)}}class fi{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,_){const x=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&o.set(x)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new ra(o,h):new Xo(o,h)}}class Pr{constructor(o,h,p,_){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(x=>({name:`a_${x}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(o,h,p,_,x){const w=this.paintVertexArray.length,I=this.expression.evaluate(new wr(0),h,{},_,[],x);this.paintVertexArray.resize(o),this._setPaintValue(w,o,I)}updatePaintArray(o,h,p,_){const x=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(o,h,x)}_setPaintValue(o,h,p){if(this.type==="color"){const _=ul(p);for(let x=o;x`u_${I}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=h.map(I=>({name:`a_${I}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,h,p,_,x){const w=this.expression.evaluate(new wr(this.zoom),h,{},_,[],x),I=this.expression.evaluate(new wr(this.zoom+1),h,{},_,[],x),P=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(P,o,w,I)}updatePaintArray(o,h,p,_){const x=this.expression.evaluate({zoom:this.zoom},p,_),w=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(o,h,x,w)}_setPaintValue(o,h,p,_){if(this.type==="color"){const x=ul(p),w=ul(_);for(let I=o;I`#define HAS_UNIFORM_${_}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Pr||p instanceof Sr)for(let _=0;_!0){this.programConfigurations={};for(const _ of o)this.programConfigurations[_.id]=new pi(_,h,p);this.needsUpload=!1,this._featureMap=new Yn,this._bufferOffset=0}populatePaintArrays(o,h,p,_,x,w){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(o,h,_,x,w);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,_){for(const x of p)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(o,this._featureMap,h,x,_)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function ds(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 di(u,o,h){const p={color:{source:Oc,composite:ef},number:{source:Jh,composite:Oc}},_=function(x){return{"line-pattern":{source:Ie,composite:Ie},"fill-pattern":{source:Ie,composite:Ie},"fill-extrusion-pattern":{source:Ie,composite:Ie}}[x]}(u);return _&&_[h]||p[o][h]}It("ConstantBinder",ia),It("CrossFadedConstantBinder",fi),It("SourceExpressionBinder",Pr),It("CrossFadedCompositeBinder",ps),It("CompositeExpressionBinder",Sr),It("ProgramConfiguration",pi,{omit:["_buffers"]}),It("ProgramConfigurationSet",Mr);const Hr=8192,Yp=Math.pow(2,14)-1,pg=-Yp-1;function Zl(u){const o=Hr/u.extent,h=u.loadGeometry();for(let p=0;pw.x+1||Pw.y+1)&&qe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function Xl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?Zl(u):[]}}function tf(u,o,h,p,_){u.emplaceBack(2*o+(p+1)/2,2*h+(_+1)/2)}class cl{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new $,this.indexArray=new Ke,this.segments=new dt,this.programConfigurations=new Mr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const _=this.layers[0],x=[];let w=null,I=!1;_.type==="circle"&&(w=_.layout.get("circle-sort-key"),I=!w.isConstant());for(const{feature:P,id:D,index:z,sourceLayerIndex:V}of o){const W=this.layers[0]._featureFilter.needGeometry,X=Xl(P,W);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),X,p))continue;const Y=I?w.evaluate(X,{},p):void 0,ie={id:D,properties:P.properties,type:P.type,sourceLayerIndex:V,index:z,geometry:W?X.geometry:Zl(P),patterns:{},sortKey:Y};x.push(ie)}I&&x.sort((P,D)=>P.sortKey-D.sortKey);for(const P of x){const{geometry:D,index:z,sourceLayerIndex:V}=P,W=o[z].feature;this.addFeature(P,D,z,p),h.featureIndex.insert(W,D,z,V,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,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,ct),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,h,p,_){for(const x of h)for(const w of x){const I=w.x,P=w.y;if(I<0||I>=Hr||P<0||P>=Hr)continue;const D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),z=D.vertexLength;tf(this.layoutVertexArray,I,P,-1,-1),tf(this.layoutVertexArray,I,P,1,-1),tf(this.layoutVertexArray,I,P,1,1),tf(this.layoutVertexArray,I,P,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),D.vertexLength+=4,D.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},_)}}function Kp(u,o){for(let h=0;h1){if(nf(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(_)._add(o))}function gb(u,o){let h,p,_,x=!1;for(let w=0;wo.y!=_.y>o.y&&o.x<(_.x-p.x)*(o.y-p.y)/(_.y-p.y)+p.x&&(x=!x)}return x}function rf(u,o){let h=!1;for(let p=0,_=u.length-1;po.y!=w.y>o.y&&o.x<(w.x-x.x)*(o.y-x.y)/(w.y-x.y)+x.x&&(h=!h)}return h}function HT(u,o,h){const p=h[0],_=h[2];if(u.x_.x&&o.x>_.x||u.y_.y&&o.y>_.y)return!1;const x=Pe(u,o,h[0]);return x!==Pe(u,o,h[1])||x!==Pe(u,o,h[2])||x!==Pe(u,o,h[3])}function td(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function mg(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function gg(u,o,h,p,_){if(!o[0]&&!o[1])return u;const x=E.convert(o)._mult(_);h==="viewport"&&x._rotate(-p);const w=[];for(let I=0;Ibb(fe,ie))}(D,P),X=V?z*I:z;for(const Y of _)for(const ie of Y){const fe=V?ie:bb(ie,P);let we=X;const Oe=_g([],[ie.x,ie.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?we*=Oe[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(we*=w.cameraToCenterDistance/Oe[3]),dg(W,fe,we))return!0}return!1}}function bb(u,o){const h=_g([],[u.x,u.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class xb extends cl{}let wb;It("HeatmapBucket",xb,{omit:["layers"]});var YT={get paint(){return wb=wb||new To({"heatmap-radius":new qt(Re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new qt(Re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ot(Re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Up(Re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ot(Re.paint_heatmap["heatmap-opacity"])})}};function Xy(u,{width:o,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${o*h*p}`)}else _=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=_,u}function Sb(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const _=Xy({},{width:o,height:h},p);$y(u,_,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,h)},p),u.width=o,u.height=h,u.data=_.data}function $y(u,o,h,p,_,x){if(_.width===0||_.height===0)return o;if(_.width>u.width||_.height>u.height||h.x>u.width-_.width||h.y>u.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>o.width||_.height>o.height||p.x>o.width-_.width||p.y>o.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const w=u.data,I=o.data;if(w===I)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<_.height;P++){const D=((h.y+P)*u.width+h.x)*x,z=((p.y+P)*o.width+p.x)*x;for(let V=0;V<_.width*x;V++)I[z+V]=w[D+V]}return o}class rd{constructor(o,h){Xy(this,o,1,h)}resize(o){Sb(this,o,1)}clone(){return new rd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,x){$y(o,h,p,_,x,1)}}class ks{constructor(o,h){Xy(this,o,4,h)}resize(o){Sb(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new ks({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,x){$y(o,h,p,_,x,4)}}function Eb(u){const o={},h=u.resolution||256,p=u.clips?u.clips.length:1,_=u.image||new ks({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const x=(w,I,P)=>{o[u.evaluationKey]=P;const D=u.expression.evaluate(o);_.data[w+I+0]=Math.floor(255*D.r/D.a),_.data[w+I+1]=Math.floor(255*D.g/D.a),_.data[w+I+2]=Math.floor(255*D.b/D.a),_.data[w+I+3]=Math.floor(255*D.a)};if(u.clips)for(let w=0,I=0;w80*h){p=x=u[0],_=w=u[1];for(var Y=h;Yx&&(x=I),P>w&&(w=P);D=(D=Math.max(x-p,w-_))!==0?32767/D:0}return id(W,X,h,p,_,D,0),X}function Cb(u,o,h,p,_){var x,w;if(_===Qy(u,o,h,p)>0)for(x=o;x=o;x-=p)w=Pb(x,u[x],u[x+1],w);return w&&vg(w,w.next)&&(sd(w),w=w.next),w}function Vc(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!vg(p,p.next)&&ei(p.prev,p,p.next)!==0)p=p.next;else{if(sd(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function id(u,o,h,p,_,x,w){if(u){!w&&x&&function(z,V,W,X){var Y=z;do Y.z===0&&(Y.z=Ky(Y.x,Y.y,V,W,X)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==z);Y.prevZ.nextZ=null,Y.prevZ=null,function(ie){var fe,we,Oe,Ee,Ae,Qe,et,St,Dt=1;do{for(we=ie,ie=null,Ae=null,Qe=0;we;){for(Qe++,Oe=we,et=0,fe=0;fe0||St>0&&Oe;)et!==0&&(St===0||!Oe||we.z<=Oe.z)?(Ee=we,we=we.nextZ,et--):(Ee=Oe,Oe=Oe.nextZ,St--),Ae?Ae.nextZ=Ee:ie=Ee,Ee.prevZ=Ae,Ae=Ee;we=Oe}Ae.nextZ=null,Dt*=2}while(Qe>1)}(Y)}(u,p,_,x);for(var I,P,D=u;u.prev!==u.next;)if(I=u.prev,P=u.next,x?rL(u,p,_,x):nL(u))o.push(I.i/h|0),o.push(u.i/h|0),o.push(P.i/h|0),sd(u),u=P.next,D=P.next;else if((u=P)===D){w?w===1?id(u=iL(Vc(u),o,h),o,h,p,_,x,2):w===2&&oL(u,o,h,p,_,x):id(Vc(u),o,h,p,_,x,1);break}}}function nL(u){var o=u.prev,h=u,p=u.next;if(ei(o,h,p)>=0)return!1;for(var _=o.x,x=h.x,w=p.x,I=o.y,P=h.y,D=p.y,z=_x?_>w?_:w:x>w?x:w,X=I>P?I>D?I:D:P>D?P:D,Y=p.next;Y!==o;){if(Y.x>=z&&Y.x<=W&&Y.y>=V&&Y.y<=X&&sf(_,I,x,P,w,D,Y.x,Y.y)&&ei(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function rL(u,o,h,p){var _=u.prev,x=u,w=u.next;if(ei(_,x,w)>=0)return!1;for(var I=_.x,P=x.x,D=w.x,z=_.y,V=x.y,W=w.y,X=IP?I>D?I:D:P>D?P:D,fe=z>V?z>W?z:W:V>W?V:W,we=Ky(X,Y,o,h,p),Oe=Ky(ie,fe,o,h,p),Ee=u.prevZ,Ae=u.nextZ;Ee&&Ee.z>=we&&Ae&&Ae.z<=Oe;){if(Ee.x>=X&&Ee.x<=ie&&Ee.y>=Y&&Ee.y<=fe&&Ee!==_&&Ee!==w&&sf(I,z,P,V,D,W,Ee.x,Ee.y)&&ei(Ee.prev,Ee,Ee.next)>=0||(Ee=Ee.prevZ,Ae.x>=X&&Ae.x<=ie&&Ae.y>=Y&&Ae.y<=fe&&Ae!==_&&Ae!==w&&sf(I,z,P,V,D,W,Ae.x,Ae.y)&&ei(Ae.prev,Ae,Ae.next)>=0))return!1;Ae=Ae.nextZ}for(;Ee&&Ee.z>=we;){if(Ee.x>=X&&Ee.x<=ie&&Ee.y>=Y&&Ee.y<=fe&&Ee!==_&&Ee!==w&&sf(I,z,P,V,D,W,Ee.x,Ee.y)&&ei(Ee.prev,Ee,Ee.next)>=0)return!1;Ee=Ee.prevZ}for(;Ae&&Ae.z<=Oe;){if(Ae.x>=X&&Ae.x<=ie&&Ae.y>=Y&&Ae.y<=fe&&Ae!==_&&Ae!==w&&sf(I,z,P,V,D,W,Ae.x,Ae.y)&&ei(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.nextZ}return!0}function iL(u,o,h){var p=u;do{var _=p.prev,x=p.next.next;!vg(_,x)&&Tb(_,p,p.next,x)&&od(_,x)&&od(x,_)&&(o.push(_.i/h|0),o.push(p.i/h|0),o.push(x.i/h|0),sd(p),sd(p.next),p=u=x),p=p.next}while(p!==u);return Vc(p)}function oL(u,o,h,p,_,x){var w=u;do{for(var I=w.next.next;I!==w.prev;){if(w.i!==I.i&&cL(w,I)){var P=Lb(w,I);return w=Vc(w,w.next),P=Vc(P,P.next),id(w,o,h,p,_,x,0),void id(P,o,h,p,_,x,0)}I=I.next}w=w.next}while(w!==u)}function sL(u,o){return u.x-o.x}function aL(u,o){var h=function(_,x){var w,I=x,P=_.x,D=_.y,z=-1/0;do{if(D<=I.y&&D>=I.next.y&&I.next.y!==I.y){var V=I.x+(D-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(V<=P&&V>z&&(z=V,w=I.x=I.x&&I.x>=Y&&P!==I.x&&sf(Dw.x||I.x===w.x&&lL(w,I)))&&(w=I,fe=W)),I=I.next;while(I!==X);return w}(u,o);if(!h)return o;var p=Lb(h,u);return Vc(p,p.next),Vc(h,h.next)}function lL(u,o){return ei(u.prev,u,o.prev)<0&&ei(o.next,u,u.next)<0}function Ky(u,o,h,p,_){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*_|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*_|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function uL(u){var o=u,h=u;do(o.x=(u-w)*(x-I)&&(u-w)*(p-I)>=(h-w)*(o-I)&&(h-w)*(x-I)>=(_-w)*(p-I)}function cL(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&Tb(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(u,o)&&(od(u,o)&&od(o,u)&&function(h,p){var _=h,x=!1,w=(h.x+p.x)/2,I=(h.y+p.y)/2;do _.y>I!=_.next.y>I&&_.next.y!==_.y&&w<(_.next.x-_.x)*(I-_.y)/(_.next.y-_.y)+_.x&&(x=!x),_=_.next;while(_!==h);return x}(u,o)&&(ei(u.prev,u,o.prev)||ei(u,o.prev,o))||vg(u,o)&&ei(u.prev,u,u.next)>0&&ei(o.prev,o,o.next)>0)}function ei(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function vg(u,o){return u.x===o.x&&u.y===o.y}function Tb(u,o,h,p){var _=xg(ei(u,o,h)),x=xg(ei(u,o,p)),w=xg(ei(h,p,u)),I=xg(ei(h,p,o));return _!==x&&w!==I||!(_!==0||!bg(u,h,o))||!(x!==0||!bg(u,p,o))||!(w!==0||!bg(h,u,p))||!(I!==0||!bg(h,o,p))}function bg(u,o,h){return o.x<=Math.max(u.x,h.x)&&o.x>=Math.min(u.x,h.x)&&o.y<=Math.max(u.y,h.y)&&o.y>=Math.min(u.y,h.y)}function xg(u){return u>0?1:u<0?-1:0}function od(u,o){return ei(u.prev,u,u.next)<0?ei(u,o,u.next)>=0&&ei(u,u.prev,o)>=0:ei(u,o,u.prev)<0||ei(u,u.next,o)<0}function Lb(u,o){var h=new Jy(u.i,u.x,u.y),p=new Jy(o.i,o.x,o.y),_=u.next,x=o.prev;return u.next=o,o.prev=u,h.next=_,_.prev=h,p.next=h,h.prev=p,x.next=p,p.prev=x,p}function Pb(u,o,h,p){var _=new Jy(u,o,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function sd(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 Jy(u,o,h){this.i=u,this.x=o,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Qy(u,o,h,p){for(var _=0,x=o,w=h-p;x0&&h.holes.push(p+=u[_-1].length)}return h};var Mb=d(Yy.exports);function hL(u,o,h,p,_){Ab(u,o,h||0,p||u.length-1,_||fL)}function Ab(u,o,h,p,_){for(;p>h;){if(p-h>600){var x=p-h+1,w=o-h+1,I=Math.log(x),P=.5*Math.exp(2*I/3),D=.5*Math.sqrt(I*P*(x-P)/x)*(w-x/2<0?-1:1);Ab(u,o,Math.max(h,Math.floor(o-w*P/x+D)),Math.min(p,Math.floor(o+(x-w)*P/x+D)),_)}var z=u[o],V=h,W=p;for(ad(u,h,o),_(u[p],z)>0&&ad(u,h,p);V0;)W--}_(u[h],z)===0?ad(u,h,W):ad(u,++W,p),W<=o&&(h=W+1),o<=W&&(p=W-1)}}function ad(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function fL(u,o){return uo?1:0}function e0(u,o){const h=u.length;if(h<=1)return[u];const p=[];let _,x;for(let w=0;w1)for(let w=0;wh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new he,this.indexArray=new Ke,this.indexArray2=new rt,this.programConfigurations=new Mr(o.layers,o.zoom),this.segments=new dt,this.segments2=new dt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=t0("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),x=!_.isConstant(),w=[];for(const{feature:I,id:P,index:D,sourceLayerIndex:z}of o){const V=this.layers[0]._featureFilter.needGeometry,W=Xl(I,V);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),W,p))continue;const X=x?_.evaluate(W,{},p,h.availableImages):void 0,Y={id:P,properties:I.properties,type:I.type,sourceLayerIndex:z,index:D,geometry:V?W.geometry:Zl(I),patterns:{},sortKey:X};w.push(Y)}x&&w.sort((I,P)=>I.sortKey-P.sortKey);for(const I of w){const{geometry:P,index:D,sourceLayerIndex:z}=I;if(this.hasPattern){const V=n0("fill",this.layers,I,this.zoom,h);this.patternFeatures.push(V)}else this.addFeature(I,P,D,p,{});h.featureIndex.insert(o[D].feature,P,D,z,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,tL),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,h,p,_,x){for(const w of e0(h,500)){let I=0;for(const X of w)I+=X.length;const P=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),D=P.vertexLength,z=[],V=[];for(const X of w){if(X.length===0)continue;X!==w[0]&&V.push(z.length/2);const Y=this.segments2.prepareSegment(X.length,this.layoutVertexArray,this.indexArray2),ie=Y.vertexLength;this.layoutVertexArray.emplaceBack(X[0].x,X[0].y),this.indexArray2.emplaceBack(ie+X.length-1,ie),z.push(X[0].x),z.push(X[0].y);for(let fe=1;fe>3}if(_--,p===1||p===2)x+=u.readSVarint(),w+=u.readSVarint(),p===1&&(o&&I.push(o),o=[]),o.push(new vL(x,w));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&I.push(o),I},af.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,_=0,x=0,w=1/0,I=-1/0,P=1/0,D=-1/0;u.pos>3}if(p--,h===1||h===2)(_+=u.readSVarint())I&&(I=_),(x+=u.readSVarint())D&&(D=x);else if(h!==7)throw new Error("unknown command "+h)}return[w,P,I,D]},af.prototype.toGeoJSON=function(u,o,h){var p,_,x=this.extent*Math.pow(2,h),w=this.extent*u,I=this.extent*o,P=this.loadGeometry(),D=af.types[this.type];function z(X){for(var Y=0;Y>3;_=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 _}(h))}Ob.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 wL(this._pbf,o,this.extent,this._keys,this._values)};var EL=Nb;function IL(u,o,h){if(u===3){var p=new EL(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}Nu.VectorTile=function(u,o){this.layers=u.readFields(IL,{},o)},Nu.VectorTileFeature=Rb,Nu.VectorTileLayer=Nb;const CL=Nu.VectorTileFeature.types,i0=Math.pow(2,13);function ld(u,o,h,p,_,x,w,I){u.emplaceBack(o,h,2*Math.floor(p*i0)+w,_*i0*2,x*i0*2,Math.round(I))}class o0{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new ce,this.centroidVertexArray=new j,this.indexArray=new Ke,this.programConfigurations=new Mr(o.layers,o.zoom),this.segments=new dt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=t0("fill-extrusion",this.layers,h);for(const{feature:_,id:x,index:w,sourceLayerIndex:I}of o){const P=this.layers[0]._featureFilter.needGeometry,D=Xl(_,P);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),D,p))continue;const z={id:x,sourceLayerIndex:I,index:w,geometry:P?D.geometry:Zl(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(n0("fill-extrusion",this.layers,z,this.zoom,h)):this.addFeature(z,z.geometry,w,p,{}),h.featureIndex.insert(_,z.geometry,w,I,this.index,!0)}}addFeatures(o,h,p){for(const _ of this.features){const{geometry:x}=_;this.addFeature(_,x,_.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,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,yL),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,_L.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,h,p,_,x){const w={x:0,y:0,vertexCount:0};for(const I of e0(h,500)){let P=0;for(const Y of I)P+=Y.length;let D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of I){if(Y.length===0||LL(Y))continue;let ie=0;for(let fe=0;fe=1){const Oe=Y[fe-1];if(!TL(we,Oe)){D.vertexLength+4>dt.MAX_VERTEX_ARRAY_LENGTH&&(D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Ee=we.sub(Oe)._perp()._unit(),Ae=Oe.dist(we);ie+Ae>32768&&(ie=0),ld(this.layoutVertexArray,we.x,we.y,Ee.x,Ee.y,0,0,ie),ld(this.layoutVertexArray,we.x,we.y,Ee.x,Ee.y,0,1,ie),w.x+=2*we.x,w.y+=2*we.y,w.vertexCount+=2,ie+=Ae,ld(this.layoutVertexArray,Oe.x,Oe.y,Ee.x,Ee.y,0,0,ie),ld(this.layoutVertexArray,Oe.x,Oe.y,Ee.x,Ee.y,0,1,ie),w.x+=2*Oe.x,w.y+=2*Oe.y,w.vertexCount+=2;const Qe=D.vertexLength;this.indexArray.emplaceBack(Qe,Qe+2,Qe+1),this.indexArray.emplaceBack(Qe+1,Qe+2,Qe+3),D.vertexLength+=4,D.primitiveLength+=2}}}}if(D.vertexLength+P>dt.MAX_VERTEX_ARRAY_LENGTH&&(D=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),CL[o.type]!=="Polygon")continue;const z=[],V=[],W=D.vertexLength;for(const Y of I)if(Y.length!==0){Y!==I[0]&&V.push(z.length/2);for(let ie=0;ieHr)||u.y===o.y&&(u.y<0||u.y>Hr)}function LL(u){return u.every(o=>o.x<0)||u.every(o=>o.x>Hr)||u.every(o=>o.y<0)||u.every(o=>o.y>Hr)}let zb;It("FillExtrusionBucket",o0,{omit:["layers","features"]});var PL={get paint(){return zb=zb||new To({"fill-extrusion-opacity":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qt(Re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zh(Re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new qt(Re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qt(Re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ML extends As{constructor(o){super(o,PL)}createBucket(o){return new o0(o)}queryRadius(){return mg(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,_,x,w,I,P){const D=gg(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,I),z=this.paint.get("fill-extrusion-height").evaluate(h,p),V=this.paint.get("fill-extrusion-base").evaluate(h,p),W=function(Y,ie,fe,we){const Oe=[];for(const Ee of Y){const Ae=[Ee.x,Ee.y,0,1];_g(Ae,Ae,ie),Oe.push(new E(Ae[0]/Ae[3],Ae[1]/Ae[3]))}return Oe}(D,P),X=function(Y,ie,fe,we){const Oe=[],Ee=[],Ae=we[8]*ie,Qe=we[9]*ie,et=we[10]*ie,St=we[11]*ie,Dt=we[8]*fe,wt=we[9]*fe,bt=we[10]*fe,ht=we[11]*fe;for(const Pt of Y){const gt=[],st=[];for(const Gt of Pt){const Nt=Gt.x,xn=Gt.y,dr=we[0]*Nt+we[4]*xn+we[12],Er=we[1]*Nt+we[5]*xn+we[13],xi=we[2]*Nt+we[6]*xn+we[14],ms=we[3]*Nt+we[7]*xn+we[15],Po=xi+et,mi=ms+St,Vi=dr+Dt,$i=Er+wt,Mo=xi+bt,Ao=ms+ht,wi=new E((dr+Ae)/mi,(Er+Qe)/mi);wi.z=Po/mi,gt.push(wi);const Si=new E(Vi/Ao,$i/Ao);Si.z=Mo/Ao,st.push(Si)}Oe.push(gt),Ee.push(st)}return[Oe,Ee]}(_,V,z,P);return function(Y,ie,fe){let we=1/0;Jp(fe,ie)&&(we=Fb(fe,ie[0]));for(let Oe=0;Oeh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new me,this.layoutVertexArray2=new re,this.indexArray=new Ke,this.programConfigurations=new Mr(o.layers,o.zoom),this.segments=new dt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=t0("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),x=!_.isConstant(),w=[];for(const{feature:I,id:P,index:D,sourceLayerIndex:z}of o){const V=this.layers[0]._featureFilter.needGeometry,W=Xl(I,V);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),W,p))continue;const X=x?_.evaluate(W,{},p):void 0,Y={id:P,properties:I.properties,type:I.type,sourceLayerIndex:z,index:D,geometry:V?W.geometry:Zl(I),patterns:{},sortKey:X};w.push(Y)}x&&w.sort((I,P)=>I.sortKey-P.sortKey);for(const I of w){const{geometry:P,index:D,sourceLayerIndex:z}=I;if(this.hasPattern){const V=n0("line",this.layers,I,this.zoom,h);this.patternFeatures.push(V)}else this.addFeature(I,P,D,p,{});h.featureIndex.insert(o[D].feature,P,D,z,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,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,RL)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,kL),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,h,p,_,x){const w=this.layers[0].layout,I=w.get("line-join").evaluate(o,{}),P=w.get("line-cap"),D=w.get("line-miter-limit"),z=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const V of h)this.addLine(V,o,I,P,D,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,x,_)}addLine(o,h,p,_,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let we=0;we=2&&o[P-1].equals(o[P-2]);)P--;let D=0;for(;D0;if(St&&we>D){const ht=W.dist(X);if(ht>2*z){const Pt=W.sub(W.sub(X)._mult(z/ht)._round());this.updateDistance(X,Pt),this.addCurrentVertex(Pt,ie,0,0,V),X=Pt}}const wt=X&&Y;let bt=wt?p:I?"butt":_;if(wt&&bt==="round"&&(Qex&&(bt="bevel"),bt==="bevel"&&(Qe>2&&(bt="flipbevel"),Qe100)Oe=fe.mult(-1);else{const ht=Qe*ie.add(fe).mag()/ie.sub(fe).mag();Oe._perp()._mult(ht*(Dt?-1:1))}this.addCurrentVertex(W,Oe,0,0,V),this.addCurrentVertex(W,Oe.mult(-1),0,0,V)}else if(bt==="bevel"||bt==="fakeround"){const ht=-Math.sqrt(Qe*Qe-1),Pt=Dt?ht:0,gt=Dt?0:ht;if(X&&this.addCurrentVertex(W,ie,Pt,gt,V),bt==="fakeround"){const st=Math.round(180*et/Math.PI/20);for(let Gt=1;Gt2*z){const Pt=W.add(Y.sub(W)._mult(z/ht)._round());this.updateDistance(W,Pt),this.addCurrentVertex(Pt,fe,0,0,V),W=Pt}}}}addCurrentVertex(o,h,p,_,x,w=!1){const I=h.y*_-h.x,P=-h.y-h.x*_;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,w,!1,p,x),this.addHalfVertex(o,I,P,w,!0,-_,x),this.distance>Bb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,_,x,w))}addHalfVertex({x:o,y:h},p,_,x,w,I,P){const D=.5*(this.lineClips?this.scaledDistance*(Bb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(x?1:0),(h<<1)+(w?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(I===0?0:I<0?-1:1)|(63&D)<<2,D>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const z=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),P.primitiveLength++),w?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let Vb,Ub;It("LineBucket",s0,{omit:["layers","patternFeatures"]});var jb={get paint(){return Ub=Ub||new To({"line-opacity":new qt(Re.paint_line["line-opacity"]),"line-color":new qt(Re.paint_line["line-color"]),"line-translate":new Ot(Re.paint_line["line-translate"]),"line-translate-anchor":new Ot(Re.paint_line["line-translate-anchor"]),"line-width":new qt(Re.paint_line["line-width"]),"line-gap-width":new qt(Re.paint_line["line-gap-width"]),"line-offset":new qt(Re.paint_line["line-offset"]),"line-blur":new qt(Re.paint_line["line-blur"]),"line-dasharray":new Dc(Re.paint_line["line-dasharray"]),"line-pattern":new Zh(Re.paint_line["line-pattern"]),"line-gradient":new Up(Re.paint_line["line-gradient"])})},get layout(){return Vb=Vb||new To({"line-cap":new Ot(Re.layout_line["line-cap"]),"line-join":new qt(Re.layout_line["line-join"]),"line-miter-limit":new Ot(Re.layout_line["line-miter-limit"]),"line-round-limit":new Ot(Re.layout_line["line-round-limit"]),"line-sort-key":new qt(Re.layout_line["line-sort-key"])})}};class zL extends qt{possiblyEvaluate(o,h){return h=new wr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,_){return h=ae({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,_)}}let wg;class FL extends As{constructor(o){super(o,jb),this.gradientVersion=0,wg||(wg=new zL(jb.paint.properties["line-width"].specification),wg.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Ic,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=wg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new s0(o)}queryRadius(o){const h=o,p=Gb(td("line-width",this,h),td("line-gap-width",this,h)),_=td("line-offset",this,h);return p/2+Math.abs(_)+mg(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,_,x,w,I){const P=gg(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,I),D=I/2*Gb(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),z=this.paint.get("line-offset").evaluate(h,p);return z&&(_=function(V,W){const X=[];for(let Y=0;Y=3){for(let fe=0;fe0?o+2*u:u}const BL=Qr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),VL=Qr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Qr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const UL=Qr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Qr([{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 qb=Qr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),jL=Qr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function GL(u,o,h){return u.sections.forEach(p=>{p.text=function(_,x,w){const I=x.layout.get("text-transform").evaluate(w,{});return I==="uppercase"?_=_.toLocaleUpperCase():I==="lowercase"&&(_=_.toLocaleLowerCase()),al.applyArabicShaping&&(_=al.applyArabicShaping(_)),_}(p.text,o,h)}),u}Qr([{name:"triangle",components:3,type:"Uint16"}]),Qr([{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"}]),Qr([{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"}]),Qr([{type:"Float32",name:"offsetX"}]),Qr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Qr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const cd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var bi=24,Wb=tr,Hb=function(u,o,h,p,_){var x,w,I=8*_-p-1,P=(1<>1,z=-7,V=h?_-1:0,W=h?-1:1,X=u[o+V];for(V+=W,x=X&(1<<-z)-1,X>>=-z,z+=I;z>0;x=256*x+u[o+V],V+=W,z-=8);for(w=x&(1<<-z)-1,x>>=-z,z+=p;z>0;w=256*w+u[o+V],V+=W,z-=8);if(x===0)x=1-D;else{if(x===P)return w?NaN:1/0*(X?-1:1);w+=Math.pow(2,p),x-=D}return(X?-1:1)*w*Math.pow(2,x-p)},Zb=function(u,o,h,p,_,x){var w,I,P,D=8*x-_-1,z=(1<>1,W=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,X=p?0:x-1,Y=p?1:-1,ie=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(I=isNaN(o)?1:0,w=z):(w=Math.floor(Math.log(o)/Math.LN2),o*(P=Math.pow(2,-w))<1&&(w--,P*=2),(o+=w+V>=1?W/P:W*Math.pow(2,1-V))*P>=2&&(w++,P/=2),w+V>=z?(I=0,w=z):w+V>=1?(I=(o*P-1)*Math.pow(2,_),w+=V):(I=o*Math.pow(2,V-1)*Math.pow(2,_),w=0));_>=8;u[h+X]=255&I,X+=Y,I/=256,_-=8);for(w=w<<_|I,D+=_;D>0;u[h+X]=255&w,X+=Y,w/=256,D-=8);u[h+X-Y]|=128*ie};function tr(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}tr.Varint=0,tr.Fixed64=1,tr.Bytes=2,tr.Fixed32=5;var a0=4294967296,Xb=1/a0,$b=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function $l(u){return u.type===tr.Bytes?u.readVarint()+u.pos:u.pos+1}function lf(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function Yb(u,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=u;_--)h.buf[_+p]=h.buf[_]}function qL(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function Kb(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}tr.prototype={destroy:function(){this.buf=null},readFields:function(u,o,h){for(h=h||this.length;this.pos>3,x=this.pos;this.type=7&p,u(_,o,this),this.pos===x&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=Sg(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=Kb(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=Sg(this.buf,this.pos)+Sg(this.buf,this.pos+4)*a0;return this.pos+=8,u},readSFixed64:function(){var u=Sg(this.buf,this.pos)+Kb(this.buf,this.pos+4)*a0;return this.pos+=8,u},readFloat:function(){var u=Hb(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=Hb(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(_,x,w){var I,P,D=w.buf;if(I=(112&(P=D[w.pos++]))>>4,P<128||(I|=(127&(P=D[w.pos++]))<<3,P<128)||(I|=(127&(P=D[w.pos++]))<<10,P<128)||(I|=(127&(P=D[w.pos++]))<<17,P<128)||(I|=(127&(P=D[w.pos++]))<<24,P<128)||(I|=(1&(P=D[w.pos++]))<<31,P<128))return lf(_,I,x);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=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&&$b?function(h,p,_){return $b.decode(h.subarray(p,_))}(this.buf,o,u):function(h,p,_){for(var x="",w=p;w<_;){var I,P,D,z=h[w],V=null,W=z>239?4:z>223?3:z>191?2:1;if(w+W>_)break;W===1?z<128&&(V=z):W===2?(192&(I=h[w+1]))==128&&(V=(31&z)<<6|63&I)<=127&&(V=null):W===3?(P=h[w+2],(192&(I=h[w+1]))==128&&(192&P)==128&&((V=(15&z)<<12|(63&I)<<6|63&P)<=2047||V>=55296&&V<=57343)&&(V=null)):W===4&&(P=h[w+2],D=h[w+3],(192&(I=h[w+1]))==128&&(192&P)==128&&(192&D)==128&&((V=(15&z)<<18|(63&I)<<12|(63&P)<<6|63&D)<=65535||V>=1114112)&&(V=null)),V===null?(V=65533,W=1):V>65535&&(V-=65536,x+=String.fromCharCode(V>>>10&1023|55296),V=56320|1023&V),x+=String.fromCharCode(V),w+=W}return x}(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!==tr.Bytes)return u.push(this.readVarint(o));var h=$l(this);for(u=u||[];this.pos127;);else if(o===tr.Bytes)this.pos=this.readVarint()+this.pos;else if(o===tr.Fixed32)this.pos+=4;else{if(o!==tr.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,h){var p,_;if(o>=0?(p=o%4294967296|0,_=o/4294967296|0):(_=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,_=_+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(x,w,I){I.buf[I.pos++]=127&x|128,x>>>=7,I.buf[I.pos++]=127&x|128,x>>>=7,I.buf[I.pos++]=127&x|128,x>>>=7,I.buf[I.pos++]=127&x|128,I.buf[I.pos]=127&(x>>>=7)}(p,0,h),function(x,w){var I=(7&x)<<4;w.buf[w.pos++]|=I|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(_,h)}(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,_,x){for(var w,I,P=0;P<_.length;P++){if((w=_.charCodeAt(P))>55295&&w<57344){if(!I){w>56319||P+1===_.length?(p[x++]=239,p[x++]=191,p[x++]=189):I=w;continue}if(w<56320){p[x++]=239,p[x++]=191,p[x++]=189,I=w;continue}w=I-55296<<10|w-56320|65536,I=null}else I&&(p[x++]=239,p[x++]=191,p[x++]=189,I=null);w<128?p[x++]=w:(w<2048?p[x++]=w>>6|192:(w<65536?p[x++]=w>>12|224:(p[x++]=w>>18|240,p[x++]=w>>12&63|128),p[x++]=w>>6&63|128),p[x++]=63&w|128)}return x}(this.buf,u,this.pos);var h=this.pos-o;h>=128&&Yb(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),Zb(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),Zb(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 h=0;h=128&&Yb(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,h){this.writeTag(u,tr.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,qL,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,WL,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,XL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,HL,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,ZL,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,$L,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,YL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,KL,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,JL,o)},writeBytesField:function(u,o){this.writeTag(u,tr.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,tr.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,tr.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,tr.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,tr.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,tr.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,tr.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,tr.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,tr.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,tr.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var l0=d(Wb);const u0=3;function QL(u,o,h){u===1&&h.readMessage(eP,o)}function eP(u,o,h){if(u===3){const{id:p,bitmap:_,width:x,height:w,left:I,top:P,advance:D}=h.readMessage(tP,{});o.push({id:p,bitmap:new rd({width:x+2*u0,height:w+2*u0},_),metrics:{width:x,height:w,left:I,top:P,advance:D}})}}function tP(u,o,h){u===1?o.id=h.readVarint():u===2?o.bitmap=h.readBytes():u===3?o.width=h.readVarint():u===4?o.height=h.readVarint():u===5?o.left=h.readSVarint():u===6?o.top=h.readSVarint():u===7&&(o.advance=h.readVarint())}const Jb=u0;function Qb(u){let o=0,h=0;for(const w of u)o+=w.w*w.h,h=Math.max(h,w.w);u.sort((w,I)=>I.h-w.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let _=0,x=0;for(const w of u)for(let I=p.length-1;I>=0;I--){const P=p[I];if(!(w.w>P.w||w.h>P.h)){if(w.x=P.x,w.y=P.y,x=Math.max(x,w.y+w.h),_=Math.max(_,w.x+w.w),w.w===P.w&&w.h===P.h){const D=p.pop();I=0&&p>=o&&Ig[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new cf;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push(fd.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Eg(u,o,h,p,_,x,w,I,P,D,z,V,W,X,Y,ie){const fe=cf.fromFeature(u,_);let we;V===c.ah.vertical&&fe.verticalizePunctuation();const{processBidirectionalText:Oe,processStyledBidirectionalText:Ee}=al;if(Oe&&fe.sections.length===1){we=[];const et=Oe(fe.toString(),h0(fe,D,x,o,p,X,Y));for(const St of et){const Dt=new cf;Dt.text=St,Dt.sections=fe.sections;for(let wt=0;wt0&&Kl>Yo&&(Yo=Kl)}else{const Rs=Dt[In.fontStack],Jo=Rs&&Rs[Yi];if(Jo&&Jo.rect)Ra=Jo.rect,oa=Jo.metrics;else{const Kl=St[In.fontStack],_d=Kl&&Kl[Yi];if(!_d)continue;oa=_d.metrics}Ii=(Si-In.scale)*bi}sa?(et.verticalizable=!0,po.push({glyph:Yi,imageName:Na,x:dr,y:Er+Ii,vertical:sa,scale:In.scale,fontStack:In.fontStack,sectionIndex:mo,metrics:oa,rect:Ra}),dr+=Yl*In.scale+Gt):(po.push({glyph:Yi,imageName:Na,x:dr,y:Er+Ii,vertical:sa,scale:In.scale,fontStack:In.fontStack,sectionIndex:mo,metrics:oa,rect:Ra}),dr+=oa.advance*In.scale+Gt)}po.length!==0&&(xi=Math.max(dr-Gt,xi),iP(po,0,po.length-1,Po,Yo)),dr=0;const Ko=ht*Si+Yo;ko.lineOffset=Math.max(Yo,fo),Er+=Ko,ms=Math.max(Ko,ms),++mi}var Vi;const $i=Er-hd,{horizontalAlign:Mo,verticalAlign:Ao}=f0(Pt);(function(wi,Si,fo,ko,po,Yo,Ko,Ei,In){const mo=(Si-fo)*po;let Yi=0;Yi=Yo!==Ko?-Ei*ko-hd:(-ko*In+.5)*Ko;for(const Ii of wi)for(const oa of Ii.positionedGlyphs)oa.x+=mo,oa.y+=Yi})(et.positionedLines,Po,Mo,Ao,xi,ms,ht,$i,bt.length),et.top+=-Ao*$i,et.bottom=et.top+$i,et.left+=-Mo*xi,et.right=et.left+xi}(Qe,o,h,p,we,w,I,P,V,D,W,ie),!function(et){for(const St of et)if(St.positionedGlyphs.length!==0)return!1;return!0}(Ae)&&Qe}const Ig={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},nP={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 tx(u,o,h,p,_,x){if(o.imageName){const w=p[o.imageName];return w?w.displaySize[0]*o.scale*bi/x+_:0}{const w=h[o.fontStack],I=w&&w[u];return I?I.metrics.advance*o.scale+_:0}}function nx(u,o,h,p){const _=Math.pow(u-o,2);return p?u=0;let z=0;for(let W=0;Ww.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=Zy([]),this.placementViewportMatrix=Zy([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=sx(this.zoom,h["text-size"]),this.iconSizeData=sx(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),x=p.get("symbol-z-order");this.canOverlap=p0(p,"text-overlap","text-allow-overlap")!=="never"||p0(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(w=>c.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new m0(new Mr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new m0(new Mr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new b,this.lineVertexArray=new T,this.symbolInstances=new g,this.textAnchorOffsets=new A}calculateGlyphDependencies(o,h,p,_,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),z=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,V=x.get("symbol-sort-key");if(this.features=[],!D&&!z)return;const W=h.iconDependencies,X=h.glyphDependencies,Y=h.availableImages,ie=new wr(this.zoom);for(const{feature:fe,id:we,index:Oe,sourceLayerIndex:Ee}of o){const Ae=_._featureFilter.needGeometry,Qe=Xl(fe,Ae);if(!_._featureFilter.filter(ie,Qe,p))continue;let et,St;if(Ae||(Qe.geometry=Zl(fe)),D){const wt=_.getValueAndResolveTokens("text-field",Qe,p,Y),bt=qo.factory(wt),ht=this.hasRTLText=this.hasRTLText||lP(bt);(!ht||al.getRTLTextPluginStatus()==="unavailable"||ht&&al.isParsed())&&(et=GL(bt,_,Qe))}if(z){const wt=_.getValueAndResolveTokens("icon-image",Qe,p,Y);St=wt instanceof fs?wt:fs.fromString(wt)}if(!et&&!St)continue;const Dt=this.sortFeaturesByKey?V.evaluate(Qe,{},p):void 0;if(this.features.push({id:we,text:et,icon:St,index:Oe,sourceLayerIndex:Ee,geometry:Qe.geometry,properties:fe.properties,type:sP[fe.type],sortKey:Dt}),St&&(W[St.name]=!0),et){const wt=w.evaluate(Qe,{},p).join(","),bt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ah.vertical)>=0;for(const ht of et.sections)if(ht.image)W[ht.image.name]=!0;else{const Pt=Du(et.toString()),gt=ht.fontStack||wt,st=X[gt]=X[gt]||{};this.calculateGlyphDependencies(ht.text,st,bt,this.allowVerticalPlacement,Pt)}}}x.get("symbol-placement")==="line"&&(this.features=function(fe){const we={},Oe={},Ee=[];let Ae=0;function Qe(wt){Ee.push(fe[wt]),Ae++}function et(wt,bt,ht){const Pt=Oe[wt];return delete Oe[wt],Oe[bt]=Pt,Ee[Pt].geometry[0].pop(),Ee[Pt].geometry[0]=Ee[Pt].geometry[0].concat(ht[0]),Pt}function St(wt,bt,ht){const Pt=we[bt];return delete we[bt],we[wt]=Pt,Ee[Pt].geometry[0].shift(),Ee[Pt].geometry[0]=ht[0].concat(Ee[Pt].geometry[0]),Pt}function Dt(wt,bt,ht){const Pt=ht?bt[0][bt[0].length-1]:bt[0][0];return`${wt}:${Pt.x}:${Pt.y}`}for(let wt=0;wtwt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((fe,we)=>fe.sortKey-we.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,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,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let _=o.dist(h[o.segment+1]),x=o.dist(h[o.segment]);const w={};for(let I=o.segment+1;I=0;I--)w[I]={x:h[I].x,y:h[I].y,tileUnitDistanceFromAnchor:x},I>0&&(x+=h[I-1].dist(h[I]));for(let I=0;I0}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,h){const p=o.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let x=p.vertexStartIndex;x<_;x+=4)o.indexArray.emplaceBack(x,x+1,x+2),o.indexArray.emplaceBack(x+1,x+2,x+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),_=[],x=[],w=[];for(let I=0;I_[I]-_[P]||x[P]-x[I]),w}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,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 h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,x,w)=>{_>=0&&w.indexOf(_)===x&&this.addIndicesForPlacedSymbol(this.text,_)}),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 ax,lx;It("SymbolBucket",hf,{omit:["layers","collisionBoxArray","features","compareText"]}),hf.MAX_GLYPHS=65535,hf.addDynamicAttributes=d0;var _0={get paint(){return lx=lx||new To({"icon-opacity":new qt(Re.paint_symbol["icon-opacity"]),"icon-color":new qt(Re.paint_symbol["icon-color"]),"icon-halo-color":new qt(Re.paint_symbol["icon-halo-color"]),"icon-halo-width":new qt(Re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qt(Re.paint_symbol["icon-halo-blur"]),"icon-translate":new Ot(Re.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ot(Re.paint_symbol["icon-translate-anchor"]),"text-opacity":new qt(Re.paint_symbol["text-opacity"]),"text-color":new qt(Re.paint_symbol["text-color"],{runtimeType:Wr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new qt(Re.paint_symbol["text-halo-color"]),"text-halo-width":new qt(Re.paint_symbol["text-halo-width"]),"text-halo-blur":new qt(Re.paint_symbol["text-halo-blur"]),"text-translate":new Ot(Re.paint_symbol["text-translate"]),"text-translate-anchor":new Ot(Re.paint_symbol["text-translate-anchor"])})},get layout(){return ax=ax||new To({"symbol-placement":new Ot(Re.layout_symbol["symbol-placement"]),"symbol-spacing":new Ot(Re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ot(Re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new qt(Re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ot(Re.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ot(Re.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ot(Re.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ot(Re.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ot(Re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ot(Re.layout_symbol["icon-rotation-alignment"]),"icon-size":new qt(Re.layout_symbol["icon-size"]),"icon-text-fit":new Ot(Re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ot(Re.layout_symbol["icon-text-fit-padding"]),"icon-image":new qt(Re.layout_symbol["icon-image"]),"icon-rotate":new qt(Re.layout_symbol["icon-rotate"]),"icon-padding":new qt(Re.layout_symbol["icon-padding"]),"icon-keep-upright":new Ot(Re.layout_symbol["icon-keep-upright"]),"icon-offset":new qt(Re.layout_symbol["icon-offset"]),"icon-anchor":new qt(Re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ot(Re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ot(Re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ot(Re.layout_symbol["text-rotation-alignment"]),"text-field":new qt(Re.layout_symbol["text-field"]),"text-font":new qt(Re.layout_symbol["text-font"]),"text-size":new qt(Re.layout_symbol["text-size"]),"text-max-width":new qt(Re.layout_symbol["text-max-width"]),"text-line-height":new Ot(Re.layout_symbol["text-line-height"]),"text-letter-spacing":new qt(Re.layout_symbol["text-letter-spacing"]),"text-justify":new qt(Re.layout_symbol["text-justify"]),"text-radial-offset":new qt(Re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ot(Re.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new qt(Re.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new qt(Re.layout_symbol["text-anchor"]),"text-max-angle":new Ot(Re.layout_symbol["text-max-angle"]),"text-writing-mode":new Ot(Re.layout_symbol["text-writing-mode"]),"text-rotate":new qt(Re.layout_symbol["text-rotate"]),"text-padding":new Ot(Re.layout_symbol["text-padding"]),"text-keep-upright":new Ot(Re.layout_symbol["text-keep-upright"]),"text-transform":new qt(Re.layout_symbol["text-transform"]),"text-offset":new qt(Re.layout_symbol["text-offset"]),"text-allow-overlap":new Ot(Re.layout_symbol["text-allow-overlap"]),"text-overlap":new Ot(Re.layout_symbol["text-overlap"]),"text-ignore-placement":new Ot(Re.layout_symbol["text-ignore-placement"]),"text-optional":new Ot(Re.layout_symbol["text-optional"])})}};class ux{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:ui,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.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}}It("FormatSectionOverride",ux,{omit:["defaultValue"]});class Tg extends As{constructor(o){super(o,_0)}recalculate(o,h){if(super.recalculate(o,h),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 _=[];for(const x of p)_.indexOf(x)<0&&_.push(x);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,_){const x=this.layout.get(o).evaluate(h,{},p,_),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||sr(w.value)||!x?x:function(I,P){return P.replace(/{([^{}]+)}/g,(D,z)=>I&&z in I?String(I[z]):"")}(h.properties,x)}createBucket(o){return new hf(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of _0.paint.overridableProperties){if(!Tg.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new ux(h),_=new pr(p,h.property.specification);let x=null;x=h.value.kind==="constant"||h.value.kind==="source"?new Dh("source",_):new Mp("composite",_,h.value.zoomStops),this.paint._values[o]=new Ms(h.property,x,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Tg.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),_=_0.paint.properties[h];let x=!1;const w=I=>{for(const P of I)if(_.overrides&&_.overrides.hasOverride(P))return void(x=!0)};if(p.value.kind==="constant"&&p.value.value instanceof qo)w(p.value.value.sections);else if(p.value.kind==="source"){const I=D=>{x||(D instanceof nl&&hi(D.value)===Kr?w(D.value.sections):D instanceof Ah?w(D.sections):D.eachChild(I))},P=p.value;P._styleExpression&&I(P._styleExpression.expression)}return x}}let cx;var uP={get paint(){return cx=cx||new To({"background-color":new Ot(Re.paint_background["background-color"]),"background-pattern":new Dc(Re.paint_background["background-pattern"]),"background-opacity":new Ot(Re.paint_background["background-opacity"])})}};class cP extends As{constructor(o){super(o,uP)}}let hx;var hP={get paint(){return hx=hx||new To({"raster-opacity":new Ot(Re.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ot(Re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ot(Re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ot(Re.paint_raster["raster-brightness-max"]),"raster-saturation":new Ot(Re.paint_raster["raster-saturation"]),"raster-contrast":new Ot(Re.paint_raster["raster-contrast"]),"raster-resampling":new Ot(Re.paint_raster["raster-resampling"]),"raster-fade-duration":new Ot(Re.paint_raster["raster-fade-duration"])})}};class fP extends As{constructor(o){super(o,hP)}}class pP extends As{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.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 dP{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const y0=63710088e-1;class Fu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Fu(_e(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,_=o.lat*h,x=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((o.lng-this.lng)*h);return y0*Math.acos(Math.min(x,1))}static convert(o){if(o instanceof Fu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Fu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Fu(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 fx=2*Math.PI*y0;function px(u){return fx*Math.cos(u*Math.PI/180)}function dx(u){return(180+u)/360}function mx(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function gx(u,o){return u/px(o)}function v0(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class Lg{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=Fu.convert(o);return new Lg(dx(p.lng),mx(p.lat),gx(h,p.lat))}toLngLat(){return new Fu(360*this.x-180,v0(this.y))}toAltitude(){return this.z*px(v0(this.y))}meterInMercatorCoordinateUnits(){return 1/fx*(o=v0(this.y),1/Math.cos(o*Math.PI/180));var o}}function _x(u,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class b0{constructor(o,h,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||h<0||h>=Math.pow(2,o))throw new Error(`x=${h}, 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=h,this.y=p,this.key=dd(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const _=(w=this.y,I=this.z,P=_x(256*(x=this.x),256*(w=Math.pow(2,I)-w-1),I),D=_x(256*(x+1),256*(w+1),I),P[0]+","+P[1]+","+D[0]+","+D[1]);var x,w,I,P,D;const z=function(V,W,X){let Y,ie="";for(let fe=V;fe>0;fe--)Y=1<1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,_)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new E((o.x*h-this.x)*Hr,(o.y*h-this.y)*Hr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class yx{constructor(o,h){this.wrap=o,this.canonical=h,this.key=dd(o,h.z,h.z,h.x,h.y)}}class Ds{constructor(o,h,p,_,x){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new b0(p,+_,+x),this.key=dd(h,o,p,_,x)}clone(){return new Ds(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 h=this.canonical.z-o;return o>this.canonical.z?new Ds(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ds(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){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?dd(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):dd(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new Ds(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new Ds(h,this.wrap,h,p,_),new Ds(h,this.wrap,h,p+1,_),new Ds(h,this.wrap,h,p,_+1),new Ds(h,this.wrap,h,p+1,_+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=V),V=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new ks({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,x=h*this.dim+this.dim,w=p*this.dim,I=p*this.dim+this.dim;switch(h){case-1:_=x-1;break;case 1:x=_+1}switch(p){case-1:w=I-1;break;case 1:I=w+1}const P=-h*this.dim,D=-p*this.dim;for(let z=w;z=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 xx{constructor(o,h,p,_,x){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=_,this.properties=o.properties,this.id=x}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 h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class wx{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new Mc(Hr,16,0),this.grid3D=new Mc(Hr,16,0),this.featureIndexArray=new U,this.promoteId=h}insert(o,h,p,_,x,w){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,x);const P=w?this.grid3D:this.grid;for(let D=0;D=0&&V[3]>=0&&P.insert(I,V[0],V[1],V[2],V[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Nu.VectorTile(new l0(this.rawTileData)).layers,this.sourceLayerCoder=new bx(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,_){this.loadVTLayers();const x=o.params||{},w=Hr/o.tileSize/o.scale,I=zh(x.filter),P=o.queryGeometry,D=o.queryPadding*w,z=Ex(P),V=this.grid.query(z.minX-D,z.minY-D,z.maxX+D,z.maxY+D),W=Ex(o.cameraQueryGeometry),X=this.grid3D.query(W.minX-D,W.minY-D,W.maxX+D,W.maxY+D,(fe,we,Oe,Ee)=>function(Ae,Qe,et,St,Dt){for(const bt of Ae)if(Qe<=bt.x&&et<=bt.y&&St>=bt.x&&Dt>=bt.y)return!0;const wt=[new E(Qe,et),new E(Qe,Dt),new E(St,Dt),new E(St,et)];if(Ae.length>2){for(const bt of wt)if(rf(Ae,bt))return!0}for(let bt=0;bt(Ee||(Ee=Zl(Ae)),Qe.queryIntersectsFeature(P,Ae,et,Ee,this.z,o.transform,w,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,h,p,_,x,w,I,P,D,z,V){const W=this.bucketLayerIDs[h];if(w&&!function(fe,we){for(let Oe=0;Oe=0)return!0;return!1}(w,W))return;const X=this.sourceLayerCoder.decode(p),Y=this.vtLayers[X].feature(_);if(x.needGeometry){const fe=Xl(Y,!0);if(!x.filter(new wr(this.tileID.overscaledZ),fe,this.tileID.canonical))return}else if(!x.filter(new wr(this.tileID.overscaledZ),Y))return;const ie=this.getId(Y,X);for(let fe=0;fe{const I=o instanceof kc?o.get(w):null;return I&&I.evaluate?I.evaluate(h,p,_):I})}function Ex(u){let o=1/0,h=1/0,p=-1/0,_=-1/0;for(const x of u)o=Math.min(o,x.x),h=Math.min(h,x.y),p=Math.max(p,x.x),_=Math.max(_,x.y);return{minX:o,minY:h,maxX:p,maxY:_}}function mP(u,o){return o-u}function Ix(u,o,h,p,_){const x=[];for(let w=0;w=p&&V.x>=p||(z.x>=p?z=new E(p,z.y+(p-z.x)/(V.x-z.x)*(V.y-z.y))._round():V.x>=p&&(V=new E(p,z.y+(p-z.x)/(V.x-z.x)*(V.y-z.y))._round()),z.y>=_&&V.y>=_||(z.y>=_?z=new E(z.x+(_-z.y)/(V.y-z.y)*(V.x-z.x),_)._round():V.y>=_&&(V=new E(z.x+(_-z.y)/(V.y-z.y)*(V.x-z.x),_)._round()),P&&z.equals(P[P.length-1])||(P=[z],x.push(P)),P.push(V)))))}}return x}It("FeatureIndex",wx,{omit:["rawTileData","sourceLayerCoder"]});class Bu extends E{constructor(o,h,p,_){super(o,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new Bu(this.x,this.y,this.angle,this.segment)}}function Cx(u,o,h,p,_){if(o.segment===void 0||h===0)return!0;let x=o,w=o.segment+1,I=0;for(;I>-h/2;){if(w--,w<0)return!1;I-=u[w].dist(x),x=u[w]}I+=u[w].dist(u[w+1]),w++;const P=[];let D=0;for(;Ip;)D-=P.shift().angleDelta;if(D>_)return!1;w++,I+=z.dist(V)}return!0}function Tx(u){let o=0;for(let h=0;hD){const Y=(D-P)/X,ie=co.number(V.x,W.x,Y),fe=co.number(V.y,W.y,Y),we=new Bu(ie,fe,W.angleTo(V),z);return we._round(),!w||Cx(u,we,I,w,o)?we:void 0}P+=X}}function _P(u,o,h,p,_,x,w,I,P){const D=Lx(p,x,w),z=Px(p,_),V=z*w,W=u[0].x===0||u[0].x===P||u[0].y===0||u[0].y===P;return o-V=0&&Ae=0&&Qe=0&&W+D<=z){const et=new Bu(Ae,Qe,Oe,Y);et._round(),p&&!Cx(u,et,x,p,_)||X.push(et)}}V+=we}return I||X.length||w||(X=Mx(u,V/2,h,p,_,x,w,!0,P)),X}It("Anchor",Bu);const ff=$o;function Ax(u,o,h,p){const _=[],x=u.image,w=x.pixelRatio,I=x.paddedRect.w-2*ff,P=x.paddedRect.h-2*ff,D=u.right-u.left,z=u.bottom-u.top,V=x.stretchX||[[0,I]],W=x.stretchY||[[0,P]],X=(ht,Pt)=>ht+Pt[1]-Pt[0],Y=V.reduce(X,0),ie=W.reduce(X,0),fe=I-Y,we=P-ie;let Oe=0,Ee=Y,Ae=0,Qe=ie,et=0,St=fe,Dt=0,wt=we;if(x.content&&p){const ht=x.content;Oe=Pg(V,0,ht[0]),Ae=Pg(W,0,ht[1]),Ee=Pg(V,ht[0],ht[2]),Qe=Pg(W,ht[1],ht[3]),et=ht[0]-Oe,Dt=ht[1]-Ae,St=ht[2]-ht[0]-Ee,wt=ht[3]-ht[1]-Qe}const bt=(ht,Pt,gt,st)=>{const Gt=Mg(ht.stretch-Oe,Ee,D,u.left),Nt=Ag(ht.fixed-et,St,ht.stretch,Y),xn=Mg(Pt.stretch-Ae,Qe,z,u.top),dr=Ag(Pt.fixed-Dt,wt,Pt.stretch,ie),Er=Mg(gt.stretch-Oe,Ee,D,u.left),xi=Ag(gt.fixed-et,St,gt.stretch,Y),ms=Mg(st.stretch-Ae,Qe,z,u.top),Po=Ag(st.fixed-Dt,wt,st.stretch,ie),mi=new E(Gt,xn),Vi=new E(Er,xn),$i=new E(Er,ms),Mo=new E(Gt,ms),Ao=new E(Nt/w,dr/w),wi=new E(xi/w,Po/w),Si=o*Math.PI/180;if(Si){const po=Math.sin(Si),Yo=Math.cos(Si),Ko=[Yo,-po,po,Yo];mi._matMult(Ko),Vi._matMult(Ko),Mo._matMult(Ko),$i._matMult(Ko)}const fo=ht.stretch+ht.fixed,ko=Pt.stretch+Pt.fixed;return{tl:mi,tr:Vi,bl:Mo,br:$i,tex:{x:x.paddedRect.x+ff+fo,y:x.paddedRect.y+ff+ko,w:gt.stretch+gt.fixed-fo,h:st.stretch+st.fixed-ko},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ao,pixelOffsetBR:wi,minFontScaleX:St/w/D,minFontScaleY:wt/w/z,isSDF:h}};if(p&&(x.stretchX||x.stretchY)){const ht=kx(V,fe,Y),Pt=kx(W,we,ie);for(let gt=0;gt0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let V=w.top*I-P[0],W=w.bottom*I+P[2],X=w.left*I-P[3],Y=w.right*I+P[1];const ie=w.collisionPadding;if(ie&&(X-=ie[0]*I,V-=ie[1]*I,Y+=ie[2]*I,W+=ie[3]*I),z){const fe=new E(X,V),we=new E(Y,V),Oe=new E(X,W),Ee=new E(Y,W),Ae=z*Math.PI/180;fe._rotate(Ae),we._rotate(Ae),Oe._rotate(Ae),Ee._rotate(Ae),X=Math.min(fe.x,we.x,Oe.x,Ee.x),Y=Math.max(fe.x,we.x,Oe.x,Ee.x),V=Math.min(fe.y,we.y,Oe.y,Ee.y),W=Math.max(fe.y,we.y,Oe.y,Ee.y)}o.emplaceBack(h.x,h.y,X,V,Y,W,p,_,x)}this.boxEndIndex=o.length}}class yP{constructor(o=[],h=vP){if(this.data=o,this.length=this.data.length,this.compare=h,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],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,_=h[o];for(;o>0;){const x=o-1>>1,w=h[x];if(p(_,w)>=0)break;h[o]=w,o=x}h[o]=_}_down(o){const{data:h,compare:p}=this,_=this.length>>1,x=h[o];for(;o<_;){let w=1+(o<<1),I=h[w];const P=w+1;if(P=0)break;h[o]=I,o=w}h[o]=x}}function vP(u,o){return uo?1:0}function bP(u,o=1,h=!1){let p=1/0,_=1/0,x=-1/0,w=-1/0;const I=u[0];for(let X=0;Xx)&&(x=Y.x),(!X||Y.y>w)&&(w=Y.y)}const P=Math.min(x-p,w-_);let D=P/2;const z=new yP([],xP);if(P===0)return new E(p,_);for(let X=p;XV.d||!V.d)&&(V=X,h&&console.log("found best %d after %d probes",Math.round(1e4*X.d)/1e4,W)),X.max-V.d<=o||(D=X.h/2,z.push(new pf(X.p.x-D,X.p.y-D,D,u)),z.push(new pf(X.p.x+D,X.p.y-D,D,u)),z.push(new pf(X.p.x-D,X.p.y+D,D,u)),z.push(new pf(X.p.x+D,X.p.y+D,D,u)),W+=4)}return h&&(console.log(`num probes: ${W}`),console.log(`best distance: ${V.d}`)),V.p}function xP(u,o){return o.max-u.max}function pf(u,o,h,p){this.p=new E(u,o),this.h=h,this.d=function(_,x){let w=!1,I=1/0;for(let P=0;P_.y!=Y.y>_.y&&_.x<(Y.x-X.x)*(_.y-X.y)/(Y.y-X.y)+X.x&&(w=!w),I=Math.min(I,mb(_,X,Y))}}return(w?1:-1)*Math.sqrt(I)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Xi;c.ap=void 0,(Xi=c.ap||(c.ap={}))[Xi.center=1]="center",Xi[Xi.left=2]="left",Xi[Xi.right=3]="right",Xi[Xi.top=4]="top",Xi[Xi.bottom=5]="bottom",Xi[Xi["top-left"]=6]="top-left",Xi[Xi["top-right"]=7]="top-right",Xi[Xi["bottom-left"]=8]="bottom-left",Xi[Xi["bottom-right"]=9]="bottom-right";const Vu=7,x0=Number.POSITIVE_INFINITY;function Dx(u,o){return o[1]!==x0?function(h,p,_){let x=0,w=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":w=_-Vu;break;case"bottom-right":case"bottom-left":case"bottom":w=-_+Vu}switch(h){case"top-right":case"bottom-right":case"right":x=-p;break;case"top-left":case"bottom-left":case"left":x=p}return[x,w]}(u,o[0],o[1]):function(h,p){let _=0,x=0;p<0&&(p=0);const w=p/Math.SQRT2;switch(h){case"top-right":case"top-left":x=w-Vu;break;case"bottom-right":case"bottom-left":x=-w+Vu;break;case"bottom":x=-p+Vu;break;case"top":x=p-Vu}switch(h){case"top-right":case"bottom-right":_=-w;break;case"top-left":case"bottom-left":_=w;break;case"left":_=p;break;case"right":_=-p}return[_,x]}(u,o[0])}function Rx(u,o,h){var p;const _=u.layout,x=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(x){const I=x.values,P=[];for(let D=0;DW*bi);z.startsWith("top")?V[1]-=Vu:z.startsWith("bottom")&&(V[1]+=Vu),P[D+1]=V}return new hs(P)}const w=_.get("text-variable-anchor");if(w){let I;I=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(o,{},h)*bi,x0]:_.get("text-offset").evaluate(o,{},h).map(D=>D*bi);const P=[];for(const D of w)P.push(D,Dx(D,I));return new hs(P)}return null}function w0(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 wP(u,o,h,p,_,x,w,I,P,D,z){let V=x.textMaxSize.evaluate(o,{});V===void 0&&(V=w);const W=u.layers[0].layout,X=W.get("icon-offset").evaluate(o,{},z),Y=Ox(h.horizontal),ie=w/24,fe=u.tilePixelRatio*ie,we=u.tilePixelRatio*V/24,Oe=u.tilePixelRatio*I,Ee=u.tilePixelRatio*W.get("symbol-spacing"),Ae=W.get("text-padding")*u.tilePixelRatio,Qe=function(st,Gt,Nt,xn=1){const dr=st.get("icon-padding").evaluate(Gt,{},Nt),Er=dr&&dr.values;return[Er[0]*xn,Er[1]*xn,Er[2]*xn,Er[3]*xn]}(W,o,z,u.tilePixelRatio),et=W.get("text-max-angle")/180*Math.PI,St=W.get("text-rotation-alignment")!=="viewport"&&W.get("symbol-placement")!=="point",Dt=W.get("icon-rotation-alignment")==="map"&&W.get("symbol-placement")!=="point",wt=W.get("symbol-placement"),bt=Ee/2,ht=W.get("icon-text-fit");let Pt;p&&ht!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(Pt=ox(p,h.vertical,ht,W.get("icon-text-fit-padding"),X,ie)),Y&&(p=ox(p,Y,ht,W.get("icon-text-fit-padding"),X,ie)));const gt=(st,Gt)=>{Gt.x<0||Gt.x>=Hr||Gt.y<0||Gt.y>=Hr||function(Nt,xn,dr,Er,xi,ms,Po,mi,Vi,$i,Mo,Ao,wi,Si,fo,ko,po,Yo,Ko,Ei,In,mo,Yi,Ii,oa){const Ra=Nt.addToLineVertexArray(xn,dr);let Na,Yl,sa,Rs,Jo=0,Kl=0,_d=0,Vx=0,M0=-1,A0=-1;const Jl={};let Ux=Br("");if(Nt.allowVerticalPlacement&&Er.vertical){const go=mi.layout.get("text-rotate").evaluate(In,{},Ii)+90;sa=new kg(Vi,xn,$i,Mo,Ao,Er.vertical,wi,Si,fo,go),Po&&(Rs=new kg(Vi,xn,$i,Mo,Ao,Po,po,Yo,fo,go))}if(xi){const go=mi.layout.get("icon-rotate").evaluate(In,{}),Ns=mi.layout.get("icon-text-fit")!=="none",Uc=Ax(xi,go,Yi,Ns),za=Po?Ax(Po,go,Yi,Ns):void 0;Yl=new kg(Vi,xn,$i,Mo,Ao,xi,po,Yo,!1,go),Jo=4*Uc.length;const jc=Nt.iconSizeData;let fl=null;jc.kind==="source"?(fl=[hl*mi.layout.get("icon-size").evaluate(In,{})],fl[0]>zu&&qe(`${Nt.layerIds[0]}: Value for "icon-size" is >= ${pd}. Reduce your "icon-size".`)):jc.kind==="composite"&&(fl=[hl*mo.compositeIconSizes[0].evaluate(In,{},Ii),hl*mo.compositeIconSizes[1].evaluate(In,{},Ii)],(fl[0]>zu||fl[1]>zu)&&qe(`${Nt.layerIds[0]}: Value for "icon-size" is >= ${pd}. Reduce your "icon-size".`)),Nt.addSymbols(Nt.icon,Uc,fl,Ei,Ko,In,c.ah.none,xn,Ra.lineStartIndex,Ra.lineLength,-1,Ii),M0=Nt.icon.placedSymbolArray.length-1,za&&(Kl=4*za.length,Nt.addSymbols(Nt.icon,za,fl,Ei,Ko,In,c.ah.vertical,xn,Ra.lineStartIndex,Ra.lineLength,-1,Ii),A0=Nt.icon.placedSymbolArray.length-1)}const jx=Object.keys(Er.horizontal);for(const go of jx){const Ns=Er.horizontal[go];if(!Na){Ux=Br(Ns.text);const za=mi.layout.get("text-rotate").evaluate(In,{},Ii);Na=new kg(Vi,xn,$i,Mo,Ao,Ns,wi,Si,fo,za)}const Uc=Ns.positionedLines.length===1;if(_d+=Nx(Nt,xn,Ns,ms,mi,fo,In,ko,Ra,Er.vertical?c.ah.horizontal:c.ah.horizontalOnly,Uc?jx:[go],Jl,M0,mo,Ii),Uc)break}Er.vertical&&(Vx+=Nx(Nt,xn,Er.vertical,ms,mi,fo,In,ko,Ra,c.ah.vertical,["vertical"],Jl,A0,mo,Ii));const IP=Na?Na.boxStartIndex:Nt.collisionBoxArray.length,CP=Na?Na.boxEndIndex:Nt.collisionBoxArray.length,TP=sa?sa.boxStartIndex:Nt.collisionBoxArray.length,LP=sa?sa.boxEndIndex:Nt.collisionBoxArray.length,PP=Yl?Yl.boxStartIndex:Nt.collisionBoxArray.length,MP=Yl?Yl.boxEndIndex:Nt.collisionBoxArray.length,AP=Rs?Rs.boxStartIndex:Nt.collisionBoxArray.length,kP=Rs?Rs.boxEndIndex:Nt.collisionBoxArray.length;let Oa=-1;const Rg=(go,Ns)=>go&&go.circleDiameter?Math.max(go.circleDiameter,Ns):Ns;Oa=Rg(Na,Oa),Oa=Rg(sa,Oa),Oa=Rg(Yl,Oa),Oa=Rg(Rs,Oa);const Gx=Oa>-1?1:0;Gx&&(Oa*=oa/bi),Nt.glyphOffsetArray.length>=hf.MAX_GLYPHS&&qe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),In.sortKey!==void 0&&Nt.addToSortKeyRanges(Nt.symbolInstances.length,In.sortKey);const DP=Rx(mi,In,Ii),[RP,NP]=function(go,Ns){const Uc=go.length,za=Ns==null?void 0:Ns.values;if((za==null?void 0:za.length)>0)for(let jc=0;jc=0?Jl.right:-1,Jl.center>=0?Jl.center:-1,Jl.left>=0?Jl.left:-1,Jl.vertical||-1,M0,A0,Ux,IP,CP,TP,LP,PP,MP,AP,kP,$i,_d,Vx,Jo,Kl,Gx,0,wi,Oa,RP,NP)}(u,Gt,st,h,p,_,Pt,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,fe,[Ae,Ae,Ae,Ae],St,P,Oe,Qe,Dt,X,o,x,D,z,w)};if(wt==="line")for(const st of Ix(o.geometry,0,0,Hr,Hr)){const Gt=_P(st,Ee,et,h.vertical||Y,p,24,we,u.overscaling,Hr);for(const Nt of Gt)Y&&SP(u,Y.text,bt,Nt)||gt(st,Nt)}else if(wt==="line-center"){for(const st of o.geometry)if(st.length>1){const Gt=gP(st,et,h.vertical||Y,p,24,we);Gt&>(st,Gt)}}else if(o.type==="Polygon")for(const st of e0(o.geometry,0)){const Gt=bP(st,16);gt(st[0],new Bu(Gt.x,Gt.y,0))}else if(o.type==="LineString")for(const st of o.geometry)gt(st,new Bu(st[0].x,st[0].y,0));else if(o.type==="Point")for(const st of o.geometry)for(const Gt of st)gt([Gt],new Bu(Gt.x,Gt.y,0))}function Nx(u,o,h,p,_,x,w,I,P,D,z,V,W,X,Y){const ie=function(Oe,Ee,Ae,Qe,et,St,Dt,wt){const bt=Qe.layout.get("text-rotate").evaluate(St,{})*Math.PI/180,ht=[];for(const Pt of Ee.positionedLines)for(const gt of Pt.positionedGlyphs){if(!gt.rect)continue;const st=gt.rect||{};let Gt=Jb+1,Nt=!0,xn=1,dr=0;const Er=(et||wt)&>.vertical,xi=gt.metrics.advance*gt.scale/2;if(wt&&Ee.verticalizable&&(dr=Pt.lineOffset/2-(gt.imageName?-(bi-gt.metrics.width*gt.scale)/2:(gt.scale-1)*bi)),gt.imageName){const Ei=Dt[gt.imageName];Nt=Ei.sdf,xn=Ei.pixelRatio,Gt=$o/xn}const ms=et?[gt.x+xi,gt.y]:[0,0];let Po=et?[0,0]:[gt.x+xi+Ae[0],gt.y+Ae[1]-dr],mi=[0,0];Er&&(mi=Po,Po=[0,0]);const Vi=gt.metrics.isDoubleResolution?2:1,$i=(gt.metrics.left-Gt)*gt.scale-xi+Po[0],Mo=(-gt.metrics.top-Gt)*gt.scale+Po[1],Ao=$i+st.w/Vi*gt.scale/xn,wi=Mo+st.h/Vi*gt.scale/xn,Si=new E($i,Mo),fo=new E(Ao,Mo),ko=new E($i,wi),po=new E(Ao,wi);if(Er){const Ei=new E(-xi,xi-hd),In=-Math.PI/2,mo=bi/2-xi,Yi=new E(5-hd-mo,-(gt.imageName?mo:0)),Ii=new E(...mi);Si._rotateAround(In,Ei)._add(Yi)._add(Ii),fo._rotateAround(In,Ei)._add(Yi)._add(Ii),ko._rotateAround(In,Ei)._add(Yi)._add(Ii),po._rotateAround(In,Ei)._add(Yi)._add(Ii)}if(bt){const Ei=Math.sin(bt),In=Math.cos(bt),mo=[In,-Ei,Ei,In];Si._matMult(mo),fo._matMult(mo),ko._matMult(mo),po._matMult(mo)}const Yo=new E(0,0),Ko=new E(0,0);ht.push({tl:Si,tr:fo,bl:ko,br:po,tex:st,writingMode:Ee.writingMode,glyphOffset:ms,sectionIndex:gt.sectionIndex,isSDF:Nt,pixelOffsetTL:Yo,pixelOffsetBR:Ko,minFontScaleX:0,minFontScaleY:0})}return ht}(0,h,I,_,x,w,p,u.allowVerticalPlacement),fe=u.textSizeData;let we=null;fe.kind==="source"?(we=[hl*_.layout.get("text-size").evaluate(w,{})],we[0]>zu&&qe(`${u.layerIds[0]}: Value for "text-size" is >= ${pd}. Reduce your "text-size".`)):fe.kind==="composite"&&(we=[hl*X.compositeTextSizes[0].evaluate(w,{},Y),hl*X.compositeTextSizes[1].evaluate(w,{},Y)],(we[0]>zu||we[1]>zu)&&qe(`${u.layerIds[0]}: Value for "text-size" is >= ${pd}. Reduce your "text-size".`)),u.addSymbols(u.text,ie,we,I,x,w,D,o,P.lineStartIndex,P.lineLength,W,Y);for(const Oe of z)V[Oe]=u.text.placedSymbolArray.length-1;return 4*ie.length}function Ox(u){for(const o in u)return u[o];return null}function SP(u,o,h,p){const _=u.compareText;if(o in _){const x=_[o];for(let w=x.length-1;w>=0;w--)if(p.dist(x[w])>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const x=zx[15&p];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[I]=new Uint32Array(o,4,1);return new S0(I,w,x,o)}constructor(o,h=64,p=Float64Array,_){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const x=zx.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,I=o*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-I%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+P,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+I+P),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+P,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return E0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:I}=this,P=[0,x.length-1,0],D=[];for(;P.length;){const z=P.pop()||0,V=P.pop()||0,W=P.pop()||0;if(V-W<=I){for(let fe=W;fe<=V;fe++){const we=w[2*fe],Oe=w[2*fe+1];we>=o&&we<=p&&Oe>=h&&Oe<=_&&D.push(x[fe])}continue}const X=W+V>>1,Y=w[2*X],ie=w[2*X+1];Y>=o&&Y<=p&&ie>=h&&ie<=_&&D.push(x[X]),(z===0?o<=Y:h<=ie)&&(P.push(W),P.push(X-1),P.push(1-z)),(z===0?p>=Y:_>=ie)&&(P.push(X+1),P.push(V),P.push(1-z))}return D}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:x,nodeSize:w}=this,I=[0,_.length-1,0],P=[],D=p*p;for(;I.length;){const z=I.pop()||0,V=I.pop()||0,W=I.pop()||0;if(V-W<=w){for(let fe=W;fe<=V;fe++)Bx(x[2*fe],x[2*fe+1],o,h)<=D&&P.push(_[fe]);continue}const X=W+V>>1,Y=x[2*X],ie=x[2*X+1];Bx(Y,ie,o,h)<=D&&P.push(_[X]),(z===0?o-p<=Y:h-p<=ie)&&(I.push(W),I.push(X-1),I.push(1-z)),(z===0?o+p>=Y:h+p>=ie)&&(I.push(X+1),I.push(V),I.push(1-z))}return P}}function E0(u,o,h,p,_,x){if(_-p<=h)return;const w=p+_>>1;Fx(u,o,w,p,_,x),E0(u,o,h,p,w-1,1-x),E0(u,o,h,w+1,_,1-x)}function Fx(u,o,h,p,_,x){for(;_>p;){if(_-p>600){const D=_-p+1,z=h-p+1,V=Math.log(D),W=.5*Math.exp(2*V/3),X=.5*Math.sqrt(V*W*(D-W)/D)*(z-D/2<0?-1:1);Fx(u,o,h,Math.max(p,Math.floor(h-z*W/D+X)),Math.min(_,Math.floor(h+(D-z)*W/D+X)),x)}const w=o[2*h+x];let I=p,P=_;for(md(u,o,p,h),o[2*_+x]>w&&md(u,o,p,_);Iw;)P--}o[2*p+x]===w?md(u,o,p,P):(P++,md(u,o,P,_)),P<=h&&(p=P+1),h<=P&&(_=P-1)}}function md(u,o,h,p){I0(u,h,p),I0(o,2*h,2*p),I0(o,2*h+1,2*p+1)}function I0(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function Bx(u,o,h,p){const _=u-h,x=o-p;return _*_+x*x}var C0;c.bd=void 0,(C0=c.bd||(c.bd={})).create="create",C0.load="load",C0.fullLoad="fullLoad";let Dg=null,gd=[];const T0=1e3/60,L0="loadTime",P0="fullLoadTime",EP={mark(u){performance.mark(u)},frame(u){const o=u;Dg!=null&&gd.push(o-Dg),Dg=o},clearMetrics(){Dg=null,gd=[],performance.clearMeasures(L0),performance.clearMeasures(P0);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(L0,c.bd.create,c.bd.load),performance.measure(P0,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(L0)[0].duration,o=performance.getEntriesByName(P0)[0].duration,h=gd.length,p=1/(gd.reduce((x,w)=>x+w,0)/h/1e3),_=gd.filter(x=>x>T0).reduce((x,w)=>x+(w-T0)/T0,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};c.$=dt,c.A=of,c.B=function(u){if(Xe==null){const o=u.navigator?u.navigator.userAgent:null;Xe=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Xe},c.C=class{constructor(u,o){this.target=u,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new dP(()=>this.process()),this.subscription=function(h,p,_,x){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=ft(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const I={id:_,type:"",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(I)},{once:!0});const x=[],w=Object.assign(Object.assign({},u),{id:_,sourceMapId:this.mapId,origin:location.origin,data:Au(u.data,x)});this.target.postMessage(w,{transfer:x})})}receive(u){const o=u.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(ft(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const u=this.taskQueue.shift(),o=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(u,o)}processTask(u,o){return l(this,void 0,void 0,function*(){if(o.type===""){const _=this.resolveRejects[u];return delete this.resolveRejects[u],_?void(o.error?_.reject(ku(o.error)):_.resolve(ku(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=ku(o.data),p=new AbortController;this.abortControllers[u]=p;try{const _=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,_)}catch(_){this.completeTask(u,_)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const _={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?Au(o):null,data:Au(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Ot,c.E=kt,c.F=function(){var u=new of(16);return of!=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},c.G=Nn,c.H=function(u,o,h){var p,_,x,w,I,P,D,z,V,W,X,Y,ie=h[0],fe=h[1],we=h[2];return o===u?(u[12]=o[0]*ie+o[4]*fe+o[8]*we+o[12],u[13]=o[1]*ie+o[5]*fe+o[9]*we+o[13],u[14]=o[2]*ie+o[6]*fe+o[10]*we+o[14],u[15]=o[3]*ie+o[7]*fe+o[11]*we+o[15]):(_=o[1],x=o[2],w=o[3],I=o[4],P=o[5],D=o[6],z=o[7],V=o[8],W=o[9],X=o[10],Y=o[11],u[0]=p=o[0],u[1]=_,u[2]=x,u[3]=w,u[4]=I,u[5]=P,u[6]=D,u[7]=z,u[8]=V,u[9]=W,u[10]=X,u[11]=Y,u[12]=p*ie+I*fe+V*we+o[12],u[13]=_*ie+P*fe+W*we+o[13],u[14]=x*ie+D*fe+X*we+o[14],u[15]=w*ie+z*fe+Y*we+o[15]),u},c.I=c0,c.J=function(u,o,h){var p=h[0],_=h[1],x=h[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]*_,u[5]=o[5]*_,u[6]=o[6]*_,u[7]=o[7]*_,u[8]=o[8]*x,u[9]=o[9]*x,u[10]=o[10]*x,u[11]=o[11]*x,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},c.K=vb,c.L=function(u,o){const h={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of u){const _=window.document.createElement("source");On(p)||(o.crossOrigin="Anonymous"),_.src=p,o.appendChild(_)}})},c.a3=function(){return le++},c.a4=y,c.a5=hf,c.a6=zh,c.a7=Xl,c.a8=wr,c.a9=xx,c.aA=Q,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!_n(u.version,o.version))return[{command:"setStyle",args:[o]}];_n(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),_n(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),_n(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),_n(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),_n(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),_n(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),_n(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),_n(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),_n(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),_n(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},_=[];(function(w,I,P,D){let z;for(z in I=I||{},w=w||{})Object.prototype.hasOwnProperty.call(w,z)&&(Object.prototype.hasOwnProperty.call(I,z)||Cs(z,P,D));for(z in I)Object.prototype.hasOwnProperty.call(I,z)&&(Object.prototype.hasOwnProperty.call(w,z)?_n(w[z],I[z])||(w[z].type==="geojson"&&I[z].type==="geojson"&&tl(w,I,z)?ur(P,{command:"setGeoJSONSourceData",args:[z,I[z].data]}):Ks(z,I,P,D)):Go(z,I,P))})(u.sources,o.sources,_,p);const x=[];u.layers&&u.layers.forEach(w=>{"source"in w&&p[w.source]?h.push({command:"removeLayer",args:[w.id]}):x.push(w)}),h=h.concat(_),function(w,I,P){I=I||[];const D=(w=w||[]).map(zl),z=I.map(zl),V=w.reduce(Ts,{}),W=I.reduce(Ts,{}),X=D.slice(),Y=Object.create(null);let ie,fe,we,Oe,Ee;for(let Ae=0,Qe=0;Ae@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,x)=>{const w=_||x;return o[p]=!w||w.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=K,c.ad=function(u,o,h){var p=Math.sin(h),_=Math.cos(h),x=o[0],w=o[1],I=o[2],P=o[3],D=o[4],z=o[5],V=o[6],W=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]=x*_+D*p,u[1]=w*_+z*p,u[2]=I*_+V*p,u[3]=P*_+W*p,u[4]=D*_-x*p,u[5]=z*_-w*p,u[6]=V*_-I*p,u[7]=W*_-P*p,u},c.ae=function(u){var o=new of(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},c.af=_g,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:_,minZoom:x,maxZoom:w}=u,I=_?K(Zi.interpolationFactor(_,o,x,w),0,1):0;u.kind==="camera"?p=co.number(u.minSize,u.maxSize,I):h=I}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:_}){return u.kind==="source"?p/hl:u.kind==="composite"?co.number(p/hl,_/hl,h):o},c.aj=d0,c.ak=function(u,o,h,p){const _=o.y-u.y,x=o.x-u.x,w=p.y-h.y,I=p.x-h.x,P=w*x-I*_;if(P===0)return null;const D=(I*(u.y-h.y)-w*(u.x-h.x))/P;return new E(u.x+D*x,u.y+D*_)},c.al=Ix,c.am=Kp,c.an=Zy,c.ao=bi,c.aq=p0,c.ar=function(u,o){var h=o[0],p=o[1],_=o[2],x=o[3],w=o[4],I=o[5],P=o[6],D=o[7],z=o[8],V=o[9],W=o[10],X=o[11],Y=o[12],ie=o[13],fe=o[14],we=o[15],Oe=h*I-p*w,Ee=h*P-_*w,Ae=h*D-x*w,Qe=p*P-_*I,et=p*D-x*I,St=_*D-x*P,Dt=z*ie-V*Y,wt=z*fe-W*Y,bt=z*we-X*Y,ht=V*fe-W*ie,Pt=V*we-X*ie,gt=W*we-X*fe,st=Oe*gt-Ee*Pt+Ae*ht+Qe*bt-et*wt+St*Dt;return st?(u[0]=(I*gt-P*Pt+D*ht)*(st=1/st),u[1]=(_*Pt-p*gt-x*ht)*st,u[2]=(ie*St-fe*et+we*Qe)*st,u[3]=(W*et-V*St-X*Qe)*st,u[4]=(P*bt-w*gt-D*wt)*st,u[5]=(h*gt-_*bt+x*wt)*st,u[6]=(fe*Ae-Y*St-we*Ee)*st,u[7]=(z*St-W*Ae+X*Ee)*st,u[8]=(w*Pt-I*bt+D*Dt)*st,u[9]=(p*bt-h*Pt-x*Dt)*st,u[10]=(Y*et-ie*Ae+we*Oe)*st,u[11]=(V*Ae-z*et-X*Oe)*st,u[12]=(I*wt-w*ht-P*Dt)*st,u[13]=(h*ht-p*wt+_*Dt)*st,u[14]=(ie*Ee-Y*Qe-fe*Oe)*st,u[15]=(z*Qe-V*Ee+W*Oe)*st,u):null},c.as=w0,c.at=f0,c.au=S0,c.av=function(){const u={},o=Re.$version;for(const h in Re.$root){const p=Re.$root[h];if(p.required){let _=null;_=h==="version"?o:p.type==="array"?[]:{},_!=null&&(u[h]=_)}}return u},c.aw=rg,c.ax=Nr,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hst*bi)}let wt=w?"center":h.get("text-justify").evaluate(D,{},u.canonical);const bt=h.get("symbol-placement"),ht=bt==="point"?h.get("text-max-width").evaluate(D,{},u.canonical)*bi:0,Pt=()=>{u.bucket.allowVerticalPlacement&&Du(Ae)&&(Y.vertical=Eg(ie,u.glyphMap,u.glyphPositions,u.imagePositions,z,ht,x,St,"left",et,we,c.ah.vertical,!0,bt,W,V))};if(!w&&Dt){const gt=new Set;if(wt==="auto")for(let Gt=0;Gtl(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(u)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=ae,c.f=u=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=At})},p.onerror=()=>h(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 _=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(_):At}),c.g=pn,c.h=(u,o)=>Jn(ae(u,{type:"json"}),o),c.i=ft,c.j=ot,c.k=Ce,c.l=(u,o)=>Jn(ae(u,{type:"arrayBuffer"}),o),c.m=Jn,c.n=function(u){return new l0(u).readFields(QL,[])},c.o=rd,c.p=Qb,c.q=To,c.r=Gy,c.s=On,c.t=Mu,c.u=xt,c.v=Re,c.w=qe,c.x=ql,c.y=function([u,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(h),y:u*Math.sin(o)*Math.sin(h),z:u*Math.cos(h)}},c.z=co}),i("worker",["./shared"],function(c){class l{constructor(q){this.keyCache={},q&&this.replace(q)}replace(q){this._layerConfigs={},this._layers={},this.update(q,[])}update(q,Z){for(const ue of q){this._layerConfigs[ue.id]=ue;const Te=this._layers[ue.id]=c.az(ue);Te._featureFilter=c.a6(Te.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of Z)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const J=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const ue of J){const Te=ue.map(Ye=>this._layers[Ye.id]),ee=Te[0];if(ee.visibility==="none")continue;const Me=ee.source||"";let Se=this.familiesBySource[Me];Se||(Se=this.familiesBySource[Me]={});const Ne=ee.sourceLayer||"_geojsonTileLayer";let He=Se[Ne];He||(He=Se[Ne]=[]),He.push(Te)}}}class d{constructor(q){const Z={},J=[];for(const Me in q){const Se=q[Me],Ne=Z[Me]={};for(const He in Se){const Ye=Se[+He];if(!Ye||Ye.bitmap.width===0||Ye.bitmap.height===0)continue;const Je={x:0,y:0,w:Ye.bitmap.width+2,h:Ye.bitmap.height+2};J.push(Je),Ne[He]={rect:Je,metrics:Ye.metrics}}}const{w:ue,h:Te}=c.p(J),ee=new c.o({width:ue||1,height:Te||1});for(const Me in q){const Se=q[Me];for(const Ne in Se){const He=Se[+Ne];if(!He||He.bitmap.width===0||He.bitmap.height===0)continue;const Ye=Z[Me][Ne].rect;c.o.copy(He.bitmap,ee,{x:0,y:0},{x:Ye.x+1,y:Ye.y+1},He.bitmap)}}this.image=ee,this.positions=Z}}c.bi("GlyphAtlas",d);class v{constructor(q){this.tileID=new c.Q(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),this.uid=q.uid,this.zoom=q.zoom,this.pixelRatio=q.pixelRatio,this.tileSize=q.tileSize,this.source=q.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=q.showCollisionBoxes,this.collectResourceTiming=!!q.collectResourceTiming,this.returnDependencies=!!q.returnDependencies,this.promoteId=q.promoteId,this.inFlightDependencies=[]}parse(q,Z,J,ue){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=q,this.collisionBoxArray=new c.a4;const Te=new c.bj(Object.keys(q.layers).sort()),ee=new c.bk(this.tileID,this.promoteId);ee.bucketLayerIDs=[];const Me={},Se={featureIndex:ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Ne=Z.familiesBySource[this.source];for(const dn in Ne){const Or=q.layers[dn];if(!Or)continue;Or.version===1&&c.w(`Vector tile source "${this.source}" layer "${dn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _i=Te.encode(dn),uo=[];for(let Eo=0;Eo=Mi.maxzoom||Mi.visibility!=="none"&&(S(Eo,this.zoom,J),(Me[Mi.id]=Mi.createBucket({index:ee.bucketLayerIDs.length,layers:Eo,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_i,sourceID:this.source})).populate(uo,Se,this.tileID.canonical),ee.bucketLayerIDs.push(Eo.map(Js=>Js.id)))}}const He=c.aE(Se.glyphDependencies,dn=>Object.keys(dn).map(Number));this.inFlightDependencies.forEach(dn=>dn==null?void 0:dn.abort()),this.inFlightDependencies=[];let Ye=Promise.resolve({});if(Object.keys(He).length){const dn=new AbortController;this.inFlightDependencies.push(dn),Ye=ue.sendAsync({type:"GG",data:{stacks:He,source:this.source,tileID:this.tileID,type:"glyphs"}},dn)}const Je=Object.keys(Se.iconDependencies);let Rt=Promise.resolve({});if(Je.length){const dn=new AbortController;this.inFlightDependencies.push(dn),Rt=ue.sendAsync({type:"GI",data:{icons:Je,source:this.source,tileID:this.tileID,type:"icons"}},dn)}const Ft=Object.keys(Se.patternDependencies);let en=Promise.resolve({});if(Ft.length){const dn=new AbortController;this.inFlightDependencies.push(dn),en=ue.sendAsync({type:"GI",data:{icons:Ft,source:this.source,tileID:this.tileID,type:"patterns"}},dn)}const[nn,Tn,er]=yield Promise.all([Ye,Rt,en]),xr=new d(nn),ci=new c.bl(Tn,er);for(const dn in Me){const Or=Me[dn];Or instanceof c.a5?(S(Or.layers,this.zoom,J),c.bm({bucket:Or,glyphMap:nn,glyphPositions:xr.positions,imageMap:Tn,imagePositions:ci.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Or.hasPattern&&(Or instanceof c.bn||Or instanceof c.bo||Or instanceof c.bp)&&(S(Or.layers,this.zoom,J),Or.addFeatures(Se,this.tileID.canonical,ci.patternPositions))}return this.status="done",{buckets:Object.values(Me).filter(dn=>!dn.isEmpty()),featureIndex:ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:xr.image,imageAtlas:ci,glyphMap:this.returnDependencies?nn:null,iconMap:this.returnDependencies?Tn:null,glyphPositions:this.returnDependencies?xr.positions:null}})}}function S(pe,q,Z){const J=new c.a8(q);for(const ue of pe)ue.recalculate(J,Z)}class E{constructor(q,Z,J){this.actor=q,this.layerIndex=Z,this.availableImages=J,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(q,Z){return c._(this,void 0,void 0,function*(){const J=yield c.l(q.request,Z);try{return{vectorTile:new c.bq.VectorTile(new c.br(J.data)),rawData:J.data,cacheControl:J.cacheControl,expires:J.expires}}catch(ue){const Te=new Uint8Array(J.data);let ee=`Unable to parse the tile at ${q.request.url}, `;throw ee+=Te[0]===31&&Te[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.messge}`,new Error(ee)}})}loadTile(q){return c._(this,void 0,void 0,function*(){const Z=q.uid,J=!!(q&&q.request&&q.request.collectResourceTiming)&&new c.bs(q.request),ue=new v(q);this.loading[Z]=ue;const Te=new AbortController;ue.abort=Te;try{const ee=yield this.loadVectorTile(q,Te);if(delete this.loading[Z],!ee)return null;const Me=ee.rawData,Se={};ee.expires&&(Se.expires=ee.expires),ee.cacheControl&&(Se.cacheControl=ee.cacheControl);const Ne={};if(J){const Ye=J.finish();Ye&&(Ne.resourceTiming=JSON.parse(JSON.stringify(Ye)))}ue.vectorTile=ee.vectorTile;const He=ue.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[Z]=ue,this.fetching[Z]={rawTileData:Me,cacheControl:Se,resourceTiming:Ne};try{const Ye=yield He;return c.e({rawTileData:Me.slice(0)},Ye,Se,Ne)}finally{delete this.fetching[Z]}}catch(ee){throw delete this.loading[Z],ue.status="done",this.loaded[Z]=ue,ee}})}reloadTile(q){return c._(this,void 0,void 0,function*(){const Z=q.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const J=this.loaded[Z];if(J.showCollisionBoxes=q.showCollisionBoxes,J.status==="parsing"){const ue=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);let Te;if(this.fetching[Z]){const{rawTileData:ee,cacheControl:Me,resourceTiming:Se}=this.fetching[Z];delete this.fetching[Z],Te=c.e({rawTileData:ee.slice(0)},ue,Me,Se)}else Te=ue;return Te}if(J.status==="done"&&J.vectorTile)return J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(q){return c._(this,void 0,void 0,function*(){const Z=this.loading,J=q.uid;Z&&Z[J]&&Z[J].abort&&(Z[J].abort.abort(),delete Z[J])})}removeTile(q){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[q.uid]&&delete this.loaded[q.uid]})}}class C{constructor(){this.loaded={}}loadTile(q){return c._(this,void 0,void 0,function*(){const{uid:Z,encoding:J,rawImageData:ue,redFactor:Te,greenFactor:ee,blueFactor:Me,baseShift:Se}=q,Ne=ue.width+2,He=ue.height+2,Ye=c.b(ue)?new c.R({width:Ne,height:He},yield c.bt(ue,-1,-1,Ne,He)):ue,Je=new c.bu(Z,Ye,J,Te,ee,Me,Se);return this.loaded=this.loaded||{},this.loaded[Z]=Je,Je})}removeTile(q){const Z=this.loaded,J=q.uid;Z&&Z[J]&&delete Z[J]}}function M(pe,q){if(pe.length!==0){k(pe[0],q);for(var Z=1;Z=Math.abs(Me)?Z-Se+Me:Me-Se+Z,Z=Se}Z+J>=0!=!!q&&pe.reverse()}var R=c.bv(function pe(q,Z){var J,ue=q&&q.type;if(ue==="FeatureCollection")for(J=0;J>31}function it(pe,q){for(var Z=pe.loadGeometry(),J=pe.type,ue=0,Te=0,ee=Z.length,Me=0;Mepe},At=Math.fround||(yt=new Float32Array(1),pe=>(yt[0]=+pe,yt[0]));var yt;const zt=3,Tt=5,tn=6;class Rn{constructor(q){this.options=Object.assign(Object.create(Mt),q),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(q){const{log:Z,minZoom:J,maxZoom:ue}=this.options;Z&&console.time("total time");const Te=`prepare ${q.length} points`;Z&&console.time(Te),this.points=q;const ee=[];for(let Se=0;Se=J;Se--){const Ne=+Date.now();Me=this.trees[Se]=this._createTree(this._cluster(Me,Se)),Z&&console.log("z%d: %d clusters in %dms",Se,Me.numItems,+Date.now()-Ne)}return Z&&console.timeEnd("total time"),this}getClusters(q,Z){let J=((q[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,q[1]));let Te=q[2]===180?180:((q[2]+180)%360+360)%360-180;const ee=Math.max(-90,Math.min(90,q[3]));if(q[2]-q[0]>=360)J=-180,Te=180;else if(J>Te){const Ye=this.getClusters([J,ue,180,ee],Z),Je=this.getClusters([-180,ue,Te,ee],Z);return Ye.concat(Je)}const Me=this.trees[this._limitZoom(Z)],Se=Me.range(Nn(J),En(ee),Nn(Te),En(ue)),Ne=Me.data,He=[];for(const Ye of Se){const Je=this.stride*Ye;He.push(Ne[Je+Tt]>1?Jt(Ne,Je,this.clusterProps):this.points[Ne[Je+zt]])}return He}getChildren(q){const Z=this._getOriginId(q),J=this._getOriginZoom(q),ue="No cluster with the specified id.",Te=this.trees[J];if(!Te)throw new Error(ue);const ee=Te.data;if(Z*this.stride>=ee.length)throw new Error(ue);const Me=this.options.radius/(this.options.extent*Math.pow(2,J-1)),Se=Te.within(ee[Z*this.stride],ee[Z*this.stride+1],Me),Ne=[];for(const He of Se){const Ye=He*this.stride;ee[Ye+4]===q&&Ne.push(ee[Ye+Tt]>1?Jt(ee,Ye,this.clusterProps):this.points[ee[Ye+zt]])}if(Ne.length===0)throw new Error(ue);return Ne}getLeaves(q,Z,J){const ue=[];return this._appendLeaves(ue,q,Z=Z||10,J=J||0,0),ue}getTile(q,Z,J){const ue=this.trees[this._limitZoom(q)],Te=Math.pow(2,q),{extent:ee,radius:Me}=this.options,Se=Me/ee,Ne=(J-Se)/Te,He=(J+1+Se)/Te,Ye={features:[]};return this._addTileFeatures(ue.range((Z-Se)/Te,Ne,(Z+1+Se)/Te,He),ue.data,Z,J,Te,Ye),Z===0&&this._addTileFeatures(ue.range(1-Se/Te,Ne,1,He),ue.data,Te,J,Te,Ye),Z===Te-1&&this._addTileFeatures(ue.range(0,Ne,Se/Te,He),ue.data,-1,J,Te,Ye),Ye.features.length?Ye:null}getClusterExpansionZoom(q){let Z=this._getOriginZoom(q)-1;for(;Z<=this.options.maxZoom;){const J=this.getChildren(q);if(Z++,J.length!==1)break;q=J[0].properties.cluster_id}return Z}_appendLeaves(q,Z,J,ue,Te){const ee=this.getChildren(Z);for(const Me of ee){const Se=Me.properties;if(Se&&Se.cluster?Te+Se.point_count<=ue?Te+=Se.point_count:Te=this._appendLeaves(q,Se.cluster_id,J,ue,Te):Te1;let He,Ye,Je;if(Ne)He=pn(Z,Se,this.clusterProps),Ye=Z[Se],Je=Z[Se+1];else{const en=this.points[Z[Se+zt]];He=en.properties;const[nn,Tn]=en.geometry.coordinates;Ye=Nn(nn),Je=En(Tn)}const Rt={type:1,geometry:[[Math.round(this.options.extent*(Ye*Te-J)),Math.round(this.options.extent*(Je*Te-ue))]],tags:He};let Ft;Ft=Ne||this.options.generateId?Z[Se+zt]:this.points[Z[Se+zt]].id,Ft!==void 0&&(Rt.id=Ft),ee.features.push(Rt)}}_limitZoom(q){return Math.max(this.options.minZoom,Math.min(Math.floor(+q),this.options.maxZoom+1))}_cluster(q,Z){const{radius:J,extent:ue,reduce:Te,minPoints:ee}=this.options,Me=J/(ue*Math.pow(2,Z)),Se=q.data,Ne=[],He=this.stride;for(let Ye=0;YeZ&&(nn+=Se[er+Tt])}if(nn>en&&nn>=ee){let Tn,er=Je*en,xr=Rt*en,ci=-1;const dn=((Ye/He|0)<<5)+(Z+1)+this.points.length;for(const Or of Ft){const _i=Or*He;if(Se[_i+2]<=Z)continue;Se[_i+2]=Z;const uo=Se[_i+Tt];er+=Se[_i]*uo,xr+=Se[_i+1]*uo,Se[_i+4]=dn,Te&&(Tn||(Tn=this._map(Se,Ye,!0),ci=this.clusterProps.length,this.clusterProps.push(Tn)),Te(Tn,this._map(Se,_i)))}Se[Ye+4]=dn,Ne.push(er/nn,xr/nn,1/0,dn,-1,nn),Te&&Ne.push(ci)}else{for(let Tn=0;Tn1)for(const Tn of Ft){const er=Tn*He;if(!(Se[er+2]<=Z)){Se[er+2]=Z;for(let xr=0;xr>5}_getOriginZoom(q){return(q-this.points.length)%32}_map(q,Z,J){if(q[Z+Tt]>1){const ee=this.clusterProps[q[Z+tn]];return J?Object.assign({},ee):ee}const ue=this.points[q[Z+zt]].properties,Te=this.options.map(ue);return J&&Te===ue?Object.assign({},Te):Te}}function Jt(pe,q,Z){return{type:"Feature",id:pe[q+zt],properties:pn(pe,q,Z),geometry:{type:"Point",coordinates:[(J=pe[q],360*(J-.5)),Nr(pe[q+1])]}};var J}function pn(pe,q,Z){const J=pe[q+Tt],ue=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,Te=pe[q+tn],ee=Te===-1?{}:Object.assign({},Z[Te]);return Object.assign(ee,{cluster:!0,cluster_id:pe[q+zt],point_count:J,point_count_abbreviated:ue})}function Nn(pe){return pe/360+.5}function En(pe){const q=Math.sin(pe*Math.PI/180),Z=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return Z<0?0:Z>1?1:Z}function Nr(pe){const q=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(q))/Math.PI-90}function Jn(pe,q,Z,J){for(var ue,Te=J,ee=Z-q>>1,Me=Z-q,Se=pe[q],Ne=pe[q+1],He=pe[Z],Ye=pe[Z+1],Je=q+3;JeTe)ue=Je,Te=Rt;else if(Rt===Te){var Ft=Math.abs(Je-ee);FtJ&&(ue-q>3&&Jn(pe,q,ue,J),pe[ue+2]=Te,Z-ue>3&&Jn(pe,ue,Z,J))}function On(pe,q,Z,J,ue,Te){var ee=ue-Z,Me=Te-J;if(ee!==0||Me!==0){var Se=((pe-Z)*ee+(q-J)*Me)/(ee*ee+Me*Me);Se>1?(Z=ue,J=Te):Se>0&&(Z+=ee*Se,J+=Me*Se)}return(ee=pe-Z)*ee+(Me=q-J)*Me}function Qn(pe,q,Z,J){var ue={id:pe===void 0?null:pe,type:q,geometry:Z,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Te){var ee=Te.geometry,Me=Te.type;if(Me==="Point"||Me==="MultiPoint"||Me==="LineString")ne(Te,ee);else if(Me==="Polygon"||Me==="MultiLineString")for(var Se=0;Se0&&(ee+=J?(ue*Ne-Se*Te)/2:Math.sqrt(Math.pow(Se-ue,2)+Math.pow(Ne-Te,2))),ue=Se,Te=Ne}var He=q.length-3;q[2]=1,Jn(q,0,He,Z),q[He+2]=1,q.size=Math.abs(ee),q.start=0,q.end=q.size}function Re(pe,q,Z,J){for(var ue=0;ue1?1:Z}function _n(pe,q,Z,J,ue,Te,ee,Me){if(J/=q,Te>=(Z/=q)&&ee=J)return null;for(var Se=[],Ne=0;Ne=Z&&Ft=J)){var en=[];if(Je==="Point"||Je==="MultiPoint")ur(Ye,en,Z,J,ue);else if(Je==="LineString")Go(Ye,en,Z,J,ue,!1,Me.lineMetrics);else if(Je==="MultiLineString")Ks(Ye,en,Z,J,ue,!1);else if(Je==="Polygon")Ks(Ye,en,Z,J,ue,!0);else if(Je==="MultiPolygon")for(var nn=0;nn=Z&&ee<=J&&(q.push(pe[Te]),q.push(pe[Te+1]),q.push(pe[Te+2]))}}function Go(pe,q,Z,J,ue,Te,ee){for(var Me,Se,Ne=Cs(pe),He=ue===0?Bi:zl,Ye=pe.start,Je=0;JeZ&&(Se=He(Ne,Rt,Ft,nn,Tn,Z),ee&&(Ne.start=Ye+Me*Se)):er>J?xr=Z&&(Se=He(Ne,Rt,Ft,nn,Tn,Z),ci=!0),xr>J&&er<=J&&(Se=He(Ne,Rt,Ft,nn,Tn,J),ci=!0),!Te&&ci&&(ee&&(Ne.end=Ye+Me*Se),q.push(Ne),Ne=Cs(pe)),ee&&(Ye+=Me)}var dn=pe.length-3;Rt=pe[dn],Ft=pe[dn+1],en=pe[dn+2],(er=ue===0?Rt:Ft)>=Z&&er<=J&&tl(Ne,Rt,Ft,en),dn=Ne.length-3,Te&&dn>=3&&(Ne[dn]!==Ne[0]||Ne[dn+1]!==Ne[1])&&tl(Ne,Ne[0],Ne[1],Ne[2]),Ne.length&&q.push(Ne)}function Cs(pe){var q=[];return q.size=pe.size,q.start=pe.start,q.end=pe.end,q}function Ks(pe,q,Z,J,ue,Te){for(var ee=0;eeee.maxX&&(ee.maxX=He),Ye>ee.maxY&&(ee.maxY=Ye)}return ee}function ui(pe,q,Z,J){var ue=q.geometry,Te=q.type,ee=[];if(Te==="Point"||Te==="MultiPoint")for(var Me=0;Me0&&q.size<(ue?ee:J))Z.numPoints+=q.length/3;else{for(var Me=[],Se=0;Seee)&&(Z.numSimplified++,Me.push(q[Se]),Me.push(q[Se+1])),Z.numPoints++;ue&&function(Ne,He){for(var Ye=0,Je=0,Rt=Ne.length,Ft=Rt-2;Je0===He)for(Je=0,Rt=Ne.length;Je24)throw new Error("maxZoom should be in the 0-24 range");if(q.promoteId&&q.generateId)throw new Error("promoteId and generateId cannot be used together.");var J=function(ue,Te){var ee=[];if(ue.type==="FeatureCollection")for(var Me=0;Me1&&console.time("creation"),Je=this.tiles[Ye]=Fl(pe,q,Z,J,Se),this.tileCoords.push({z:q,x:Z,y:J}),Ne)){Ne>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",q,Z,J,Je.numFeatures,Je.numPoints,Je.numSimplified),console.timeEnd("creation"));var Rt="z"+q;this.stats[Rt]=(this.stats[Rt]||0)+1,this.total++}if(Je.source=pe,ue){if(q===Se.maxZoom||q===ue)continue;var Ft=1<1&&console.time("clipping");var en,nn,Tn,er,xr,ci,dn=.5*Se.buffer/Se.extent,Or=.5-dn,_i=.5+dn,uo=1+dn;en=nn=Tn=er=null,xr=_n(pe,He,Z-dn,Z+_i,0,Je.minX,Je.maxX,Se),ci=_n(pe,He,Z+Or,Z+uo,0,Je.minX,Je.maxX,Se),pe=null,xr&&(en=_n(xr,He,J-dn,J+_i,1,Je.minY,Je.maxY,Se),nn=_n(xr,He,J+Or,J+uo,1,Je.minY,Je.maxY,Se),xr=null),ci&&(Tn=_n(ci,He,J-dn,J+_i,1,Je.minY,Je.maxY,Se),er=_n(ci,He,J+Or,J+uo,1,Je.minY,Je.maxY,Se),ci=null),Ne>1&&console.timeEnd("clipping"),Me.push(en||[],q+1,2*Z,2*J),Me.push(nn||[],q+1,2*Z,2*J+1),Me.push(Tn||[],q+1,2*Z+1,2*J),Me.push(er||[],q+1,2*Z+1,2*J+1)}}},un.prototype.getTile=function(pe,q,Z){var J=this.options,ue=J.extent,Te=J.debug;if(pe<0||pe>24)return null;var ee=1<1&&console.log("drilling down to z%d-%d-%d",pe,q,Z);for(var Se,Ne=pe,He=q,Ye=Z;!Se&&Ne>0;)Ne--,He=Math.floor(He/2),Ye=Math.floor(Ye/2),Se=this.tiles[an(Ne,He,Ye)];return Se&&Se.source?(Te>1&&console.log("found parent tile z%d-%d-%d",Ne,He,Ye),Te>1&&console.time("drilling down"),this.splitTile(Se.source,Ne,He,Ye,pe,q,Z),Te>1&&console.timeEnd("drilling down"),this.tiles[Me]?us(this.tiles[Me],ue):null):null};class Aa extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(q,Z){return c._(this,void 0,void 0,function*(){const J=q.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ue=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!ue)return null;const Te=new class{constructor(Me){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=Me.length,this._features=Me}feature(Me){return new class{constructor(Se){this._feature=Se,this.extent=c.W,this.type=Se.type,this.properties=Se.tags,"id"in Se&&!isNaN(Se.id)&&(this.id=parseInt(Se.id,10))}loadGeometry(){if(this._feature.type===1){const Se=[];for(const Ne of this._feature.geometry)Se.push([new c.P(Ne[0],Ne[1])]);return Se}{const Se=[];for(const Ne of this._feature.geometry){const He=[];for(const Ye of Ne)He.push(new c.P(Ye[0],Ye[1]));Se.push(He)}return Se}}toGeoJSON(Se,Ne,He){return N.call(this,Se,Ne,He)}}(this._features[Me])}}(ue.features);let ee=Xe(Te);return ee.byteOffset===0&&ee.byteLength===ee.buffer.byteLength||(ee=new Uint8Array(ee)),{vectorTile:Te,rawData:ee.buffer}})}loadData(q){return c._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const J=!!(q&&q.request&&q.request.collectResourceTiming)&&new c.bs(q.request);this._pendingRequest=new AbortController;try{let ue=yield this.loadGeoJSON(q,this._pendingRequest);if(delete this._pendingRequest,typeof ue!="object")throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);if(R(ue,!0),q.filter){const ee=c.by(q.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ee.result==="error")throw new Error(ee.value.map(Se=>`${Se.key}: ${Se.message}`).join(", "));ue={type:"FeatureCollection",features:ue.features.filter(Se=>ee.value.evaluate({zoom:0},Se))}}this._geoJSONIndex=q.cluster?new Rn(function({superclusterOptions:ee,clusterProperties:Me}){if(!Me||!ee)return ee;const Se={},Ne={},He={accumulated:null,zoom:0},Ye={properties:null},Je=Object.keys(Me);for(const Rt of Je){const[Ft,en]=Me[Rt],nn=c.by(en),Tn=c.by(typeof Ft=="string"?[Ft,["accumulated"],["get",Rt]]:Ft);Se[Rt]=nn.value,Ne[Rt]=Tn.value}return ee.map=Rt=>{Ye.properties=Rt;const Ft={};for(const en of Je)Ft[en]=Se[en].evaluate(He,Ye);return Ft},ee.reduce=(Rt,Ft)=>{Ye.properties=Ft;for(const en of Je)He.accumulated=Rt[en],Rt[en]=Ne[en].evaluate(He,Ye)},ee}(q)).load(ue.features):function(ee,Me){return new un(ee,Me)}(ue,q.geojsonVtOptions),this.loaded={};const Te={};if(J){const ee=J.finish();ee&&(Te.resourceTiming={},Te.resourceTiming[q.source]=JSON.parse(JSON.stringify(ee)))}return Te}catch(ue){if(delete this._pendingRequest,c.bz(ue))return{abandoned:!0};throw ue}})}reloadTile(q){const Z=this.loaded;return Z&&Z[q.uid]?super.reloadTile(q):this.loadTile(q)}loadGeoJSON(q,Z){return c._(this,void 0,void 0,function*(){const{promoteId:J}=q;if(q.request){const ue=yield c.h(q.request,Z);return this._dataUpdateable=cs(ue.data,J)?sn(ue.data,J):void 0,ue.data}if(typeof q.data=="string")try{const ue=JSON.parse(q.data);return this._dataUpdateable=cs(ue,J)?sn(ue,J):void 0,ue}catch{throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`)}if(!q.dataDiff)throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${q.source}`);return function(ue,Te,ee){var Me,Se,Ne,He;if(Te.removeAll&&ue.clear(),Te.remove)for(const Ye of Te.remove)ue.delete(Ye);if(Te.add)for(const Ye of Te.add){const Je=Wr(Ye,ee);Je!=null&&ue.set(Je,Ye)}if(Te.update)for(const Ye of Te.update){let Je=ue.get(Ye.id);if(Je==null)continue;const Rt=!Ye.removeAllProperties&&(((Me=Ye.removeProperties)===null||Me===void 0?void 0:Me.length)>0||((Se=Ye.addOrUpdateProperties)===null||Se===void 0?void 0:Se.length)>0);if((Ye.newGeometry||Ye.removeAllProperties||Rt)&&(Je=Object.assign({},Je),ue.set(Ye.id,Je),Rt&&(Je.properties=Object.assign({},Je.properties))),Ye.newGeometry&&(Je.geometry=Ye.newGeometry),Ye.removeAllProperties)Je.properties={};else if(((Ne=Ye.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const Ft of Ye.removeProperties)Object.prototype.hasOwnProperty.call(Je.properties,Ft)&&delete Je.properties[Ft];if(((He=Ye.addOrUpdateProperties)===null||He===void 0?void 0:He.length)>0)for(const{key:Ft,value:en}of Ye.addOrUpdateProperties)Je.properties[Ft]=en}}(this._dataUpdateable,q.dataDiff,J),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(q){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(q){return this._geoJSONIndex.getClusterExpansionZoom(q.clusterId)}getClusterChildren(q){return this._geoJSONIndex.getChildren(q.clusterId)}getClusterLeaves(q){return this._geoJSONIndex.getLeaves(q.clusterId,q.limit,q.offset)}}class Kr{constructor(q){this.self=q,this.actor=new c.C(q),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,J)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=J},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=Z=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,J)=>this._getDEMWorkerSource(Z,J.source).loadTile(J)),this.actor.registerMessageHandler("RDT",(Z,J)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,J.source).removeTile(J)})),this.actor.registerMessageHandler("GCEZ",(Z,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,J.type,J.source).getClusterExpansionZoom(J)})),this.actor.registerMessageHandler("GCC",(Z,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,J.type,J.source).getClusterChildren(J)})),this.actor.registerMessageHandler("GCL",(Z,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,J.type,J.source).getClusterLeaves(J)})),this.actor.registerMessageHandler("LD",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).loadData(J)),this.actor.registerMessageHandler("LT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).loadTile(J)),this.actor.registerMessageHandler("RT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).reloadTile(J)),this.actor.registerMessageHandler("AT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).abortTile(J)),this.actor.registerMessageHandler("RMT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).removeTile(J)),this.actor.registerMessageHandler("RS",(Z,J)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][J.type]||!this.workerSources[Z][J.type][J.source])return;const ue=this.workerSources[Z][J.type][J.source];delete this.workerSources[Z][J.type][J.source],ue.removeSource!==void 0&&ue.removeSource(J)})),this.actor.registerMessageHandler("RM",Z=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,J)=>c._(this,void 0,void 0,function*(){this.referrer=J})),this.actor.registerMessageHandler("SRPS",(Z,J)=>this._syncRTLPluginState(Z,J)),this.actor.registerMessageHandler("IS",(Z,J)=>c._(this,void 0,void 0,function*(){this.self.importScripts(J)})),this.actor.registerMessageHandler("SI",(Z,J)=>this._setImages(Z,J)),this.actor.registerMessageHandler("UL",(Z,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(J.layers,J.removedIds)})),this.actor.registerMessageHandler("SL",(Z,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(J)}))}_setImages(q,Z){return c._(this,void 0,void 0,function*(){this.availableImages[q]=Z;for(const J in this.workerSources[q]){const ue=this.workerSources[q][J];for(const Te in ue)ue[Te].availableImages=Z}})}_syncRTLPluginState(q,Z){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(Z.pluginStatus!=="loading")return c.bA.setState(Z),Z;const J=Z.pluginURL;if(this.self.importScripts(J),c.bA.isParsed()){const ue={pluginStatus:"loaded",pluginURL:J};return c.bA.setState(ue),ue}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${J}`)})}_getAvailableImages(q){let Z=this.availableImages[q];return Z||(Z=[]),Z}_getLayerIndex(q){let Z=this.layerIndexes[q];return Z||(Z=this.layerIndexes[q]=new l),Z}_getWorkerSource(q,Z,J){if(this.workerSources[q]||(this.workerSources[q]={}),this.workerSources[q][Z]||(this.workerSources[q][Z]={}),!this.workerSources[q][Z][J]){const ue={sendAsync:(Te,ee)=>(Te.targetMapId=q,this.actor.sendAsync(Te,ee))};switch(Z){case"vector":this.workerSources[q][Z][J]=new E(ue,this._getLayerIndex(q),this._getAvailableImages(q));break;case"geojson":this.workerSources[q][Z][J]=new Aa(ue,this._getLayerIndex(q),this._getAvailableImages(q));break;default:this.workerSources[q][Z][J]=new this.externalWorkerSourceTypes[Z](ue,this._getLayerIndex(q),this._getAvailableImages(q))}}return this.workerSources[q][Z][J]}_getDEMWorkerSource(q,Z){return this.demWorkerSources[q]||(this.demWorkerSources[q]={}),this.demWorkerSources[q][Z]||(this.demWorkerSources[q][Z]=new C),this.demWorkerSources[q][Z]}}return c.i(self)&&(self.worker=new Kr(self)),Kr}),i("index",["exports","./shared"],function(c,l){var d="4.1.3";let v,S;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((a,f)=>{const m=requestAnimationFrame(a);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),f(l.c())})}),getImageData(y,a=0){return this.getImageCanvasContext(y).getImageData(-a,-a,y.width+2*a,y.height+2*a)},getImageCanvasContext(y){const a=window.document.createElement("canvas"),f=a.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return a.width=y.width,a.height=y.height,f.drawImage(y,0,0,y.width,y.height),f},resolveURL:y=>(v||(v=document.createElement("a")),v.href=y,v.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class C{static testProp(a){if(!C.docStyle)return a[0];for(let f=0;f{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(a){const f=a.getBoundingClientRect();return{x:f.width/a.offsetWidth||1,y:f.height/a.offsetHeight||1,boundingClientRect:f}}static getPoint(a,f,m){const g=f.boundingClientRect;return new l.P((m.clientX-g.left)/f.x-a.clientLeft,(m.clientY-g.top)/f.y-a.clientTop)}static mousePos(a,f){const m=C.getScale(a);return C.getPoint(a,m,f)}static touchPos(a,f){const m=[],g=C.getScale(a);for(let b=0;b{a=[],f=0,m=0,g={}},y.addThrottleControl=A=>{const O=m++;return g[O]=A,O},y.removeThrottleControl=A=>{delete g[A],T()},y.getImage=(A,O,U=!0)=>new Promise((j,$)=>{M.supported&&(A.headers||(A.headers={}),A.headers.accept="image/webp,*/*"),l.e(A,{type:"image"}),a.push({abortController:O,requestParameters:A,supportImageRefresh:U,state:"queued",onError:he=>{$(he)},onSuccess:he=>{j(he)}}),T()});const b=A=>l._(this,void 0,void 0,function*(){A.state="running";const{requestParameters:O,supportImageRefresh:U,onError:j,onSuccess:$,abortController:he}=A,ce=U===!1&&!l.i(self)&&!l.g(O.url)&&(!O.headers||Object.keys(O.headers).reduce((Ie,Ue)=>Ie&&Ue==="accept",!0));f++;const me=ce?L(O,he):l.m(O,he);try{const Ie=yield me;delete A.abortController,A.state="completed",Ie.data instanceof HTMLImageElement||l.b(Ie.data)?$(Ie):Ie.data&&$({data:yield(re=Ie.data,typeof createImageBitmap=="function"?l.d(re):l.f(re)),cacheControl:Ie.cacheControl,expires:Ie.expires})}catch(Ie){delete A.abortController,j(Ie)}finally{f--,T()}var re}),T=()=>{const A=(()=>{for(const O of Object.keys(g))if(g[O]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let O=f;O0;O++){const U=a.shift();U.abortController.signal.aborted?O--:b(U)}},L=(A,O)=>new Promise((U,j)=>{const $=new Image,he=A.url,ce=A.credentials;ce&&ce==="include"?$.crossOrigin="use-credentials":(ce&&ce==="same-origin"||!l.s(he))&&($.crossOrigin="anonymous"),O.signal.addEventListener("abort",()=>{$.src="",j(l.c())}),$.fetchPriority="high",$.onload=()=>{$.onerror=$.onload=null,U({data:$})},$.onerror=()=>{$.onerror=$.onload=null,O.signal.aborted||j(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."))},$.src=he})}(G||(G={})),G.resetRequestQueue();class H{constructor(a){this._transformRequestFn=a}transformRequest(a,f){return this._transformRequestFn&&this._transformRequestFn(a,f)||{url:a}}normalizeSpriteURL(a,f,m){const g=function(b){const T=b.match(K);if(!T)throw new Error(`Unable to parse URL "${b}"`);return{protocol:T[1],authority:T[2],path:T[3]||"/",params:T[4]?T[4].split("&"):[]}}(a);return g.path+=`${f}${m}`,function(b){const T=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${T}`}(g)}setTransformRequest(a){this._transformRequestFn=a}}const K=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function _e(y){var a=new l.A(3);return a[0]=y[0],a[1]=y[1],a[2]=y[2],a}var ae,le=function(y,a,f){return y[0]=a[0]-f[0],y[1]=a[1]-f[1],y[2]=a[2]-f[2],y};ae=new l.A(3),l.A!=Float32Array&&(ae[0]=0,ae[1]=0,ae[2]=0);var ve=function(y){var a=y[0],f=y[1];return a*a+f*f};function ke(y){const a=[];if(typeof y=="string")a.push({id:"default",url:y});else if(y&&y.length>0){const f=[];for(const{id:m,url:g}of y){const b=`${m}${g}`;f.indexOf(b)===-1&&(f.push(b),a.push({id:m,url:g}))}}return a}(function(){var y=new l.A(2);l.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Q{constructor(a,f,m,g){this.context=a,this.format=m,this.texture=a.gl.createTexture(),this.update(f,g)}update(a,f,m){const{width:g,height:b}=a,T=!(this.size&&this.size[0]===g&&this.size[1]===b||m),{context:L}=this,{gl:A}=L;if(this.useMipmap=!!(f&&f.useMipmap),A.bindTexture(A.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===A.RGBA&&(!f||f.premultiply!==!1)),T)this.size=[g,b],a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement||a instanceof ImageData||l.b(a)?A.texImage2D(A.TEXTURE_2D,0,this.format,this.format,A.UNSIGNED_BYTE,a):A.texImage2D(A.TEXTURE_2D,0,this.format,g,b,0,this.format,A.UNSIGNED_BYTE,a.data);else{const{x:O,y:U}=m||{x:0,y:0};a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement||a instanceof ImageData||l.b(a)?A.texSubImage2D(A.TEXTURE_2D,0,O,U,A.RGBA,A.UNSIGNED_BYTE,a):A.texSubImage2D(A.TEXTURE_2D,0,O,U,g,b,A.RGBA,A.UNSIGNED_BYTE,a.data)}this.useMipmap&&this.isSizePowerOfTwo()&&A.generateMipmap(A.TEXTURE_2D)}bind(a,f,m){const{context:g}=this,{gl:b}=g;b.bindTexture(b.TEXTURE_2D,this.texture),m!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=b.LINEAR),a!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,a),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,m||a),this.filter=a),f!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:a}=this.context;a.deleteTexture(this.texture),this.texture=null}}function oe(y){const{userImage:a}=y;return!!(a&&a.render&&a.render())&&(y.data.replace(new Uint8Array(a.data.buffer)),!0)}class qe extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:f,promiseResolve:m}of this.requestors)m(this._getImagesForIds(f));this.requestors=[]}}getImage(a){const f=this.images[a];if(f&&!f.data&&f.spriteData){const m=f.spriteData;f.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),f.spriteData=null}return f}addImage(a,f){if(this.images[a])throw new Error(`Image id ${a} already exist, use updateImage instead`);this._validate(a,f)&&(this.images[a]=f)}_validate(a,f){let m=!0;const g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new l.j(new Error(`Image "${a}" has invalid "stretchX" value`))),m=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new l.j(new Error(`Image "${a}" has invalid "stretchY" value`))),m=!1),this._validateContent(f.content,f)||(this.fire(new l.j(new Error(`Image "${a}" has invalid "content" value`))),m=!1),m}_validateStretch(a,f){if(!a)return!0;let m=0;for(const g of a){if(g[0]{let g=!0;if(!this.isLoaded())for(const b of a)this.images[b]||(g=!1);this.isLoaded()||g?f(this._getImagesForIds(a)):this.requestors.push({ids:a,promiseResolve:f})})}_getImagesForIds(a){const f={};for(const m of a){let g=this.getImage(m);g||(this.fire(new l.k("styleimagemissing",{id:m})),g=this.getImage(m)),g?f[m]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:l.w(`Image "${m}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:a,height:f}=this.atlasImage;return{width:a,height:f}}getPattern(a){const f=this.patterns[a],m=this.getImage(a);if(!m)return null;if(f&&f.position.version===m.version)return f.position;if(f)f.position.version=m.version;else{const g={w:m.data.width+2,h:m.data.height+2,x:0,y:0},b=new l.I(g,m);this.patterns[a]={bin:g,position:b}}return this._updatePatternAtlas(),this.patterns[a].position}bind(a){const f=a.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Q(a,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const a=[];for(const b in this.patterns)a.push(this.patterns[b].bin);const{w:f,h:m}=l.p(a),g=this.atlasImage;g.resize({width:f||1,height:m||1});for(const b in this.patterns){const{bin:T}=this.patterns[b],L=T.x+1,A=T.y+1,O=this.getImage(b).data,U=O.width,j=O.height;l.R.copy(O,g,{x:0,y:0},{x:L,y:A},{width:U,height:j}),l.R.copy(O,g,{x:0,y:j-1},{x:L,y:A-1},{width:U,height:1}),l.R.copy(O,g,{x:0,y:0},{x:L,y:A+j},{width:U,height:1}),l.R.copy(O,g,{x:U-1,y:0},{x:L-1,y:A},{width:1,height:j}),l.R.copy(O,g,{x:0,y:0},{x:L+U,y:A},{width:1,height:j})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(a){for(const f of a){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const m=this.getImage(f);m||l.w(`Image with ID: "${f}" was not found`),oe(m)&&this.updateImage(f,m)}}}const Pe=1e20;function it(y,a,f,m,g,b,T,L,A){for(let O=a;O-1);A++,b[A]=L,T[A]=O,T[A+1]=Pe}for(let L=0,A=0;L65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[b])return{stack:a,id:f,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[b]){const L=Xe.loadGlyphRange(a,b,this.url,this.requestManager);m.requests[b]=L}const T=yield m.requests[b];for(const L in T)this._doesCharSupportLocalGlyph(+L)||(m.glyphs[+L]=T[+L]);return m.ranges[b]=!0,{stack:a,id:f,glyph:T[f]||null}})}_doesCharSupportLocalGlyph(a){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](a)||l.u["Hangul Syllables"](a)||l.u.Hiragana(a)||l.u.Katakana(a))}_tinySDF(a,f,m){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(m))return;let b=a.tinySDF;if(!b){let L="400";/bold/i.test(f)?L="900":/medium/i.test(f)?L="500":/light/i.test(f)&&(L="200"),b=a.tinySDF=new Xe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:L})}const T=b.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:T.width||60,height:T.height||60},T.data),metrics:{width:T.glyphWidth/2||24,height:T.glyphHeight/2||24,left:T.glyphLeft/2+.5||0,top:T.glyphTop/2-27.5||-8,advance:T.glyphAdvance/2||24,isDoubleResolution:!0}}}}Xe.loadGlyphRange=function(y,a,f,m){return l._(this,void 0,void 0,function*(){const g=256*a,b=g+255,T=m.transformRequest(f.replace("{fontstack}",y).replace("{range}",`${g}-${b}`),"Glyphs"),L=yield l.l(T,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${a}, ${g}-${b}`);const A={};for(const O of l.n(L.data))A[O.id]=O;return A})},Xe.TinySDF=class{constructor({fontSize:y=24,buffer:a=3,radius:f=8,cutoff:m=.25,fontFamily:g="sans-serif",fontWeight:b="normal",fontStyle:T="normal"}={}){this.buffer=a,this.cutoff=m,this.radius=f;const L=this.size=y+4*a,A=this._createCanvas(L),O=this.ctx=A.getContext("2d",{willReadFrequently:!0});O.font=`${T} ${b} ${y}px ${g}`,O.textBaseline="alphabetic",O.textAlign="left",O.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(y){const a=document.createElement("canvas");return a.width=a.height=y,a}draw(y){const{width:a,actualBoundingBoxAscent:f,actualBoundingBoxDescent:m,actualBoundingBoxLeft:g,actualBoundingBoxRight:b}=this.ctx.measureText(y),T=Math.ceil(f),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-g))),A=Math.min(this.size-this.buffer,T+Math.ceil(m)),O=L+2*this.buffer,U=A+2*this.buffer,j=Math.max(O*U,0),$=new Uint8ClampedArray(j),he={data:$,width:O,height:U,glyphWidth:L,glyphHeight:A,glyphTop:T,glyphLeft:0,glyphAdvance:a};if(L===0||A===0)return he;const{ctx:ce,buffer:me,gridInner:re,gridOuter:Ie}=this;ce.clearRect(me,me,L,A),ce.fillText(y,me,me+T);const Ue=ce.getImageData(me,me,L,A);Ie.fill(Pe,0,j),re.fill(0,0,j);for(let xe=0;xe0?Ke*Ke:0,re[Ze]=Ke<0?Ke*Ke:0}}it(Ie,0,0,O,U,O,this.f,this.v,this.z),it(re,me,me,L,A,O,this.f,this.v,this.z);for(let xe=0;xe1&&(A=a[++L]);const U=Math.abs(O-A.left),j=Math.abs(O-A.right),$=Math.min(U,j);let he;const ce=b/m*(g+1);if(A.isDash){const me=g-Math.abs(ce);he=Math.sqrt($*$+me*me)}else he=g-Math.sqrt($*$+ce*ce);this.data[T+O]=Math.max(0,Math.min(255,he+128))}}}addRegularDash(a){for(let L=a.length-1;L>=0;--L){const A=a[L],O=a[L+1];A.zeroLength?a.splice(L,1):O&&O.isDash===A.isDash&&(O.left=A.left,a.splice(L,1))}const f=a[0],m=a[a.length-1];f.isDash===m.isDash&&(f.left=m.left-this.width,m.right=f.right+this.width);const g=this.width*this.nextRow;let b=0,T=a[b];for(let L=0;L1&&(T=a[++b]);const A=Math.abs(L-T.left),O=Math.abs(L-T.right),U=Math.min(A,O);this.data[g+L]=Math.max(0,Math.min(255,(T.isDash?U:-U)+128))}}addDash(a,f){const m=f?7:0,g=2*m+1;if(this.nextRow+g>this.height)return l.w("LineAtlas out of space"),null;let b=0;for(let L=0;L{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Tt]}numActive(){return Object.keys(this.active).length}}const Rn=Math.floor(E.hardwareConcurrency/2);let Jt,pn;function Nn(){return Jt||(Jt=new tn),Jt}tn.workerCount=l.B(globalThis)?Math.max(Math.min(Rn,3),1):1;class En{constructor(a,f){this.workerPool=a,this.actors=[],this.currentActor=0,this.id=f;const m=this.workerPool.acquire(f);for(let g=0;g{f.remove()}),this.actors=[],a&&this.workerPool.release(this.id)}registerMessageHandler(a,f){for(const m of this.actors)m.registerMessageHandler(a,f)}}function Nr(){return pn||(pn=new En(Nn(),l.G),pn.registerMessageHandler("GR",(y,a,f)=>l.m(a,f))),pn}function Jn(y,a){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*y.width,.5*y.height,1]),l.K(f,f,y.calculatePosMatrix(a.toUnwrapped()))}function On(y,a,f,m,g,b){const T=function(j,$,he){if(j)for(const ce of j){const me=$[ce];if(me&&me.source===he&&me.type==="fill-extrusion")return!0}else for(const ce in $){const me=$[ce];if(me.source===he&&me.type==="fill-extrusion")return!0}return!1}(g&&g.layers,a,y.id),L=b.maxPitchScaleFactor(),A=y.tilesIn(m,L,T);A.sort(Qn);const O=[];for(const j of A)O.push({wrappedTileID:j.tileID.wrapped().key,queryResults:j.tile.queryRenderedFeatures(a,f,y._state,j.queryGeometry,j.cameraQueryGeometry,j.scale,g,b,L,Jn(y.transform,j.tileID))});const U=function(j){const $={},he={};for(const ce of j){const me=ce.queryResults,re=ce.wrappedTileID,Ie=he[re]=he[re]||{};for(const Ue in me){const xe=me[Ue],De=Ie[Ue]=Ie[Ue]||{},Ge=$[Ue]=$[Ue]||[];for(const Ze of xe)De[Ze.featureIndex]||(De[Ze.featureIndex]=!0,Ge.push(Ze))}}return $}(O);for(const j in U)U[j].forEach($=>{const he=$.feature,ce=y.getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=ce});return U}function Qn(y,a){const f=y.tileID,m=a.tileID;return f.overscaledZ-m.overscaledZ||f.canonical.y-m.canonical.y||f.wrap-m.wrap||f.canonical.x-m.canonical.x}function ne(y,a,f){return l._(this,void 0,void 0,function*(){let m=y;if(y.url?m=(yield l.h(a.transformRequest(y.url,"Source"),f)).data:yield E.frameAsync(f),!m)return null;const g=l.L(l.e(m,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(g.vectorLayerIds=m.vector_layers.map(b=>b.id)),g})}class Ce{constructor(a,f){a&&(f?this.setSouthWest(a).setNorthEast(f):Array.isArray(a)&&(a.length===4?this.setSouthWest([a[0],a[1]]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1])))}setNorthEast(a){return this._ne=a instanceof l.M?new l.M(a.lng,a.lat):l.M.convert(a),this}setSouthWest(a){return this._sw=a instanceof l.M?new l.M(a.lng,a.lat):l.M.convert(a),this}extend(a){const f=this._sw,m=this._ne;let g,b;if(a instanceof l.M)g=a,b=a;else{if(!(a instanceof Ce))return Array.isArray(a)?a.length===4||a.every(Array.isArray)?this.extend(Ce.convert(a)):this.extend(l.M.convert(a)):a&&("lng"in a||"lon"in a)&&"lat"in a?this.extend(l.M.convert(a)):this;if(g=a._sw,b=a._ne,!g||!b)return this}return f||m?(f.lng=Math.min(g.lng,f.lng),f.lat=Math.min(g.lat,f.lat),m.lng=Math.max(b.lng,m.lng),m.lat=Math.max(b.lat,m.lat)):(this._sw=new l.M(g.lng,g.lat),this._ne=new l.M(b.lng,b.lat)),this}getCenter(){return new l.M((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 l.M(this.getWest(),this.getNorth())}getSouthEast(){return new l.M(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(a){const{lng:f,lat:m}=l.M.convert(a);let g=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&g}static convert(a){return a instanceof Ce?a:a&&new Ce(a)}static fromLngLat(a,f=0){const m=360*f/40075017,g=m/Math.cos(Math.PI/180*a.lat);return new Ce(new l.M(a.lng-g,a.lat-m),new l.M(a.lng+g,a.lat+m))}}class ot{constructor(a,f,m){this.bounds=Ce.convert(this.validateBounds(a)),this.minzoom=f||0,this.maxzoom=m||24}validateBounds(a){return Array.isArray(a)&&a.length===4?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3])]:[-180,-90,180,90]}contains(a){const f=Math.pow(2,a.z),m=Math.floor(l.N(this.bounds.getWest())*f),g=Math.floor(l.O(this.bounds.getNorth())*f),b=Math.ceil(l.N(this.bounds.getEast())*f),T=Math.ceil(l.O(this.bounds.getSouth())*f);return a.x>=m&&a.x=g&&a.y{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(f,"Tile"),uid:a.uid,tileID:a.tileID,zoom:a.tileID.overscaledZ,tileSize:this.tileSize*a.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let g="RT";if(a.actor&&a.state!=="expired"){if(a.state==="loading")return new Promise((b,T)=>{a.reloadPromise={resolve:b,reject:T}})}else a.actor=this.dispatcher.getActor(),g="LT";a.abortController=new AbortController;try{const b=yield a.actor.sendAsync({type:g,data:m},a.abortController);if(delete a.abortController,a.aborted)return;this._afterTileLoadWorkerResponse(a,b)}catch(b){if(delete a.abortController,a.aborted)return;if(b&&b.status!==404)throw b;this._afterTileLoadWorkerResponse(a,null)}})}_afterTileLoadWorkerResponse(a,f){if(f&&f.resourceTiming&&(a.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&a.setExpiryData(f),a.loadVectorData(f,this.map.painter),a.reloadPromise){const m=a.reloadPromise;a.reloadPromise=null,this.loadTile(a).then(m.resolve).catch(m.reject)}}abortTile(a){return l._(this,void 0,void 0,function*(){a.abortController&&(a.abortController.abort(),delete a.abortController),a.actor&&(yield a.actor.sendAsync({type:"AT",data:{uid:a.uid,type:this.type,source:this.id}}))})}unloadTile(a){return l._(this,void 0,void 0,function*(){a.unloadVectorData(),a.actor&&(yield a.actor.sendAsync({type:"RMT",data:{uid:a.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Re extends l.E{constructor(a,f,m,g){super(),this.id=a,this.dispatcher=m,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=l.e({type:"raster"},f),l.e(this,l.L(f,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const a=yield ne(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,a&&(l.e(this,a),a.bounds&&(this.tileBounds=new ot(a.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(a){this._tileJSONRequest=null,this.fire(new l.j(a))}})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(a){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),a(),this.load()}setTiles(a){return this.setSourceProperty(()=>{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}serialize(){return l.e({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);a.abortController=new AbortController;try{const m=yield G.getImage(this.map._requestManager.transformRequest(f,"Tile"),a.abortController,this.map._refreshExpiredTiles);if(delete a.abortController,a.aborted)return void(a.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&a.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const g=this.map.painter.context,b=g.gl,T=m.data;a.texture=this.map.painter.getTileTexture(T.width),a.texture?a.texture.update(T,{useMipmap:!0}):(a.texture=new Q(g,T,b.RGBA,{useMipmap:!0}),a.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&b.texParameterf(b.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),a.state="loaded"}}catch(m){if(delete a.abortController,a.aborted)a.state="unloaded";else if(m)throw a.state="errored",m}})}abortTile(a){return l._(this,void 0,void 0,function*(){a.abortController&&(a.abortController.abort(),delete a.abortController)})}unloadTile(a){return l._(this,void 0,void 0,function*(){a.texture&&this.map.painter.saveTileTexture(a.texture)})}hasTransition(){return!1}}class on extends Re{constructor(a,f,m,g){super(a,f,m,g),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(f,"Tile");a.neighboringTiles=this._getNeighboringTiles(a.tileID),a.abortController=new AbortController;try{const g=yield G.getImage(m,a.abortController,this.map._refreshExpiredTiles);if(delete a.abortController,a.aborted)return void(a.state="unloaded");if(g&&g.data){const b=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&a.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const T=l.b(b)&&l.S()?b:yield this.readImageNow(b),L={type:this.type,uid:a.uid,source:this.id,rawImageData:T,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!a.actor||a.state==="expired"){a.actor=this.dispatcher.getActor();const A=yield a.actor.sendAsync({type:"LDT",data:L});a.dem=A,a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0,a.state="loaded"}}}catch(g){if(delete a.abortController,a.aborted)a.state="unloaded";else if(g)throw a.state="errored",g}})}readImageNow(a){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.U()){const f=a.width+2,m=a.height+2;try{return new l.R({width:f,height:m},yield l.V(a,-1,-1,f,m))}catch{}}return E.getImageData(a,1)})}_getNeighboringTiles(a){const f=a.canonical,m=Math.pow(2,f.z),g=(f.x-1+m)%m,b=f.x===0?a.wrap-1:a.wrap,T=(f.x+1+m)%m,L=f.x+1===m?a.wrap+1:a.wrap,A={};return A[new l.Q(a.overscaledZ,b,f.z,g,f.y).key]={backfilled:!1},A[new l.Q(a.overscaledZ,L,f.z,T,f.y).key]={backfilled:!1},f.y>0&&(A[new l.Q(a.overscaledZ,b,f.z,g,f.y-1).key]={backfilled:!1},A[new l.Q(a.overscaledZ,a.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},A[new l.Q(a.overscaledZ,L,f.z,T,f.y-1).key]={backfilled:!1}),f.y+10&&l.e(b,{resourceTiming:g}),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.actor?"RT":"LT";a.actor=this.actor;const m={type:this.type,uid:a.uid,tileID:a.tileID,zoom:a.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.abortController=new AbortController;const g=yield this.actor.sendAsync({type:f,data:m},a.abortController);delete a.abortController,a.unloadVectorData(),a.aborted||a.loadVectorData(g,this.map.painter,f==="RT")})}abortTile(a){return l._(this,void 0,void 0,function*(){a.abortController&&(a.abortController.abort(),delete a.abortController),a.aborted=!0})}unloadTile(a){return l._(this,void 0,void 0,function*(){a.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:a.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var _n=l.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ur extends l.E{constructor(a,f,m,g){super(),this.id=a,this.dispatcher=m,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=f}load(a){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,a&&(this.coordinates=a),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new l.j(f))}})}loaded(){return this._loaded}updateImage(a){return a.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=a.url,this.load(a.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(a){this.coordinates=a;const f=a.map(l.Y.fromLngLat);this.tileID=function(g){let b=1/0,T=1/0,L=-1/0,A=-1/0;for(const $ of g)b=Math.min(b,$.x),T=Math.min(T,$.y),L=Math.max(L,$.x),A=Math.max(A,$.y);const O=Math.max(L-b,A-T),U=Math.max(0,Math.floor(-Math.log(O)/Math.LN2)),j=Math.pow(2,U);return new l.a0(U,Math.floor((b+L)/2*j),Math.floor((T+A)/2*j))}(f),this.minzoom=this.maxzoom=this.tileID.z;const m=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new l.Z,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.W,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.W),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.W,l.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const a=this.map.painter.context,f=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,_n.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Q(a,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const b=this.tiles[g];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(a){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={}):a.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Go extends ur{constructor(a,f,m,g){super(a,f,m,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const a=this.options;this.urls=[];for(const f of a.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield l.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new l.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(a){if(this.video){const f=this.video.seekable;af.end(0)?this.fire(new l.j(new l.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=a}}getVideo(){return this.video}onAdd(a){this.map||(this.map=a,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const a=this.map.painter.context,f=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,_n.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Q(a,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const b=this.tiles[g];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Cs extends ur{constructor(a,f,m,g){super(a,f,m,g),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(T=>typeof T!="number"))||this.fire(new l.j(new l.a1(`sources.${a}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a1(`sources.${a}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new l.j(new l.a1(`sources.${a}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a1(`sources.${a}`,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 l.j(new l.a1(`sources.${a}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return l._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.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())})}getCanvas(){return this.canvas}onAdd(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let a=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,a=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,a=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,m=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,_n.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?(a||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Q(f,this.canvas,m.RGBA,{premultiply:!0});let g=!1;for(const b in this.tiles){const T=this.tiles[b];T.state!=="loaded"&&(T.state="loaded",T.texture=this.texture,g=!0)}g&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height])if(isNaN(a)||a<=0)return!0;return!1}}const Ks={},tl=y=>{switch(y){case"geojson":return qr;case"image":return ur;case"raster":return Re;case"raster-dem":return on;case"vector":return kt;case"video":return Go;case"canvas":return Cs}return Ks[y]},Bi="RTLPluginLoaded";class zl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Nr()}_syncState(a){return this.status=a,this.dispatcher.broadcast("SRPS",{pluginStatus:a,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(a){return l._(this,arguments,void 0,function*(f,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Bi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ts=null;function lt(){return Ts||(Ts=new zl),Ts}class us{constructor(a,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=a,this.uid=l.a3(),this.uses=0,this.tileSize=f,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(a){const f=a+this.timeAdded;fb.getLayer(O)).filter(Boolean);if(A.length!==0){L.layers=A,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(O=>A.filter(U=>U.id===O)[0]));for(const O of A)T[O.id]=L}}return T}(a.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const b=this.buckets[g];if(b instanceof l.a5){if(this.hasSymbolBuckets=!0,!m)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const b=this.buckets[g];if(b instanceof l.a5&&b.hasRTLText){this.hasRTLText=!0,lt().lazyLoad();break}}this.queryPadding=0;for(const g in this.buckets){const b=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(g).queryRadius(b))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage)}else this.collisionBoxArray=new l.a4}unloadVectorData(){for(const a in this.buckets)this.buckets[a].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(a){return this.buckets[a.id]}upload(a){for(const m in this.buckets){const g=this.buckets[m];g.uploadPending()&&g.upload(a)}const f=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Q(a,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Q(a,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)}queryRenderedFeatures(a,f,m,g,b,T,L,A,O,U){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:b,scale:T,tileSize:this.tileSize,pixelPosMatrix:U,transform:A,params:L,queryPadding:this.queryPadding*O},a,f,m):{}}querySourceFeatures(a,f){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const g=m.loadVTLayers(),b=f&&f.sourceLayer?f.sourceLayer:"",T=g._geojsonTileLayer||g[b];if(!T)return;const L=l.a6(f&&f.filter),{z:A,x:O,y:U}=this.tileID.canonical,j={z:A,x:O,y:U};for(let $=0;$m)g=!1;else if(f)if(this.expirationTime{this.remove(a,b)},m)),this.data[g].push(b),this.order.push(g),this.order.length>this.max){const T=this._getAndRemoveByKey(this.order[0]);T&&this.onRemove(T)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const f=this.data[a].shift();return f.timeout&&clearTimeout(f.timeout),this.data[a].length===0&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),f.value}getByKey(a){const f=this.data[a];return f?f[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(a,f){if(!this.has(a))return this;const m=a.wrapped().key,g=f===void 0?0:this.data[m].indexOf(f),b=this.data[m][g];return this.data[m].splice(g,1),b.timeout&&clearTimeout(b.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(b.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(a){for(this.max=a;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(a){const f=[];for(const m in this.data)for(const g of this.data[m])a(g.value)||f.push(g);for(const m of f)this.remove(m.value.tileID,m)}}class Fl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,f,m){const g=String(f);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][g]=this.stateChanges[a][g]||{},l.e(this.stateChanges[a][g],m),this.deletedStates[a]===null){this.deletedStates[a]={};for(const b in this.state[a])b!==g&&(this.deletedStates[a][b]=null)}else if(this.deletedStates[a]&&this.deletedStates[a][g]===null){this.deletedStates[a][g]={};for(const b in this.state[a][g])m[b]||(this.deletedStates[a][g][b]=null)}else for(const b in m)this.deletedStates[a]&&this.deletedStates[a][g]&&this.deletedStates[a][g][b]===null&&delete this.deletedStates[a][g][b]}removeFeatureState(a,f,m){if(this.deletedStates[a]===null)return;const g=String(f);if(this.deletedStates[a]=this.deletedStates[a]||{},m&&f!==void 0)this.deletedStates[a][g]!==null&&(this.deletedStates[a][g]=this.deletedStates[a][g]||{},this.deletedStates[a][g][m]=null);else if(f!==void 0)if(this.stateChanges[a]&&this.stateChanges[a][g])for(m in this.deletedStates[a][g]={},this.stateChanges[a][g])this.deletedStates[a][g][m]=null;else this.deletedStates[a][g]=null;else this.deletedStates[a]=null}getState(a,f){const m=String(f),g=l.e({},(this.state[a]||{})[m],(this.stateChanges[a]||{})[m]);if(this.deletedStates[a]===null)return{};if(this.deletedStates[a]){const b=this.deletedStates[a][f];if(b===null)return{};for(const T in b)delete g[T]}return g}initializeTileState(a,f){a.setFeatureState(this.state,f)}coalesceChanges(a,f){const m={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const b={};for(const T in this.stateChanges[g])this.state[g][T]||(this.state[g][T]={}),l.e(this.state[g][T],this.stateChanges[g][T]),b[T]=this.state[g][T];m[g]=b}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const b={};if(this.deletedStates[g]===null)for(const T in this.state[g])b[T]={},this.state[g][T]={};else for(const T in this.deletedStates[g]){if(this.deletedStates[g][T]===null)this.state[g][T]={};else for(const L of Object.keys(this.deletedStates[g][T]))delete this.state[g][T][L];b[T]=this.state[g][T]}m[g]=m[g]||{},l.e(m[g],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const g in a)a[g].setFeatureState(m,f)}}class ui extends l.E{constructor(a,f,m){super(),this.id=a,this.dispatcher=m,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,b,T,L)=>{const A=new(tl(b.type))(g,b,T,L);if(A.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${A.id}`);return A})(a,f,m,this),this._tiles={},this._cache=new lo(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Fl,this._didEmitContent=!1,this._updated=!1}onAdd(a){this.map=a,this._maxTileCacheSize=a?a._maxTileCacheSize:null,this._maxTileCacheZoomLevels=a?a._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(a)}onRemove(a){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(a)}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 a in this._tiles){const f=this._tiles[a];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(a,f,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(a),this._tileLoaded(a,f,m)}catch(g){a.state="errored",g.status!==404?this._source.fire(new l.j(g,{tile:a})):this.update(this.transform,this.terrain)}})}_unloadTile(a){this._source.unloadTile&&this._source.unloadTile(a)}_abortTile(a){this._source.abortTile&&this._source.abortTile(a),this._source.fire(new l.k("dataabort",{tile:a,coord:a.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(a){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const m=this._tiles[f];m.upload(a),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(a=>a.tileID).sort(pt).map(a=>a.key)}getRenderableIds(a){const f=[];for(const m in this._tiles)this._isIdRenderable(m,a)&&f.push(this._tiles[m]);return a?f.sort((m,g)=>{const b=m.tileID,T=g.tileID,L=new l.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),A=new l.P(T.canonical.x,T.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-T.overscaledZ||A.y-L.y||A.x-L.x}).map(m=>m.tileID.key):f.map(m=>m.tileID).sort(pt).map(m=>m.key)}hasRenderableParent(a){const f=this.findLoadedParent(a,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(a,f){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(f||!this._tiles[a].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const a in this._tiles)this._tiles[a].state!=="errored"&&this._reloadTile(a,"reloading")}}_reloadTile(a,f){return l._(this,void 0,void 0,function*(){const m=this._tiles[a];m&&(m.state!=="loading"&&(m.state=f),yield this._loadTile(m,a,f))})}_tileLoaded(a,f,m){a.timeAdded=E.now(),m==="expired"&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(f,a),this.getSource().type==="raster-dem"&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null),a.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:a,coord:a.tileID}))}_backfillDEM(a){const f=this.getRenderableIds();for(let g=0;g1||(Math.abs(T)>1&&(Math.abs(T+A)===1?T+=A:Math.abs(T-A)===1&&(T-=A)),b.dem&&g.dem&&(g.dem.backfillBorder(b.dem,T,L),g.neighboringTiles&&g.neighboringTiles[O]&&(g.neighboringTiles[O].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(a,f,m,g){for(const b in this._tiles){let T=this._tiles[b];if(g[b]||!T.hasData()||T.tileID.overscaledZ<=f||T.tileID.overscaledZ>m)continue;let L=T.tileID;for(;T&&T.tileID.overscaledZ>f+1;){const O=T.tileID.scaledTo(T.tileID.overscaledZ-1);T=this._tiles[O.key],T&&T.hasData()&&(L=O)}let A=L;for(;A.overscaledZ>f;)if(A=A.scaledTo(A.overscaledZ-1),a[A.key]){g[L.key]=L;break}}}findLoadedParent(a,f){if(a.key in this._loadedParentTiles){const m=this._loadedParentTiles[a.key];return m&&m.tileID.overscaledZ>=f?m:null}for(let m=a.overscaledZ-1;m>=f;m--){const g=a.scaledTo(m),b=this._getLoadedTile(g);if(b)return b}}_getLoadedTile(a){const f=this._tiles[a.key];return f&&f.hasData()?f:this._cache.getByKey(a.wrapped().key)}updateCacheSize(a){const f=Math.ceil(a.width/this._source.tileSize)+1,m=Math.ceil(a.height/this._source.tileSize)+1,g=Math.floor(f*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(b)}handleWrapJump(a){const f=Math.round((a-(this._prevLng===void 0?a:this._prevLng))/360);if(this._prevLng=a,f){const m={};for(const g in this._tiles){const b=this._tiles[g];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+f),m[b.tileID.key]=b}this._tiles=m;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(a,f){if(!this._sourceLoaded||this._paused)return;let m;this.transform=a,this.terrain=f,this.updateCacheSize(a),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=a.getVisibleUnwrappedCoordinates(this._source.tileID).map(U=>new l.Q(U.canonical.z,U.wrap,U.canonical.z,U.canonical.x,U.canonical.y)):(m=a.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:f}),this._source.hasTile&&(m=m.filter(U=>this._source.hasTile(U)))):m=[];const g=a.coveringZoomLevel(this._source),b=Math.max(g-ui.maxOverzooming,this._source.minzoom),T=Math.max(g+ui.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const U={};for(const j of m)if(j.canonical.z>this._source.minzoom){const $=j.scaledTo(j.canonical.z-1);U[$.key]=$;const he=j.scaledTo(Math.max(this._source.minzoom,Math.min(j.canonical.z,5)));U[he.key]=he}m=m.concat(Object.values(U))}const L=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const A=this._updateRetainedTiles(m,g);if(un(this._source.type)){const U={},j={},$=Object.keys(A),he=E.now();for(const ce of $){const me=A[ce],re=this._tiles[ce];if(!re||re.fadeEndTime!==0&&re.fadeEndTime<=he)continue;const Ie=this.findLoadedParent(me,b);Ie&&(this._addTile(Ie.tileID),U[Ie.tileID.key]=Ie.tileID),j[ce]=me}this._retainLoadedChildren(j,g,T,A);for(const ce in U)A[ce]||(this._coveredTiles[ce]=!0,A[ce]=U[ce]);if(f){const ce={},me={};for(const re of m)this._tiles[re.key].hasData()?ce[re.key]=re:me[re.key]=re;for(const re in me){const Ie=me[re].children(this._source.maxzoom);this._tiles[Ie[0].key]&&this._tiles[Ie[1].key]&&this._tiles[Ie[2].key]&&this._tiles[Ie[3].key]&&(ce[Ie[0].key]=A[Ie[0].key]=Ie[0],ce[Ie[1].key]=A[Ie[1].key]=Ie[1],ce[Ie[2].key]=A[Ie[2].key]=Ie[2],ce[Ie[3].key]=A[Ie[3].key]=Ie[3],delete me[re])}for(const re in me){const Ie=this.findLoadedParent(me[re],this._source.minzoom);if(Ie){ce[Ie.tileID.key]=A[Ie.tileID.key]=Ie.tileID;for(const Ue in ce)ce[Ue].isChildOf(Ie.tileID)&&delete ce[Ue]}}for(const re in this._tiles)ce[re]||(this._coveredTiles[re]=!0)}}for(const U in A)this._tiles[U].clearFadeHold();const O=l.ab(this._tiles,A);for(const U of O){const j=this._tiles[U];j.hasSymbolBuckets&&!j.holdingForFade()?j.setHoldDuration(this.map._fadeDuration):j.hasSymbolBuckets&&!j.symbolFadeFinished()||this._removeTile(U)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(a)}_updateRetainedTiles(a,f){const m={},g={},b=Math.max(f-ui.maxOverzooming,this._source.minzoom),T=Math.max(f+ui.maxUnderzooming,this._source.minzoom),L={};for(const A of a){const O=this._addTile(A);m[A.key]=A,O.hasData()||fthis._source.maxzoom){const j=A.children(this._source.maxzoom)[0],$=this.getTile(j);if($&&$.hasData()){m[j.key]=j;continue}}else{const j=A.children(this._source.maxzoom);if(m[j[0].key]&&m[j[1].key]&&m[j[2].key]&&m[j[3].key])continue}let U=O.wasRequested();for(let j=A.overscaledZ-1;j>=b;--j){const $=A.scaledTo(j);if(g[$.key])break;if(g[$.key]=!0,O=this.getTile($),!O&&U&&(O=this._addTile($)),O){const he=O.hasData();if((U||he)&&(m[$.key]=$),U=O.wasRequested(),he)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const a in this._tiles){const f=[];let m,g=this._tiles[a].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){m=this._loadedParentTiles[g.key];break}f.push(g.key);const b=g.scaledTo(g.overscaledZ-1);if(m=this._getLoadedTile(b),m)break;g=b}for(const b of f)this._loadedParentTiles[b]=m}}_addTile(a){let f=this._tiles[a.key];if(f)return f;f=this._cache.getAndRemove(a),f&&(this._setTileReloadTimer(a.key,f),f.tileID=a,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[a.key]&&(clearTimeout(this._cacheTimers[a.key]),delete this._cacheTimers[a.key],this._setTileReloadTimer(a.key,f)));const m=f;return f||(f=new us(a,this._source.tileSize*a.overscaleFactor()),this._loadTile(f,a.key,f.state)),f.uses++,this._tiles[a.key]=f,m||this._source.fire(new l.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(a,f){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const m=f.getExpiryTimeout();m&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},m))}_removeTile(a){const f=this._tiles[a];f&&(f.uses--,delete this._tiles[a],this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(a){const f=a.sourceDataType;a.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&a.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const a in this._tiles)this._removeTile(a);this._cache.reset()}tilesIn(a,f,m){const g=[],b=this.transform;if(!b)return g;const T=m?b.getCameraQueryGeometry(a):a,L=a.map(ce=>b.pointCoordinate(ce,this.terrain)),A=T.map(ce=>b.pointCoordinate(ce,this.terrain)),O=this.getIds();let U=1/0,j=1/0,$=-1/0,he=-1/0;for(const ce of A)U=Math.min(U,ce.x),j=Math.min(j,ce.y),$=Math.max($,ce.x),he=Math.max(he,ce.y);for(let ce=0;ce=0&&xe[1].y+Ue>=0){const De=L.map(Ze=>re.getTilePoint(Ze)),Ge=A.map(Ze=>re.getTilePoint(Ze));g.push({tile:me,tileID:re,queryGeometry:De,cameraQueryGeometry:Ge,scale:Ie})}}return g}getVisibleCoordinates(a){const f=this.getRenderableIds(a).map(m=>this._tiles[m].tileID);for(const m of f)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(un(this._source.type)){const a=E.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=a)return!0}return!1}setFeatureState(a,f,m){this._state.updateState(a=a||"_geojsonTileLayer",f,m)}removeFeatureState(a,f,m){this._state.removeFeatureState(a=a||"_geojsonTileLayer",f,m)}getFeatureState(a,f){return this._state.getState(a=a||"_geojsonTileLayer",f)}setDependencies(a,f,m){const g=this._tiles[a];g&&g.setDependencies(f,m)}reloadTilesForDependencies(a,f){for(const m in this._tiles)this._tiles[m].hasDependency(a,f)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(a,f))}}function pt(y,a){const f=Math.abs(2*y.wrap)-+(y.wrap<0),m=Math.abs(2*a.wrap)-+(a.wrap<0);return y.overscaledZ-a.overscaledZ||m-f||a.canonical.y-y.canonical.y||a.canonical.x-y.canonical.x}function un(y){return y==="raster"||y==="image"||y==="video"}ui.maxOverzooming=10,ui.maxUnderzooming=3;class an{constructor(a,f){this.reset(a,f)}reset(a,f){this.points=a||[],this._distances=[0];for(let m=1;m0?(g-T)/L:0;return this.points[b].mult(1-A).add(this.points[f].mult(A))}}function Wr(y,a){let f=!0;return y==="always"||y!=="never"&&a!=="never"||(f=!1),f}class cs{constructor(a,f,m){const g=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(a/m),this.yCellCount=Math.ceil(f/m);for(let T=0;Tthis.width||g<0||f>this.height)return[];const A=[];if(a<=0&&f<=0&&this.width<=m&&this.height<=g){if(b)return[{key:null,x1:a,y1:f,x2:m,y2:g}];for(let O=0;O0}hitTestCircle(a,f,m,g,b){const T=a-m,L=a+m,A=f-m,O=f+m;if(L<0||T>this.width||O<0||A>this.height)return!1;const U=[];return this._forEachCell(T,A,L,O,this._queryCellCircle,U,{hitTest:!0,overlapMode:g,circle:{x:a,y:f,radius:m},seenUids:{box:{},circle:{}}},b),U.length>0}_queryCell(a,f,m,g,b,T,L,A){const{seenUids:O,hitTest:U,overlapMode:j}=L,$=this.boxCells[b];if($!==null){const ce=this.bboxes;for(const me of $)if(!O.box[me]){O.box[me]=!0;const re=4*me,Ie=this.boxKeys[me];if(a<=ce[re+2]&&f<=ce[re+3]&&m>=ce[re+0]&&g>=ce[re+1]&&(!A||A(Ie))&&(!U||!Wr(j,Ie.overlapMode))&&(T.push({key:Ie,x1:ce[re],y1:ce[re+1],x2:ce[re+2],y2:ce[re+3]}),U))return!0}}const he=this.circleCells[b];if(he!==null){const ce=this.circles;for(const me of he)if(!O.circle[me]){O.circle[me]=!0;const re=3*me,Ie=this.circleKeys[me];if(this._circleAndRectCollide(ce[re],ce[re+1],ce[re+2],a,f,m,g)&&(!A||A(Ie))&&(!U||!Wr(j,Ie.overlapMode))){const Ue=ce[re],xe=ce[re+1],De=ce[re+2];if(T.push({key:Ie,x1:Ue-De,y1:xe-De,x2:Ue+De,y2:xe+De}),U)return!0}}}return!1}_queryCellCircle(a,f,m,g,b,T,L,A){const{circle:O,seenUids:U,overlapMode:j}=L,$=this.boxCells[b];if($!==null){const ce=this.bboxes;for(const me of $)if(!U.box[me]){U.box[me]=!0;const re=4*me,Ie=this.boxKeys[me];if(this._circleAndRectCollide(O.x,O.y,O.radius,ce[re+0],ce[re+1],ce[re+2],ce[re+3])&&(!A||A(Ie))&&!Wr(j,Ie.overlapMode))return T.push(!0),!0}}const he=this.circleCells[b];if(he!==null){const ce=this.circles;for(const me of he)if(!U.circle[me]){U.circle[me]=!0;const re=3*me,Ie=this.circleKeys[me];if(this._circlesCollide(ce[re],ce[re+1],ce[re+2],O.x,O.y,O.radius)&&(!A||A(Ie))&&!Wr(j,Ie.overlapMode))return T.push(!0),!0}}}_forEachCell(a,f,m,g,b,T,L,A){const O=this._convertToXCellCoord(a),U=this._convertToYCellCoord(f),j=this._convertToXCellCoord(m),$=this._convertToYCellCoord(g);for(let he=O;he<=j;he++)for(let ce=U;ce<=$;ce++)if(b.call(this,a,f,m,g,this.xCellCount*ce+he,T,L,A))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,f,m,g,b,T){const L=g-a,A=b-f,O=m+T;return O*O>L*L+A*A}_circleAndRectCollide(a,f,m,g,b,T,L){const A=(T-g)/2,O=Math.abs(a-(g+A));if(O>A+m)return!1;const U=(L-b)/2,j=Math.abs(f-(b+U));if(j>U+m)return!1;if(O<=A||j<=U)return!0;const $=O-A,he=j-U;return $*$+he*he<=m*m}}function sn(y,a,f,m,g){const b=l.F();return a?(l.J(b,b,[1/g,1/g,1]),f||l.ad(b,b,m.angle)):l.K(b,m.labelPlaneMatrix,y),b}function Aa(y,a,f,m,g){if(a){const b=l.ae(y);return l.J(b,b,[g,g,1]),f||l.ad(b,b,-m.angle),b}return m.glCoordMatrix}function Kr(y,a,f){let m;f?(m=[y.x,y.y,f(y.x,y.y),1],l.af(m,m,a)):(m=[y.x,y.y,0,1],Rt(m,m,a));const g=m[3];return{point:new l.P(m[0]/g,m[1]/g),signedDistanceFromCamera:g}}function pe(y,a){return .5+y/a*.5}function q(y,a){const f=y[0]/y[3],m=y[1]/y[3];return f>=-a[0]&&f<=a[0]&&m>=-a[1]&&m<=a[1]}function Z(y,a,f,m,g,b,T,L,A,O){const U=m?y.textSizeData:y.iconSizeData,j=l.ag(U,f.transform.zoom),$=[256/f.width*2+1,256/f.height*2+1],he=m?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;he.clear();const ce=y.lineVertexArray,me=m?y.text.placedSymbolArray:y.icon.placedSymbolArray,re=f.transform.width/f.transform.height;let Ie=!1;for(let Ue=0;UeMath.abs(f.x-a.x)*m?{useVertical:!0}:(y===l.ah.vertical?a.yf.x)?{needsFlipping:!0}:null}function Te(y,a,f,m,g,b,T,L,A,O,U,j,$,he,ce,me){const re=a/24,Ie=y.lineOffsetX*re,Ue=y.lineOffsetY*re;let xe;if(y.numGlyphs>1){const De=y.glyphStartIndex+y.numGlyphs,Ge=y.lineStartIndex,Ze=y.lineStartIndex+y.lineLength,Ke=J(re,L,Ie,Ue,f,U,j,y,A,b,$,ce,me);if(!Ke)return{notEnoughRoom:!0};const rt=Kr(Ke.first.point,T,me).point,tt=Kr(Ke.last.point,T,me).point;if(m&&!f){const ct=ue(y.writingMode,rt,tt,he);if(ct)return ct}xe=[Ke.first];for(let ct=y.glyphStartIndex+1;ct0?rt.point:ee(j,Ke,Ge,1,g,me),ct=ue(y.writingMode,Ge,tt,he);if(ct)return ct}const De=He(re*L.getoffsetX(y.glyphStartIndex),Ie,Ue,f,U,j,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,A,b,$,ce,me);if(!De)return{notEnoughRoom:!0};xe=[De]}for(const De of xe)l.aj(O,De.point,De.angle);return{}}function ee(y,a,f,m,g,b){const T=Kr(y.add(y.sub(a)._unit()),g,b).point,L=f.sub(T);return f.add(L._mult(m/L.mag()))}function Me(y,a){const{projectionCache:f,lineVertexArray:m,labelPlaneMatrix:g,tileAnchorPoint:b,distanceFromAnchor:T,getElevation:L,previousVertex:A,direction:O,absOffsetX:U}=a;if(f.projections[y])return f.projections[y];const j=new l.P(m.getx(y),m.gety(y)),$=Kr(j,g,L);if($.signedDistanceFromCamera>0)return f.projections[y]=$.point,$.point;const he=y-O;return ee(T===0?b:new l.P(m.getx(he),m.gety(he)),j,A,U-T+1,g,L)}function Se(y,a,f){return y._unit()._perp()._mult(a*f)}function Ne(y,a,f,m,g,b,T,L){const{projectionCache:A,direction:O}=L;if(A.offsets[y])return A.offsets[y];const U=f.add(a);if(y+O=g)return A.offsets[y]=U,U;const j=Me(y+O,L),$=Se(j.sub(f),T,O),he=f.add($),ce=j.add($);return A.offsets[y]=l.ak(b,U,he,ce)||U,A.offsets[y]}function He(y,a,f,m,g,b,T,L,A,O,U,j,$,he){const ce=m?y-a:y+a;let me=ce>0?1:-1,re=0;m&&(me*=-1,re=Math.PI),me<0&&(re+=Math.PI);let Ie,Ue,xe=me>0?L+T:L+T+1,De=g,Ge=g,Ze=0,Ke=0;const rt=Math.abs(ce),tt=[];let ct;for(;Ze+Ke<=rt;){if(xe+=me,xe=A)return null;Ze+=Ke,Ge=De,Ue=Ie;const mt={projectionCache:j,lineVertexArray:O,labelPlaneMatrix:U,tileAnchorPoint:b,distanceFromAnchor:Ze,getElevation:he,previousVertex:Ge,direction:me,absOffsetX:rt};if(De=Me(xe,mt),f===0)tt.push(Ge),ct=De.sub(Ge);else{let Xt;const hn=De.sub(Ge);Xt=hn.mag()===0?Se(Me(xe+me,mt).sub(De),f,me):Se(hn,f,me),Ue||(Ue=Ge.add(Xt)),Ie=Ne(xe,Xt,De,L,A,Ue,f,mt),tt.push(Ue),ct=Ie.sub(Ue)}Ke=ct.mag()}const dt=ct._mult((rt-Ze)/Ke)._add(Ue||Ge),cn=re+Math.atan2(De.y-Ge.y,De.x-Ge.x);return tt.push(dt),{point:dt,angle:$?cn:0,path:tt}}const Ye=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Je(y,a){for(let f=0;f=1;mn--)hn.push(mt.path[mn]);for(let mn=1;mnKr(vn,A,ce));hn=mn.some(vn=>vn.signedDistanceFromCamera<=0)?[]:mn.map(vn=>vn.point)}let Qt=[];if(hn.length>0){const mn=hn[0].clone(),vn=hn[0].clone();for(let Br=1;Br=ct.x&&vn.x<=dt.x&&mn.y>=ct.y&&vn.y<=dt.y?[hn]:vn.xdt.x||vn.ydt.y?[]:l.al([hn],ct.x,ct.y,dt.x,dt.y)}for(const mn of Qt){cn.reset(mn,.25*tt);let vn=0;vn=cn.length<=.5*tt?1:Math.ceil(cn.paddedLength/Pn)+1;for(let Br=0;Br=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(a,f,m,g){return m>=0&&a=0&&fm.collisionGroupID===f}}return this.collisionGroups[a]}}function _i(y,a,f,m,g){const{horizontalAlign:b,verticalAlign:T}=l.at(y);return new l.P(-(b-.5)*a+m[0]*g,-(T-.5)*f+m[1]*g)}function uo(y,a,f,m,g,b){const{x1:T,x2:L,y1:A,y2:O,anchorPointX:U,anchorPointY:j}=y,$=new l.P(a,f);return m&&$._rotate(g?b:-b),{x1:T+$.x,y1:A+$.y,x2:L+$.x,y2:O+$.y,anchorPointX:U,anchorPointY:j}}class Eo{constructor(a,f,m,g,b){this.transform=a.clone(),this.terrain=f,this.collisionIndex=new en(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Or(g),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(a,f,m,g){const b=m.getBucket(f),T=m.latestFeatureIndex;if(!b||!T||f.id!==b.layerIds[0])return;const L=m.collisionBoxArray,A=b.layers[0].layout,O=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),U=m.tileSize/l.W,j=this.transform.calculatePosMatrix(m.tileID.toUnwrapped()),$=A.get("text-pitch-alignment")==="map",he=A.get("text-rotation-alignment")==="map",ce=nn(m,1,this.transform.zoom),me=sn(j,$,he,this.transform,ce);let re=null;if($){const Ue=Aa(j,$,he,this.transform,ce);re=l.K([],this.transform.labelPlaneMatrix,Ue)}this.retainedQueryData[b.bucketInstanceId]=new dn(b.bucketInstanceId,T,b.sourceLayerIndex,b.index,m.tileID);const Ie={bucket:b,layout:A,posMatrix:j,textLabelPlaneMatrix:me,labelToScreenMatrix:re,scale:O,textPixelRatio:U,holdingForFade:m.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:l.ag(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(g)for(const Ue of b.sortKeyRanges){const{sortKey:xe,symbolInstanceStart:De,symbolInstanceEnd:Ge}=Ue;a.push({sortKey:xe,symbolInstanceStart:De,symbolInstanceEnd:Ge,parameters:Ie})}else a.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Ie})}attemptAnchorPlacement(a,f,m,g,b,T,L,A,O,U,j,$,he,ce,me,re){const Ie=l.ap[a.textAnchor],Ue=[a.textOffset0,a.textOffset1],xe=_i(Ie,m,g,Ue,b),De=this.collisionIndex.placeCollisionBox(uo(f,xe.x,xe.y,T,L,this.transform.angle),j,A,O,U.predicate,re);if((!me||this.collisionIndex.placeCollisionBox(uo(me,xe.x,xe.y,T,L,this.transform.angle),j,A,O,U.predicate,re).box.length!==0)&&De.box.length>0){let Ge;if(this.prevPlacement&&this.prevPlacement.variableOffsets[$.crossTileID]&&this.prevPlacement.placements[$.crossTileID]&&this.prevPlacement.placements[$.crossTileID].text&&(Ge=this.prevPlacement.variableOffsets[$.crossTileID].anchor),$.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[$.crossTileID]={textOffset:Ue,width:m,height:g,anchor:Ie,textBoxScale:b,prevAnchor:Ge},this.markUsedJustification(he,Ie,$,ce),he.allowVerticalPlacement&&(this.markUsedOrientation(he,ce,$),this.placedOrientations[$.crossTileID]=ce),{shift:xe,placedGlyphBoxes:De}}}placeLayerBucketPart(a,f,m){const{bucket:g,layout:b,posMatrix:T,textLabelPlaneMatrix:L,labelToScreenMatrix:A,textPixelRatio:O,holdingForFade:U,collisionBoxArray:j,partiallyEvaluatedTextSize:$,collisionGroup:he}=a.parameters,ce=b.get("text-optional"),me=b.get("icon-optional"),re=l.aq(b,"text-overlap","text-allow-overlap"),Ie=re==="always",Ue=l.aq(b,"icon-overlap","icon-allow-overlap"),xe=Ue==="always",De=b.get("text-rotation-alignment")==="map",Ge=b.get("text-pitch-alignment")==="map",Ze=b.get("icon-text-fit")!=="none",Ke=b.get("symbol-z-order")==="viewport-y",rt=Ie&&(xe||!g.hasIconData()||me),tt=xe&&(Ie||!g.hasTextData()||ce);!g.collisionArrays&&j&&g.deserializeCollisionBoxes(j);const ct=this.retainedQueryData[g.bucketInstanceId].tileID,dt=this.terrain?(mt,Xt)=>this.terrain.getElevation(ct,mt,Xt):null,cn=(mt,Xt)=>{var hn,Pn;if(f[mt.crossTileID])return;if(U)return void(this.placements[mt.crossTileID]=new xr(!1,!1,!1));let Qt=!1,mn=!1,vn=!0,Br=null,Yn={box:null,offscreen:null},Zo={box:null,offscreen:null},yi=null,Lr=null,vi=null,Xo=0,ra=0,ll=0;Xt.textFeatureIndex?Xo=Xt.textFeatureIndex:mt.useRuntimeCollisionCircles&&(Xo=mt.featureIndex),Xt.verticalTextFeatureIndex&&(ra=Xt.verticalTextFeatureIndex);const Bc=Xt.textBox;if(Bc){const fi=pi=>{let Mr=l.ah.horizontal;if(g.allowVerticalPlacement&&!pi&&this.prevPlacement){const ds=this.prevPlacement.placedOrientations[mt.crossTileID];ds&&(this.placedOrientations[mt.crossTileID]=ds,Mr=ds,this.markUsedOrientation(g,Mr,mt))}return Mr},Pr=(pi,Mr)=>{if(g.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&Xt.verticalTextBox){for(const ds of g.writingModes)if(ds===l.ah.vertical?(Yn=Mr(),Zo=Yn):Yn=pi(),Yn&&Yn.box&&Yn.box.length)break}else Yn=pi()},Sr=mt.textAnchorOffsetStartIndex,ps=mt.textAnchorOffsetEndIndex;if(ps===Sr){const pi=(Mr,ds)=>{const di=this.collisionIndex.placeCollisionBox(Mr,re,O,T,he.predicate,dt);return di&&di.box&&di.box.length&&(this.markUsedOrientation(g,ds,mt),this.placedOrientations[mt.crossTileID]=ds),di};Pr(()=>pi(Bc,l.ah.horizontal),()=>{const Mr=Xt.verticalTextBox;return g.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&Mr?pi(Mr,l.ah.vertical):{box:null,offscreen:null}}),fi(Yn&&Yn.box&&Yn.box.length)}else{let pi=l.ap[(Pn=(hn=this.prevPlacement)===null||hn===void 0?void 0:hn.variableOffsets[mt.crossTileID])===null||Pn===void 0?void 0:Pn.anchor];const Mr=(di,Hr,Yp)=>{const pg=di.x2-di.x1,Zl=di.y2-di.y1,Xl=mt.textBoxScale,tf=Ze&&Ue==="never"?Hr:null;let cl={box:[],offscreen:!1},Kp=re==="never"?1:2,dg="never";pi&&Kp++;for(let Jp=0;JpMr(Bc,Xt.iconBox,l.ah.horizontal),()=>{const di=Xt.verticalTextBox;return g.allowVerticalPlacement&&!(Yn&&Yn.box&&Yn.box.length)&&mt.numVerticalGlyphVertices>0&&di?Mr(di,Xt.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),Yn&&(Qt=Yn.box,vn=Yn.offscreen);const ds=fi(Yn&&Yn.box);if(!Qt&&this.prevPlacement){const di=this.prevPlacement.variableOffsets[mt.crossTileID];di&&(this.variableOffsets[mt.crossTileID]=di,this.markUsedJustification(g,di.anchor,mt,ds))}}}if(yi=Yn,Qt=yi&&yi.box&&yi.box.length>0,vn=yi&&yi.offscreen,mt.useRuntimeCollisionCircles){const fi=g.text.placedSymbolArray.get(mt.centerJustifiedTextSymbolIndex),Pr=l.ai(g.textSizeData,$,fi),Sr=b.get("text-padding");Lr=this.collisionIndex.placeCollisionCircles(re,fi,g.lineVertexArray,g.glyphOffsetArray,Pr,T,L,A,m,Ge,he.predicate,mt.collisionCircleDiameter,Sr,dt),Lr.circles.length&&Lr.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Qt=Ie||Lr.circles.length>0&&!Lr.collisionDetected,vn=vn&&Lr.offscreen}if(Xt.iconFeatureIndex&&(ll=Xt.iconFeatureIndex),Xt.iconBox){const fi=Pr=>{const Sr=Ze&&Br?uo(Pr,Br.x,Br.y,De,Ge,this.transform.angle):Pr;return this.collisionIndex.placeCollisionBox(Sr,Ue,O,T,he.predicate,dt)};Zo&&Zo.box&&Zo.box.length&&Xt.verticalIconBox?(vi=fi(Xt.verticalIconBox),mn=vi.box.length>0):(vi=fi(Xt.iconBox),mn=vi.box.length>0),vn=vn&&vi.offscreen}const ul=ce||mt.numHorizontalGlyphVertices===0&&mt.numVerticalGlyphVertices===0,ia=me||mt.numIconVertices===0;if(ul||ia?ia?ul||(mn=mn&&Qt):Qt=mn&&Qt:mn=Qt=mn&&Qt,Qt&&yi&&yi.box&&this.collisionIndex.insertCollisionBox(yi.box,re,b.get("text-ignore-placement"),g.bucketInstanceId,Zo&&Zo.box&&ra?ra:Xo,he.ID),mn&&vi&&this.collisionIndex.insertCollisionBox(vi.box,Ue,b.get("icon-ignore-placement"),g.bucketInstanceId,ll,he.ID),Lr&&(Qt&&this.collisionIndex.insertCollisionCircles(Lr.circles,re,b.get("text-ignore-placement"),g.bucketInstanceId,Xo,he.ID),m)){const fi=g.bucketInstanceId;let Pr=this.collisionCircleArrays[fi];Pr===void 0&&(Pr=this.collisionCircleArrays[fi]=new ci);for(let Sr=0;Sr=0;--Xt){const hn=mt[Xt];cn(g.symbolInstances.get(hn),g.collisionArrays[hn])}}else for(let mt=a.symbolInstanceStart;mt=0&&(a.text.placedSymbolArray.get(L).crossTileID=b>=0&&L!==b?0:m.crossTileID)}markUsedOrientation(a,f,m){const g=f===l.ah.horizontal||f===l.ah.horizontalOnly?f:0,b=f===l.ah.vertical?f:0,T=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const L of T)a.text.placedSymbolArray.get(L).placedOrientation=g;m.verticalPlacedTextSymbolIndex&&(a.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let m=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const g=f?f.symbolFadeChange(a):1,b=f?f.opacities:{},T=f?f.variableOffsets:{},L=f?f.placedOrientations:{};for(const A in this.placements){const O=this.placements[A],U=b[A];U?(this.opacities[A]=new er(U,g,O.text,O.icon),m=m||O.text!==U.text.placed||O.icon!==U.icon.placed):(this.opacities[A]=new er(null,g,O.text,O.icon,O.skipFade),m=m||O.text||O.icon)}for(const A in b){const O=b[A];if(!this.opacities[A]){const U=new er(O,g,!1,!1);U.isHidden()||(this.opacities[A]=U,m=m||O.text.placed||O.icon.placed)}}for(const A in T)this.variableOffsets[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.variableOffsets[A]=T[A]);for(const A in L)this.placedOrientations[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.placedOrientations[A]=L[A]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=a:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:a)}updateLayerOpacities(a,f){const m={};for(const g of f){const b=g.getBucket(a);b&&g.latestFeatureIndex&&a.id===b.layerIds[0]&&this.updateBucketOpacities(b,m,g.collisionBoxArray)}}updateBucketOpacities(a,f,m){a.hasTextData()&&(a.text.opacityVertexArray.clear(),a.text.hasVisibleVertices=!1),a.hasIconData()&&(a.icon.opacityVertexArray.clear(),a.icon.hasVisibleVertices=!1),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexArray.clear(),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexArray.clear();const g=a.layers[0],b=g.layout,T=new er(null,0,!1,!1,!0),L=b.get("text-allow-overlap"),A=b.get("icon-allow-overlap"),O=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),U=b.get("text-rotation-alignment")==="map",j=b.get("text-pitch-alignment")==="map",$=b.get("icon-text-fit")!=="none",he=new er(null,0,L&&(A||!a.hasIconData()||b.get("icon-optional")),A&&(L||!a.hasTextData()||b.get("text-optional")),!0);!a.collisionArrays&&m&&(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData())&&a.deserializeCollisionBoxes(m);const ce=(me,re,Ie)=>{for(let Ue=0;Ue0,Ze=this.placedOrientations[re.crossTileID],Ke=Ze===l.ah.vertical,rt=Ze===l.ah.horizontal||Ze===l.ah.horizontalOnly;if(Ie>0||Ue>0){const tt=Io(De.text);ce(a.text,Ie,Ke?_c:tt),ce(a.text,Ue,rt?_c:tt);const ct=De.text.isHidden();[re.rightJustifiedTextSymbolIndex,re.centerJustifiedTextSymbolIndex,re.leftJustifiedTextSymbolIndex].forEach(mt=>{mt>=0&&(a.text.placedSymbolArray.get(mt).hidden=ct||Ke?1:0)}),re.verticalPlacedTextSymbolIndex>=0&&(a.text.placedSymbolArray.get(re.verticalPlacedTextSymbolIndex).hidden=ct||rt?1:0);const dt=this.variableOffsets[re.crossTileID];dt&&this.markUsedJustification(a,dt.anchor,re,Ze);const cn=this.placedOrientations[re.crossTileID];cn&&(this.markUsedJustification(a,"left",re,cn),this.markUsedOrientation(a,cn,re))}if(Ge){const tt=Io(De.icon),ct=!($&&re.verticalPlacedIconSymbolIndex&&Ke);re.placedIconSymbolIndex>=0&&(ce(a.icon,re.numIconVertices,ct?tt:_c),a.icon.placedSymbolArray.get(re.placedIconSymbolIndex).hidden=De.icon.isHidden()),re.verticalPlacedIconSymbolIndex>=0&&(ce(a.icon,re.numVerticalIconVertices,ct?_c:tt),a.icon.placedSymbolArray.get(re.verticalPlacedIconSymbolIndex).hidden=De.icon.isHidden())}if(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData()){const tt=a.collisionArrays[me];if(tt){let ct=new l.P(0,0);if(tt.textBox||tt.verticalTextBox){let cn=!0;if(O){const mt=this.variableOffsets[xe];mt?(ct=_i(mt.anchor,mt.width,mt.height,mt.textOffset,mt.textBoxScale),U&&ct._rotate(j?this.transform.angle:-this.transform.angle)):cn=!1}tt.textBox&&Mi(a.textCollisionBox.collisionVertexArray,De.text.placed,!cn||Ke,ct.x,ct.y),tt.verticalTextBox&&Mi(a.textCollisionBox.collisionVertexArray,De.text.placed,!cn||rt,ct.x,ct.y)}const dt=!!(!rt&&tt.verticalIconBox);tt.iconBox&&Mi(a.iconCollisionBox.collisionVertexArray,De.icon.placed,dt,$?ct.x:0,$?ct.y:0),tt.verticalIconBox&&Mi(a.iconCollisionBox.collisionVertexArray,De.icon.placed,!dt,$?ct.x:0,$?ct.y:0)}}}if(a.sortFeatures(this.transform.angle),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder),a.hasTextData()&&a.text.opacityVertexBuffer&&a.text.opacityVertexBuffer.updateData(a.text.opacityVertexArray),a.hasIconData()&&a.icon.opacityVertexBuffer&&a.icon.opacityVertexBuffer.updateData(a.icon.opacityVertexArray),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexBuffer&&a.iconCollisionBox.collisionVertexBuffer.updateData(a.iconCollisionBox.collisionVertexArray),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexBuffer&&a.textCollisionBox.collisionVertexBuffer.updateData(a.textCollisionBox.collisionVertexArray),a.text.opacityVertexArray.length!==a.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${a.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${a.text.layoutVertexArray.length}) / 4`);if(a.icon.opacityVertexArray.length!==a.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${a.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${a.icon.layoutVertexArray.length}) / 4`);if(a.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[a.bucketInstanceId];a.placementInvProjMatrix=me.invProjMatrix,a.placementViewportMatrix=me.viewportMatrix,a.collisionCircleArray=me.circles,delete this.collisionCircleArrays[a.bucketInstanceId]}}symbolFadeChange(a){return this.fadeDuration===0?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTimea}setStale(){this.stale=!0}}function Mi(y,a,f,m,g){y.emplaceBack(a?1:0,f?1:0,m||0,g||0),y.emplaceBack(a?1:0,f?1:0,m||0,g||0),y.emplaceBack(a?1:0,f?1:0,m||0,g||0),y.emplaceBack(a?1:0,f?1:0,m||0,g||0)}const Js=Math.pow(2,25),Mm=Math.pow(2,24),Ty=Math.pow(2,17),Xn=Math.pow(2,16),yp=Math.pow(2,9),vp=Math.pow(2,8),qo=Math.pow(2,1);function Io(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const a=y.placed?1:0,f=Math.floor(127*y.opacity);return f*Js+a*Mm+f*Ty+a*Xn+f*yp+a*vp+f*qo+a}const _c=0;class hs{constructor(a){this._sortAcrossTiles=a.layout.get("symbol-z-order")!=="viewport-y"&&!a.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(a,f,m,g,b){const T=this._bucketParts;for(;this._currentTileIndexL.sortKey-A.sortKey));this._currentPartIndex!this._forceFullPlacement&&E.now()-g>2;for(;this._currentPlacementIndex>=0;){const T=f[a[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(T.type==="symbol"&&(!T.minzoom||T.minzoom<=L)&&(!T.maxzoom||T.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new hs(T)),this._inProgressLayer.continuePlacement(m[T.source],this.placement,this._showCollisionBoxes,T,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const wu=512/l.W/2;class gh{constructor(a,f,m){this.tileID=a,this.bucketInstanceId=m,this._symbolsByKey={};const g=new Map;for(let b=0;b({x:Math.floor(A.anchorX*wu),y:Math.floor(A.anchorY*wu)})),crossTileIDs:T.map(A=>A.crossTileID)};if(L.positions.length>128){const A=new l.au(L.positions.length,16,Uint16Array);for(const{x:O,y:U}of L.positions)A.add(O,U);A.finish(),delete L.positions,L.index=A}this._symbolsByKey[b]=L}}getScaledCoordinates(a,f){const{x:m,y:g,z:b}=this.tileID.canonical,{x:T,y:L,z:A}=f.canonical,O=wu/Math.pow(2,A-b),U=(L*l.W+a.anchorY)*O,j=g*l.W*wu;return{x:Math.floor((T*l.W+a.anchorX)*O-m*l.W*wu),y:Math.floor(U-j)}}findMatches(a,f,m){const g=this.tileID.canonical.za)}}class hi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class yc{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(a){const f=Math.round((a-this.lng)/360);if(f!==0)for(const m in this.indexes){const g=this.indexes[m],b={};for(const T in g){const L=g[T];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+f),b[L.tileID.key]=L}this.indexes[m]=b}this.lng=a}addBucket(a,f,m){if(this.indexes[a.overscaledZ]&&this.indexes[a.overscaledZ][a.key]){if(this.indexes[a.overscaledZ][a.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(a.overscaledZ,this.indexes[a.overscaledZ][a.key])}for(let b=0;ba.overscaledZ)for(const L in T){const A=T[L];A.tileID.isChildOf(a)&&A.findMatches(f.symbolInstances,a,g)}else{const L=T[a.scaledTo(Number(b)).key];L&&L.findMatches(f.symbolInstances,a,g)}}for(let b=0;b{f[m]=!0});for(const m in this.layerIndexes)f[m]||delete this.layerIndexes[m]}}const Tr=(y,a)=>l.t(y,a&&a.filter(f=>f.identifier!=="source.canvas")),_h=l.av();class Wo extends l.E{constructor(a,f={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const g=this.sourceCaches[m].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[m].reload()}},this.map=a,this.dispatcher=new En(Nn(),a._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,g)=>this.getGlyphs(m,g)),this.dispatcher.registerMessageHandler("GI",(m,g)=>this.getImages(m,g)),this.imageManager=new qe,this.imageManager.setEventedParent(this),this.glyphManager=new Xe(a._requestManager,f.localIdeographFontFamily),this.lineAtlas=new zt(256,512),this.crossTileSymbolIndex=new nl,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ax()),lt().on(Bi,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const g=this.sourceCaches[m.sourceId];if(!g)return;const b=g.getSource();if(b&&b.vectorLayerIds)for(const T in this._layers){const L=this._layers[T];L.source===b.id&&this._validateLayer(L)}})}loadURL(a,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(a,"Style");this._loadStyleRequest=new AbortController,l.h(g,this._loadStyleRequest).then(b=>{this._loadStyleRequest=null,this._load(b.data,f,m)}).catch(b=>{this._loadStyleRequest=null,b&&this.fire(new l.j(b))})}loadJSON(a,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(a,f,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(_h,{validate:!1})}_load(a,f,m){var g;const b=f.transformStyle?f.transformStyle(m,a):a;if(!f.validate||!Tr(this,l.x(b))){this._loaded=!0,this.stylesheet=b;for(const T in b.sources)this.addSource(T,b.sources[T],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new yt(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const a=l.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",a),this._order=a.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of a){const m=l.az(f);m.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=m}}_loadSprite(a,f=!1,m=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(b,T,L,A){return l._(this,void 0,void 0,function*(){const O=ke(b),U=L>1?"@2x":"",j={},$={};for(const{id:he,url:ce}of O){const me=T.transformRequest(T.normalizeSpriteURL(ce,U,".json"),"SpriteJSON");j[he]=l.h(me,A);const re=T.transformRequest(T.normalizeSpriteURL(ce,U,".png"),"SpriteImage");$[he]=G.getImage(re,A)}return yield Promise.all([...Object.values(j),...Object.values($)]),function(he,ce){return l._(this,void 0,void 0,function*(){const me={};for(const re in he){me[re]={};const Ie=E.getImageCanvasContext((yield ce[re]).data),Ue=(yield he[re]).data;for(const xe in Ue){const{width:De,height:Ge,x:Ze,y:Ke,sdf:rt,pixelRatio:tt,stretchX:ct,stretchY:dt,content:cn}=Ue[xe];me[re][xe]={data:null,pixelRatio:tt,sdf:rt,stretchX:ct,stretchY:dt,content:cn,spriteData:{width:De,height:Ge,x:Ze,y:Ke,context:Ie}}}}return me})}(j,$)})}(a,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(b=>{if(this._spriteRequest=null,b)for(const T in b){this._spritesImagesIds[T]=[];const L=this._spritesImagesIds[T]?this._spritesImagesIds[T].filter(A=>!(A in b)):[];for(const A of L)this.imageManager.removeImage(A),this._changedImages[A]=!0;for(const A in b[T]){const O=T==="default"?A:`${T}:${A}`;this._spritesImagesIds[T].push(O),O in this.imageManager.images?this.imageManager.updateImage(O,b[T][A],!1):this.imageManager.addImage(O,b[T][A]),f&&(this._changedImages[O]=!0)}}}).catch(b=>{this._spriteRequest=null,g=b,this.fire(new l.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(g)})}_unloadSprite(){for(const a of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(a),this._changedImages[a]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(a){const f=this.sourceCaches[a.source];if(!f)return;const m=a.sourceLayer;if(!m)return;const g=f.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${g.id}" as specified by style layer "${a.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this.sourceCaches)if(!this.sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(a){const f=this._serializedAllLayers();if(!a||a.length===0)return Object.values(f);const m=[];for(const g of a)f[g]&&m.push(f[g]);return m}_serializedAllLayers(){let a=this._serializedLayers;if(a)return a;a=this._serializedLayers={};const f=Object.keys(this._layers);for(const m of f){const g=this._layers[m];g.type!=="custom"&&(a[m]=g.serialize())}return a}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const a in this.sourceCaches)if(this.sourceCaches[a].hasTransition())return!0;for(const a in this._layers)if(this._layers[a].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(a){if(!this._loaded)return;const f=this._changed;if(f){const g=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(g.length||b.length)&&this._updateWorkerLayers(g,b);for(const T in this._updatedSources){const L=this._updatedSources[T];if(L==="reload")this._reloadSource(T);else{if(L!=="clear")throw new Error(`Invalid action ${L}`);this._clearSource(T)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const T in this._updatedPaintProps)this._layers[T].updateTransitions(a);this.light.updateTransitions(a),this._resetUpdates()}const m={};for(const g in this.sourceCaches){const b=this.sourceCaches[g];m[g]=b.used,b.used=!1}for(const g of this._order){const b=this._layers[g];b.recalculate(a,this._availableImages),!b.isHidden(a.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const g in m){const b=this.sourceCaches[g];!!m[g]!=!!b.used&&b.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(a),this.z=a.zoom,f&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const a in this.sourceCaches)this.sourceCaches[a].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(a,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(a),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(a,f={}){var m;this._checkLoaded();const g=this.serialize();if(a=f.transformStyle?f.transformStyle(g,a):a,((m=f.validate)===null||m===void 0||m)&&Tr(this,l.x(a)))return!1;(a=l.aA(a)).layers=l.ay(a.layers);const b=l.aB(g,a),T=this._getOperationsToPerform(b);if(T.unimplemented.length>0)throw new Error(`Unimplemented: ${T.unimplemented.join(", ")}.`);if(T.operations.length===0)return!1;for(const L of T.operations)L();return this.stylesheet=a,this._serializedLayers=null,!0}_getOperationsToPerform(a){const f=[],m=[];for(const g of a)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":f.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":f.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":f.push(()=>{});break;default:m.push(g.command)}return{operations:f,unimplemented:m}}addImage(a,f){if(this.getImage(a))return this.fire(new l.j(new Error(`An image named "${a}" already exists.`)));this.imageManager.addImage(a,f),this._afterImageUpdated(a)}updateImage(a,f){this.imageManager.updateImage(a,f)}getImage(a){return this.imageManager.getImage(a)}removeImage(a){if(!this.getImage(a))return this.fire(new l.j(new Error(`An image named "${a}" does not exist.`)));this.imageManager.removeImage(a),this._afterImageUpdated(a)}_afterImageUpdated(a){this._availableImages=this.imageManager.listImages(),this._changedImages[a]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(a,f,m={}){if(this._checkLoaded(),this.sourceCaches[a]!==void 0)throw new Error(`Source "${a}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(l.x.source,`sources.${a}`,f,null,m))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[a]=new ui(a,f,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:a})),g.onAdd(this.map),this._changed=!0}removeSource(a){if(this._checkLoaded(),this.sourceCaches[a]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===a)return this.fire(new l.j(new Error(`Source "${a}" cannot be removed while layer "${m}" is using it.`)));const f=this.sourceCaches[a];delete this.sourceCaches[a],delete this._updatedSources[a],f.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:a})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(a,f){if(this._checkLoaded(),this.sourceCaches[a]===void 0)throw new Error(`There is no source with this ID=${a}`);const m=this.sourceCaches[a].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(f),this._changed=!0}getSource(a){return this.sourceCaches[a]&&this.sourceCaches[a].getSource()}addLayer(a,f,m={}){this._checkLoaded();const g=a.id;if(this.getLayer(g))return void this.fire(new l.j(new Error(`Layer "${g}" already exists on this map.`)));let b;if(a.type==="custom"){if(Tr(this,l.aC(a)))return;b=l.az(a)}else{if("source"in a&&typeof a.source=="object"&&(this.addSource(g,a.source),a=l.aA(a),a=l.e(a,{source:g})),this._validate(l.x.layer,`layers.${g}`,a,{arrayIndex:-1},m))return;b=l.az(a),this._validateLayer(b),b.setEventedParent(this,{layer:{id:g}})}const T=f?this._order.indexOf(f):this._order.length;if(f&&T===-1)this.fire(new l.j(new Error(`Cannot add layer "${g}" before non-existing layer "${f}".`)));else{if(this._order.splice(T,0,g),this._layerOrderChanged=!0,this._layers[g]=b,this._removedLayers[g]&&b.source&&b.type!=="custom"){const L=this._removedLayers[g];delete this._removedLayers[g],L.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(a,f){if(this._checkLoaded(),this._changed=!0,!this._layers[a])return void this.fire(new l.j(new Error(`The layer '${a}' does not exist in the map's style and cannot be moved.`)));if(a===f)return;const m=this._order.indexOf(a);this._order.splice(m,1);const g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new l.j(new Error(`Cannot move layer "${a}" before non-existing layer "${f}".`))):(this._order.splice(g,0,a),this._layerOrderChanged=!0)}removeLayer(a){this._checkLoaded();const f=this._layers[a];if(!f)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${a}".`)));f.setEventedParent(null);const m=this._order.indexOf(a);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[a]=f,delete this._layers[a],this._serializedLayers&&delete this._serializedLayers[a],delete this._updatedLayers[a],delete this._updatedPaintProps[a],f.onRemove&&f.onRemove(this.map)}getLayer(a){return this._layers[a]}getLayersOrder(){return[...this._order]}hasLayer(a){return a in this._layers}setLayerZoomRange(a,f,m){this._checkLoaded();const g=this.getLayer(a);g?g.minzoom===f&&g.maxzoom===m||(f!=null&&(g.minzoom=f),m!=null&&(g.maxzoom=m),this._updateLayer(g)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${a}".`)))}setFilter(a,f,m={}){this._checkLoaded();const g=this.getLayer(a);if(g){if(!l.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(l.x.filter,`layers.${g.id}.filter`,f,null,m)||(g.filter=l.aA(f),this._updateLayer(g)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${a}".`)))}getFilter(a){return l.aA(this.getLayer(a).filter)}setLayoutProperty(a,f,m,g={}){this._checkLoaded();const b=this.getLayer(a);b?l.aD(b.getLayoutProperty(f),m)||(b.setLayoutProperty(f,m,g),this._updateLayer(b)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${a}".`)))}getLayoutProperty(a,f){const m=this.getLayer(a);if(m)return m.getLayoutProperty(f);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${a}".`)))}setPaintProperty(a,f,m,g={}){this._checkLoaded();const b=this.getLayer(a);b?l.aD(b.getPaintProperty(f),m)||(b.setPaintProperty(f,m,g)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[a]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${a}".`)))}getPaintProperty(a,f){return this.getLayer(a).getPaintProperty(f)}setFeatureState(a,f){this._checkLoaded();const m=a.source,g=a.sourceLayer,b=this.sourceCaches[m];if(b===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const T=b.getSource().type;T==="geojson"&&g?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):T!=="vector"||g?(a.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(g,a.id,f)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(a,f){this._checkLoaded();const m=a.source,g=this.sourceCaches[m];if(g===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const b=g.getSource().type,T=b==="vector"?a.sourceLayer:void 0;b!=="vector"||T?f&&typeof a.id!="string"&&typeof a.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(T,a.id,f):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(a){this._checkLoaded();const f=a.source,m=a.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||m?(a.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(m,a.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const a=l.aE(this.sourceCaches,b=>b.serialize()),f=this._serializeByIds(this._order),m=this.map.getTerrain()||void 0,g=this.stylesheet;return l.aF({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:a,layers:f,terrain:m},b=>b!==void 0)}_updateLayer(a){this._updatedLayers[a.id]=!0,a.source&&!this._updatedSources[a.source]&&this.sourceCaches[a.source].getSource().type!=="raster"&&(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(a){const f=T=>this._layers[T].type==="fill-extrusion",m={},g=[];for(let T=this._order.length-1;T>=0;T--){const L=this._order[T];if(f(L)){m[L]=T;for(const A of a){const O=A[L];if(O)for(const U of O)g.push(U)}}}g.sort((T,L)=>L.intersectionZ-T.intersectionZ);const b=[];for(let T=this._order.length-1;T>=0;T--){const L=this._order[T];if(f(L))for(let A=g.length-1;A>=0;A--){const O=g[A].feature;if(m[O.layer.id]{const rt=Ie.featureSortOrder;if(rt){const tt=rt.indexOf(Ze.featureIndex);return rt.indexOf(Ke.featureIndex)-tt}return Ke.featureIndex-Ze.featureIndex});for(const Ze of Ge)De.push(Ze)}}for(const Ie in ce)ce[Ie].forEach(Ue=>{const xe=Ue.feature,De=O[L[Ie].source].getFeatureState(xe.layer["source-layer"],xe.id);xe.source=xe.layer.source,xe.layer["source-layer"]&&(xe.sourceLayer=xe.layer["source-layer"]),xe.state=De});return ce}(this._layers,T,this.sourceCaches,a,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(a,f){f&&f.filter&&this._validate(l.x.filter,"querySourceFeatures.filter",f.filter,null,f);const m=this.sourceCaches[a];return m?function(g,b){const T=g.getRenderableIds().map(O=>g.getTileByID(O)),L=[],A={};for(let O=0;O$.getTileByID(he)).sort((he,ce)=>ce.tileID.overscaledZ-he.tileID.overscaledZ||(he.tileID.isLessThan(ce.tileID)?-1:1))}const j=this.crossTileSymbolIndex.addLayer(U,A[U.source],a.center.lng);T=T||j}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),a.zoom))&&(this.pauseablePlacement=new fs(a,this.map.terrain,this._order,b,f,m,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,A),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),L=!0),T&&this.pauseablePlacement.placement.setStale()),L||T)for(const O of this._order){const U=this._layers[O];U.type==="symbol"&&this.placement.updateLayerOpacities(U,A[U.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const a in this.sourceCaches)this.sourceCaches[a].releaseSymbolFadeTiles()}getImages(a,f){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,f.icons),m})}getGlyphs(a,f){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(f.stacks),g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(a,f={}){this._checkLoaded(),a&&this._validate(l.x.glyphs,"glyphs",a,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=a,this.glyphManager.entries={},this.glyphManager.setURL(a))}addSprite(a,f,m={},g){this._checkLoaded();const b=[{id:a,url:f}],T=[...ke(this.stylesheet.sprite),...b];this._validate(l.x.sprite,"sprite",T,null,m)||(this.stylesheet.sprite=T,this._loadSprite(b,!0,g))}removeSprite(a){this._checkLoaded();const f=ke(this.stylesheet.sprite);if(f.find(m=>m.id===a)){if(this._spritesImagesIds[a])for(const m of this._spritesImagesIds[a])this.imageManager.removeImage(m),this._changedImages[m]=!0;f.splice(f.findIndex(m=>m.id===a),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[a],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${a}" doesn't exists on this map.`)))}getSprite(){return ke(this.stylesheet.sprite)}setSprite(a,f={},m){this._checkLoaded(),a&&this._validate(l.x.sprite,"sprite",a,null,f)||(this.stylesheet.sprite=a,a?this._loadSprite(a,!0,m):(this._unloadSprite(),m&&m(null)))}}var yh=l.X([{name:"a_pos",type:"Int16",components:2}]),Qs="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 vc={prelude:$n(`#ifdef GL_ES + */(function(t,e){(function(n,r){t.exports=r()})(_m,function(){var n={},r={};function i(c,l,d){if(r[c]=d,c==="index"){var v="var sharedModule = {}; ("+r.shared+")(sharedModule); ("+r.worker+")(sharedModule);",S={};return r.shared(S),r.index(n,S),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([v],{type:"text/javascript"}))),n}}i("shared",["exports"],function(c){function l(u,o,h,p){return new(h||(h=Promise))(function(_,x){function w(D){try{P(p.next(D))}catch(O){x(O)}}function I(D){try{P(p.throw(D))}catch(O){x(O)}}function P(D){var O;D.done?_(D.value):(O=D.value,O instanceof h?O:new h(function(B){B(O)})).then(w,I)}P((p=p.apply(u,o||[])).next())})}function d(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}typeof SuppressedError=="function"&&SuppressedError;var v=S;function S(u,o){this.x=u,this.y=o}S.prototype={clone:function(){return new S(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,h=u.y-this.y;return o*o+h*h},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),h=Math.sin(u),p=h*this.x+o*this.y;return this.x=o*this.x-h*this.y,this.y=p,this},_rotateAround:function(u,o){var h=Math.cos(u),p=Math.sin(u),_=o.y+p*(this.x-o.x)+h*(this.y-o.y);return this.x=o.x+h*(this.x-o.x)-p*(this.y-o.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(u){return u instanceof S?u:Array.isArray(u)?new S(u[0],u[1]):u};var E=d(v),C=M;function M(u,o,h,p){this.cx=3*u,this.bx=3*(h-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=h,this.p2y=p}M.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 h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?w=h:I=h,h=.5*(I-w)+w;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var k=d(C);let R,F;function U(){return R==null&&(R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),R}function z(){if(F==null&&(F=!1,U())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const _=4*p;o.fillStyle=`rgb(${_},${_+1},${_+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){F=!0;break}}}return F||!1}function G(u,o,h,p){const _=new k(u,o,h,p);return function(x){return _.solve(x)}}const q=G(.25,.1,.25,1);function X(u,o,h){return Math.min(h,Math.max(o,u))}function de(u,o,h){const p=h-o,_=((u-o)%p+p)%p+o;return _===o?h:_}function ae(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let le=1;function ye(u,o,h){const p={};for(const _ in u)p[_]=o.call(h||this,u[_],_,u);return p}function ke(u,o,h){const p={};for(const _ in u)o.call(h||this,u[_],_,u)&&(p[_]=u[_]);return p}function Q(u){return Array.isArray(u)?u.map(Q):typeof u=="object"&&u?ye(u,Q):u}const oe={};function qe(u){oe[u]||(typeof console<"u"&&console.warn(u),oe[u]=!0)}function Pe(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function it(u){let o=0;for(let h,p,_=0,x=u.length,w=x-1;_"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(u,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const I=w.startsWith("BGR"),P=new Uint8ClampedArray(p*_*4);if(yield x.copyTo(P,function(D,O,B,H,$){const K=4*Math.max(-O,0),ie=(Math.max(0,B)-B)*H*4+K,fe=4*H,we=Math.max(0,O),Oe=Math.max(0,B);return{rect:{x:we,y:Oe,width:Math.min(D.width,O+H)-we,height:Math.min(D.height,B+$)-Oe},layout:[{offset:ie,stride:fe}]}}(u,o,h,p,_)),I)for(let D=0;Dft(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Jn=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=pn(u.url);if(p)return p(u,o);if(ft(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Nn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test(Nr())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(this,void 0,void 0,function*(){const x=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Nr(),signal:_.signal});p.type==="json"&&x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const D=yield w.blob();throw new En(w.status,w.statusText,p.url,D)}let I;I=p.type==="arrayBuffer"||p.type==="image"?w.arrayBuffer():p.type==="json"?w.json():w.text();const P=yield I;if(_.signal.aborted)throw Rn();return{data:P,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(u,o);if(ft(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Nn},o)}var h;return function(p,_){return new Promise((x,w)=>{const I=new XMLHttpRequest;I.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(I.responseType="arraybuffer");for(const P in p.headers)I.setRequestHeader(P,p.headers[P]);p.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=p.credentials==="include",I.onerror=()=>{w(new Error(I.statusText))},I.onload=()=>{if(!_.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let P=I.response;if(p.type==="json")try{P=JSON.parse(I.response)}catch(D){return void w(D)}x({data:P,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const P=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});w(new En(I.status,I.statusText,p.url,P))}},_.signal.addEventListener("abort",()=>{I.abort(),w(Rn())}),I.send(p.body)})}(u,o)};function On(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function Qn(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function ne(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Ce{constructor(o,h={}){ae(this,h),this.type=o}}class ot extends Ce{constructor(o,h={}){super("error",ae({error:o},h))}}class kt{on(o,h){return this._listeners=this._listeners||{},Qn(o,h,this._listeners),this}off(o,h){return ne(o,h,this._listeners),ne(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Qn(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Ce(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const I of _)I.call(this,o);const x=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const I of x)ne(p,I,this._oneTimeListeners),I.call(this,o);const w=this._eventedParent;w&&(ae(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof ot&&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,h){return this._eventedParent=o,this._eventedParentData=h,this}}var Re={$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"},sky:{type:"sky"},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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 on=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function qr(u,o){const h={};for(const p in u)p!=="ref"&&(h[p]=u[p]);return on.forEach(p=>{p in o&&(h[p]=o[p])}),h}function _n(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let h=0;h`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Te=[ci,pt,un,an,Wr,Jr,cs,J(sn),pe,W,Z];function ee(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!ee(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 h of Te)if(!ee(h,o))return null}}return`Expected ${ue(u)} but found ${ue(o)} instead.`}function Me(u,o){return o.some(h=>h.kind===u.kind)}function Se(u,o){return o.some(h=>h==="null"?u===null:h==="array"?Array.isArray(u):h==="object"?u&&!Array.isArray(u)&&typeof u=="object":h===typeof u)}function Ne(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const He=.96422,Ye=.82521,Je=4/29,Rt=6/29,Ft=3*Rt*Rt,en=Rt*Rt*Rt,nn=Math.PI/180,Tn=180/Math.PI;function er(u){return(u%=360)<0&&(u+=360),u}function xr([u,o,h,p]){let _,x;const w=dn((.2225045*(u=hi(u))+.7168786*(o=hi(o))+.0606169*(h=hi(h)))/1);u===o&&o===h?_=x=w:(_=dn((.4360747*u+.3850649*o+.1430804*h)/He),x=dn((.0139322*u+.0971045*o+.7141733*h)/Ye));const I=116*w-16;return[I<0?0:I,500*(_-w),200*(w-x),p]}function hi(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function dn(u){return u>en?Math.pow(u,1/3):u/Ft+Je}function Or([u,o,h,p]){let _=(u+16)/116,x=isNaN(o)?_:_+o/500,w=isNaN(h)?_:_-h/200;return _=1*uo(_),x=He*uo(x),w=Ye*uo(w),[_i(3.1338561*x-1.6168667*_-.4906146*w),_i(-.9787684*x+1.9161415*_+.033454*w),_i(.0719453*x-.2289914*_+1.4052427*w),p]}function _i(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function uo(u){return u>Rt?u*u*u:Ft*(u-Je)}function Eo(u){return parseInt(u.padEnd(2,u),16)/255}function Mi(u,o){return Js(o?u/100:u,0,1)}function Js(u,o,h){return Math.min(Math.max(o,u),h)}function Mm(u){return!u.some(Number.isNaN)}const Ty={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Xn{constructor(o,h,p,_=1,x=!0){this.r=o,this.g=h,this.b=p,this.a=_,x||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[o,h,p,_]))}static parse(o){if(o instanceof Xn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=Ty[p];if(_){const[w,I,P]=_;return[w/255,I/255,P/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 I=1;return[Eo(p.slice(I,I+=w)),Eo(p.slice(I,I+=w)),Eo(p.slice(I,I+=w)),Eo(p.slice(I,I+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[I,P,D,O,B,H,$,K,ie,fe,we,Oe]=w,Ee=[O||" ",$||" ",fe].join("");if(Ee===" "||Ee===" /"||Ee===",,"||Ee===",,,"){const Ae=[D,H,ie].join(""),Qe=Ae==="%%%"?100:Ae===""?255:0;if(Qe){const et=[Js(+P/Qe,0,1),Js(+B/Qe,0,1),Js(+K/Qe,0,1),we?Mi(+we,Oe):1];if(Mm(et))return et}}return}}const x=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,I,P,D,O,B,H,$,K]=x,ie=[P||" ",O||" ",H].join("");if(ie===" "||ie===" /"||ie===",,"||ie===",,,"){const fe=[+I,Js(+D,0,100),Js(+B,0,100),$?Mi(+$,K):1];if(Mm(fe))return function([we,Oe,Ee,Ae]){function Qe(et){const St=(et+we/30)%12,Dt=Oe*Math.min(Ee,1-Ee);return Ee-Dt*Math.max(-1,Math.min(St-3,9-St,1))}return we=er(we),Oe/=100,Ee/=100,[Qe(0),Qe(8),Qe(4),Ae]}(fe)}}}(o);return h?new Xn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:_}=this,x=_||1/0;return this.overwriteGetter("rgb",[o/x,h/x,p/x,_])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,_,x]=xr(o),w=Math.sqrt(p*p+_*_);return[Math.round(1e4*w)?er(Math.atan2(_,p)*Tn):NaN,w,h,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",xr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,_]=this.rgb;return`rgba(${[o,h,p].map(x=>Math.round(255*x)).join(",")},${_})`}}Xn.black=new Xn(0,0,0,1),Xn.white=new Xn(1,1,1,1),Xn.transparent=new Xn(0,0,0,0),Xn.red=new Xn(1,0,0,1);class yp{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class vp{constructor(o,h,p,_,x){this.text=o,this.image=h,this.scale=p,this.fontStack=_,this.textColor=x}}class qo{constructor(o){this.sections=o}static fromString(o){return new qo([new vp(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 qo?o:qo.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class Io{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Io)return o;if(typeof o=="number")return new Io([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="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 Io(o)}}toString(){return JSON.stringify(this.values)}}const _c=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class hs{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof hs)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&u<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,h,p]:[u,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function gh(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof Xn||u instanceof yp||u instanceof qo||u instanceof Io||u instanceof hs||u instanceof fs)return!0;if(Array.isArray(u)){for(const o of u)if(!gh(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!gh(u[o]))return!1;return!0}return!1}function fi(u){if(u===null)return ci;if(typeof u=="string")return un;if(typeof u=="boolean")return an;if(typeof u=="number")return pt;if(u instanceof Xn)return Wr;if(u instanceof yp)return Aa;if(u instanceof qo)return Jr;if(u instanceof Io)return pe;if(u instanceof hs)return Z;if(u instanceof fs)return W;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const _=fi(p);if(h){if(h===_)continue;h=sn;break}h=_}return J(h||sn,o)}return cs}function yc(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof Xn||u instanceof qo||u instanceof Io||u instanceof hs||u instanceof fs?u.toString():JSON.stringify(u)}class nl{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!gh(o[1]))return h.error("invalid value");const p=o[1];let _=fi(p);const x=h.expectedType;return _.kind!=="array"||_.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(_=x),new nl(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Tr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const _h={string:un,number:pt,boolean:an,object:cs};class Wo{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,_=1;const x=o[0];if(x==="array"){let I,P;if(o.length>2){const D=o[1];if(typeof D!="string"||!(D in _h)||D==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);I=_h[D],_++}else I=sn;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);P=o[2],_++}p=J(I,P)}else{if(!_h[x])throw new Error(`Types doesn't contain name = ${x}`);p=_h[x]}const w=[];for(;_o.outputDefined())}}const yh={"to-boolean":an,"to-color":Wr,"to-number":pt,"to-string":un};class Qs{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!yh[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 h.error("Expected one argument.");const _=yh[p],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:Su(h[0],h[1],h[2],h[3]),!p))return new Xn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new Tr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const _=Io.parse(h);if(_)return _}throw new Tr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const _=hs.parse(h);if(_)return _}throw new Tr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new Tr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return qo.fromString(yc(this.args[0].evaluate(o)));case"resolvedImage":return fs.fromString(yc(this.args[0].evaluate(o)));default:return yc(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const vc=["Unknown","Point","LineString","Polygon"];class $n{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"?vc[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 h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=Xn.parse(o)),h}}class vh{constructor(o,h,p=[],_,x=new Fl,w=[]){this.registry=o,this.path=p,this.key=p.map(I=>`[${I}]`).join(""),this.scope=x,this.errors=w,this.expectedType=_,this._isConstant=h}parse(o,h,p,_,x={}){return h?this.concat(h,p,_)._parse(o,x):this._parse(o,x)}_parse(o,h){function p(_,x,w){return w==="assert"?new Wo(x,[_]):w==="coerce"?new Qs(x,[_]):_}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 _=o[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[_];if(x){let w=x.parse(o,this);if(!w)return null;if(this.expectedType){const I=this.expectedType,P=w.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||P.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(I.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(I,P))return null}else w=p(w,I,h.typeAnnotation||"coerce");else w=p(w,I,h.typeAnnotation||"coerce");else w=p(w,I,h.typeAnnotation||"coerce");else w=p(w,I,h.typeAnnotation||"assert")}if(!(w instanceof nl)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const I=new $n;try{w=new nl(w.type,w.evaluate(I))}catch(P){return this.error(P.message),null}}return w}return this.error(`Unknown expression "${_}". 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,h,p){const _=typeof o=="number"?this.path.concat(o):this.path,x=p?this.scope.concat(p):this.scope;return new vh(this.registry,this._isConstant,_,h||null,x,this.errors)}error(o,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new lo(p,o))}checkSubtype(o,h){const p=ee(o,h);return p&&this.error(p),p}}class Eu{constructor(o,h,p){this.type=Aa,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,an);if(!_)return null;const x=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,an);if(!x)return null;let w=null;return p.locale&&(w=h.parse(p.locale,1,un),!w)?null:new Eu(_,x,w)}evaluate(o){return new yp(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 rl=8192;function bh(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 bc(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function Ly(u,o){const h=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,_=Math.pow(2,o.z);return[Math.round(h*_*rl),Math.round(p*_*rl)]}function Am(u,o,h){const p=u[0]-o[0],_=u[1]-o[1],x=u[0]-h[0],w=u[1]-h[1];return p*w-x*_==0&&p*x<=0&&_*w<=0}function xh(u,o){let h=!1;for(let w=0,I=o.length;w(p=u)[1]!=(x=P[D+1])[1]>p[1]&&p[0]<(x[0]-_[0])*(p[1]-_[1])/(x[1]-_[1])+_[0]&&(h=!h)}}var p,_,x;return h}function Py(u,o){for(let h=0;h0&&I<0||w<0&&I>0}function My(u,o,h){for(const D of h)for(let O=0;Oh[2]){const _=.5*p;let x=u[0]-h[0]>_?-p:h[0]-u[0]>_?p:0;x===0&&(x=u[0]-h[2]>_?-p:h[2]-u[0]>_?p:0),u[0]+=x}bh(o,u)}function Sh(u,o,h,p){const _=Math.pow(2,p.z)*rl,x=[p.x*rl,p.y*rl],w=[];for(const I of u)for(const P of I){const D=[P.x+x[0],P.y+x[1]];Om(D,o,h,_),w.push(D)}return w}function zm(u,o,h,p){const _=Math.pow(2,p.z)*rl,x=[p.x*rl,p.y*rl],w=[];for(const P of u){const D=[];for(const O of P){const B=[O.x+x[0],O.y+x[1]];bh(o,B),D.push(B)}w.push(D)}if(o[2]-o[0]<=_/2){(I=o)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const P of w)for(const D of P)Om(D,o,h,_)}var I;return w}class Bl{constructor(o,h){this.type=an,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(gh(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const _=[];for(const x of p.features){const{type:w,coordinates:I}=x.geometry;w==="Polygon"&&_.push(I),w==="MultiPolygon"&&_.push(...I)}if(_.length)return new Bl(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Bl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Bl(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=h.canonicalID();if(p.type==="Polygon"){const I=wh(p.coordinates,x,w),P=Sh(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!xh(D,I))return!1}if(p.type==="MultiPolygon"){const I=Nm(p.coordinates,x,w),P=Sh(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!Py(D,I))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=h.canonicalID();if(p.type==="Polygon"){const I=wh(p.coordinates,x,w),P=zm(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!Dm(D,I))return!1}if(p.type==="MultiPolygon"){const I=Nm(p.coordinates,x,w),P=zm(h.geometry(),_,x,w);if(!bc(_,x))return!1;for(const D of P)if(!Rm(D,I))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Eh{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new Eh(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Ho{constructor(o,h,p,_){this.name=o,this.type=h,this._evaluate=p,this.args=_}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],_=Ho.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(_)?_[0]:_.type,w=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,I=w.filter(([D])=>!Array.isArray(D)||D.length===o.length-1);let P=null;for(const[D,O]of I){P=new vh(h.registry,xc,h.path,null,h.scope);const B=[];let H=!1;for(let $=1;${return H=B,Array.isArray(H)?`(${H.map(ue).join(", ")})`:`(${ue(H.type)}...)`;var H}).join(" | "),O=[];for(let B=1;B{h=o?h&&xc(p):h&&p instanceof nl}),!!h&&Ih(u)&&Sc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ih(u){if(u instanceof Ho&&(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 Bl)return!1;let o=!0;return u.eachChild(h=>{o&&!Ih(h)&&(o=!1)}),o}function wc(u){if(u instanceof Ho&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!wc(h)&&(o=!1)}),o}function Sc(u,o){if(u instanceof Ho&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!Sc(p,o)&&(h=!1)}),h}function Ec(u,o){const h=u.length-1;let p,_,x=0,w=h,I=0;for(;x<=w;)if(I=Math.floor((x+w)/2),p=u[I],_=u[I+1],p<=o){if(I===h||o<_)return I;x=I+1}else{if(!(p>o))throw new Tr("Input is not a number.");w=I-1}return 0}class Ic{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,x]of p)this.labels.push(_),this.outputs.push(x)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,pt);if(!p)return null;const _=[];let x=null;h.expectedType&&h.expectedType.kind!=="value"&&(x=h.expectedType);for(let w=1;w=I)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',D);const B=h.parse(P,O,x);if(!B)return null;x=x||B.type,_.push([I,B])}return new Ic(x,p,_)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const x=h.length;return _>=h[x-1]?p[x-1].evaluate(o):p[Ec(h,_)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Ay(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var ky=Fm;function Fm(u,o,h,p){this.cx=3*u,this.bx=3*(h-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=h,this.p2y=p}Fm.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 h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?w=h:I=h,h=.5*(I-w)+w;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var Dy=Ay(ky);function Vl(u,o,h){return u+h*(o-u)}function Ch(u,o,h){return u.map((p,_)=>Vl(p,o[_],h))}const co={number:Vl,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[_,x,w,I]=Ch(u.rgb,o.rgb,h);return new Xn(_,x,w,I,!1)}case"hcl":{const[_,x,w,I]=u.hcl,[P,D,O,B]=o.hcl;let H,$;if(isNaN(_)||isNaN(P))isNaN(_)?isNaN(P)?H=NaN:(H=P,w!==1&&w!==0||($=D)):(H=_,O!==1&&O!==0||($=x));else{let Oe=P-_;P>_&&Oe>180?Oe-=360:P<_&&_-P>180&&(Oe+=360),H=_+h*Oe}const[K,ie,fe,we]=function([Oe,Ee,Ae,Qe]){return Oe=isNaN(Oe)?0:Oe*nn,Or([Ae,Math.cos(Oe)*Ee,Math.sin(Oe)*Ee,Qe])}([H,$??Vl(x,D,h),Vl(w,O,h),Vl(I,B,h)]);return new Xn(K,ie,fe,we,!1)}case"lab":{const[_,x,w,I]=Or(Ch(u.lab,o.lab,h));return new Xn(_,x,w,I,!1)}}},array:Ch,padding:function(u,o,h){return new Io(Ch(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,_=o.values;if(p.length!==_.length)throw new Tr(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const x=[];for(let w=0;wtypeof O!="number"||O<0||O>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:D}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(x=h.parse(x,2,pt),!x)return null;const I=[];let P=null;p==="interpolate-hcl"||p==="interpolate-lab"?P=Wr:h.expectedType&&h.expectedType.kind!=="value"&&(P=h.expectedType);for(let D=0;D=O)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',H);const K=h.parse(B,$,P);if(!K)return null;P=P||K.type,I.push([O,K])}return Ne(P,pt)||Ne(P,Wr)||Ne(P,pe)||Ne(P,Z)||Ne(P,J(pt))?new Zi(P,p,_,x,I):h.error(`Type ${ue(P)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const x=h.length;if(_>=h[x-1])return p[x-1].evaluate(o);const w=Ec(h,_),I=Zi.interpolationFactor(this.interpolation,_,h[w],h[w+1]),P=p[w].evaluate(o),D=p[w+1].evaluate(o);switch(this.operator){case"interpolate":return co[this.type.kind](P,D,I);case"interpolate-hcl":return co.color(P,D,I,"hcl");case"interpolate-lab":return co.color(P,D,I,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Gn(u,o,h,p){const _=p-h,x=u-h;return _===0?0:o===1?x/_:(Math.pow(o,x)-1)/(Math.pow(o,_)-1)}class Th{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const _=h.expectedType;_&&_.kind!=="value"&&(p=_);const x=[];for(const I of o.slice(1)){const P=h.parse(I,1+x.length,p,void 0,{typeAnnotation:"omit"});if(!P)return null;p=p||P.type,x.push(P)}if(!p)throw new Error("No output type");const w=_&&x.some(I=>ee(_,I.type));return new Th(w?sn:p,x)}evaluate(o){let h,p=null,_=0;for(const x of this.args)if(_++,p=x.evaluate(o),p&&p instanceof fs&&!p.available&&(h||(h=p.name),p=null,_===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class Lh{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let x=1;x=p.length)throw new Tr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new Tr(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class xp{constructor(o,h){this.type=an,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,sn),_=h.parse(o[2],2,sn);return p&&_?Me(p.type,[an,un,pt,ci,sn])?new xp(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ue(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!Se(h,["boolean","string","number","null"]))throw new Tr(`Expected first argument to be of type boolean, string, number or null, but found ${ue(fi(h))} instead.`);if(!Se(p,["string","array"]))throw new Tr(`Expected second argument to be of type array or string, but found ${ue(fi(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Ph{constructor(o,h,p){this.type=pt,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,sn),_=h.parse(o[2],2,sn);if(!p||!_)return null;if(!Me(p.type,[an,un,pt,ci,sn]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${ue(p.type)} instead`);if(o.length===4){const x=h.parse(o[3],3,pt);return x?new Ph(p,_,x):null}return new Ph(p,_)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!Se(h,["boolean","string","number","null"]))throw new Tr(`Expected first argument to be of type boolean, string, number or null, but found ${ue(fi(h))} instead.`);if(!Se(p,["string","array"]))throw new Tr(`Expected second argument to be of type array or string, but found ${ue(fi(p))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(o);return p.indexOf(h,_)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class wp{constructor(o,h,p,_,x,w){this.inputType=o,this.type=h,this.input=p,this.cases=_,this.outputs=x,this.otherwise=w}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const x={},w=[];for(let D=2;DNumber.MAX_SAFE_INTEGER)return H.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return H.error("Numeric branch labels must be integer values.");if(p){if(H.checkSubtype(p,fi(K)))return null}else p=fi(K);if(x[String(K)]!==void 0)return H.error("Branch labels must be unique.");x[String(K)]=w.length}const $=h.parse(B,D,_);if(!$)return null;_=_||$.type,w.push($)}const I=h.parse(o[1],1,sn);if(!I)return null;const P=h.parse(o[o.length-1],o.length-1,_);return P?I.type.kind!=="value"&&h.concat(1).checkSubtype(p,I.type)?null:new wp(p,_,I,x,w,P):null}evaluate(o){const h=this.input.evaluate(o);return(fi(h)===this.inputType&&this.outputs[this.cases[h]]||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 Sp{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const _=[];for(let w=1;wh.outputDefined())&&this.otherwise.outputDefined()}}class Mh{constructor(o,h,p,_){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=_}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,sn),_=h.parse(o[2],2,pt);if(!p||!_)return null;if(!Me(p.type,[J(sn),un,sn]))return h.error(`Expected first argument to be of type array or string, but found ${ue(p.type)} instead`);if(o.length===4){const x=h.parse(o[3],3,pt);return x?new Mh(p.type,p,_,x):null}return new Mh(p.type,p,_)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!Se(h,["string","array"]))throw new Tr(`Expected first argument to be of type array or string, but found ${ue(fi(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(o);return h.slice(p,_)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Bm(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 Vm(u,o,h,p){return p.compare(o,h)===0}function Iu(u,o,h){const p=u!=="=="&&u!=="!=";return class WE{constructor(x,w,I){this.type=an,this.lhs=x,this.rhs=w,this.collator=I,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const I=x[0];let P=w.parse(x[1],1,sn);if(!P)return null;if(!Bm(I,P.type))return w.concat(1).error(`"${I}" comparisons are not supported for type '${ue(P.type)}'.`);let D=w.parse(x[2],2,sn);if(!D)return null;if(!Bm(I,D.type))return w.concat(2).error(`"${I}" comparisons are not supported for type '${ue(D.type)}'.`);if(P.type.kind!==D.type.kind&&P.type.kind!=="value"&&D.type.kind!=="value")return w.error(`Cannot compare types '${ue(P.type)}' and '${ue(D.type)}'.`);p&&(P.type.kind==="value"&&D.type.kind!=="value"?P=new Wo(D.type,[P]):P.type.kind!=="value"&&D.type.kind==="value"&&(D=new Wo(P.type,[D])));let O=null;if(x.length===4){if(P.type.kind!=="string"&&D.type.kind!=="string"&&P.type.kind!=="value"&&D.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(O=w.parse(x[3],3,Aa),!O)return null}return new WE(P,D,O)}evaluate(x){const w=this.lhs.evaluate(x),I=this.rhs.evaluate(x);if(p&&this.hasUntypedArgument){const P=fi(w),D=fi(I);if(P.kind!==D.kind||P.kind!=="string"&&P.kind!=="number")throw new Tr(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${P.kind}, ${D.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const P=fi(w),D=fi(I);if(P.kind!=="string"||D.kind!=="string")return o(x,w,I)}return this.collator?h(x,w,I,this.collator.evaluate(x)):o(x,w,I)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const Ry=Iu("==",function(u,o,h){return o===h},Vm),Ny=Iu("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!Vm(0,o,h,p)}),Oy=Iu("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),Fy=Iu("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),By=Iu(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class Ep{constructor(o,h,p,_,x){this.type=un,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=x}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,pt);if(!p)return null;const _=o[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let x=null;if(_.locale&&(x=h.parse(_.locale,1,un),!x))return null;let w=null;if(_.currency&&(w=h.parse(_.currency,1,un),!w))return null;let I=null;if(_["min-fraction-digits"]&&(I=h.parse(_["min-fraction-digits"],1,pt),!I))return null;let P=null;return _["max-fraction-digits"]&&(P=h.parse(_["max-fraction-digits"],1,pt),!P)?null:new Ep(p,x,w,I,P)}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 Ah{constructor(o){this.type=Jr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const _=[];let x=!1;for(let w=1;w<=o.length-1;++w){const I=o[w];if(x&&typeof I=="object"&&!Array.isArray(I)){x=!1;let P=null;if(I["font-scale"]&&(P=h.parse(I["font-scale"],1,pt),!P))return null;let D=null;if(I["text-font"]&&(D=h.parse(I["text-font"],1,J(un)),!D))return null;let O=null;if(I["text-color"]&&(O=h.parse(I["text-color"],1,Wr),!O))return null;const B=_[_.length-1];B.scale=P,B.font=D,B.textColor=O}else{const P=h.parse(o[w],1,sn);if(!P)return null;const D=P.type.kind;if(D!=="string"&&D!=="value"&&D!=="null"&&D!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,_.push({content:P,scale:null,font:null,textColor:null})}}return new Ah(_)}evaluate(o){return new qo(this.sections.map(h=>{const p=h.content.evaluate(o);return fi(p)===W?new vp("",p,null,null,null):new vp(yc(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class Ip{constructor(o){this.type=W,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,un);return p?new Ip(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=fs.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class Cp{constructor(o){this.type=pt,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${ue(p.type)} instead.`):new Cp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new Tr(`Expected value to be of type string or array, but found ${ue(fi(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const Cu={"==":Ry,"!=":Ny,">":zy,"<":Oy,">=":By,"<=":Fy,array:Wo,at:bp,boolean:Wo,case:Sp,coalesce:Th,collator:Eu,format:Ah,image:Ip,in:xp,"index-of":Ph,interpolate:Zi,"interpolate-hcl":Zi,"interpolate-lab":Zi,length:Cp,let:Lh,literal:nl,match:wp,number:Wo,"number-format":Ep,object:Wo,slice:Mh,step:Ic,string:Wo,"to-boolean":Qs,"to-color":Qs,"to-number":Qs,"to-string":Qs,var:Eh,within:Bl};function Um(u,[o,h,p,_]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const x=_?_.evaluate(u):1,w=Su(o,h,p,x);if(w)throw new Tr(w);return new Xn(o/255,h/255,p/255,x,!1)}function jm(u,o){return u in o}function Tp(u,o){const h=o[u];return h===void 0?null:h}function Ul(u){return{type:u}}function Gm(u){return{result:"success",value:u}}function Tu(u){return{result:"error",value:u}}function Lu(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function qm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function Lp(u){return!!u.expression&&u.expression.interpolated}function zn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function kh(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Vy(u){return u}function Wm(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",_=p||!(p||u.property!==void 0),x=u.type||(Lp(o)?"exponential":"interval");if(h||o.type==="padding"){const O=h?Xn.parse:Io.parse;(u=us({},u)).stops&&(u.stops=u.stops.map(B=>[B[0],O(B[1])])),u.default=O(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 I,P,D;if(x==="exponential")I=Ln;else if(x==="interval")I=Uy;else if(x==="categorical"){I=Qr,P=Object.create(null);for(const O of u.stops)P[O[0]]=O[1];D=typeof u.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);I=Pp}if(p){const O={},B=[];for(let K=0;KK[0]),evaluate:({zoom:K},ie)=>Ln({stops:H,base:u.base},o,K).evaluate(K,ie)}}if(_){const O=x==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:O,interpolationFactor:Zi.interpolationFactor.bind(void 0,O),zoomStops:u.stops.map(B=>B[0]),evaluate:({zoom:B})=>I(u,o,B,P,D)}}return{kind:"source",evaluate(O,B){const H=B&&B.properties?B.properties[u.property]:void 0;return H===void 0?Cc(u.default,o.default):I(u,o,H,P,D)}}}function Cc(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function Qr(u,o,h,p,_){return Cc(typeof h===_?p[h]:void 0,u.default,o.default)}function Uy(u,o,h){if(zn(h)!=="number")return Cc(u.default,o.default);const p=u.stops.length;if(p===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[p-1][0])return u.stops[p-1][1];const _=Ec(u.stops.map(x=>x[0]),h);return u.stops[_][1]}function Ln(u,o,h){const p=u.base!==void 0?u.base:1;if(zn(h)!=="number")return Cc(u.default,o.default);const _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];const x=Ec(u.stops.map(O=>O[0]),h),w=function(O,B,H,$){const K=$-H,ie=O-H;return K===0?0:B===1?ie/K:(Math.pow(B,ie)-1)/(Math.pow(B,K)-1)}(h,p,u.stops[x][0],u.stops[x+1][0]),I=u.stops[x][1],P=u.stops[x+1][1],D=co[o.type]||Vy;return typeof I.evaluate=="function"?{evaluate(...O){const B=I.evaluate.apply(void 0,O),H=P.evaluate.apply(void 0,O);if(B!==void 0&&H!==void 0)return D(B,H,w,u.colorSpace)}}:D(I,P,w,u.colorSpace)}function Pp(u,o,h){switch(o.type){case"color":h=Xn.parse(h);break;case"formatted":h=qo.fromString(h.toString());break;case"resolvedImage":h=fs.fromString(h.toString());break;case"padding":h=Io.parse(h);break;default:zn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return Cc(h,u.default,o.default)}Ho.register(Cu,{error:[{kind:"error"},[un],(u,[o])=>{throw new Tr(o.evaluate(u))}],typeof:[un,[sn],(u,[o])=>ue(fi(o.evaluate(u)))],"to-rgba":[J(pt,4),[Wr],(u,[o])=>{const[h,p,_,x]=o.evaluate(u).rgb;return[255*h,255*p,255*_,x]}],rgb:[Wr,[pt,pt,pt],Um],rgba:[Wr,[pt,pt,pt,pt],Um],has:{type:an,overloads:[[[un],(u,[o])=>jm(o.evaluate(u),u.properties())],[[un,cs],(u,[o,h])=>jm(o.evaluate(u),h.evaluate(u))]]},get:{type:sn,overloads:[[[un],(u,[o])=>Tp(o.evaluate(u),u.properties())],[[un,cs],(u,[o,h])=>Tp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[sn,[un],(u,[o])=>Tp(o.evaluate(u),u.featureState||{})],properties:[cs,[],u=>u.properties()],"geometry-type":[un,[],u=>u.geometryType()],id:[sn,[],u=>u.id()],zoom:[pt,[],u=>u.globals.zoom],"heatmap-density":[pt,[],u=>u.globals.heatmapDensity||0],"line-progress":[pt,[],u=>u.globals.lineProgress||0],accumulated:[sn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[pt,Ul(pt),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[pt,Ul(pt),(u,o)=>{let h=1;for(const p of o)h*=p.evaluate(u);return h}],"-":{type:pt,overloads:[[[pt,pt],(u,[o,h])=>o.evaluate(u)-h.evaluate(u)],[[pt],(u,[o])=>-o.evaluate(u)]]},"/":[pt,[pt,pt],(u,[o,h])=>o.evaluate(u)/h.evaluate(u)],"%":[pt,[pt,pt],(u,[o,h])=>o.evaluate(u)%h.evaluate(u)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(u,[o,h])=>Math.pow(o.evaluate(u),h.evaluate(u))],sqrt:[pt,[pt],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[pt,[pt],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[pt,[pt],(u,[o])=>Math.log(o.evaluate(u))],log2:[pt,[pt],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[pt,[pt],(u,[o])=>Math.sin(o.evaluate(u))],cos:[pt,[pt],(u,[o])=>Math.cos(o.evaluate(u))],tan:[pt,[pt],(u,[o])=>Math.tan(o.evaluate(u))],asin:[pt,[pt],(u,[o])=>Math.asin(o.evaluate(u))],acos:[pt,[pt],(u,[o])=>Math.acos(o.evaluate(u))],atan:[pt,[pt],(u,[o])=>Math.atan(o.evaluate(u))],min:[pt,Ul(pt),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[pt,Ul(pt),(u,o)=>Math.max(...o.map(h=>h.evaluate(u)))],abs:[pt,[pt],(u,[o])=>Math.abs(o.evaluate(u))],round:[pt,[pt],(u,[o])=>{const h=o.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[pt,[pt],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[pt,[pt],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[an,[un,sn],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[an,[sn],(u,[o])=>u.id()===o.value],"filter-type-==":[an,[un],(u,[o])=>u.geometryType()===o.value],"filter-<":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[an,[un,sn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[an,[sn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[an,[sn],(u,[o])=>o.value in u.properties()],"filter-has-id":[an,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[an,[J(un)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[an,[J(sn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[an,[un,J(sn)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[an,[un,J(sn)],(u,[o,h])=>function(p,_,x,w){for(;x<=w;){const I=x+w>>1;if(_[I]===p)return!0;_[I]>p?w=I-1:x=I+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:an,overloads:[[[an,an],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Ul(an),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:an,overloads:[[[an,an],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Ul(an),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[an,[an],(u,[o])=>!o.evaluate(u)],"is-supported-script":[an,[un],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[un,[un],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[un,[un],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[un,Ul(sn),(u,o)=>o.map(h=>yc(h.evaluate(u))).join("")],"resolved-locale":[un,[Aa],(u,[o])=>o.evaluate(u).resolvedLocale()]});class pr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new $n,this._defaultValue=h?(p=h).type==="color"&&kh(p.default)?new Xn(0,0,0,0):p.type==="color"?Xn.parse(p.default)||null:p.type==="padding"?Io.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?hs.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,_,x,w){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,_,x,w){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const I=this.expression.evaluate(this._evaluator);if(I==null||typeof I=="number"&&I!=I)return this._defaultValue;if(this._enumValues&&!(I in this._enumValues))throw new Tr(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(I)} instead.`);return I}catch(I){return this._warningHistory[I.message]||(this._warningHistory[I.message]=!0,typeof console<"u"&&console.warn(I.message)),this._defaultValue}}}function sr(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in Cu}function jl(u,o){const h=new vh(Cu,xc,[],o?function(_){const x={color:Wr,string:un,number:pt,enum:un,boolean:an,formatted:Jr,padding:pe,resolvedImage:W,variableAnchorOffsetCollection:Z};return _.type==="array"?J(x[_.value]||sn,_.length):x[_.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?Gm(new pr(p,o)):Tu(h.errors)}class Dh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!wc(h.expression)}evaluateWithoutErrorHandling(o,h,p,_,x,w){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,x,w)}evaluate(o,h,p,_,x,w){return this._styleExpression.evaluate(o,h,p,_,x,w)}}class Mp{constructor(o,h,p,_){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!wc(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(o,h,p,_,x,w){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,x,w)}evaluate(o,h,p,_,x,w){return this._styleExpression.evaluate(o,h,p,_,x,w)}interpolationFactor(o,h,p){return this.interpolationType?Zi.interpolationFactor(this.interpolationType,o,h,p):0}}function Hm(u,o){const h=jl(u,o);if(h.result==="error")return h;const p=h.value.expression,_=Ih(p);if(!_&&!Lu(o))return Tu([new lo("","data expressions not supported")]);const x=Sc(p,["zoom"]);if(!x&&!qm(o))return Tu([new lo("","zoom expressions not supported")]);const w=Nh(p);return w||x?w instanceof lo?Tu([w]):w instanceof Zi&&!Lp(o)?Tu([new lo("",'"interpolate" expressions cannot be used with this property')]):Gm(w?new Mp(_?"camera":"composite",h.value,w.labels,w instanceof Zi?w.interpolation:void 0):new Dh(_?"constant":"source",h.value)):Tu([new lo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Rh{constructor(o,h){this._parameters=o,this._specification=h,us(this,Wm(this._parameters,this._specification))}static deserialize(o){return new Rh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Nh(u){let o=null;if(u instanceof Lh)o=Nh(u.result);else if(u instanceof Th){for(const h of u.args)if(o=Nh(h),o)break}else(u instanceof Ic||u instanceof Zi)&&u.input instanceof Ho&&u.input.name==="zoom"&&(o=u);return o instanceof lo||u.eachChild(h=>{const p=Nh(h);p instanceof lo?o=p:!o&&p?o=new lo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new lo("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function Oh(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(!Oh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Zm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zh(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Oh(u)||(u=Bh(u));const o=jl(u,Zm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>o.value.evaluate(h,p,{},_),needGeometry:Fh(u)}}function Xm(u,o){return uo?1:0}function Fh(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?Ap(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(Bh))):o==="all"?["all"].concat(u.slice(1).map(Bh)):o==="none"?["all"].concat(u.slice(1).map(Bh).map(Vh)):o==="in"?$m(u[1],u.slice(2)):o==="!in"?Vh($m(u[1],u.slice(2))):o==="has"?Ym(u[1]):o==="!has"?Vh(Ym(u[1])):o!=="within"||u;var h}function Ap(u,o,h){switch(u){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,u,o]}}function $m(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(h=>typeof h!=typeof o[0])?["filter-in-large",u,["literal",o.sort(Xm)]]:["filter-in-small",u,["literal",o]]}}function Ym(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Vh(u){return["!",u]}function kp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let _="[";for(const x of u)_+=`${kp(x)},`;return`${_}]`}const h=Object.keys(u).sort();let p="{";for(let _=0;_p.maximum?[new lt(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Jm(u){const o=u.valueSpec,h=zr(u.value.type);let p,_,x,w={};const I=h!=="categorical"&&u.value.property===void 0,P=!I,D=zn(u.value.stops)==="array"&&zn(u.value.stops[0])==="array"&&zn(u.value.stops[0][0])==="object",O=ho({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function($){if(h==="identity")return[new lt($.key,$.value,'identity function may not have a "stops" property')];let K=[];const ie=$.value;return K=K.concat(Dp({key:$.key,value:ie,valueSpec:$.valueSpec,validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec,arrayElementValidator:B})),zn(ie)==="array"&&ie.length===0&&K.push(new lt($.key,ie,"array must have at least one stop")),K},default:function($){return $.validateSpec({key:$.key,value:$.value,valueSpec:o,validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec})}}});return h==="identity"&&I&&O.push(new lt(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||O.push(new lt(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!Lp(u.valueSpec)&&O.push(new lt(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(P&&!Lu(u.valueSpec)?O.push(new lt(u.key,u.value,"property functions not supported")):I&&!qm(u.valueSpec)&&O.push(new lt(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!D||u.value.property!==void 0||O.push(new lt(u.key,u.value,'"property" property is required')),O;function B($){let K=[];const ie=$.value,fe=$.key;if(zn(ie)!=="array")return[new lt(fe,ie,`array expected, ${zn(ie)} found`)];if(ie.length!==2)return[new lt(fe,ie,`array length 2 expected, length ${ie.length} found`)];if(D){if(zn(ie[0])!=="object")return[new lt(fe,ie,`object expected, ${zn(ie[0])} found`)];if(ie[0].zoom===void 0)return[new lt(fe,ie,"object stop key must have zoom")];if(ie[0].value===void 0)return[new lt(fe,ie,"object stop key must have value")];if(x&&x>zr(ie[0].zoom))return[new lt(fe,ie[0].zoom,"stop zoom values must appear in ascending order")];zr(ie[0].zoom)!==x&&(x=zr(ie[0].zoom),_=void 0,w={}),K=K.concat(ho({key:`${fe}[0]`,value:ie[0],valueSpec:{zoom:{}},validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec,objectElementValidators:{zoom:Uh,value:H}}))}else K=K.concat(H({key:`${fe}[0]`,value:ie[0],valueSpec:{},validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec},ie));return sr(il(ie[1]))?K.concat([new lt(`${fe}[1]`,ie[1],"expressions are not allowed in function stops.")]):K.concat($.validateSpec({key:`${fe}[1]`,value:ie[1],valueSpec:o,validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec}))}function H($,K){const ie=zn($.value),fe=zr($.value),we=$.value!==null?$.value:K;if(p){if(ie!==p)return[new lt($.key,we,`${ie} stop domain type must match previous stop domain type ${p}`)]}else p=ie;if(ie!=="number"&&ie!=="string"&&ie!=="boolean")return[new lt($.key,we,"stop domain value must be a number, string, or boolean")];if(ie!=="number"&&h!=="categorical"){let Oe=`number expected, ${ie} found`;return Lu(o)&&h===void 0&&(Oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new lt($.key,we,Oe)]}return h!=="categorical"||ie!=="number"||isFinite(fe)&&Math.floor(fe)===fe?h!=="categorical"&&ie==="number"&&_!==void 0&&fe<_?[new lt($.key,we,"stop domain values must appear in ascending order")]:(_=fe,h==="categorical"&&fe in w?[new lt($.key,we,"stop domain values must be unique")]:(w[fe]=!0,[])):[new lt($.key,we,`integer expected, found ${fe}`)]}}function ol(u){const o=(u.expressionContext==="property"?Hm:jl)(il(u.value),u.valueSpec);if(o.result==="error")return o.value.map(p=>new lt(`${u.key}${p.key}`,u.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new lt(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"&&!wc(h))return[new lt(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!wc(h))return[new lt(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!Sc(h,["zoom","feature-state"]))return[new lt(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Ih(h))return[new lt(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function sl(u){const o=u.key,h=u.value,p=u.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(zr(h))===-1&&_.push(new lt(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(zr(h))===-1&&_.push(new lt(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function Pu(u){return Oh(il(u.value))?ol(us({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Rp(u)}function Rp(u){const o=u.value,h=u.key;if(zn(o)!=="array")return[new lt(h,o,`array expected, ${zn(o)} found`)];const p=u.styleSpec;let _,x=[];if(o.length<1)return[new lt(h,o,"filter array must have at least 1 element")];switch(x=x.concat(sl({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),zr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&zr(o[1])==="$type"&&x.push(new lt(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&x.push(new lt(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(_=zn(o[1]),_!=="string"&&x.push(new lt(`${h}[1]`,o[1],`string expected, ${_} found`)));for(let w=2;w{D in h&&o.push(new lt(p,h[D],`"${D}" is prohibited for ref layers`))}),_.layers.forEach(D=>{zr(D.id)===I&&(P=D)}),P?P.ref?o.push(new lt(p,h.ref,"ref cannot reference another ref layer")):w=zr(P.type):o.push(new lt(p,h.ref,`ref layer "${I}" not found`))}else if(w!=="background")if(h.source){const P=_.sources&&_.sources[h.source],D=P&&zr(P.type);P?D==="vector"&&w==="raster"?o.push(new lt(p,h.source,`layer "${h.id}" requires a raster source`)):D!=="raster-dem"&&w==="hillshade"?o.push(new lt(p,h.source,`layer "${h.id}" requires a raster-dem source`)):D==="raster"&&w!=="raster"?o.push(new lt(p,h.source,`layer "${h.id}" requires a vector source`)):D!=="vector"||h["source-layer"]?D==="raster-dem"&&w!=="hillshade"?o.push(new lt(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!h.paint||!h.paint["line-gradient"]||D==="geojson"&&P.lineMetrics||o.push(new lt(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new lt(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new lt(p,h.source,`source "${h.source}" not found`))}else o.push(new lt(p,h,'missing required property "source"'));return o=o.concat(ho({key:p,value:h,valueSpec:x.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:h.type,valueSpec:x.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:Pu,layout:P=>ho({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":D=>Op(us({layerType:w},D))}}),paint:P=>ho({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":D=>Np(us({layerType:w},D))}})}})),o}function Gl(u){const o=u.value,h=u.key,p=zn(o);return p!=="string"?[new lt(h,o,`string expected, ${p} found`)]:[]}const Qm={promoteId:function({key:u,value:o}){if(zn(o)==="string")return Gl({key:u,value:o});{const h=[];for(const p in o)h.push(...Gl({key:`${u}.${p}`,value:o[p]}));return h}}};function eg(u){const o=u.value,h=u.key,p=u.styleSpec,_=u.style,x=u.validateSpec;if(!o.type)return[new lt(h,o,'"type" is required')];const w=zr(o.type);let I;switch(w){case"vector":case"raster":return I=ho({key:h,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:Qm,validateSpec:x}),I;case"raster-dem":return I=function(P){var D;const O=(D=P.sourceName)!==null&&D!==void 0?D:"",B=P.value,H=P.styleSpec,$=H.source_raster_dem,K=P.style;let ie=[];const fe=zn(B);if(B===void 0)return ie;if(fe!=="object")return ie.push(new lt("source_raster_dem",B,`object expected, ${fe} found`)),ie;const we=zr(B.encoding)==="custom",Oe=["redFactor","greenFactor","blueFactor","baseShift"],Ee=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Ae in B)!we&&Oe.includes(Ae)?ie.push(new lt(Ae,B[Ae],`In "${O}": "${Ae}" is only valid when "encoding" is set to "custom". ${Ee} encoding found`)):$[Ae]?ie=ie.concat(P.validateSpec({key:Ae,value:B[Ae],valueSpec:$[Ae],validateSpec:P.validateSpec,style:K,styleSpec:H})):ie.push(new lt(Ae,B[Ae],`unknown property "${Ae}"`));return ie}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:x}),I;case"geojson":if(I=ho({key:h,value:o,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:x,objectElementValidators:Qm}),o.cluster)for(const P in o.clusterProperties){const[D,O]=o.clusterProperties[P],B=typeof D=="string"?[D,["accumulated"],["get",P]]:D;I.push(...ol({key:`${h}.${P}.map`,value:O,validateSpec:x,expressionContext:"cluster-map"})),I.push(...ol({key:`${h}.${P}.reduce`,value:B,validateSpec:x,expressionContext:"cluster-reduce"}))}return I;case"video":return ho({key:h,value:o,valueSpec:p.source_video,style:_,validateSpec:x,styleSpec:p});case"image":return ho({key:h,value:o,valueSpec:p.source_image,style:_,validateSpec:x,styleSpec:p});case"canvas":return[new lt(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sl({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:x,styleSpec:p})}}function tg(u){const o=u.value,h=u.styleSpec,p=h.light,_=u.style;let x=[];const w=zn(o);if(o===void 0)return x;if(w!=="object")return x=x.concat([new lt("light",o,`object expected, ${w} found`)]),x;for(const I in o){const P=I.match(/^(.*)-transition$/);x=x.concat(P&&p[P[1]]&&p[P[1]].transition?u.validateSpec({key:I,value:o[I],valueSpec:h.transition,validateSpec:u.validateSpec,style:_,styleSpec:h}):p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new lt(I,o[I],`unknown property "${I}"`)])}return x}function ng(u){const o=u.value,h=u.styleSpec,p=h.sky,_=u.style,x=zn(o);if(o===void 0)return[];if(x!=="object")return[new lt("sky",o,`object expected, ${x} found`)];let w=[];for(const I in o)w=w.concat(p[I]?ea({key:I,value:o[I],valueSpec:p[I],style:_,styleSpec:h}):[new lt(I,o[I],`unknown property "${I}"`)]);return w}function Lc(u){const o=u.value,h=u.styleSpec,p=h.terrain,_=u.style;let x=[];const w=zn(o);if(o===void 0)return x;if(w!=="object")return x=x.concat([new lt("terrain",o,`object expected, ${w} found`)]),x;for(const I in o)x=x.concat(p[I]?u.validateSpec({key:I,value:o[I],valueSpec:p[I],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new lt(I,o[I],`unknown property "${I}"`)]);return x}function Pc(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const _=[],x=[];for(const w in h)h[w].id&&_.includes(h[w].id)&&o.push(new lt(p,h,`all the sprites' ids must be unique, but ${h[w].id} is duplicated`)),_.push(h[w].id),h[w].url&&x.includes(h[w].url)&&o.push(new lt(p,h,`all the sprites' URLs must be unique, but ${h[w].url} is duplicated`)),x.push(h[w].url),o=o.concat(ho({key:`${p}[${w}]`,value:h[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return Gl({key:p,value:h})}const Co={"*":()=>[],array:Dp,boolean:function(u){const o=u.value,h=u.key,p=zn(o);return p!=="boolean"?[new lt(h,o,`boolean expected, ${p} found`)]:[]},number:Uh,color:function(u){const o=u.key,h=u.value,p=zn(h);return p!=="string"?[new lt(o,h,`color expected, ${p} found`)]:Xn.parse(String(h))?[]:[new lt(o,h,`color expected, "${h}" found`)]},constants:Km,enum:sl,filter:Pu,function:Jm,layer:Tc,object:ho,source:eg,light:tg,sky:ng,terrain:Lc,string:Gl,formatted:function(u){return Gl(u).length===0?[]:ol(u)},resolvedImage:function(u){return Gl(u).length===0?[]:ol(u)},padding:function(u){const o=u.key,h=u.value;if(zn(h)==="array"){if(h.length<1||h.length>4)return[new lt(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let x=0;x[]}})),u.constants&&(h=h.concat(Km({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:ea}))),Mu(h)}function ta(u){return function(o){return u({...o,validateSpec:ea})}}function Mu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function Ps(u){return function(...o){return Mu(u.apply(this,o))}}Ls.source=Ps(ta(eg)),Ls.sprite=Ps(ta(Pc)),Ls.glyphs=Ps(ta(zp)),Ls.light=Ps(ta(tg)),Ls.sky=Ps(ta(ng)),Ls.terrain=Ps(ta(Lc)),Ls.layer=Ps(ta(Tc)),Ls.filter=Ps(ta(Pu)),Ls.paintProperty=Ps(ta(Np)),Ls.layoutProperty=Ps(ta(Op));const ql=Ls,Gy=ql.light,Fp=ql.paintProperty,qy=ql.layoutProperty;function Au(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new ot(new Error(p.message))),h=!0;return h}class Mc{constructor(o,h,p){const _=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(h=w[1])+2*(p=w[2]);for(let P=0;P=B[K+0]&&_>=B[K+1])?(I[$]=!0,w.push(O[$])):I[$]=!1}}}}_forEachCell(o,h,p,_,x,w,I,P){const D=this._convertToCellCoord(o),O=this._convertToCellCoord(h),B=this._convertToCellCoord(p),H=this._convertToCellCoord(_);for(let $=D;$<=B;$++)for(let K=O;K<=H;K++){const ie=this.d*K+$;if((!P||P(this._convertFromCellCoord($),this._convertFromCellCoord(K),this._convertFromCellCoord($+1),this._convertFromCellCoord(K+1)))&&x.call(this,o,h,p,_,ie,w,I,P))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,h=3+this.cells.length+1+1;let p=0;for(let w=0;w=0)continue;const w=u[x];_[x]=na[p].shallow.indexOf(x)>=0?w:ku(w,o)}u instanceof Error&&(_.message=u.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(_.$name=p),_}throw new Error("can't serialize object of type "+typeof u)}function Du(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||u instanceof Error||Gh(u)||Mt(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(Du);if(typeof u=="object"){const o=u.$name||"Object";if(!na[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=na[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const _ of Object.keys(u)){if(_==="$name")continue;const x=u[_];p[_]=na[o].shallow.indexOf(_)>=0?x:Du(x)}return p}throw new Error("can't deserialize object of type "+typeof u)}class rg{constructor(){this.first=!0}update(o,h){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=h):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 Ru(u){for(const o of u)if(qh(o.charCodeAt(0)))return!0;return!1}function ig(u){for(const o of u)if(!og(o.charCodeAt(0)))return!1;return!0}function og(u){return!(xt.Arabic(u)||xt["Arabic Supplement"](u)||xt["Arabic Extended-A"](u)||xt["Arabic Presentation Forms-A"](u)||xt["Arabic Presentation Forms-B"](u))}function qh(u){return!(u!==746&&u!==747&&(u<4352||!(xt["Bopomofo Extended"](u)||xt.Bopomofo(u)||xt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||xt["CJK Compatibility Ideographs"](u)||xt["CJK Compatibility"](u)||xt["CJK Radicals Supplement"](u)||xt["CJK Strokes"](u)||!(!xt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||xt["CJK Unified Ideographs Extension A"](u)||xt["CJK Unified Ideographs"](u)||xt["Enclosed CJK Letters and Months"](u)||xt["Hangul Compatibility Jamo"](u)||xt["Hangul Jamo Extended-A"](u)||xt["Hangul Jamo Extended-B"](u)||xt["Hangul Jamo"](u)||xt["Hangul Syllables"](u)||xt.Hiragana(u)||xt["Ideographic Description Characters"](u)||xt.Kanbun(u)||xt["Kangxi Radicals"](u)||xt["Katakana Phonetic Extensions"](u)||xt.Katakana(u)&&u!==12540||!(!xt["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)||!(!xt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||xt["Unified Canadian Aboriginal Syllabics"](u)||xt["Unified Canadian Aboriginal Syllabics Extended"](u)||xt["Vertical Forms"](u)||xt["Yijing Hexagram Symbols"](u)||xt["Yi Syllables"](u)||xt["Yi Radicals"](u))))}function Bp(u){return!(qh(u)||function(o){return!!(xt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||xt["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)||xt["Letterlike Symbols"](o)||xt["Number Forms"](o)||xt["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)||xt["Control Pictures"](o)&&o!==9251||xt["Optical Character Recognition"](o)||xt["Enclosed Alphanumerics"](o)||xt["Geometric Shapes"](o)||xt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||xt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||xt["CJK Symbols and Punctuation"](o)||xt.Katakana(o)||xt["Private Use Area"](o)||xt["CJK Compatibility Forms"](o)||xt["Small Form Variants"](o)||xt["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 Wh(u){return u>=1424&&u<=2303||xt["Arabic Presentation Forms-A"](u)||xt["Arabic Presentation Forms-B"](u)}function sg(u,o){return!(!o&&Wh(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||xt.Khmer(u))}function Wy(u){for(const o of u)if(Wh(o.charCodeAt(0)))return!0;return!1}const al=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class wr{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rg,this.transition={})}isSupportedScript(o){return function(h,p){for(const _ of h)if(!sg(_.charCodeAt(0),p))return!1;return!0}(o,al.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Ac{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,_){if(kh(p))return new Rh(p,_);if(sr(p)){const x=Hm(p,_);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=p;return _.type==="color"&&typeof p=="string"?x=Xn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(x=hs.parse(p)):x=Io.parse(p),{kind:"constant",evaluate:()=>x}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class Hh{constructor(o){this.property=o,this.value=new Ac(o,void 0)}transitioned(o,h){return new ag(this.property,this.value,h,ae({},o.transition,this.transition),o.now)}untransitioned(){return new ag(this.property,this.value,null,{},0)}}class Vp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Q(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Hh(this._values[o].property)),this._values[o].value=new Ac(this._values[o].property,h===null?void 0:Q(h))}getTransition(o){return Q(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Hh(this._values[o].property)),this._values[o].transition=Q(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const _=this.getTransition(h);_!==void 0&&(o[`${h}-transition`]=_)}return o}transitioned(o,h){const p=new lg(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(o,h._values[_]);return p}untransitioned(){const o=new lg(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class ag{constructor(o,h,p,_,x){this.property=o,this.value=h,this.begin=x+_.delay||0,this.end=this.begin+_.duration||0,o.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const _=o.now||0,x=this.value.possiblyEvaluate(o,h,p),w=this.prior;if(w){if(_>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(_=1)return 1;const D=P*P,O=D*P;return 4*(P<.5?O:3*(P-D)+O-.75)}(I))}}return x}}class lg{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const _=new kc(this._properties);for(const x of Object.keys(this._values))_._values[x]=this._values[x].possiblyEvaluate(o,h,p);return _}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class ug{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Q(this._values[o].value)}setValue(o,h){this._values[o]=new Ac(this._values[o].property,h===null?void 0:Q(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const _=new kc(this._properties);for(const x of Object.keys(this._values))_._values[x]=this._values[x].possiblyEvaluate(o,h,p);return _}}class Ms{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,_){return this.property.evaluate(this.value,this.parameters,o,h,p,_)}}class kc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Ot{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const _=co[this.specification.type];return _?_(o,h,p):o}}class qt{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,_){return new Ms(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,_)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new Ms(this,{kind:"constant",value:void 0},o.parameters);const _=co[this.specification.type];if(_){const x=_(o.value.value,h.value.value,p);return new Ms(this,{kind:"constant",value:x},o.parameters)}return o}evaluate(o,h,p,_,x,w){return o.kind==="constant"?o.value:o.evaluate(h,p,_,x,w)}}class Zh extends qt{possiblyEvaluate(o,h,p,_){if(o.value===void 0)return new Ms(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const x=o.expression.evaluate(h,null,{},p,_),w=o.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,I=this._calculate(w,w,w,h);return new Ms(this,{kind:"constant",value:I},h)}if(o.expression.kind==="camera"){const x=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new Ms(this,{kind:"constant",value:x},h)}return new Ms(this,o.expression,h)}evaluate(o,h,p,_,x,w){if(o.kind==="source"){const I=o.evaluate(h,p,_,x,w);return this._calculate(I,I,I,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,_),o.evaluate({zoom:Math.floor(h.zoom)},p,_),o.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):o.value}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Dc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){if(o.value!==void 0){if(o.expression.kind==="constant"){const x=o.expression.evaluate(h,null,{},p,_);return this._calculate(x,x,x,h)}return this._calculate(o.expression.evaluate(new wr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new wr(Math.floor(h.zoom),h)),o.expression.evaluate(new wr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Up{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){return!!o.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class To{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new Ac(p,void 0),x=this.defaultTransitionablePropertyValues[h]=new Hh(p);this.defaultTransitioningPropertyValues[h]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}It("DataDrivenProperty",qt),It("DataConstantProperty",Ot),It("CrossFadedDataDrivenProperty",Zh),It("CrossFadedProperty",Dc),It("ColorRampProperty",Up);const jp="-transition";class As extends kt{constructor(o,h){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),h.layout&&(this._unevaluatedLayout=new ug(h.layout)),h.paint)){this._transitionablePaint=new Vp(h.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 kc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(qy,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(jp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(Fp,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(jp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[o],x=_.property.specification["property-type"]==="cross-faded-data-driven",w=_.value.isDataDriven(),I=_.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const P=this._transitionablePaint._values[o].value;return P.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(o,I,P)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,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,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}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),ke(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,_,x={}){return(!x||x.validate!==!1)&&Au(this,o.call(ql,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:Re,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof Ms&&Lu(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const cg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Rc{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Fr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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 h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ei(u,o=1){let h=0,p=0;return{members:u.map(_=>{const x=cg[_.type].BYTES_PER_ELEMENT,w=h=hg(h,Math.max(o,x)),I=_.components||1;return p=Math.max(p,x),h+=x*I,{name:_.name,type:_.type,components:I,offset:w}}),size:hg(h,Math.max(p,o)),alignment:o}}function hg(u,o){return Math.ceil(u/o)*o}class Nc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.int16[_+0]=h,this.int16[_+1]=p,o}}Nc.prototype.bytesPerElement=4,It("StructArrayLayout2i4",Nc);class ka extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=_,o}}ka.prototype.bytesPerElement=6,It("StructArrayLayout3i6",ka);class Gp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_)}emplace(o,h,p,_,x){const w=4*o;return this.int16[w+0]=h,this.int16[w+1]=p,this.int16[w+2]=_,this.int16[w+3]=x,o}}Gp.prototype.bytesPerElement=8,It("StructArrayLayout4i8",Gp);class qp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,x,w)}emplace(o,h,p,_,x,w,I){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=x,this.int16[P+4]=w,this.int16[P+5]=I,o}}qp.prototype.bytesPerElement=12,It("StructArrayLayout2i4i12",qp);class Wp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,x,w)}emplace(o,h,p,_,x,w,I){const P=4*o,D=8*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.uint8[D+4]=_,this.uint8[D+5]=x,this.uint8[D+6]=w,this.uint8[D+7]=I,o}}Wp.prototype.bytesPerElement=8,It("StructArrayLayout2i4ub8",Wp);class Oc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.float32[_+0]=h,this.float32[_+1]=p,o}}Oc.prototype.bytesPerElement=8,It("StructArrayLayout2f8",Oc);class Xh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w,I,P,D,O){const B=this.length;return this.resize(B+1),this.emplace(B,o,h,p,_,x,w,I,P,D,O)}emplace(o,h,p,_,x,w,I,P,D,O,B){const H=10*o;return this.uint16[H+0]=h,this.uint16[H+1]=p,this.uint16[H+2]=_,this.uint16[H+3]=x,this.uint16[H+4]=w,this.uint16[H+5]=I,this.uint16[H+6]=P,this.uint16[H+7]=D,this.uint16[H+8]=O,this.uint16[H+9]=B,o}}Xh.prototype.bytesPerElement=20,It("StructArrayLayout10ui20",Xh);class Hp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w,I,P,D,O,B,H){const $=this.length;return this.resize($+1),this.emplace($,o,h,p,_,x,w,I,P,D,O,B,H)}emplace(o,h,p,_,x,w,I,P,D,O,B,H,$){const K=12*o;return this.int16[K+0]=h,this.int16[K+1]=p,this.int16[K+2]=_,this.int16[K+3]=x,this.uint16[K+4]=w,this.uint16[K+5]=I,this.uint16[K+6]=P,this.uint16[K+7]=D,this.int16[K+8]=O,this.int16[K+9]=B,this.int16[K+10]=H,this.int16[K+11]=$,o}}Hp.prototype.bytesPerElement=24,It("StructArrayLayout4i4ui4i24",Hp);class Zp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,o}}Zp.prototype.bytesPerElement=12,It("StructArrayLayout3f12",Zp);class Da extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}Da.prototype.bytesPerElement=4,It("StructArrayLayout1ul4",Da);class $h extends Fr{_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,h,p,_,x,w,I,P,D){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,_,x,w,I,P,D)}emplace(o,h,p,_,x,w,I,P,D,O){const B=10*o,H=5*o;return this.int16[B+0]=h,this.int16[B+1]=p,this.int16[B+2]=_,this.int16[B+3]=x,this.int16[B+4]=w,this.int16[B+5]=I,this.uint32[H+3]=P,this.uint16[B+8]=D,this.uint16[B+9]=O,o}}$h.prototype.bytesPerElement=20,It("StructArrayLayout6i1ul2ui20",$h);class zc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,o,h,p,_,x,w)}emplace(o,h,p,_,x,w,I){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=x,this.int16[P+4]=w,this.int16[P+5]=I,o}}zc.prototype.bytesPerElement=12,It("StructArrayLayout2i2i2i12",zc);class Yh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,x){const w=this.length;return this.resize(w+1),this.emplace(w,o,h,p,_,x)}emplace(o,h,p,_,x,w){const I=4*o,P=8*o;return this.float32[I+0]=h,this.float32[I+1]=p,this.float32[I+2]=_,this.int16[P+6]=x,this.int16[P+7]=w,o}}Yh.prototype.bytesPerElement=16,It("StructArrayLayout2f1f2i16",Yh);class Fc extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_)}emplace(o,h,p,_,x){const w=12*o,I=3*o;return this.uint8[w+0]=h,this.uint8[w+1]=p,this.float32[I+1]=_,this.float32[I+2]=x,o}}Fc.prototype.bytesPerElement=12,It("StructArrayLayout2ub2f12",Fc);class Kh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.uint16[x+0]=h,this.uint16[x+1]=p,this.uint16[x+2]=_,o}}Kh.prototype.bytesPerElement=6,It("StructArrayLayout3ui6",Kh);class Nu extends Fr{_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,h,p,_,x,w,I,P,D,O,B,H,$,K,ie,fe,we){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,o,h,p,_,x,w,I,P,D,O,B,H,$,K,ie,fe,we)}emplace(o,h,p,_,x,w,I,P,D,O,B,H,$,K,ie,fe,we,Oe){const Ee=24*o,Ae=12*o,Qe=48*o;return this.int16[Ee+0]=h,this.int16[Ee+1]=p,this.uint16[Ee+2]=_,this.uint16[Ee+3]=x,this.uint32[Ae+2]=w,this.uint32[Ae+3]=I,this.uint32[Ae+4]=P,this.uint16[Ee+10]=D,this.uint16[Ee+11]=O,this.uint16[Ee+12]=B,this.float32[Ae+7]=H,this.float32[Ae+8]=$,this.uint8[Qe+36]=K,this.uint8[Qe+37]=ie,this.uint8[Qe+38]=fe,this.uint32[Ae+10]=we,this.int16[Ee+22]=Oe,o}}Nu.prototype.bytesPerElement=48,It("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Nu);class Wl extends Fr{_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,h,p,_,x,w,I,P,D,O,B,H,$,K,ie,fe,we,Oe,Ee,Ae,Qe,et,St,Dt,wt,bt,ht,Pt){const gt=this.length;return this.resize(gt+1),this.emplace(gt,o,h,p,_,x,w,I,P,D,O,B,H,$,K,ie,fe,we,Oe,Ee,Ae,Qe,et,St,Dt,wt,bt,ht,Pt)}emplace(o,h,p,_,x,w,I,P,D,O,B,H,$,K,ie,fe,we,Oe,Ee,Ae,Qe,et,St,Dt,wt,bt,ht,Pt,gt){const st=32*o,Gt=16*o;return this.int16[st+0]=h,this.int16[st+1]=p,this.int16[st+2]=_,this.int16[st+3]=x,this.int16[st+4]=w,this.int16[st+5]=I,this.int16[st+6]=P,this.int16[st+7]=D,this.uint16[st+8]=O,this.uint16[st+9]=B,this.uint16[st+10]=H,this.uint16[st+11]=$,this.uint16[st+12]=K,this.uint16[st+13]=ie,this.uint16[st+14]=fe,this.uint16[st+15]=we,this.uint16[st+16]=Oe,this.uint16[st+17]=Ee,this.uint16[st+18]=Ae,this.uint16[st+19]=Qe,this.uint16[st+20]=et,this.uint16[st+21]=St,this.uint16[st+22]=Dt,this.uint32[Gt+12]=wt,this.float32[Gt+13]=bt,this.float32[Gt+14]=ht,this.uint16[st+30]=Pt,this.uint16[st+31]=gt,o}}Wl.prototype.bytesPerElement=64,It("StructArrayLayout8i15ui1ul2f2ui64",Wl);class Jh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Jh.prototype.bytesPerElement=4,It("StructArrayLayout1f4",Jh);class Qh extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=3*o;return this.uint16[6*o+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,o}}Qh.prototype.bytesPerElement=12,It("StructArrayLayout1ui2f12",Qh);class Hl extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const x=4*o;return this.uint32[2*o+0]=h,this.uint16[x+2]=p,this.uint16[x+3]=_,o}}Hl.prototype.bytesPerElement=8,It("StructArrayLayout1ul2ui8",Hl);class Xp extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.uint16[_+0]=h,this.uint16[_+1]=p,o}}Xp.prototype.bytesPerElement=4,It("StructArrayLayout2ui4",Xp);class $p extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}$p.prototype.bytesPerElement=2,It("StructArrayLayout1ui2",$p);class ef extends Fr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_)}emplace(o,h,p,_,x){const w=4*o;return this.float32[w+0]=h,this.float32[w+1]=p,this.float32[w+2]=_,this.float32[w+3]=x,o}}ef.prototype.bytesPerElement=16,It("StructArrayLayout4f16",ef);class fg extends Rc{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 E(this.anchorPointX,this.anchorPointY)}}fg.prototype.size=20;class y extends $h{get(o){return new fg(this,o)}}It("CollisionBoxArray",y);class a extends Rc{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]}}a.prototype.size=48;class f extends Nu{get(o){return new a(this,o)}}It("PlacedSymbolArray",f);class m extends Rc{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]}}m.prototype.size=64;class g extends Wl{get(o){return new m(this,o)}}It("SymbolInstanceArray",g);class b extends Jh{getoffsetX(o){return this.float32[1*o+0]}}It("GlyphOffsetArray",b);class T extends ka{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}It("SymbolLineVertexArray",T);class L extends Rc{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]}}L.prototype.size=12;class A extends Qh{get(o){return new L(this,o)}}It("TextAnchorOffsetArray",A);class N extends Rc{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]}}N.prototype.size=8;class V extends Hl{get(o){return new N(this,o)}}It("FeatureIndexArray",V);class j extends Nc{}class Y extends Nc{}class he extends Nc{}class ce extends qp{}class ge extends Wp{}class re extends Oc{}class Ie extends Xh{}class je extends Hp{}class xe extends Zp{}class De extends Da{}class Ge extends zc{}class Ze extends Fc{}class Ke extends Kh{}class rt extends Xp{}const tt=ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:ct}=tt;class dt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,_){let x=this.segments[this.segments.length-1];return o>dt.MAX_VERTEX_ARRAY_LENGTH&&qe(`Max vertices per segment is ${dt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!x||x.vertexLength+o>dt.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==_)&&(x={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(x.sortKey=_),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,_){return new dt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function cn(u,o){return 256*(u=X(Math.floor(u),0,255))+X(Math.floor(o),0,255)}dt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,It("SegmentVector",dt);const mt=ei([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Xt={exports:{}},hn={exports:{}};hn.exports=function(u,o){var h,p,_,x,w,I,P,D;for(p=u.length-(h=3&u.length),_=o,w=3432918353,I=461845907,D=0;D>>16)*w&65535)<<16)&4294967295)<<15|P>>>17))*I+(((P>>>16)*I&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(P=0,h){case 3:P^=(255&u.charCodeAt(D+2))<<16;case 2:P^=(255&u.charCodeAt(D+1))<<8;case 1:_^=P=(65535&(P=(P=(65535&(P^=255&u.charCodeAt(D)))*w+(((P>>>16)*w&65535)<<16)&4294967295)<<15|P>>>17))*I+(((P>>>16)*I&65535)<<16)&4294967295}return _^=u.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var Pn=hn.exports,Qt={exports:{}};Qt.exports=function(u,o){for(var h,p=u.length,_=o^p,x=0;p>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(x)|(255&u.charCodeAt(++x))<<8|(255&u.charCodeAt(++x))<<16|(255&u.charCodeAt(++x))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++x;switch(p){case 3:_^=(255&u.charCodeAt(x+2))<<16;case 2:_^=(255&u.charCodeAt(x+1))<<8;case 1:_=1540483477*(65535&(_^=255&u.charCodeAt(x)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var mn=Pn,vn=Qt.exports;Xt.exports=mn,Xt.exports.murmur3=mn,Xt.exports.murmur2=vn;var Br=d(Xt.exports);class Yn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,_){this.ids.push(Zo(o)),this.positions.push(h,p,_)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=Zo(o);let p=0,_=this.ids.length-1;for(;p<_;){const w=p+_>>1;this.ids[w]>=h?_=w:p=w+1}const x=[];for(;this.ids[p]===h;)x.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return x}static serialize(o,h){const p=new Float64Array(o.ids),_=new Uint32Array(o.positions);return yi(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(o){const h=new Yn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function Zo(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Br(String(u))}function yi(u,o,h,p){for(;h>1];let x=h-1,w=p+1;for(;;){do x++;while(u[x]<_);do w--;while(u[w]>_);if(x>=w)break;Lr(u,x,w),Lr(o,3*x,3*w),Lr(o,3*x+1,3*w+1),Lr(o,3*x+2,3*w+2)}w-h`u_${_}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new ll(o,h):new Xo(o,h)}}class pi{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,_){const x=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&o.set(x)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new ra(o,h):new Xo(o,h)}}class Pr{constructor(o,h,p,_){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(x=>({name:`a_${x}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(o,h,p,_,x){const w=this.paintVertexArray.length,I=this.expression.evaluate(new wr(0),h,{},_,[],x);this.paintVertexArray.resize(o),this._setPaintValue(w,o,I)}updatePaintArray(o,h,p,_){const x=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(o,h,x)}_setPaintValue(o,h,p){if(this.type==="color"){const _=ul(p);for(let x=o;x`u_${I}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=h.map(I=>({name:`a_${I}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,h,p,_,x){const w=this.expression.evaluate(new wr(this.zoom),h,{},_,[],x),I=this.expression.evaluate(new wr(this.zoom+1),h,{},_,[],x),P=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(P,o,w,I)}updatePaintArray(o,h,p,_){const x=this.expression.evaluate({zoom:this.zoom},p,_),w=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(o,h,x,w)}_setPaintValue(o,h,p,_){if(this.type==="color"){const x=ul(p),w=ul(_);for(let I=o;I`#define HAS_UNIFORM_${_}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Pr||p instanceof Sr)for(let _=0;_!0){this.programConfigurations={};for(const _ of o)this.programConfigurations[_.id]=new di(_,h,p);this.needsUpload=!1,this._featureMap=new Yn,this._bufferOffset=0}populatePaintArrays(o,h,p,_,x,w){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(o,h,_,x,w);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,_){for(const x of p)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(o,this._featureMap,h,x,_)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function ds(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 mi(u,o,h){const p={color:{source:Oc,composite:ef},number:{source:Jh,composite:Oc}},_=function(x){return{"line-pattern":{source:Ie,composite:Ie},"fill-pattern":{source:Ie,composite:Ie},"fill-extrusion-pattern":{source:Ie,composite:Ie}}[x]}(u);return _&&_[h]||p[o][h]}It("ConstantBinder",ia),It("CrossFadedConstantBinder",pi),It("SourceExpressionBinder",Pr),It("CrossFadedCompositeBinder",ps),It("CompositeExpressionBinder",Sr),It("ProgramConfiguration",di,{omit:["_buffers"]}),It("ProgramConfigurationSet",Mr);const Hr=8192,Yp=Math.pow(2,14)-1,pg=-Yp-1;function Zl(u){const o=Hr/u.extent,h=u.loadGeometry();for(let p=0;pw.x+1||Pw.y+1)&&qe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function Xl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?Zl(u):[]}}function tf(u,o,h,p,_){u.emplaceBack(2*o+(p+1)/2,2*h+(_+1)/2)}class cl{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Y,this.indexArray=new Ke,this.segments=new dt,this.programConfigurations=new Mr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const _=this.layers[0],x=[];let w=null,I=!1;_.type==="circle"&&(w=_.layout.get("circle-sort-key"),I=!w.isConstant());for(const{feature:P,id:D,index:O,sourceLayerIndex:B}of o){const H=this.layers[0]._featureFilter.needGeometry,$=Xl(P,H);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),$,p))continue;const K=I?w.evaluate($,{},p):void 0,ie={id:D,properties:P.properties,type:P.type,sourceLayerIndex:B,index:O,geometry:H?$.geometry:Zl(P),patterns:{},sortKey:K};x.push(ie)}I&&x.sort((P,D)=>P.sortKey-D.sortKey);for(const P of x){const{geometry:D,index:O,sourceLayerIndex:B}=P,H=o[O].feature;this.addFeature(P,D,O,p),h.featureIndex.insert(H,D,O,B,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,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,ct),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,h,p,_){for(const x of h)for(const w of x){const I=w.x,P=w.y;if(I<0||I>=Hr||P<0||P>=Hr)continue;const D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),O=D.vertexLength;tf(this.layoutVertexArray,I,P,-1,-1),tf(this.layoutVertexArray,I,P,1,-1),tf(this.layoutVertexArray,I,P,1,1),tf(this.layoutVertexArray,I,P,-1,1),this.indexArray.emplaceBack(O,O+1,O+2),this.indexArray.emplaceBack(O,O+3,O+2),D.vertexLength+=4,D.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},_)}}function Kp(u,o){for(let h=0;h1){if(nf(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(_)._add(o))}function gb(u,o){let h,p,_,x=!1;for(let w=0;wo.y!=_.y>o.y&&o.x<(_.x-p.x)*(o.y-p.y)/(_.y-p.y)+p.x&&(x=!x)}return x}function rf(u,o){let h=!1;for(let p=0,_=u.length-1;po.y!=w.y>o.y&&o.x<(w.x-x.x)*(o.y-x.y)/(w.y-x.y)+x.x&&(h=!h)}return h}function HT(u,o,h){const p=h[0],_=h[2];if(u.x_.x&&o.x>_.x||u.y_.y&&o.y>_.y)return!1;const x=Pe(u,o,h[0]);return x!==Pe(u,o,h[1])||x!==Pe(u,o,h[2])||x!==Pe(u,o,h[3])}function td(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function mg(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function gg(u,o,h,p,_){if(!o[0]&&!o[1])return u;const x=E.convert(o)._mult(_);h==="viewport"&&x._rotate(-p);const w=[];for(let I=0;Ibb(fe,ie))}(D,P),$=B?O*I:O;for(const K of _)for(const ie of K){const fe=B?ie:bb(ie,P);let we=$;const Oe=_g([],[ie.x,ie.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?we*=Oe[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(we*=w.cameraToCenterDistance/Oe[3]),dg(H,fe,we))return!0}return!1}}function bb(u,o){const h=_g([],[u.x,u.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class xb extends cl{}let wb;It("HeatmapBucket",xb,{omit:["layers"]});var YT={get paint(){return wb=wb||new To({"heatmap-radius":new qt(Re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new qt(Re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ot(Re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Up(Re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ot(Re.paint_heatmap["heatmap-opacity"])})}};function Xy(u,{width:o,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${o*h*p}`)}else _=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=_,u}function Sb(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const _=Xy({},{width:o,height:h},p);$y(u,_,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,h)},p),u.width=o,u.height=h,u.data=_.data}function $y(u,o,h,p,_,x){if(_.width===0||_.height===0)return o;if(_.width>u.width||_.height>u.height||h.x>u.width-_.width||h.y>u.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>o.width||_.height>o.height||p.x>o.width-_.width||p.y>o.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const w=u.data,I=o.data;if(w===I)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<_.height;P++){const D=((h.y+P)*u.width+h.x)*x,O=((p.y+P)*o.width+p.x)*x;for(let B=0;B<_.width*x;B++)I[O+B]=w[D+B]}return o}class rd{constructor(o,h){Xy(this,o,1,h)}resize(o){Sb(this,o,1)}clone(){return new rd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,x){$y(o,h,p,_,x,1)}}class ks{constructor(o,h){Xy(this,o,4,h)}resize(o){Sb(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new ks({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,x){$y(o,h,p,_,x,4)}}function Eb(u){const o={},h=u.resolution||256,p=u.clips?u.clips.length:1,_=u.image||new ks({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const x=(w,I,P)=>{o[u.evaluationKey]=P;const D=u.expression.evaluate(o);_.data[w+I+0]=Math.floor(255*D.r/D.a),_.data[w+I+1]=Math.floor(255*D.g/D.a),_.data[w+I+2]=Math.floor(255*D.b/D.a),_.data[w+I+3]=Math.floor(255*D.a)};if(u.clips)for(let w=0,I=0;w80*h){p=x=u[0],_=w=u[1];for(var K=h;Kx&&(x=I),P>w&&(w=P);D=(D=Math.max(x-p,w-_))!==0?32767/D:0}return id(H,$,h,p,_,D,0),$}function Cb(u,o,h,p,_){var x,w;if(_===Qy(u,o,h,p)>0)for(x=o;x=o;x-=p)w=Pb(x,u[x],u[x+1],w);return w&&vg(w,w.next)&&(sd(w),w=w.next),w}function Vc(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!vg(p,p.next)&&ti(p.prev,p,p.next)!==0)p=p.next;else{if(sd(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function id(u,o,h,p,_,x,w){if(u){!w&&x&&function(O,B,H,$){var K=O;do K.z===0&&(K.z=Ky(K.x,K.y,B,H,$)),K.prevZ=K.prev,K.nextZ=K.next,K=K.next;while(K!==O);K.prevZ.nextZ=null,K.prevZ=null,function(ie){var fe,we,Oe,Ee,Ae,Qe,et,St,Dt=1;do{for(we=ie,ie=null,Ae=null,Qe=0;we;){for(Qe++,Oe=we,et=0,fe=0;fe0||St>0&&Oe;)et!==0&&(St===0||!Oe||we.z<=Oe.z)?(Ee=we,we=we.nextZ,et--):(Ee=Oe,Oe=Oe.nextZ,St--),Ae?Ae.nextZ=Ee:ie=Ee,Ee.prevZ=Ae,Ae=Ee;we=Oe}Ae.nextZ=null,Dt*=2}while(Qe>1)}(K)}(u,p,_,x);for(var I,P,D=u;u.prev!==u.next;)if(I=u.prev,P=u.next,x?rL(u,p,_,x):nL(u))o.push(I.i/h|0),o.push(u.i/h|0),o.push(P.i/h|0),sd(u),u=P.next,D=P.next;else if((u=P)===D){w?w===1?id(u=iL(Vc(u),o,h),o,h,p,_,x,2):w===2&&oL(u,o,h,p,_,x):id(Vc(u),o,h,p,_,x,1);break}}}function nL(u){var o=u.prev,h=u,p=u.next;if(ti(o,h,p)>=0)return!1;for(var _=o.x,x=h.x,w=p.x,I=o.y,P=h.y,D=p.y,O=_x?_>w?_:w:x>w?x:w,$=I>P?I>D?I:D:P>D?P:D,K=p.next;K!==o;){if(K.x>=O&&K.x<=H&&K.y>=B&&K.y<=$&&sf(_,I,x,P,w,D,K.x,K.y)&&ti(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function rL(u,o,h,p){var _=u.prev,x=u,w=u.next;if(ti(_,x,w)>=0)return!1;for(var I=_.x,P=x.x,D=w.x,O=_.y,B=x.y,H=w.y,$=IP?I>D?I:D:P>D?P:D,fe=O>B?O>H?O:H:B>H?B:H,we=Ky($,K,o,h,p),Oe=Ky(ie,fe,o,h,p),Ee=u.prevZ,Ae=u.nextZ;Ee&&Ee.z>=we&&Ae&&Ae.z<=Oe;){if(Ee.x>=$&&Ee.x<=ie&&Ee.y>=K&&Ee.y<=fe&&Ee!==_&&Ee!==w&&sf(I,O,P,B,D,H,Ee.x,Ee.y)&&ti(Ee.prev,Ee,Ee.next)>=0||(Ee=Ee.prevZ,Ae.x>=$&&Ae.x<=ie&&Ae.y>=K&&Ae.y<=fe&&Ae!==_&&Ae!==w&&sf(I,O,P,B,D,H,Ae.x,Ae.y)&&ti(Ae.prev,Ae,Ae.next)>=0))return!1;Ae=Ae.nextZ}for(;Ee&&Ee.z>=we;){if(Ee.x>=$&&Ee.x<=ie&&Ee.y>=K&&Ee.y<=fe&&Ee!==_&&Ee!==w&&sf(I,O,P,B,D,H,Ee.x,Ee.y)&&ti(Ee.prev,Ee,Ee.next)>=0)return!1;Ee=Ee.prevZ}for(;Ae&&Ae.z<=Oe;){if(Ae.x>=$&&Ae.x<=ie&&Ae.y>=K&&Ae.y<=fe&&Ae!==_&&Ae!==w&&sf(I,O,P,B,D,H,Ae.x,Ae.y)&&ti(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.nextZ}return!0}function iL(u,o,h){var p=u;do{var _=p.prev,x=p.next.next;!vg(_,x)&&Tb(_,p,p.next,x)&&od(_,x)&&od(x,_)&&(o.push(_.i/h|0),o.push(p.i/h|0),o.push(x.i/h|0),sd(p),sd(p.next),p=u=x),p=p.next}while(p!==u);return Vc(p)}function oL(u,o,h,p,_,x){var w=u;do{for(var I=w.next.next;I!==w.prev;){if(w.i!==I.i&&cL(w,I)){var P=Lb(w,I);return w=Vc(w,w.next),P=Vc(P,P.next),id(w,o,h,p,_,x,0),void id(P,o,h,p,_,x,0)}I=I.next}w=w.next}while(w!==u)}function sL(u,o){return u.x-o.x}function aL(u,o){var h=function(_,x){var w,I=x,P=_.x,D=_.y,O=-1/0;do{if(D<=I.y&&D>=I.next.y&&I.next.y!==I.y){var B=I.x+(D-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(B<=P&&B>O&&(O=B,w=I.x=I.x&&I.x>=K&&P!==I.x&&sf(Dw.x||I.x===w.x&&lL(w,I)))&&(w=I,fe=H)),I=I.next;while(I!==$);return w}(u,o);if(!h)return o;var p=Lb(h,u);return Vc(p,p.next),Vc(h,h.next)}function lL(u,o){return ti(u.prev,u,o.prev)<0&&ti(o.next,u,u.next)<0}function Ky(u,o,h,p,_){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*_|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*_|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function uL(u){var o=u,h=u;do(o.x=(u-w)*(x-I)&&(u-w)*(p-I)>=(h-w)*(o-I)&&(h-w)*(x-I)>=(_-w)*(p-I)}function cL(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&Tb(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(u,o)&&(od(u,o)&&od(o,u)&&function(h,p){var _=h,x=!1,w=(h.x+p.x)/2,I=(h.y+p.y)/2;do _.y>I!=_.next.y>I&&_.next.y!==_.y&&w<(_.next.x-_.x)*(I-_.y)/(_.next.y-_.y)+_.x&&(x=!x),_=_.next;while(_!==h);return x}(u,o)&&(ti(u.prev,u,o.prev)||ti(u,o.prev,o))||vg(u,o)&&ti(u.prev,u,u.next)>0&&ti(o.prev,o,o.next)>0)}function ti(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function vg(u,o){return u.x===o.x&&u.y===o.y}function Tb(u,o,h,p){var _=xg(ti(u,o,h)),x=xg(ti(u,o,p)),w=xg(ti(h,p,u)),I=xg(ti(h,p,o));return _!==x&&w!==I||!(_!==0||!bg(u,h,o))||!(x!==0||!bg(u,p,o))||!(w!==0||!bg(h,u,p))||!(I!==0||!bg(h,o,p))}function bg(u,o,h){return o.x<=Math.max(u.x,h.x)&&o.x>=Math.min(u.x,h.x)&&o.y<=Math.max(u.y,h.y)&&o.y>=Math.min(u.y,h.y)}function xg(u){return u>0?1:u<0?-1:0}function od(u,o){return ti(u.prev,u,u.next)<0?ti(u,o,u.next)>=0&&ti(u,u.prev,o)>=0:ti(u,o,u.prev)<0||ti(u,u.next,o)<0}function Lb(u,o){var h=new Jy(u.i,u.x,u.y),p=new Jy(o.i,o.x,o.y),_=u.next,x=o.prev;return u.next=o,o.prev=u,h.next=_,_.prev=h,p.next=h,h.prev=p,x.next=p,p.prev=x,p}function Pb(u,o,h,p){var _=new Jy(u,o,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function sd(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 Jy(u,o,h){this.i=u,this.x=o,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Qy(u,o,h,p){for(var _=0,x=o,w=h-p;x0&&h.holes.push(p+=u[_-1].length)}return h};var Mb=d(Yy.exports);function hL(u,o,h,p,_){Ab(u,o,h||0,p||u.length-1,_||fL)}function Ab(u,o,h,p,_){for(;p>h;){if(p-h>600){var x=p-h+1,w=o-h+1,I=Math.log(x),P=.5*Math.exp(2*I/3),D=.5*Math.sqrt(I*P*(x-P)/x)*(w-x/2<0?-1:1);Ab(u,o,Math.max(h,Math.floor(o-w*P/x+D)),Math.min(p,Math.floor(o+(x-w)*P/x+D)),_)}var O=u[o],B=h,H=p;for(ad(u,h,o),_(u[p],O)>0&&ad(u,h,p);B0;)H--}_(u[h],O)===0?ad(u,h,H):ad(u,++H,p),H<=o&&(h=H+1),o<=H&&(p=H-1)}}function ad(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function fL(u,o){return uo?1:0}function e0(u,o){const h=u.length;if(h<=1)return[u];const p=[];let _,x;for(let w=0;w1)for(let w=0;wh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new he,this.indexArray=new Ke,this.indexArray2=new rt,this.programConfigurations=new Mr(o.layers,o.zoom),this.segments=new dt,this.segments2=new dt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=t0("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),x=!_.isConstant(),w=[];for(const{feature:I,id:P,index:D,sourceLayerIndex:O}of o){const B=this.layers[0]._featureFilter.needGeometry,H=Xl(I,B);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),H,p))continue;const $=x?_.evaluate(H,{},p,h.availableImages):void 0,K={id:P,properties:I.properties,type:I.type,sourceLayerIndex:O,index:D,geometry:B?H.geometry:Zl(I),patterns:{},sortKey:$};w.push(K)}x&&w.sort((I,P)=>I.sortKey-P.sortKey);for(const I of w){const{geometry:P,index:D,sourceLayerIndex:O}=I;if(this.hasPattern){const B=n0("fill",this.layers,I,this.zoom,h);this.patternFeatures.push(B)}else this.addFeature(I,P,D,p,{});h.featureIndex.insert(o[D].feature,P,D,O,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,tL),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,h,p,_,x){for(const w of e0(h,500)){let I=0;for(const $ of w)I+=$.length;const P=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),D=P.vertexLength,O=[],B=[];for(const $ of w){if($.length===0)continue;$!==w[0]&&B.push(O.length/2);const K=this.segments2.prepareSegment($.length,this.layoutVertexArray,this.indexArray2),ie=K.vertexLength;this.layoutVertexArray.emplaceBack($[0].x,$[0].y),this.indexArray2.emplaceBack(ie+$.length-1,ie),O.push($[0].x),O.push($[0].y);for(let fe=1;fe<$.length;fe++)this.layoutVertexArray.emplaceBack($[fe].x,$[fe].y),this.indexArray2.emplaceBack(ie+fe-1,ie+fe),O.push($[fe].x),O.push($[fe].y);K.vertexLength+=$.length,K.primitiveLength+=$.length}const H=Mb(O,B);for(let $=0;$>3}if(_--,p===1||p===2)x+=u.readSVarint(),w+=u.readSVarint(),p===1&&(o&&I.push(o),o=[]),o.push(new vL(x,w));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&I.push(o),I},af.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,_=0,x=0,w=1/0,I=-1/0,P=1/0,D=-1/0;u.pos>3}if(p--,h===1||h===2)(_+=u.readSVarint())I&&(I=_),(x+=u.readSVarint())D&&(D=x);else if(h!==7)throw new Error("unknown command "+h)}return[w,P,I,D]},af.prototype.toGeoJSON=function(u,o,h){var p,_,x=this.extent*Math.pow(2,h),w=this.extent*u,I=this.extent*o,P=this.loadGeometry(),D=af.types[this.type];function O($){for(var K=0;K<$.length;K++){var ie=$[K];$[K]=[360*(ie.x+w)/x-180,360/Math.PI*Math.atan(Math.exp((180-360*(ie.y+I)/x)*Math.PI/180))-90]}}switch(this.type){case 1:var B=[];for(p=0;p>3;_=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 _}(h))}Ob.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 wL(this._pbf,o,this.extent,this._keys,this._values)};var EL=Nb;function IL(u,o,h){if(u===3){var p=new EL(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}Ou.VectorTile=function(u,o){this.layers=u.readFields(IL,{},o)},Ou.VectorTileFeature=Rb,Ou.VectorTileLayer=Nb;const CL=Ou.VectorTileFeature.types,i0=Math.pow(2,13);function ld(u,o,h,p,_,x,w,I){u.emplaceBack(o,h,2*Math.floor(p*i0)+w,_*i0*2,x*i0*2,Math.round(I))}class o0{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new ce,this.centroidVertexArray=new j,this.indexArray=new Ke,this.programConfigurations=new Mr(o.layers,o.zoom),this.segments=new dt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=t0("fill-extrusion",this.layers,h);for(const{feature:_,id:x,index:w,sourceLayerIndex:I}of o){const P=this.layers[0]._featureFilter.needGeometry,D=Xl(_,P);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),D,p))continue;const O={id:x,sourceLayerIndex:I,index:w,geometry:P?D.geometry:Zl(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(n0("fill-extrusion",this.layers,O,this.zoom,h)):this.addFeature(O,O.geometry,w,p,{}),h.featureIndex.insert(_,O.geometry,w,I,this.index,!0)}}addFeatures(o,h,p){for(const _ of this.features){const{geometry:x}=_;this.addFeature(_,x,_.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,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,yL),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,_L.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,h,p,_,x){const w={x:0,y:0,vertexCount:0};for(const I of e0(h,500)){let P=0;for(const K of I)P+=K.length;let D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of I){if(K.length===0||LL(K))continue;let ie=0;for(let fe=0;fe=1){const Oe=K[fe-1];if(!TL(we,Oe)){D.vertexLength+4>dt.MAX_VERTEX_ARRAY_LENGTH&&(D=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Ee=we.sub(Oe)._perp()._unit(),Ae=Oe.dist(we);ie+Ae>32768&&(ie=0),ld(this.layoutVertexArray,we.x,we.y,Ee.x,Ee.y,0,0,ie),ld(this.layoutVertexArray,we.x,we.y,Ee.x,Ee.y,0,1,ie),w.x+=2*we.x,w.y+=2*we.y,w.vertexCount+=2,ie+=Ae,ld(this.layoutVertexArray,Oe.x,Oe.y,Ee.x,Ee.y,0,0,ie),ld(this.layoutVertexArray,Oe.x,Oe.y,Ee.x,Ee.y,0,1,ie),w.x+=2*Oe.x,w.y+=2*Oe.y,w.vertexCount+=2;const Qe=D.vertexLength;this.indexArray.emplaceBack(Qe,Qe+2,Qe+1),this.indexArray.emplaceBack(Qe+1,Qe+2,Qe+3),D.vertexLength+=4,D.primitiveLength+=2}}}}if(D.vertexLength+P>dt.MAX_VERTEX_ARRAY_LENGTH&&(D=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),CL[o.type]!=="Polygon")continue;const O=[],B=[],H=D.vertexLength;for(const K of I)if(K.length!==0){K!==I[0]&&B.push(O.length/2);for(let ie=0;ieHr)||u.y===o.y&&(u.y<0||u.y>Hr)}function LL(u){return u.every(o=>o.x<0)||u.every(o=>o.x>Hr)||u.every(o=>o.y<0)||u.every(o=>o.y>Hr)}let zb;It("FillExtrusionBucket",o0,{omit:["layers","features"]});var PL={get paint(){return zb=zb||new To({"fill-extrusion-opacity":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qt(Re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zh(Re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new qt(Re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qt(Re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ot(Re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ML extends As{constructor(o){super(o,PL)}createBucket(o){return new o0(o)}queryRadius(){return mg(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,_,x,w,I,P){const D=gg(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,I),O=this.paint.get("fill-extrusion-height").evaluate(h,p),B=this.paint.get("fill-extrusion-base").evaluate(h,p),H=function(K,ie,fe,we){const Oe=[];for(const Ee of K){const Ae=[Ee.x,Ee.y,0,1];_g(Ae,Ae,ie),Oe.push(new E(Ae[0]/Ae[3],Ae[1]/Ae[3]))}return Oe}(D,P),$=function(K,ie,fe,we){const Oe=[],Ee=[],Ae=we[8]*ie,Qe=we[9]*ie,et=we[10]*ie,St=we[11]*ie,Dt=we[8]*fe,wt=we[9]*fe,bt=we[10]*fe,ht=we[11]*fe;for(const Pt of K){const gt=[],st=[];for(const Gt of Pt){const Nt=Gt.x,xn=Gt.y,dr=we[0]*Nt+we[4]*xn+we[12],Er=we[1]*Nt+we[5]*xn+we[13],xi=we[2]*Nt+we[6]*xn+we[14],ms=we[3]*Nt+we[7]*xn+we[15],Po=xi+et,gi=ms+St,Vi=dr+Dt,$i=Er+wt,Mo=xi+bt,Ao=ms+ht,wi=new E((dr+Ae)/gi,(Er+Qe)/gi);wi.z=Po/gi,gt.push(wi);const Si=new E(Vi/Ao,$i/Ao);Si.z=Mo/Ao,st.push(Si)}Oe.push(gt),Ee.push(st)}return[Oe,Ee]}(_,B,O,P);return function(K,ie,fe){let we=1/0;Jp(fe,ie)&&(we=Fb(fe,ie[0]));for(let Oe=0;Oeh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new ge,this.layoutVertexArray2=new re,this.indexArray=new Ke,this.programConfigurations=new Mr(o.layers,o.zoom),this.segments=new dt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=t0("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),x=!_.isConstant(),w=[];for(const{feature:I,id:P,index:D,sourceLayerIndex:O}of o){const B=this.layers[0]._featureFilter.needGeometry,H=Xl(I,B);if(!this.layers[0]._featureFilter.filter(new wr(this.zoom),H,p))continue;const $=x?_.evaluate(H,{},p):void 0,K={id:P,properties:I.properties,type:I.type,sourceLayerIndex:O,index:D,geometry:B?H.geometry:Zl(I),patterns:{},sortKey:$};w.push(K)}x&&w.sort((I,P)=>I.sortKey-P.sortKey);for(const I of w){const{geometry:P,index:D,sourceLayerIndex:O}=I;if(this.hasPattern){const B=n0("line",this.layers,I,this.zoom,h);this.patternFeatures.push(B)}else this.addFeature(I,P,D,p,{});h.featureIndex.insert(o[D].feature,P,D,O,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,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,RL)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,kL),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,h,p,_,x){const w=this.layers[0].layout,I=w.get("line-join").evaluate(o,{}),P=w.get("line-cap"),D=w.get("line-miter-limit"),O=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const B of h)this.addLine(B,o,I,P,D,O);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,x,_)}addLine(o,h,p,_,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let we=0;we=2&&o[P-1].equals(o[P-2]);)P--;let D=0;for(;D0;if(St&&we>D){const ht=H.dist($);if(ht>2*O){const Pt=H.sub(H.sub($)._mult(O/ht)._round());this.updateDistance($,Pt),this.addCurrentVertex(Pt,ie,0,0,B),$=Pt}}const wt=$&&K;let bt=wt?p:I?"butt":_;if(wt&&bt==="round"&&(Qex&&(bt="bevel"),bt==="bevel"&&(Qe>2&&(bt="flipbevel"),Qe100)Oe=fe.mult(-1);else{const ht=Qe*ie.add(fe).mag()/ie.sub(fe).mag();Oe._perp()._mult(ht*(Dt?-1:1))}this.addCurrentVertex(H,Oe,0,0,B),this.addCurrentVertex(H,Oe.mult(-1),0,0,B)}else if(bt==="bevel"||bt==="fakeround"){const ht=-Math.sqrt(Qe*Qe-1),Pt=Dt?ht:0,gt=Dt?0:ht;if($&&this.addCurrentVertex(H,ie,Pt,gt,B),bt==="fakeround"){const st=Math.round(180*et/Math.PI/20);for(let Gt=1;Gt2*O){const Pt=H.add(K.sub(H)._mult(O/ht)._round());this.updateDistance(H,Pt),this.addCurrentVertex(Pt,fe,0,0,B),H=Pt}}}}addCurrentVertex(o,h,p,_,x,w=!1){const I=h.y*_-h.x,P=-h.y-h.x*_;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,w,!1,p,x),this.addHalfVertex(o,I,P,w,!0,-_,x),this.distance>Bb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,_,x,w))}addHalfVertex({x:o,y:h},p,_,x,w,I,P){const D=.5*(this.lineClips?this.scaledDistance*(Bb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(x?1:0),(h<<1)+(w?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(I===0?0:I<0?-1:1)|(63&D)<<2,D>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const O=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,O),P.primitiveLength++),w?this.e2=O:this.e1=O}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let Vb,Ub;It("LineBucket",s0,{omit:["layers","patternFeatures"]});var jb={get paint(){return Ub=Ub||new To({"line-opacity":new qt(Re.paint_line["line-opacity"]),"line-color":new qt(Re.paint_line["line-color"]),"line-translate":new Ot(Re.paint_line["line-translate"]),"line-translate-anchor":new Ot(Re.paint_line["line-translate-anchor"]),"line-width":new qt(Re.paint_line["line-width"]),"line-gap-width":new qt(Re.paint_line["line-gap-width"]),"line-offset":new qt(Re.paint_line["line-offset"]),"line-blur":new qt(Re.paint_line["line-blur"]),"line-dasharray":new Dc(Re.paint_line["line-dasharray"]),"line-pattern":new Zh(Re.paint_line["line-pattern"]),"line-gradient":new Up(Re.paint_line["line-gradient"])})},get layout(){return Vb=Vb||new To({"line-cap":new Ot(Re.layout_line["line-cap"]),"line-join":new qt(Re.layout_line["line-join"]),"line-miter-limit":new Ot(Re.layout_line["line-miter-limit"]),"line-round-limit":new Ot(Re.layout_line["line-round-limit"]),"line-sort-key":new qt(Re.layout_line["line-sort-key"])})}};class zL extends qt{possiblyEvaluate(o,h){return h=new wr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,_){return h=ae({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,_)}}let wg;class FL extends As{constructor(o){super(o,jb),this.gradientVersion=0,wg||(wg=new zL(jb.paint.properties["line-width"].specification),wg.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Ic,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=wg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new s0(o)}queryRadius(o){const h=o,p=Gb(td("line-width",this,h),td("line-gap-width",this,h)),_=td("line-offset",this,h);return p/2+Math.abs(_)+mg(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,_,x,w,I){const P=gg(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,I),D=I/2*Gb(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),O=this.paint.get("line-offset").evaluate(h,p);return O&&(_=function(B,H){const $=[];for(let K=0;K=3){for(let fe=0;fe0?o+2*u:u}const BL=ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),VL=ei([{name:"a_projected_pos",components:3,type:"Float32"}],4);ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const UL=ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ei([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const qb=ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),jL=ei([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function GL(u,o,h){return u.sections.forEach(p=>{p.text=function(_,x,w){const I=x.layout.get("text-transform").evaluate(w,{});return I==="uppercase"?_=_.toLocaleUpperCase():I==="lowercase"&&(_=_.toLocaleLowerCase()),al.applyArabicShaping&&(_=al.applyArabicShaping(_)),_}(p.text,o,h)}),u}ei([{name:"triangle",components:3,type:"Uint16"}]),ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ei([{type:"Float32",name:"offsetX"}]),ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ei([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const cd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var bi=24,Wb=tr,Hb=function(u,o,h,p,_){var x,w,I=8*_-p-1,P=(1<>1,O=-7,B=h?_-1:0,H=h?-1:1,$=u[o+B];for(B+=H,x=$&(1<<-O)-1,$>>=-O,O+=I;O>0;x=256*x+u[o+B],B+=H,O-=8);for(w=x&(1<<-O)-1,x>>=-O,O+=p;O>0;w=256*w+u[o+B],B+=H,O-=8);if(x===0)x=1-D;else{if(x===P)return w?NaN:1/0*($?-1:1);w+=Math.pow(2,p),x-=D}return($?-1:1)*w*Math.pow(2,x-p)},Zb=function(u,o,h,p,_,x){var w,I,P,D=8*x-_-1,O=(1<>1,H=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,$=p?0:x-1,K=p?1:-1,ie=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(I=isNaN(o)?1:0,w=O):(w=Math.floor(Math.log(o)/Math.LN2),o*(P=Math.pow(2,-w))<1&&(w--,P*=2),(o+=w+B>=1?H/P:H*Math.pow(2,1-B))*P>=2&&(w++,P/=2),w+B>=O?(I=0,w=O):w+B>=1?(I=(o*P-1)*Math.pow(2,_),w+=B):(I=o*Math.pow(2,B-1)*Math.pow(2,_),w=0));_>=8;u[h+$]=255&I,$+=K,I/=256,_-=8);for(w=w<<_|I,D+=_;D>0;u[h+$]=255&w,$+=K,w/=256,D-=8);u[h+$-K]|=128*ie};function tr(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}tr.Varint=0,tr.Fixed64=1,tr.Bytes=2,tr.Fixed32=5;var a0=4294967296,Xb=1/a0,$b=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function $l(u){return u.type===tr.Bytes?u.readVarint()+u.pos:u.pos+1}function lf(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function Yb(u,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=u;_--)h.buf[_+p]=h.buf[_]}function qL(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function Kb(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}tr.prototype={destroy:function(){this.buf=null},readFields:function(u,o,h){for(h=h||this.length;this.pos>3,x=this.pos;this.type=7&p,u(_,o,this),this.pos===x&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=Sg(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=Kb(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=Sg(this.buf,this.pos)+Sg(this.buf,this.pos+4)*a0;return this.pos+=8,u},readSFixed64:function(){var u=Sg(this.buf,this.pos)+Kb(this.buf,this.pos+4)*a0;return this.pos+=8,u},readFloat:function(){var u=Hb(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=Hb(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(_,x,w){var I,P,D=w.buf;if(I=(112&(P=D[w.pos++]))>>4,P<128||(I|=(127&(P=D[w.pos++]))<<3,P<128)||(I|=(127&(P=D[w.pos++]))<<10,P<128)||(I|=(127&(P=D[w.pos++]))<<17,P<128)||(I|=(127&(P=D[w.pos++]))<<24,P<128)||(I|=(1&(P=D[w.pos++]))<<31,P<128))return lf(_,I,x);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=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&&$b?function(h,p,_){return $b.decode(h.subarray(p,_))}(this.buf,o,u):function(h,p,_){for(var x="",w=p;w<_;){var I,P,D,O=h[w],B=null,H=O>239?4:O>223?3:O>191?2:1;if(w+H>_)break;H===1?O<128&&(B=O):H===2?(192&(I=h[w+1]))==128&&(B=(31&O)<<6|63&I)<=127&&(B=null):H===3?(P=h[w+2],(192&(I=h[w+1]))==128&&(192&P)==128&&((B=(15&O)<<12|(63&I)<<6|63&P)<=2047||B>=55296&&B<=57343)&&(B=null)):H===4&&(P=h[w+2],D=h[w+3],(192&(I=h[w+1]))==128&&(192&P)==128&&(192&D)==128&&((B=(15&O)<<18|(63&I)<<12|(63&P)<<6|63&D)<=65535||B>=1114112)&&(B=null)),B===null?(B=65533,H=1):B>65535&&(B-=65536,x+=String.fromCharCode(B>>>10&1023|55296),B=56320|1023&B),x+=String.fromCharCode(B),w+=H}return x}(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!==tr.Bytes)return u.push(this.readVarint(o));var h=$l(this);for(u=u||[];this.pos127;);else if(o===tr.Bytes)this.pos=this.readVarint()+this.pos;else if(o===tr.Fixed32)this.pos+=4;else{if(o!==tr.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,h){var p,_;if(o>=0?(p=o%4294967296|0,_=o/4294967296|0):(_=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,_=_+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(x,w,I){I.buf[I.pos++]=127&x|128,x>>>=7,I.buf[I.pos++]=127&x|128,x>>>=7,I.buf[I.pos++]=127&x|128,x>>>=7,I.buf[I.pos++]=127&x|128,I.buf[I.pos]=127&(x>>>=7)}(p,0,h),function(x,w){var I=(7&x)<<4;w.buf[w.pos++]|=I|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(_,h)}(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,_,x){for(var w,I,P=0;P<_.length;P++){if((w=_.charCodeAt(P))>55295&&w<57344){if(!I){w>56319||P+1===_.length?(p[x++]=239,p[x++]=191,p[x++]=189):I=w;continue}if(w<56320){p[x++]=239,p[x++]=191,p[x++]=189,I=w;continue}w=I-55296<<10|w-56320|65536,I=null}else I&&(p[x++]=239,p[x++]=191,p[x++]=189,I=null);w<128?p[x++]=w:(w<2048?p[x++]=w>>6|192:(w<65536?p[x++]=w>>12|224:(p[x++]=w>>18|240,p[x++]=w>>12&63|128),p[x++]=w>>6&63|128),p[x++]=63&w|128)}return x}(this.buf,u,this.pos);var h=this.pos-o;h>=128&&Yb(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),Zb(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),Zb(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 h=0;h=128&&Yb(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,h){this.writeTag(u,tr.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,qL,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,WL,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,XL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,HL,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,ZL,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,$L,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,YL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,KL,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,JL,o)},writeBytesField:function(u,o){this.writeTag(u,tr.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,tr.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,tr.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,tr.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,tr.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,tr.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,tr.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,tr.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,tr.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,tr.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var l0=d(Wb);const u0=3;function QL(u,o,h){u===1&&h.readMessage(eP,o)}function eP(u,o,h){if(u===3){const{id:p,bitmap:_,width:x,height:w,left:I,top:P,advance:D}=h.readMessage(tP,{});o.push({id:p,bitmap:new rd({width:x+2*u0,height:w+2*u0},_),metrics:{width:x,height:w,left:I,top:P,advance:D}})}}function tP(u,o,h){u===1?o.id=h.readVarint():u===2?o.bitmap=h.readBytes():u===3?o.width=h.readVarint():u===4?o.height=h.readVarint():u===5?o.left=h.readSVarint():u===6?o.top=h.readSVarint():u===7&&(o.advance=h.readVarint())}const Jb=u0;function Qb(u){let o=0,h=0;for(const w of u)o+=w.w*w.h,h=Math.max(h,w.w);u.sort((w,I)=>I.h-w.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let _=0,x=0;for(const w of u)for(let I=p.length-1;I>=0;I--){const P=p[I];if(!(w.w>P.w||w.h>P.h)){if(w.x=P.x,w.y=P.y,x=Math.max(x,w.y+w.h),_=Math.max(_,w.x+w.w),w.w===P.w&&w.h===P.h){const D=p.pop();I=0&&p>=o&&Ig[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new cf;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push(fd.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Eg(u,o,h,p,_,x,w,I,P,D,O,B,H,$,K,ie){const fe=cf.fromFeature(u,_);let we;B===c.ah.vertical&&fe.verticalizePunctuation();const{processBidirectionalText:Oe,processStyledBidirectionalText:Ee}=al;if(Oe&&fe.sections.length===1){we=[];const et=Oe(fe.toString(),h0(fe,D,x,o,p,$,K));for(const St of et){const Dt=new cf;Dt.text=St,Dt.sections=fe.sections;for(let wt=0;wt0&&Kl>Yo&&(Yo=Kl)}else{const Rs=Dt[In.fontStack],Jo=Rs&&Rs[Yi];if(Jo&&Jo.rect)Ra=Jo.rect,oa=Jo.metrics;else{const Kl=St[In.fontStack],_d=Kl&&Kl[Yi];if(!_d)continue;oa=_d.metrics}Ii=(Si-In.scale)*bi}sa?(et.verticalizable=!0,po.push({glyph:Yi,imageName:Na,x:dr,y:Er+Ii,vertical:sa,scale:In.scale,fontStack:In.fontStack,sectionIndex:mo,metrics:oa,rect:Ra}),dr+=Yl*In.scale+Gt):(po.push({glyph:Yi,imageName:Na,x:dr,y:Er+Ii,vertical:sa,scale:In.scale,fontStack:In.fontStack,sectionIndex:mo,metrics:oa,rect:Ra}),dr+=oa.advance*In.scale+Gt)}po.length!==0&&(xi=Math.max(dr-Gt,xi),iP(po,0,po.length-1,Po,Yo)),dr=0;const Ko=ht*Si+Yo;ko.lineOffset=Math.max(Yo,fo),Er+=Ko,ms=Math.max(Ko,ms),++gi}var Vi;const $i=Er-hd,{horizontalAlign:Mo,verticalAlign:Ao}=f0(Pt);(function(wi,Si,fo,ko,po,Yo,Ko,Ei,In){const mo=(Si-fo)*po;let Yi=0;Yi=Yo!==Ko?-Ei*ko-hd:(-ko*In+.5)*Ko;for(const Ii of wi)for(const oa of Ii.positionedGlyphs)oa.x+=mo,oa.y+=Yi})(et.positionedLines,Po,Mo,Ao,xi,ms,ht,$i,bt.length),et.top+=-Ao*$i,et.bottom=et.top+$i,et.left+=-Mo*xi,et.right=et.left+xi}(Qe,o,h,p,we,w,I,P,B,D,H,ie),!function(et){for(const St of et)if(St.positionedGlyphs.length!==0)return!1;return!0}(Ae)&&Qe}const Ig={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},nP={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 tx(u,o,h,p,_,x){if(o.imageName){const w=p[o.imageName];return w?w.displaySize[0]*o.scale*bi/x+_:0}{const w=h[o.fontStack],I=w&&w[u];return I?I.metrics.advance*o.scale+_:0}}function nx(u,o,h,p){const _=Math.pow(u-o,2);return p?u=0;let O=0;for(let H=0;Hw.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=Zy([]),this.placementViewportMatrix=Zy([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=sx(this.zoom,h["text-size"]),this.iconSizeData=sx(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),x=p.get("symbol-z-order");this.canOverlap=p0(p,"text-overlap","text-allow-overlap")!=="never"||p0(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(w=>c.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new m0(new Mr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new m0(new Mr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new b,this.lineVertexArray=new T,this.symbolInstances=new g,this.textAnchorOffsets=new A}calculateGlyphDependencies(o,h,p,_,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),O=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,B=x.get("symbol-sort-key");if(this.features=[],!D&&!O)return;const H=h.iconDependencies,$=h.glyphDependencies,K=h.availableImages,ie=new wr(this.zoom);for(const{feature:fe,id:we,index:Oe,sourceLayerIndex:Ee}of o){const Ae=_._featureFilter.needGeometry,Qe=Xl(fe,Ae);if(!_._featureFilter.filter(ie,Qe,p))continue;let et,St;if(Ae||(Qe.geometry=Zl(fe)),D){const wt=_.getValueAndResolveTokens("text-field",Qe,p,K),bt=qo.factory(wt),ht=this.hasRTLText=this.hasRTLText||lP(bt);(!ht||al.getRTLTextPluginStatus()==="unavailable"||ht&&al.isParsed())&&(et=GL(bt,_,Qe))}if(O){const wt=_.getValueAndResolveTokens("icon-image",Qe,p,K);St=wt instanceof fs?wt:fs.fromString(wt)}if(!et&&!St)continue;const Dt=this.sortFeaturesByKey?B.evaluate(Qe,{},p):void 0;if(this.features.push({id:we,text:et,icon:St,index:Oe,sourceLayerIndex:Ee,geometry:Qe.geometry,properties:fe.properties,type:sP[fe.type],sortKey:Dt}),St&&(H[St.name]=!0),et){const wt=w.evaluate(Qe,{},p).join(","),bt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ah.vertical)>=0;for(const ht of et.sections)if(ht.image)H[ht.image.name]=!0;else{const Pt=Ru(et.toString()),gt=ht.fontStack||wt,st=$[gt]=$[gt]||{};this.calculateGlyphDependencies(ht.text,st,bt,this.allowVerticalPlacement,Pt)}}}x.get("symbol-placement")==="line"&&(this.features=function(fe){const we={},Oe={},Ee=[];let Ae=0;function Qe(wt){Ee.push(fe[wt]),Ae++}function et(wt,bt,ht){const Pt=Oe[wt];return delete Oe[wt],Oe[bt]=Pt,Ee[Pt].geometry[0].pop(),Ee[Pt].geometry[0]=Ee[Pt].geometry[0].concat(ht[0]),Pt}function St(wt,bt,ht){const Pt=we[bt];return delete we[bt],we[wt]=Pt,Ee[Pt].geometry[0].shift(),Ee[Pt].geometry[0]=ht[0].concat(Ee[Pt].geometry[0]),Pt}function Dt(wt,bt,ht){const Pt=ht?bt[0][bt[0].length-1]:bt[0][0];return`${wt}:${Pt.x}:${Pt.y}`}for(let wt=0;wtwt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((fe,we)=>fe.sortKey-we.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,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,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let _=o.dist(h[o.segment+1]),x=o.dist(h[o.segment]);const w={};for(let I=o.segment+1;I=0;I--)w[I]={x:h[I].x,y:h[I].y,tileUnitDistanceFromAnchor:x},I>0&&(x+=h[I-1].dist(h[I]));for(let I=0;I0}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,h){const p=o.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let x=p.vertexStartIndex;x<_;x+=4)o.indexArray.emplaceBack(x,x+1,x+2),o.indexArray.emplaceBack(x+1,x+2,x+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),_=[],x=[],w=[];for(let I=0;I_[I]-_[P]||x[P]-x[I]),w}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,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 h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,x,w)=>{_>=0&&w.indexOf(_)===x&&this.addIndicesForPlacedSymbol(this.text,_)}),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 ax,lx;It("SymbolBucket",hf,{omit:["layers","collisionBoxArray","features","compareText"]}),hf.MAX_GLYPHS=65535,hf.addDynamicAttributes=d0;var _0={get paint(){return lx=lx||new To({"icon-opacity":new qt(Re.paint_symbol["icon-opacity"]),"icon-color":new qt(Re.paint_symbol["icon-color"]),"icon-halo-color":new qt(Re.paint_symbol["icon-halo-color"]),"icon-halo-width":new qt(Re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qt(Re.paint_symbol["icon-halo-blur"]),"icon-translate":new Ot(Re.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ot(Re.paint_symbol["icon-translate-anchor"]),"text-opacity":new qt(Re.paint_symbol["text-opacity"]),"text-color":new qt(Re.paint_symbol["text-color"],{runtimeType:Wr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new qt(Re.paint_symbol["text-halo-color"]),"text-halo-width":new qt(Re.paint_symbol["text-halo-width"]),"text-halo-blur":new qt(Re.paint_symbol["text-halo-blur"]),"text-translate":new Ot(Re.paint_symbol["text-translate"]),"text-translate-anchor":new Ot(Re.paint_symbol["text-translate-anchor"])})},get layout(){return ax=ax||new To({"symbol-placement":new Ot(Re.layout_symbol["symbol-placement"]),"symbol-spacing":new Ot(Re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ot(Re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new qt(Re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ot(Re.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ot(Re.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ot(Re.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ot(Re.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ot(Re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ot(Re.layout_symbol["icon-rotation-alignment"]),"icon-size":new qt(Re.layout_symbol["icon-size"]),"icon-text-fit":new Ot(Re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ot(Re.layout_symbol["icon-text-fit-padding"]),"icon-image":new qt(Re.layout_symbol["icon-image"]),"icon-rotate":new qt(Re.layout_symbol["icon-rotate"]),"icon-padding":new qt(Re.layout_symbol["icon-padding"]),"icon-keep-upright":new Ot(Re.layout_symbol["icon-keep-upright"]),"icon-offset":new qt(Re.layout_symbol["icon-offset"]),"icon-anchor":new qt(Re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ot(Re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ot(Re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ot(Re.layout_symbol["text-rotation-alignment"]),"text-field":new qt(Re.layout_symbol["text-field"]),"text-font":new qt(Re.layout_symbol["text-font"]),"text-size":new qt(Re.layout_symbol["text-size"]),"text-max-width":new qt(Re.layout_symbol["text-max-width"]),"text-line-height":new Ot(Re.layout_symbol["text-line-height"]),"text-letter-spacing":new qt(Re.layout_symbol["text-letter-spacing"]),"text-justify":new qt(Re.layout_symbol["text-justify"]),"text-radial-offset":new qt(Re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ot(Re.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new qt(Re.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new qt(Re.layout_symbol["text-anchor"]),"text-max-angle":new Ot(Re.layout_symbol["text-max-angle"]),"text-writing-mode":new Ot(Re.layout_symbol["text-writing-mode"]),"text-rotate":new qt(Re.layout_symbol["text-rotate"]),"text-padding":new Ot(Re.layout_symbol["text-padding"]),"text-keep-upright":new Ot(Re.layout_symbol["text-keep-upright"]),"text-transform":new qt(Re.layout_symbol["text-transform"]),"text-offset":new qt(Re.layout_symbol["text-offset"]),"text-allow-overlap":new Ot(Re.layout_symbol["text-allow-overlap"]),"text-overlap":new Ot(Re.layout_symbol["text-overlap"]),"text-ignore-placement":new Ot(Re.layout_symbol["text-ignore-placement"]),"text-optional":new Ot(Re.layout_symbol["text-optional"])})}};class ux{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:ci,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.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}}It("FormatSectionOverride",ux,{omit:["defaultValue"]});class Tg extends As{constructor(o){super(o,_0)}recalculate(o,h){if(super.recalculate(o,h),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 _=[];for(const x of p)_.indexOf(x)<0&&_.push(x);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,_){const x=this.layout.get(o).evaluate(h,{},p,_),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||sr(w.value)||!x?x:function(I,P){return P.replace(/{([^{}]+)}/g,(D,O)=>I&&O in I?String(I[O]):"")}(h.properties,x)}createBucket(o){return new hf(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of _0.paint.overridableProperties){if(!Tg.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new ux(h),_=new pr(p,h.property.specification);let x=null;x=h.value.kind==="constant"||h.value.kind==="source"?new Dh("source",_):new Mp("composite",_,h.value.zoomStops),this.paint._values[o]=new Ms(h.property,x,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Tg.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),_=_0.paint.properties[h];let x=!1;const w=I=>{for(const P of I)if(_.overrides&&_.overrides.hasOverride(P))return void(x=!0)};if(p.value.kind==="constant"&&p.value.value instanceof qo)w(p.value.value.sections);else if(p.value.kind==="source"){const I=D=>{x||(D instanceof nl&&fi(D.value)===Jr?w(D.value.sections):D instanceof Ah?w(D.sections):D.eachChild(I))},P=p.value;P._styleExpression&&I(P._styleExpression.expression)}return x}}let cx;var uP={get paint(){return cx=cx||new To({"background-color":new Ot(Re.paint_background["background-color"]),"background-pattern":new Dc(Re.paint_background["background-pattern"]),"background-opacity":new Ot(Re.paint_background["background-opacity"])})}};class cP extends As{constructor(o){super(o,uP)}}let hx;var hP={get paint(){return hx=hx||new To({"raster-opacity":new Ot(Re.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ot(Re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ot(Re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ot(Re.paint_raster["raster-brightness-max"]),"raster-saturation":new Ot(Re.paint_raster["raster-saturation"]),"raster-contrast":new Ot(Re.paint_raster["raster-contrast"]),"raster-resampling":new Ot(Re.paint_raster["raster-resampling"]),"raster-fade-duration":new Ot(Re.paint_raster["raster-fade-duration"])})}};class fP extends As{constructor(o){super(o,hP)}}class pP extends As{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.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 dP{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const y0=63710088e-1;class Bu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Bu(de(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,_=o.lat*h,x=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((o.lng-this.lng)*h);return y0*Math.acos(Math.min(x,1))}static convert(o){if(o instanceof Bu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Bu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Bu(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 fx=2*Math.PI*y0;function px(u){return fx*Math.cos(u*Math.PI/180)}function dx(u){return(180+u)/360}function mx(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function gx(u,o){return u/px(o)}function v0(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class Lg{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=Bu.convert(o);return new Lg(dx(p.lng),mx(p.lat),gx(h,p.lat))}toLngLat(){return new Bu(360*this.x-180,v0(this.y))}toAltitude(){return this.z*px(v0(this.y))}meterInMercatorCoordinateUnits(){return 1/fx*(o=v0(this.y),1/Math.cos(o*Math.PI/180));var o}}function _x(u,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class b0{constructor(o,h,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||h<0||h>=Math.pow(2,o))throw new Error(`x=${h}, 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=h,this.y=p,this.key=dd(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const _=(w=this.y,I=this.z,P=_x(256*(x=this.x),256*(w=Math.pow(2,I)-w-1),I),D=_x(256*(x+1),256*(w+1),I),P[0]+","+P[1]+","+D[0]+","+D[1]);var x,w,I,P,D;const O=function(B,H,$){let K,ie="";for(let fe=B;fe>0;fe--)K=1<1?"@2x":"").replace(/{quadkey}/g,O).replace(/{bbox-epsg-3857}/g,_)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new E((o.x*h-this.x)*Hr,(o.y*h-this.y)*Hr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class yx{constructor(o,h){this.wrap=o,this.canonical=h,this.key=dd(o,h.z,h.z,h.x,h.y)}}class Ds{constructor(o,h,p,_,x){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new b0(p,+_,+x),this.key=dd(h,o,p,_,x)}clone(){return new Ds(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 h=this.canonical.z-o;return o>this.canonical.z?new Ds(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ds(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){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?dd(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):dd(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new Ds(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new Ds(h,this.wrap,h,p,_),new Ds(h,this.wrap,h,p+1,_),new Ds(h,this.wrap,h,p,_+1),new Ds(h,this.wrap,h,p+1,_+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||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new ks({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,x=h*this.dim+this.dim,w=p*this.dim,I=p*this.dim+this.dim;switch(h){case-1:_=x-1;break;case 1:x=_+1}switch(p){case-1:w=I-1;break;case 1:I=w+1}const P=-h*this.dim,D=-p*this.dim;for(let O=w;O=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 xx{constructor(o,h,p,_,x){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=_,this.properties=o.properties,this.id=x}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 h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class wx{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new Mc(Hr,16,0),this.grid3D=new Mc(Hr,16,0),this.featureIndexArray=new V,this.promoteId=h}insert(o,h,p,_,x,w){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,x);const P=w?this.grid3D:this.grid;for(let D=0;D=0&&B[3]>=0&&P.insert(I,B[0],B[1],B[2],B[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ou.VectorTile(new l0(this.rawTileData)).layers,this.sourceLayerCoder=new bx(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,_){this.loadVTLayers();const x=o.params||{},w=Hr/o.tileSize/o.scale,I=zh(x.filter),P=o.queryGeometry,D=o.queryPadding*w,O=Ex(P),B=this.grid.query(O.minX-D,O.minY-D,O.maxX+D,O.maxY+D),H=Ex(o.cameraQueryGeometry),$=this.grid3D.query(H.minX-D,H.minY-D,H.maxX+D,H.maxY+D,(fe,we,Oe,Ee)=>function(Ae,Qe,et,St,Dt){for(const bt of Ae)if(Qe<=bt.x&&et<=bt.y&&St>=bt.x&&Dt>=bt.y)return!0;const wt=[new E(Qe,et),new E(Qe,Dt),new E(St,Dt),new E(St,et)];if(Ae.length>2){for(const bt of wt)if(rf(Ae,bt))return!0}for(let bt=0;bt(Ee||(Ee=Zl(Ae)),Qe.queryIntersectsFeature(P,Ae,et,Ee,this.z,o.transform,w,o.pixelPosMatrix)))}return K}loadMatchingFeature(o,h,p,_,x,w,I,P,D,O,B){const H=this.bucketLayerIDs[h];if(w&&!function(fe,we){for(let Oe=0;Oe=0)return!0;return!1}(w,H))return;const $=this.sourceLayerCoder.decode(p),K=this.vtLayers[$].feature(_);if(x.needGeometry){const fe=Xl(K,!0);if(!x.filter(new wr(this.tileID.overscaledZ),fe,this.tileID.canonical))return}else if(!x.filter(new wr(this.tileID.overscaledZ),K))return;const ie=this.getId(K,$);for(let fe=0;fe{const I=o instanceof kc?o.get(w):null;return I&&I.evaluate?I.evaluate(h,p,_):I})}function Ex(u){let o=1/0,h=1/0,p=-1/0,_=-1/0;for(const x of u)o=Math.min(o,x.x),h=Math.min(h,x.y),p=Math.max(p,x.x),_=Math.max(_,x.y);return{minX:o,minY:h,maxX:p,maxY:_}}function mP(u,o){return o-u}function Ix(u,o,h,p,_){const x=[];for(let w=0;w=p&&B.x>=p||(O.x>=p?O=new E(p,O.y+(p-O.x)/(B.x-O.x)*(B.y-O.y))._round():B.x>=p&&(B=new E(p,O.y+(p-O.x)/(B.x-O.x)*(B.y-O.y))._round()),O.y>=_&&B.y>=_||(O.y>=_?O=new E(O.x+(_-O.y)/(B.y-O.y)*(B.x-O.x),_)._round():B.y>=_&&(B=new E(O.x+(_-O.y)/(B.y-O.y)*(B.x-O.x),_)._round()),P&&O.equals(P[P.length-1])||(P=[O],x.push(P)),P.push(B)))))}}return x}It("FeatureIndex",wx,{omit:["rawTileData","sourceLayerCoder"]});class Vu extends E{constructor(o,h,p,_){super(o,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new Vu(this.x,this.y,this.angle,this.segment)}}function Cx(u,o,h,p,_){if(o.segment===void 0||h===0)return!0;let x=o,w=o.segment+1,I=0;for(;I>-h/2;){if(w--,w<0)return!1;I-=u[w].dist(x),x=u[w]}I+=u[w].dist(u[w+1]),w++;const P=[];let D=0;for(;Ip;)D-=P.shift().angleDelta;if(D>_)return!1;w++,I+=O.dist(B)}return!0}function Tx(u){let o=0;for(let h=0;hD){const K=(D-P)/$,ie=co.number(B.x,H.x,K),fe=co.number(B.y,H.y,K),we=new Vu(ie,fe,H.angleTo(B),O);return we._round(),!w||Cx(u,we,I,w,o)?we:void 0}P+=$}}function _P(u,o,h,p,_,x,w,I,P){const D=Lx(p,x,w),O=Px(p,_),B=O*w,H=u[0].x===0||u[0].x===P||u[0].y===0||u[0].y===P;return o-B=0&&Ae=0&&Qe=0&&H+D<=O){const et=new Vu(Ae,Qe,Oe,K);et._round(),p&&!Cx(u,et,x,p,_)||$.push(et)}}B+=we}return I||$.length||w||($=Mx(u,B/2,h,p,_,x,w,!0,P)),$}It("Anchor",Vu);const ff=$o;function Ax(u,o,h,p){const _=[],x=u.image,w=x.pixelRatio,I=x.paddedRect.w-2*ff,P=x.paddedRect.h-2*ff,D=u.right-u.left,O=u.bottom-u.top,B=x.stretchX||[[0,I]],H=x.stretchY||[[0,P]],$=(ht,Pt)=>ht+Pt[1]-Pt[0],K=B.reduce($,0),ie=H.reduce($,0),fe=I-K,we=P-ie;let Oe=0,Ee=K,Ae=0,Qe=ie,et=0,St=fe,Dt=0,wt=we;if(x.content&&p){const ht=x.content;Oe=Pg(B,0,ht[0]),Ae=Pg(H,0,ht[1]),Ee=Pg(B,ht[0],ht[2]),Qe=Pg(H,ht[1],ht[3]),et=ht[0]-Oe,Dt=ht[1]-Ae,St=ht[2]-ht[0]-Ee,wt=ht[3]-ht[1]-Qe}const bt=(ht,Pt,gt,st)=>{const Gt=Mg(ht.stretch-Oe,Ee,D,u.left),Nt=Ag(ht.fixed-et,St,ht.stretch,K),xn=Mg(Pt.stretch-Ae,Qe,O,u.top),dr=Ag(Pt.fixed-Dt,wt,Pt.stretch,ie),Er=Mg(gt.stretch-Oe,Ee,D,u.left),xi=Ag(gt.fixed-et,St,gt.stretch,K),ms=Mg(st.stretch-Ae,Qe,O,u.top),Po=Ag(st.fixed-Dt,wt,st.stretch,ie),gi=new E(Gt,xn),Vi=new E(Er,xn),$i=new E(Er,ms),Mo=new E(Gt,ms),Ao=new E(Nt/w,dr/w),wi=new E(xi/w,Po/w),Si=o*Math.PI/180;if(Si){const po=Math.sin(Si),Yo=Math.cos(Si),Ko=[Yo,-po,po,Yo];gi._matMult(Ko),Vi._matMult(Ko),Mo._matMult(Ko),$i._matMult(Ko)}const fo=ht.stretch+ht.fixed,ko=Pt.stretch+Pt.fixed;return{tl:gi,tr:Vi,bl:Mo,br:$i,tex:{x:x.paddedRect.x+ff+fo,y:x.paddedRect.y+ff+ko,w:gt.stretch+gt.fixed-fo,h:st.stretch+st.fixed-ko},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ao,pixelOffsetBR:wi,minFontScaleX:St/w/D,minFontScaleY:wt/w/O,isSDF:h}};if(p&&(x.stretchX||x.stretchY)){const ht=kx(B,fe,K),Pt=kx(H,we,ie);for(let gt=0;gt0&&(K=Math.max(10,K),this.circleDiameter=K)}else{let B=w.top*I-P[0],H=w.bottom*I+P[2],$=w.left*I-P[3],K=w.right*I+P[1];const ie=w.collisionPadding;if(ie&&($-=ie[0]*I,B-=ie[1]*I,K+=ie[2]*I,H+=ie[3]*I),O){const fe=new E($,B),we=new E(K,B),Oe=new E($,H),Ee=new E(K,H),Ae=O*Math.PI/180;fe._rotate(Ae),we._rotate(Ae),Oe._rotate(Ae),Ee._rotate(Ae),$=Math.min(fe.x,we.x,Oe.x,Ee.x),K=Math.max(fe.x,we.x,Oe.x,Ee.x),B=Math.min(fe.y,we.y,Oe.y,Ee.y),H=Math.max(fe.y,we.y,Oe.y,Ee.y)}o.emplaceBack(h.x,h.y,$,B,K,H,p,_,x)}this.boxEndIndex=o.length}}class yP{constructor(o=[],h=vP){if(this.data=o,this.length=this.data.length,this.compare=h,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],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,_=h[o];for(;o>0;){const x=o-1>>1,w=h[x];if(p(_,w)>=0)break;h[o]=w,o=x}h[o]=_}_down(o){const{data:h,compare:p}=this,_=this.length>>1,x=h[o];for(;o<_;){let w=1+(o<<1),I=h[w];const P=w+1;if(P=0)break;h[o]=I,o=w}h[o]=x}}function vP(u,o){return uo?1:0}function bP(u,o=1,h=!1){let p=1/0,_=1/0,x=-1/0,w=-1/0;const I=u[0];for(let $=0;$x)&&(x=K.x),(!$||K.y>w)&&(w=K.y)}const P=Math.min(x-p,w-_);let D=P/2;const O=new yP([],xP);if(P===0)return new E(p,_);for(let $=p;$B.d||!B.d)&&(B=$,h&&console.log("found best %d after %d probes",Math.round(1e4*$.d)/1e4,H)),$.max-B.d<=o||(D=$.h/2,O.push(new pf($.p.x-D,$.p.y-D,D,u)),O.push(new pf($.p.x+D,$.p.y-D,D,u)),O.push(new pf($.p.x-D,$.p.y+D,D,u)),O.push(new pf($.p.x+D,$.p.y+D,D,u)),H+=4)}return h&&(console.log(`num probes: ${H}`),console.log(`best distance: ${B.d}`)),B.p}function xP(u,o){return o.max-u.max}function pf(u,o,h,p){this.p=new E(u,o),this.h=h,this.d=function(_,x){let w=!1,I=1/0;for(let P=0;P_.y!=K.y>_.y&&_.x<(K.x-$.x)*(_.y-$.y)/(K.y-$.y)+$.x&&(w=!w),I=Math.min(I,mb(_,$,K))}}return(w?1:-1)*Math.sqrt(I)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Xi;c.ap=void 0,(Xi=c.ap||(c.ap={}))[Xi.center=1]="center",Xi[Xi.left=2]="left",Xi[Xi.right=3]="right",Xi[Xi.top=4]="top",Xi[Xi.bottom=5]="bottom",Xi[Xi["top-left"]=6]="top-left",Xi[Xi["top-right"]=7]="top-right",Xi[Xi["bottom-left"]=8]="bottom-left",Xi[Xi["bottom-right"]=9]="bottom-right";const Uu=7,x0=Number.POSITIVE_INFINITY;function Dx(u,o){return o[1]!==x0?function(h,p,_){let x=0,w=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":w=_-Uu;break;case"bottom-right":case"bottom-left":case"bottom":w=-_+Uu}switch(h){case"top-right":case"bottom-right":case"right":x=-p;break;case"top-left":case"bottom-left":case"left":x=p}return[x,w]}(u,o[0],o[1]):function(h,p){let _=0,x=0;p<0&&(p=0);const w=p/Math.SQRT2;switch(h){case"top-right":case"top-left":x=w-Uu;break;case"bottom-right":case"bottom-left":x=-w+Uu;break;case"bottom":x=-p+Uu;break;case"top":x=p-Uu}switch(h){case"top-right":case"bottom-right":_=-w;break;case"top-left":case"bottom-left":_=w;break;case"left":_=p;break;case"right":_=-p}return[_,x]}(u,o[0])}function Rx(u,o,h){var p;const _=u.layout,x=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(x){const I=x.values,P=[];for(let D=0;DH*bi);O.startsWith("top")?B[1]-=Uu:O.startsWith("bottom")&&(B[1]+=Uu),P[D+1]=B}return new hs(P)}const w=_.get("text-variable-anchor");if(w){let I;I=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(o,{},h)*bi,x0]:_.get("text-offset").evaluate(o,{},h).map(D=>D*bi);const P=[];for(const D of w)P.push(D,Dx(D,I));return new hs(P)}return null}function w0(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 wP(u,o,h,p,_,x,w,I,P,D,O){let B=x.textMaxSize.evaluate(o,{});B===void 0&&(B=w);const H=u.layers[0].layout,$=H.get("icon-offset").evaluate(o,{},O),K=Ox(h.horizontal),ie=w/24,fe=u.tilePixelRatio*ie,we=u.tilePixelRatio*B/24,Oe=u.tilePixelRatio*I,Ee=u.tilePixelRatio*H.get("symbol-spacing"),Ae=H.get("text-padding")*u.tilePixelRatio,Qe=function(st,Gt,Nt,xn=1){const dr=st.get("icon-padding").evaluate(Gt,{},Nt),Er=dr&&dr.values;return[Er[0]*xn,Er[1]*xn,Er[2]*xn,Er[3]*xn]}(H,o,O,u.tilePixelRatio),et=H.get("text-max-angle")/180*Math.PI,St=H.get("text-rotation-alignment")!=="viewport"&&H.get("symbol-placement")!=="point",Dt=H.get("icon-rotation-alignment")==="map"&&H.get("symbol-placement")!=="point",wt=H.get("symbol-placement"),bt=Ee/2,ht=H.get("icon-text-fit");let Pt;p&&ht!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(Pt=ox(p,h.vertical,ht,H.get("icon-text-fit-padding"),$,ie)),K&&(p=ox(p,K,ht,H.get("icon-text-fit-padding"),$,ie)));const gt=(st,Gt)=>{Gt.x<0||Gt.x>=Hr||Gt.y<0||Gt.y>=Hr||function(Nt,xn,dr,Er,xi,ms,Po,gi,Vi,$i,Mo,Ao,wi,Si,fo,ko,po,Yo,Ko,Ei,In,mo,Yi,Ii,oa){const Ra=Nt.addToLineVertexArray(xn,dr);let Na,Yl,sa,Rs,Jo=0,Kl=0,_d=0,Vx=0,M0=-1,A0=-1;const Jl={};let Ux=Br("");if(Nt.allowVerticalPlacement&&Er.vertical){const go=gi.layout.get("text-rotate").evaluate(In,{},Ii)+90;sa=new kg(Vi,xn,$i,Mo,Ao,Er.vertical,wi,Si,fo,go),Po&&(Rs=new kg(Vi,xn,$i,Mo,Ao,Po,po,Yo,fo,go))}if(xi){const go=gi.layout.get("icon-rotate").evaluate(In,{}),Ns=gi.layout.get("icon-text-fit")!=="none",Uc=Ax(xi,go,Yi,Ns),za=Po?Ax(Po,go,Yi,Ns):void 0;Yl=new kg(Vi,xn,$i,Mo,Ao,xi,po,Yo,!1,go),Jo=4*Uc.length;const jc=Nt.iconSizeData;let fl=null;jc.kind==="source"?(fl=[hl*gi.layout.get("icon-size").evaluate(In,{})],fl[0]>Fu&&qe(`${Nt.layerIds[0]}: Value for "icon-size" is >= ${pd}. Reduce your "icon-size".`)):jc.kind==="composite"&&(fl=[hl*mo.compositeIconSizes[0].evaluate(In,{},Ii),hl*mo.compositeIconSizes[1].evaluate(In,{},Ii)],(fl[0]>Fu||fl[1]>Fu)&&qe(`${Nt.layerIds[0]}: Value for "icon-size" is >= ${pd}. Reduce your "icon-size".`)),Nt.addSymbols(Nt.icon,Uc,fl,Ei,Ko,In,c.ah.none,xn,Ra.lineStartIndex,Ra.lineLength,-1,Ii),M0=Nt.icon.placedSymbolArray.length-1,za&&(Kl=4*za.length,Nt.addSymbols(Nt.icon,za,fl,Ei,Ko,In,c.ah.vertical,xn,Ra.lineStartIndex,Ra.lineLength,-1,Ii),A0=Nt.icon.placedSymbolArray.length-1)}const jx=Object.keys(Er.horizontal);for(const go of jx){const Ns=Er.horizontal[go];if(!Na){Ux=Br(Ns.text);const za=gi.layout.get("text-rotate").evaluate(In,{},Ii);Na=new kg(Vi,xn,$i,Mo,Ao,Ns,wi,Si,fo,za)}const Uc=Ns.positionedLines.length===1;if(_d+=Nx(Nt,xn,Ns,ms,gi,fo,In,ko,Ra,Er.vertical?c.ah.horizontal:c.ah.horizontalOnly,Uc?jx:[go],Jl,M0,mo,Ii),Uc)break}Er.vertical&&(Vx+=Nx(Nt,xn,Er.vertical,ms,gi,fo,In,ko,Ra,c.ah.vertical,["vertical"],Jl,A0,mo,Ii));const IP=Na?Na.boxStartIndex:Nt.collisionBoxArray.length,CP=Na?Na.boxEndIndex:Nt.collisionBoxArray.length,TP=sa?sa.boxStartIndex:Nt.collisionBoxArray.length,LP=sa?sa.boxEndIndex:Nt.collisionBoxArray.length,PP=Yl?Yl.boxStartIndex:Nt.collisionBoxArray.length,MP=Yl?Yl.boxEndIndex:Nt.collisionBoxArray.length,AP=Rs?Rs.boxStartIndex:Nt.collisionBoxArray.length,kP=Rs?Rs.boxEndIndex:Nt.collisionBoxArray.length;let Oa=-1;const Rg=(go,Ns)=>go&&go.circleDiameter?Math.max(go.circleDiameter,Ns):Ns;Oa=Rg(Na,Oa),Oa=Rg(sa,Oa),Oa=Rg(Yl,Oa),Oa=Rg(Rs,Oa);const Gx=Oa>-1?1:0;Gx&&(Oa*=oa/bi),Nt.glyphOffsetArray.length>=hf.MAX_GLYPHS&&qe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),In.sortKey!==void 0&&Nt.addToSortKeyRanges(Nt.symbolInstances.length,In.sortKey);const DP=Rx(gi,In,Ii),[RP,NP]=function(go,Ns){const Uc=go.length,za=Ns==null?void 0:Ns.values;if((za==null?void 0:za.length)>0)for(let jc=0;jc=0?Jl.right:-1,Jl.center>=0?Jl.center:-1,Jl.left>=0?Jl.left:-1,Jl.vertical||-1,M0,A0,Ux,IP,CP,TP,LP,PP,MP,AP,kP,$i,_d,Vx,Jo,Kl,Gx,0,wi,Oa,RP,NP)}(u,Gt,st,h,p,_,Pt,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,fe,[Ae,Ae,Ae,Ae],St,P,Oe,Qe,Dt,$,o,x,D,O,w)};if(wt==="line")for(const st of Ix(o.geometry,0,0,Hr,Hr)){const Gt=_P(st,Ee,et,h.vertical||K,p,24,we,u.overscaling,Hr);for(const Nt of Gt)K&&SP(u,K.text,bt,Nt)||gt(st,Nt)}else if(wt==="line-center"){for(const st of o.geometry)if(st.length>1){const Gt=gP(st,et,h.vertical||K,p,24,we);Gt&>(st,Gt)}}else if(o.type==="Polygon")for(const st of e0(o.geometry,0)){const Gt=bP(st,16);gt(st[0],new Vu(Gt.x,Gt.y,0))}else if(o.type==="LineString")for(const st of o.geometry)gt(st,new Vu(st[0].x,st[0].y,0));else if(o.type==="Point")for(const st of o.geometry)for(const Gt of st)gt([Gt],new Vu(Gt.x,Gt.y,0))}function Nx(u,o,h,p,_,x,w,I,P,D,O,B,H,$,K){const ie=function(Oe,Ee,Ae,Qe,et,St,Dt,wt){const bt=Qe.layout.get("text-rotate").evaluate(St,{})*Math.PI/180,ht=[];for(const Pt of Ee.positionedLines)for(const gt of Pt.positionedGlyphs){if(!gt.rect)continue;const st=gt.rect||{};let Gt=Jb+1,Nt=!0,xn=1,dr=0;const Er=(et||wt)&>.vertical,xi=gt.metrics.advance*gt.scale/2;if(wt&&Ee.verticalizable&&(dr=Pt.lineOffset/2-(gt.imageName?-(bi-gt.metrics.width*gt.scale)/2:(gt.scale-1)*bi)),gt.imageName){const Ei=Dt[gt.imageName];Nt=Ei.sdf,xn=Ei.pixelRatio,Gt=$o/xn}const ms=et?[gt.x+xi,gt.y]:[0,0];let Po=et?[0,0]:[gt.x+xi+Ae[0],gt.y+Ae[1]-dr],gi=[0,0];Er&&(gi=Po,Po=[0,0]);const Vi=gt.metrics.isDoubleResolution?2:1,$i=(gt.metrics.left-Gt)*gt.scale-xi+Po[0],Mo=(-gt.metrics.top-Gt)*gt.scale+Po[1],Ao=$i+st.w/Vi*gt.scale/xn,wi=Mo+st.h/Vi*gt.scale/xn,Si=new E($i,Mo),fo=new E(Ao,Mo),ko=new E($i,wi),po=new E(Ao,wi);if(Er){const Ei=new E(-xi,xi-hd),In=-Math.PI/2,mo=bi/2-xi,Yi=new E(5-hd-mo,-(gt.imageName?mo:0)),Ii=new E(...gi);Si._rotateAround(In,Ei)._add(Yi)._add(Ii),fo._rotateAround(In,Ei)._add(Yi)._add(Ii),ko._rotateAround(In,Ei)._add(Yi)._add(Ii),po._rotateAround(In,Ei)._add(Yi)._add(Ii)}if(bt){const Ei=Math.sin(bt),In=Math.cos(bt),mo=[In,-Ei,Ei,In];Si._matMult(mo),fo._matMult(mo),ko._matMult(mo),po._matMult(mo)}const Yo=new E(0,0),Ko=new E(0,0);ht.push({tl:Si,tr:fo,bl:ko,br:po,tex:st,writingMode:Ee.writingMode,glyphOffset:ms,sectionIndex:gt.sectionIndex,isSDF:Nt,pixelOffsetTL:Yo,pixelOffsetBR:Ko,minFontScaleX:0,minFontScaleY:0})}return ht}(0,h,I,_,x,w,p,u.allowVerticalPlacement),fe=u.textSizeData;let we=null;fe.kind==="source"?(we=[hl*_.layout.get("text-size").evaluate(w,{})],we[0]>Fu&&qe(`${u.layerIds[0]}: Value for "text-size" is >= ${pd}. Reduce your "text-size".`)):fe.kind==="composite"&&(we=[hl*$.compositeTextSizes[0].evaluate(w,{},K),hl*$.compositeTextSizes[1].evaluate(w,{},K)],(we[0]>Fu||we[1]>Fu)&&qe(`${u.layerIds[0]}: Value for "text-size" is >= ${pd}. Reduce your "text-size".`)),u.addSymbols(u.text,ie,we,I,x,w,D,o,P.lineStartIndex,P.lineLength,H,K);for(const Oe of O)B[Oe]=u.text.placedSymbolArray.length-1;return 4*ie.length}function Ox(u){for(const o in u)return u[o];return null}function SP(u,o,h,p){const _=u.compareText;if(o in _){const x=_[o];for(let w=x.length-1;w>=0;w--)if(p.dist(x[w])>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const x=zx[15&p];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[I]=new Uint32Array(o,4,1);return new S0(I,w,x,o)}constructor(o,h=64,p=Float64Array,_){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const x=zx.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,I=o*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-I%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+P,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+I+P),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+I+P,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return E0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:I}=this,P=[0,x.length-1,0],D=[];for(;P.length;){const O=P.pop()||0,B=P.pop()||0,H=P.pop()||0;if(B-H<=I){for(let fe=H;fe<=B;fe++){const we=w[2*fe],Oe=w[2*fe+1];we>=o&&we<=p&&Oe>=h&&Oe<=_&&D.push(x[fe])}continue}const $=H+B>>1,K=w[2*$],ie=w[2*$+1];K>=o&&K<=p&&ie>=h&&ie<=_&&D.push(x[$]),(O===0?o<=K:h<=ie)&&(P.push(H),P.push($-1),P.push(1-O)),(O===0?p>=K:_>=ie)&&(P.push($+1),P.push(B),P.push(1-O))}return D}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:x,nodeSize:w}=this,I=[0,_.length-1,0],P=[],D=p*p;for(;I.length;){const O=I.pop()||0,B=I.pop()||0,H=I.pop()||0;if(B-H<=w){for(let fe=H;fe<=B;fe++)Bx(x[2*fe],x[2*fe+1],o,h)<=D&&P.push(_[fe]);continue}const $=H+B>>1,K=x[2*$],ie=x[2*$+1];Bx(K,ie,o,h)<=D&&P.push(_[$]),(O===0?o-p<=K:h-p<=ie)&&(I.push(H),I.push($-1),I.push(1-O)),(O===0?o+p>=K:h+p>=ie)&&(I.push($+1),I.push(B),I.push(1-O))}return P}}function E0(u,o,h,p,_,x){if(_-p<=h)return;const w=p+_>>1;Fx(u,o,w,p,_,x),E0(u,o,h,p,w-1,1-x),E0(u,o,h,w+1,_,1-x)}function Fx(u,o,h,p,_,x){for(;_>p;){if(_-p>600){const D=_-p+1,O=h-p+1,B=Math.log(D),H=.5*Math.exp(2*B/3),$=.5*Math.sqrt(B*H*(D-H)/D)*(O-D/2<0?-1:1);Fx(u,o,h,Math.max(p,Math.floor(h-O*H/D+$)),Math.min(_,Math.floor(h+(D-O)*H/D+$)),x)}const w=o[2*h+x];let I=p,P=_;for(md(u,o,p,h),o[2*_+x]>w&&md(u,o,p,_);Iw;)P--}o[2*p+x]===w?md(u,o,p,P):(P++,md(u,o,P,_)),P<=h&&(p=P+1),h<=P&&(_=P-1)}}function md(u,o,h,p){I0(u,h,p),I0(o,2*h,2*p),I0(o,2*h+1,2*p+1)}function I0(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function Bx(u,o,h,p){const _=u-h,x=o-p;return _*_+x*x}var C0;c.bd=void 0,(C0=c.bd||(c.bd={})).create="create",C0.load="load",C0.fullLoad="fullLoad";let Dg=null,gd=[];const T0=1e3/60,L0="loadTime",P0="fullLoadTime",EP={mark(u){performance.mark(u)},frame(u){const o=u;Dg!=null&&gd.push(o-Dg),Dg=o},clearMetrics(){Dg=null,gd=[],performance.clearMeasures(L0),performance.clearMeasures(P0);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(L0,c.bd.create,c.bd.load),performance.measure(P0,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(L0)[0].duration,o=performance.getEntriesByName(P0)[0].duration,h=gd.length,p=1/(gd.reduce((x,w)=>x+w,0)/h/1e3),_=gd.filter(x=>x>T0).reduce((x,w)=>x+(w-T0)/T0,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};c.$=dt,c.A=of,c.B=function(u){if(Xe==null){const o=u.navigator?u.navigator.userAgent:null;Xe=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Xe},c.C=class{constructor(u,o){this.target=u,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new dP(()=>this.process()),this.subscription=function(h,p,_,x){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=ft(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const I={id:_,type:"",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(I)},{once:!0});const x=[],w=Object.assign(Object.assign({},u),{id:_,sourceMapId:this.mapId,origin:location.origin,data:ku(u.data,x)});this.target.postMessage(w,{transfer:x})})}receive(u){const o=u.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(ft(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const u=this.taskQueue.shift(),o=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(u,o)}processTask(u,o){return l(this,void 0,void 0,function*(){if(o.type===""){const _=this.resolveRejects[u];return delete this.resolveRejects[u],_?void(o.error?_.reject(Du(o.error)):_.resolve(Du(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Du(o.data),p=new AbortController;this.abortControllers[u]=p;try{const _=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,_)}catch(_){this.completeTask(u,_)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const _={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?ku(o):null,data:ku(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Ot,c.E=kt,c.F=function(){var u=new of(16);return of!=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},c.G=Nn,c.H=function(u,o,h){var p,_,x,w,I,P,D,O,B,H,$,K,ie=h[0],fe=h[1],we=h[2];return o===u?(u[12]=o[0]*ie+o[4]*fe+o[8]*we+o[12],u[13]=o[1]*ie+o[5]*fe+o[9]*we+o[13],u[14]=o[2]*ie+o[6]*fe+o[10]*we+o[14],u[15]=o[3]*ie+o[7]*fe+o[11]*we+o[15]):(_=o[1],x=o[2],w=o[3],I=o[4],P=o[5],D=o[6],O=o[7],B=o[8],H=o[9],$=o[10],K=o[11],u[0]=p=o[0],u[1]=_,u[2]=x,u[3]=w,u[4]=I,u[5]=P,u[6]=D,u[7]=O,u[8]=B,u[9]=H,u[10]=$,u[11]=K,u[12]=p*ie+I*fe+B*we+o[12],u[13]=_*ie+P*fe+H*we+o[13],u[14]=x*ie+D*fe+$*we+o[14],u[15]=w*ie+O*fe+K*we+o[15]),u},c.I=c0,c.J=function(u,o,h){var p=h[0],_=h[1],x=h[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]*_,u[5]=o[5]*_,u[6]=o[6]*_,u[7]=o[7]*_,u[8]=o[8]*x,u[9]=o[9]*x,u[10]=o[10]*x,u[11]=o[11]*x,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},c.K=vb,c.L=function(u,o){const h={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of u){const _=window.document.createElement("source");On(p)||(o.crossOrigin="Anonymous"),_.src=p,o.appendChild(_)}})},c.a3=function(){return le++},c.a4=y,c.a5=hf,c.a6=zh,c.a7=Xl,c.a8=wr,c.a9=xx,c.aA=Q,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!_n(u.version,o.version))return[{command:"setStyle",args:[o]}];_n(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),_n(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),_n(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),_n(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),_n(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),_n(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),_n(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),_n(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),_n(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),_n(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},_=[];(function(w,I,P,D){let O;for(O in I=I||{},w=w||{})Object.prototype.hasOwnProperty.call(w,O)&&(Object.prototype.hasOwnProperty.call(I,O)||Cs(O,P,D));for(O in I)Object.prototype.hasOwnProperty.call(I,O)&&(Object.prototype.hasOwnProperty.call(w,O)?_n(w[O],I[O])||(w[O].type==="geojson"&&I[O].type==="geojson"&&tl(w,I,O)?ur(P,{command:"setGeoJSONSourceData",args:[O,I[O].data]}):Ks(O,I,P,D)):Go(O,I,P))})(u.sources,o.sources,_,p);const x=[];u.layers&&u.layers.forEach(w=>{"source"in w&&p[w.source]?h.push({command:"removeLayer",args:[w.id]}):x.push(w)}),h=h.concat(_),function(w,I,P){I=I||[];const D=(w=w||[]).map(zl),O=I.map(zl),B=w.reduce(Ts,{}),H=I.reduce(Ts,{}),$=D.slice(),K=Object.create(null);let ie,fe,we,Oe,Ee;for(let Ae=0,Qe=0;Ae@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,x)=>{const w=_||x;return o[p]=!w||w.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=X,c.ad=function(u,o,h){var p=Math.sin(h),_=Math.cos(h),x=o[0],w=o[1],I=o[2],P=o[3],D=o[4],O=o[5],B=o[6],H=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]=x*_+D*p,u[1]=w*_+O*p,u[2]=I*_+B*p,u[3]=P*_+H*p,u[4]=D*_-x*p,u[5]=O*_-w*p,u[6]=B*_-I*p,u[7]=H*_-P*p,u},c.ae=function(u){var o=new of(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},c.af=_g,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:_,minZoom:x,maxZoom:w}=u,I=_?X(Zi.interpolationFactor(_,o,x,w),0,1):0;u.kind==="camera"?p=co.number(u.minSize,u.maxSize,I):h=I}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:_}){return u.kind==="source"?p/hl:u.kind==="composite"?co.number(p/hl,_/hl,h):o},c.aj=d0,c.ak=function(u,o,h,p){const _=o.y-u.y,x=o.x-u.x,w=p.y-h.y,I=p.x-h.x,P=w*x-I*_;if(P===0)return null;const D=(I*(u.y-h.y)-w*(u.x-h.x))/P;return new E(u.x+D*x,u.y+D*_)},c.al=Ix,c.am=Kp,c.an=Zy,c.ao=bi,c.aq=p0,c.ar=function(u,o){var h=o[0],p=o[1],_=o[2],x=o[3],w=o[4],I=o[5],P=o[6],D=o[7],O=o[8],B=o[9],H=o[10],$=o[11],K=o[12],ie=o[13],fe=o[14],we=o[15],Oe=h*I-p*w,Ee=h*P-_*w,Ae=h*D-x*w,Qe=p*P-_*I,et=p*D-x*I,St=_*D-x*P,Dt=O*ie-B*K,wt=O*fe-H*K,bt=O*we-$*K,ht=B*fe-H*ie,Pt=B*we-$*ie,gt=H*we-$*fe,st=Oe*gt-Ee*Pt+Ae*ht+Qe*bt-et*wt+St*Dt;return st?(u[0]=(I*gt-P*Pt+D*ht)*(st=1/st),u[1]=(_*Pt-p*gt-x*ht)*st,u[2]=(ie*St-fe*et+we*Qe)*st,u[3]=(H*et-B*St-$*Qe)*st,u[4]=(P*bt-w*gt-D*wt)*st,u[5]=(h*gt-_*bt+x*wt)*st,u[6]=(fe*Ae-K*St-we*Ee)*st,u[7]=(O*St-H*Ae+$*Ee)*st,u[8]=(w*Pt-I*bt+D*Dt)*st,u[9]=(p*bt-h*Pt-x*Dt)*st,u[10]=(K*et-ie*Ae+we*Oe)*st,u[11]=(B*Ae-O*et-$*Oe)*st,u[12]=(I*wt-w*ht-P*Dt)*st,u[13]=(h*ht-p*wt+_*Dt)*st,u[14]=(ie*Ee-K*Qe-fe*Oe)*st,u[15]=(O*Qe-B*Ee+H*Oe)*st,u):null},c.as=w0,c.at=f0,c.au=S0,c.av=function(){const u={},o=Re.$version;for(const h in Re.$root){const p=Re.$root[h];if(p.required){let _=null;_=h==="version"?o:p.type==="array"?[]:{},_!=null&&(u[h]=_)}}return u},c.aw=rg,c.ax=Nr,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hst*bi)}let wt=w?"center":h.get("text-justify").evaluate(D,{},u.canonical);const bt=h.get("symbol-placement"),ht=bt==="point"?h.get("text-max-width").evaluate(D,{},u.canonical)*bi:0,Pt=()=>{u.bucket.allowVerticalPlacement&&Ru(Ae)&&(K.vertical=Eg(ie,u.glyphMap,u.glyphPositions,u.imagePositions,O,ht,x,St,"left",et,we,c.ah.vertical,!0,bt,H,B))};if(!w&&Dt){const gt=new Set;if(wt==="auto")for(let Gt=0;Gtl(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(u)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=ae,c.f=u=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=At})},p.onerror=()=>h(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 _=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(_):At}),c.g=pn,c.h=(u,o)=>Jn(ae(u,{type:"json"}),o),c.i=ft,c.j=ot,c.k=Ce,c.l=(u,o)=>Jn(ae(u,{type:"arrayBuffer"}),o),c.m=Jn,c.n=function(u){return new l0(u).readFields(QL,[])},c.o=rd,c.p=Qb,c.q=To,c.r=Gy,c.s=On,c.t=Au,c.u=xt,c.v=Re,c.w=qe,c.x=ql,c.y=function([u,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(h),y:u*Math.sin(o)*Math.sin(h),z:u*Math.cos(h)}},c.z=co}),i("worker",["./shared"],function(c){class l{constructor(W){this.keyCache={},W&&this.replace(W)}replace(W){this._layerConfigs={},this._layers={},this.update(W,[])}update(W,Z){for(const ue of W){this._layerConfigs[ue.id]=ue;const Te=this._layers[ue.id]=c.az(ue);Te._featureFilter=c.a6(Te.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of Z)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const J=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const ue of J){const Te=ue.map(Ye=>this._layers[Ye.id]),ee=Te[0];if(ee.visibility==="none")continue;const Me=ee.source||"";let Se=this.familiesBySource[Me];Se||(Se=this.familiesBySource[Me]={});const Ne=ee.sourceLayer||"_geojsonTileLayer";let He=Se[Ne];He||(He=Se[Ne]=[]),He.push(Te)}}}class d{constructor(W){const Z={},J=[];for(const Me in W){const Se=W[Me],Ne=Z[Me]={};for(const He in Se){const Ye=Se[+He];if(!Ye||Ye.bitmap.width===0||Ye.bitmap.height===0)continue;const Je={x:0,y:0,w:Ye.bitmap.width+2,h:Ye.bitmap.height+2};J.push(Je),Ne[He]={rect:Je,metrics:Ye.metrics}}}const{w:ue,h:Te}=c.p(J),ee=new c.o({width:ue||1,height:Te||1});for(const Me in W){const Se=W[Me];for(const Ne in Se){const He=Se[+Ne];if(!He||He.bitmap.width===0||He.bitmap.height===0)continue;const Ye=Z[Me][Ne].rect;c.o.copy(He.bitmap,ee,{x:0,y:0},{x:Ye.x+1,y:Ye.y+1},He.bitmap)}}this.image=ee,this.positions=Z}}c.bi("GlyphAtlas",d);class v{constructor(W){this.tileID=new c.Q(W.tileID.overscaledZ,W.tileID.wrap,W.tileID.canonical.z,W.tileID.canonical.x,W.tileID.canonical.y),this.uid=W.uid,this.zoom=W.zoom,this.pixelRatio=W.pixelRatio,this.tileSize=W.tileSize,this.source=W.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=W.showCollisionBoxes,this.collectResourceTiming=!!W.collectResourceTiming,this.returnDependencies=!!W.returnDependencies,this.promoteId=W.promoteId,this.inFlightDependencies=[]}parse(W,Z,J,ue){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=W,this.collisionBoxArray=new c.a4;const Te=new c.bj(Object.keys(W.layers).sort()),ee=new c.bk(this.tileID,this.promoteId);ee.bucketLayerIDs=[];const Me={},Se={featureIndex:ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},Ne=Z.familiesBySource[this.source];for(const dn in Ne){const Or=W.layers[dn];if(!Or)continue;Or.version===1&&c.w(`Vector tile source "${this.source}" layer "${dn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _i=Te.encode(dn),uo=[];for(let Eo=0;Eo=Mi.maxzoom||Mi.visibility!=="none"&&(S(Eo,this.zoom,J),(Me[Mi.id]=Mi.createBucket({index:ee.bucketLayerIDs.length,layers:Eo,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_i,sourceID:this.source})).populate(uo,Se,this.tileID.canonical),ee.bucketLayerIDs.push(Eo.map(Js=>Js.id)))}}const He=c.aE(Se.glyphDependencies,dn=>Object.keys(dn).map(Number));this.inFlightDependencies.forEach(dn=>dn==null?void 0:dn.abort()),this.inFlightDependencies=[];let Ye=Promise.resolve({});if(Object.keys(He).length){const dn=new AbortController;this.inFlightDependencies.push(dn),Ye=ue.sendAsync({type:"GG",data:{stacks:He,source:this.source,tileID:this.tileID,type:"glyphs"}},dn)}const Je=Object.keys(Se.iconDependencies);let Rt=Promise.resolve({});if(Je.length){const dn=new AbortController;this.inFlightDependencies.push(dn),Rt=ue.sendAsync({type:"GI",data:{icons:Je,source:this.source,tileID:this.tileID,type:"icons"}},dn)}const Ft=Object.keys(Se.patternDependencies);let en=Promise.resolve({});if(Ft.length){const dn=new AbortController;this.inFlightDependencies.push(dn),en=ue.sendAsync({type:"GI",data:{icons:Ft,source:this.source,tileID:this.tileID,type:"patterns"}},dn)}const[nn,Tn,er]=yield Promise.all([Ye,Rt,en]),xr=new d(nn),hi=new c.bl(Tn,er);for(const dn in Me){const Or=Me[dn];Or instanceof c.a5?(S(Or.layers,this.zoom,J),c.bm({bucket:Or,glyphMap:nn,glyphPositions:xr.positions,imageMap:Tn,imagePositions:hi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Or.hasPattern&&(Or instanceof c.bn||Or instanceof c.bo||Or instanceof c.bp)&&(S(Or.layers,this.zoom,J),Or.addFeatures(Se,this.tileID.canonical,hi.patternPositions))}return this.status="done",{buckets:Object.values(Me).filter(dn=>!dn.isEmpty()),featureIndex:ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:xr.image,imageAtlas:hi,glyphMap:this.returnDependencies?nn:null,iconMap:this.returnDependencies?Tn:null,glyphPositions:this.returnDependencies?xr.positions:null}})}}function S(pe,W,Z){const J=new c.a8(W);for(const ue of pe)ue.recalculate(J,Z)}class E{constructor(W,Z,J){this.actor=W,this.layerIndex=Z,this.availableImages=J,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(W,Z){return c._(this,void 0,void 0,function*(){const J=yield c.l(W.request,Z);try{return{vectorTile:new c.bq.VectorTile(new c.br(J.data)),rawData:J.data,cacheControl:J.cacheControl,expires:J.expires}}catch(ue){const Te=new Uint8Array(J.data);let ee=`Unable to parse the tile at ${W.request.url}, `;throw ee+=Te[0]===31&&Te[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.messge}`,new Error(ee)}})}loadTile(W){return c._(this,void 0,void 0,function*(){const Z=W.uid,J=!!(W&&W.request&&W.request.collectResourceTiming)&&new c.bs(W.request),ue=new v(W);this.loading[Z]=ue;const Te=new AbortController;ue.abort=Te;try{const ee=yield this.loadVectorTile(W,Te);if(delete this.loading[Z],!ee)return null;const Me=ee.rawData,Se={};ee.expires&&(Se.expires=ee.expires),ee.cacheControl&&(Se.cacheControl=ee.cacheControl);const Ne={};if(J){const Ye=J.finish();Ye&&(Ne.resourceTiming=JSON.parse(JSON.stringify(Ye)))}ue.vectorTile=ee.vectorTile;const He=ue.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[Z]=ue,this.fetching[Z]={rawTileData:Me,cacheControl:Se,resourceTiming:Ne};try{const Ye=yield He;return c.e({rawTileData:Me.slice(0)},Ye,Se,Ne)}finally{delete this.fetching[Z]}}catch(ee){throw delete this.loading[Z],ue.status="done",this.loaded[Z]=ue,ee}})}reloadTile(W){return c._(this,void 0,void 0,function*(){const Z=W.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const J=this.loaded[Z];if(J.showCollisionBoxes=W.showCollisionBoxes,J.status==="parsing"){const ue=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor);let Te;if(this.fetching[Z]){const{rawTileData:ee,cacheControl:Me,resourceTiming:Se}=this.fetching[Z];delete this.fetching[Z],Te=c.e({rawTileData:ee.slice(0)},ue,Me,Se)}else Te=ue;return Te}if(J.status==="done"&&J.vectorTile)return J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(W){return c._(this,void 0,void 0,function*(){const Z=this.loading,J=W.uid;Z&&Z[J]&&Z[J].abort&&(Z[J].abort.abort(),delete Z[J])})}removeTile(W){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[W.uid]&&delete this.loaded[W.uid]})}}class C{constructor(){this.loaded={}}loadTile(W){return c._(this,void 0,void 0,function*(){const{uid:Z,encoding:J,rawImageData:ue,redFactor:Te,greenFactor:ee,blueFactor:Me,baseShift:Se}=W,Ne=ue.width+2,He=ue.height+2,Ye=c.b(ue)?new c.R({width:Ne,height:He},yield c.bt(ue,-1,-1,Ne,He)):ue,Je=new c.bu(Z,Ye,J,Te,ee,Me,Se);return this.loaded=this.loaded||{},this.loaded[Z]=Je,Je})}removeTile(W){const Z=this.loaded,J=W.uid;Z&&Z[J]&&delete Z[J]}}function M(pe,W){if(pe.length!==0){k(pe[0],W);for(var Z=1;Z=Math.abs(Me)?Z-Se+Me:Me-Se+Z,Z=Se}Z+J>=0!=!!W&&pe.reverse()}var R=c.bv(function pe(W,Z){var J,ue=W&&W.type;if(ue==="FeatureCollection")for(J=0;J>31}function it(pe,W){for(var Z=pe.loadGeometry(),J=pe.type,ue=0,Te=0,ee=Z.length,Me=0;Mepe},At=Math.fround||(yt=new Float32Array(1),pe=>(yt[0]=+pe,yt[0]));var yt;const zt=3,Tt=5,tn=6;class Rn{constructor(W){this.options=Object.assign(Object.create(Mt),W),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(W){const{log:Z,minZoom:J,maxZoom:ue}=this.options;Z&&console.time("total time");const Te=`prepare ${W.length} points`;Z&&console.time(Te),this.points=W;const ee=[];for(let Se=0;Se=J;Se--){const Ne=+Date.now();Me=this.trees[Se]=this._createTree(this._cluster(Me,Se)),Z&&console.log("z%d: %d clusters in %dms",Se,Me.numItems,+Date.now()-Ne)}return Z&&console.timeEnd("total time"),this}getClusters(W,Z){let J=((W[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,W[1]));let Te=W[2]===180?180:((W[2]+180)%360+360)%360-180;const ee=Math.max(-90,Math.min(90,W[3]));if(W[2]-W[0]>=360)J=-180,Te=180;else if(J>Te){const Ye=this.getClusters([J,ue,180,ee],Z),Je=this.getClusters([-180,ue,Te,ee],Z);return Ye.concat(Je)}const Me=this.trees[this._limitZoom(Z)],Se=Me.range(Nn(J),En(ee),Nn(Te),En(ue)),Ne=Me.data,He=[];for(const Ye of Se){const Je=this.stride*Ye;He.push(Ne[Je+Tt]>1?Jt(Ne,Je,this.clusterProps):this.points[Ne[Je+zt]])}return He}getChildren(W){const Z=this._getOriginId(W),J=this._getOriginZoom(W),ue="No cluster with the specified id.",Te=this.trees[J];if(!Te)throw new Error(ue);const ee=Te.data;if(Z*this.stride>=ee.length)throw new Error(ue);const Me=this.options.radius/(this.options.extent*Math.pow(2,J-1)),Se=Te.within(ee[Z*this.stride],ee[Z*this.stride+1],Me),Ne=[];for(const He of Se){const Ye=He*this.stride;ee[Ye+4]===W&&Ne.push(ee[Ye+Tt]>1?Jt(ee,Ye,this.clusterProps):this.points[ee[Ye+zt]])}if(Ne.length===0)throw new Error(ue);return Ne}getLeaves(W,Z,J){const ue=[];return this._appendLeaves(ue,W,Z=Z||10,J=J||0,0),ue}getTile(W,Z,J){const ue=this.trees[this._limitZoom(W)],Te=Math.pow(2,W),{extent:ee,radius:Me}=this.options,Se=Me/ee,Ne=(J-Se)/Te,He=(J+1+Se)/Te,Ye={features:[]};return this._addTileFeatures(ue.range((Z-Se)/Te,Ne,(Z+1+Se)/Te,He),ue.data,Z,J,Te,Ye),Z===0&&this._addTileFeatures(ue.range(1-Se/Te,Ne,1,He),ue.data,Te,J,Te,Ye),Z===Te-1&&this._addTileFeatures(ue.range(0,Ne,Se/Te,He),ue.data,-1,J,Te,Ye),Ye.features.length?Ye:null}getClusterExpansionZoom(W){let Z=this._getOriginZoom(W)-1;for(;Z<=this.options.maxZoom;){const J=this.getChildren(W);if(Z++,J.length!==1)break;W=J[0].properties.cluster_id}return Z}_appendLeaves(W,Z,J,ue,Te){const ee=this.getChildren(Z);for(const Me of ee){const Se=Me.properties;if(Se&&Se.cluster?Te+Se.point_count<=ue?Te+=Se.point_count:Te=this._appendLeaves(W,Se.cluster_id,J,ue,Te):Te1;let He,Ye,Je;if(Ne)He=pn(Z,Se,this.clusterProps),Ye=Z[Se],Je=Z[Se+1];else{const en=this.points[Z[Se+zt]];He=en.properties;const[nn,Tn]=en.geometry.coordinates;Ye=Nn(nn),Je=En(Tn)}const Rt={type:1,geometry:[[Math.round(this.options.extent*(Ye*Te-J)),Math.round(this.options.extent*(Je*Te-ue))]],tags:He};let Ft;Ft=Ne||this.options.generateId?Z[Se+zt]:this.points[Z[Se+zt]].id,Ft!==void 0&&(Rt.id=Ft),ee.features.push(Rt)}}_limitZoom(W){return Math.max(this.options.minZoom,Math.min(Math.floor(+W),this.options.maxZoom+1))}_cluster(W,Z){const{radius:J,extent:ue,reduce:Te,minPoints:ee}=this.options,Me=J/(ue*Math.pow(2,Z)),Se=W.data,Ne=[],He=this.stride;for(let Ye=0;YeZ&&(nn+=Se[er+Tt])}if(nn>en&&nn>=ee){let Tn,er=Je*en,xr=Rt*en,hi=-1;const dn=((Ye/He|0)<<5)+(Z+1)+this.points.length;for(const Or of Ft){const _i=Or*He;if(Se[_i+2]<=Z)continue;Se[_i+2]=Z;const uo=Se[_i+Tt];er+=Se[_i]*uo,xr+=Se[_i+1]*uo,Se[_i+4]=dn,Te&&(Tn||(Tn=this._map(Se,Ye,!0),hi=this.clusterProps.length,this.clusterProps.push(Tn)),Te(Tn,this._map(Se,_i)))}Se[Ye+4]=dn,Ne.push(er/nn,xr/nn,1/0,dn,-1,nn),Te&&Ne.push(hi)}else{for(let Tn=0;Tn1)for(const Tn of Ft){const er=Tn*He;if(!(Se[er+2]<=Z)){Se[er+2]=Z;for(let xr=0;xr>5}_getOriginZoom(W){return(W-this.points.length)%32}_map(W,Z,J){if(W[Z+Tt]>1){const ee=this.clusterProps[W[Z+tn]];return J?Object.assign({},ee):ee}const ue=this.points[W[Z+zt]].properties,Te=this.options.map(ue);return J&&Te===ue?Object.assign({},Te):Te}}function Jt(pe,W,Z){return{type:"Feature",id:pe[W+zt],properties:pn(pe,W,Z),geometry:{type:"Point",coordinates:[(J=pe[W],360*(J-.5)),Nr(pe[W+1])]}};var J}function pn(pe,W,Z){const J=pe[W+Tt],ue=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,Te=pe[W+tn],ee=Te===-1?{}:Object.assign({},Z[Te]);return Object.assign(ee,{cluster:!0,cluster_id:pe[W+zt],point_count:J,point_count_abbreviated:ue})}function Nn(pe){return pe/360+.5}function En(pe){const W=Math.sin(pe*Math.PI/180),Z=.5-.25*Math.log((1+W)/(1-W))/Math.PI;return Z<0?0:Z>1?1:Z}function Nr(pe){const W=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(W))/Math.PI-90}function Jn(pe,W,Z,J){for(var ue,Te=J,ee=Z-W>>1,Me=Z-W,Se=pe[W],Ne=pe[W+1],He=pe[Z],Ye=pe[Z+1],Je=W+3;JeTe)ue=Je,Te=Rt;else if(Rt===Te){var Ft=Math.abs(Je-ee);FtJ&&(ue-W>3&&Jn(pe,W,ue,J),pe[ue+2]=Te,Z-ue>3&&Jn(pe,ue,Z,J))}function On(pe,W,Z,J,ue,Te){var ee=ue-Z,Me=Te-J;if(ee!==0||Me!==0){var Se=((pe-Z)*ee+(W-J)*Me)/(ee*ee+Me*Me);Se>1?(Z=ue,J=Te):Se>0&&(Z+=ee*Se,J+=Me*Se)}return(ee=pe-Z)*ee+(Me=W-J)*Me}function Qn(pe,W,Z,J){var ue={id:pe===void 0?null:pe,type:W,geometry:Z,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Te){var ee=Te.geometry,Me=Te.type;if(Me==="Point"||Me==="MultiPoint"||Me==="LineString")ne(Te,ee);else if(Me==="Polygon"||Me==="MultiLineString")for(var Se=0;Se0&&(ee+=J?(ue*Ne-Se*Te)/2:Math.sqrt(Math.pow(Se-ue,2)+Math.pow(Ne-Te,2))),ue=Se,Te=Ne}var He=W.length-3;W[2]=1,Jn(W,0,He,Z),W[He+2]=1,W.size=Math.abs(ee),W.start=0,W.end=W.size}function Re(pe,W,Z,J){for(var ue=0;ue1?1:Z}function _n(pe,W,Z,J,ue,Te,ee,Me){if(J/=W,Te>=(Z/=W)&&ee=J)return null;for(var Se=[],Ne=0;Ne=Z&&Ft=J)){var en=[];if(Je==="Point"||Je==="MultiPoint")ur(Ye,en,Z,J,ue);else if(Je==="LineString")Go(Ye,en,Z,J,ue,!1,Me.lineMetrics);else if(Je==="MultiLineString")Ks(Ye,en,Z,J,ue,!1);else if(Je==="Polygon")Ks(Ye,en,Z,J,ue,!0);else if(Je==="MultiPolygon")for(var nn=0;nn=Z&&ee<=J&&(W.push(pe[Te]),W.push(pe[Te+1]),W.push(pe[Te+2]))}}function Go(pe,W,Z,J,ue,Te,ee){for(var Me,Se,Ne=Cs(pe),He=ue===0?Bi:zl,Ye=pe.start,Je=0;JeZ&&(Se=He(Ne,Rt,Ft,nn,Tn,Z),ee&&(Ne.start=Ye+Me*Se)):er>J?xr=Z&&(Se=He(Ne,Rt,Ft,nn,Tn,Z),hi=!0),xr>J&&er<=J&&(Se=He(Ne,Rt,Ft,nn,Tn,J),hi=!0),!Te&&hi&&(ee&&(Ne.end=Ye+Me*Se),W.push(Ne),Ne=Cs(pe)),ee&&(Ye+=Me)}var dn=pe.length-3;Rt=pe[dn],Ft=pe[dn+1],en=pe[dn+2],(er=ue===0?Rt:Ft)>=Z&&er<=J&&tl(Ne,Rt,Ft,en),dn=Ne.length-3,Te&&dn>=3&&(Ne[dn]!==Ne[0]||Ne[dn+1]!==Ne[1])&&tl(Ne,Ne[0],Ne[1],Ne[2]),Ne.length&&W.push(Ne)}function Cs(pe){var W=[];return W.size=pe.size,W.start=pe.start,W.end=pe.end,W}function Ks(pe,W,Z,J,ue,Te){for(var ee=0;eeee.maxX&&(ee.maxX=He),Ye>ee.maxY&&(ee.maxY=Ye)}return ee}function ci(pe,W,Z,J){var ue=W.geometry,Te=W.type,ee=[];if(Te==="Point"||Te==="MultiPoint")for(var Me=0;Me0&&W.size<(ue?ee:J))Z.numPoints+=W.length/3;else{for(var Me=[],Se=0;Seee)&&(Z.numSimplified++,Me.push(W[Se]),Me.push(W[Se+1])),Z.numPoints++;ue&&function(Ne,He){for(var Ye=0,Je=0,Rt=Ne.length,Ft=Rt-2;Je0===He)for(Je=0,Rt=Ne.length;Je24)throw new Error("maxZoom should be in the 0-24 range");if(W.promoteId&&W.generateId)throw new Error("promoteId and generateId cannot be used together.");var J=function(ue,Te){var ee=[];if(ue.type==="FeatureCollection")for(var Me=0;Me1&&console.time("creation"),Je=this.tiles[Ye]=Fl(pe,W,Z,J,Se),this.tileCoords.push({z:W,x:Z,y:J}),Ne)){Ne>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W,Z,J,Je.numFeatures,Je.numPoints,Je.numSimplified),console.timeEnd("creation"));var Rt="z"+W;this.stats[Rt]=(this.stats[Rt]||0)+1,this.total++}if(Je.source=pe,ue){if(W===Se.maxZoom||W===ue)continue;var Ft=1<1&&console.time("clipping");var en,nn,Tn,er,xr,hi,dn=.5*Se.buffer/Se.extent,Or=.5-dn,_i=.5+dn,uo=1+dn;en=nn=Tn=er=null,xr=_n(pe,He,Z-dn,Z+_i,0,Je.minX,Je.maxX,Se),hi=_n(pe,He,Z+Or,Z+uo,0,Je.minX,Je.maxX,Se),pe=null,xr&&(en=_n(xr,He,J-dn,J+_i,1,Je.minY,Je.maxY,Se),nn=_n(xr,He,J+Or,J+uo,1,Je.minY,Je.maxY,Se),xr=null),hi&&(Tn=_n(hi,He,J-dn,J+_i,1,Je.minY,Je.maxY,Se),er=_n(hi,He,J+Or,J+uo,1,Je.minY,Je.maxY,Se),hi=null),Ne>1&&console.timeEnd("clipping"),Me.push(en||[],W+1,2*Z,2*J),Me.push(nn||[],W+1,2*Z,2*J+1),Me.push(Tn||[],W+1,2*Z+1,2*J),Me.push(er||[],W+1,2*Z+1,2*J+1)}}},un.prototype.getTile=function(pe,W,Z){var J=this.options,ue=J.extent,Te=J.debug;if(pe<0||pe>24)return null;var ee=1<1&&console.log("drilling down to z%d-%d-%d",pe,W,Z);for(var Se,Ne=pe,He=W,Ye=Z;!Se&&Ne>0;)Ne--,He=Math.floor(He/2),Ye=Math.floor(Ye/2),Se=this.tiles[an(Ne,He,Ye)];return Se&&Se.source?(Te>1&&console.log("found parent tile z%d-%d-%d",Ne,He,Ye),Te>1&&console.time("drilling down"),this.splitTile(Se.source,Ne,He,Ye,pe,W,Z),Te>1&&console.timeEnd("drilling down"),this.tiles[Me]?us(this.tiles[Me],ue):null):null};class Aa extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(W,Z){return c._(this,void 0,void 0,function*(){const J=W.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ue=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!ue)return null;const Te=new class{constructor(Me){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=Me.length,this._features=Me}feature(Me){return new class{constructor(Se){this._feature=Se,this.extent=c.W,this.type=Se.type,this.properties=Se.tags,"id"in Se&&!isNaN(Se.id)&&(this.id=parseInt(Se.id,10))}loadGeometry(){if(this._feature.type===1){const Se=[];for(const Ne of this._feature.geometry)Se.push([new c.P(Ne[0],Ne[1])]);return Se}{const Se=[];for(const Ne of this._feature.geometry){const He=[];for(const Ye of Ne)He.push(new c.P(Ye[0],Ye[1]));Se.push(He)}return Se}}toGeoJSON(Se,Ne,He){return F.call(this,Se,Ne,He)}}(this._features[Me])}}(ue.features);let ee=Xe(Te);return ee.byteOffset===0&&ee.byteLength===ee.buffer.byteLength||(ee=new Uint8Array(ee)),{vectorTile:Te,rawData:ee.buffer}})}loadData(W){return c._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const J=!!(W&&W.request&&W.request.collectResourceTiming)&&new c.bs(W.request);this._pendingRequest=new AbortController;try{let ue=yield this.loadGeoJSON(W,this._pendingRequest);if(delete this._pendingRequest,typeof ue!="object")throw new Error(`Input data given to '${W.source}' is not a valid GeoJSON object.`);if(R(ue,!0),W.filter){const ee=c.by(W.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ee.result==="error")throw new Error(ee.value.map(Se=>`${Se.key}: ${Se.message}`).join(", "));ue={type:"FeatureCollection",features:ue.features.filter(Se=>ee.value.evaluate({zoom:0},Se))}}this._geoJSONIndex=W.cluster?new Rn(function({superclusterOptions:ee,clusterProperties:Me}){if(!Me||!ee)return ee;const Se={},Ne={},He={accumulated:null,zoom:0},Ye={properties:null},Je=Object.keys(Me);for(const Rt of Je){const[Ft,en]=Me[Rt],nn=c.by(en),Tn=c.by(typeof Ft=="string"?[Ft,["accumulated"],["get",Rt]]:Ft);Se[Rt]=nn.value,Ne[Rt]=Tn.value}return ee.map=Rt=>{Ye.properties=Rt;const Ft={};for(const en of Je)Ft[en]=Se[en].evaluate(He,Ye);return Ft},ee.reduce=(Rt,Ft)=>{Ye.properties=Ft;for(const en of Je)He.accumulated=Rt[en],Rt[en]=Ne[en].evaluate(He,Ye)},ee}(W)).load(ue.features):function(ee,Me){return new un(ee,Me)}(ue,W.geojsonVtOptions),this.loaded={};const Te={};if(J){const ee=J.finish();ee&&(Te.resourceTiming={},Te.resourceTiming[W.source]=JSON.parse(JSON.stringify(ee)))}return Te}catch(ue){if(delete this._pendingRequest,c.bz(ue))return{abandoned:!0};throw ue}})}reloadTile(W){const Z=this.loaded;return Z&&Z[W.uid]?super.reloadTile(W):this.loadTile(W)}loadGeoJSON(W,Z){return c._(this,void 0,void 0,function*(){const{promoteId:J}=W;if(W.request){const ue=yield c.h(W.request,Z);return this._dataUpdateable=cs(ue.data,J)?sn(ue.data,J):void 0,ue.data}if(typeof W.data=="string")try{const ue=JSON.parse(W.data);return this._dataUpdateable=cs(ue,J)?sn(ue,J):void 0,ue}catch{throw new Error(`Input data given to '${W.source}' is not a valid GeoJSON object.`)}if(!W.dataDiff)throw new Error(`Input data given to '${W.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${W.source}`);return function(ue,Te,ee){var Me,Se,Ne,He;if(Te.removeAll&&ue.clear(),Te.remove)for(const Ye of Te.remove)ue.delete(Ye);if(Te.add)for(const Ye of Te.add){const Je=Wr(Ye,ee);Je!=null&&ue.set(Je,Ye)}if(Te.update)for(const Ye of Te.update){let Je=ue.get(Ye.id);if(Je==null)continue;const Rt=!Ye.removeAllProperties&&(((Me=Ye.removeProperties)===null||Me===void 0?void 0:Me.length)>0||((Se=Ye.addOrUpdateProperties)===null||Se===void 0?void 0:Se.length)>0);if((Ye.newGeometry||Ye.removeAllProperties||Rt)&&(Je=Object.assign({},Je),ue.set(Ye.id,Je),Rt&&(Je.properties=Object.assign({},Je.properties))),Ye.newGeometry&&(Je.geometry=Ye.newGeometry),Ye.removeAllProperties)Je.properties={};else if(((Ne=Ye.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const Ft of Ye.removeProperties)Object.prototype.hasOwnProperty.call(Je.properties,Ft)&&delete Je.properties[Ft];if(((He=Ye.addOrUpdateProperties)===null||He===void 0?void 0:He.length)>0)for(const{key:Ft,value:en}of Ye.addOrUpdateProperties)Je.properties[Ft]=en}}(this._dataUpdateable,W.dataDiff,J),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(W){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(W){return this._geoJSONIndex.getClusterExpansionZoom(W.clusterId)}getClusterChildren(W){return this._geoJSONIndex.getChildren(W.clusterId)}getClusterLeaves(W){return this._geoJSONIndex.getLeaves(W.clusterId,W.limit,W.offset)}}class Jr{constructor(W){this.self=W,this.actor=new c.C(W),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,J)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=J},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=Z=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,J)=>this._getDEMWorkerSource(Z,J.source).loadTile(J)),this.actor.registerMessageHandler("RDT",(Z,J)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,J.source).removeTile(J)})),this.actor.registerMessageHandler("GCEZ",(Z,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,J.type,J.source).getClusterExpansionZoom(J)})),this.actor.registerMessageHandler("GCC",(Z,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,J.type,J.source).getClusterChildren(J)})),this.actor.registerMessageHandler("GCL",(Z,J)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,J.type,J.source).getClusterLeaves(J)})),this.actor.registerMessageHandler("LD",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).loadData(J)),this.actor.registerMessageHandler("LT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).loadTile(J)),this.actor.registerMessageHandler("RT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).reloadTile(J)),this.actor.registerMessageHandler("AT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).abortTile(J)),this.actor.registerMessageHandler("RMT",(Z,J)=>this._getWorkerSource(Z,J.type,J.source).removeTile(J)),this.actor.registerMessageHandler("RS",(Z,J)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][J.type]||!this.workerSources[Z][J.type][J.source])return;const ue=this.workerSources[Z][J.type][J.source];delete this.workerSources[Z][J.type][J.source],ue.removeSource!==void 0&&ue.removeSource(J)})),this.actor.registerMessageHandler("RM",Z=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,J)=>c._(this,void 0,void 0,function*(){this.referrer=J})),this.actor.registerMessageHandler("SRPS",(Z,J)=>this._syncRTLPluginState(Z,J)),this.actor.registerMessageHandler("IS",(Z,J)=>c._(this,void 0,void 0,function*(){this.self.importScripts(J)})),this.actor.registerMessageHandler("SI",(Z,J)=>this._setImages(Z,J)),this.actor.registerMessageHandler("UL",(Z,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(J.layers,J.removedIds)})),this.actor.registerMessageHandler("SL",(Z,J)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(J)}))}_setImages(W,Z){return c._(this,void 0,void 0,function*(){this.availableImages[W]=Z;for(const J in this.workerSources[W]){const ue=this.workerSources[W][J];for(const Te in ue)ue[Te].availableImages=Z}})}_syncRTLPluginState(W,Z){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(Z.pluginStatus!=="loading")return c.bA.setState(Z),Z;const J=Z.pluginURL;if(this.self.importScripts(J),c.bA.isParsed()){const ue={pluginStatus:"loaded",pluginURL:J};return c.bA.setState(ue),ue}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${J}`)})}_getAvailableImages(W){let Z=this.availableImages[W];return Z||(Z=[]),Z}_getLayerIndex(W){let Z=this.layerIndexes[W];return Z||(Z=this.layerIndexes[W]=new l),Z}_getWorkerSource(W,Z,J){if(this.workerSources[W]||(this.workerSources[W]={}),this.workerSources[W][Z]||(this.workerSources[W][Z]={}),!this.workerSources[W][Z][J]){const ue={sendAsync:(Te,ee)=>(Te.targetMapId=W,this.actor.sendAsync(Te,ee))};switch(Z){case"vector":this.workerSources[W][Z][J]=new E(ue,this._getLayerIndex(W),this._getAvailableImages(W));break;case"geojson":this.workerSources[W][Z][J]=new Aa(ue,this._getLayerIndex(W),this._getAvailableImages(W));break;default:this.workerSources[W][Z][J]=new this.externalWorkerSourceTypes[Z](ue,this._getLayerIndex(W),this._getAvailableImages(W))}}return this.workerSources[W][Z][J]}_getDEMWorkerSource(W,Z){return this.demWorkerSources[W]||(this.demWorkerSources[W]={}),this.demWorkerSources[W][Z]||(this.demWorkerSources[W][Z]=new C),this.demWorkerSources[W][Z]}}return c.i(self)&&(self.worker=new Jr(self)),Jr}),i("index",["exports","./shared"],function(c,l){var d="4.1.3";let v,S;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((a,f)=>{const m=requestAnimationFrame(a);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),f(l.c())})}),getImageData(y,a=0){return this.getImageCanvasContext(y).getImageData(-a,-a,y.width+2*a,y.height+2*a)},getImageCanvasContext(y){const a=window.document.createElement("canvas"),f=a.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return a.width=y.width,a.height=y.height,f.drawImage(y,0,0,y.width,y.height),f},resolveURL:y=>(v||(v=document.createElement("a")),v.href=y,v.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class C{static testProp(a){if(!C.docStyle)return a[0];for(let f=0;f{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(a){const f=a.getBoundingClientRect();return{x:f.width/a.offsetWidth||1,y:f.height/a.offsetHeight||1,boundingClientRect:f}}static getPoint(a,f,m){const g=f.boundingClientRect;return new l.P((m.clientX-g.left)/f.x-a.clientLeft,(m.clientY-g.top)/f.y-a.clientTop)}static mousePos(a,f){const m=C.getScale(a);return C.getPoint(a,m,f)}static touchPos(a,f){const m=[],g=C.getScale(a);for(let b=0;b{a=[],f=0,m=0,g={}},y.addThrottleControl=A=>{const N=m++;return g[N]=A,N},y.removeThrottleControl=A=>{delete g[A],T()},y.getImage=(A,N,V=!0)=>new Promise((j,Y)=>{M.supported&&(A.headers||(A.headers={}),A.headers.accept="image/webp,*/*"),l.e(A,{type:"image"}),a.push({abortController:N,requestParameters:A,supportImageRefresh:V,state:"queued",onError:he=>{Y(he)},onSuccess:he=>{j(he)}}),T()});const b=A=>l._(this,void 0,void 0,function*(){A.state="running";const{requestParameters:N,supportImageRefresh:V,onError:j,onSuccess:Y,abortController:he}=A,ce=V===!1&&!l.i(self)&&!l.g(N.url)&&(!N.headers||Object.keys(N.headers).reduce((Ie,je)=>Ie&&je==="accept",!0));f++;const ge=ce?L(N,he):l.m(N,he);try{const Ie=yield ge;delete A.abortController,A.state="completed",Ie.data instanceof HTMLImageElement||l.b(Ie.data)?Y(Ie):Ie.data&&Y({data:yield(re=Ie.data,typeof createImageBitmap=="function"?l.d(re):l.f(re)),cacheControl:Ie.cacheControl,expires:Ie.expires})}catch(Ie){delete A.abortController,j(Ie)}finally{f--,T()}var re}),T=()=>{const A=(()=>{for(const N of Object.keys(g))if(g[N]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let N=f;N0;N++){const V=a.shift();V.abortController.signal.aborted?N--:b(V)}},L=(A,N)=>new Promise((V,j)=>{const Y=new Image,he=A.url,ce=A.credentials;ce&&ce==="include"?Y.crossOrigin="use-credentials":(ce&&ce==="same-origin"||!l.s(he))&&(Y.crossOrigin="anonymous"),N.signal.addEventListener("abort",()=>{Y.src="",j(l.c())}),Y.fetchPriority="high",Y.onload=()=>{Y.onerror=Y.onload=null,V({data:Y})},Y.onerror=()=>{Y.onerror=Y.onload=null,N.signal.aborted||j(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."))},Y.src=he})}(G||(G={})),G.resetRequestQueue();class q{constructor(a){this._transformRequestFn=a}transformRequest(a,f){return this._transformRequestFn&&this._transformRequestFn(a,f)||{url:a}}normalizeSpriteURL(a,f,m){const g=function(b){const T=b.match(X);if(!T)throw new Error(`Unable to parse URL "${b}"`);return{protocol:T[1],authority:T[2],path:T[3]||"/",params:T[4]?T[4].split("&"):[]}}(a);return g.path+=`${f}${m}`,function(b){const T=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${T}`}(g)}setTransformRequest(a){this._transformRequestFn=a}}const X=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function de(y){var a=new l.A(3);return a[0]=y[0],a[1]=y[1],a[2]=y[2],a}var ae,le=function(y,a,f){return y[0]=a[0]-f[0],y[1]=a[1]-f[1],y[2]=a[2]-f[2],y};ae=new l.A(3),l.A!=Float32Array&&(ae[0]=0,ae[1]=0,ae[2]=0);var ye=function(y){var a=y[0],f=y[1];return a*a+f*f};function ke(y){const a=[];if(typeof y=="string")a.push({id:"default",url:y});else if(y&&y.length>0){const f=[];for(const{id:m,url:g}of y){const b=`${m}${g}`;f.indexOf(b)===-1&&(f.push(b),a.push({id:m,url:g}))}}return a}(function(){var y=new l.A(2);l.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Q{constructor(a,f,m,g){this.context=a,this.format=m,this.texture=a.gl.createTexture(),this.update(f,g)}update(a,f,m){const{width:g,height:b}=a,T=!(this.size&&this.size[0]===g&&this.size[1]===b||m),{context:L}=this,{gl:A}=L;if(this.useMipmap=!!(f&&f.useMipmap),A.bindTexture(A.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===A.RGBA&&(!f||f.premultiply!==!1)),T)this.size=[g,b],a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement||a instanceof ImageData||l.b(a)?A.texImage2D(A.TEXTURE_2D,0,this.format,this.format,A.UNSIGNED_BYTE,a):A.texImage2D(A.TEXTURE_2D,0,this.format,g,b,0,this.format,A.UNSIGNED_BYTE,a.data);else{const{x:N,y:V}=m||{x:0,y:0};a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement||a instanceof ImageData||l.b(a)?A.texSubImage2D(A.TEXTURE_2D,0,N,V,A.RGBA,A.UNSIGNED_BYTE,a):A.texSubImage2D(A.TEXTURE_2D,0,N,V,g,b,A.RGBA,A.UNSIGNED_BYTE,a.data)}this.useMipmap&&this.isSizePowerOfTwo()&&A.generateMipmap(A.TEXTURE_2D)}bind(a,f,m){const{context:g}=this,{gl:b}=g;b.bindTexture(b.TEXTURE_2D,this.texture),m!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=b.LINEAR),a!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,a),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,m||a),this.filter=a),f!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:a}=this.context;a.deleteTexture(this.texture),this.texture=null}}function oe(y){const{userImage:a}=y;return!!(a&&a.render&&a.render())&&(y.data.replace(new Uint8Array(a.data.buffer)),!0)}class qe extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:f,promiseResolve:m}of this.requestors)m(this._getImagesForIds(f));this.requestors=[]}}getImage(a){const f=this.images[a];if(f&&!f.data&&f.spriteData){const m=f.spriteData;f.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),f.spriteData=null}return f}addImage(a,f){if(this.images[a])throw new Error(`Image id ${a} already exist, use updateImage instead`);this._validate(a,f)&&(this.images[a]=f)}_validate(a,f){let m=!0;const g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new l.j(new Error(`Image "${a}" has invalid "stretchX" value`))),m=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new l.j(new Error(`Image "${a}" has invalid "stretchY" value`))),m=!1),this._validateContent(f.content,f)||(this.fire(new l.j(new Error(`Image "${a}" has invalid "content" value`))),m=!1),m}_validateStretch(a,f){if(!a)return!0;let m=0;for(const g of a){if(g[0]{let g=!0;if(!this.isLoaded())for(const b of a)this.images[b]||(g=!1);this.isLoaded()||g?f(this._getImagesForIds(a)):this.requestors.push({ids:a,promiseResolve:f})})}_getImagesForIds(a){const f={};for(const m of a){let g=this.getImage(m);g||(this.fire(new l.k("styleimagemissing",{id:m})),g=this.getImage(m)),g?f[m]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:l.w(`Image "${m}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:a,height:f}=this.atlasImage;return{width:a,height:f}}getPattern(a){const f=this.patterns[a],m=this.getImage(a);if(!m)return null;if(f&&f.position.version===m.version)return f.position;if(f)f.position.version=m.version;else{const g={w:m.data.width+2,h:m.data.height+2,x:0,y:0},b=new l.I(g,m);this.patterns[a]={bin:g,position:b}}return this._updatePatternAtlas(),this.patterns[a].position}bind(a){const f=a.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Q(a,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const a=[];for(const b in this.patterns)a.push(this.patterns[b].bin);const{w:f,h:m}=l.p(a),g=this.atlasImage;g.resize({width:f||1,height:m||1});for(const b in this.patterns){const{bin:T}=this.patterns[b],L=T.x+1,A=T.y+1,N=this.getImage(b).data,V=N.width,j=N.height;l.R.copy(N,g,{x:0,y:0},{x:L,y:A},{width:V,height:j}),l.R.copy(N,g,{x:0,y:j-1},{x:L,y:A-1},{width:V,height:1}),l.R.copy(N,g,{x:0,y:0},{x:L,y:A+j},{width:V,height:1}),l.R.copy(N,g,{x:V-1,y:0},{x:L-1,y:A},{width:1,height:j}),l.R.copy(N,g,{x:0,y:0},{x:L+V,y:A},{width:1,height:j})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(a){for(const f of a){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const m=this.getImage(f);m||l.w(`Image with ID: "${f}" was not found`),oe(m)&&this.updateImage(f,m)}}}const Pe=1e20;function it(y,a,f,m,g,b,T,L,A){for(let N=a;N-1);A++,b[A]=L,T[A]=N,T[A+1]=Pe}for(let L=0,A=0;L65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[b])return{stack:a,id:f,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[b]){const L=Xe.loadGlyphRange(a,b,this.url,this.requestManager);m.requests[b]=L}const T=yield m.requests[b];for(const L in T)this._doesCharSupportLocalGlyph(+L)||(m.glyphs[+L]=T[+L]);return m.ranges[b]=!0,{stack:a,id:f,glyph:T[f]||null}})}_doesCharSupportLocalGlyph(a){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](a)||l.u["Hangul Syllables"](a)||l.u.Hiragana(a)||l.u.Katakana(a))}_tinySDF(a,f,m){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(m))return;let b=a.tinySDF;if(!b){let L="400";/bold/i.test(f)?L="900":/medium/i.test(f)?L="500":/light/i.test(f)&&(L="200"),b=a.tinySDF=new Xe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:L})}const T=b.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:T.width||60,height:T.height||60},T.data),metrics:{width:T.glyphWidth/2||24,height:T.glyphHeight/2||24,left:T.glyphLeft/2+.5||0,top:T.glyphTop/2-27.5||-8,advance:T.glyphAdvance/2||24,isDoubleResolution:!0}}}}Xe.loadGlyphRange=function(y,a,f,m){return l._(this,void 0,void 0,function*(){const g=256*a,b=g+255,T=m.transformRequest(f.replace("{fontstack}",y).replace("{range}",`${g}-${b}`),"Glyphs"),L=yield l.l(T,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${a}, ${g}-${b}`);const A={};for(const N of l.n(L.data))A[N.id]=N;return A})},Xe.TinySDF=class{constructor({fontSize:y=24,buffer:a=3,radius:f=8,cutoff:m=.25,fontFamily:g="sans-serif",fontWeight:b="normal",fontStyle:T="normal"}={}){this.buffer=a,this.cutoff=m,this.radius=f;const L=this.size=y+4*a,A=this._createCanvas(L),N=this.ctx=A.getContext("2d",{willReadFrequently:!0});N.font=`${T} ${b} ${y}px ${g}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(y){const a=document.createElement("canvas");return a.width=a.height=y,a}draw(y){const{width:a,actualBoundingBoxAscent:f,actualBoundingBoxDescent:m,actualBoundingBoxLeft:g,actualBoundingBoxRight:b}=this.ctx.measureText(y),T=Math.ceil(f),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-g))),A=Math.min(this.size-this.buffer,T+Math.ceil(m)),N=L+2*this.buffer,V=A+2*this.buffer,j=Math.max(N*V,0),Y=new Uint8ClampedArray(j),he={data:Y,width:N,height:V,glyphWidth:L,glyphHeight:A,glyphTop:T,glyphLeft:0,glyphAdvance:a};if(L===0||A===0)return he;const{ctx:ce,buffer:ge,gridInner:re,gridOuter:Ie}=this;ce.clearRect(ge,ge,L,A),ce.fillText(y,ge,ge+T);const je=ce.getImageData(ge,ge,L,A);Ie.fill(Pe,0,j),re.fill(0,0,j);for(let xe=0;xe0?Ke*Ke:0,re[Ze]=Ke<0?Ke*Ke:0}}it(Ie,0,0,N,V,N,this.f,this.v,this.z),it(re,ge,ge,L,A,N,this.f,this.v,this.z);for(let xe=0;xe1&&(A=a[++L]);const V=Math.abs(N-A.left),j=Math.abs(N-A.right),Y=Math.min(V,j);let he;const ce=b/m*(g+1);if(A.isDash){const ge=g-Math.abs(ce);he=Math.sqrt(Y*Y+ge*ge)}else he=g-Math.sqrt(Y*Y+ce*ce);this.data[T+N]=Math.max(0,Math.min(255,he+128))}}}addRegularDash(a){for(let L=a.length-1;L>=0;--L){const A=a[L],N=a[L+1];A.zeroLength?a.splice(L,1):N&&N.isDash===A.isDash&&(N.left=A.left,a.splice(L,1))}const f=a[0],m=a[a.length-1];f.isDash===m.isDash&&(f.left=m.left-this.width,m.right=f.right+this.width);const g=this.width*this.nextRow;let b=0,T=a[b];for(let L=0;L1&&(T=a[++b]);const A=Math.abs(L-T.left),N=Math.abs(L-T.right),V=Math.min(A,N);this.data[g+L]=Math.max(0,Math.min(255,(T.isDash?V:-V)+128))}}addDash(a,f){const m=f?7:0,g=2*m+1;if(this.nextRow+g>this.height)return l.w("LineAtlas out of space"),null;let b=0;for(let L=0;L{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Tt]}numActive(){return Object.keys(this.active).length}}const Rn=Math.floor(E.hardwareConcurrency/2);let Jt,pn;function Nn(){return Jt||(Jt=new tn),Jt}tn.workerCount=l.B(globalThis)?Math.max(Math.min(Rn,3),1):1;class En{constructor(a,f){this.workerPool=a,this.actors=[],this.currentActor=0,this.id=f;const m=this.workerPool.acquire(f);for(let g=0;g{f.remove()}),this.actors=[],a&&this.workerPool.release(this.id)}registerMessageHandler(a,f){for(const m of this.actors)m.registerMessageHandler(a,f)}}function Nr(){return pn||(pn=new En(Nn(),l.G),pn.registerMessageHandler("GR",(y,a,f)=>l.m(a,f))),pn}function Jn(y,a){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*y.width,.5*y.height,1]),l.K(f,f,y.calculatePosMatrix(a.toUnwrapped()))}function On(y,a,f,m,g,b){const T=function(j,Y,he){if(j)for(const ce of j){const ge=Y[ce];if(ge&&ge.source===he&&ge.type==="fill-extrusion")return!0}else for(const ce in Y){const ge=Y[ce];if(ge.source===he&&ge.type==="fill-extrusion")return!0}return!1}(g&&g.layers,a,y.id),L=b.maxPitchScaleFactor(),A=y.tilesIn(m,L,T);A.sort(Qn);const N=[];for(const j of A)N.push({wrappedTileID:j.tileID.wrapped().key,queryResults:j.tile.queryRenderedFeatures(a,f,y._state,j.queryGeometry,j.cameraQueryGeometry,j.scale,g,b,L,Jn(y.transform,j.tileID))});const V=function(j){const Y={},he={};for(const ce of j){const ge=ce.queryResults,re=ce.wrappedTileID,Ie=he[re]=he[re]||{};for(const je in ge){const xe=ge[je],De=Ie[je]=Ie[je]||{},Ge=Y[je]=Y[je]||[];for(const Ze of xe)De[Ze.featureIndex]||(De[Ze.featureIndex]=!0,Ge.push(Ze))}}return Y}(N);for(const j in V)V[j].forEach(Y=>{const he=Y.feature,ce=y.getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=ce});return V}function Qn(y,a){const f=y.tileID,m=a.tileID;return f.overscaledZ-m.overscaledZ||f.canonical.y-m.canonical.y||f.wrap-m.wrap||f.canonical.x-m.canonical.x}function ne(y,a,f){return l._(this,void 0,void 0,function*(){let m=y;if(y.url?m=(yield l.h(a.transformRequest(y.url,"Source"),f)).data:yield E.frameAsync(f),!m)return null;const g=l.L(l.e(m,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(g.vectorLayerIds=m.vector_layers.map(b=>b.id)),g})}class Ce{constructor(a,f){a&&(f?this.setSouthWest(a).setNorthEast(f):Array.isArray(a)&&(a.length===4?this.setSouthWest([a[0],a[1]]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1])))}setNorthEast(a){return this._ne=a instanceof l.M?new l.M(a.lng,a.lat):l.M.convert(a),this}setSouthWest(a){return this._sw=a instanceof l.M?new l.M(a.lng,a.lat):l.M.convert(a),this}extend(a){const f=this._sw,m=this._ne;let g,b;if(a instanceof l.M)g=a,b=a;else{if(!(a instanceof Ce))return Array.isArray(a)?a.length===4||a.every(Array.isArray)?this.extend(Ce.convert(a)):this.extend(l.M.convert(a)):a&&("lng"in a||"lon"in a)&&"lat"in a?this.extend(l.M.convert(a)):this;if(g=a._sw,b=a._ne,!g||!b)return this}return f||m?(f.lng=Math.min(g.lng,f.lng),f.lat=Math.min(g.lat,f.lat),m.lng=Math.max(b.lng,m.lng),m.lat=Math.max(b.lat,m.lat)):(this._sw=new l.M(g.lng,g.lat),this._ne=new l.M(b.lng,b.lat)),this}getCenter(){return new l.M((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 l.M(this.getWest(),this.getNorth())}getSouthEast(){return new l.M(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(a){const{lng:f,lat:m}=l.M.convert(a);let g=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&g}static convert(a){return a instanceof Ce?a:a&&new Ce(a)}static fromLngLat(a,f=0){const m=360*f/40075017,g=m/Math.cos(Math.PI/180*a.lat);return new Ce(new l.M(a.lng-g,a.lat-m),new l.M(a.lng+g,a.lat+m))}}class ot{constructor(a,f,m){this.bounds=Ce.convert(this.validateBounds(a)),this.minzoom=f||0,this.maxzoom=m||24}validateBounds(a){return Array.isArray(a)&&a.length===4?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3])]:[-180,-90,180,90]}contains(a){const f=Math.pow(2,a.z),m=Math.floor(l.N(this.bounds.getWest())*f),g=Math.floor(l.O(this.bounds.getNorth())*f),b=Math.ceil(l.N(this.bounds.getEast())*f),T=Math.ceil(l.O(this.bounds.getSouth())*f);return a.x>=m&&a.x=g&&a.y{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(f,"Tile"),uid:a.uid,tileID:a.tileID,zoom:a.tileID.overscaledZ,tileSize:this.tileSize*a.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let g="RT";if(a.actor&&a.state!=="expired"){if(a.state==="loading")return new Promise((b,T)=>{a.reloadPromise={resolve:b,reject:T}})}else a.actor=this.dispatcher.getActor(),g="LT";a.abortController=new AbortController;try{const b=yield a.actor.sendAsync({type:g,data:m},a.abortController);if(delete a.abortController,a.aborted)return;this._afterTileLoadWorkerResponse(a,b)}catch(b){if(delete a.abortController,a.aborted)return;if(b&&b.status!==404)throw b;this._afterTileLoadWorkerResponse(a,null)}})}_afterTileLoadWorkerResponse(a,f){if(f&&f.resourceTiming&&(a.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&a.setExpiryData(f),a.loadVectorData(f,this.map.painter),a.reloadPromise){const m=a.reloadPromise;a.reloadPromise=null,this.loadTile(a).then(m.resolve).catch(m.reject)}}abortTile(a){return l._(this,void 0,void 0,function*(){a.abortController&&(a.abortController.abort(),delete a.abortController),a.actor&&(yield a.actor.sendAsync({type:"AT",data:{uid:a.uid,type:this.type,source:this.id}}))})}unloadTile(a){return l._(this,void 0,void 0,function*(){a.unloadVectorData(),a.actor&&(yield a.actor.sendAsync({type:"RMT",data:{uid:a.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Re extends l.E{constructor(a,f,m,g){super(),this.id=a,this.dispatcher=m,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=l.e({type:"raster"},f),l.e(this,l.L(f,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const a=yield ne(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,a&&(l.e(this,a),a.bounds&&(this.tileBounds=new ot(a.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(a){this._tileJSONRequest=null,this.fire(new l.j(a))}})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(a){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),a(),this.load()}setTiles(a){return this.setSourceProperty(()=>{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}serialize(){return l.e({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);a.abortController=new AbortController;try{const m=yield G.getImage(this.map._requestManager.transformRequest(f,"Tile"),a.abortController,this.map._refreshExpiredTiles);if(delete a.abortController,a.aborted)return void(a.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&a.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const g=this.map.painter.context,b=g.gl,T=m.data;a.texture=this.map.painter.getTileTexture(T.width),a.texture?a.texture.update(T,{useMipmap:!0}):(a.texture=new Q(g,T,b.RGBA,{useMipmap:!0}),a.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&b.texParameterf(b.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),a.state="loaded"}}catch(m){if(delete a.abortController,a.aborted)a.state="unloaded";else if(m)throw a.state="errored",m}})}abortTile(a){return l._(this,void 0,void 0,function*(){a.abortController&&(a.abortController.abort(),delete a.abortController)})}unloadTile(a){return l._(this,void 0,void 0,function*(){a.texture&&this.map.painter.saveTileTexture(a.texture)})}hasTransition(){return!1}}class on extends Re{constructor(a,f,m,g){super(a,f,m,g),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(f,"Tile");a.neighboringTiles=this._getNeighboringTiles(a.tileID),a.abortController=new AbortController;try{const g=yield G.getImage(m,a.abortController,this.map._refreshExpiredTiles);if(delete a.abortController,a.aborted)return void(a.state="unloaded");if(g&&g.data){const b=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&a.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const T=l.b(b)&&l.S()?b:yield this.readImageNow(b),L={type:this.type,uid:a.uid,source:this.id,rawImageData:T,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!a.actor||a.state==="expired"){a.actor=this.dispatcher.getActor();const A=yield a.actor.sendAsync({type:"LDT",data:L});a.dem=A,a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0,a.state="loaded"}}}catch(g){if(delete a.abortController,a.aborted)a.state="unloaded";else if(g)throw a.state="errored",g}})}readImageNow(a){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.U()){const f=a.width+2,m=a.height+2;try{return new l.R({width:f,height:m},yield l.V(a,-1,-1,f,m))}catch{}}return E.getImageData(a,1)})}_getNeighboringTiles(a){const f=a.canonical,m=Math.pow(2,f.z),g=(f.x-1+m)%m,b=f.x===0?a.wrap-1:a.wrap,T=(f.x+1+m)%m,L=f.x+1===m?a.wrap+1:a.wrap,A={};return A[new l.Q(a.overscaledZ,b,f.z,g,f.y).key]={backfilled:!1},A[new l.Q(a.overscaledZ,L,f.z,T,f.y).key]={backfilled:!1},f.y>0&&(A[new l.Q(a.overscaledZ,b,f.z,g,f.y-1).key]={backfilled:!1},A[new l.Q(a.overscaledZ,a.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},A[new l.Q(a.overscaledZ,L,f.z,T,f.y-1).key]={backfilled:!1}),f.y+10&&l.e(b,{resourceTiming:g}),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(a){return l._(this,void 0,void 0,function*(){const f=a.actor?"RT":"LT";a.actor=this.actor;const m={type:this.type,uid:a.uid,tileID:a.tileID,zoom:a.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.abortController=new AbortController;const g=yield this.actor.sendAsync({type:f,data:m},a.abortController);delete a.abortController,a.unloadVectorData(),a.aborted||a.loadVectorData(g,this.map.painter,f==="RT")})}abortTile(a){return l._(this,void 0,void 0,function*(){a.abortController&&(a.abortController.abort(),delete a.abortController),a.aborted=!0})}unloadTile(a){return l._(this,void 0,void 0,function*(){a.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:a.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var _n=l.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ur extends l.E{constructor(a,f,m,g){super(),this.id=a,this.dispatcher=m,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=f}load(a){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,a&&(this.coordinates=a),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new l.j(f))}})}loaded(){return this._loaded}updateImage(a){return a.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=a.url,this.load(a.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(a){this.coordinates=a;const f=a.map(l.Y.fromLngLat);this.tileID=function(g){let b=1/0,T=1/0,L=-1/0,A=-1/0;for(const Y of g)b=Math.min(b,Y.x),T=Math.min(T,Y.y),L=Math.max(L,Y.x),A=Math.max(A,Y.y);const N=Math.max(L-b,A-T),V=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),j=Math.pow(2,V);return new l.a0(V,Math.floor((b+L)/2*j),Math.floor((T+A)/2*j))}(f),this.minzoom=this.maxzoom=this.tileID.z;const m=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new l.Z,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.W,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.W),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.W,l.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const a=this.map.painter.context,f=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,_n.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Q(a,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const b=this.tiles[g];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(a){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={}):a.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Go extends ur{constructor(a,f,m,g){super(a,f,m,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const a=this.options;this.urls=[];for(const f of a.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield l.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new l.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(a){if(this.video){const f=this.video.seekable;af.end(0)?this.fire(new l.j(new l.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=a}}getVideo(){return this.video}onAdd(a){this.map||(this.map=a,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const a=this.map.painter.context,f=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,_n.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Q(a,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const b=this.tiles[g];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Cs extends ur{constructor(a,f,m,g){super(a,f,m,g),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(T=>typeof T!="number"))||this.fire(new l.j(new l.a1(`sources.${a}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a1(`sources.${a}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new l.j(new l.a1(`sources.${a}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a1(`sources.${a}`,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 l.j(new l.a1(`sources.${a}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return l._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.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())})}getCanvas(){return this.canvas}onAdd(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let a=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,a=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,a=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,m=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,_n.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?(a||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Q(f,this.canvas,m.RGBA,{premultiply:!0});let g=!1;for(const b in this.tiles){const T=this.tiles[b];T.state!=="loaded"&&(T.state="loaded",T.texture=this.texture,g=!0)}g&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height])if(isNaN(a)||a<=0)return!0;return!1}}const Ks={},tl=y=>{switch(y){case"geojson":return qr;case"image":return ur;case"raster":return Re;case"raster-dem":return on;case"vector":return kt;case"video":return Go;case"canvas":return Cs}return Ks[y]},Bi="RTLPluginLoaded";class zl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Nr()}_syncState(a){return this.status=a,this.dispatcher.broadcast("SRPS",{pluginStatus:a,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(a){return l._(this,arguments,void 0,function*(f,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Bi))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ts=null;function lt(){return Ts||(Ts=new zl),Ts}class us{constructor(a,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=a,this.uid=l.a3(),this.uses=0,this.tileSize=f,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(a){const f=a+this.timeAdded;fb.getLayer(N)).filter(Boolean);if(A.length!==0){L.layers=A,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(N=>A.filter(V=>V.id===N)[0]));for(const N of A)T[N.id]=L}}return T}(a.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const b=this.buckets[g];if(b instanceof l.a5){if(this.hasSymbolBuckets=!0,!m)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const b=this.buckets[g];if(b instanceof l.a5&&b.hasRTLText){this.hasRTLText=!0,lt().lazyLoad();break}}this.queryPadding=0;for(const g in this.buckets){const b=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(g).queryRadius(b))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage)}else this.collisionBoxArray=new l.a4}unloadVectorData(){for(const a in this.buckets)this.buckets[a].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(a){return this.buckets[a.id]}upload(a){for(const m in this.buckets){const g=this.buckets[m];g.uploadPending()&&g.upload(a)}const f=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Q(a,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Q(a,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)}queryRenderedFeatures(a,f,m,g,b,T,L,A,N,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:b,scale:T,tileSize:this.tileSize,pixelPosMatrix:V,transform:A,params:L,queryPadding:this.queryPadding*N},a,f,m):{}}querySourceFeatures(a,f){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const g=m.loadVTLayers(),b=f&&f.sourceLayer?f.sourceLayer:"",T=g._geojsonTileLayer||g[b];if(!T)return;const L=l.a6(f&&f.filter),{z:A,x:N,y:V}=this.tileID.canonical,j={z:A,x:N,y:V};for(let Y=0;Ym)g=!1;else if(f)if(this.expirationTime{this.remove(a,b)},m)),this.data[g].push(b),this.order.push(g),this.order.length>this.max){const T=this._getAndRemoveByKey(this.order[0]);T&&this.onRemove(T)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const f=this.data[a].shift();return f.timeout&&clearTimeout(f.timeout),this.data[a].length===0&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),f.value}getByKey(a){const f=this.data[a];return f?f[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(a,f){if(!this.has(a))return this;const m=a.wrapped().key,g=f===void 0?0:this.data[m].indexOf(f),b=this.data[m][g];return this.data[m].splice(g,1),b.timeout&&clearTimeout(b.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(b.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(a){for(this.max=a;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(a){const f=[];for(const m in this.data)for(const g of this.data[m])a(g.value)||f.push(g);for(const m of f)this.remove(m.value.tileID,m)}}class Fl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,f,m){const g=String(f);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][g]=this.stateChanges[a][g]||{},l.e(this.stateChanges[a][g],m),this.deletedStates[a]===null){this.deletedStates[a]={};for(const b in this.state[a])b!==g&&(this.deletedStates[a][b]=null)}else if(this.deletedStates[a]&&this.deletedStates[a][g]===null){this.deletedStates[a][g]={};for(const b in this.state[a][g])m[b]||(this.deletedStates[a][g][b]=null)}else for(const b in m)this.deletedStates[a]&&this.deletedStates[a][g]&&this.deletedStates[a][g][b]===null&&delete this.deletedStates[a][g][b]}removeFeatureState(a,f,m){if(this.deletedStates[a]===null)return;const g=String(f);if(this.deletedStates[a]=this.deletedStates[a]||{},m&&f!==void 0)this.deletedStates[a][g]!==null&&(this.deletedStates[a][g]=this.deletedStates[a][g]||{},this.deletedStates[a][g][m]=null);else if(f!==void 0)if(this.stateChanges[a]&&this.stateChanges[a][g])for(m in this.deletedStates[a][g]={},this.stateChanges[a][g])this.deletedStates[a][g][m]=null;else this.deletedStates[a][g]=null;else this.deletedStates[a]=null}getState(a,f){const m=String(f),g=l.e({},(this.state[a]||{})[m],(this.stateChanges[a]||{})[m]);if(this.deletedStates[a]===null)return{};if(this.deletedStates[a]){const b=this.deletedStates[a][f];if(b===null)return{};for(const T in b)delete g[T]}return g}initializeTileState(a,f){a.setFeatureState(this.state,f)}coalesceChanges(a,f){const m={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const b={};for(const T in this.stateChanges[g])this.state[g][T]||(this.state[g][T]={}),l.e(this.state[g][T],this.stateChanges[g][T]),b[T]=this.state[g][T];m[g]=b}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const b={};if(this.deletedStates[g]===null)for(const T in this.state[g])b[T]={},this.state[g][T]={};else for(const T in this.deletedStates[g]){if(this.deletedStates[g][T]===null)this.state[g][T]={};else for(const L of Object.keys(this.deletedStates[g][T]))delete this.state[g][T][L];b[T]=this.state[g][T]}m[g]=m[g]||{},l.e(m[g],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const g in a)a[g].setFeatureState(m,f)}}class ci extends l.E{constructor(a,f,m){super(),this.id=a,this.dispatcher=m,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,b,T,L)=>{const A=new(tl(b.type))(g,b,T,L);if(A.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${A.id}`);return A})(a,f,m,this),this._tiles={},this._cache=new lo(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Fl,this._didEmitContent=!1,this._updated=!1}onAdd(a){this.map=a,this._maxTileCacheSize=a?a._maxTileCacheSize:null,this._maxTileCacheZoomLevels=a?a._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(a)}onRemove(a){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(a)}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 a in this._tiles){const f=this._tiles[a];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(a,f,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(a),this._tileLoaded(a,f,m)}catch(g){a.state="errored",g.status!==404?this._source.fire(new l.j(g,{tile:a})):this.update(this.transform,this.terrain)}})}_unloadTile(a){this._source.unloadTile&&this._source.unloadTile(a)}_abortTile(a){this._source.abortTile&&this._source.abortTile(a),this._source.fire(new l.k("dataabort",{tile:a,coord:a.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(a){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const m=this._tiles[f];m.upload(a),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(a=>a.tileID).sort(pt).map(a=>a.key)}getRenderableIds(a){const f=[];for(const m in this._tiles)this._isIdRenderable(m,a)&&f.push(this._tiles[m]);return a?f.sort((m,g)=>{const b=m.tileID,T=g.tileID,L=new l.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),A=new l.P(T.canonical.x,T.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-T.overscaledZ||A.y-L.y||A.x-L.x}).map(m=>m.tileID.key):f.map(m=>m.tileID).sort(pt).map(m=>m.key)}hasRenderableParent(a){const f=this.findLoadedParent(a,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(a,f){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(f||!this._tiles[a].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const a in this._tiles)this._tiles[a].state!=="errored"&&this._reloadTile(a,"reloading")}}_reloadTile(a,f){return l._(this,void 0,void 0,function*(){const m=this._tiles[a];m&&(m.state!=="loading"&&(m.state=f),yield this._loadTile(m,a,f))})}_tileLoaded(a,f,m){a.timeAdded=E.now(),m==="expired"&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(f,a),this.getSource().type==="raster-dem"&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null),a.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:a,coord:a.tileID}))}_backfillDEM(a){const f=this.getRenderableIds();for(let g=0;g1||(Math.abs(T)>1&&(Math.abs(T+A)===1?T+=A:Math.abs(T-A)===1&&(T-=A)),b.dem&&g.dem&&(g.dem.backfillBorder(b.dem,T,L),g.neighboringTiles&&g.neighboringTiles[N]&&(g.neighboringTiles[N].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(a,f,m,g){for(const b in this._tiles){let T=this._tiles[b];if(g[b]||!T.hasData()||T.tileID.overscaledZ<=f||T.tileID.overscaledZ>m)continue;let L=T.tileID;for(;T&&T.tileID.overscaledZ>f+1;){const N=T.tileID.scaledTo(T.tileID.overscaledZ-1);T=this._tiles[N.key],T&&T.hasData()&&(L=N)}let A=L;for(;A.overscaledZ>f;)if(A=A.scaledTo(A.overscaledZ-1),a[A.key]){g[L.key]=L;break}}}findLoadedParent(a,f){if(a.key in this._loadedParentTiles){const m=this._loadedParentTiles[a.key];return m&&m.tileID.overscaledZ>=f?m:null}for(let m=a.overscaledZ-1;m>=f;m--){const g=a.scaledTo(m),b=this._getLoadedTile(g);if(b)return b}}_getLoadedTile(a){const f=this._tiles[a.key];return f&&f.hasData()?f:this._cache.getByKey(a.wrapped().key)}updateCacheSize(a){const f=Math.ceil(a.width/this._source.tileSize)+1,m=Math.ceil(a.height/this._source.tileSize)+1,g=Math.floor(f*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(b)}handleWrapJump(a){const f=Math.round((a-(this._prevLng===void 0?a:this._prevLng))/360);if(this._prevLng=a,f){const m={};for(const g in this._tiles){const b=this._tiles[g];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+f),m[b.tileID.key]=b}this._tiles=m;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(a,f){if(!this._sourceLoaded||this._paused)return;let m;this.transform=a,this.terrain=f,this.updateCacheSize(a),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=a.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new l.Q(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(m=a.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:f}),this._source.hasTile&&(m=m.filter(V=>this._source.hasTile(V)))):m=[];const g=a.coveringZoomLevel(this._source),b=Math.max(g-ci.maxOverzooming,this._source.minzoom),T=Math.max(g+ci.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const j of m)if(j.canonical.z>this._source.minzoom){const Y=j.scaledTo(j.canonical.z-1);V[Y.key]=Y;const he=j.scaledTo(Math.max(this._source.minzoom,Math.min(j.canonical.z,5)));V[he.key]=he}m=m.concat(Object.values(V))}const L=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const A=this._updateRetainedTiles(m,g);if(un(this._source.type)){const V={},j={},Y=Object.keys(A),he=E.now();for(const ce of Y){const ge=A[ce],re=this._tiles[ce];if(!re||re.fadeEndTime!==0&&re.fadeEndTime<=he)continue;const Ie=this.findLoadedParent(ge,b);Ie&&(this._addTile(Ie.tileID),V[Ie.tileID.key]=Ie.tileID),j[ce]=ge}this._retainLoadedChildren(j,g,T,A);for(const ce in V)A[ce]||(this._coveredTiles[ce]=!0,A[ce]=V[ce]);if(f){const ce={},ge={};for(const re of m)this._tiles[re.key].hasData()?ce[re.key]=re:ge[re.key]=re;for(const re in ge){const Ie=ge[re].children(this._source.maxzoom);this._tiles[Ie[0].key]&&this._tiles[Ie[1].key]&&this._tiles[Ie[2].key]&&this._tiles[Ie[3].key]&&(ce[Ie[0].key]=A[Ie[0].key]=Ie[0],ce[Ie[1].key]=A[Ie[1].key]=Ie[1],ce[Ie[2].key]=A[Ie[2].key]=Ie[2],ce[Ie[3].key]=A[Ie[3].key]=Ie[3],delete ge[re])}for(const re in ge){const Ie=this.findLoadedParent(ge[re],this._source.minzoom);if(Ie){ce[Ie.tileID.key]=A[Ie.tileID.key]=Ie.tileID;for(const je in ce)ce[je].isChildOf(Ie.tileID)&&delete ce[je]}}for(const re in this._tiles)ce[re]||(this._coveredTiles[re]=!0)}}for(const V in A)this._tiles[V].clearFadeHold();const N=l.ab(this._tiles,A);for(const V of N){const j=this._tiles[V];j.hasSymbolBuckets&&!j.holdingForFade()?j.setHoldDuration(this.map._fadeDuration):j.hasSymbolBuckets&&!j.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(a)}_updateRetainedTiles(a,f){const m={},g={},b=Math.max(f-ci.maxOverzooming,this._source.minzoom),T=Math.max(f+ci.maxUnderzooming,this._source.minzoom),L={};for(const A of a){const N=this._addTile(A);m[A.key]=A,N.hasData()||fthis._source.maxzoom){const j=A.children(this._source.maxzoom)[0],Y=this.getTile(j);if(Y&&Y.hasData()){m[j.key]=j;continue}}else{const j=A.children(this._source.maxzoom);if(m[j[0].key]&&m[j[1].key]&&m[j[2].key]&&m[j[3].key])continue}let V=N.wasRequested();for(let j=A.overscaledZ-1;j>=b;--j){const Y=A.scaledTo(j);if(g[Y.key])break;if(g[Y.key]=!0,N=this.getTile(Y),!N&&V&&(N=this._addTile(Y)),N){const he=N.hasData();if((V||he)&&(m[Y.key]=Y),V=N.wasRequested(),he)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const a in this._tiles){const f=[];let m,g=this._tiles[a].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){m=this._loadedParentTiles[g.key];break}f.push(g.key);const b=g.scaledTo(g.overscaledZ-1);if(m=this._getLoadedTile(b),m)break;g=b}for(const b of f)this._loadedParentTiles[b]=m}}_addTile(a){let f=this._tiles[a.key];if(f)return f;f=this._cache.getAndRemove(a),f&&(this._setTileReloadTimer(a.key,f),f.tileID=a,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[a.key]&&(clearTimeout(this._cacheTimers[a.key]),delete this._cacheTimers[a.key],this._setTileReloadTimer(a.key,f)));const m=f;return f||(f=new us(a,this._source.tileSize*a.overscaleFactor()),this._loadTile(f,a.key,f.state)),f.uses++,this._tiles[a.key]=f,m||this._source.fire(new l.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(a,f){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const m=f.getExpiryTimeout();m&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},m))}_removeTile(a){const f=this._tiles[a];f&&(f.uses--,delete this._tiles[a],this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(a){const f=a.sourceDataType;a.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&a.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const a in this._tiles)this._removeTile(a);this._cache.reset()}tilesIn(a,f,m){const g=[],b=this.transform;if(!b)return g;const T=m?b.getCameraQueryGeometry(a):a,L=a.map(ce=>b.pointCoordinate(ce,this.terrain)),A=T.map(ce=>b.pointCoordinate(ce,this.terrain)),N=this.getIds();let V=1/0,j=1/0,Y=-1/0,he=-1/0;for(const ce of A)V=Math.min(V,ce.x),j=Math.min(j,ce.y),Y=Math.max(Y,ce.x),he=Math.max(he,ce.y);for(let ce=0;ce=0&&xe[1].y+je>=0){const De=L.map(Ze=>re.getTilePoint(Ze)),Ge=A.map(Ze=>re.getTilePoint(Ze));g.push({tile:ge,tileID:re,queryGeometry:De,cameraQueryGeometry:Ge,scale:Ie})}}return g}getVisibleCoordinates(a){const f=this.getRenderableIds(a).map(m=>this._tiles[m].tileID);for(const m of f)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(un(this._source.type)){const a=E.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=a)return!0}return!1}setFeatureState(a,f,m){this._state.updateState(a=a||"_geojsonTileLayer",f,m)}removeFeatureState(a,f,m){this._state.removeFeatureState(a=a||"_geojsonTileLayer",f,m)}getFeatureState(a,f){return this._state.getState(a=a||"_geojsonTileLayer",f)}setDependencies(a,f,m){const g=this._tiles[a];g&&g.setDependencies(f,m)}reloadTilesForDependencies(a,f){for(const m in this._tiles)this._tiles[m].hasDependency(a,f)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(a,f))}}function pt(y,a){const f=Math.abs(2*y.wrap)-+(y.wrap<0),m=Math.abs(2*a.wrap)-+(a.wrap<0);return y.overscaledZ-a.overscaledZ||m-f||a.canonical.y-y.canonical.y||a.canonical.x-y.canonical.x}function un(y){return y==="raster"||y==="image"||y==="video"}ci.maxOverzooming=10,ci.maxUnderzooming=3;class an{constructor(a,f){this.reset(a,f)}reset(a,f){this.points=a||[],this._distances=[0];for(let m=1;m0?(g-T)/L:0;return this.points[b].mult(1-A).add(this.points[f].mult(A))}}function Wr(y,a){let f=!0;return y==="always"||y!=="never"&&a!=="never"||(f=!1),f}class cs{constructor(a,f,m){const g=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(a/m),this.yCellCount=Math.ceil(f/m);for(let T=0;Tthis.width||g<0||f>this.height)return[];const A=[];if(a<=0&&f<=0&&this.width<=m&&this.height<=g){if(b)return[{key:null,x1:a,y1:f,x2:m,y2:g}];for(let N=0;N0}hitTestCircle(a,f,m,g,b){const T=a-m,L=a+m,A=f-m,N=f+m;if(L<0||T>this.width||N<0||A>this.height)return!1;const V=[];return this._forEachCell(T,A,L,N,this._queryCellCircle,V,{hitTest:!0,overlapMode:g,circle:{x:a,y:f,radius:m},seenUids:{box:{},circle:{}}},b),V.length>0}_queryCell(a,f,m,g,b,T,L,A){const{seenUids:N,hitTest:V,overlapMode:j}=L,Y=this.boxCells[b];if(Y!==null){const ce=this.bboxes;for(const ge of Y)if(!N.box[ge]){N.box[ge]=!0;const re=4*ge,Ie=this.boxKeys[ge];if(a<=ce[re+2]&&f<=ce[re+3]&&m>=ce[re+0]&&g>=ce[re+1]&&(!A||A(Ie))&&(!V||!Wr(j,Ie.overlapMode))&&(T.push({key:Ie,x1:ce[re],y1:ce[re+1],x2:ce[re+2],y2:ce[re+3]}),V))return!0}}const he=this.circleCells[b];if(he!==null){const ce=this.circles;for(const ge of he)if(!N.circle[ge]){N.circle[ge]=!0;const re=3*ge,Ie=this.circleKeys[ge];if(this._circleAndRectCollide(ce[re],ce[re+1],ce[re+2],a,f,m,g)&&(!A||A(Ie))&&(!V||!Wr(j,Ie.overlapMode))){const je=ce[re],xe=ce[re+1],De=ce[re+2];if(T.push({key:Ie,x1:je-De,y1:xe-De,x2:je+De,y2:xe+De}),V)return!0}}}return!1}_queryCellCircle(a,f,m,g,b,T,L,A){const{circle:N,seenUids:V,overlapMode:j}=L,Y=this.boxCells[b];if(Y!==null){const ce=this.bboxes;for(const ge of Y)if(!V.box[ge]){V.box[ge]=!0;const re=4*ge,Ie=this.boxKeys[ge];if(this._circleAndRectCollide(N.x,N.y,N.radius,ce[re+0],ce[re+1],ce[re+2],ce[re+3])&&(!A||A(Ie))&&!Wr(j,Ie.overlapMode))return T.push(!0),!0}}const he=this.circleCells[b];if(he!==null){const ce=this.circles;for(const ge of he)if(!V.circle[ge]){V.circle[ge]=!0;const re=3*ge,Ie=this.circleKeys[ge];if(this._circlesCollide(ce[re],ce[re+1],ce[re+2],N.x,N.y,N.radius)&&(!A||A(Ie))&&!Wr(j,Ie.overlapMode))return T.push(!0),!0}}}_forEachCell(a,f,m,g,b,T,L,A){const N=this._convertToXCellCoord(a),V=this._convertToYCellCoord(f),j=this._convertToXCellCoord(m),Y=this._convertToYCellCoord(g);for(let he=N;he<=j;he++)for(let ce=V;ce<=Y;ce++)if(b.call(this,a,f,m,g,this.xCellCount*ce+he,T,L,A))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,f,m,g,b,T){const L=g-a,A=b-f,N=m+T;return N*N>L*L+A*A}_circleAndRectCollide(a,f,m,g,b,T,L){const A=(T-g)/2,N=Math.abs(a-(g+A));if(N>A+m)return!1;const V=(L-b)/2,j=Math.abs(f-(b+V));if(j>V+m)return!1;if(N<=A||j<=V)return!0;const Y=N-A,he=j-V;return Y*Y+he*he<=m*m}}function sn(y,a,f,m,g){const b=l.F();return a?(l.J(b,b,[1/g,1/g,1]),f||l.ad(b,b,m.angle)):l.K(b,m.labelPlaneMatrix,y),b}function Aa(y,a,f,m,g){if(a){const b=l.ae(y);return l.J(b,b,[g,g,1]),f||l.ad(b,b,-m.angle),b}return m.glCoordMatrix}function Jr(y,a,f){let m;f?(m=[y.x,y.y,f(y.x,y.y),1],l.af(m,m,a)):(m=[y.x,y.y,0,1],Rt(m,m,a));const g=m[3];return{point:new l.P(m[0]/g,m[1]/g),signedDistanceFromCamera:g}}function pe(y,a){return .5+y/a*.5}function W(y,a){const f=y[0]/y[3],m=y[1]/y[3];return f>=-a[0]&&f<=a[0]&&m>=-a[1]&&m<=a[1]}function Z(y,a,f,m,g,b,T,L,A,N){const V=m?y.textSizeData:y.iconSizeData,j=l.ag(V,f.transform.zoom),Y=[256/f.width*2+1,256/f.height*2+1],he=m?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;he.clear();const ce=y.lineVertexArray,ge=m?y.text.placedSymbolArray:y.icon.placedSymbolArray,re=f.transform.width/f.transform.height;let Ie=!1;for(let je=0;jeMath.abs(f.x-a.x)*m?{useVertical:!0}:(y===l.ah.vertical?a.yf.x)?{needsFlipping:!0}:null}function Te(y,a,f,m,g,b,T,L,A,N,V,j,Y,he,ce,ge){const re=a/24,Ie=y.lineOffsetX*re,je=y.lineOffsetY*re;let xe;if(y.numGlyphs>1){const De=y.glyphStartIndex+y.numGlyphs,Ge=y.lineStartIndex,Ze=y.lineStartIndex+y.lineLength,Ke=J(re,L,Ie,je,f,V,j,y,A,b,Y,ce,ge);if(!Ke)return{notEnoughRoom:!0};const rt=Jr(Ke.first.point,T,ge).point,tt=Jr(Ke.last.point,T,ge).point;if(m&&!f){const ct=ue(y.writingMode,rt,tt,he);if(ct)return ct}xe=[Ke.first];for(let ct=y.glyphStartIndex+1;ct0?rt.point:ee(j,Ke,Ge,1,g,ge),ct=ue(y.writingMode,Ge,tt,he);if(ct)return ct}const De=He(re*L.getoffsetX(y.glyphStartIndex),Ie,je,f,V,j,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,A,b,Y,ce,ge);if(!De)return{notEnoughRoom:!0};xe=[De]}for(const De of xe)l.aj(N,De.point,De.angle);return{}}function ee(y,a,f,m,g,b){const T=Jr(y.add(y.sub(a)._unit()),g,b).point,L=f.sub(T);return f.add(L._mult(m/L.mag()))}function Me(y,a){const{projectionCache:f,lineVertexArray:m,labelPlaneMatrix:g,tileAnchorPoint:b,distanceFromAnchor:T,getElevation:L,previousVertex:A,direction:N,absOffsetX:V}=a;if(f.projections[y])return f.projections[y];const j=new l.P(m.getx(y),m.gety(y)),Y=Jr(j,g,L);if(Y.signedDistanceFromCamera>0)return f.projections[y]=Y.point,Y.point;const he=y-N;return ee(T===0?b:new l.P(m.getx(he),m.gety(he)),j,A,V-T+1,g,L)}function Se(y,a,f){return y._unit()._perp()._mult(a*f)}function Ne(y,a,f,m,g,b,T,L){const{projectionCache:A,direction:N}=L;if(A.offsets[y])return A.offsets[y];const V=f.add(a);if(y+N=g)return A.offsets[y]=V,V;const j=Me(y+N,L),Y=Se(j.sub(f),T,N),he=f.add(Y),ce=j.add(Y);return A.offsets[y]=l.ak(b,V,he,ce)||V,A.offsets[y]}function He(y,a,f,m,g,b,T,L,A,N,V,j,Y,he){const ce=m?y-a:y+a;let ge=ce>0?1:-1,re=0;m&&(ge*=-1,re=Math.PI),ge<0&&(re+=Math.PI);let Ie,je,xe=ge>0?L+T:L+T+1,De=g,Ge=g,Ze=0,Ke=0;const rt=Math.abs(ce),tt=[];let ct;for(;Ze+Ke<=rt;){if(xe+=ge,xe=A)return null;Ze+=Ke,Ge=De,je=Ie;const mt={projectionCache:j,lineVertexArray:N,labelPlaneMatrix:V,tileAnchorPoint:b,distanceFromAnchor:Ze,getElevation:he,previousVertex:Ge,direction:ge,absOffsetX:rt};if(De=Me(xe,mt),f===0)tt.push(Ge),ct=De.sub(Ge);else{let Xt;const hn=De.sub(Ge);Xt=hn.mag()===0?Se(Me(xe+ge,mt).sub(De),f,ge):Se(hn,f,ge),je||(je=Ge.add(Xt)),Ie=Ne(xe,Xt,De,L,A,je,f,mt),tt.push(je),ct=Ie.sub(je)}Ke=ct.mag()}const dt=ct._mult((rt-Ze)/Ke)._add(je||Ge),cn=re+Math.atan2(De.y-Ge.y,De.x-Ge.x);return tt.push(dt),{point:dt,angle:Y?cn:0,path:tt}}const Ye=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Je(y,a){for(let f=0;f=1;mn--)hn.push(mt.path[mn]);for(let mn=1;mnJr(vn,A,ce));hn=mn.some(vn=>vn.signedDistanceFromCamera<=0)?[]:mn.map(vn=>vn.point)}let Qt=[];if(hn.length>0){const mn=hn[0].clone(),vn=hn[0].clone();for(let Br=1;Br=ct.x&&vn.x<=dt.x&&mn.y>=ct.y&&vn.y<=dt.y?[hn]:vn.xdt.x||vn.ydt.y?[]:l.al([hn],ct.x,ct.y,dt.x,dt.y)}for(const mn of Qt){cn.reset(mn,.25*tt);let vn=0;vn=cn.length<=.5*tt?1:Math.ceil(cn.paddedLength/Pn)+1;for(let Br=0;Br=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(a,f,m,g){return m>=0&&a=0&&fm.collisionGroupID===f}}return this.collisionGroups[a]}}function _i(y,a,f,m,g){const{horizontalAlign:b,verticalAlign:T}=l.at(y);return new l.P(-(b-.5)*a+m[0]*g,-(T-.5)*f+m[1]*g)}function uo(y,a,f,m,g,b){const{x1:T,x2:L,y1:A,y2:N,anchorPointX:V,anchorPointY:j}=y,Y=new l.P(a,f);return m&&Y._rotate(g?b:-b),{x1:T+Y.x,y1:A+Y.y,x2:L+Y.x,y2:N+Y.y,anchorPointX:V,anchorPointY:j}}class Eo{constructor(a,f,m,g,b){this.transform=a.clone(),this.terrain=f,this.collisionIndex=new en(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Or(g),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(a,f,m,g){const b=m.getBucket(f),T=m.latestFeatureIndex;if(!b||!T||f.id!==b.layerIds[0])return;const L=m.collisionBoxArray,A=b.layers[0].layout,N=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),V=m.tileSize/l.W,j=this.transform.calculatePosMatrix(m.tileID.toUnwrapped()),Y=A.get("text-pitch-alignment")==="map",he=A.get("text-rotation-alignment")==="map",ce=nn(m,1,this.transform.zoom),ge=sn(j,Y,he,this.transform,ce);let re=null;if(Y){const je=Aa(j,Y,he,this.transform,ce);re=l.K([],this.transform.labelPlaneMatrix,je)}this.retainedQueryData[b.bucketInstanceId]=new dn(b.bucketInstanceId,T,b.sourceLayerIndex,b.index,m.tileID);const Ie={bucket:b,layout:A,posMatrix:j,textLabelPlaneMatrix:ge,labelToScreenMatrix:re,scale:N,textPixelRatio:V,holdingForFade:m.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:l.ag(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(g)for(const je of b.sortKeyRanges){const{sortKey:xe,symbolInstanceStart:De,symbolInstanceEnd:Ge}=je;a.push({sortKey:xe,symbolInstanceStart:De,symbolInstanceEnd:Ge,parameters:Ie})}else a.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Ie})}attemptAnchorPlacement(a,f,m,g,b,T,L,A,N,V,j,Y,he,ce,ge,re){const Ie=l.ap[a.textAnchor],je=[a.textOffset0,a.textOffset1],xe=_i(Ie,m,g,je,b),De=this.collisionIndex.placeCollisionBox(uo(f,xe.x,xe.y,T,L,this.transform.angle),j,A,N,V.predicate,re);if((!ge||this.collisionIndex.placeCollisionBox(uo(ge,xe.x,xe.y,T,L,this.transform.angle),j,A,N,V.predicate,re).box.length!==0)&&De.box.length>0){let Ge;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Y.crossTileID]&&this.prevPlacement.placements[Y.crossTileID]&&this.prevPlacement.placements[Y.crossTileID].text&&(Ge=this.prevPlacement.variableOffsets[Y.crossTileID].anchor),Y.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Y.crossTileID]={textOffset:je,width:m,height:g,anchor:Ie,textBoxScale:b,prevAnchor:Ge},this.markUsedJustification(he,Ie,Y,ce),he.allowVerticalPlacement&&(this.markUsedOrientation(he,ce,Y),this.placedOrientations[Y.crossTileID]=ce),{shift:xe,placedGlyphBoxes:De}}}placeLayerBucketPart(a,f,m){const{bucket:g,layout:b,posMatrix:T,textLabelPlaneMatrix:L,labelToScreenMatrix:A,textPixelRatio:N,holdingForFade:V,collisionBoxArray:j,partiallyEvaluatedTextSize:Y,collisionGroup:he}=a.parameters,ce=b.get("text-optional"),ge=b.get("icon-optional"),re=l.aq(b,"text-overlap","text-allow-overlap"),Ie=re==="always",je=l.aq(b,"icon-overlap","icon-allow-overlap"),xe=je==="always",De=b.get("text-rotation-alignment")==="map",Ge=b.get("text-pitch-alignment")==="map",Ze=b.get("icon-text-fit")!=="none",Ke=b.get("symbol-z-order")==="viewport-y",rt=Ie&&(xe||!g.hasIconData()||ge),tt=xe&&(Ie||!g.hasTextData()||ce);!g.collisionArrays&&j&&g.deserializeCollisionBoxes(j);const ct=this.retainedQueryData[g.bucketInstanceId].tileID,dt=this.terrain?(mt,Xt)=>this.terrain.getElevation(ct,mt,Xt):null,cn=(mt,Xt)=>{var hn,Pn;if(f[mt.crossTileID])return;if(V)return void(this.placements[mt.crossTileID]=new xr(!1,!1,!1));let Qt=!1,mn=!1,vn=!0,Br=null,Yn={box:null,offscreen:null},Zo={box:null,offscreen:null},yi=null,Lr=null,vi=null,Xo=0,ra=0,ll=0;Xt.textFeatureIndex?Xo=Xt.textFeatureIndex:mt.useRuntimeCollisionCircles&&(Xo=mt.featureIndex),Xt.verticalTextFeatureIndex&&(ra=Xt.verticalTextFeatureIndex);const Bc=Xt.textBox;if(Bc){const pi=di=>{let Mr=l.ah.horizontal;if(g.allowVerticalPlacement&&!di&&this.prevPlacement){const ds=this.prevPlacement.placedOrientations[mt.crossTileID];ds&&(this.placedOrientations[mt.crossTileID]=ds,Mr=ds,this.markUsedOrientation(g,Mr,mt))}return Mr},Pr=(di,Mr)=>{if(g.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&Xt.verticalTextBox){for(const ds of g.writingModes)if(ds===l.ah.vertical?(Yn=Mr(),Zo=Yn):Yn=di(),Yn&&Yn.box&&Yn.box.length)break}else Yn=di()},Sr=mt.textAnchorOffsetStartIndex,ps=mt.textAnchorOffsetEndIndex;if(ps===Sr){const di=(Mr,ds)=>{const mi=this.collisionIndex.placeCollisionBox(Mr,re,N,T,he.predicate,dt);return mi&&mi.box&&mi.box.length&&(this.markUsedOrientation(g,ds,mt),this.placedOrientations[mt.crossTileID]=ds),mi};Pr(()=>di(Bc,l.ah.horizontal),()=>{const Mr=Xt.verticalTextBox;return g.allowVerticalPlacement&&mt.numVerticalGlyphVertices>0&&Mr?di(Mr,l.ah.vertical):{box:null,offscreen:null}}),pi(Yn&&Yn.box&&Yn.box.length)}else{let di=l.ap[(Pn=(hn=this.prevPlacement)===null||hn===void 0?void 0:hn.variableOffsets[mt.crossTileID])===null||Pn===void 0?void 0:Pn.anchor];const Mr=(mi,Hr,Yp)=>{const pg=mi.x2-mi.x1,Zl=mi.y2-mi.y1,Xl=mt.textBoxScale,tf=Ze&&je==="never"?Hr:null;let cl={box:[],offscreen:!1},Kp=re==="never"?1:2,dg="never";di&&Kp++;for(let Jp=0;JpMr(Bc,Xt.iconBox,l.ah.horizontal),()=>{const mi=Xt.verticalTextBox;return g.allowVerticalPlacement&&!(Yn&&Yn.box&&Yn.box.length)&&mt.numVerticalGlyphVertices>0&&mi?Mr(mi,Xt.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),Yn&&(Qt=Yn.box,vn=Yn.offscreen);const ds=pi(Yn&&Yn.box);if(!Qt&&this.prevPlacement){const mi=this.prevPlacement.variableOffsets[mt.crossTileID];mi&&(this.variableOffsets[mt.crossTileID]=mi,this.markUsedJustification(g,mi.anchor,mt,ds))}}}if(yi=Yn,Qt=yi&&yi.box&&yi.box.length>0,vn=yi&&yi.offscreen,mt.useRuntimeCollisionCircles){const pi=g.text.placedSymbolArray.get(mt.centerJustifiedTextSymbolIndex),Pr=l.ai(g.textSizeData,Y,pi),Sr=b.get("text-padding");Lr=this.collisionIndex.placeCollisionCircles(re,pi,g.lineVertexArray,g.glyphOffsetArray,Pr,T,L,A,m,Ge,he.predicate,mt.collisionCircleDiameter,Sr,dt),Lr.circles.length&&Lr.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Qt=Ie||Lr.circles.length>0&&!Lr.collisionDetected,vn=vn&&Lr.offscreen}if(Xt.iconFeatureIndex&&(ll=Xt.iconFeatureIndex),Xt.iconBox){const pi=Pr=>{const Sr=Ze&&Br?uo(Pr,Br.x,Br.y,De,Ge,this.transform.angle):Pr;return this.collisionIndex.placeCollisionBox(Sr,je,N,T,he.predicate,dt)};Zo&&Zo.box&&Zo.box.length&&Xt.verticalIconBox?(vi=pi(Xt.verticalIconBox),mn=vi.box.length>0):(vi=pi(Xt.iconBox),mn=vi.box.length>0),vn=vn&&vi.offscreen}const ul=ce||mt.numHorizontalGlyphVertices===0&&mt.numVerticalGlyphVertices===0,ia=ge||mt.numIconVertices===0;if(ul||ia?ia?ul||(mn=mn&&Qt):Qt=mn&&Qt:mn=Qt=mn&&Qt,Qt&&yi&&yi.box&&this.collisionIndex.insertCollisionBox(yi.box,re,b.get("text-ignore-placement"),g.bucketInstanceId,Zo&&Zo.box&&ra?ra:Xo,he.ID),mn&&vi&&this.collisionIndex.insertCollisionBox(vi.box,je,b.get("icon-ignore-placement"),g.bucketInstanceId,ll,he.ID),Lr&&(Qt&&this.collisionIndex.insertCollisionCircles(Lr.circles,re,b.get("text-ignore-placement"),g.bucketInstanceId,Xo,he.ID),m)){const pi=g.bucketInstanceId;let Pr=this.collisionCircleArrays[pi];Pr===void 0&&(Pr=this.collisionCircleArrays[pi]=new hi);for(let Sr=0;Sr=0;--Xt){const hn=mt[Xt];cn(g.symbolInstances.get(hn),g.collisionArrays[hn])}}else for(let mt=a.symbolInstanceStart;mt=0&&(a.text.placedSymbolArray.get(L).crossTileID=b>=0&&L!==b?0:m.crossTileID)}markUsedOrientation(a,f,m){const g=f===l.ah.horizontal||f===l.ah.horizontalOnly?f:0,b=f===l.ah.vertical?f:0,T=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const L of T)a.text.placedSymbolArray.get(L).placedOrientation=g;m.verticalPlacedTextSymbolIndex&&(a.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let m=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const g=f?f.symbolFadeChange(a):1,b=f?f.opacities:{},T=f?f.variableOffsets:{},L=f?f.placedOrientations:{};for(const A in this.placements){const N=this.placements[A],V=b[A];V?(this.opacities[A]=new er(V,g,N.text,N.icon),m=m||N.text!==V.text.placed||N.icon!==V.icon.placed):(this.opacities[A]=new er(null,g,N.text,N.icon,N.skipFade),m=m||N.text||N.icon)}for(const A in b){const N=b[A];if(!this.opacities[A]){const V=new er(N,g,!1,!1);V.isHidden()||(this.opacities[A]=V,m=m||N.text.placed||N.icon.placed)}}for(const A in T)this.variableOffsets[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.variableOffsets[A]=T[A]);for(const A in L)this.placedOrientations[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.placedOrientations[A]=L[A]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=a:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:a)}updateLayerOpacities(a,f){const m={};for(const g of f){const b=g.getBucket(a);b&&g.latestFeatureIndex&&a.id===b.layerIds[0]&&this.updateBucketOpacities(b,m,g.collisionBoxArray)}}updateBucketOpacities(a,f,m){a.hasTextData()&&(a.text.opacityVertexArray.clear(),a.text.hasVisibleVertices=!1),a.hasIconData()&&(a.icon.opacityVertexArray.clear(),a.icon.hasVisibleVertices=!1),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexArray.clear(),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexArray.clear();const g=a.layers[0],b=g.layout,T=new er(null,0,!1,!1,!0),L=b.get("text-allow-overlap"),A=b.get("icon-allow-overlap"),N=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),V=b.get("text-rotation-alignment")==="map",j=b.get("text-pitch-alignment")==="map",Y=b.get("icon-text-fit")!=="none",he=new er(null,0,L&&(A||!a.hasIconData()||b.get("icon-optional")),A&&(L||!a.hasTextData()||b.get("text-optional")),!0);!a.collisionArrays&&m&&(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData())&&a.deserializeCollisionBoxes(m);const ce=(ge,re,Ie)=>{for(let je=0;je0,Ze=this.placedOrientations[re.crossTileID],Ke=Ze===l.ah.vertical,rt=Ze===l.ah.horizontal||Ze===l.ah.horizontalOnly;if(Ie>0||je>0){const tt=Io(De.text);ce(a.text,Ie,Ke?_c:tt),ce(a.text,je,rt?_c:tt);const ct=De.text.isHidden();[re.rightJustifiedTextSymbolIndex,re.centerJustifiedTextSymbolIndex,re.leftJustifiedTextSymbolIndex].forEach(mt=>{mt>=0&&(a.text.placedSymbolArray.get(mt).hidden=ct||Ke?1:0)}),re.verticalPlacedTextSymbolIndex>=0&&(a.text.placedSymbolArray.get(re.verticalPlacedTextSymbolIndex).hidden=ct||rt?1:0);const dt=this.variableOffsets[re.crossTileID];dt&&this.markUsedJustification(a,dt.anchor,re,Ze);const cn=this.placedOrientations[re.crossTileID];cn&&(this.markUsedJustification(a,"left",re,cn),this.markUsedOrientation(a,cn,re))}if(Ge){const tt=Io(De.icon),ct=!(Y&&re.verticalPlacedIconSymbolIndex&&Ke);re.placedIconSymbolIndex>=0&&(ce(a.icon,re.numIconVertices,ct?tt:_c),a.icon.placedSymbolArray.get(re.placedIconSymbolIndex).hidden=De.icon.isHidden()),re.verticalPlacedIconSymbolIndex>=0&&(ce(a.icon,re.numVerticalIconVertices,ct?_c:tt),a.icon.placedSymbolArray.get(re.verticalPlacedIconSymbolIndex).hidden=De.icon.isHidden())}if(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData()){const tt=a.collisionArrays[ge];if(tt){let ct=new l.P(0,0);if(tt.textBox||tt.verticalTextBox){let cn=!0;if(N){const mt=this.variableOffsets[xe];mt?(ct=_i(mt.anchor,mt.width,mt.height,mt.textOffset,mt.textBoxScale),V&&ct._rotate(j?this.transform.angle:-this.transform.angle)):cn=!1}tt.textBox&&Mi(a.textCollisionBox.collisionVertexArray,De.text.placed,!cn||Ke,ct.x,ct.y),tt.verticalTextBox&&Mi(a.textCollisionBox.collisionVertexArray,De.text.placed,!cn||rt,ct.x,ct.y)}const dt=!!(!rt&&tt.verticalIconBox);tt.iconBox&&Mi(a.iconCollisionBox.collisionVertexArray,De.icon.placed,dt,Y?ct.x:0,Y?ct.y:0),tt.verticalIconBox&&Mi(a.iconCollisionBox.collisionVertexArray,De.icon.placed,!dt,Y?ct.x:0,Y?ct.y:0)}}}if(a.sortFeatures(this.transform.angle),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder),a.hasTextData()&&a.text.opacityVertexBuffer&&a.text.opacityVertexBuffer.updateData(a.text.opacityVertexArray),a.hasIconData()&&a.icon.opacityVertexBuffer&&a.icon.opacityVertexBuffer.updateData(a.icon.opacityVertexArray),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexBuffer&&a.iconCollisionBox.collisionVertexBuffer.updateData(a.iconCollisionBox.collisionVertexArray),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexBuffer&&a.textCollisionBox.collisionVertexBuffer.updateData(a.textCollisionBox.collisionVertexArray),a.text.opacityVertexArray.length!==a.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${a.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${a.text.layoutVertexArray.length}) / 4`);if(a.icon.opacityVertexArray.length!==a.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${a.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${a.icon.layoutVertexArray.length}) / 4`);if(a.bucketInstanceId in this.collisionCircleArrays){const ge=this.collisionCircleArrays[a.bucketInstanceId];a.placementInvProjMatrix=ge.invProjMatrix,a.placementViewportMatrix=ge.viewportMatrix,a.collisionCircleArray=ge.circles,delete this.collisionCircleArrays[a.bucketInstanceId]}}symbolFadeChange(a){return this.fadeDuration===0?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTimea}setStale(){this.stale=!0}}function Mi(y,a,f,m,g){y.emplaceBack(a?1:0,f?1:0,m||0,g||0),y.emplaceBack(a?1:0,f?1:0,m||0,g||0),y.emplaceBack(a?1:0,f?1:0,m||0,g||0),y.emplaceBack(a?1:0,f?1:0,m||0,g||0)}const Js=Math.pow(2,25),Mm=Math.pow(2,24),Ty=Math.pow(2,17),Xn=Math.pow(2,16),yp=Math.pow(2,9),vp=Math.pow(2,8),qo=Math.pow(2,1);function Io(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const a=y.placed?1:0,f=Math.floor(127*y.opacity);return f*Js+a*Mm+f*Ty+a*Xn+f*yp+a*vp+f*qo+a}const _c=0;class hs{constructor(a){this._sortAcrossTiles=a.layout.get("symbol-z-order")!=="viewport-y"&&!a.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(a,f,m,g,b){const T=this._bucketParts;for(;this._currentTileIndexL.sortKey-A.sortKey));this._currentPartIndex!this._forceFullPlacement&&E.now()-g>2;for(;this._currentPlacementIndex>=0;){const T=f[a[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(T.type==="symbol"&&(!T.minzoom||T.minzoom<=L)&&(!T.maxzoom||T.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new hs(T)),this._inProgressLayer.continuePlacement(m[T.source],this.placement,this._showCollisionBoxes,T,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const Su=512/l.W/2;class gh{constructor(a,f,m){this.tileID=a,this.bucketInstanceId=m,this._symbolsByKey={};const g=new Map;for(let b=0;b({x:Math.floor(A.anchorX*Su),y:Math.floor(A.anchorY*Su)})),crossTileIDs:T.map(A=>A.crossTileID)};if(L.positions.length>128){const A=new l.au(L.positions.length,16,Uint16Array);for(const{x:N,y:V}of L.positions)A.add(N,V);A.finish(),delete L.positions,L.index=A}this._symbolsByKey[b]=L}}getScaledCoordinates(a,f){const{x:m,y:g,z:b}=this.tileID.canonical,{x:T,y:L,z:A}=f.canonical,N=Su/Math.pow(2,A-b),V=(L*l.W+a.anchorY)*N,j=g*l.W*Su;return{x:Math.floor((T*l.W+a.anchorX)*N-m*l.W*Su),y:Math.floor(V-j)}}findMatches(a,f,m){const g=this.tileID.canonical.za)}}class fi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class yc{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(a){const f=Math.round((a-this.lng)/360);if(f!==0)for(const m in this.indexes){const g=this.indexes[m],b={};for(const T in g){const L=g[T];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+f),b[L.tileID.key]=L}this.indexes[m]=b}this.lng=a}addBucket(a,f,m){if(this.indexes[a.overscaledZ]&&this.indexes[a.overscaledZ][a.key]){if(this.indexes[a.overscaledZ][a.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(a.overscaledZ,this.indexes[a.overscaledZ][a.key])}for(let b=0;ba.overscaledZ)for(const L in T){const A=T[L];A.tileID.isChildOf(a)&&A.findMatches(f.symbolInstances,a,g)}else{const L=T[a.scaledTo(Number(b)).key];L&&L.findMatches(f.symbolInstances,a,g)}}for(let b=0;b{f[m]=!0});for(const m in this.layerIndexes)f[m]||delete this.layerIndexes[m]}}const Tr=(y,a)=>l.t(y,a&&a.filter(f=>f.identifier!=="source.canvas")),_h=l.av();class Wo extends l.E{constructor(a,f={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const g=this.sourceCaches[m].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[m].reload()}},this.map=a,this.dispatcher=new En(Nn(),a._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,g)=>this.getGlyphs(m,g)),this.dispatcher.registerMessageHandler("GI",(m,g)=>this.getImages(m,g)),this.imageManager=new qe,this.imageManager.setEventedParent(this),this.glyphManager=new Xe(a._requestManager,f.localIdeographFontFamily),this.lineAtlas=new zt(256,512),this.crossTileSymbolIndex=new nl,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ax()),lt().on(Bi,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const g=this.sourceCaches[m.sourceId];if(!g)return;const b=g.getSource();if(b&&b.vectorLayerIds)for(const T in this._layers){const L=this._layers[T];L.source===b.id&&this._validateLayer(L)}})}loadURL(a,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(a,"Style");this._loadStyleRequest=new AbortController,l.h(g,this._loadStyleRequest).then(b=>{this._loadStyleRequest=null,this._load(b.data,f,m)}).catch(b=>{this._loadStyleRequest=null,b&&this.fire(new l.j(b))})}loadJSON(a,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(a,f,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(_h,{validate:!1})}_load(a,f,m){var g;const b=f.transformStyle?f.transformStyle(m,a):a;if(!f.validate||!Tr(this,l.x(b))){this._loaded=!0,this.stylesheet=b;for(const T in b.sources)this.addSource(T,b.sources[T],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new yt(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const a=l.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",a),this._order=a.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of a){const m=l.az(f);m.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=m}}_loadSprite(a,f=!1,m=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(b,T,L,A){return l._(this,void 0,void 0,function*(){const N=ke(b),V=L>1?"@2x":"",j={},Y={};for(const{id:he,url:ce}of N){const ge=T.transformRequest(T.normalizeSpriteURL(ce,V,".json"),"SpriteJSON");j[he]=l.h(ge,A);const re=T.transformRequest(T.normalizeSpriteURL(ce,V,".png"),"SpriteImage");Y[he]=G.getImage(re,A)}return yield Promise.all([...Object.values(j),...Object.values(Y)]),function(he,ce){return l._(this,void 0,void 0,function*(){const ge={};for(const re in he){ge[re]={};const Ie=E.getImageCanvasContext((yield ce[re]).data),je=(yield he[re]).data;for(const xe in je){const{width:De,height:Ge,x:Ze,y:Ke,sdf:rt,pixelRatio:tt,stretchX:ct,stretchY:dt,content:cn}=je[xe];ge[re][xe]={data:null,pixelRatio:tt,sdf:rt,stretchX:ct,stretchY:dt,content:cn,spriteData:{width:De,height:Ge,x:Ze,y:Ke,context:Ie}}}}return ge})}(j,Y)})}(a,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(b=>{if(this._spriteRequest=null,b)for(const T in b){this._spritesImagesIds[T]=[];const L=this._spritesImagesIds[T]?this._spritesImagesIds[T].filter(A=>!(A in b)):[];for(const A of L)this.imageManager.removeImage(A),this._changedImages[A]=!0;for(const A in b[T]){const N=T==="default"?A:`${T}:${A}`;this._spritesImagesIds[T].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,b[T][A],!1):this.imageManager.addImage(N,b[T][A]),f&&(this._changedImages[N]=!0)}}}).catch(b=>{this._spriteRequest=null,g=b,this.fire(new l.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(g)})}_unloadSprite(){for(const a of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(a),this._changedImages[a]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(a){const f=this.sourceCaches[a.source];if(!f)return;const m=a.sourceLayer;if(!m)return;const g=f.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${g.id}" as specified by style layer "${a.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this.sourceCaches)if(!this.sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(a){const f=this._serializedAllLayers();if(!a||a.length===0)return Object.values(f);const m=[];for(const g of a)f[g]&&m.push(f[g]);return m}_serializedAllLayers(){let a=this._serializedLayers;if(a)return a;a=this._serializedLayers={};const f=Object.keys(this._layers);for(const m of f){const g=this._layers[m];g.type!=="custom"&&(a[m]=g.serialize())}return a}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const a in this.sourceCaches)if(this.sourceCaches[a].hasTransition())return!0;for(const a in this._layers)if(this._layers[a].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(a){if(!this._loaded)return;const f=this._changed;if(f){const g=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(g.length||b.length)&&this._updateWorkerLayers(g,b);for(const T in this._updatedSources){const L=this._updatedSources[T];if(L==="reload")this._reloadSource(T);else{if(L!=="clear")throw new Error(`Invalid action ${L}`);this._clearSource(T)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const T in this._updatedPaintProps)this._layers[T].updateTransitions(a);this.light.updateTransitions(a),this._resetUpdates()}const m={};for(const g in this.sourceCaches){const b=this.sourceCaches[g];m[g]=b.used,b.used=!1}for(const g of this._order){const b=this._layers[g];b.recalculate(a,this._availableImages),!b.isHidden(a.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const g in m){const b=this.sourceCaches[g];!!m[g]!=!!b.used&&b.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(a),this.z=a.zoom,f&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const a in this.sourceCaches)this.sourceCaches[a].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(a,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(a),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(a,f={}){var m;this._checkLoaded();const g=this.serialize();if(a=f.transformStyle?f.transformStyle(g,a):a,((m=f.validate)===null||m===void 0||m)&&Tr(this,l.x(a)))return!1;(a=l.aA(a)).layers=l.ay(a.layers);const b=l.aB(g,a),T=this._getOperationsToPerform(b);if(T.unimplemented.length>0)throw new Error(`Unimplemented: ${T.unimplemented.join(", ")}.`);if(T.operations.length===0)return!1;for(const L of T.operations)L();return this.stylesheet=a,this._serializedLayers=null,!0}_getOperationsToPerform(a){const f=[],m=[];for(const g of a)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":f.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":f.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":f.push(()=>{});break;default:m.push(g.command)}return{operations:f,unimplemented:m}}addImage(a,f){if(this.getImage(a))return this.fire(new l.j(new Error(`An image named "${a}" already exists.`)));this.imageManager.addImage(a,f),this._afterImageUpdated(a)}updateImage(a,f){this.imageManager.updateImage(a,f)}getImage(a){return this.imageManager.getImage(a)}removeImage(a){if(!this.getImage(a))return this.fire(new l.j(new Error(`An image named "${a}" does not exist.`)));this.imageManager.removeImage(a),this._afterImageUpdated(a)}_afterImageUpdated(a){this._availableImages=this.imageManager.listImages(),this._changedImages[a]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(a,f,m={}){if(this._checkLoaded(),this.sourceCaches[a]!==void 0)throw new Error(`Source "${a}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(l.x.source,`sources.${a}`,f,null,m))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[a]=new ci(a,f,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:a})),g.onAdd(this.map),this._changed=!0}removeSource(a){if(this._checkLoaded(),this.sourceCaches[a]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===a)return this.fire(new l.j(new Error(`Source "${a}" cannot be removed while layer "${m}" is using it.`)));const f=this.sourceCaches[a];delete this.sourceCaches[a],delete this._updatedSources[a],f.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:a})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(a,f){if(this._checkLoaded(),this.sourceCaches[a]===void 0)throw new Error(`There is no source with this ID=${a}`);const m=this.sourceCaches[a].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(f),this._changed=!0}getSource(a){return this.sourceCaches[a]&&this.sourceCaches[a].getSource()}addLayer(a,f,m={}){this._checkLoaded();const g=a.id;if(this.getLayer(g))return void this.fire(new l.j(new Error(`Layer "${g}" already exists on this map.`)));let b;if(a.type==="custom"){if(Tr(this,l.aC(a)))return;b=l.az(a)}else{if("source"in a&&typeof a.source=="object"&&(this.addSource(g,a.source),a=l.aA(a),a=l.e(a,{source:g})),this._validate(l.x.layer,`layers.${g}`,a,{arrayIndex:-1},m))return;b=l.az(a),this._validateLayer(b),b.setEventedParent(this,{layer:{id:g}})}const T=f?this._order.indexOf(f):this._order.length;if(f&&T===-1)this.fire(new l.j(new Error(`Cannot add layer "${g}" before non-existing layer "${f}".`)));else{if(this._order.splice(T,0,g),this._layerOrderChanged=!0,this._layers[g]=b,this._removedLayers[g]&&b.source&&b.type!=="custom"){const L=this._removedLayers[g];delete this._removedLayers[g],L.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(a,f){if(this._checkLoaded(),this._changed=!0,!this._layers[a])return void this.fire(new l.j(new Error(`The layer '${a}' does not exist in the map's style and cannot be moved.`)));if(a===f)return;const m=this._order.indexOf(a);this._order.splice(m,1);const g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new l.j(new Error(`Cannot move layer "${a}" before non-existing layer "${f}".`))):(this._order.splice(g,0,a),this._layerOrderChanged=!0)}removeLayer(a){this._checkLoaded();const f=this._layers[a];if(!f)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${a}".`)));f.setEventedParent(null);const m=this._order.indexOf(a);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[a]=f,delete this._layers[a],this._serializedLayers&&delete this._serializedLayers[a],delete this._updatedLayers[a],delete this._updatedPaintProps[a],f.onRemove&&f.onRemove(this.map)}getLayer(a){return this._layers[a]}getLayersOrder(){return[...this._order]}hasLayer(a){return a in this._layers}setLayerZoomRange(a,f,m){this._checkLoaded();const g=this.getLayer(a);g?g.minzoom===f&&g.maxzoom===m||(f!=null&&(g.minzoom=f),m!=null&&(g.maxzoom=m),this._updateLayer(g)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${a}".`)))}setFilter(a,f,m={}){this._checkLoaded();const g=this.getLayer(a);if(g){if(!l.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(l.x.filter,`layers.${g.id}.filter`,f,null,m)||(g.filter=l.aA(f),this._updateLayer(g)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${a}".`)))}getFilter(a){return l.aA(this.getLayer(a).filter)}setLayoutProperty(a,f,m,g={}){this._checkLoaded();const b=this.getLayer(a);b?l.aD(b.getLayoutProperty(f),m)||(b.setLayoutProperty(f,m,g),this._updateLayer(b)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${a}".`)))}getLayoutProperty(a,f){const m=this.getLayer(a);if(m)return m.getLayoutProperty(f);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${a}".`)))}setPaintProperty(a,f,m,g={}){this._checkLoaded();const b=this.getLayer(a);b?l.aD(b.getPaintProperty(f),m)||(b.setPaintProperty(f,m,g)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[a]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${a}".`)))}getPaintProperty(a,f){return this.getLayer(a).getPaintProperty(f)}setFeatureState(a,f){this._checkLoaded();const m=a.source,g=a.sourceLayer,b=this.sourceCaches[m];if(b===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const T=b.getSource().type;T==="geojson"&&g?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):T!=="vector"||g?(a.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(g,a.id,f)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(a,f){this._checkLoaded();const m=a.source,g=this.sourceCaches[m];if(g===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const b=g.getSource().type,T=b==="vector"?a.sourceLayer:void 0;b!=="vector"||T?f&&typeof a.id!="string"&&typeof a.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(T,a.id,f):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(a){this._checkLoaded();const f=a.source,m=a.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||m?(a.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(m,a.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const a=l.aE(this.sourceCaches,b=>b.serialize()),f=this._serializeByIds(this._order),m=this.map.getTerrain()||void 0,g=this.stylesheet;return l.aF({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:a,layers:f,terrain:m},b=>b!==void 0)}_updateLayer(a){this._updatedLayers[a.id]=!0,a.source&&!this._updatedSources[a.source]&&this.sourceCaches[a.source].getSource().type!=="raster"&&(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(a){const f=T=>this._layers[T].type==="fill-extrusion",m={},g=[];for(let T=this._order.length-1;T>=0;T--){const L=this._order[T];if(f(L)){m[L]=T;for(const A of a){const N=A[L];if(N)for(const V of N)g.push(V)}}}g.sort((T,L)=>L.intersectionZ-T.intersectionZ);const b=[];for(let T=this._order.length-1;T>=0;T--){const L=this._order[T];if(f(L))for(let A=g.length-1;A>=0;A--){const N=g[A].feature;if(m[N.layer.id]{const rt=Ie.featureSortOrder;if(rt){const tt=rt.indexOf(Ze.featureIndex);return rt.indexOf(Ke.featureIndex)-tt}return Ke.featureIndex-Ze.featureIndex});for(const Ze of Ge)De.push(Ze)}}for(const Ie in ce)ce[Ie].forEach(je=>{const xe=je.feature,De=N[L[Ie].source].getFeatureState(xe.layer["source-layer"],xe.id);xe.source=xe.layer.source,xe.layer["source-layer"]&&(xe.sourceLayer=xe.layer["source-layer"]),xe.state=De});return ce}(this._layers,T,this.sourceCaches,a,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(a,f){f&&f.filter&&this._validate(l.x.filter,"querySourceFeatures.filter",f.filter,null,f);const m=this.sourceCaches[a];return m?function(g,b){const T=g.getRenderableIds().map(N=>g.getTileByID(N)),L=[],A={};for(let N=0;NY.getTileByID(he)).sort((he,ce)=>ce.tileID.overscaledZ-he.tileID.overscaledZ||(he.tileID.isLessThan(ce.tileID)?-1:1))}const j=this.crossTileSymbolIndex.addLayer(V,A[V.source],a.center.lng);T=T||j}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),a.zoom))&&(this.pauseablePlacement=new fs(a,this.map.terrain,this._order,b,f,m,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,A),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),L=!0),T&&this.pauseablePlacement.placement.setStale()),L||T)for(const N of this._order){const V=this._layers[N];V.type==="symbol"&&this.placement.updateLayerOpacities(V,A[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const a in this.sourceCaches)this.sourceCaches[a].releaseSymbolFadeTiles()}getImages(a,f){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,f.icons),m})}getGlyphs(a,f){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(f.stacks),g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(a,f={}){this._checkLoaded(),a&&this._validate(l.x.glyphs,"glyphs",a,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=a,this.glyphManager.entries={},this.glyphManager.setURL(a))}addSprite(a,f,m={},g){this._checkLoaded();const b=[{id:a,url:f}],T=[...ke(this.stylesheet.sprite),...b];this._validate(l.x.sprite,"sprite",T,null,m)||(this.stylesheet.sprite=T,this._loadSprite(b,!0,g))}removeSprite(a){this._checkLoaded();const f=ke(this.stylesheet.sprite);if(f.find(m=>m.id===a)){if(this._spritesImagesIds[a])for(const m of this._spritesImagesIds[a])this.imageManager.removeImage(m),this._changedImages[m]=!0;f.splice(f.findIndex(m=>m.id===a),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[a],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${a}" doesn't exists on this map.`)))}getSprite(){return ke(this.stylesheet.sprite)}setSprite(a,f={},m){this._checkLoaded(),a&&this._validate(l.x.sprite,"sprite",a,null,f)||(this.stylesheet.sprite=a,a?this._loadSprite(a,!0,m):(this._unloadSprite(),m&&m(null)))}}var yh=l.X([{name:"a_pos",type:"Int16",components:2}]),Qs="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 vc={prelude:$n(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -527,71 +527,71 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:$n("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Qs),terrainDepth:$n("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Qs),terrainCoords:$n("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Qs)};function $n(y,a){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=a.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=a.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),T=b?b.concat(g):g,L={};return{fragmentSource:y=y.replace(f,(A,O,U,j,$)=>(L[$]=!0,O==="define"?` -#ifndef HAS_UNIFORM_u_${$} -varying ${U} ${j} ${$}; +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:$n("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Qs),terrainDepth:$n("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Qs),terrainCoords:$n("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Qs)};function $n(y,a){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=a.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=a.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),T=b?b.concat(g):g,L={};return{fragmentSource:y=y.replace(f,(A,N,V,j,Y)=>(L[Y]=!0,N==="define"?` +#ifndef HAS_UNIFORM_u_${Y} +varying ${V} ${j} ${Y}; #else -uniform ${U} ${j} u_${$}; +uniform ${V} ${j} u_${Y}; #endif `:` -#ifdef HAS_UNIFORM_u_${$} - ${U} ${j} ${$} = u_${$}; -#endif -`)),vertexSource:a=a.replace(f,(A,O,U,j,$)=>{const he=j==="float"?"vec2":"vec4",ce=$.match(/color/)?"color":he;return L[$]?O==="define"?` -#ifndef HAS_UNIFORM_u_${$} -uniform lowp float u_${$}_t; -attribute ${U} ${he} a_${$}; -varying ${U} ${j} ${$}; +#ifdef HAS_UNIFORM_u_${Y} + ${V} ${j} ${Y} = u_${Y}; +#endif +`)),vertexSource:a=a.replace(f,(A,N,V,j,Y)=>{const he=j==="float"?"vec2":"vec4",ce=Y.match(/color/)?"color":he;return L[Y]?N==="define"?` +#ifndef HAS_UNIFORM_u_${Y} +uniform lowp float u_${Y}_t; +attribute ${V} ${he} a_${Y}; +varying ${V} ${j} ${Y}; #else -uniform ${U} ${j} u_${$}; +uniform ${V} ${j} u_${Y}; #endif `:ce==="vec4"?` -#ifndef HAS_UNIFORM_u_${$} - ${$} = a_${$}; +#ifndef HAS_UNIFORM_u_${Y} + ${Y} = a_${Y}; #else - ${U} ${j} ${$} = u_${$}; + ${V} ${j} ${Y} = u_${Y}; #endif `:` -#ifndef HAS_UNIFORM_u_${$} - ${$} = unpack_mix_${ce}(a_${$}, u_${$}_t); +#ifndef HAS_UNIFORM_u_${Y} + ${Y} = unpack_mix_${ce}(a_${Y}, u_${Y}_t); #else - ${U} ${j} ${$} = u_${$}; + ${V} ${j} ${Y} = u_${Y}; #endif -`:O==="define"?` -#ifndef HAS_UNIFORM_u_${$} -uniform lowp float u_${$}_t; -attribute ${U} ${he} a_${$}; +`:N==="define"?` +#ifndef HAS_UNIFORM_u_${Y} +uniform lowp float u_${Y}_t; +attribute ${V} ${he} a_${Y}; #else -uniform ${U} ${j} u_${$}; +uniform ${V} ${j} u_${Y}; #endif `:ce==="vec4"?` -#ifndef HAS_UNIFORM_u_${$} - ${U} ${j} ${$} = a_${$}; +#ifndef HAS_UNIFORM_u_${Y} + ${V} ${j} ${Y} = a_${Y}; #else - ${U} ${j} ${$} = u_${$}; + ${V} ${j} ${Y} = u_${Y}; #endif `:` -#ifndef HAS_UNIFORM_u_${$} - ${U} ${j} ${$} = unpack_mix_${ce}(a_${$}, u_${$}_t); +#ifndef HAS_UNIFORM_u_${Y} + ${V} ${j} ${Y} = unpack_mix_${ce}(a_${Y}, u_${Y}_t); #else - ${U} ${j} ${$} = u_${$}; + ${V} ${j} ${Y} = u_${Y}; #endif -`}),staticAttributes:m,staticUniforms:T}}class vh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(a,f,m,g,b,T,L,A,O){this.context=a;let U=this.boundPaintVertexBuffers.length!==g.length;for(let j=0;!U&&j({u_depth:new l.aG(Ze,Ke.u_depth),u_terrain:new l.aG(Ze,Ke.u_terrain),u_terrain_dim:new l.aH(Ze,Ke.u_terrain_dim),u_terrain_matrix:new l.aI(Ze,Ke.u_terrain_matrix),u_terrain_unpack:new l.aJ(Ze,Ke.u_terrain_unpack),u_terrain_exaggeration:new l.aH(Ze,Ke.u_terrain_exaggeration)}))(a,Ge),this.binderUniforms=m?m.getUniforms(a,Ge):[]}draw(a,f,m,g,b,T,L,A,O,U,j,$,he,ce,me,re,Ie,Ue){const xe=a.gl;if(this.failedToCreate)return;if(a.program.set(this.program),a.setDepthMode(m),a.setStencilMode(g),a.setColorMode(b),a.setCullFace(T),A){a.activeTexture.set(xe.TEXTURE2),xe.bindTexture(xe.TEXTURE_2D,A.depthTexture),a.activeTexture.set(xe.TEXTURE3),xe.bindTexture(xe.TEXTURE_2D,A.texture);for(const Ge in this.terrainUniforms)this.terrainUniforms[Ge].set(A[Ge])}for(const Ge in this.fixedUniforms)this.fixedUniforms[Ge].set(L[Ge]);me&&me.setUniforms(a,this.binderUniforms,he,{zoom:ce});let De=0;switch(f){case xe.LINES:De=2;break;case xe.TRIANGLES:De=3;break;case xe.LINE_STRIP:De=1}for(const Ge of $.get()){const Ze=Ge.vaos||(Ge.vaos={});(Ze[O]||(Ze[O]=new vh)).bind(a,this,U,me?me.getPaintVertexBuffers():[],j,Ge.vertexOffset,re,Ie,Ue),xe.drawElements(f,Ge.primitiveLength*De,xe.UNSIGNED_SHORT,Ge.primitiveOffset*De*2)}}}function bh(y,a,f){const m=1/nn(f,1,a.transform.tileZoom),g=Math.pow(2,f.tileID.overscaledZ),b=f.tileSize*Math.pow(2,a.transform.tileZoom)/g,T=b*(f.tileID.canonical.x+f.tileID.wrap*g),L=b*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[m,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[T>>16,L>>16],u_pixel_coord_lower:[65535&T,65535&L]}}const bc=(y,a,f,m)=>{const g=a.style.light,b=g.properties.get("position"),T=[b.x,b.y,b.z],L=function(){var O=new l.A(9);return l.A!=Float32Array&&(O[1]=0,O[2]=0,O[3]=0,O[5]=0,O[6]=0,O[7]=0),O[0]=1,O[4]=1,O[8]=1,O}();g.properties.get("anchor")==="viewport"&&function(O,U){var j=Math.sin(U),$=Math.cos(U);O[0]=$,O[1]=j,O[2]=0,O[3]=-j,O[4]=$,O[5]=0,O[6]=0,O[7]=0,O[8]=1}(L,-a.transform.angle),function(O,U,j){var $=U[0],he=U[1],ce=U[2];O[0]=$*j[0]+he*j[3]+ce*j[6],O[1]=$*j[1]+he*j[4]+ce*j[7],O[2]=$*j[2]+he*j[5]+ce*j[8]}(T,T,L);const A=g.properties.get("color");return{u_matrix:y,u_lightpos:T,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[A.r,A.g,A.b],u_vertical_gradient:+f,u_opacity:m}},Ly=(y,a,f,m,g,b,T)=>l.e(bc(y,a,f,m),bh(b,a,T),{u_height_factor:-Math.pow(2,g.overscaledZ)/T.tileSize/8}),Am=y=>({u_matrix:y}),xh=(y,a,f,m)=>l.e(Am(y),bh(f,a,m)),Py=(y,a)=>({u_matrix:y,u_world:a}),km=(y,a,f,m,g)=>l.e(xh(y,a,f,m),{u_world:g}),My=(y,a,f,m)=>{const g=y.transform;let b,T;if(m.paint.get("circle-pitch-alignment")==="map"){const L=nn(f,1,g.zoom);b=!0,T=[L,L]}else b=!1,T=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(a.posMatrix,f,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:T}},Dm=(y,a,f)=>{const m=nn(f,1,a.zoom),g=Math.pow(2,a.zoom-f.tileID.overscaledZ),b=f.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:a.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[a.pixelsToGLUnits[0]/(m*g),a.pixelsToGLUnits[1]/(m*g)],u_overscale_factor:b}},Rm=(y,a,f=1)=>({u_matrix:y,u_color:a,u_overlay:0,u_overlay_scale:f}),wh=y=>({u_matrix:y}),Nm=(y,a,f,m)=>({u_matrix:y,u_extrude_scale:nn(a,1,f),u_intensity:m});function Om(y,a){const f=Math.pow(2,a.canonical.z),m=a.canonical.y;return[new l.Y(0,m/f).toLngLat().lat,new l.Y(0,(m+1)/f).toLngLat().lat]}const Sh=(y,a,f,m)=>{const g=y.transform;return{u_matrix:xc(y,a,f,m),u_ratio:1/nn(a,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},zm=(y,a,f,m,g)=>l.e(Sh(y,a,f,g),{u_image:0,u_image_height:m}),Bl=(y,a,f,m,g)=>{const b=y.transform,T=Ho(a,b);return{u_matrix:xc(y,a,f,g),u_texsize:a.imageAtlasTexture.size,u_ratio:1/nn(a,1,b.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[T,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Eh=(y,a,f,m,g,b)=>{const T=y.lineAtlas,L=Ho(a,y.transform),A=f.layout.get("line-cap")==="round",O=T.getDash(m.from,A),U=T.getDash(m.to,A),j=O.width*g.fromScale,$=U.width*g.toScale;return l.e(Sh(y,a,f,b),{u_patternscale_a:[L/j,-O.height/2],u_patternscale_b:[L/$,-U.height/2],u_sdfgamma:T.width/(256*Math.min(j,$)*y.pixelRatio)/2,u_image:0,u_tex_y_a:O.y,u_tex_y_b:U.y,u_mix:g.t})};function Ho(y,a){return 1/nn(y,1,a.tileZoom)}function xc(y,a,f,m){return y.translatePosMatrix(m?m.posMatrix:a.tileID.posMatrix,a,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const Ih=(y,a,f,m,g)=>{return{u_matrix:y,u_tl_parent:a,u_scale_parent:f,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.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:(T=g.paint.get("raster-saturation"),T>0?1-1/(1.001-T):-T),u_contrast_factor:(b=g.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:wc(g.paint.get("raster-hue-rotate"))};var b,T};function wc(y){y*=Math.PI/180;const a=Math.sin(y),f=Math.cos(y);return[(2*f+1)/3,(-Math.sqrt(3)*a-f+1)/3,(Math.sqrt(3)*a-f+1)/3]}const Sc=(y,a,f,m,g,b,T,L,A,O)=>{const U=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:U.cameraToCenterDistance,u_pitch:U.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:U.width/U.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:T,u_coord_matrix:L,u_is_text:+A,u_pitch_with_map:+m,u_texsize:O,u_texture:0}},Ec=(y,a,f,m,g,b,T,L,A,O,U)=>{const j=g.transform;return l.e(Sc(y,a,f,m,g,b,T,L,A,O),{u_gamma_scale:m?Math.cos(j._pitch)*j.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+U})},Ic=(y,a,f,m,g,b,T,L,A,O)=>l.e(Ec(y,a,f,m,g,b,T,L,!0,A,!0),{u_texsize_icon:O,u_texture_icon:1}),Ay=(y,a,f)=>({u_matrix:y,u_opacity:a,u_color:f}),ky=(y,a,f,m,g,b)=>l.e(function(T,L,A,O){const U=A.imageManager.getPattern(T.from.toString()),j=A.imageManager.getPattern(T.to.toString()),{width:$,height:he}=A.imageManager.getPixelSize(),ce=Math.pow(2,O.tileID.overscaledZ),me=O.tileSize*Math.pow(2,A.transform.tileZoom)/ce,re=me*(O.tileID.canonical.x+O.tileID.wrap*ce),Ie=me*O.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:U.tl,u_pattern_br_a:U.br,u_pattern_tl_b:j.tl,u_pattern_br_b:j.br,u_texsize:[$,he],u_mix:L.t,u_pattern_size_a:U.displaySize,u_pattern_size_b:j.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/nn(O,1,A.transform.tileZoom),u_pixel_coord_upper:[re>>16,Ie>>16],u_pixel_coord_lower:[65535&re,65535&Ie]}}(m,b,f,g),{u_matrix:y,u_opacity:a}),Fm={fillExtrusion:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_lightpos:new l.aK(y,a.u_lightpos),u_lightintensity:new l.aH(y,a.u_lightintensity),u_lightcolor:new l.aK(y,a.u_lightcolor),u_vertical_gradient:new l.aH(y,a.u_vertical_gradient),u_opacity:new l.aH(y,a.u_opacity)}),fillExtrusionPattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_lightpos:new l.aK(y,a.u_lightpos),u_lightintensity:new l.aH(y,a.u_lightintensity),u_lightcolor:new l.aK(y,a.u_lightcolor),u_vertical_gradient:new l.aH(y,a.u_vertical_gradient),u_height_factor:new l.aH(y,a.u_height_factor),u_image:new l.aG(y,a.u_image),u_texsize:new l.aL(y,a.u_texsize),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade),u_opacity:new l.aH(y,a.u_opacity)}),fill:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix)}),fillPattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_image:new l.aG(y,a.u_image),u_texsize:new l.aL(y,a.u_texsize),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade)}),fillOutline:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_world:new l.aL(y,a.u_world)}),fillOutlinePattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_world:new l.aL(y,a.u_world),u_image:new l.aG(y,a.u_image),u_texsize:new l.aL(y,a.u_texsize),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade)}),circle:(y,a)=>({u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_scale_with_map:new l.aG(y,a.u_scale_with_map),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_extrude_scale:new l.aL(y,a.u_extrude_scale),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_matrix:new l.aI(y,a.u_matrix)}),collisionBox:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(y,a.u_pixels_to_tile_units),u_extrude_scale:new l.aL(y,a.u_extrude_scale),u_overscale_factor:new l.aH(y,a.u_overscale_factor)}),collisionCircle:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_inv_matrix:new l.aI(y,a.u_inv_matrix),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_viewport_size:new l.aL(y,a.u_viewport_size)}),debug:(y,a)=>({u_color:new l.aM(y,a.u_color),u_matrix:new l.aI(y,a.u_matrix),u_overlay:new l.aG(y,a.u_overlay),u_overlay_scale:new l.aH(y,a.u_overlay_scale)}),clippingMask:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix)}),heatmap:(y,a)=>({u_extrude_scale:new l.aH(y,a.u_extrude_scale),u_intensity:new l.aH(y,a.u_intensity),u_matrix:new l.aI(y,a.u_matrix)}),heatmapTexture:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_world:new l.aL(y,a.u_world),u_image:new l.aG(y,a.u_image),u_color_ramp:new l.aG(y,a.u_color_ramp),u_opacity:new l.aH(y,a.u_opacity)}),hillshade:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_image:new l.aG(y,a.u_image),u_latrange:new l.aL(y,a.u_latrange),u_light:new l.aL(y,a.u_light),u_shadow:new l.aM(y,a.u_shadow),u_highlight:new l.aM(y,a.u_highlight),u_accent:new l.aM(y,a.u_accent)}),hillshadePrepare:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_image:new l.aG(y,a.u_image),u_dimension:new l.aL(y,a.u_dimension),u_zoom:new l.aH(y,a.u_zoom),u_unpack:new l.aJ(y,a.u_unpack)}),line:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels)}),lineGradient:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels),u_image:new l.aG(y,a.u_image),u_image_height:new l.aH(y,a.u_image_height)}),linePattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_texsize:new l.aL(y,a.u_texsize),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_image:new l.aG(y,a.u_image),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade)}),lineSDF:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels),u_patternscale_a:new l.aL(y,a.u_patternscale_a),u_patternscale_b:new l.aL(y,a.u_patternscale_b),u_sdfgamma:new l.aH(y,a.u_sdfgamma),u_image:new l.aG(y,a.u_image),u_tex_y_a:new l.aH(y,a.u_tex_y_a),u_tex_y_b:new l.aH(y,a.u_tex_y_b),u_mix:new l.aH(y,a.u_mix)}),raster:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_tl_parent:new l.aL(y,a.u_tl_parent),u_scale_parent:new l.aH(y,a.u_scale_parent),u_buffer_scale:new l.aH(y,a.u_buffer_scale),u_fade_t:new l.aH(y,a.u_fade_t),u_opacity:new l.aH(y,a.u_opacity),u_image0:new l.aG(y,a.u_image0),u_image1:new l.aG(y,a.u_image1),u_brightness_low:new l.aH(y,a.u_brightness_low),u_brightness_high:new l.aH(y,a.u_brightness_high),u_saturation_factor:new l.aH(y,a.u_saturation_factor),u_contrast_factor:new l.aH(y,a.u_contrast_factor),u_spin_weights:new l.aK(y,a.u_spin_weights)}),symbolIcon:(y,a)=>({u_is_size_zoom_constant:new l.aG(y,a.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,a.u_is_size_feature_constant),u_size_t:new l.aH(y,a.u_size_t),u_size:new l.aH(y,a.u_size),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pitch:new l.aH(y,a.u_pitch),u_rotate_symbol:new l.aG(y,a.u_rotate_symbol),u_aspect_ratio:new l.aH(y,a.u_aspect_ratio),u_fade_change:new l.aH(y,a.u_fade_change),u_matrix:new l.aI(y,a.u_matrix),u_label_plane_matrix:new l.aI(y,a.u_label_plane_matrix),u_coord_matrix:new l.aI(y,a.u_coord_matrix),u_is_text:new l.aG(y,a.u_is_text),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_texsize:new l.aL(y,a.u_texsize),u_texture:new l.aG(y,a.u_texture)}),symbolSDF:(y,a)=>({u_is_size_zoom_constant:new l.aG(y,a.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,a.u_is_size_feature_constant),u_size_t:new l.aH(y,a.u_size_t),u_size:new l.aH(y,a.u_size),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pitch:new l.aH(y,a.u_pitch),u_rotate_symbol:new l.aG(y,a.u_rotate_symbol),u_aspect_ratio:new l.aH(y,a.u_aspect_ratio),u_fade_change:new l.aH(y,a.u_fade_change),u_matrix:new l.aI(y,a.u_matrix),u_label_plane_matrix:new l.aI(y,a.u_label_plane_matrix),u_coord_matrix:new l.aI(y,a.u_coord_matrix),u_is_text:new l.aG(y,a.u_is_text),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_texsize:new l.aL(y,a.u_texsize),u_texture:new l.aG(y,a.u_texture),u_gamma_scale:new l.aH(y,a.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_is_halo:new l.aG(y,a.u_is_halo)}),symbolTextAndIcon:(y,a)=>({u_is_size_zoom_constant:new l.aG(y,a.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,a.u_is_size_feature_constant),u_size_t:new l.aH(y,a.u_size_t),u_size:new l.aH(y,a.u_size),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pitch:new l.aH(y,a.u_pitch),u_rotate_symbol:new l.aG(y,a.u_rotate_symbol),u_aspect_ratio:new l.aH(y,a.u_aspect_ratio),u_fade_change:new l.aH(y,a.u_fade_change),u_matrix:new l.aI(y,a.u_matrix),u_label_plane_matrix:new l.aI(y,a.u_label_plane_matrix),u_coord_matrix:new l.aI(y,a.u_coord_matrix),u_is_text:new l.aG(y,a.u_is_text),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_texsize:new l.aL(y,a.u_texsize),u_texsize_icon:new l.aL(y,a.u_texsize_icon),u_texture:new l.aG(y,a.u_texture),u_texture_icon:new l.aG(y,a.u_texture_icon),u_gamma_scale:new l.aH(y,a.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_is_halo:new l.aG(y,a.u_is_halo)}),background:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_opacity:new l.aH(y,a.u_opacity),u_color:new l.aM(y,a.u_color)}),backgroundPattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_opacity:new l.aH(y,a.u_opacity),u_image:new l.aG(y,a.u_image),u_pattern_tl_a:new l.aL(y,a.u_pattern_tl_a),u_pattern_br_a:new l.aL(y,a.u_pattern_br_a),u_pattern_tl_b:new l.aL(y,a.u_pattern_tl_b),u_pattern_br_b:new l.aL(y,a.u_pattern_br_b),u_texsize:new l.aL(y,a.u_texsize),u_mix:new l.aH(y,a.u_mix),u_pattern_size_a:new l.aL(y,a.u_pattern_size_a),u_pattern_size_b:new l.aL(y,a.u_pattern_size_b),u_scale_a:new l.aH(y,a.u_scale_a),u_scale_b:new l.aH(y,a.u_scale_b),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(y,a.u_tile_units_to_pixels)}),terrain:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_texture:new l.aG(y,a.u_texture),u_ele_delta:new l.aH(y,a.u_ele_delta)}),terrainDepth:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ele_delta:new l.aH(y,a.u_ele_delta)}),terrainCoords:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_texture:new l.aG(y,a.u_texture),u_terrain_coords_id:new l.aH(y,a.u_terrain_coords_id),u_ele_delta:new l.aH(y,a.u_ele_delta)})};class Dy{constructor(a,f,m){this.context=a;const g=a.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Vl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ch{constructor(a,f,m,g){this.length=f.length,this.attributes=m,this.itemSize=f.bytesPerElement,this.dynamicDraw=g,this.context=a;const b=a.gl;this.buffer=b.createBuffer(),a.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){if(a.length!==this.length)throw new Error(`Length of new data is ${a.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,a.arrayBuffer)}enableAttributes(a,f){for(let m=0;m0){const ct=l.F(),dt=Ke;l.aP(ct,Ze.placementInvProjMatrix,y.transform.glCoordMatrix),l.aP(ct,ct,Ze.placementViewportMatrix),U.push({circleArray:tt,circleOffset:$,transform:dt,invTransform:ct,coord:De}),j+=tt.length/4,$=j}rt&&O.draw(L,A.LINES,Ln.disabled,pr.disabled,y.colorModeForRenderPass(),sr.disabled,Dm(Ke,y.transform,Ge),y.style.map.terrain&&y.style.map.terrain.getTerrainData(De),f.id,rt.layoutVertexBuffer,rt.indexBuffer,rt.segments,null,y.transform.zoom,null,null,rt.collisionVertexBuffer)}if(!T||!U.length)return;const he=y.useProgram("collisionCircle"),ce=new l.aQ;ce.resize(4*j),ce._trim();let me=0;for(const xe of U)for(let De=0;De=0&&(ce[re.associatedIconIndex]={shiftedAnchor:cn,angle:mt})}else Je(re.numGlyphs,$)}if(O){he.clear();const me=y.icon.placedSymbolArray;for(let re=0;rey.style.map.terrain.getElevation(rt,ds,di):null,Mr=f.layout.get("text-rotation-alignment")==="map";Z(ct,rt.posMatrix,y,g,Xo,ra,re,O,Mr,pi)}const ul=y.translatePosMatrix(rt.posMatrix,tt,b,T),ia=Ie||g&&Ze||Bc?Mp:Xo,fi=y.translatePosMatrix(ra,tt,b,T,!0),Pr=mt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Sr;Sr=mt?ct.iconsInText?Ic(Xt.kind,Qt,Ue,re,y,ul,ia,fi,vn,yi):Ec(Xt.kind,Qt,Ue,re,y,ul,ia,fi,g,vn,!0):Sc(Xt.kind,Qt,Ue,re,y,ul,ia,fi,g,vn);const ps={program:Pn,buffers:dt,uniformValues:Sr,atlasTexture:Br,atlasTextureIcon:Lr,atlasInterpolation:Yn,atlasInterpolationIcon:Zo,isSDF:mt,hasHalo:Pr};if(xe&&ct.canOverlap){De=!0;const pi=dt.segments.get();for(const Mr of pi)Ke.push({segments:new l.$([Mr]),sortKey:Mr.sortKey,state:ps,terrainData:mn})}else Ke.push({segments:dt.segments,sortKey:0,state:ps,terrainData:mn})}De&&Ke.sort((rt,tt)=>rt.sortKey-tt.sortKey);for(const rt of Ke){const tt=rt.state;if($.activeTexture.set(he.TEXTURE0),tt.atlasTexture.bind(tt.atlasInterpolation,he.CLAMP_TO_EDGE),tt.atlasTextureIcon&&($.activeTexture.set(he.TEXTURE1),tt.atlasTextureIcon&&tt.atlasTextureIcon.bind(tt.atlasInterpolationIcon,he.CLAMP_TO_EDGE)),tt.isSDF){const ct=tt.uniformValues;tt.hasHalo&&(ct.u_is_halo=1,Zm(tt.buffers,rt.segments,f,y,tt.program,Ge,U,j,ct,rt.terrainData)),ct.u_is_halo=0}Zm(tt.buffers,rt.segments,f,y,tt.program,Ge,U,j,tt.uniformValues,rt.terrainData)}}function Zm(y,a,f,m,g,b,T,L,A,O){const U=m.context;g.draw(U,U.gl.TRIANGLES,b,T,L,sr.disabled,A,O,f.id,y.layoutVertexBuffer,y.indexBuffer,a,f.paint,m.transform.zoom,y.programConfigurations.get(f.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function zh(y,a,f,m,g){if(!f||!m||!m.imageAtlas)return;const b=m.imageAtlas.patternPositions;let T=b[f.to.toString()],L=b[f.from.toString()];if(!T&&L&&(T=L),!L&&T&&(L=T),!T||!L){const A=g.getPaintProperty(a);T=b[A],L=b[A]}T&&L&&y.setConstantPatternPositions(T,L)}function Xm(y,a,f,m,g,b,T){const L=y.context.gl,A="fill-pattern",O=f.paint.get(A),U=O&&O.constantOr(1),j=f.getCrossfadeParameters();let $,he,ce,me,re;T?(he=U&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",$=L.LINES):(he=U?"fillPattern":"fill",$=L.TRIANGLES);const Ie=O.constantOr(null);for(const Ue of m){const xe=a.getTile(Ue);if(U&&!xe.patternsLoaded())continue;const De=xe.getBucket(f);if(!De)continue;const Ge=De.programConfigurations.get(f.id),Ze=y.useProgram(he,Ge),Ke=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ue);U&&(y.context.activeTexture.set(L.TEXTURE0),xe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ge.updatePaintBuffers(j)),zh(Ge,A,Ie,xe,f);const rt=Ke?Ue:null,tt=y.translatePosMatrix(rt?rt.posMatrix:Ue.posMatrix,xe,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(T){me=De.indexBuffer2,re=De.segments2;const ct=[L.drawingBufferWidth,L.drawingBufferHeight];ce=he==="fillOutlinePattern"&&U?km(tt,y,j,xe,ct):Py(tt,ct)}else me=De.indexBuffer,re=De.segments,ce=U?xh(tt,y,j,xe):Am(tt);Ze.draw(y.context,$,g,y.stencilModeForClipping(Ue),b,sr.disabled,ce,Ke,f.id,De.layoutVertexBuffer,me,re,f.paint,y.transform.zoom,Ge)}}function Fh(y,a,f,m,g,b,T){const L=y.context,A=L.gl,O="fill-extrusion-pattern",U=f.paint.get(O),j=U.constantOr(1),$=f.getCrossfadeParameters(),he=f.paint.get("fill-extrusion-opacity"),ce=U.constantOr(null);for(const me of m){const re=a.getTile(me),Ie=re.getBucket(f);if(!Ie)continue;const Ue=y.style.map.terrain&&y.style.map.terrain.getTerrainData(me),xe=Ie.programConfigurations.get(f.id),De=y.useProgram(j?"fillExtrusionPattern":"fillExtrusion",xe);j&&(y.context.activeTexture.set(A.TEXTURE0),re.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),xe.updatePaintBuffers($)),zh(xe,O,ce,re,f);const Ge=y.translatePosMatrix(me.posMatrix,re,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ze=f.paint.get("fill-extrusion-vertical-gradient"),Ke=j?Ly(Ge,y,Ze,he,me,$,re):bc(Ge,y,Ze,he);De.draw(L,L.gl.TRIANGLES,g,b,T,sr.backCCW,Ke,Ue,f.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,f.paint,y.transform.zoom,xe,y.style.map.terrain&&Ie.centroidVertexBuffer)}}function Bh(y,a,f,m,g,b,T){const L=y.context,A=L.gl,O=f.fbo;if(!O)return;const U=y.useProgram("hillshade"),j=y.style.map.terrain&&y.style.map.terrain.getTerrainData(a);L.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,O.colorAttachment.get()),U.draw(L,A.TRIANGLES,g,b,T,sr.disabled,(($,he,ce,me)=>{const re=ce.paint.get("hillshade-shadow-color"),Ie=ce.paint.get("hillshade-highlight-color"),Ue=ce.paint.get("hillshade-accent-color");let xe=ce.paint.get("hillshade-illumination-direction")*(Math.PI/180);ce.paint.get("hillshade-illumination-anchor")==="viewport"&&(xe-=$.transform.angle);const De=!$.options.moving;return{u_matrix:me?me.posMatrix:$.transform.calculatePosMatrix(he.tileID.toUnwrapped(),De),u_image:0,u_latrange:Om(0,he.tileID),u_light:[ce.paint.get("hillshade-exaggeration"),xe],u_shadow:re,u_highlight:Ie,u_accent:Ue}})(y,f,m,j?a:null),j,m.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Ap(y,a,f,m,g,b){const T=y.context,L=T.gl,A=a.dem;if(A&&A.data){const O=A.dim,U=A.stride,j=A.getPixels();if(T.activeTexture.set(L.TEXTURE1),T.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||y.getTileTexture(U),a.demTexture){const he=a.demTexture;he.update(j,{premultiply:!1}),he.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else a.demTexture=new Q(T,j,L.RGBA,{premultiply:!1}),a.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);T.activeTexture.set(L.TEXTURE0);let $=a.fbo;if(!$){const he=new Q(T,{width:O,height:O,data:null},L.RGBA);he.bind(L.LINEAR,L.CLAMP_TO_EDGE),$=a.fbo=T.createFramebuffer(O,O,!0,!1),$.colorAttachment.set(he.texture)}T.bindFramebuffer.set($.framebuffer),T.viewport.set([0,0,O,O]),y.useProgram("hillshadePrepare").draw(T,L.TRIANGLES,m,g,b,sr.disabled,((he,ce)=>{const me=ce.stride,re=l.F();return l.aN(re,0,l.W,-l.W,0,0,1),l.H(re,re,[0,-l.W,0]),{u_matrix:re,u_image:1,u_dimension:[me,me],u_zoom:he.overscaledZ,u_unpack:ce.getUnpackVector()}})(a.tileID,A),null,f.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),a.needsHillshadePrepare=!1}}function $m(y,a,f,m,g,b){const T=m.paint.get("raster-fade-duration");if(!b&&T>0){const L=E.now(),A=(L-y.timeAdded)/T,O=a?(L-a.timeAdded)/T:-1,U=f.getSource(),j=g.coveringZoomLevel({tileSize:U.tileSize,roundZoom:U.roundZoom}),$=!a||Math.abs(a.tileID.overscaledZ-j)>Math.abs(y.tileID.overscaledZ-j),he=$&&y.refreshedUponExpiration?1:l.ac($?A:1-O,0,1);return y.refreshedUponExpiration&&A>=1&&(y.refreshedUponExpiration=!1),a?{opacity:1,mix:1-he}:{opacity:he,mix:0}}return{opacity:1,mix:0}}const Ym=new l.aO(1,0,0,1),Vh=new l.aO(0,1,0,1),kp=new l.aO(0,0,1,1),jy=new l.aO(1,0,1,1),Km=new l.aO(0,1,1,1);function zr(y,a,f,m){ho(y,0,a+f/2,y.transform.width,f,m)}function il(y,a,f,m){ho(y,a-f/2,0,f,y.transform.height,m)}function ho(y,a,f,m,g,b){const T=y.context,L=T.gl;L.enable(L.SCISSOR_TEST),L.scissor(a*y.pixelRatio,f*y.pixelRatio,m*y.pixelRatio,g*y.pixelRatio),T.clear({color:b}),L.disable(L.SCISSOR_TEST)}function Dp(y,a,f){const m=y.context,g=m.gl,b=f.posMatrix,T=y.useProgram("debug"),L=Ln.disabled,A=pr.disabled,O=y.colorModeForRenderPass(),U="$debug",j=y.style.map.terrain&&y.style.map.terrain.getTerrainData(f);m.activeTexture.set(g.TEXTURE0);const $=a.getTileByID(f.key).latestRawTileData,he=Math.floor(($&&$.byteLength||0)/1024),ce=a.getTile(f).tileSize,me=512/Math.min(ce,512)*(f.overscaledZ/y.transform.zoom)*.5;let re=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(re+=` => ${f.overscaledZ}`),function(Ie,Ue){Ie.initDebugOverlayCanvas();const xe=Ie.debugOverlayCanvas,De=Ie.context.gl,Ge=Ie.debugOverlayCanvas.getContext("2d");Ge.clearRect(0,0,xe.width,xe.height),Ge.shadowColor="white",Ge.shadowBlur=2,Ge.lineWidth=1.5,Ge.strokeStyle="white",Ge.textBaseline="top",Ge.font="bold 36px Open Sans, sans-serif",Ge.fillText(Ue,5,5),Ge.strokeText(Ue,5,5),Ie.debugOverlayTexture.update(xe),Ie.debugOverlayTexture.bind(De.LINEAR,De.CLAMP_TO_EDGE)}(y,`${re} ${he}kB`),T.draw(m,g.TRIANGLES,L,A,Jr.alphaBlended,sr.disabled,Rm(b,l.aO.transparent,me),null,U,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),T.draw(m,g.LINE_STRIP,L,A,O,sr.disabled,Rm(b,l.aO.red),j,U,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Uh(y,a,f){const m=y.context,g=m.gl,b=y.colorModeForRenderPass(),T=new Ln(g.LEQUAL,Ln.ReadWrite,y.depthRangeFor3D),L=y.useProgram("terrain"),A=a.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,y.width,y.height]);for(const O of f){const U=y.renderToTexture.getTexture(O),j=a.getTerrainData(O.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,U.texture);const $={u_matrix:y.transform.calculatePosMatrix(O.tileID.toUnwrapped()),u_texture:0,u_ele_delta:a.getMeshFrameDelta(y.transform.zoom)};L.draw(m,g.TRIANGLES,T,pr.disabled,b,sr.backCCW,$,j,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}class Jm{constructor(a,f){this.context=new Uy(a),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ui.maxUnderzooming+ui.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new nl}resize(a,f,m){if(this.width=Math.floor(a*m),this.height=Math.floor(f*m),this.pixelRatio=m,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 a=this.context,f=new l.aV;f.emplaceBack(0,0),f.emplaceBack(l.W,0),f.emplaceBack(0,l.W),f.emplaceBack(l.W,l.W),this.tileExtentBuffer=a.createVertexBuffer(f,yh.members),this.tileExtentSegments=l.$.simpleSegment(0,0,4,2);const m=new l.aV;m.emplaceBack(0,0),m.emplaceBack(l.W,0),m.emplaceBack(0,l.W),m.emplaceBack(l.W,l.W),this.debugBuffer=a.createVertexBuffer(m,yh.members),this.debugSegments=l.$.simpleSegment(0,0,4,5);const g=new l.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(l.W,0,l.W,0),g.emplaceBack(0,l.W,0,l.W),g.emplaceBack(l.W,l.W,l.W,l.W),this.rasterBoundsBuffer=a.createVertexBuffer(g,_n.members),this.rasterBoundsSegments=l.$.simpleSegment(0,0,4,2);const b=new l.aV;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=a.createVertexBuffer(b,yh.members),this.viewportSegments=l.$.simpleSegment(0,0,4,2);const T=new l.aW;T.emplaceBack(0),T.emplaceBack(1),T.emplaceBack(3),T.emplaceBack(2),T.emplaceBack(0),this.tileBorderIndexBuffer=a.createIndexBuffer(T);const L=new l.aX;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=a.createIndexBuffer(L);const A=this.context.gl;this.stencilClearMode=new pr({func:A.ALWAYS,mask:0},0,255,A.ZERO,A.ZERO,A.ZERO)}clearStencil(){const a=this.context,f=a.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.F();l.aN(m,0,this.width,this.height,0,0,1),l.J(m,m,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(a,f.TRIANGLES,Ln.disabled,this.stencilClearMode,Jr.disabled,sr.disabled,wh(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(a,f){if(this.currentStencilSource===a.source||!a.isTileClipped()||!f||!f.length)return;this.currentStencilSource=a.source;const m=this.context,g=m.gl;this.nextStencilID+f.length>256&&this.clearStencil(),m.setColorMode(Jr.disabled),m.setDepthMode(Ln.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const T of f){const L=this._tileClippingMaskIDs[T.key]=this.nextStencilID++,A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T);b.draw(m,g.TRIANGLES,Ln.disabled,new pr({func:g.ALWAYS,mask:0},L,255,g.KEEP,g.KEEP,g.REPLACE),Jr.disabled,sr.disabled,wh(T.posMatrix),A,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const a=this.nextStencilID++,f=this.context.gl;return new pr({func:f.NOTEQUAL,mask:255},a,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(a){const f=this.context.gl;return new pr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[a.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(a){const f=this.context.gl,m=a.sort((T,L)=>L.overscaledZ-T.overscaledZ),g=m[m.length-1].overscaledZ,b=m[0].overscaledZ-g+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const T={};for(let L=0;L=0;this.currentLayer--){const A=this.style._layers[m[this.currentLayer]],O=g[A.source],U=b[A.source];this._renderTileClippingMasks(A,U),this.renderLayer(this,O,A,U)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerre.source&&!re.isHidden(U)?[O.sourceCaches[re.source]]:[]),he=$.filter(re=>re.getSource().type==="vector"),ce=$.filter(re=>re.getSource().type!=="vector"),me=re=>{(!j||j.getSource().maxzoomme(re)),j||ce.forEach(re=>me(re)),j}(this.style,this.transform.zoom);A&&function(O,U,j){for(let $=0;$0),g&&(l.a_(f,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(b,T){const L=b.context,A=L.gl,O=Jr.unblended,U=new Ln(A.LEQUAL,Ln.ReadWrite,[0,1]),j=T.getTerrainMesh(),$=T.sourceCache.getRenderableTiles(),he=b.useProgram("terrainDepth");L.bindFramebuffer.set(T.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1});for(const ce of $){const me=T.getTerrainData(ce.tileID),re={u_matrix:b.transform.calculatePosMatrix(ce.tileID.toUnwrapped()),u_ele_delta:T.getMeshFrameDelta(b.transform.zoom)};he.draw(L,A.TRIANGLES,U,pr.disabled,O,sr.backCCW,re,me,"terrain",j.vertexBuffer,j.indexBuffer,j.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain),function(b,T){const L=b.context,A=L.gl,O=Jr.unblended,U=new Ln(A.LEQUAL,Ln.ReadWrite,[0,1]),j=T.getTerrainMesh(),$=T.getCoordsTexture(),he=T.sourceCache.getRenderableTiles(),ce=b.useProgram("terrainCoords");L.bindFramebuffer.set(T.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1}),T.coordsIndex=[];for(const me of he){const re=T.getTerrainData(me.tileID);L.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,$.texture);const Ie={u_matrix:b.transform.calculatePosMatrix(me.tileID.toUnwrapped()),u_terrain_coords_id:(255-T.coordsIndex.length)/255,u_texture:0,u_ele_delta:T.getMeshFrameDelta(b.transform.zoom)};ce.draw(L,A.TRIANGLES,U,pr.disabled,O,sr.backCCW,Ie,re,"terrain",j.vertexBuffer,j.indexBuffer,j.segments),T.coordsIndex.push(me.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain))}renderLayer(a,f,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(b,T,L,A,O){if(b.renderPass!=="translucent")return;const U=pr.disabled,j=b.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function($,he,ce,me,re,Ie,Ue){const xe=he.transform,De=re==="map",Ge=Ie==="map";for(const Ze of $){const Ke=me.getTile(Ze),rt=Ke.getBucket(ce);if(!rt||!rt.text||!rt.text.segments.get().length)continue;const tt=l.ag(rt.textSizeData,xe.zoom),ct=nn(Ke,1,he.transform.zoom),dt=sn(Ze.posMatrix,Ge,De,he.transform,ct),cn=ce.layout.get("icon-text-fit")!=="none"&&rt.hasIconData();if(tt){const mt=Math.pow(2,xe.zoom-Ke.tileID.overscaledZ);Rh(rt,De,Ge,Ue,xe,dt,Ze.posMatrix,mt,tt,cn,he.style.map.terrain?(Xt,hn)=>he.style.map.terrain.getElevation(Ze,Xt,hn):null)}}}(A,b,L,T,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),O),L.paint.get("icon-opacity").constantOr(1)!==0&&Oh(b,T,L,A,!1,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),L.layout.get("icon-rotation-alignment"),L.layout.get("icon-pitch-alignment"),L.layout.get("icon-keep-upright"),U,j),L.paint.get("text-opacity").constantOr(1)!==0&&Oh(b,T,L,A,!0,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.layout.get("text-keep-upright"),U,j),T.map.showCollisionBoxes&&(Dh(b,T,L,A,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),!0),Dh(b,T,L,A,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),!1))})(a,f,m,g,this.style.placement.variableOffsets);break;case"circle":(function(b,T,L,A){if(b.renderPass!=="translucent")return;const O=L.paint.get("circle-opacity"),U=L.paint.get("circle-stroke-width"),j=L.paint.get("circle-stroke-opacity"),$=!L.layout.get("circle-sort-key").isConstant();if(O.constantOr(1)===0&&(U.constantOr(1)===0||j.constantOr(1)===0))return;const he=b.context,ce=he.gl,me=b.depthModeForSublayer(0,Ln.ReadOnly),re=pr.disabled,Ie=b.colorModeForRenderPass(),Ue=[];for(let xe=0;xexe.sortKey-De.sortKey);for(const xe of Ue){const{programConfiguration:De,program:Ge,layoutVertexBuffer:Ze,indexBuffer:Ke,uniformValues:rt,terrainData:tt}=xe.state;Ge.draw(he,ce.TRIANGLES,me,re,Ie,sr.disabled,rt,tt,L.id,Ze,Ke,xe.segments,L.paint,b.transform.zoom,De)}})(a,f,m,g);break;case"heatmap":(function(b,T,L,A){if(L.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const O=b.context,U=O.gl,j=pr.disabled,$=new Jr([U.ONE,U.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(he,ce,me){const re=he.gl;he.activeTexture.set(re.TEXTURE1),he.viewport.set([0,0,ce.width/4,ce.height/4]);let Ie=me.heatmapFbo;if(Ie)re.bindTexture(re.TEXTURE_2D,Ie.colorAttachment.get()),he.bindFramebuffer.set(Ie.framebuffer);else{const Ue=re.createTexture();re.bindTexture(re.TEXTURE_2D,Ue),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_WRAP_S,re.CLAMP_TO_EDGE),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_WRAP_T,re.CLAMP_TO_EDGE),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_MIN_FILTER,re.LINEAR),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_MAG_FILTER,re.LINEAR),Ie=me.heatmapFbo=he.createFramebuffer(ce.width/4,ce.height/4,!1,!1),function(xe,De,Ge,Ze){var Ke,rt;const tt=xe.gl,ct=(Ke=xe.HALF_FLOAT)!==null&&Ke!==void 0?Ke:tt.UNSIGNED_BYTE,dt=(rt=xe.RGBA16F)!==null&&rt!==void 0?rt:tt.RGBA;tt.texImage2D(tt.TEXTURE_2D,0,dt,De.width/4,De.height/4,0,tt.RGBA,ct,null),Ze.colorAttachment.set(Ge)}(he,ce,Ue,Ie)}})(O,b,L),O.clear({color:l.aO.transparent});for(let he=0;he{const xe=l.F();l.aN(xe,0,me.width,me.height,0,0,1);const De=me.context.gl;return{u_matrix:xe,u_world:[De.drawingBufferWidth,De.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:re.paint.get("heatmap-opacity")}})(O,U),null,U.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,U.paint,O.transform.zoom)}(b,L))})(a,f,m,g);break;case"line":(function(b,T,L,A){if(b.renderPass!=="translucent")return;const O=L.paint.get("line-opacity"),U=L.paint.get("line-width");if(O.constantOr(1)===0||U.constantOr(1)===0)return;const j=b.depthModeForSublayer(0,Ln.ReadOnly),$=b.colorModeForRenderPass(),he=L.paint.get("line-dasharray"),ce=L.paint.get("line-pattern"),me=ce.constantOr(1),re=L.paint.get("line-gradient"),Ie=L.getCrossfadeParameters(),Ue=me?"linePattern":he?"lineSDF":re?"lineGradient":"line",xe=b.context,De=xe.gl;let Ge=!0;for(const Ze of A){const Ke=T.getTile(Ze);if(me&&!Ke.patternsLoaded())continue;const rt=Ke.getBucket(L);if(!rt)continue;const tt=rt.programConfigurations.get(L.id),ct=b.context.program.get(),dt=b.useProgram(Ue,tt),cn=Ge||dt.program!==ct,mt=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Ze),Xt=ce.constantOr(null);if(Xt&&Ke.imageAtlas){const Qt=Ke.imageAtlas,mn=Qt.patternPositions[Xt.to.toString()],vn=Qt.patternPositions[Xt.from.toString()];mn&&vn&&tt.setConstantPatternPositions(mn,vn)}const hn=mt?Ze:null,Pn=me?Bl(b,Ke,L,Ie,hn):he?Eh(b,Ke,L,he,Ie,hn):re?zm(b,Ke,L,rt.lineClipsArray.length,hn):Sh(b,Ke,L,hn);if(me)xe.activeTexture.set(De.TEXTURE0),Ke.imageAtlasTexture.bind(De.LINEAR,De.CLAMP_TO_EDGE),tt.updatePaintBuffers(Ie);else if(he&&(cn||b.lineAtlas.dirty))xe.activeTexture.set(De.TEXTURE0),b.lineAtlas.bind(xe);else if(re){const Qt=rt.gradients[L.id];let mn=Qt.texture;if(L.gradientVersion!==Qt.version){let vn=256;if(L.stepInterpolant){const Br=T.getSource().maxzoom,Yn=Ze.canonical.z===Br?Math.ceil(1<0?f.pop():null}isPatternMissing(a){if(!a)return!1;if(!a.from||!a.to)return!0;const f=this.imageManager.getPattern(a.from.toString()),m=this.imageManager.getPattern(a.to.toString());return!f||!m}useProgram(a,f){this.cache=this.cache||{};const m=a+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new rl(this.context,vc[a],f,Fm[a],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}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 a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Q(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:a,drawingBufferHeight:f}=this.context.gl;return this.width!==a||this.height!==f}}class ol{constructor(a,f){this.points=a,this.planes=f}static fromInvProjectionMatrix(a,f,m){const g=Math.pow(2,m),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(L=>{const A=1/(L=l.af([],L,a))[3]/f*g;return l.a$(L,L,[A,A,1/L[3],A])}),T=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const A=function($,he){var ce=he[0],me=he[1],re=he[2],Ie=ce*ce+me*me+re*re;return Ie>0&&(Ie=1/Math.sqrt(Ie)),$[0]=he[0]*Ie,$[1]=he[1]*Ie,$[2]=he[2]*Ie,$}([],function($,he,ce){var me=he[0],re=he[1],Ie=he[2],Ue=ce[0],xe=ce[1],De=ce[2];return $[0]=re*De-Ie*xe,$[1]=Ie*Ue-me*De,$[2]=me*xe-re*Ue,$}([],le([],b[L[0]],b[L[1]]),le([],b[L[2]],b[L[1]]))),O=-((U=A)[0]*(j=b[L[1]])[0]+U[1]*j[1]+U[2]*j[2]);var U,j;return A.concat(O)});return new ol(b,T)}}class sl{constructor(a,f){this.min=a,this.max=f,this.center=function(m,g,b){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,b){return m[0]=g[0]+b[0],m[1]=g[1]+b[1],m[2]=g[2]+b[2],m}([],this.min,this.max))}quadrant(a){const f=[a%2==0,a<2],m=_e(this.min),g=_e(this.max);for(let b=0;b=0&&T++;if(T===0)return 0;T!==f.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let b=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(let L=0;Lthis.max[g]-this.min[g])return 0}return 1}}class Lu{constructor(a=0,f=0,m=0,g=0){if(isNaN(a)||a<0||isNaN(f)||f<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=f,this.left=m,this.right=g}interpolate(a,f,m){return f.top!=null&&a.top!=null&&(this.top=l.z.number(a.top,f.top,m)),f.bottom!=null&&a.bottom!=null&&(this.bottom=l.z.number(a.bottom,f.bottom,m)),f.left!=null&&a.left!=null&&(this.left=l.z.number(a.left,f.left,m)),f.right!=null&&a.right!=null&&(this.right=l.z.number(a.right,f.right,m)),this}getCenter(a,f){const m=l.ac((this.left+a-this.right)/2,0,a),g=l.ac((this.top+f-this.bottom)/2,0,f);return new l.P(m,g)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new Lu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Rp=85.051129;class jh{constructor(a,f,m,g,b){this.tileSize=512,this._renderWorldCopies=b===void 0||!!b,this._minZoom=a||0,this._maxZoom=f||22,this._minPitch=m??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Lu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const a=new jh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.apply(this),a}apply(a){this.tileSize=a.tileSize,this.latRange=a.latRange,this.width=a.width,this.height=a.height,this._center=a._center,this._elevation=a._elevation,this.minElevationForCurrentTile=a.minElevationForCurrentTile,this.zoom=a.zoom,this.angle=a.angle,this._fov=a._fov,this._pitch=a._pitch,this._unmodified=a._unmodified,this._edgeInsets=a._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(a){a===void 0?a=!0:a===null&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(a){const f=-l.b1(a,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,b){var T=g[0],L=g[1],A=g[2],O=g[3],U=Math.sin(b),j=Math.cos(b);m[0]=T*j+A*U,m[1]=L*j+O*U,m[2]=T*-U+A*j,m[3]=L*-U+O*j}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(a){const f=l.ac(a,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(a){const f=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(a){a.lat===this._center.lat&&a.lng===this._center.lng||(this._unmodified=!1,this._center=a,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(a){a!==this._elevation&&(this._elevation=a,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(a){this._edgeInsets.equals(a)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,a,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(a){return this._edgeInsets.equals(a)}interpolatePadding(a,f,m){this._unmodified=!1,this._edgeInsets.interpolate(a,f,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(a){const f=(a.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/a.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(a){const f=[new l.b2(0,a)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),g=this.pointCoordinate(new l.P(this.width,0)),b=this.pointCoordinate(new l.P(this.width,this.height)),T=this.pointCoordinate(new l.P(0,this.height)),L=Math.floor(Math.min(m.x,g.x,b.x,T.x)),A=Math.floor(Math.max(m.x,g.x,b.x,T.x)),O=1;for(let U=L-O;U<=A+O;U++)U!==0&&f.push(new l.b2(U,a))}return f}coveringTiles(a){var f,m;let g=this.coveringZoomLevel(a);const b=g;if(a.minzoom!==void 0&&ga.maxzoom&&(g=a.maxzoom);const T=this.pointCoordinate(this.getCameraPoint()),L=l.Y.fromLngLat(this.center),A=Math.pow(2,g),O=[A*T.x,A*T.y,0],U=[A*L.x,A*L.y,0],j=ol.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let $=a.minzoom||0;!a.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&($=g);const he=a.terrain?2/Math.min(this.tileSize,a.tileSize)*this.tileSize:3,ce=xe=>({aabb:new sl([xe*A,0,0],[(xe+1)*A,A,0]),zoom:0,x:0,y:0,wrap:xe,fullyVisible:!1}),me=[],re=[],Ie=g,Ue=a.reparseOverscaled?b:g;if(this._renderWorldCopies)for(let xe=1;xe<=3;xe++)me.push(ce(-xe)),me.push(ce(xe));for(me.push(ce(0));me.length>0;){const xe=me.pop(),De=xe.x,Ge=xe.y;let Ze=xe.fullyVisible;if(!Ze){const dt=xe.aabb.intersects(j);if(dt===0)continue;Ze=dt===2}const Ke=a.terrain?O:U,rt=xe.aabb.distanceX(Ke),tt=xe.aabb.distanceY(Ke),ct=Math.max(Math.abs(rt),Math.abs(tt));if(xe.zoom===Ie||ct>he+(1<=$){const dt=Ie-xe.zoom,cn=O[0]-.5-(De<>1),Xt=xe.zoom+1;let hn=xe.aabb.quadrant(dt);if(a.terrain){const Pn=new l.Q(Xt,xe.wrap,Xt,cn,mt),Qt=a.terrain.getMinMaxElevation(Pn),mn=(f=Qt.minElevation)!==null&&f!==void 0?f:this.elevation,vn=(m=Qt.maxElevation)!==null&&m!==void 0?m:this.elevation;hn=new sl([hn.min[0],hn.min[1],mn],[hn.max[0],hn.max[1],vn])}me.push({aabb:hn,zoom:Xt,x:cn,y:mt,wrap:xe.wrap,fullyVisible:Ze})}}return re.sort((xe,De)=>xe.distanceSq-De.distanceSq).map(xe=>xe.tileID)}resize(a,f){this.width=a,this.height=f,this.pixelsToGLUnits=[2/a,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(a){const f=l.ac(a.lat,-85.051129,Rp);return new l.P(l.N(a.lng)*this.worldSize,l.O(f)*this.worldSize)}unproject(a){return new l.Y(a.x/this.worldSize,a.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(a){const f=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,a),b=a.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-b))return;const T=m+f-b,L=Math.cos(this._pitch)*this.cameraToCenterDistance/T/l.b3(1,g.lat),A=this.scaleZoom(L/this.tileSize);this._elevation=b,this._center=g,this.zoom=A}setLocationAtPoint(a,f){const m=this.pointCoordinate(f),g=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(a),T=new l.Y(b.x-(m.x-g.x),b.y-(m.y-g.y));this.center=this.coordinateLocation(T),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(a,f){return f?this.coordinatePoint(this.locationCoordinate(a),f.getElevationForLngLatZoom(a,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(a))}pointLocation(a,f){return this.coordinateLocation(this.pointCoordinate(a,f))}locationCoordinate(a){return l.Y.fromLngLat(a)}coordinateLocation(a){return a&&a.toLngLat()}pointCoordinate(a,f){if(f){const $=f.pointCoordinate(a);if($!=null)return $}const m=[a.x,a.y,0,1],g=[a.x,a.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(g,g,this.pixelMatrixInverse);const b=m[3],T=g[3],L=m[1]/b,A=g[1]/T,O=m[2]/b,U=g[2]/T,j=O===U?0:(0-O)/(U-O);return new l.Y(l.z.number(m[0]/b,g[0]/T,j)/this.worldSize,l.z.number(L,A,j)/this.worldSize)}coordinatePoint(a,f=0,m=this.pixelMatrix){const g=[a.x*this.worldSize,a.y*this.worldSize,f,1];return l.af(g,g,m),new l.P(g[0]/g[3],g[1]/g[3])}getBounds(){const a=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new l.P(0,a))).extend(this.pointLocation(new l.P(this.width,a))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ce([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(a){a?(this.lngRange=[a.getWest(),a.getEast()],this.latRange=[a.getSouth(),a.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Rp])}calculatePosMatrix(a,f=!1){const m=a.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const b=a.canonical,T=this.worldSize/this.zoomScale(b.z),L=b.x+Math.pow(2,b.z)*a.wrap,A=l.an(new Float64Array(16));return l.H(A,A,[L*T,b.y*T,0]),l.J(A,A,[T/l.W,T/l.W,1]),l.K(A,f?this.alignedProjMatrix:this.projMatrix,A),g[m]=new Float32Array(A),g[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(a,f){f=l.ac(+f,this.minZoom,this.maxZoom);const m={center:new l.M(a.lng,a.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const xe=179.9999999999;g=[-xe,xe]}const b=this.tileSize*this.zoomScale(m.zoom);let T=0,L=b,A=0,O=b,U=0,j=0;const{x:$,y:he}=this.size;if(this.latRange){const xe=this.latRange;T=l.O(xe[1])*b,L=l.O(xe[0])*b,L-TL&&(Ie=L-xe)}if(g){const xe=(A+O)/2;let De=ce;this._renderWorldCopies&&(De=l.b1(ce,xe-b/2,xe+b/2));const Ge=$/2;De-GeO&&(re=O-Ge)}if(re!==void 0||Ie!==void 0){const xe=new l.P(re??ce,Ie??me);m.center=this.unproject.call({worldSize:b},xe).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const a=this._unmodified,{center:f,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=m,this._unmodified=a,this._constraining=!1}_calcMatrices(){if(!this.height)return;const a=this.centerOffset,f=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b3(1,this.center.lat)*this.worldSize;let g=l.an(new Float64Array(16));l.J(g,g,[this.width/2,-this.height/2,1]),l.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=l.an(new Float64Array(16)),l.J(g,g,[1,-1,1]),l.H(g,g,[-1,-1,0]),l.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),T=Math.min(this.elevation,this.minElevationForCurrentTile),L=b-T*this._pixelPerMeter/Math.cos(this._pitch),A=T<0?L:b,O=Math.PI/2+this._pitch,U=this._fov*(.5+a.y/this.height),j=Math.sin(U)*A/Math.sin(l.ac(Math.PI-O-U,.01,Math.PI-.01)),$=this.getHorizon(),he=2*Math.atan($/this.cameraToCenterDistance)*(.5+a.y/(2*$)),ce=Math.sin(he)*A/Math.sin(l.ac(Math.PI-O-he,.01,Math.PI-.01)),me=Math.min(j,ce),re=1.01*(Math.cos(Math.PI/2-this._pitch)*me+A),Ie=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,Ie,re),g[8]=2*-a.x/this.width,g[9]=2*a.y/this.height,l.J(g,g,[1,-1,1]),l.H(g,g,[0,0,-this.cameraToCenterDistance]),l.b5(g,g,this._pitch),l.ad(g,g,this.angle),l.H(g,g,[-f,-m,0]),this.mercatorMatrix=l.J([],g,[this.worldSize,this.worldSize,this.worldSize]),l.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.K(new Float64Array(16),this.labelPlaneMatrix,g),l.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=l.ar([],g),this.pixelMatrix3D=l.K(new Float64Array(16),this.labelPlaneMatrix,g);const Ue=this.width%2/2,xe=this.height%2/2,De=Math.cos(this.angle),Ge=Math.sin(this.angle),Ze=f-Math.round(f)+De*Ue+Ge*xe,Ke=m-Math.round(m)+De*xe+Ge*Ue,rt=new Float64Array(g);if(l.H(rt,rt,[Ze>.5?Ze-1:Ze,Ke>.5?Ke-1:Ke,0]),this.alignedProjMatrix=rt,g=l.ar(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 a=this.pointCoordinate(new l.P(0,0)),f=[a.x*this.worldSize,a.y*this.worldSize,0,1];return l.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const a=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,a))}getCameraQueryGeometry(a){const f=this.getCameraPoint();if(a.length===1)return[a[0],f];{let m=f.x,g=f.y,b=f.x,T=f.y;for(const L of a)m=Math.min(m,L.x),g=Math.min(g,L.y),b=Math.max(b,L.x),T=Math.max(T,L.y);return[new l.P(m,g),new l.P(b,g),new l.P(b,T),new l.P(m,T),new l.P(m,g)]}}lngLatToCameraDepth(a,f){const m=this.locationCoordinate(a),g=[m.x*this.worldSize,m.y*this.worldSize,f,1];return l.af(g,g,this.projMatrix),g[2]/g[3]}}function Np(y,a){let f,m=!1,g=null,b=null;const T=()=>{g=null,m&&(y.apply(b,f),g=setTimeout(T,a),m=!1)};return(...L)=>(m=!0,b=this,f=L,g||T(),g)}class Op{constructor(a){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let m;return f.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:m,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=Np(this._updateHashUnthrottled,300),this._hashName=a&&encodeURIComponent(a)}addTo(a){return this._map=a,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(a){const f=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,g),T=Math.round(f.lng*b)/b,L=Math.round(f.lat*b)/b,A=this._map.getBearing(),O=this._map.getPitch();let U="";if(U+=a?`/${T}/${L}/${m}`:`${m}/${L}/${T}`,(A||O)&&(U+="/"+Math.round(10*A)/10),O&&(U+=`/${Math.round(O)}`),this._hashName){const j=this._hashName;let $=!1;const he=window.location.hash.slice(1).split("&").map(ce=>{const me=ce.split("=")[0];return me===j?($=!0,`${me}=${U}`):ce}).filter(ce=>ce);return $||he.push(`${j}=${U}`),`#${he.join("&")}`}return`#${U}`}}const Tc={linearity:.3,easing:l.b6(0,0,.3,1)},Gl=l.e({deceleration:2500,maxSpeed:1400},Tc),Qm=l.e({deceleration:20,maxSpeed:1400},Tc),eg=l.e({deceleration:1e3,maxSpeed:360},Tc),tg=l.e({deceleration:1e3,maxSpeed:90},Tc);class ng{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(a){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:a})}_drainInertiaBuffer(){const a=this._inertiaBuffer,f=E.now();for(;a.length>0&&f-a[0].time>160;)a.shift()}_onMoveEnd(a){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)f.zoom+=b.zoomDelta||0,f.bearing+=b.bearingDelta||0,f.pitch+=b.pitchDelta||0,b.panDelta&&f.pan._add(b.panDelta),b.around&&(f.around=b.around),b.pinchAround&&(f.pinchAround=b.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(f.pan.mag()){const b=Pc(f.pan.mag(),m,l.e({},Gl,a||{}));g.offset=f.pan.mult(b.amount/f.pan.mag()),g.center=this._map.transform.center,Lc(g,b)}if(f.zoom){const b=Pc(f.zoom,m,Qm);g.zoom=this._map.transform.zoom+b.amount,Lc(g,b)}if(f.bearing){const b=Pc(f.bearing,m,eg);g.bearing=this._map.transform.bearing+l.ac(b.amount,-179,179),Lc(g,b)}if(f.pitch){const b=Pc(f.pitch,m,tg);g.pitch=this._map.transform.pitch+b.amount,Lc(g,b)}if(g.zoom||g.bearing){const b=f.pinchAround===void 0?f.around:f.pinchAround;g.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),l.e(g,{noMoveStart:!0})}}function Lc(y,a){(!y.duration||y.durationf.unproject(A)),L=b.reduce((A,O,U,j)=>A.add(O.div(j.length)),new l.P(0,0));super(a,{points:b,point:L,lngLats:T,lngLat:f.unproject(L),originalEvent:m}),this._defaultPrevented=!1}}class zp extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,f,m){super(a,{originalEvent:m}),this._defaultPrevented=!1}}class Ls{constructor(a,f){this._map=a,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new zp(a.type,this._map,a))}mousedown(a,f){return this._mousedownPos=f,this._firePreventable(new Co(a.type,this._map,a))}mouseup(a){this._map.fire(new Co(a.type,this._map,a))}click(a,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new Co(a.type,this._map,a))}dblclick(a){return this._firePreventable(new Co(a.type,this._map,a))}mouseover(a){this._map.fire(new Co(a.type,this._map,a))}mouseout(a){this._map.fire(new Co(a.type,this._map,a))}touchstart(a){return this._firePreventable(new ea(a.type,this._map,a))}touchmove(a){this._map.fire(new ea(a.type,this._map,a))}touchend(a){this._map.fire(new ea(a.type,this._map,a))}touchcancel(a){this._map.fire(new ea(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ta{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(a){this._map.fire(new Co(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Co("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._ignoreContextMenu||this._map.fire(new Co(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Pu{constructor(a){this._map=a}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(a){return this.transform.pointLocation(l.P.convert(a),this._map.terrain)}}class Ps{constructor(a,f){this._map=a,this._tr=new Pu(a),this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,f){this.isEnabled()&&a.shiftKey&&a.button===0&&(C.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(a,f){if(!this._active)return;const m=f;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)b.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",a)}keydown(a){this._active&&a.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",a))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(a,f){return this._map.fire(new l.k(a,{originalEvent:f}))}}function ql(y,a){if(y.length!==a.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${a.length}`);const f={};for(let m=0;mthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=a.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const b=new l.P(0,0);for(const T of g)b._add(T);return b.div(g.length)}(f),this.touches=ql(m,f)))}touchmove(a,f,m){if(this.aborted||!this.centroid)return;const g=ql(m,f);for(const b in this.touches){const T=g[b];(!T||T.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(a,f,m){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Fp{constructor(a){this.singleTap=new Gy(a),this.numTaps=a.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(a,f,m){this.singleTap.touchstart(a,f,m)}touchmove(a,f,m){this.singleTap.touchmove(a,f,m)}touchend(a,f,m){const g=this.singleTap.touchend(a,f,m);if(g){const b=a.timeStamp-this.lastTime<500,T=!this.lastTap||this.lastTap.dist(g)<30;if(b&&T||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class qy{constructor(a){this._tr=new Pu(a),this._zoomIn=new Fp({numTouches:1,numTaps:2}),this._zoomOut=new Fp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,f,m){this._zoomIn.touchstart(a,f,m),this._zoomOut.touchstart(a,f,m)}touchmove(a,f,m){this._zoomIn.touchmove(a,f,m),this._zoomOut.touchmove(a,f,m)}touchend(a,f,m){const g=this._zoomIn.touchend(a,f,m),b=this._zoomOut.touchend(a,f,m),T=this._tr;return g?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:T.zoom+1,around:T.unproject(g)},{originalEvent:a})}):b?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:T.zoom-1,around:T.unproject(b)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mu{constructor(a){this._enabled=!!a.enable,this._moveStateManager=a.moveStateManager,this._clickTolerance=a.clickTolerance||1,this._moveFunction=a.move,this._activateOnStart=!!a.activateOnStart,a.assignEvents(this),this.reset()}reset(a){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(a)}_move(...a){const f=this._moveFunction(...a);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(a,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(a)&&(this._moveStateManager.startMove(a),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(a,f){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(a.preventDefault(),!this._moveStateManager.isValidMoveEvent(a))return void this.reset(a);const g=f.length?f[0]:f;return!this._moved&&g.dist(m){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(a){a.preventDefault()}},Au=({enable:y,clickTolerance:a,bearingDegreesPerPixelMoved:f=.8})=>{const m=new na({checkCorrectEvent:g=>C.mouseButton(g)===0&&g.ctrlKey||C.mouseButton(g)===2});return new Mu({clickTolerance:a,move:(g,b)=>({bearingDelta:(b.x-g.x)*f}),moveStateManager:m,enable:y,assignEvents:Gh})},ku=({enable:y,clickTolerance:a,pitchDegreesPerPixelMoved:f=-.5})=>{const m=new na({checkCorrectEvent:g=>C.mouseButton(g)===0&&g.ctrlKey||C.mouseButton(g)===2});return new Mu({clickTolerance:a,move:(g,b)=>({pitchDelta:(b.y-g.y)*f}),moveStateManager:m,enable:y,assignEvents:Gh})};class rg{constructor(a,f){this._clickTolerance=a.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(a,f,m){return this._calculateTransform(a,f,m)}touchmove(a,f,m){if(this._active&&!(m.length0&&(this._active=!0);const g=ql(m,f),b=new l.P(0,0),T=new l.P(0,0);let L=0;for(const O in g){const U=g[O],j=this._touches[O];j&&(b._add(U),T._add(U.sub(j)),L++,g[O]=U)}if(this._touches=g,LMath.abs(y.x)}class sg extends xt{constructor(a){super(),this._currentTouchCount=0,this._map=a}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(a,f,m){super.touchstart(a,f,m),this._currentTouchCount=m.length}_start(a){this._lastPoints=a,Wh(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,f,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=a[0].sub(this._lastPoints[0]),b=a[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,b,m.timeStamp),this._valid?(this._lastPoints=a,this._active=!0,{pitchDelta:(g.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(a,f,m){if(this._valid!==void 0)return this._valid;const g=a.mag()>=2,b=f.mag()>=2;if(!g&&!b)return;if(!g||!b)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const T=a.y>0==f.y>0;return Wh(a)&&Wh(f)&&T}}const Wy={panStep:100,bearingStep:15,pitchStep:10};class al{constructor(a){this._tr=new Pu(a);const f=Wy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let f=0,m=0,g=0,b=0,T=0;switch(a.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:a.shiftKey?m=-1:(a.preventDefault(),b=-1);break;case 39:a.shiftKey?m=1:(a.preventDefault(),b=1);break;case 38:a.shiftKey?g=1:(a.preventDefault(),T=-1);break;case 40:a.shiftKey?g=-1:(a.preventDefault(),T=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:L=>{const A=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:wr,zoom:f?Math.round(A.zoom)+f*(a.shiftKey?2:1):A.zoom,bearing:A.bearing+m*this._bearingStep,pitch:A.pitch+g*this._pitchStep,offset:[-b*this._panStep,-T*this._panStep],center:A.center},{originalEvent:a})}}}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 wr(y){return y*(2-y)}const Ac=4.000244140625;class Hh{constructor(a,f){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=a,this._tr=new Pu(a),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&a.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(a){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!a[this._map.cooperativeGestures._bypassKey])return;let f=a.deltaMode===WheelEvent.DOM_DELTA_LINE?40*a.deltaY:a.deltaY;const m=E.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,f!==0&&f%Ac==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,a)):this._type||(this._type=Math.abs(g*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),a.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=a,this._delta-=f,this._active||this._start(a)),a.preventDefault()}_start(a){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 f=C.mousePos(this._map.getCanvas(),a),m=this._tr;this._around=f.y>m.transform.height/2-m.transform.getHorizon()?l.M.convert(this._aroundCenter?m.center:m.unproject(f)):l.M.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const a=this._tr.transform;if(this._delta!==0){const L=this._type==="wheel"&&Math.abs(this._delta)>Ac?this._wheelZoomRate:this._defaultZoomRate;let A=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&A!==0&&(A=1/A);const O=typeof this._targetZoom=="number"?a.zoomScale(this._targetZoom):a.scale;this._targetZoom=Math.min(a.maxZoom,Math.max(a.minZoom,a.scaleZoom(O*A))),this._type==="wheel"&&(this._startZoom=a.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:a.zoom,m=this._startZoom,g=this._easing;let b,T=!1;if(this._type==="wheel"&&m&&g){const L=Math.min((E.now()-this._lastWheelEventTime)/200,1),A=g(L);b=l.z.number(m,f,A),L<1?this._frameId||(this._frameId=!0):T=!0}else b=f,T=!0;return this._active=!0,T&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!T,zoomDelta:b-a.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(a){let f=l.b7;if(this._prevEase){const m=this._prevEase,g=(E.now()-m.start)/m.duration,b=m.easing(g+.01)-m.easing(g),T=.27/Math.sqrt(b*b+1e-4)*.01,L=Math.sqrt(.0729-T*T);f=l.b6(T,L,.25,1)}return this._prevEase={start:E.now(),duration:a,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Vp{constructor(a,f){this._clickZoom=a,this._tapZoom=f}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 ag{constructor(a){this._tr=new Pu(a),this.reset()}reset(){this._active=!1}dblclick(a,f){return a.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(a.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lg{constructor(){this._tap=new Fp({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(a,f,m){if(!this._swipePoint)if(this._tapTime){const g=f[0],b=a.timeStamp-this._tapTime<500,T=this._tapPoint.dist(g)<30;b&&T?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(a,f,m)}touchmove(a,f,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=f[0],b=g.y-this._swipePoint.y;return this._swipePoint=g,a.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(a,f,m)}touchend(a,f,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(a,f,m);g&&(this._tapTime=a.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 ug{constructor(a,f,m){this._el=a,this._mousePan=f,this._touchPan=m}enable(a){this._inertiaOptions=a||{},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 Ms{constructor(a,f,m){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=f,this._mousePitch=m}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 kc{constructor(a,f,m,g){this._el=a,this._touchZoom=f,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ot{constructor(a,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=a,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const a=this._map.getCanvasContainer();a.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",a);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=f,this._container.appendChild(g);const b=document.createElement("div");b.className="maplibregl-mobile-message",b.textContent=m,this._container.appendChild(b),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(C.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(a){this._onCooperativeGesture(a.touches.length===1)}wheel(a){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!a[this._bypassKey])}_onCooperativeGesture(a){this._enabled&&a&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const qt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Zh extends l.k{}function Dc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Up{constructor(a,f){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 T=g.type==="renderFrame"?void 0:g,L={needsRenderFrame:!1},A={},O={},U=g.touches,j=U?this._getMapTouches(U):void 0,$=j?C.touchPos(this._map.getCanvas(),j):C.mousePos(this._map.getCanvas(),g);for(const{handlerName:me,handler:re,allowed:Ie}of this._handlers){if(!re.isEnabled())continue;let Ue;this._blockedByActive(O,Ie,me)?re.reset():re[b||g.type]&&(Ue=re[b||g.type](g,$,j),this.mergeHandlerResult(L,A,Ue,me,T),Ue&&Ue.needsRenderFrame&&this._triggerRenderFrame()),(Ue||re.isActive())&&(O[me]=re)}const he={};for(const me in this._previousActiveHandlers)O[me]||(he[me]=T);this._previousActiveHandlers=O,(Object.keys(he).length||Dc(L))&&(this._changes.push([L,A,he]),this._triggerRenderFrame()),(Object.keys(O).length||Dc(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=L;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))},this._map=a,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ng(a),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,b,T]of this._listeners)C.addEventListener(g,b,g===document?this.handleWindowEvent:this.handleEvent,T)}destroy(){for(const[a,f,m]of this._listeners)C.removeEventListener(a,f,a===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(a){const f=this._map,m=f.getCanvasContainer();this._add("mapEvent",new Ls(f,a));const g=f.boxZoom=new Ps(f,a);this._add("boxZoom",g),a.interactive&&a.boxZoom&&g.enable();const b=f.cooperativeGestures=new Ot(f,a.cooperativeGestures);this._add("cooperativeGestures",b),a.cooperativeGestures&&b.enable();const T=new qy(f),L=new ag(f);f.doubleClickZoom=new Vp(L,T),this._add("tapZoom",T),this._add("clickZoom",L),a.interactive&&a.doubleClickZoom&&f.doubleClickZoom.enable();const A=new lg;this._add("tapDragZoom",A);const O=f.touchPitch=new sg(f);this._add("touchPitch",O),a.interactive&&a.touchPitch&&f.touchPitch.enable(a.touchPitch);const U=Au(a),j=ku(a);f.dragRotate=new Ms(a,U,j),this._add("mouseRotate",U,["mousePitch"]),this._add("mousePitch",j,["mouseRotate"]),a.interactive&&a.dragRotate&&f.dragRotate.enable();const $=(({enable:Ue,clickTolerance:xe})=>{const De=new na({checkCorrectEvent:Ge=>C.mouseButton(Ge)===0&&!Ge.ctrlKey});return new Mu({clickTolerance:xe,move:(Ge,Ze)=>({around:Ze,panDelta:Ze.sub(Ge)}),activateOnStart:!0,moveStateManager:De,enable:Ue,assignEvents:Gh})})(a),he=new rg(a,f);f.dragPan=new ug(m,$,he),this._add("mousePan",$),this._add("touchPan",he,["touchZoom","touchRotate"]),a.interactive&&a.dragPan&&f.dragPan.enable(a.dragPan);const ce=new Bp,me=new og;f.touchZoomRotate=new kc(m,me,ce,A),this._add("touchRotate",ce,["touchPan","touchZoom"]),this._add("touchZoom",me,["touchPan","touchRotate"]),a.interactive&&a.touchZoomRotate&&f.touchZoomRotate.enable(a.touchZoomRotate);const re=f.scrollZoom=new Hh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",re,["mousePan"]),a.interactive&&a.scrollZoom&&f.scrollZoom.enable(a.scrollZoom);const Ie=f.keyboard=new al(f);this._add("keyboard",Ie),a.interactive&&a.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new ta(f))}_add(a,f,m){this._handlers.push({handlerName:a,handler:f,allowed:m}),this._handlersById[a]=f}stop(a){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qt(this._eventsInProgress)||this.isZooming()}_blockedByActive(a,f,m){for(const g in a)if(g!==m&&(!f||f.indexOf(g)<0))return!0;return!1}_getMapTouches(a){const f=[];for(const m of a)this._el.contains(m.target)&&f.push(m);return f}mergeHandlerResult(a,f,m,g,b){if(!m)return;l.e(a,m);const T={handlerName:g,originalEvent:m.originalEvent||b};m.zoomDelta!==void 0&&(f.zoom=T),m.panDelta!==void 0&&(f.drag=T),m.pitchDelta!==void 0&&(f.pitch=T),m.bearingDelta!==void 0&&(f.rotate=T)}_applyChanges(){const a={},f={},m={};for(const[g,b,T]of this._changes)g.panDelta&&(a.panDelta=(a.panDelta||new l.P(0,0))._add(g.panDelta)),g.zoomDelta&&(a.zoomDelta=(a.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(a.bearingDelta=(a.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(a.pitchDelta=(a.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(a.around=g.around),g.pinchAround!==void 0&&(a.pinchAround=g.pinchAround),g.noInertia&&(a.noInertia=g.noInertia),l.e(f,b),l.e(m,T);this._updateMapTransform(a,f,m),this._changes=[]}_updateMapTransform(a,f,m){const g=this._map,b=g._getTransformForUpdate(),T=g.terrain;if(!(Dc(a)||T&&this._terrainMovement))return this._fireEvents(f,m,!0);let{panDelta:L,zoomDelta:A,bearingDelta:O,pitchDelta:U,around:j,pinchAround:$}=a;$!==void 0&&(j=$),g._stop(!0),j=j||g.transform.centerPoint;const he=b.pointLocation(L?j.sub(L):j);O&&(b.bearing+=O),U&&(b.pitch+=U),A&&(b.zoom+=A),T?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(L)):b.setLocationAtPoint(he,j):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(he,j),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,b.recalculateZoom(g.terrain)})):b.setLocationAtPoint(he,j),g._applyUpdatedTransform(b),this._map._update(),a.noInertia||this._inertia.record(a),this._fireEvents(f,m,!0)}_fireEvents(a,f,m){const g=qt(this._eventsInProgress),b=qt(a),T={};for(const U in a){const{originalEvent:j}=a[U];this._eventsInProgress[U]||(T[`${U}start`]=j),this._eventsInProgress[U]=a[U]}!g&&b&&this._fireEvent("movestart",b.originalEvent);for(const U in T)this._fireEvent(U,T[U]);b&&this._fireEvent("move",b.originalEvent);for(const U in a){const{originalEvent:j}=a[U];this._fireEvent(U,j)}const L={};let A;for(const U in this._eventsInProgress){const{handlerName:j,originalEvent:$}=this._eventsInProgress[U];this._handlersById[j].isActive()||(delete this._eventsInProgress[U],A=f[j]||$,L[`${U}end`]=A)}for(const U in L)this._fireEvent(U,L[U]);const O=qt(this._eventsInProgress);if(m&&(g||b)&&!O){this._updatingCamera=!0;const U=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),j=$=>$!==0&&-this._bearingSnap<$&&${delete this._frameId,this.handleEvent(new Zh("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class To extends l.E{constructor(a,f){super(),this._renderFrameCallback=()=>{const m=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=a,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.M(this.transform.center.lng,this.transform.center.lat)}setCenter(a,f){return this.jumpTo({center:a},f)}panBy(a,f,m){return a=l.P.convert(a).mult(-1),this.panTo(this.transform.center,l.e({offset:a},f),m)}panTo(a,f,m){return this.easeTo(l.e({center:a},f),m)}getZoom(){return this.transform.zoom}setZoom(a,f){return this.jumpTo({zoom:a},f),this}zoomTo(a,f,m){return this.easeTo(l.e({zoom:a},f),m)}zoomIn(a,f){return this.zoomTo(this.getZoom()+1,a,f),this}zoomOut(a,f){return this.zoomTo(this.getZoom()-1,a,f),this}getBearing(){return this.transform.bearing}setBearing(a,f){return this.jumpTo({bearing:a},f),this}getPadding(){return this.transform.padding}setPadding(a,f){return this.jumpTo({padding:a},f),this}rotateTo(a,f,m){return this.easeTo(l.e({bearing:a},f),m)}resetNorth(a,f){return this.rotateTo(0,l.e({duration:1e3},a),f),this}resetNorthPitch(a,f){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},a),f),this}snapToNorth(a,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=l.z.number(b,re,Ke)),this._rotating&&(g.bearing=l.z.number(T,O,Ke)),this._pitching&&(g.pitch=l.z.number(L,U,Ke)),this._padding&&(g.interpolatePadding(A,j,Ke),he=g.centerPoint.add($)),this.terrain&&!a.freezeElevation&&this._updateElevation(Ke),De)g.setLocationAtPoint(De,Ge);else{const rt=g.zoomScale(g.zoom-b),tt=re>b?Math.min(2,xe):Math.max(.5,xe),ct=Math.pow(tt,1-Ke),dt=g.unproject(Ie.add(Ue.mult(Ke*ct)).mult(rt));g.setLocationAtPoint(g.renderWorldCopies?dt.wrap():dt,he)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},Ke=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ke)},a),this}_prepareEase(a,f,m={}){this._moving=!0,f||m.moving||this.fire(new l.k("movestart",a)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",a)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",a)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",a))}_prepareElevation(a){this._elevationCenter=a,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(a){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(a<1&&f!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=a*(m-(f-(m*a+this._elevationStart))/(1-a)),this._elevationTarget=f}this.transform.elevation=l.z.number(this._elevationStart,this._elevationTarget,a)}_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(a){if(!this.transformCameraUpdate)return;const f=a.clone(),{center:m,zoom:g,pitch:b,bearing:T,elevation:L}=this.transformCameraUpdate(f);m&&(f.center=m),g!==void 0&&(f.zoom=g),b!==void 0&&(f.pitch=b),T!==void 0&&(f.bearing=T),L!==void 0&&(f.elevation=L),this.transform.apply(f)}_fireMoveEvents(a){this.fire(new l.k("move",a)),this._zooming&&this.fire(new l.k("zoom",a)),this._rotating&&this.fire(new l.k("rotate",a)),this._pitching&&this.fire(new l.k("pitch",a))}_afterEase(a,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const m=this._zooming,g=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",a)),g&&this.fire(new l.k("rotateend",a)),b&&this.fire(new l.k("pitchend",a)),this.fire(new l.k("moveend",a))}flyTo(a,f){var m;if(!a.essential&&E.prefersReducedMotion){const Pn=l.L(a,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pn,f)}this.stop(),a=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b7},a);const g=this._getTransformForUpdate(),b=this.getZoom(),T=this.getBearing(),L=this.getPitch(),A=this.getPadding(),O="bearing"in a?this._normalizeBearing(a.bearing,T):T,U="pitch"in a?+a.pitch:L,j="padding"in a?a.padding:g.padding,$=l.P.convert(a.offset);let he=g.centerPoint.add($);const ce=g.pointLocation(he),{center:me,zoom:re}=g.getConstrained(l.M.convert(a.center||ce),(m=a.zoom)!==null&&m!==void 0?m:b);this._normalizeCenter(me);const Ie=g.zoomScale(re-b),Ue=g.project(ce),xe=g.project(me).sub(Ue);let De=a.curve;const Ge=Math.max(g.width,g.height),Ze=Ge/Ie,Ke=xe.mag();if("minZoom"in a){const Pn=l.ac(Math.min(a.minZoom,b,re),g.minZoom,g.maxZoom),Qt=Ge/g.zoomScale(Pn-b);De=Math.sqrt(Qt/Ke*2)}const rt=De*De;function tt(Pn){const Qt=(Ze*Ze-Ge*Ge+(Pn?-1:1)*rt*rt*Ke*Ke)/(2*(Pn?Ze:Ge)*rt*Ke);return Math.log(Math.sqrt(Qt*Qt+1)-Qt)}function ct(Pn){return(Math.exp(Pn)-Math.exp(-Pn))/2}function dt(Pn){return(Math.exp(Pn)+Math.exp(-Pn))/2}const cn=tt(!1);let mt=function(Pn){return dt(cn)/dt(cn+De*Pn)},Xt=function(Pn){return Ge*((dt(cn)*(ct(Qt=cn+De*Pn)/dt(Qt))-ct(cn))/rt)/Ke;var Qt},hn=(tt(!0)-cn)/De;if(Math.abs(Ke)<1e-6||!isFinite(hn)){if(Math.abs(Ge-Ze)<1e-6)return this.easeTo(a,f);const Pn=Zea.maxDuration&&(a.duration=0),this._zooming=!0,this._rotating=T!==O,this._pitching=U!==L,this._padding=!g.isPaddingEqual(j),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(me),this._ease(Pn=>{const Qt=Pn*hn,mn=1/mt(Qt);g.zoom=Pn===1?re:b+g.scaleZoom(mn),this._rotating&&(g.bearing=l.z.number(T,O,Pn)),this._pitching&&(g.pitch=l.z.number(L,U,Pn)),this._padding&&(g.interpolatePadding(A,j,Pn),he=g.centerPoint.add($)),this.terrain&&!a.freezeElevation&&this._updateElevation(Pn);const vn=Pn===1?me:g.unproject(Ue.add(xe.mult(Xt(Qt))).mult(mn));g.setLocationAtPoint(g.renderWorldCopies?vn.wrap():vn,he),this._applyUpdatedTransform(g),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},a),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(a,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,f)}if(!a){const m=this.handlers;m&&m.stop(!1)}return this}_ease(a,f,m){m.animate===!1||m.duration===0?(a(1),f()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=a,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(a,f){a=l.b1(a,-180,180);const m=Math.abs(a-f);return Math.abs(a-360-f)180?-360:m<-180?360:0}queryTerrainElevation(a){return this.terrain?this.terrain.getElevationForLngLatZoom(l.M.convert(a),this.transform.tileZoom)-this.transform.elevation:null}}const jp={compact:!0,customAttribution:'MapLibre'};class As{constructor(a=jp){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=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.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=a}getDefaultPosition(){return"bottom-right"}onAdd(a){return this._map=a,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.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(){C.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(a,f){const m=this._map._getUIString(`AttributionControl.${f}`);a.title=m,a.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let a=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=a.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&a.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const f=this._map.style.sourceCaches;for(const g in f){const b=f[g];if(b.used||b.usedForTerrain){const T=b.getSource();T.attribution&&a.indexOf(T.attribution)<0&&a.push(T.attribution)}}a=a.filter(g=>String(g).trim()),a.sort((g,b)=>g.length-b.length),a=a.filter((g,b)=>{for(let T=b+1;T=0)return!1;return!0});const m=a.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,a.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class cg{constructor(a={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const m=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=a}getDefaultPosition(){return"bottom-left"}onAdd(a){this._map=a,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const f=C.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Rc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const f=++this._id;return this._queue.push({callback:a,id:f,cancelled:!1}),f}remove(a){const f=this._currentlyRunning,m=f?this._queue.concat(f):this._queue;for(const g of m)if(g.id===a)return void(g.cancelled=!0)}run(a=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const m of f)if(!m.cancelled&&(m.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Fr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class Qr extends l.E{constructor(a){super(),this.sourceCache=a,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,a.usedForTerrain=!0,a.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(a,f){this.sourceCache.update(a,f),this._renderableTilesKeys=[];const m={};for(const g of a.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),l.aN(g.posMatrix,0,l.W,0,l.W,0,1),this._tiles[g.key]=new us(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(a){for(const f in this._tiles){const m=this._tiles[f];(!a||m.tileID.equals(a)||m.tileID.isChildOf(a)||a.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(a=>this.getTileByID(a))}getTileByID(a){return this._tiles[a]}getTerrainCoords(a){const f={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(a.canonical)){const b=a.clone();b.posMatrix=new Float64Array(16),l.aN(b.posMatrix,0,l.W,0,l.W,0,1),f[m]=b}else if(g.canonical.isChildOf(a.canonical)){const b=a.clone();b.posMatrix=new Float64Array(16);const T=g.canonical.z-a.canonical.z,L=g.canonical.x-(g.canonical.x>>T<>T<>T;l.aN(b.posMatrix,0,O,0,O,0,1),l.H(b.posMatrix,b.posMatrix,[-L*O,-A*O,0]),f[m]=b}else if(a.canonical.isChildOf(g.canonical)){const b=a.clone();b.posMatrix=new Float64Array(16);const T=a.canonical.z-g.canonical.z,L=a.canonical.x-(a.canonical.x>>T<>T<>T;l.aN(b.posMatrix,0,l.W,0,l.W,0,1),l.H(b.posMatrix,b.posMatrix,[L*O,A*O,0]),l.J(b.posMatrix,b.posMatrix,[1/2**T,1/2**T,0]),f[m]=b}}return f}getSourceTile(a,f){const m=this.sourceCache._source;let g=a.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g=m.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(a.scaledTo(g--).key);return b}tilesAfterTime(a=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=a)}}class hg{constructor(a,f,m){this.painter=a,this.sourceCache=new Qr(f),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(a,f,m,g=l.W){var b;if(!(f>=0&&f=0&&ma.canonical.z&&(a.canonical.z>=g?b=a.canonical.z-g:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const T=a.canonical.x-(a.canonical.x>>b<>b<>8<<4|b>>8,f[T+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new Q(a,m,a.gl.RGBA,{premultiply:!1});return g.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(a){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),m=this.painter.context,g=m.gl,b=Math.round(a.x*this.painter.pixelRatio/devicePixelRatio),T=Math.round(a.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(b,L-T-1,1,1,g.RGBA,g.UNSIGNED_BYTE,f),m.bindFramebuffer.set(null);const A=f[0]+(f[2]>>4<<8),O=f[1]+((15&f[2])<<8),U=this.coordsIndex[255-f[3]],j=U&&this.sourceCache.getTileByID(U);if(!j)return null;const $=this._coordsTextureSize,he=(1<a.id!==f),this._recentlyUsed.push(a.id)}stampObject(a){a.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const a=this._createObject(this._objects.length);return this._objects.push(a),a}freeObject(a){a.inUse=!1}freeAllObjects(){for(const a of this._objects)this.freeObject(a)}isFull(){return!(this._objects.length!a.inUse)===!1}}const ka={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Gp{constructor(a,f){this.painter=a,this.terrain=f,this.pool=new Nc(a.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(a){return this.pool.getObjectForId(a.rtt[this._stacks.length-1].id).texture}prepareForRender(a,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=a._order.filter(m=>!a._layers[m].isHidden(f)),this._coordsDescendingInv={};for(const m in a.sourceCaches){this._coordsDescendingInv[m]={};const g=a.sourceCaches[m].getVisibleCoordinates();for(const b of g){const T=this.terrain.sourceCache.getTerrainCoords(b);for(const L in T)this._coordsDescendingInv[m][L]||(this._coordsDescendingInv[m][L]=[]),this._coordsDescendingInv[m][L].push(T[L])}}this._coordsDescendingInvStr={};for(const m of a._order){const g=a._layers[m],b=g.source;if(ka[g.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const T in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][T]=this._coordsDescendingInv[b][T].map(L=>L.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[g][m.tileID.key];b&&b!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(a){if(a.isHidden(this.painter.transform.zoom))return!1;const f=a.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===a.id;if(ka[f]&&(this._prevType&&ka[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(a.id),!g))return!0;if(ka[this._prevType]||ka[f]&&g){this._prevType=f;const b=this._stacks.length-1,T=this._stacks[b]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(Uh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[b]){const O=this.pool.getObjectForId(L.rtt[b].id);if(O.stamp===L.rtt[b].stamp){this.pool.useObject(O);continue}}const A=this.pool.getOrCreateFreeObject();this.pool.useObject(A),this.pool.stampObject(A),L.rtt[b]={id:A.id,stamp:A.stamp},m.context.bindFramebuffer.set(A.fbo.framebuffer),m.context.clear({color:l.aO.transparent,stencil:0}),m.currentStencilSource=void 0;for(let O=0;O{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Hp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Zp{constructor(a,f,m=!1){this.mousedown=T=>{this.startMouse(l.e({},T,{ctrlKey:!0,preventDefault:()=>T.preventDefault()}),C.mousePos(this.element,T)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=T=>{this.moveMouse(T,C.mousePos(this.element,T))},this.mouseup=T=>{this.mouseRotate.dragEnd(T),this.mousePitch&&this.mousePitch.dragEnd(T),this.offTemp()},this.touchstart=T=>{T.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,T.targetTouches)[0],this.startTouch(T,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=T=>{T.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,T.targetTouches)[0],this.moveTouch(T,this._lastPos))},this.touchend=T=>{T.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=a.dragRotate._mouseRotate.getClickTolerance(),b=a.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=Au({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:T,clickTolerance:L,bearingDegreesPerPixelMoved:A=.8})=>{const O=new It;return new Mu({clickTolerance:L,move:(U,j)=>({bearingDelta:(j.x-U.x)*A}),moveStateManager:O,enable:T,assignEvents:Xh})})({clickTolerance:g,enable:!0}),this.map=a,m&&(this.mousePitch=ku({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:T,clickTolerance:L,pitchDegreesPerPixelMoved:A=-.5})=>{const O=new It;return new Mu({clickTolerance:L,move:(U,j)=>({pitchDelta:(j.y-U.y)*A}),moveStateManager:O,enable:T,assignEvents:Xh})})({clickTolerance:b,enable:!0})),C.addEventListener(f,"mousedown",this.mousedown),C.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(f,"touchcancel",this.reset)}startMouse(a,f){this.mouseRotate.dragStart(a,f),this.mousePitch&&this.mousePitch.dragStart(a,f),C.disableDrag()}startTouch(a,f){this.touchRotate.dragStart(a,f),this.touchPitch&&this.touchPitch.dragStart(a,f),C.disableDrag()}moveMouse(a,f){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(a,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(a,f)||{};b&&m.setPitch(m.getPitch()+b)}}moveTouch(a,f){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(a,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(a,f)||{};b&&m.setPitch(m.getPitch()+b)}}off(){const a=this.element;C.removeEventListener(a,"mousedown",this.mousedown),C.removeEventListener(a,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(a,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let Da;function $h(y,a,f){const m=new l.M(y.lng,y.lat);if(y=new l.M(y.lng,y.lat),a){const g=new l.M(y.lng-360,y.lat),b=new l.M(y.lng+360,y.lat),T=f.locationPoint(y).distSqr(a);f.locationPoint(g).distSqr(a)180;){const g=f.locationPoint(y);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;y.lng>f.center.lng?y.lng-=360:y.lng+=360}return y.lng!==m.lng&&f.locationPoint(y).y>f.height/2-f.getHorizon()?y:m}const zc={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 Yh(y,a,f){const m=y.classList;for(const g in zc)m.remove(`maplibregl-${f}-anchor-${g}`);m.add(`maplibregl-${f}-anchor-${a}`)}class Fc extends l.E{constructor(a){if(super(),this._onKeyPress=f=>{const m=f.code,g=f.charCode||f.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=f=>{const m=f.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=f=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?$h(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let b="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let T="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?T="rotateX(0deg)":this._pitchAlignment==="map"&&(T=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${zc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${T} ${b}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=f.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 l.k("dragstart"))),this.fire(new l.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 l.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.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=a&&a.anchor||"center",this._color=a&&a.color||"#3FB1CE",this._scale=a&&a.scale||1,this._draggable=a&&a.draggable||!1,this._clickTolerance=a&&a.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=a&&a.rotation||0,this._rotationAlignment=a&&a.rotationAlignment||"auto",this._pitchAlignment=a&&a.pitchAlignment&&a.pitchAlignment!=="auto"?a.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(a==null?void 0:a.opacity,a==null?void 0:a.opacityWhenCovered),a&&a.element)this._element=a.element,this._offset=l.P.convert(a&&a.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div"),this._element.setAttribute("aria-label","Map marker");const f=C.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${m}px`),f.setAttributeNS(null,"width",`${g}px`),f.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const b=C.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 T=C.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill-rule","nonzero");const L=C.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");const A=[{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 Ie of A){const Ue=C.createNS("http://www.w3.org/2000/svg","ellipse");Ue.setAttributeNS(null,"opacity","0.04"),Ue.setAttributeNS(null,"cx","10.5"),Ue.setAttributeNS(null,"cy","5.80029008"),Ue.setAttributeNS(null,"rx",Ie.rx),Ue.setAttributeNS(null,"ry",Ie.ry),L.appendChild(Ue)}const O=C.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"fill",this._color);const U=C.createNS("http://www.w3.org/2000/svg","path");U.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"),O.appendChild(U);const j=C.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"fill","#000000");const $=C.createNS("http://www.w3.org/2000/svg","path");$.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"),j.appendChild($);const he=C.createNS("http://www.w3.org/2000/svg","g");he.setAttributeNS(null,"transform","translate(6.0, 7.0)"),he.setAttributeNS(null,"fill","#FFFFFF");const ce=C.createNS("http://www.w3.org/2000/svg","g");ce.setAttributeNS(null,"transform","translate(8.0, 8.0)");const me=C.createNS("http://www.w3.org/2000/svg","circle");me.setAttributeNS(null,"fill","#000000"),me.setAttributeNS(null,"opacity","0.25"),me.setAttributeNS(null,"cx","5.5"),me.setAttributeNS(null,"cy","5.5"),me.setAttributeNS(null,"r","5.4999962");const re=C.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#FFFFFF"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962"),ce.appendChild(me),ce.appendChild(re),T.appendChild(L),T.appendChild(O),T.appendChild(j),T.appendChild(he),T.appendChild(ce),f.appendChild(T),f.setAttributeNS(null,"height",m*this._scale+"px"),f.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(f),this._offset=l.P.convert(a&&a.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Yh(this._element,this._anchor,"marker"),a&&a.className)for(const f of a.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(a){return this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._update),a.on("moveend",this._update),a.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),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=l.M.convert(a),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(a){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),a){if(!("offset"in a.options)){const g=Math.abs(13.5)/Math.SQRT2;a.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=a,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 a=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:a?(a.isOpen()?a.remove():(a.setLngLat(this._lngLat),a.addTo(this._map)),this):this}_updateOpacity(a=!1){var f,m;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(a)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const g=this._map,b=g.terrain.depthAtPoint(this._pos),T=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,T)-b<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/g.transform._pixelPerMeter,A=Math.sin(g.getPitch()*Math.PI/180)*L,O=g.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),U=g.transform.lngLatToCameraDepth(this._lngLat,T+A)-O>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&U&&this._popup.remove(),this._element.style.opacity=U?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(a){return this._offset=l.P.convert(a),this._update(),this}addClassName(a){this._element.classList.add(a)}removeClassName(a){this._element.classList.remove(a)}toggleClassName(a){return this._element.classList.toggle(a)}setDraggable(a){return this._draggable=!!a,this._map&&(a?(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(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a&&a!=="auto"?a:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(a,f){return a===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),a!==void 0&&(this._opacity=a),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Kh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ru=0,Wl=!1;const Jh={maxWidth:100,unit:"metric"};function Qh(y,a,f){const m=f&&f.maxWidth||100,g=y._container.clientHeight/2,b=y.unproject([0,g]),T=y.unproject([m,g]),L=b.distanceTo(T);if(f&&f.unit==="imperial"){const A=3.2808*L;A>5280?Hl(a,m,A/5280,y._getUIString("ScaleControl.Miles")):Hl(a,m,A,y._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Hl(a,m,L/1852,y._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Hl(a,m,L/1e3,y._getUIString("ScaleControl.Kilometers")):Hl(a,m,L,y._getUIString("ScaleControl.Meters"))}function Hl(y,a,f,m){const g=function(b){const T=Math.pow(10,`${Math.floor(b)}`.length-1);let L=b/T;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(A){const O=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*O)/O}(L),T*L}(f);y.style.width=a*(g/f)+"px",y.innerHTML=`${g} ${m}`}const Xp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},$p=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ef(y){if(y){if(typeof y=="number"){const a=Math.round(Math.abs(y)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,y),"top-left":new l.P(a,a),"top-right":new l.P(-a,a),bottom:new l.P(0,-y),"bottom-left":new l.P(a,-a),"bottom-right":new l.P(-a,-a),left:new l.P(y,0),right:new l.P(-y,0)}}if(y instanceof l.P||Array.isArray(y)){const a=l.P.convert(y);return{center:a,top:a,"top-left":a,"top-right":a,bottom:a,"bottom-left":a,"bottom-right":a,left:a,right:a}}return{center:l.P.convert(y.center||[0,0]),top:l.P.convert(y.top||[0,0]),"top-left":l.P.convert(y["top-left"]||[0,0]),"top-right":l.P.convert(y["top-right"]||[0,0]),bottom:l.P.convert(y.bottom||[0,0]),"bottom-left":l.P.convert(y["bottom-left"]||[0,0]),"bottom-right":l.P.convert(y["bottom-right"]||[0,0]),left:l.P.convert(y.left||[0,0]),right:l.P.convert(y.right||[0,0])}}return ef(new l.P(0,0))}const fg=d;c.AJAXError=l.be,c.Evented=l.E,c.LngLat=l.M,c.MercatorCoordinate=l.Y,c.Point=l.P,c.addProtocol=l.bf,c.config=l.a,c.removeProtocol=l.bg,c.AttributionControl=As,c.BoxZoomHandler=Ps,c.CanvasSource=Cs,c.CooperativeGesturesHandler=Ot,c.DoubleClickZoomHandler=Vp,c.DragPanHandler=ug,c.DragRotateHandler=Ms,c.EdgeInsets=Lu,c.FullscreenControl=class extends l.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var a;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((a=f==null?void 0:f.shadowRoot)===null||a===void 0)&&a.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===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:l.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=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.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 l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=qr,c.GeolocateControl=class extends l.E{constructor(y){super(),this._onSuccess=a=>{if(this._map){if(this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=a,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(a),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(a),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",a)),this._finish()}},this._updateCamera=a=>{const f=new l.M(a.coords.longitude,a.coords.latitude),m=a.coords.accuracy,g=this._map.getBearing(),b=l.e({bearing:g},this.options.fitBoundsOptions),T=Ce.fromLngLat(f,m);this._map.fitBounds(T,b,{geolocateSource:!0})},this._updateMarker=a=>{if(a){const f=new l.M(a.coords.longitude,a.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=a.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=a=>{if(this._map){if(this.options.trackUserLocation)if(a.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 f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(a.code===3&&Wl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",a)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=a=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Fc({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.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 l.k("trackuserlocationend")))})}},this.options=l.e({},Kh,y)}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(a=!1){if(Da!==void 0&&!a)return Da;if(window.navigator.permissions===void 0)return Da=!!window.navigator.geolocation,Da;try{Da=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Da=!!window.navigator.geolocation}return Da})}().then(a=>this._setupUI(a)),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(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ru=0,Wl=!1}_isOutOfMapMaxBounds(y){const a=this._map.getMaxBounds(),f=y.coords;return a&&(f.longitudea.getEast()||f.latitudea.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(),a=y.getSouthEast(),f=y.getNorthEast(),m=a.distanceTo(f),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return l.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 l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ru--,Wl=!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 l.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 l.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"),Ru++,Ru>1?(y={maximumAge:6e5,timeout:0},Wl=!0):(y=this.options.positionOptions,Wl=!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)}},c.Hash=Op,c.ImageSource=ur,c.KeyboardHandler=al,c.LngLatBounds=Ce,c.LogoControl=cg,c.Map=class extends To{constructor(y){if(l.bc.mark(l.bd.create),(y=l.e({},Oc,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 jh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=a=>{a.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:a}))},this._contextRestored=a=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:a}))},this._onMapScroll=a=>{if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,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 Rc,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},qp,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new H(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 a=!1;const f=Np(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{a?f(m):a=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Up(this,y),this._hash=y.hash&&new Op(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,l.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 As(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new cg,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new l.k(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new l.k(`${a.dataType}dataloading`,a))}),this.on("dataabort",a=>{this.fire(new l.k("sourcedataabort",a))})}_getMapId(){return this._mapId}addControl(y,a){if(a===void 0&&(a=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=y.onAdd(this);this._controls.push(y);const m=this._controlPositions[a];return a.indexOf("bottom")!==-1?m.insertBefore(f,m.firstChild):m.appendChild(f),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const a=this._controls.indexOf(y);return a>-1&&this._controls.splice(a,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,a,f,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,a,f,m)}resize(y){var a;const f=this._containerDimensions(),m=f[0],g=f[1],b=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,b),this.painter.resize(m,g,b),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const A=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,A),this.painter.resize(m,g,A)}this.transform.resize(m,g),(a=this._requestedCameraState)===null||a===void 0||a.resize(m,g);const T=!this._moving;return T&&(this.stop(),this.fire(new l.k("movestart",y)).fire(new l.k("move",y))),this.fire(new l.k("resize",y)),T&&this.fire(new l.k("moveend",y)),this}_getClampedPixelRatio(y,a){const{0:f,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),b=y*g,T=a*g;return Math.min(b>f?f/b:1,T>m?m/T: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(Ce.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()}project(y){return this.transform.locationPoint(l.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(l.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,a,f){if(y==="mouseenter"||y==="mouseover"){let m=!1;return{layer:a,listener:f,delegates:{mousemove:b=>{const T=this.getLayer(a)?this.queryRenderedFeatures(b.point,{layers:[a]}):[];T.length?m||(m=!0,f.call(this,new Co(y,this,b.originalEvent,{features:T}))):m=!1},mouseout:()=>{m=!1}}}}if(y==="mouseleave"||y==="mouseout"){let m=!1;return{layer:a,listener:f,delegates:{mousemove:T=>{(this.getLayer(a)?this.queryRenderedFeatures(T.point,{layers:[a]}):[]).length?m=!0:m&&(m=!1,f.call(this,new Co(y,this,T.originalEvent)))},mouseout:T=>{m&&(m=!1,f.call(this,new Co(y,this,T.originalEvent)))}}}}{const m=g=>{const b=this.getLayer(a)?this.queryRenderedFeatures(g.point,{layers:[a]}):[];b.length&&(g.features=b,f.call(this,g),delete g.features)};return{layer:a,listener:f,delegates:{[y]:m}}}}on(y,a,f){if(f===void 0)return super.on(y,a);const m=this._createDelegatedListener(y,a,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(y,a,f){if(f===void 0)return super.once(y,a);const m=this._createDelegatedListener(y,a,f);for(const g in m.delegates)this.once(g,m.delegates[g]);return this}off(y,a,f){return f===void 0?super.off(y,a):(this._delegatedListeners&&this._delegatedListeners[y]&&(m=>{const g=this._delegatedListeners[y];for(let b=0;bthis._updateStyle(y,a));const f=this.style&&a.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Wo(this,a||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,a,f):this.style.loadJSON(y,a,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Wo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,a){if(typeof y=="string"){const f=this._requestManager.transformRequest(y,"Style");l.h(f,new AbortController).then(m=>{this._updateDiff(m.data,a)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof y=="object"&&this._updateDiff(y,a)}_updateDiff(y,a){try{this.style.setState(y,a)&&this._update(!0)}catch(f){l.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(y,a)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(y,a){return this._lazyInitEmptyStyle(),this.style.addSource(y,a),this._update(!0)}isSourceLoaded(y){const a=this.style&&this.style.sourceCaches[y];if(a!==void 0)return a.loaded();this.fire(new l.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 a=this.style.sourceCaches[y.source];if(!a)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&a.reload();for(const f in this.style._layers){const m=this.style._layers[f];m.type==="hillshade"&&m.source===y.source&&l.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 hg(this.painter,a,y),this.painter.renderToTexture=new Gp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=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(f.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:y})),this}getTerrain(){var y,a;return(a=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&a!==void 0?a:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const a in y){const f=y[a]._tiles;for(const m in f){const g=f[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,a,f={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:b,stretchY:T,content:L}=f;if(this._lazyInitEmptyStyle(),!(a instanceof HTMLImageElement||l.b(a))){if(a.width===void 0||a.height===void 0)return this.fire(new l.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:A,height:O,data:U}=a,j=a;return this.style.addImage(y,{data:new l.R({width:A,height:O},new Uint8Array(U)),pixelRatio:m,stretchX:b,stretchY:T,content:L,sdf:g,version:0,userImage:j}),j.onAdd&&j.onAdd(this,y),this}}{const{width:A,height:O,data:U}=E.getImageData(a);this.style.addImage(y,{data:new l.R({width:A,height:O},U),pixelRatio:m,stretchX:b,stretchY:T,content:L,sdf:g,version:0})}}updateImage(y,a){const f=this.style.getImage(y);if(!f)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=a instanceof HTMLImageElement||l.b(a)?E.getImageData(a):a,{width:g,height:b,data:T}=m;if(g===void 0||b===void 0)return this.fire(new l.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!==f.data.width||b!==f.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(a instanceof HTMLImageElement||l.b(a));return f.data.replace(T,L),this.style.updateImage(y,f),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return G.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,a){return this._lazyInitEmptyStyle(),this.style.addLayer(y,a),this._update(!0)}moveLayer(y,a){return this.style.moveLayer(y,a),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,a,f){return this.style.setLayerZoomRange(y,a,f),this._update(!0)}setFilter(y,a,f={}){return this.style.setFilter(y,a,f),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,a,f,m={}){return this.style.setPaintProperty(y,a,f,m),this._update(!0)}getPaintProperty(y,a){return this.style.getPaintProperty(y,a)}setLayoutProperty(y,a,f,m={}){return this.style.setLayoutProperty(y,a,f,m),this._update(!0)}getLayoutProperty(y,a){return this.style.getLayoutProperty(y,a)}setGlyphs(y,a={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,a),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,a,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,a,f,m=>{m||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,a={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,a,f=>{f||this._update(!0)}),this}setLight(y,a={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,a),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,a){return this.style.setFeatureState(y,a),this._update()}removeFeatureState(y,a){return this.style.removeFeatureState(y,a),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,a=0;return this._container&&(y=this._container.clientWidth||400,a=this._container.clientHeight||300),[y,a]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const a=this._canvasContainer=C.create("div","maplibregl-canvas-container",y);this._interactive&&a.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",a),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 f=this._containerDimensions(),m=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],m);const g=this._controlContainer=C.create("div","maplibregl-control-container",y),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(T=>{b[T]=C.create("div",`maplibregl-ctrl-${T} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,a,f){this._canvas.width=Math.floor(f*y),this._canvas.height=Math.floor(f*a),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${a}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let a=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{a={requestedAttributes:y},m&&(a.statusMessage=m.statusMessage,a.type=m.type)},{once:!0});const f=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!f){const m="Failed to initialize WebGL";throw a?(a.message=m,new Error(JSON.stringify(a))):new Error(m)}this.painter=new Jm(f,this.transform),M.testSupport(f)}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 a=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,b=E.now();this.style.zoomHistory.update(g,b);const T=new l.a8(g,{now:b,fadeDuration:a,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=T.crossFadingFactor();L===1&&L===this._crossFadingFactor||(f=!0,this._crossFadingFactor=L),this.style.update(T)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=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.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,a,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:a,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bc.mark(l.bd.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bc.mark(l.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),G.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bc.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(y=>{l.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}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 Wp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=Co,c.MapTouchEvent=ea,c.MapWheelEvent=zp,c.Marker=Fc,c.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const a=this._map.getZoom(),f=a===this._map.getMaxZoom(),m=a===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const a=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=a},this._setButtonTitle=(a,f)=>{const m=this._map._getUIString(`NavigationControl.${f}`);a.title=m,a.setAttribute("aria-label",m)},this.options=l.e({},Hp,y),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",a=>this._map.zoomIn({},{originalEvent:a})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",a=>this._map.zoomOut({},{originalEvent:a})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",a=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:a}):this._map.resetNorth({},{originalEvent:a})}),this._compassIcon=C.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 Zp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.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,a){const f=C.create("button",y,this._container);return f.type="button",f.addEventListener("click",a),f}},c.Popup=class extends l.E{constructor(y){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=a=>{this._update(a.point)},this._onMouseMove=a=>{this._update(a.point)},this._onDrag=a=>{this._update(a.point)},this._update=a=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const L of this.options.className.split(" "))this._container.classList.add(L);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?$h(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!a)return;const m=this._flatPos=this._pos=this._trackPointer&&a?a:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&a?a:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const b=ef(this.options.offset);if(!g){const L=this._container.offsetWidth,A=this._container.offsetHeight;let O;O=m.y+b.bottom.ythis._map.transform.height-A?["bottom"]:[],m.xthis._map.transform.width-L/2&&O.push("right"),g=O.length===0?"bottom":O.join("-")}let T=m.add(b[g]);this.options.subpixelPositioning||(T=T.round()),C.setTransform(this._container,`${zc[g]} translate(${T.x}px,${T.y}px)`),Yh(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Xp),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 l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=l.M.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const a=document.createDocumentFragment(),f=document.createElement("body");let m;for(f.innerHTML=y;m=f.firstChild,m;)a.appendChild(m);return this.setDOMContent(a)}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=C.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)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.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($p);y&&y.focus()}},c.RasterDEMTileSource=on,c.RasterTileSource=Re,c.ScaleControl=class{constructor(y){this._onMove=()=>{Qh(this._map,this._container,this.options)},this.setUnit=a=>{this.options.unit=a,Qh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Jh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Hh,c.Style=Wo,c.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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.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(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=sg,c.TwoFingersTouchRotateHandler=Bp,c.TwoFingersTouchZoomHandler=og,c.TwoFingersTouchZoomRotateHandler=kc,c.VectorTileSource=kt,c.VideoSource=Go,c.addSourceType=(y,a)=>l._(void 0,void 0,void 0,function*(){if(tl(y))throw new Error(`A source type called "${y}" already exists.`);((f,m)=>{Ks[f]=m})(y,a)}),c.clearPrewarmedResources=function(){const y=Jt;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Tt),Jt=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()"))},c.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return lt().getRTLTextPluginStatus()},c.getVersion=function(){return fg},c.getWorkerCount=function(){return tn.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(y){return Nr().broadcast("IS",y)},c.prewarm=function(){Nn().acquire(Tt)},c.setMaxParallelImageRequests=function(y){l.a.MAX_PARALLEL_IMAGE_REQUESTS=y},c.setRTLTextPlugin=function(y,a){return lt().setRTLTextPlugin(y,a)},c.setWorkerCount=function(y){tn.workerCount=y},c.setWorkerUrl=function(y){l.a.WORKER_URL=y}});var s=n;return s})})(qE);var ey=qE.exports;const Bs=d1(ey),mf=[];function R0(t,e){return{subscribe:Fn(t,e).subscribe}}function Fn(t,e=Ct){let n;const r=new Set;function i(l){if(Ut(t,l)&&(t=l,n)){const d=!mf.length;for(const v of r)v[1](),mf.push(v,t);if(d){for(let v=0;v{r.delete(v),r.size===0&&n&&(n(),n=null)}}return{set:i,update:s,subscribe:c}}let $t;const HE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&HE.decode();let Md=null;function Vd(){return(Md===null||Md.byteLength===0)&&(Md=new Uint8Array($t.memory.buffer)),Md}function vl(t,e){return t=t>>>0,HE.decode(Vd().subarray(t,t+e))}const ru=new Array(128).fill(void 0);ru.push(void 0,null,!0,!1);let Ud=ru.length;function Ui(t){Ud===ru.length&&ru.push(ru.length+1);const e=Ud;return Ud=ru[e],ru[e]=t,e}function Mn(t){return ru[t]}function hM(t){t<132||(ru[t]=Ud,Ud=t)}function Kg(t){const e=Mn(t);return hM(t),e}function N0(t){return t==null}let Ad=null;function fM(){return(Ad===null||Ad.byteLength===0)&&(Ad=new Float64Array($t.memory.buffer)),Ad}let kd=null;function mr(){return(kd===null||kd.byteLength===0)&&(kd=new Int32Array($t.memory.buffer)),kd}let Zu=0;const Jg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},pM=typeof Jg.encodeInto=="function"?function(t,e){return Jg.encodeInto(t,e)}:function(t,e){const n=Jg.encode(t);return e.set(n),{read:t.length,written:n.length}};function Og(t,e,n){if(n===void 0){const l=Jg.encode(t),d=e(l.length,1)>>>0;return Vd().subarray(d,d+l.length).set(l),Zu=l.length,d}let r=t.length,i=e(r,1)>>>0;const s=Vd();let c=0;for(;c127)break;s[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=Vd().subarray(i+c,i+r),d=pM(t,l);c+=d.written}return Zu=c,i}function mv(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=mv(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:r}function dM(t,e){const n=e(t.length*1,1)>>>0;return Vd().set(t,n/1),Zu=t.length,n}function O0(t,e){try{return t.apply(this,e)}catch(n){$t.__wbindgen_exn_store(Ui(n))}}class p_{static __wrap(e){e=e>>>0;const n=Object.create(p_.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();$t.__wbg_jsroutesnapper_free(e)}constructor(e){try{const s=$t.__wbindgen_add_to_stack_pointer(-16),c=dM(e,$t.__wbindgen_malloc),l=Zu;$t.jsroutesnapper_new(s,c,l);var n=mr()[s/4+0],r=mr()[s/4+1],i=mr()[s/4+2];if(i)throw Kg(r);return p_.__wrap(n)}finally{$t.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){$t.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Ui(e))}setAreaMode(){$t.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_getConfig(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}toFinalFeature(){try{const r=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_toFinalFeature(r,this.__wbg_ptr);var e=mr()[r/4+0],n=mr()[r/4+1];let i;return e!==0&&(i=vl(e,n).slice(),$t.__wbindgen_free(e,n*1)),i}finally{$t.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_renderGeojson(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}toggleSnapMode(){$t.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,n,r){return $t.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,n,r)!==0}onClick(){$t.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return $t.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return $t.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){$t.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const i=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_editExisting(i,this.__wbg_ptr,Ui(e));var n=mr()[i/4+0],r=mr()[i/4+1];if(r)throw Kg(n)}finally{$t.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_debugRenderGraph(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}debugSnappableNodes(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_debugSnappableNodes(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}routeNameForWaypoints(e){let n,r;try{const S=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Ui(e));var i=mr()[S/4+0],s=mr()[S/4+1],c=mr()[S/4+2],l=mr()[S/4+3],d=i,v=s;if(l)throw d=0,v=0,Kg(c);return n=d,r=v,vl(d,v)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(n,r,1)}}addSnappedWaypoint(e,n){$t.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,n)}undo(){$t.jsroutesnapper_undo(this.__wbg_ptr)}}async function mM(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.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",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function gM(){const t={};return t.wbg={},t.wbg.__wbindgen_string_new=function(e,n){const r=vl(e,n);return Ui(r)},t.wbg.__wbindgen_object_drop_ref=function(e){Kg(e)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(vl(e,n));return Ui(r)},t.wbg.__wbindgen_is_object=function(e){const n=Mn(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return Mn(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return Mn(e)in Mn(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=Mn(n),i=typeof r=="number"?r:void 0;fM()[e/8+1]=N0(i)?0:i,mr()[e/4+0]=!N0(i)},t.wbg.__wbindgen_boolean_get=function(e){const n=Mn(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return Mn(e)==Mn(n)},t.wbg.__wbindgen_string_get=function(e,n){const r=Mn(n),i=typeof r=="string"?r:void 0;var s=N0(i)?0:Og(i,$t.__wbindgen_malloc,$t.__wbindgen_realloc),c=Zu;mr()[e/4+1]=c,mr()[e/4+0]=s},t.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,n){const r=Mn(e)[Mn(n)];return Ui(r)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=Mn(e);return Ui(n)},t.wbg.__wbg_String_4370c5505c674d30=function(e,n){const r=String(Mn(n)),i=Og(r,$t.__wbindgen_malloc,$t.__wbindgen_realloc),s=Zu;mr()[e/4+1]=s,mr()[e/4+0]=i},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ui(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=Mn(n).stack,i=Og(r,$t.__wbindgen_malloc,$t.__wbindgen_realloc),s=Zu;mr()[e/4+1]=s,mr()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(vl(e,n))}finally{$t.__wbindgen_free(r,i,1)}},t.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(Mn(e))},t.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(Mn(e))},t.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(Mn(e))},t.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(Mn(e))},t.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(Mn(e))},t.wbg.__wbg_get_44be0491f933a435=function(e,n){const r=Mn(e)[n>>>0];return Ui(r)},t.wbg.__wbg_length_fff51ee6522a1a18=function(e){return Mn(e).length},t.wbg.__wbindgen_is_function=function(e){return typeof Mn(e)=="function"},t.wbg.__wbg_next_526fc47e980da008=function(e){const n=Mn(e).next;return Ui(n)},t.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return O0(function(e){const n=Mn(e).next();return Ui(n)},arguments)},t.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return Mn(e).done},t.wbg.__wbg_value_1695675138684bd5=function(e){const n=Mn(e).value;return Ui(n)},t.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Ui(Symbol.iterator)},t.wbg.__wbg_get_97b561fb56f034b5=function(){return O0(function(e,n){const r=Reflect.get(Mn(e),Mn(n));return Ui(r)},arguments)},t.wbg.__wbg_call_cb65541d95d71282=function(){return O0(function(e,n){const r=Mn(e).call(Mn(n));return Ui(r)},arguments)},t.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(Mn(e))},t.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let n;try{n=Mn(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const n=Mn(e).buffer;return Ui(n)},t.wbg.__wbg_new_8125e318e6245eed=function(e){const n=new Uint8Array(Mn(e));return Ui(n)},t.wbg.__wbg_set_5cf90238115182c3=function(e,n,r){Mn(e).set(Mn(n),r>>>0)},t.wbg.__wbg_length_72e2208bbc0efc61=function(e){return Mn(e).length},t.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let n;try{n=Mn(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const r=mv(Mn(n)),i=Og(r,$t.__wbindgen_malloc,$t.__wbindgen_realloc),s=Zu;mr()[e/4+1]=s,mr()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(vl(e,n))},t.wbg.__wbindgen_memory=function(){const e=$t.memory;return Ui(e)},t}function _M(t,e){return $t=t.exports,ZE.__wbindgen_wasm_module=e,Ad=null,kd=null,Md=null,$t}async function ZE(t){if($t!==void 0)return $t;typeof t>"u"&&(t="/ltn/assets/route_snapper_bg.wasm");const e=gM();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await mM(await t,e);return _M(n,r)}var Ro=63710088e-1,m1={centimeters:Ro*100,centimetres:Ro*100,degrees:Ro/111325,feet:Ro*3.28084,inches:Ro*39.37,kilometers:Ro/1e3,kilometres:Ro/1e3,meters:Ro,metres:Ro,miles:Ro/1609.344,millimeters:Ro*1e3,millimetres:Ro*1e3,nauticalmiles:Ro/1852,radians:1,yards:Ro*1.0936},yM={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/Ro,yards:1.0936133},gv={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 ga(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function vM(t,e,n){switch(t){case"Point":return _s(e).geometry;case"LineString":return ha(e).geometry;case"Polygon":return g1(e).geometry;case"MultiPoint":return $E(e).geometry;case"MultiLineString":return XE(e).geometry;case"MultiPolygon":return YE(e).geometry;default:throw new Error(t+" is invalid")}}function _s(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d_(t[0])||!d_(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ga(r,e,n)}function bM(t,e,n){return n===void 0&&(n={}),Zc(t.map(function(r){return _s(r,e)}),n)}function g1(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function _1(t,e){e===void 0&&(e="kilometers");var n=m1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function ty(t,e){e===void 0&&(e="kilometers");var n=m1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function IM(t,e){return $d(ty(t,e))}function CM(t){var e=t%360;return e<0&&(e+=360),e}function $d(t){var e=t%(2*Math.PI);return e*180/Math.PI}function fa(t){var e=t%360;return e*Math.PI/180}function TM(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return _1(ty(t,e),n)}function LM(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=gv[e];if(!r)throw new Error("invalid original units");var i=gv[n];if(!i)throw new Error("invalid final units");return t/r*i}function d_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function y1(t){return!!t&&t.constructor===Object}function PM(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!d_(e))throw new Error("bbox must only contain numbers")})}function MM(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const AM=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:gv,bearingToAzimuth:CM,convertArea:LM,convertLength:TM,degreesToRadians:fa,earthRadius:Ro,factors:m1,feature:ga,featureCollection:Zc,geometry:vM,geometryCollection:SM,isNumber:d_,isObject:y1,lengthToDegrees:IM,lengthToRadians:ty,lineString:ha,lineStrings:wM,multiLineString:XE,multiPoint:$E,multiPolygon:YE,point:_s,points:bM,polygon:g1,polygons:xM,radiansToDegrees:$d,radiansToLength:_1,round:EM,unitsFactors:yM,validateBBox:PM,validateId:MM},Symbol.toStringTag,{value:"Module"}));function Yd(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Af(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function yd(t,e,n){n===void 0&&(n={});var r=Yd(t),i=Yd(e),s=fa(i[1]-r[1]),c=fa(i[0]-r[0]),l=fa(r[1]),d=fa(i[1]),v=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return _1(2*Math.atan2(Math.sqrt(v),Math.sqrt(1-v)),n.units)}function ym(t,e,n){if(t!==null)for(var r,i,s,c,l,d,v,S=0,E=0,C,M=t.type,k=M==="FeatureCollection",R=M==="Feature",N=k?t.features.length:1,B=0;Bd||k>v||R>S){l=E,d=r,v=k,S=R,s=0;return}var N=ha([l,E],n.properties);if(e(N,r,i,R,s)===!1)return!1;s++,l=E})===!1)return!1}}})}function FM(t,e,n){var r=n,i=!1;return JE(t,function(s,c,l,d,v){i===!1&&n===void 0?r=s:r=e(r,s,c,l,d,v),i=!0}),r}function QE(t,e){if(!t)throw new Error("geojson is required");ap(t,function(n,r,i){if(n.geometry!==null){var s=n.geometry.type,c=n.geometry.coordinates;switch(s){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;li?n:i,v=r>s?r:s;return[c,l,d,v]}var b1={exports:{}},tI={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(_m,function(){function n(F,G,H,K,_e){(function ae(le,ve,ke,Q,oe){for(;Q>ke;){if(Q-ke>600){var qe=Q-ke+1,Pe=ve-ke+1,it=Math.log(qe),ft=.5*Math.exp(2*it/3),Xe=.5*Math.sqrt(it*ft*(qe-ft)/qe)*(Pe-qe/2<0?-1:1),Mt=Math.max(ke,Math.floor(ve-Pe*ft/qe+Xe)),At=Math.min(Q,Math.floor(ve+(qe-Pe)*ft/qe+Xe));ae(le,ve,Mt,At,oe)}var yt=le[ve],zt=ke,Tt=Q;for(r(le,ke,ve),oe(le[Q],yt)>0&&r(le,ke,Q);zt0;)Tt--}oe(le[ke],yt)===0?r(le,ke,Tt):r(le,++Tt,Q),Tt<=ve&&(ke=Tt+1),ve<=Tt&&(Q=Tt-1)}})(F,G,H||0,K||F.length-1,_e||i)}function r(F,G,H){var K=F[G];F[G]=F[H],F[H]=K}function i(F,G){return FG?1:0}var s=function(F){F===void 0&&(F=9),this._maxEntries=Math.max(4,F),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(F,G,H){if(!H)return G.indexOf(F);for(var K=0;K=F.minX&&G.maxY>=F.minY}function N(F){return{children:F,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B(F,G,H,K,_e){for(var ae=[G,H];ae.length;)if(!((H=ae.pop())-(G=ae.pop())<=K)){var le=G+Math.ceil((H-G)/K/2)*K;n(F,le,G,H,_e),ae.push(G,le,le,H)}}return s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(F){var G=this.data,H=[];if(!R(F,G))return H;for(var K=this.toBBox,_e=[];G;){for(var ae=0;ae=0&&_e[G].children.length>this._maxEntries;)this._split(_e,G),G--;this._adjustParentBBoxes(K,_e,G)},s.prototype._split=function(F,G){var H=F[G],K=H.children.length,_e=this._minEntries;this._chooseSplitAxis(H,_e,K);var ae=this._chooseSplitIndex(H,_e,K),le=N(H.children.splice(ae,H.children.length-ae));le.height=H.height,le.leaf=H.leaf,l(H,this.toBBox),l(le,this.toBBox),G?F[G-1].children.push(le):this._splitRoot(H,le)},s.prototype._splitRoot=function(F,G){this.data=N([F,G]),this.data.height=F.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(F,G,H){for(var K,_e,ae,le,ve,ke,Q,oe=1/0,qe=1/0,Pe=G;Pe<=H-G;Pe++){var it=d(F,0,Pe,this.toBBox),ft=d(F,Pe,H,this.toBBox),Xe=(_e=it,ae=ft,le=void 0,ve=void 0,ke=void 0,Q=void 0,le=Math.max(_e.minX,ae.minX),ve=Math.max(_e.minY,ae.minY),ke=Math.min(_e.maxX,ae.maxX),Q=Math.min(_e.maxY,ae.maxY),Math.max(0,ke-le)*Math.max(0,Q-ve)),Mt=C(it)+C(ft);Xe=G;oe--){var qe=F.children[oe];v(le,F.leaf?_e(qe):qe),ve+=M(le)}return ve},s.prototype._adjustParentBBoxes=function(F,G,H){for(var K=H;K>=0;K--)v(G[K],F)},s.prototype._condense=function(F){for(var G=F.length-1,H=void 0;G>=0;G--)F[G].children.length===0?G>0?(H=F[G-1].children).splice(H.indexOf(F[G]),1):this.clear():l(F[G],this.toBBox)},s})})(tI);var ZM=tI.exports;const XM=Q_(AM),$M=Q_(jM);var Kx=Object.prototype.toString,nI=function(e){var n=Kx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Kx.call(e.callee)==="[object Function]"),r},z0,Jx;function YM(){if(Jx)return z0;Jx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=nI,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(C){var M=C.constructor;return M&&M.prototype===C},v={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var C in window)try{if(!v["$"+C]&&e.call(window,C)&&window[C]!==null&&typeof window[C]=="object")try{d(window[C])}catch{return!0}}catch{return!0}return!1}(),E=function(C){if(typeof window>"u"||!S)return d(C);try{return d(C)}catch{return!1}};t=function(M){var k=M!==null&&typeof M=="object",R=n.call(M)==="[object Function]",N=r(M),B=k&&n.call(M)==="[object String]",F=[];if(!k&&!R&&!N)throw new TypeError("Object.keys called on a non-object");var G=c&&R;if(B&&M.length>0&&!e.call(M,0))for(var H=0;H0)for(var K=0;K"u"||!Ki?qn:Ki(Uint8Array),Hc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?qn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?qn:ArrayBuffer,"%ArrayIteratorPrototype%":gf&&Ki?Ki([][Symbol.iterator]()):qn,"%AsyncFromSyncIteratorPrototype%":qn,"%AsyncFunction%":Sf,"%AsyncGenerator%":Sf,"%AsyncGeneratorFunction%":Sf,"%AsyncIteratorPrototype%":Sf,"%Atomics%":typeof Atomics>"u"?qn:Atomics,"%BigInt%":typeof BigInt>"u"?qn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?qn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?qn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?qn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":yA,"%eval%":eval,"%EvalError%":vA,"%Float32Array%":typeof Float32Array>"u"?qn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?qn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?qn:FinalizationRegistry,"%Function%":oI,"%GeneratorFunction%":Sf,"%Int8Array%":typeof Int8Array>"u"?qn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?qn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?qn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":gf&&Ki?Ki(Ki([][Symbol.iterator]())):qn,"%JSON%":typeof JSON=="object"?JSON:qn,"%Map%":typeof Map>"u"?qn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!gf||!Ki?qn:Ki(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?qn:Promise,"%Proxy%":typeof Proxy>"u"?qn:Proxy,"%RangeError%":bA,"%ReferenceError%":xA,"%Reflect%":typeof Reflect>"u"?qn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?qn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!gf||!Ki?qn:Ki(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?qn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":gf&&Ki?Ki(""[Symbol.iterator]()):qn,"%Symbol%":gf?Symbol:qn,"%SyntaxError%":kf,"%ThrowTypeError%":SA,"%TypedArray%":IA,"%TypeError%":Pf,"%Uint8Array%":typeof Uint8Array>"u"?qn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?qn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?qn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?qn:Uint32Array,"%URIError%":wA,"%WeakMap%":typeof WeakMap>"u"?qn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?qn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?qn:WeakSet};if(Ki)try{null.error}catch(t){var CA=Ki(Ki(t));Hc["%Error.prototype%"]=CA}var TA=function t(e){var n;if(e==="%AsyncFunction%")n=B0("async function () {}");else if(e==="%GeneratorFunction%")n=B0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=B0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ki&&(n=Ki(i.prototype))}return Hc[e]=n,n},rw={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vm=S1,g_=iI,LA=vm.call(Function.call,Array.prototype.concat),PA=vm.call(Function.apply,Array.prototype.splice),iw=vm.call(Function.call,String.prototype.replace),__=vm.call(Function.call,String.prototype.slice),MA=vm.call(Function.call,RegExp.prototype.exec),AA=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kA=/\\(\\)?/g,DA=function(e){var n=__(e,0,1),r=__(e,-1);if(n==="%"&&r!=="%")throw new kf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new kf("invalid intrinsic syntax, expected opening `%`");var i=[];return iw(e,AA,function(s,c,l,d){i[i.length]=l?iw(d,kA,"$1"):c||s}),i},RA=function(e,n){var r=e,i;if(g_(rw,r)&&(i=rw[r],r="%"+i[0]+"%"),g_(Hc,r)){var s=Hc[r];if(s===Sf&&(s=TA(r)),typeof s>"u"&&!n)throw new Pf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new kf("intrinsic "+e+" does not exist!")},Dl=function(e,n){if(typeof e!="string"||e.length===0)throw new Pf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Pf('"allowMissing" argument must be a boolean');if(MA(/^%?[^%]*%?$/,e)===null)throw new kf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=DA(e),i=r.length>0?r[0]:"",s=RA("%"+i+"%",n),c=s.name,l=s.value,d=!1,v=s.alias;v&&(i=v[0],PA(r,LA([0,1],v)));for(var S=1,E=!0;S=r.length){var R=Wc(l,C);E=!!R,E&&"get"in R&&!("originalValue"in R.get)?l=R.get:l=l[C]}else E=g_(l,C),l=l[C];E&&!d&&(Hc[c]=l)}}return l},U0,ow;function E1(){if(ow)return U0;ow=1;var t=Dl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return U0=e,U0}var NA=Dl,e_=NA("%Object.getOwnPropertyDescriptor%",!0);if(e_)try{e_([],"length")}catch{e_=null}var I1=e_,sw=E1(),OA=rI,_f=uc,aw=I1,C1=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new _f("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new _f("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _f("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _f("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _f("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _f("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,d=!!aw&&aw(e,n);if(sw)sw(e,n,{configurable:c===null&&d?d.configurable:!c,enumerable:i===null&&d?d.enumerable:!i,value:r,writable:s===null&&d?d.writable:!s});else if(l||!i&&!s&&!c)e[n]=r;else throw new OA("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_v=E1(),sI=function(){return!!_v};sI.hasArrayLengthDefineBug=function(){if(!_v)return null;try{return _v([],"length",{value:1}).length!==1}catch{return!0}};var T1=sI,zA=x1,FA=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",BA=Object.prototype.toString,VA=Array.prototype.concat,lw=C1,UA=function(t){return typeof t=="function"&&BA.call(t)==="[object Function]"},aI=T1(),jA=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!UA(r)||!r())return}aI?lw(t,e,n,!0):lw(t,e,n)},lI=function(t,e){var n=arguments.length>2?arguments[2]:{},r=zA(e);FA&&(r=VA.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||WA(n)!==n)throw new hw("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&cw){var c=cw(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(s=!1)}return(i||s||!r)&&(qA?uw(e,"length",n,!0,!0):uw(e,"length",n)),e};(function(t){var e=S1,n=Dl,r=HA,i=uc,s=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,s),d=E1(),v=n("%Math.max%");t.exports=function(C){if(typeof C!="function")throw new i("a function is required");var M=l(e,c,arguments);return r(M,1+v(0,C.length-(arguments.length-1)),!0)};var S=function(){return l(e,s,arguments)};d?d(t.exports,"apply",{value:S}):t.exports.apply=S})(uI);var lp=uI.exports,cI=Dl,hI=lp,ZA=hI(cI("String.prototype.indexOf")),Ta=function(e,n){var r=cI(e,!!n);return typeof r=="function"&&ZA(e,".prototype.")>-1?hI(r):r},XA=x1,fI=ny(),pI=Ta,fw=Object,$A=pI("Array.prototype.push"),pw=pI("Object.prototype.propertyIsEnumerable"),YA=fI?Object.getOwnPropertySymbols:null,dI=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=fw(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||hk)&&(ck?dw(e,"name",n,!0,!0):dw(e,"name",n)),e},dk=pk,mk=uc,gk=Object,yI=dk(function(){if(this==null||this!==gk(this))throw new mk("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),_k=yI,yk=uh.supportsDescriptors,vk=Object.getOwnPropertyDescriptor,vI=function(){if(yk&&/a/mig.flags==="gim"){var e=vk(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return _k},bk=uh.supportsDescriptors,xk=vI,wk=Object.getOwnPropertyDescriptor,Sk=Object.defineProperty,Ek=TypeError,mw=Object.getPrototypeOf,Ik=/a/,Ck=function(){if(!bk||!mw)throw new Ek("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=xk(),n=mw(Ik),r=wk(n,"flags");return(!r||r.get!==e)&&Sk(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},Tk=uh,Lk=lp,Pk=yI,bI=vI,Mk=Ck,xI=Lk(bI());Tk(xI,{getPolyfill:bI,implementation:Pk,shim:Mk});var Ak=xI,t_={exports:{}},kk=ny,ch=function(){return kk()&&!!Symbol.toStringTag},Dk=ch(),Rk=Ta,yv=Rk("Object.prototype.toString"),ry=function(e){return Dk&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:yv(e)==="[object Arguments]"},wI=function(e){return ry(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&yv(e)!=="[object Array]"&&yv(e.callee)==="[object Function]"},Nk=function(){return ry(arguments)}();ry.isLegacyArguments=wI;var SI=Nk?ry:wI;const Ok={},zk=Object.freeze(Object.defineProperty({__proto__:null,default:Ok},Symbol.toStringTag,{value:"Module"})),Fk=Q_(zk);var L1=typeof Map=="function"&&Map.prototype,G0=Object.getOwnPropertyDescriptor&&L1?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,y_=L1&&G0&&typeof G0.get=="function"?G0.get:null,gw=L1&&Map.prototype.forEach,P1=typeof Set=="function"&&Set.prototype,q0=Object.getOwnPropertyDescriptor&&P1?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,v_=P1&&q0&&typeof q0.get=="function"?q0.get:null,_w=P1&&Set.prototype.forEach,Bk=typeof WeakMap=="function"&&WeakMap.prototype,Gd=Bk?WeakMap.prototype.has:null,Vk=typeof WeakSet=="function"&&WeakSet.prototype,qd=Vk?WeakSet.prototype.has:null,Uk=typeof WeakRef=="function"&&WeakRef.prototype,yw=Uk?WeakRef.prototype.deref:null,jk=Boolean.prototype.valueOf,Gk=Object.prototype.toString,qk=Function.prototype.toString,Wk=String.prototype.match,M1=String.prototype.slice,Xu=String.prototype.replace,Hk=String.prototype.toUpperCase,vw=String.prototype.toLowerCase,EI=RegExp.prototype.test,bw=Array.prototype.concat,bl=Array.prototype.join,Zk=Array.prototype.slice,xw=Math.floor,vv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,W0=Object.getOwnPropertySymbols,bv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Df=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Fo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Df||"symbol")?Symbol.toStringTag:null,II=Object.prototype.propertyIsEnumerable,ww=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Sw(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||EI.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-xw(-t):xw(t);if(r!==t){var i=String(r),s=M1.call(e,i.length+1);return Xu.call(i,n,"$&_")+"."+Xu.call(Xu.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xu.call(e,n,"$&_")}var xv=Fk,Ew=xv.custom,Iw=TI(Ew)?Ew:null,Xk=function t(e,n,r,i){var s=n||{};if(Wu(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Wu(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=Wu(s,"customInspect")?s.customInspect:!0;if(typeof c!="boolean"&&c!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Wu(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Wu(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return PI(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var d=String(e);return l?Sw(e,d):d}if(typeof e=="bigint"){var v=String(e)+"n";return l?Sw(e,v):v}var S=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof e=="object")return wv(e)?"[Array]":"[Object]";var E=f3(s,r);if(typeof i>"u")i=[];else if(LI(i,e)>=0)return"[Circular]";function C(qe,Pe,it){if(Pe&&(i=Zk.call(i),i.push(Pe)),it){var ft={depth:s.depth};return Wu(s,"quoteStyle")&&(ft.quoteStyle=s.quoteStyle),t(qe,ft,r+1,i)}return t(qe,s,r+1,i)}if(typeof e=="function"&&!Cw(e)){var M=r3(e),k=zg(e,C);return"[Function"+(M?": "+M:" (anonymous)")+"]"+(k.length>0?" { "+bl.call(k,", ")+" }":"")}if(TI(e)){var R=Df?Xu.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):bv.call(e);return typeof e=="object"&&!Df?vd(R):R}if(u3(e)){for(var N="<"+vw.call(String(e.nodeName)),B=e.attributes||[],F=0;F",N}if(wv(e)){if(e.length===0)return"[]";var G=zg(e,C);return E&&!h3(G)?"["+Sv(G,E)+"]":"[ "+bl.call(G,", ")+" ]"}if(Kk(e)){var H=zg(e,C);return!("cause"in Error.prototype)&&"cause"in e&&!II.call(e,"cause")?"{ ["+String(e)+"] "+bl.call(bw.call("[cause]: "+C(e.cause),H),", ")+" }":H.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+bl.call(H,", ")+" }"}if(typeof e=="object"&&c){if(Iw&&typeof e[Iw]=="function"&&xv)return xv(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(i3(e)){var K=[];return gw&&gw.call(e,function(qe,Pe){K.push(C(Pe,e,!0)+" => "+C(qe,e))}),Tw("Map",y_.call(e),K,E)}if(a3(e)){var _e=[];return _w&&_w.call(e,function(qe){_e.push(C(qe,e))}),Tw("Set",v_.call(e),_e,E)}if(o3(e))return H0("WeakMap");if(l3(e))return H0("WeakSet");if(s3(e))return H0("WeakRef");if(Qk(e))return vd(C(Number(e)));if(t3(e))return vd(C(vv.call(e)));if(e3(e))return vd(jk.call(e));if(Jk(e))return vd(C(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===_m)return"{ [object globalThis] }";if(!Yk(e)&&!Cw(e)){var ae=zg(e,C),le=ww?ww(e)===Object.prototype:e instanceof Object||e.constructor===Object,ve=e instanceof Object?"":"null prototype",ke=!le&&Fo&&Object(e)===e&&Fo in e?M1.call(cc(e),8,-1):ve?"Object":"",Q=le||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",oe=Q+(ke||ve?"["+bl.call(bw.call([],ke||[],ve||[]),": ")+"] ":"");return ae.length===0?oe+"{}":E?oe+"{"+Sv(ae,E)+"}":oe+"{ "+bl.call(ae,", ")+" }"}return String(e)};function CI(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function $k(t){return Xu.call(String(t),/"/g,""")}function wv(t){return cc(t)==="[object Array]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Yk(t){return cc(t)==="[object Date]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Cw(t){return cc(t)==="[object RegExp]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Kk(t){return cc(t)==="[object Error]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Jk(t){return cc(t)==="[object String]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Qk(t){return cc(t)==="[object Number]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function e3(t){return cc(t)==="[object Boolean]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function TI(t){if(Df)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!bv)return!1;try{return bv.call(t),!0}catch{}return!1}function t3(t){if(!t||typeof t!="object"||!vv)return!1;try{return vv.call(t),!0}catch{}return!1}var n3=Object.prototype.hasOwnProperty||function(t){return t in this};function Wu(t,e){return n3.call(t,e)}function cc(t){return Gk.call(t)}function r3(t){if(t.name)return t.name;var e=Wk.call(qk.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function LI(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return PI(M1.call(t,0,e.maxStringLength),e)+r}var i=Xu.call(Xu.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,c3);return CI(i,"single",e)}function c3(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+Hk.call(e.toString(16))}function vd(t){return"Object("+t+")"}function H0(t){return t+" { ? }"}function Tw(t,e,n,r){var i=r?Sv(n,r):bl.call(n,", ");return t+" ("+e+") {"+i+"}"}function h3(t){for(var e=0;e({u_depth:new l.aG(Ze,Ke.u_depth),u_terrain:new l.aG(Ze,Ke.u_terrain),u_terrain_dim:new l.aH(Ze,Ke.u_terrain_dim),u_terrain_matrix:new l.aI(Ze,Ke.u_terrain_matrix),u_terrain_unpack:new l.aJ(Ze,Ke.u_terrain_unpack),u_terrain_exaggeration:new l.aH(Ze,Ke.u_terrain_exaggeration)}))(a,Ge),this.binderUniforms=m?m.getUniforms(a,Ge):[]}draw(a,f,m,g,b,T,L,A,N,V,j,Y,he,ce,ge,re,Ie,je){const xe=a.gl;if(this.failedToCreate)return;if(a.program.set(this.program),a.setDepthMode(m),a.setStencilMode(g),a.setColorMode(b),a.setCullFace(T),A){a.activeTexture.set(xe.TEXTURE2),xe.bindTexture(xe.TEXTURE_2D,A.depthTexture),a.activeTexture.set(xe.TEXTURE3),xe.bindTexture(xe.TEXTURE_2D,A.texture);for(const Ge in this.terrainUniforms)this.terrainUniforms[Ge].set(A[Ge])}for(const Ge in this.fixedUniforms)this.fixedUniforms[Ge].set(L[Ge]);ge&&ge.setUniforms(a,this.binderUniforms,he,{zoom:ce});let De=0;switch(f){case xe.LINES:De=2;break;case xe.TRIANGLES:De=3;break;case xe.LINE_STRIP:De=1}for(const Ge of Y.get()){const Ze=Ge.vaos||(Ge.vaos={});(Ze[N]||(Ze[N]=new vh)).bind(a,this,V,ge?ge.getPaintVertexBuffers():[],j,Ge.vertexOffset,re,Ie,je),xe.drawElements(f,Ge.primitiveLength*De,xe.UNSIGNED_SHORT,Ge.primitiveOffset*De*2)}}}function bh(y,a,f){const m=1/nn(f,1,a.transform.tileZoom),g=Math.pow(2,f.tileID.overscaledZ),b=f.tileSize*Math.pow(2,a.transform.tileZoom)/g,T=b*(f.tileID.canonical.x+f.tileID.wrap*g),L=b*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[m,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[T>>16,L>>16],u_pixel_coord_lower:[65535&T,65535&L]}}const bc=(y,a,f,m)=>{const g=a.style.light,b=g.properties.get("position"),T=[b.x,b.y,b.z],L=function(){var N=new l.A(9);return l.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,V){var j=Math.sin(V),Y=Math.cos(V);N[0]=Y,N[1]=j,N[2]=0,N[3]=-j,N[4]=Y,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(L,-a.transform.angle),function(N,V,j){var Y=V[0],he=V[1],ce=V[2];N[0]=Y*j[0]+he*j[3]+ce*j[6],N[1]=Y*j[1]+he*j[4]+ce*j[7],N[2]=Y*j[2]+he*j[5]+ce*j[8]}(T,T,L);const A=g.properties.get("color");return{u_matrix:y,u_lightpos:T,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[A.r,A.g,A.b],u_vertical_gradient:+f,u_opacity:m}},Ly=(y,a,f,m,g,b,T)=>l.e(bc(y,a,f,m),bh(b,a,T),{u_height_factor:-Math.pow(2,g.overscaledZ)/T.tileSize/8}),Am=y=>({u_matrix:y}),xh=(y,a,f,m)=>l.e(Am(y),bh(f,a,m)),Py=(y,a)=>({u_matrix:y,u_world:a}),km=(y,a,f,m,g)=>l.e(xh(y,a,f,m),{u_world:g}),My=(y,a,f,m)=>{const g=y.transform;let b,T;if(m.paint.get("circle-pitch-alignment")==="map"){const L=nn(f,1,g.zoom);b=!0,T=[L,L]}else b=!1,T=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(a.posMatrix,f,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:T}},Dm=(y,a,f)=>{const m=nn(f,1,a.zoom),g=Math.pow(2,a.zoom-f.tileID.overscaledZ),b=f.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:a.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[a.pixelsToGLUnits[0]/(m*g),a.pixelsToGLUnits[1]/(m*g)],u_overscale_factor:b}},Rm=(y,a,f=1)=>({u_matrix:y,u_color:a,u_overlay:0,u_overlay_scale:f}),wh=y=>({u_matrix:y}),Nm=(y,a,f,m)=>({u_matrix:y,u_extrude_scale:nn(a,1,f),u_intensity:m});function Om(y,a){const f=Math.pow(2,a.canonical.z),m=a.canonical.y;return[new l.Y(0,m/f).toLngLat().lat,new l.Y(0,(m+1)/f).toLngLat().lat]}const Sh=(y,a,f,m)=>{const g=y.transform;return{u_matrix:xc(y,a,f,m),u_ratio:1/nn(a,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},zm=(y,a,f,m,g)=>l.e(Sh(y,a,f,g),{u_image:0,u_image_height:m}),Bl=(y,a,f,m,g)=>{const b=y.transform,T=Ho(a,b);return{u_matrix:xc(y,a,f,g),u_texsize:a.imageAtlasTexture.size,u_ratio:1/nn(a,1,b.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[T,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Eh=(y,a,f,m,g,b)=>{const T=y.lineAtlas,L=Ho(a,y.transform),A=f.layout.get("line-cap")==="round",N=T.getDash(m.from,A),V=T.getDash(m.to,A),j=N.width*g.fromScale,Y=V.width*g.toScale;return l.e(Sh(y,a,f,b),{u_patternscale_a:[L/j,-N.height/2],u_patternscale_b:[L/Y,-V.height/2],u_sdfgamma:T.width/(256*Math.min(j,Y)*y.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:g.t})};function Ho(y,a){return 1/nn(y,1,a.tileZoom)}function xc(y,a,f,m){return y.translatePosMatrix(m?m.posMatrix:a.tileID.posMatrix,a,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const Ih=(y,a,f,m,g)=>{return{u_matrix:y,u_tl_parent:a,u_scale_parent:f,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.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:(T=g.paint.get("raster-saturation"),T>0?1-1/(1.001-T):-T),u_contrast_factor:(b=g.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:wc(g.paint.get("raster-hue-rotate"))};var b,T};function wc(y){y*=Math.PI/180;const a=Math.sin(y),f=Math.cos(y);return[(2*f+1)/3,(-Math.sqrt(3)*a-f+1)/3,(Math.sqrt(3)*a-f+1)/3]}const Sc=(y,a,f,m,g,b,T,L,A,N)=>{const V=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:V.width/V.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:T,u_coord_matrix:L,u_is_text:+A,u_pitch_with_map:+m,u_texsize:N,u_texture:0}},Ec=(y,a,f,m,g,b,T,L,A,N,V)=>{const j=g.transform;return l.e(Sc(y,a,f,m,g,b,T,L,A,N),{u_gamma_scale:m?Math.cos(j._pitch)*j.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+V})},Ic=(y,a,f,m,g,b,T,L,A,N)=>l.e(Ec(y,a,f,m,g,b,T,L,!0,A,!0),{u_texsize_icon:N,u_texture_icon:1}),Ay=(y,a,f)=>({u_matrix:y,u_opacity:a,u_color:f}),ky=(y,a,f,m,g,b)=>l.e(function(T,L,A,N){const V=A.imageManager.getPattern(T.from.toString()),j=A.imageManager.getPattern(T.to.toString()),{width:Y,height:he}=A.imageManager.getPixelSize(),ce=Math.pow(2,N.tileID.overscaledZ),ge=N.tileSize*Math.pow(2,A.transform.tileZoom)/ce,re=ge*(N.tileID.canonical.x+N.tileID.wrap*ce),Ie=ge*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:j.tl,u_pattern_br_b:j.br,u_texsize:[Y,he],u_mix:L.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:j.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/nn(N,1,A.transform.tileZoom),u_pixel_coord_upper:[re>>16,Ie>>16],u_pixel_coord_lower:[65535&re,65535&Ie]}}(m,b,f,g),{u_matrix:y,u_opacity:a}),Fm={fillExtrusion:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_lightpos:new l.aK(y,a.u_lightpos),u_lightintensity:new l.aH(y,a.u_lightintensity),u_lightcolor:new l.aK(y,a.u_lightcolor),u_vertical_gradient:new l.aH(y,a.u_vertical_gradient),u_opacity:new l.aH(y,a.u_opacity)}),fillExtrusionPattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_lightpos:new l.aK(y,a.u_lightpos),u_lightintensity:new l.aH(y,a.u_lightintensity),u_lightcolor:new l.aK(y,a.u_lightcolor),u_vertical_gradient:new l.aH(y,a.u_vertical_gradient),u_height_factor:new l.aH(y,a.u_height_factor),u_image:new l.aG(y,a.u_image),u_texsize:new l.aL(y,a.u_texsize),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade),u_opacity:new l.aH(y,a.u_opacity)}),fill:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix)}),fillPattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_image:new l.aG(y,a.u_image),u_texsize:new l.aL(y,a.u_texsize),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade)}),fillOutline:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_world:new l.aL(y,a.u_world)}),fillOutlinePattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_world:new l.aL(y,a.u_world),u_image:new l.aG(y,a.u_image),u_texsize:new l.aL(y,a.u_texsize),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade)}),circle:(y,a)=>({u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_scale_with_map:new l.aG(y,a.u_scale_with_map),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_extrude_scale:new l.aL(y,a.u_extrude_scale),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_matrix:new l.aI(y,a.u_matrix)}),collisionBox:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(y,a.u_pixels_to_tile_units),u_extrude_scale:new l.aL(y,a.u_extrude_scale),u_overscale_factor:new l.aH(y,a.u_overscale_factor)}),collisionCircle:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_inv_matrix:new l.aI(y,a.u_inv_matrix),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_viewport_size:new l.aL(y,a.u_viewport_size)}),debug:(y,a)=>({u_color:new l.aM(y,a.u_color),u_matrix:new l.aI(y,a.u_matrix),u_overlay:new l.aG(y,a.u_overlay),u_overlay_scale:new l.aH(y,a.u_overlay_scale)}),clippingMask:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix)}),heatmap:(y,a)=>({u_extrude_scale:new l.aH(y,a.u_extrude_scale),u_intensity:new l.aH(y,a.u_intensity),u_matrix:new l.aI(y,a.u_matrix)}),heatmapTexture:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_world:new l.aL(y,a.u_world),u_image:new l.aG(y,a.u_image),u_color_ramp:new l.aG(y,a.u_color_ramp),u_opacity:new l.aH(y,a.u_opacity)}),hillshade:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_image:new l.aG(y,a.u_image),u_latrange:new l.aL(y,a.u_latrange),u_light:new l.aL(y,a.u_light),u_shadow:new l.aM(y,a.u_shadow),u_highlight:new l.aM(y,a.u_highlight),u_accent:new l.aM(y,a.u_accent)}),hillshadePrepare:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_image:new l.aG(y,a.u_image),u_dimension:new l.aL(y,a.u_dimension),u_zoom:new l.aH(y,a.u_zoom),u_unpack:new l.aJ(y,a.u_unpack)}),line:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels)}),lineGradient:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels),u_image:new l.aG(y,a.u_image),u_image_height:new l.aH(y,a.u_image_height)}),linePattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_texsize:new l.aL(y,a.u_texsize),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_image:new l.aG(y,a.u_image),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels),u_scale:new l.aK(y,a.u_scale),u_fade:new l.aH(y,a.u_fade)}),lineSDF:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ratio:new l.aH(y,a.u_ratio),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,a.u_units_to_pixels),u_patternscale_a:new l.aL(y,a.u_patternscale_a),u_patternscale_b:new l.aL(y,a.u_patternscale_b),u_sdfgamma:new l.aH(y,a.u_sdfgamma),u_image:new l.aG(y,a.u_image),u_tex_y_a:new l.aH(y,a.u_tex_y_a),u_tex_y_b:new l.aH(y,a.u_tex_y_b),u_mix:new l.aH(y,a.u_mix)}),raster:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_tl_parent:new l.aL(y,a.u_tl_parent),u_scale_parent:new l.aH(y,a.u_scale_parent),u_buffer_scale:new l.aH(y,a.u_buffer_scale),u_fade_t:new l.aH(y,a.u_fade_t),u_opacity:new l.aH(y,a.u_opacity),u_image0:new l.aG(y,a.u_image0),u_image1:new l.aG(y,a.u_image1),u_brightness_low:new l.aH(y,a.u_brightness_low),u_brightness_high:new l.aH(y,a.u_brightness_high),u_saturation_factor:new l.aH(y,a.u_saturation_factor),u_contrast_factor:new l.aH(y,a.u_contrast_factor),u_spin_weights:new l.aK(y,a.u_spin_weights)}),symbolIcon:(y,a)=>({u_is_size_zoom_constant:new l.aG(y,a.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,a.u_is_size_feature_constant),u_size_t:new l.aH(y,a.u_size_t),u_size:new l.aH(y,a.u_size),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pitch:new l.aH(y,a.u_pitch),u_rotate_symbol:new l.aG(y,a.u_rotate_symbol),u_aspect_ratio:new l.aH(y,a.u_aspect_ratio),u_fade_change:new l.aH(y,a.u_fade_change),u_matrix:new l.aI(y,a.u_matrix),u_label_plane_matrix:new l.aI(y,a.u_label_plane_matrix),u_coord_matrix:new l.aI(y,a.u_coord_matrix),u_is_text:new l.aG(y,a.u_is_text),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_texsize:new l.aL(y,a.u_texsize),u_texture:new l.aG(y,a.u_texture)}),symbolSDF:(y,a)=>({u_is_size_zoom_constant:new l.aG(y,a.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,a.u_is_size_feature_constant),u_size_t:new l.aH(y,a.u_size_t),u_size:new l.aH(y,a.u_size),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pitch:new l.aH(y,a.u_pitch),u_rotate_symbol:new l.aG(y,a.u_rotate_symbol),u_aspect_ratio:new l.aH(y,a.u_aspect_ratio),u_fade_change:new l.aH(y,a.u_fade_change),u_matrix:new l.aI(y,a.u_matrix),u_label_plane_matrix:new l.aI(y,a.u_label_plane_matrix),u_coord_matrix:new l.aI(y,a.u_coord_matrix),u_is_text:new l.aG(y,a.u_is_text),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_texsize:new l.aL(y,a.u_texsize),u_texture:new l.aG(y,a.u_texture),u_gamma_scale:new l.aH(y,a.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_is_halo:new l.aG(y,a.u_is_halo)}),symbolTextAndIcon:(y,a)=>({u_is_size_zoom_constant:new l.aG(y,a.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,a.u_is_size_feature_constant),u_size_t:new l.aH(y,a.u_size_t),u_size:new l.aH(y,a.u_size),u_camera_to_center_distance:new l.aH(y,a.u_camera_to_center_distance),u_pitch:new l.aH(y,a.u_pitch),u_rotate_symbol:new l.aG(y,a.u_rotate_symbol),u_aspect_ratio:new l.aH(y,a.u_aspect_ratio),u_fade_change:new l.aH(y,a.u_fade_change),u_matrix:new l.aI(y,a.u_matrix),u_label_plane_matrix:new l.aI(y,a.u_label_plane_matrix),u_coord_matrix:new l.aI(y,a.u_coord_matrix),u_is_text:new l.aG(y,a.u_is_text),u_pitch_with_map:new l.aG(y,a.u_pitch_with_map),u_texsize:new l.aL(y,a.u_texsize),u_texsize_icon:new l.aL(y,a.u_texsize_icon),u_texture:new l.aG(y,a.u_texture),u_texture_icon:new l.aG(y,a.u_texture_icon),u_gamma_scale:new l.aH(y,a.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,a.u_device_pixel_ratio),u_is_halo:new l.aG(y,a.u_is_halo)}),background:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_opacity:new l.aH(y,a.u_opacity),u_color:new l.aM(y,a.u_color)}),backgroundPattern:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_opacity:new l.aH(y,a.u_opacity),u_image:new l.aG(y,a.u_image),u_pattern_tl_a:new l.aL(y,a.u_pattern_tl_a),u_pattern_br_a:new l.aL(y,a.u_pattern_br_a),u_pattern_tl_b:new l.aL(y,a.u_pattern_tl_b),u_pattern_br_b:new l.aL(y,a.u_pattern_br_b),u_texsize:new l.aL(y,a.u_texsize),u_mix:new l.aH(y,a.u_mix),u_pattern_size_a:new l.aL(y,a.u_pattern_size_a),u_pattern_size_b:new l.aL(y,a.u_pattern_size_b),u_scale_a:new l.aH(y,a.u_scale_a),u_scale_b:new l.aH(y,a.u_scale_b),u_pixel_coord_upper:new l.aL(y,a.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,a.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(y,a.u_tile_units_to_pixels)}),terrain:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_texture:new l.aG(y,a.u_texture),u_ele_delta:new l.aH(y,a.u_ele_delta)}),terrainDepth:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_ele_delta:new l.aH(y,a.u_ele_delta)}),terrainCoords:(y,a)=>({u_matrix:new l.aI(y,a.u_matrix),u_texture:new l.aG(y,a.u_texture),u_terrain_coords_id:new l.aH(y,a.u_terrain_coords_id),u_ele_delta:new l.aH(y,a.u_ele_delta)})};class Dy{constructor(a,f,m){this.context=a;const g=a.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Vl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ch{constructor(a,f,m,g){this.length=f.length,this.attributes=m,this.itemSize=f.bytesPerElement,this.dynamicDraw=g,this.context=a;const b=a.gl;this.buffer=b.createBuffer(),a.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){if(a.length!==this.length)throw new Error(`Length of new data is ${a.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,a.arrayBuffer)}enableAttributes(a,f){for(let m=0;m0){const ct=l.F(),dt=Ke;l.aP(ct,Ze.placementInvProjMatrix,y.transform.glCoordMatrix),l.aP(ct,ct,Ze.placementViewportMatrix),V.push({circleArray:tt,circleOffset:Y,transform:dt,invTransform:ct,coord:De}),j+=tt.length/4,Y=j}rt&&N.draw(L,A.LINES,Ln.disabled,pr.disabled,y.colorModeForRenderPass(),sr.disabled,Dm(Ke,y.transform,Ge),y.style.map.terrain&&y.style.map.terrain.getTerrainData(De),f.id,rt.layoutVertexBuffer,rt.indexBuffer,rt.segments,null,y.transform.zoom,null,null,rt.collisionVertexBuffer)}if(!T||!V.length)return;const he=y.useProgram("collisionCircle"),ce=new l.aQ;ce.resize(4*j),ce._trim();let ge=0;for(const xe of V)for(let De=0;De=0&&(ce[re.associatedIconIndex]={shiftedAnchor:cn,angle:mt})}else Je(re.numGlyphs,Y)}if(N){he.clear();const ge=y.icon.placedSymbolArray;for(let re=0;rey.style.map.terrain.getElevation(rt,ds,mi):null,Mr=f.layout.get("text-rotation-alignment")==="map";Z(ct,rt.posMatrix,y,g,Xo,ra,re,N,Mr,di)}const ul=y.translatePosMatrix(rt.posMatrix,tt,b,T),ia=Ie||g&&Ze||Bc?Mp:Xo,pi=y.translatePosMatrix(ra,tt,b,T,!0),Pr=mt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Sr;Sr=mt?ct.iconsInText?Ic(Xt.kind,Qt,je,re,y,ul,ia,pi,vn,yi):Ec(Xt.kind,Qt,je,re,y,ul,ia,pi,g,vn,!0):Sc(Xt.kind,Qt,je,re,y,ul,ia,pi,g,vn);const ps={program:Pn,buffers:dt,uniformValues:Sr,atlasTexture:Br,atlasTextureIcon:Lr,atlasInterpolation:Yn,atlasInterpolationIcon:Zo,isSDF:mt,hasHalo:Pr};if(xe&&ct.canOverlap){De=!0;const di=dt.segments.get();for(const Mr of di)Ke.push({segments:new l.$([Mr]),sortKey:Mr.sortKey,state:ps,terrainData:mn})}else Ke.push({segments:dt.segments,sortKey:0,state:ps,terrainData:mn})}De&&Ke.sort((rt,tt)=>rt.sortKey-tt.sortKey);for(const rt of Ke){const tt=rt.state;if(Y.activeTexture.set(he.TEXTURE0),tt.atlasTexture.bind(tt.atlasInterpolation,he.CLAMP_TO_EDGE),tt.atlasTextureIcon&&(Y.activeTexture.set(he.TEXTURE1),tt.atlasTextureIcon&&tt.atlasTextureIcon.bind(tt.atlasInterpolationIcon,he.CLAMP_TO_EDGE)),tt.isSDF){const ct=tt.uniformValues;tt.hasHalo&&(ct.u_is_halo=1,Zm(tt.buffers,rt.segments,f,y,tt.program,Ge,V,j,ct,rt.terrainData)),ct.u_is_halo=0}Zm(tt.buffers,rt.segments,f,y,tt.program,Ge,V,j,tt.uniformValues,rt.terrainData)}}function Zm(y,a,f,m,g,b,T,L,A,N){const V=m.context;g.draw(V,V.gl.TRIANGLES,b,T,L,sr.disabled,A,N,f.id,y.layoutVertexBuffer,y.indexBuffer,a,f.paint,m.transform.zoom,y.programConfigurations.get(f.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function zh(y,a,f,m,g){if(!f||!m||!m.imageAtlas)return;const b=m.imageAtlas.patternPositions;let T=b[f.to.toString()],L=b[f.from.toString()];if(!T&&L&&(T=L),!L&&T&&(L=T),!T||!L){const A=g.getPaintProperty(a);T=b[A],L=b[A]}T&&L&&y.setConstantPatternPositions(T,L)}function Xm(y,a,f,m,g,b,T){const L=y.context.gl,A="fill-pattern",N=f.paint.get(A),V=N&&N.constantOr(1),j=f.getCrossfadeParameters();let Y,he,ce,ge,re;T?(he=V&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Y=L.LINES):(he=V?"fillPattern":"fill",Y=L.TRIANGLES);const Ie=N.constantOr(null);for(const je of m){const xe=a.getTile(je);if(V&&!xe.patternsLoaded())continue;const De=xe.getBucket(f);if(!De)continue;const Ge=De.programConfigurations.get(f.id),Ze=y.useProgram(he,Ge),Ke=y.style.map.terrain&&y.style.map.terrain.getTerrainData(je);V&&(y.context.activeTexture.set(L.TEXTURE0),xe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ge.updatePaintBuffers(j)),zh(Ge,A,Ie,xe,f);const rt=Ke?je:null,tt=y.translatePosMatrix(rt?rt.posMatrix:je.posMatrix,xe,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(T){ge=De.indexBuffer2,re=De.segments2;const ct=[L.drawingBufferWidth,L.drawingBufferHeight];ce=he==="fillOutlinePattern"&&V?km(tt,y,j,xe,ct):Py(tt,ct)}else ge=De.indexBuffer,re=De.segments,ce=V?xh(tt,y,j,xe):Am(tt);Ze.draw(y.context,Y,g,y.stencilModeForClipping(je),b,sr.disabled,ce,Ke,f.id,De.layoutVertexBuffer,ge,re,f.paint,y.transform.zoom,Ge)}}function Fh(y,a,f,m,g,b,T){const L=y.context,A=L.gl,N="fill-extrusion-pattern",V=f.paint.get(N),j=V.constantOr(1),Y=f.getCrossfadeParameters(),he=f.paint.get("fill-extrusion-opacity"),ce=V.constantOr(null);for(const ge of m){const re=a.getTile(ge),Ie=re.getBucket(f);if(!Ie)continue;const je=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ge),xe=Ie.programConfigurations.get(f.id),De=y.useProgram(j?"fillExtrusionPattern":"fillExtrusion",xe);j&&(y.context.activeTexture.set(A.TEXTURE0),re.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),xe.updatePaintBuffers(Y)),zh(xe,N,ce,re,f);const Ge=y.translatePosMatrix(ge.posMatrix,re,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ze=f.paint.get("fill-extrusion-vertical-gradient"),Ke=j?Ly(Ge,y,Ze,he,ge,Y,re):bc(Ge,y,Ze,he);De.draw(L,L.gl.TRIANGLES,g,b,T,sr.backCCW,Ke,je,f.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,f.paint,y.transform.zoom,xe,y.style.map.terrain&&Ie.centroidVertexBuffer)}}function Bh(y,a,f,m,g,b,T){const L=y.context,A=L.gl,N=f.fbo;if(!N)return;const V=y.useProgram("hillshade"),j=y.style.map.terrain&&y.style.map.terrain.getTerrainData(a);L.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,N.colorAttachment.get()),V.draw(L,A.TRIANGLES,g,b,T,sr.disabled,((Y,he,ce,ge)=>{const re=ce.paint.get("hillshade-shadow-color"),Ie=ce.paint.get("hillshade-highlight-color"),je=ce.paint.get("hillshade-accent-color");let xe=ce.paint.get("hillshade-illumination-direction")*(Math.PI/180);ce.paint.get("hillshade-illumination-anchor")==="viewport"&&(xe-=Y.transform.angle);const De=!Y.options.moving;return{u_matrix:ge?ge.posMatrix:Y.transform.calculatePosMatrix(he.tileID.toUnwrapped(),De),u_image:0,u_latrange:Om(0,he.tileID),u_light:[ce.paint.get("hillshade-exaggeration"),xe],u_shadow:re,u_highlight:Ie,u_accent:je}})(y,f,m,j?a:null),j,m.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Ap(y,a,f,m,g,b){const T=y.context,L=T.gl,A=a.dem;if(A&&A.data){const N=A.dim,V=A.stride,j=A.getPixels();if(T.activeTexture.set(L.TEXTURE1),T.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||y.getTileTexture(V),a.demTexture){const he=a.demTexture;he.update(j,{premultiply:!1}),he.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else a.demTexture=new Q(T,j,L.RGBA,{premultiply:!1}),a.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);T.activeTexture.set(L.TEXTURE0);let Y=a.fbo;if(!Y){const he=new Q(T,{width:N,height:N,data:null},L.RGBA);he.bind(L.LINEAR,L.CLAMP_TO_EDGE),Y=a.fbo=T.createFramebuffer(N,N,!0,!1),Y.colorAttachment.set(he.texture)}T.bindFramebuffer.set(Y.framebuffer),T.viewport.set([0,0,N,N]),y.useProgram("hillshadePrepare").draw(T,L.TRIANGLES,m,g,b,sr.disabled,((he,ce)=>{const ge=ce.stride,re=l.F();return l.aN(re,0,l.W,-l.W,0,0,1),l.H(re,re,[0,-l.W,0]),{u_matrix:re,u_image:1,u_dimension:[ge,ge],u_zoom:he.overscaledZ,u_unpack:ce.getUnpackVector()}})(a.tileID,A),null,f.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),a.needsHillshadePrepare=!1}}function $m(y,a,f,m,g,b){const T=m.paint.get("raster-fade-duration");if(!b&&T>0){const L=E.now(),A=(L-y.timeAdded)/T,N=a?(L-a.timeAdded)/T:-1,V=f.getSource(),j=g.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Y=!a||Math.abs(a.tileID.overscaledZ-j)>Math.abs(y.tileID.overscaledZ-j),he=Y&&y.refreshedUponExpiration?1:l.ac(Y?A:1-N,0,1);return y.refreshedUponExpiration&&A>=1&&(y.refreshedUponExpiration=!1),a?{opacity:1,mix:1-he}:{opacity:he,mix:0}}return{opacity:1,mix:0}}const Ym=new l.aO(1,0,0,1),Vh=new l.aO(0,1,0,1),kp=new l.aO(0,0,1,1),jy=new l.aO(1,0,1,1),Km=new l.aO(0,1,1,1);function zr(y,a,f,m){ho(y,0,a+f/2,y.transform.width,f,m)}function il(y,a,f,m){ho(y,a-f/2,0,f,y.transform.height,m)}function ho(y,a,f,m,g,b){const T=y.context,L=T.gl;L.enable(L.SCISSOR_TEST),L.scissor(a*y.pixelRatio,f*y.pixelRatio,m*y.pixelRatio,g*y.pixelRatio),T.clear({color:b}),L.disable(L.SCISSOR_TEST)}function Dp(y,a,f){const m=y.context,g=m.gl,b=f.posMatrix,T=y.useProgram("debug"),L=Ln.disabled,A=pr.disabled,N=y.colorModeForRenderPass(),V="$debug",j=y.style.map.terrain&&y.style.map.terrain.getTerrainData(f);m.activeTexture.set(g.TEXTURE0);const Y=a.getTileByID(f.key).latestRawTileData,he=Math.floor((Y&&Y.byteLength||0)/1024),ce=a.getTile(f).tileSize,ge=512/Math.min(ce,512)*(f.overscaledZ/y.transform.zoom)*.5;let re=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(re+=` => ${f.overscaledZ}`),function(Ie,je){Ie.initDebugOverlayCanvas();const xe=Ie.debugOverlayCanvas,De=Ie.context.gl,Ge=Ie.debugOverlayCanvas.getContext("2d");Ge.clearRect(0,0,xe.width,xe.height),Ge.shadowColor="white",Ge.shadowBlur=2,Ge.lineWidth=1.5,Ge.strokeStyle="white",Ge.textBaseline="top",Ge.font="bold 36px Open Sans, sans-serif",Ge.fillText(je,5,5),Ge.strokeText(je,5,5),Ie.debugOverlayTexture.update(xe),Ie.debugOverlayTexture.bind(De.LINEAR,De.CLAMP_TO_EDGE)}(y,`${re} ${he}kB`),T.draw(m,g.TRIANGLES,L,A,Qr.alphaBlended,sr.disabled,Rm(b,l.aO.transparent,ge),null,V,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),T.draw(m,g.LINE_STRIP,L,A,N,sr.disabled,Rm(b,l.aO.red),j,V,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Uh(y,a,f){const m=y.context,g=m.gl,b=y.colorModeForRenderPass(),T=new Ln(g.LEQUAL,Ln.ReadWrite,y.depthRangeFor3D),L=y.useProgram("terrain"),A=a.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,y.width,y.height]);for(const N of f){const V=y.renderToTexture.getTexture(N),j=a.getTerrainData(N.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,V.texture);const Y={u_matrix:y.transform.calculatePosMatrix(N.tileID.toUnwrapped()),u_texture:0,u_ele_delta:a.getMeshFrameDelta(y.transform.zoom)};L.draw(m,g.TRIANGLES,T,pr.disabled,b,sr.backCCW,Y,j,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}class Jm{constructor(a,f){this.context=new Uy(a),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ci.maxUnderzooming+ci.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new nl}resize(a,f,m){if(this.width=Math.floor(a*m),this.height=Math.floor(f*m),this.pixelRatio=m,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 a=this.context,f=new l.aV;f.emplaceBack(0,0),f.emplaceBack(l.W,0),f.emplaceBack(0,l.W),f.emplaceBack(l.W,l.W),this.tileExtentBuffer=a.createVertexBuffer(f,yh.members),this.tileExtentSegments=l.$.simpleSegment(0,0,4,2);const m=new l.aV;m.emplaceBack(0,0),m.emplaceBack(l.W,0),m.emplaceBack(0,l.W),m.emplaceBack(l.W,l.W),this.debugBuffer=a.createVertexBuffer(m,yh.members),this.debugSegments=l.$.simpleSegment(0,0,4,5);const g=new l.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(l.W,0,l.W,0),g.emplaceBack(0,l.W,0,l.W),g.emplaceBack(l.W,l.W,l.W,l.W),this.rasterBoundsBuffer=a.createVertexBuffer(g,_n.members),this.rasterBoundsSegments=l.$.simpleSegment(0,0,4,2);const b=new l.aV;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=a.createVertexBuffer(b,yh.members),this.viewportSegments=l.$.simpleSegment(0,0,4,2);const T=new l.aW;T.emplaceBack(0),T.emplaceBack(1),T.emplaceBack(3),T.emplaceBack(2),T.emplaceBack(0),this.tileBorderIndexBuffer=a.createIndexBuffer(T);const L=new l.aX;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=a.createIndexBuffer(L);const A=this.context.gl;this.stencilClearMode=new pr({func:A.ALWAYS,mask:0},0,255,A.ZERO,A.ZERO,A.ZERO)}clearStencil(){const a=this.context,f=a.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.F();l.aN(m,0,this.width,this.height,0,0,1),l.J(m,m,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(a,f.TRIANGLES,Ln.disabled,this.stencilClearMode,Qr.disabled,sr.disabled,wh(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(a,f){if(this.currentStencilSource===a.source||!a.isTileClipped()||!f||!f.length)return;this.currentStencilSource=a.source;const m=this.context,g=m.gl;this.nextStencilID+f.length>256&&this.clearStencil(),m.setColorMode(Qr.disabled),m.setDepthMode(Ln.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const T of f){const L=this._tileClippingMaskIDs[T.key]=this.nextStencilID++,A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T);b.draw(m,g.TRIANGLES,Ln.disabled,new pr({func:g.ALWAYS,mask:0},L,255,g.KEEP,g.KEEP,g.REPLACE),Qr.disabled,sr.disabled,wh(T.posMatrix),A,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const a=this.nextStencilID++,f=this.context.gl;return new pr({func:f.NOTEQUAL,mask:255},a,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(a){const f=this.context.gl;return new pr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[a.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(a){const f=this.context.gl,m=a.sort((T,L)=>L.overscaledZ-T.overscaledZ),g=m[m.length-1].overscaledZ,b=m[0].overscaledZ-g+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const T={};for(let L=0;L=0;this.currentLayer--){const A=this.style._layers[m[this.currentLayer]],N=g[A.source],V=b[A.source];this._renderTileClippingMasks(A,V),this.renderLayer(this,N,A,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerre.source&&!re.isHidden(V)?[N.sourceCaches[re.source]]:[]),he=Y.filter(re=>re.getSource().type==="vector"),ce=Y.filter(re=>re.getSource().type!=="vector"),ge=re=>{(!j||j.getSource().maxzoomge(re)),j||ce.forEach(re=>ge(re)),j}(this.style,this.transform.zoom);A&&function(N,V,j){for(let Y=0;Y0),g&&(l.a_(f,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(b,T){const L=b.context,A=L.gl,N=Qr.unblended,V=new Ln(A.LEQUAL,Ln.ReadWrite,[0,1]),j=T.getTerrainMesh(),Y=T.sourceCache.getRenderableTiles(),he=b.useProgram("terrainDepth");L.bindFramebuffer.set(T.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1});for(const ce of Y){const ge=T.getTerrainData(ce.tileID),re={u_matrix:b.transform.calculatePosMatrix(ce.tileID.toUnwrapped()),u_ele_delta:T.getMeshFrameDelta(b.transform.zoom)};he.draw(L,A.TRIANGLES,V,pr.disabled,N,sr.backCCW,re,ge,"terrain",j.vertexBuffer,j.indexBuffer,j.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain),function(b,T){const L=b.context,A=L.gl,N=Qr.unblended,V=new Ln(A.LEQUAL,Ln.ReadWrite,[0,1]),j=T.getTerrainMesh(),Y=T.getCoordsTexture(),he=T.sourceCache.getRenderableTiles(),ce=b.useProgram("terrainCoords");L.bindFramebuffer.set(T.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1}),T.coordsIndex=[];for(const ge of he){const re=T.getTerrainData(ge.tileID);L.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,Y.texture);const Ie={u_matrix:b.transform.calculatePosMatrix(ge.tileID.toUnwrapped()),u_terrain_coords_id:(255-T.coordsIndex.length)/255,u_texture:0,u_ele_delta:T.getMeshFrameDelta(b.transform.zoom)};ce.draw(L,A.TRIANGLES,V,pr.disabled,N,sr.backCCW,Ie,re,"terrain",j.vertexBuffer,j.indexBuffer,j.segments),T.coordsIndex.push(ge.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain))}renderLayer(a,f,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(b,T,L,A,N){if(b.renderPass!=="translucent")return;const V=pr.disabled,j=b.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Y,he,ce,ge,re,Ie,je){const xe=he.transform,De=re==="map",Ge=Ie==="map";for(const Ze of Y){const Ke=ge.getTile(Ze),rt=Ke.getBucket(ce);if(!rt||!rt.text||!rt.text.segments.get().length)continue;const tt=l.ag(rt.textSizeData,xe.zoom),ct=nn(Ke,1,he.transform.zoom),dt=sn(Ze.posMatrix,Ge,De,he.transform,ct),cn=ce.layout.get("icon-text-fit")!=="none"&&rt.hasIconData();if(tt){const mt=Math.pow(2,xe.zoom-Ke.tileID.overscaledZ);Rh(rt,De,Ge,je,xe,dt,Ze.posMatrix,mt,tt,cn,he.style.map.terrain?(Xt,hn)=>he.style.map.terrain.getElevation(Ze,Xt,hn):null)}}}(A,b,L,T,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),N),L.paint.get("icon-opacity").constantOr(1)!==0&&Oh(b,T,L,A,!1,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),L.layout.get("icon-rotation-alignment"),L.layout.get("icon-pitch-alignment"),L.layout.get("icon-keep-upright"),V,j),L.paint.get("text-opacity").constantOr(1)!==0&&Oh(b,T,L,A,!0,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.layout.get("text-keep-upright"),V,j),T.map.showCollisionBoxes&&(Dh(b,T,L,A,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),!0),Dh(b,T,L,A,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),!1))})(a,f,m,g,this.style.placement.variableOffsets);break;case"circle":(function(b,T,L,A){if(b.renderPass!=="translucent")return;const N=L.paint.get("circle-opacity"),V=L.paint.get("circle-stroke-width"),j=L.paint.get("circle-stroke-opacity"),Y=!L.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||j.constantOr(1)===0))return;const he=b.context,ce=he.gl,ge=b.depthModeForSublayer(0,Ln.ReadOnly),re=pr.disabled,Ie=b.colorModeForRenderPass(),je=[];for(let xe=0;xexe.sortKey-De.sortKey);for(const xe of je){const{programConfiguration:De,program:Ge,layoutVertexBuffer:Ze,indexBuffer:Ke,uniformValues:rt,terrainData:tt}=xe.state;Ge.draw(he,ce.TRIANGLES,ge,re,Ie,sr.disabled,rt,tt,L.id,Ze,Ke,xe.segments,L.paint,b.transform.zoom,De)}})(a,f,m,g);break;case"heatmap":(function(b,T,L,A){if(L.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const N=b.context,V=N.gl,j=pr.disabled,Y=new Qr([V.ONE,V.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(he,ce,ge){const re=he.gl;he.activeTexture.set(re.TEXTURE1),he.viewport.set([0,0,ce.width/4,ce.height/4]);let Ie=ge.heatmapFbo;if(Ie)re.bindTexture(re.TEXTURE_2D,Ie.colorAttachment.get()),he.bindFramebuffer.set(Ie.framebuffer);else{const je=re.createTexture();re.bindTexture(re.TEXTURE_2D,je),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_WRAP_S,re.CLAMP_TO_EDGE),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_WRAP_T,re.CLAMP_TO_EDGE),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_MIN_FILTER,re.LINEAR),re.texParameteri(re.TEXTURE_2D,re.TEXTURE_MAG_FILTER,re.LINEAR),Ie=ge.heatmapFbo=he.createFramebuffer(ce.width/4,ce.height/4,!1,!1),function(xe,De,Ge,Ze){var Ke,rt;const tt=xe.gl,ct=(Ke=xe.HALF_FLOAT)!==null&&Ke!==void 0?Ke:tt.UNSIGNED_BYTE,dt=(rt=xe.RGBA16F)!==null&&rt!==void 0?rt:tt.RGBA;tt.texImage2D(tt.TEXTURE_2D,0,dt,De.width/4,De.height/4,0,tt.RGBA,ct,null),Ze.colorAttachment.set(Ge)}(he,ce,je,Ie)}})(N,b,L),N.clear({color:l.aO.transparent});for(let he=0;he{const xe=l.F();l.aN(xe,0,ge.width,ge.height,0,0,1);const De=ge.context.gl;return{u_matrix:xe,u_world:[De.drawingBufferWidth,De.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:re.paint.get("heatmap-opacity")}})(N,V),null,V.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments,V.paint,N.transform.zoom)}(b,L))})(a,f,m,g);break;case"line":(function(b,T,L,A){if(b.renderPass!=="translucent")return;const N=L.paint.get("line-opacity"),V=L.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const j=b.depthModeForSublayer(0,Ln.ReadOnly),Y=b.colorModeForRenderPass(),he=L.paint.get("line-dasharray"),ce=L.paint.get("line-pattern"),ge=ce.constantOr(1),re=L.paint.get("line-gradient"),Ie=L.getCrossfadeParameters(),je=ge?"linePattern":he?"lineSDF":re?"lineGradient":"line",xe=b.context,De=xe.gl;let Ge=!0;for(const Ze of A){const Ke=T.getTile(Ze);if(ge&&!Ke.patternsLoaded())continue;const rt=Ke.getBucket(L);if(!rt)continue;const tt=rt.programConfigurations.get(L.id),ct=b.context.program.get(),dt=b.useProgram(je,tt),cn=Ge||dt.program!==ct,mt=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Ze),Xt=ce.constantOr(null);if(Xt&&Ke.imageAtlas){const Qt=Ke.imageAtlas,mn=Qt.patternPositions[Xt.to.toString()],vn=Qt.patternPositions[Xt.from.toString()];mn&&vn&&tt.setConstantPatternPositions(mn,vn)}const hn=mt?Ze:null,Pn=ge?Bl(b,Ke,L,Ie,hn):he?Eh(b,Ke,L,he,Ie,hn):re?zm(b,Ke,L,rt.lineClipsArray.length,hn):Sh(b,Ke,L,hn);if(ge)xe.activeTexture.set(De.TEXTURE0),Ke.imageAtlasTexture.bind(De.LINEAR,De.CLAMP_TO_EDGE),tt.updatePaintBuffers(Ie);else if(he&&(cn||b.lineAtlas.dirty))xe.activeTexture.set(De.TEXTURE0),b.lineAtlas.bind(xe);else if(re){const Qt=rt.gradients[L.id];let mn=Qt.texture;if(L.gradientVersion!==Qt.version){let vn=256;if(L.stepInterpolant){const Br=T.getSource().maxzoom,Yn=Ze.canonical.z===Br?Math.ceil(1<0?f.pop():null}isPatternMissing(a){if(!a)return!1;if(!a.from||!a.to)return!0;const f=this.imageManager.getPattern(a.from.toString()),m=this.imageManager.getPattern(a.to.toString());return!f||!m}useProgram(a,f){this.cache=this.cache||{};const m=a+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new rl(this.context,vc[a],f,Fm[a],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}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 a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Q(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:a,drawingBufferHeight:f}=this.context.gl;return this.width!==a||this.height!==f}}class ol{constructor(a,f){this.points=a,this.planes=f}static fromInvProjectionMatrix(a,f,m){const g=Math.pow(2,m),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(L=>{const A=1/(L=l.af([],L,a))[3]/f*g;return l.a$(L,L,[A,A,1/L[3],A])}),T=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const A=function(Y,he){var ce=he[0],ge=he[1],re=he[2],Ie=ce*ce+ge*ge+re*re;return Ie>0&&(Ie=1/Math.sqrt(Ie)),Y[0]=he[0]*Ie,Y[1]=he[1]*Ie,Y[2]=he[2]*Ie,Y}([],function(Y,he,ce){var ge=he[0],re=he[1],Ie=he[2],je=ce[0],xe=ce[1],De=ce[2];return Y[0]=re*De-Ie*xe,Y[1]=Ie*je-ge*De,Y[2]=ge*xe-re*je,Y}([],le([],b[L[0]],b[L[1]]),le([],b[L[2]],b[L[1]]))),N=-((V=A)[0]*(j=b[L[1]])[0]+V[1]*j[1]+V[2]*j[2]);var V,j;return A.concat(N)});return new ol(b,T)}}class sl{constructor(a,f){this.min=a,this.max=f,this.center=function(m,g,b){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,b){return m[0]=g[0]+b[0],m[1]=g[1]+b[1],m[2]=g[2]+b[2],m}([],this.min,this.max))}quadrant(a){const f=[a%2==0,a<2],m=de(this.min),g=de(this.max);for(let b=0;b=0&&T++;if(T===0)return 0;T!==f.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let b=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(let L=0;Lthis.max[g]-this.min[g])return 0}return 1}}class Pu{constructor(a=0,f=0,m=0,g=0){if(isNaN(a)||a<0||isNaN(f)||f<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=f,this.left=m,this.right=g}interpolate(a,f,m){return f.top!=null&&a.top!=null&&(this.top=l.z.number(a.top,f.top,m)),f.bottom!=null&&a.bottom!=null&&(this.bottom=l.z.number(a.bottom,f.bottom,m)),f.left!=null&&a.left!=null&&(this.left=l.z.number(a.left,f.left,m)),f.right!=null&&a.right!=null&&(this.right=l.z.number(a.right,f.right,m)),this}getCenter(a,f){const m=l.ac((this.left+a-this.right)/2,0,a),g=l.ac((this.top+f-this.bottom)/2,0,f);return new l.P(m,g)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new Pu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Rp=85.051129;class jh{constructor(a,f,m,g,b){this.tileSize=512,this._renderWorldCopies=b===void 0||!!b,this._minZoom=a||0,this._maxZoom=f||22,this._minPitch=m??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Pu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const a=new jh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.apply(this),a}apply(a){this.tileSize=a.tileSize,this.latRange=a.latRange,this.width=a.width,this.height=a.height,this._center=a._center,this._elevation=a._elevation,this.minElevationForCurrentTile=a.minElevationForCurrentTile,this.zoom=a.zoom,this.angle=a.angle,this._fov=a._fov,this._pitch=a._pitch,this._unmodified=a._unmodified,this._edgeInsets=a._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(a){a===void 0?a=!0:a===null&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(a){const f=-l.b1(a,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,b){var T=g[0],L=g[1],A=g[2],N=g[3],V=Math.sin(b),j=Math.cos(b);m[0]=T*j+A*V,m[1]=L*j+N*V,m[2]=T*-V+A*j,m[3]=L*-V+N*j}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(a){const f=l.ac(a,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(a){const f=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(a){a.lat===this._center.lat&&a.lng===this._center.lng||(this._unmodified=!1,this._center=a,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(a){a!==this._elevation&&(this._elevation=a,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(a){this._edgeInsets.equals(a)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,a,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(a){return this._edgeInsets.equals(a)}interpolatePadding(a,f,m){this._unmodified=!1,this._edgeInsets.interpolate(a,f,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(a){const f=(a.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/a.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(a){const f=[new l.b2(0,a)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),g=this.pointCoordinate(new l.P(this.width,0)),b=this.pointCoordinate(new l.P(this.width,this.height)),T=this.pointCoordinate(new l.P(0,this.height)),L=Math.floor(Math.min(m.x,g.x,b.x,T.x)),A=Math.floor(Math.max(m.x,g.x,b.x,T.x)),N=1;for(let V=L-N;V<=A+N;V++)V!==0&&f.push(new l.b2(V,a))}return f}coveringTiles(a){var f,m;let g=this.coveringZoomLevel(a);const b=g;if(a.minzoom!==void 0&&ga.maxzoom&&(g=a.maxzoom);const T=this.pointCoordinate(this.getCameraPoint()),L=l.Y.fromLngLat(this.center),A=Math.pow(2,g),N=[A*T.x,A*T.y,0],V=[A*L.x,A*L.y,0],j=ol.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let Y=a.minzoom||0;!a.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Y=g);const he=a.terrain?2/Math.min(this.tileSize,a.tileSize)*this.tileSize:3,ce=xe=>({aabb:new sl([xe*A,0,0],[(xe+1)*A,A,0]),zoom:0,x:0,y:0,wrap:xe,fullyVisible:!1}),ge=[],re=[],Ie=g,je=a.reparseOverscaled?b:g;if(this._renderWorldCopies)for(let xe=1;xe<=3;xe++)ge.push(ce(-xe)),ge.push(ce(xe));for(ge.push(ce(0));ge.length>0;){const xe=ge.pop(),De=xe.x,Ge=xe.y;let Ze=xe.fullyVisible;if(!Ze){const dt=xe.aabb.intersects(j);if(dt===0)continue;Ze=dt===2}const Ke=a.terrain?N:V,rt=xe.aabb.distanceX(Ke),tt=xe.aabb.distanceY(Ke),ct=Math.max(Math.abs(rt),Math.abs(tt));if(xe.zoom===Ie||ct>he+(1<=Y){const dt=Ie-xe.zoom,cn=N[0]-.5-(De<>1),Xt=xe.zoom+1;let hn=xe.aabb.quadrant(dt);if(a.terrain){const Pn=new l.Q(Xt,xe.wrap,Xt,cn,mt),Qt=a.terrain.getMinMaxElevation(Pn),mn=(f=Qt.minElevation)!==null&&f!==void 0?f:this.elevation,vn=(m=Qt.maxElevation)!==null&&m!==void 0?m:this.elevation;hn=new sl([hn.min[0],hn.min[1],mn],[hn.max[0],hn.max[1],vn])}ge.push({aabb:hn,zoom:Xt,x:cn,y:mt,wrap:xe.wrap,fullyVisible:Ze})}}return re.sort((xe,De)=>xe.distanceSq-De.distanceSq).map(xe=>xe.tileID)}resize(a,f){this.width=a,this.height=f,this.pixelsToGLUnits=[2/a,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(a){const f=l.ac(a.lat,-85.051129,Rp);return new l.P(l.N(a.lng)*this.worldSize,l.O(f)*this.worldSize)}unproject(a){return new l.Y(a.x/this.worldSize,a.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(a){const f=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,a),b=a.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-b))return;const T=m+f-b,L=Math.cos(this._pitch)*this.cameraToCenterDistance/T/l.b3(1,g.lat),A=this.scaleZoom(L/this.tileSize);this._elevation=b,this._center=g,this.zoom=A}setLocationAtPoint(a,f){const m=this.pointCoordinate(f),g=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(a),T=new l.Y(b.x-(m.x-g.x),b.y-(m.y-g.y));this.center=this.coordinateLocation(T),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(a,f){return f?this.coordinatePoint(this.locationCoordinate(a),f.getElevationForLngLatZoom(a,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(a))}pointLocation(a,f){return this.coordinateLocation(this.pointCoordinate(a,f))}locationCoordinate(a){return l.Y.fromLngLat(a)}coordinateLocation(a){return a&&a.toLngLat()}pointCoordinate(a,f){if(f){const Y=f.pointCoordinate(a);if(Y!=null)return Y}const m=[a.x,a.y,0,1],g=[a.x,a.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(g,g,this.pixelMatrixInverse);const b=m[3],T=g[3],L=m[1]/b,A=g[1]/T,N=m[2]/b,V=g[2]/T,j=N===V?0:(0-N)/(V-N);return new l.Y(l.z.number(m[0]/b,g[0]/T,j)/this.worldSize,l.z.number(L,A,j)/this.worldSize)}coordinatePoint(a,f=0,m=this.pixelMatrix){const g=[a.x*this.worldSize,a.y*this.worldSize,f,1];return l.af(g,g,m),new l.P(g[0]/g[3],g[1]/g[3])}getBounds(){const a=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new l.P(0,a))).extend(this.pointLocation(new l.P(this.width,a))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ce([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(a){a?(this.lngRange=[a.getWest(),a.getEast()],this.latRange=[a.getSouth(),a.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Rp])}calculatePosMatrix(a,f=!1){const m=a.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const b=a.canonical,T=this.worldSize/this.zoomScale(b.z),L=b.x+Math.pow(2,b.z)*a.wrap,A=l.an(new Float64Array(16));return l.H(A,A,[L*T,b.y*T,0]),l.J(A,A,[T/l.W,T/l.W,1]),l.K(A,f?this.alignedProjMatrix:this.projMatrix,A),g[m]=new Float32Array(A),g[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(a,f){f=l.ac(+f,this.minZoom,this.maxZoom);const m={center:new l.M(a.lng,a.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const xe=179.9999999999;g=[-xe,xe]}const b=this.tileSize*this.zoomScale(m.zoom);let T=0,L=b,A=0,N=b,V=0,j=0;const{x:Y,y:he}=this.size;if(this.latRange){const xe=this.latRange;T=l.O(xe[1])*b,L=l.O(xe[0])*b,L-TL&&(Ie=L-xe)}if(g){const xe=(A+N)/2;let De=ce;this._renderWorldCopies&&(De=l.b1(ce,xe-b/2,xe+b/2));const Ge=Y/2;De-GeN&&(re=N-Ge)}if(re!==void 0||Ie!==void 0){const xe=new l.P(re??ce,Ie??ge);m.center=this.unproject.call({worldSize:b},xe).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const a=this._unmodified,{center:f,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=m,this._unmodified=a,this._constraining=!1}_calcMatrices(){if(!this.height)return;const a=this.centerOffset,f=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b3(1,this.center.lat)*this.worldSize;let g=l.an(new Float64Array(16));l.J(g,g,[this.width/2,-this.height/2,1]),l.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=l.an(new Float64Array(16)),l.J(g,g,[1,-1,1]),l.H(g,g,[-1,-1,0]),l.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),T=Math.min(this.elevation,this.minElevationForCurrentTile),L=b-T*this._pixelPerMeter/Math.cos(this._pitch),A=T<0?L:b,N=Math.PI/2+this._pitch,V=this._fov*(.5+a.y/this.height),j=Math.sin(V)*A/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),Y=this.getHorizon(),he=2*Math.atan(Y/this.cameraToCenterDistance)*(.5+a.y/(2*Y)),ce=Math.sin(he)*A/Math.sin(l.ac(Math.PI-N-he,.01,Math.PI-.01)),ge=Math.min(j,ce),re=1.01*(Math.cos(Math.PI/2-this._pitch)*ge+A),Ie=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,Ie,re),g[8]=2*-a.x/this.width,g[9]=2*a.y/this.height,l.J(g,g,[1,-1,1]),l.H(g,g,[0,0,-this.cameraToCenterDistance]),l.b5(g,g,this._pitch),l.ad(g,g,this.angle),l.H(g,g,[-f,-m,0]),this.mercatorMatrix=l.J([],g,[this.worldSize,this.worldSize,this.worldSize]),l.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.K(new Float64Array(16),this.labelPlaneMatrix,g),l.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=l.ar([],g),this.pixelMatrix3D=l.K(new Float64Array(16),this.labelPlaneMatrix,g);const je=this.width%2/2,xe=this.height%2/2,De=Math.cos(this.angle),Ge=Math.sin(this.angle),Ze=f-Math.round(f)+De*je+Ge*xe,Ke=m-Math.round(m)+De*xe+Ge*je,rt=new Float64Array(g);if(l.H(rt,rt,[Ze>.5?Ze-1:Ze,Ke>.5?Ke-1:Ke,0]),this.alignedProjMatrix=rt,g=l.ar(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 a=this.pointCoordinate(new l.P(0,0)),f=[a.x*this.worldSize,a.y*this.worldSize,0,1];return l.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const a=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,a))}getCameraQueryGeometry(a){const f=this.getCameraPoint();if(a.length===1)return[a[0],f];{let m=f.x,g=f.y,b=f.x,T=f.y;for(const L of a)m=Math.min(m,L.x),g=Math.min(g,L.y),b=Math.max(b,L.x),T=Math.max(T,L.y);return[new l.P(m,g),new l.P(b,g),new l.P(b,T),new l.P(m,T),new l.P(m,g)]}}lngLatToCameraDepth(a,f){const m=this.locationCoordinate(a),g=[m.x*this.worldSize,m.y*this.worldSize,f,1];return l.af(g,g,this.projMatrix),g[2]/g[3]}}function Np(y,a){let f,m=!1,g=null,b=null;const T=()=>{g=null,m&&(y.apply(b,f),g=setTimeout(T,a),m=!1)};return(...L)=>(m=!0,b=this,f=L,g||T(),g)}class Op{constructor(a){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let m;return f.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:m,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=Np(this._updateHashUnthrottled,300),this._hashName=a&&encodeURIComponent(a)}addTo(a){return this._map=a,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(a){const f=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,g),T=Math.round(f.lng*b)/b,L=Math.round(f.lat*b)/b,A=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=a?`/${T}/${L}/${m}`:`${m}/${L}/${T}`,(A||N)&&(V+="/"+Math.round(10*A)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const j=this._hashName;let Y=!1;const he=window.location.hash.slice(1).split("&").map(ce=>{const ge=ce.split("=")[0];return ge===j?(Y=!0,`${ge}=${V}`):ce}).filter(ce=>ce);return Y||he.push(`${j}=${V}`),`#${he.join("&")}`}return`#${V}`}}const Tc={linearity:.3,easing:l.b6(0,0,.3,1)},Gl=l.e({deceleration:2500,maxSpeed:1400},Tc),Qm=l.e({deceleration:20,maxSpeed:1400},Tc),eg=l.e({deceleration:1e3,maxSpeed:360},Tc),tg=l.e({deceleration:1e3,maxSpeed:90},Tc);class ng{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(a){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:a})}_drainInertiaBuffer(){const a=this._inertiaBuffer,f=E.now();for(;a.length>0&&f-a[0].time>160;)a.shift()}_onMoveEnd(a){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)f.zoom+=b.zoomDelta||0,f.bearing+=b.bearingDelta||0,f.pitch+=b.pitchDelta||0,b.panDelta&&f.pan._add(b.panDelta),b.around&&(f.around=b.around),b.pinchAround&&(f.pinchAround=b.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(f.pan.mag()){const b=Pc(f.pan.mag(),m,l.e({},Gl,a||{}));g.offset=f.pan.mult(b.amount/f.pan.mag()),g.center=this._map.transform.center,Lc(g,b)}if(f.zoom){const b=Pc(f.zoom,m,Qm);g.zoom=this._map.transform.zoom+b.amount,Lc(g,b)}if(f.bearing){const b=Pc(f.bearing,m,eg);g.bearing=this._map.transform.bearing+l.ac(b.amount,-179,179),Lc(g,b)}if(f.pitch){const b=Pc(f.pitch,m,tg);g.pitch=this._map.transform.pitch+b.amount,Lc(g,b)}if(g.zoom||g.bearing){const b=f.pinchAround===void 0?f.around:f.pinchAround;g.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),l.e(g,{noMoveStart:!0})}}function Lc(y,a){(!y.duration||y.durationf.unproject(A)),L=b.reduce((A,N,V,j)=>A.add(N.div(j.length)),new l.P(0,0));super(a,{points:b,point:L,lngLats:T,lngLat:f.unproject(L),originalEvent:m}),this._defaultPrevented=!1}}class zp extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,f,m){super(a,{originalEvent:m}),this._defaultPrevented=!1}}class Ls{constructor(a,f){this._map=a,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new zp(a.type,this._map,a))}mousedown(a,f){return this._mousedownPos=f,this._firePreventable(new Co(a.type,this._map,a))}mouseup(a){this._map.fire(new Co(a.type,this._map,a))}click(a,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new Co(a.type,this._map,a))}dblclick(a){return this._firePreventable(new Co(a.type,this._map,a))}mouseover(a){this._map.fire(new Co(a.type,this._map,a))}mouseout(a){this._map.fire(new Co(a.type,this._map,a))}touchstart(a){return this._firePreventable(new ea(a.type,this._map,a))}touchmove(a){this._map.fire(new ea(a.type,this._map,a))}touchend(a){this._map.fire(new ea(a.type,this._map,a))}touchcancel(a){this._map.fire(new ea(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ta{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(a){this._map.fire(new Co(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Co("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._ignoreContextMenu||this._map.fire(new Co(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Mu{constructor(a){this._map=a}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(a){return this.transform.pointLocation(l.P.convert(a),this._map.terrain)}}class Ps{constructor(a,f){this._map=a,this._tr=new Mu(a),this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,f){this.isEnabled()&&a.shiftKey&&a.button===0&&(C.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(a,f){if(!this._active)return;const m=f;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)b.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",a)}keydown(a){this._active&&a.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",a))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(a,f){return this._map.fire(new l.k(a,{originalEvent:f}))}}function ql(y,a){if(y.length!==a.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${a.length}`);const f={};for(let m=0;mthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=a.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const b=new l.P(0,0);for(const T of g)b._add(T);return b.div(g.length)}(f),this.touches=ql(m,f)))}touchmove(a,f,m){if(this.aborted||!this.centroid)return;const g=ql(m,f);for(const b in this.touches){const T=g[b];(!T||T.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(a,f,m){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Fp{constructor(a){this.singleTap=new Gy(a),this.numTaps=a.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(a,f,m){this.singleTap.touchstart(a,f,m)}touchmove(a,f,m){this.singleTap.touchmove(a,f,m)}touchend(a,f,m){const g=this.singleTap.touchend(a,f,m);if(g){const b=a.timeStamp-this.lastTime<500,T=!this.lastTap||this.lastTap.dist(g)<30;if(b&&T||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class qy{constructor(a){this._tr=new Mu(a),this._zoomIn=new Fp({numTouches:1,numTaps:2}),this._zoomOut=new Fp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,f,m){this._zoomIn.touchstart(a,f,m),this._zoomOut.touchstart(a,f,m)}touchmove(a,f,m){this._zoomIn.touchmove(a,f,m),this._zoomOut.touchmove(a,f,m)}touchend(a,f,m){const g=this._zoomIn.touchend(a,f,m),b=this._zoomOut.touchend(a,f,m),T=this._tr;return g?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:T.zoom+1,around:T.unproject(g)},{originalEvent:a})}):b?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:T.zoom-1,around:T.unproject(b)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Au{constructor(a){this._enabled=!!a.enable,this._moveStateManager=a.moveStateManager,this._clickTolerance=a.clickTolerance||1,this._moveFunction=a.move,this._activateOnStart=!!a.activateOnStart,a.assignEvents(this),this.reset()}reset(a){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(a)}_move(...a){const f=this._moveFunction(...a);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(a,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(a)&&(this._moveStateManager.startMove(a),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(a,f){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(a.preventDefault(),!this._moveStateManager.isValidMoveEvent(a))return void this.reset(a);const g=f.length?f[0]:f;return!this._moved&&g.dist(m){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(a){a.preventDefault()}},ku=({enable:y,clickTolerance:a,bearingDegreesPerPixelMoved:f=.8})=>{const m=new na({checkCorrectEvent:g=>C.mouseButton(g)===0&&g.ctrlKey||C.mouseButton(g)===2});return new Au({clickTolerance:a,move:(g,b)=>({bearingDelta:(b.x-g.x)*f}),moveStateManager:m,enable:y,assignEvents:Gh})},Du=({enable:y,clickTolerance:a,pitchDegreesPerPixelMoved:f=-.5})=>{const m=new na({checkCorrectEvent:g=>C.mouseButton(g)===0&&g.ctrlKey||C.mouseButton(g)===2});return new Au({clickTolerance:a,move:(g,b)=>({pitchDelta:(b.y-g.y)*f}),moveStateManager:m,enable:y,assignEvents:Gh})};class rg{constructor(a,f){this._clickTolerance=a.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(a,f,m){return this._calculateTransform(a,f,m)}touchmove(a,f,m){if(this._active&&!(m.length0&&(this._active=!0);const g=ql(m,f),b=new l.P(0,0),T=new l.P(0,0);let L=0;for(const N in g){const V=g[N],j=this._touches[N];j&&(b._add(V),T._add(V.sub(j)),L++,g[N]=V)}if(this._touches=g,LMath.abs(y.x)}class sg extends xt{constructor(a){super(),this._currentTouchCount=0,this._map=a}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(a,f,m){super.touchstart(a,f,m),this._currentTouchCount=m.length}_start(a){this._lastPoints=a,Wh(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,f,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=a[0].sub(this._lastPoints[0]),b=a[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,b,m.timeStamp),this._valid?(this._lastPoints=a,this._active=!0,{pitchDelta:(g.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(a,f,m){if(this._valid!==void 0)return this._valid;const g=a.mag()>=2,b=f.mag()>=2;if(!g&&!b)return;if(!g||!b)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const T=a.y>0==f.y>0;return Wh(a)&&Wh(f)&&T}}const Wy={panStep:100,bearingStep:15,pitchStep:10};class al{constructor(a){this._tr=new Mu(a);const f=Wy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let f=0,m=0,g=0,b=0,T=0;switch(a.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:a.shiftKey?m=-1:(a.preventDefault(),b=-1);break;case 39:a.shiftKey?m=1:(a.preventDefault(),b=1);break;case 38:a.shiftKey?g=1:(a.preventDefault(),T=-1);break;case 40:a.shiftKey?g=-1:(a.preventDefault(),T=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:L=>{const A=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:wr,zoom:f?Math.round(A.zoom)+f*(a.shiftKey?2:1):A.zoom,bearing:A.bearing+m*this._bearingStep,pitch:A.pitch+g*this._pitchStep,offset:[-b*this._panStep,-T*this._panStep],center:A.center},{originalEvent:a})}}}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 wr(y){return y*(2-y)}const Ac=4.000244140625;class Hh{constructor(a,f){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=a,this._tr=new Mu(a),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&a.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(a){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!a[this._map.cooperativeGestures._bypassKey])return;let f=a.deltaMode===WheelEvent.DOM_DELTA_LINE?40*a.deltaY:a.deltaY;const m=E.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,f!==0&&f%Ac==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,a)):this._type||(this._type=Math.abs(g*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),a.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=a,this._delta-=f,this._active||this._start(a)),a.preventDefault()}_start(a){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 f=C.mousePos(this._map.getCanvas(),a),m=this._tr;this._around=f.y>m.transform.height/2-m.transform.getHorizon()?l.M.convert(this._aroundCenter?m.center:m.unproject(f)):l.M.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const a=this._tr.transform;if(this._delta!==0){const L=this._type==="wheel"&&Math.abs(this._delta)>Ac?this._wheelZoomRate:this._defaultZoomRate;let A=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&A!==0&&(A=1/A);const N=typeof this._targetZoom=="number"?a.zoomScale(this._targetZoom):a.scale;this._targetZoom=Math.min(a.maxZoom,Math.max(a.minZoom,a.scaleZoom(N*A))),this._type==="wheel"&&(this._startZoom=a.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:a.zoom,m=this._startZoom,g=this._easing;let b,T=!1;if(this._type==="wheel"&&m&&g){const L=Math.min((E.now()-this._lastWheelEventTime)/200,1),A=g(L);b=l.z.number(m,f,A),L<1?this._frameId||(this._frameId=!0):T=!0}else b=f,T=!0;return this._active=!0,T&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!T,zoomDelta:b-a.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(a){let f=l.b7;if(this._prevEase){const m=this._prevEase,g=(E.now()-m.start)/m.duration,b=m.easing(g+.01)-m.easing(g),T=.27/Math.sqrt(b*b+1e-4)*.01,L=Math.sqrt(.0729-T*T);f=l.b6(T,L,.25,1)}return this._prevEase={start:E.now(),duration:a,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Vp{constructor(a,f){this._clickZoom=a,this._tapZoom=f}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 ag{constructor(a){this._tr=new Mu(a),this.reset()}reset(){this._active=!1}dblclick(a,f){return a.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(a.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lg{constructor(){this._tap=new Fp({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(a,f,m){if(!this._swipePoint)if(this._tapTime){const g=f[0],b=a.timeStamp-this._tapTime<500,T=this._tapPoint.dist(g)<30;b&&T?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(a,f,m)}touchmove(a,f,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=f[0],b=g.y-this._swipePoint.y;return this._swipePoint=g,a.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(a,f,m)}touchend(a,f,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(a,f,m);g&&(this._tapTime=a.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 ug{constructor(a,f,m){this._el=a,this._mousePan=f,this._touchPan=m}enable(a){this._inertiaOptions=a||{},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 Ms{constructor(a,f,m){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=f,this._mousePitch=m}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 kc{constructor(a,f,m,g){this._el=a,this._touchZoom=f,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ot{constructor(a,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=a,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const a=this._map.getCanvasContainer();a.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",a);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=f,this._container.appendChild(g);const b=document.createElement("div");b.className="maplibregl-mobile-message",b.textContent=m,this._container.appendChild(b),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(C.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(a){this._onCooperativeGesture(a.touches.length===1)}wheel(a){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!a[this._bypassKey])}_onCooperativeGesture(a){this._enabled&&a&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const qt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Zh extends l.k{}function Dc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Up{constructor(a,f){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 T=g.type==="renderFrame"?void 0:g,L={needsRenderFrame:!1},A={},N={},V=g.touches,j=V?this._getMapTouches(V):void 0,Y=j?C.touchPos(this._map.getCanvas(),j):C.mousePos(this._map.getCanvas(),g);for(const{handlerName:ge,handler:re,allowed:Ie}of this._handlers){if(!re.isEnabled())continue;let je;this._blockedByActive(N,Ie,ge)?re.reset():re[b||g.type]&&(je=re[b||g.type](g,Y,j),this.mergeHandlerResult(L,A,je,ge,T),je&&je.needsRenderFrame&&this._triggerRenderFrame()),(je||re.isActive())&&(N[ge]=re)}const he={};for(const ge in this._previousActiveHandlers)N[ge]||(he[ge]=T);this._previousActiveHandlers=N,(Object.keys(he).length||Dc(L))&&(this._changes.push([L,A,he]),this._triggerRenderFrame()),(Object.keys(N).length||Dc(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=L;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))},this._map=a,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ng(a),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,b,T]of this._listeners)C.addEventListener(g,b,g===document?this.handleWindowEvent:this.handleEvent,T)}destroy(){for(const[a,f,m]of this._listeners)C.removeEventListener(a,f,a===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(a){const f=this._map,m=f.getCanvasContainer();this._add("mapEvent",new Ls(f,a));const g=f.boxZoom=new Ps(f,a);this._add("boxZoom",g),a.interactive&&a.boxZoom&&g.enable();const b=f.cooperativeGestures=new Ot(f,a.cooperativeGestures);this._add("cooperativeGestures",b),a.cooperativeGestures&&b.enable();const T=new qy(f),L=new ag(f);f.doubleClickZoom=new Vp(L,T),this._add("tapZoom",T),this._add("clickZoom",L),a.interactive&&a.doubleClickZoom&&f.doubleClickZoom.enable();const A=new lg;this._add("tapDragZoom",A);const N=f.touchPitch=new sg(f);this._add("touchPitch",N),a.interactive&&a.touchPitch&&f.touchPitch.enable(a.touchPitch);const V=ku(a),j=Du(a);f.dragRotate=new Ms(a,V,j),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",j,["mouseRotate"]),a.interactive&&a.dragRotate&&f.dragRotate.enable();const Y=(({enable:je,clickTolerance:xe})=>{const De=new na({checkCorrectEvent:Ge=>C.mouseButton(Ge)===0&&!Ge.ctrlKey});return new Au({clickTolerance:xe,move:(Ge,Ze)=>({around:Ze,panDelta:Ze.sub(Ge)}),activateOnStart:!0,moveStateManager:De,enable:je,assignEvents:Gh})})(a),he=new rg(a,f);f.dragPan=new ug(m,Y,he),this._add("mousePan",Y),this._add("touchPan",he,["touchZoom","touchRotate"]),a.interactive&&a.dragPan&&f.dragPan.enable(a.dragPan);const ce=new Bp,ge=new og;f.touchZoomRotate=new kc(m,ge,ce,A),this._add("touchRotate",ce,["touchPan","touchZoom"]),this._add("touchZoom",ge,["touchPan","touchRotate"]),a.interactive&&a.touchZoomRotate&&f.touchZoomRotate.enable(a.touchZoomRotate);const re=f.scrollZoom=new Hh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",re,["mousePan"]),a.interactive&&a.scrollZoom&&f.scrollZoom.enable(a.scrollZoom);const Ie=f.keyboard=new al(f);this._add("keyboard",Ie),a.interactive&&a.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new ta(f))}_add(a,f,m){this._handlers.push({handlerName:a,handler:f,allowed:m}),this._handlersById[a]=f}stop(a){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qt(this._eventsInProgress)||this.isZooming()}_blockedByActive(a,f,m){for(const g in a)if(g!==m&&(!f||f.indexOf(g)<0))return!0;return!1}_getMapTouches(a){const f=[];for(const m of a)this._el.contains(m.target)&&f.push(m);return f}mergeHandlerResult(a,f,m,g,b){if(!m)return;l.e(a,m);const T={handlerName:g,originalEvent:m.originalEvent||b};m.zoomDelta!==void 0&&(f.zoom=T),m.panDelta!==void 0&&(f.drag=T),m.pitchDelta!==void 0&&(f.pitch=T),m.bearingDelta!==void 0&&(f.rotate=T)}_applyChanges(){const a={},f={},m={};for(const[g,b,T]of this._changes)g.panDelta&&(a.panDelta=(a.panDelta||new l.P(0,0))._add(g.panDelta)),g.zoomDelta&&(a.zoomDelta=(a.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(a.bearingDelta=(a.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(a.pitchDelta=(a.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(a.around=g.around),g.pinchAround!==void 0&&(a.pinchAround=g.pinchAround),g.noInertia&&(a.noInertia=g.noInertia),l.e(f,b),l.e(m,T);this._updateMapTransform(a,f,m),this._changes=[]}_updateMapTransform(a,f,m){const g=this._map,b=g._getTransformForUpdate(),T=g.terrain;if(!(Dc(a)||T&&this._terrainMovement))return this._fireEvents(f,m,!0);let{panDelta:L,zoomDelta:A,bearingDelta:N,pitchDelta:V,around:j,pinchAround:Y}=a;Y!==void 0&&(j=Y),g._stop(!0),j=j||g.transform.centerPoint;const he=b.pointLocation(L?j.sub(L):j);N&&(b.bearing+=N),V&&(b.pitch+=V),A&&(b.zoom+=A),T?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(L)):b.setLocationAtPoint(he,j):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(he,j),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,b.recalculateZoom(g.terrain)})):b.setLocationAtPoint(he,j),g._applyUpdatedTransform(b),this._map._update(),a.noInertia||this._inertia.record(a),this._fireEvents(f,m,!0)}_fireEvents(a,f,m){const g=qt(this._eventsInProgress),b=qt(a),T={};for(const V in a){const{originalEvent:j}=a[V];this._eventsInProgress[V]||(T[`${V}start`]=j),this._eventsInProgress[V]=a[V]}!g&&b&&this._fireEvent("movestart",b.originalEvent);for(const V in T)this._fireEvent(V,T[V]);b&&this._fireEvent("move",b.originalEvent);for(const V in a){const{originalEvent:j}=a[V];this._fireEvent(V,j)}const L={};let A;for(const V in this._eventsInProgress){const{handlerName:j,originalEvent:Y}=this._eventsInProgress[V];this._handlersById[j].isActive()||(delete this._eventsInProgress[V],A=f[j]||Y,L[`${V}end`]=A)}for(const V in L)this._fireEvent(V,L[V]);const N=qt(this._eventsInProgress);if(m&&(g||b)&&!N){this._updatingCamera=!0;const V=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),j=Y=>Y!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Zh("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class To extends l.E{constructor(a,f){super(),this._renderFrameCallback=()=>{const m=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=a,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.M(this.transform.center.lng,this.transform.center.lat)}setCenter(a,f){return this.jumpTo({center:a},f)}panBy(a,f,m){return a=l.P.convert(a).mult(-1),this.panTo(this.transform.center,l.e({offset:a},f),m)}panTo(a,f,m){return this.easeTo(l.e({center:a},f),m)}getZoom(){return this.transform.zoom}setZoom(a,f){return this.jumpTo({zoom:a},f),this}zoomTo(a,f,m){return this.easeTo(l.e({zoom:a},f),m)}zoomIn(a,f){return this.zoomTo(this.getZoom()+1,a,f),this}zoomOut(a,f){return this.zoomTo(this.getZoom()-1,a,f),this}getBearing(){return this.transform.bearing}setBearing(a,f){return this.jumpTo({bearing:a},f),this}getPadding(){return this.transform.padding}setPadding(a,f){return this.jumpTo({padding:a},f),this}rotateTo(a,f,m){return this.easeTo(l.e({bearing:a},f),m)}resetNorth(a,f){return this.rotateTo(0,l.e({duration:1e3},a),f),this}resetNorthPitch(a,f){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},a),f),this}snapToNorth(a,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=l.z.number(b,re,Ke)),this._rotating&&(g.bearing=l.z.number(T,N,Ke)),this._pitching&&(g.pitch=l.z.number(L,V,Ke)),this._padding&&(g.interpolatePadding(A,j,Ke),he=g.centerPoint.add(Y)),this.terrain&&!a.freezeElevation&&this._updateElevation(Ke),De)g.setLocationAtPoint(De,Ge);else{const rt=g.zoomScale(g.zoom-b),tt=re>b?Math.min(2,xe):Math.max(.5,xe),ct=Math.pow(tt,1-Ke),dt=g.unproject(Ie.add(je.mult(Ke*ct)).mult(rt));g.setLocationAtPoint(g.renderWorldCopies?dt.wrap():dt,he)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},Ke=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ke)},a),this}_prepareEase(a,f,m={}){this._moving=!0,f||m.moving||this.fire(new l.k("movestart",a)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",a)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",a)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",a))}_prepareElevation(a){this._elevationCenter=a,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(a){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(a<1&&f!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=a*(m-(f-(m*a+this._elevationStart))/(1-a)),this._elevationTarget=f}this.transform.elevation=l.z.number(this._elevationStart,this._elevationTarget,a)}_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(a){if(!this.transformCameraUpdate)return;const f=a.clone(),{center:m,zoom:g,pitch:b,bearing:T,elevation:L}=this.transformCameraUpdate(f);m&&(f.center=m),g!==void 0&&(f.zoom=g),b!==void 0&&(f.pitch=b),T!==void 0&&(f.bearing=T),L!==void 0&&(f.elevation=L),this.transform.apply(f)}_fireMoveEvents(a){this.fire(new l.k("move",a)),this._zooming&&this.fire(new l.k("zoom",a)),this._rotating&&this.fire(new l.k("rotate",a)),this._pitching&&this.fire(new l.k("pitch",a))}_afterEase(a,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const m=this._zooming,g=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",a)),g&&this.fire(new l.k("rotateend",a)),b&&this.fire(new l.k("pitchend",a)),this.fire(new l.k("moveend",a))}flyTo(a,f){var m;if(!a.essential&&E.prefersReducedMotion){const Pn=l.L(a,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pn,f)}this.stop(),a=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b7},a);const g=this._getTransformForUpdate(),b=this.getZoom(),T=this.getBearing(),L=this.getPitch(),A=this.getPadding(),N="bearing"in a?this._normalizeBearing(a.bearing,T):T,V="pitch"in a?+a.pitch:L,j="padding"in a?a.padding:g.padding,Y=l.P.convert(a.offset);let he=g.centerPoint.add(Y);const ce=g.pointLocation(he),{center:ge,zoom:re}=g.getConstrained(l.M.convert(a.center||ce),(m=a.zoom)!==null&&m!==void 0?m:b);this._normalizeCenter(ge);const Ie=g.zoomScale(re-b),je=g.project(ce),xe=g.project(ge).sub(je);let De=a.curve;const Ge=Math.max(g.width,g.height),Ze=Ge/Ie,Ke=xe.mag();if("minZoom"in a){const Pn=l.ac(Math.min(a.minZoom,b,re),g.minZoom,g.maxZoom),Qt=Ge/g.zoomScale(Pn-b);De=Math.sqrt(Qt/Ke*2)}const rt=De*De;function tt(Pn){const Qt=(Ze*Ze-Ge*Ge+(Pn?-1:1)*rt*rt*Ke*Ke)/(2*(Pn?Ze:Ge)*rt*Ke);return Math.log(Math.sqrt(Qt*Qt+1)-Qt)}function ct(Pn){return(Math.exp(Pn)-Math.exp(-Pn))/2}function dt(Pn){return(Math.exp(Pn)+Math.exp(-Pn))/2}const cn=tt(!1);let mt=function(Pn){return dt(cn)/dt(cn+De*Pn)},Xt=function(Pn){return Ge*((dt(cn)*(ct(Qt=cn+De*Pn)/dt(Qt))-ct(cn))/rt)/Ke;var Qt},hn=(tt(!0)-cn)/De;if(Math.abs(Ke)<1e-6||!isFinite(hn)){if(Math.abs(Ge-Ze)<1e-6)return this.easeTo(a,f);const Pn=Zea.maxDuration&&(a.duration=0),this._zooming=!0,this._rotating=T!==N,this._pitching=V!==L,this._padding=!g.isPaddingEqual(j),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(ge),this._ease(Pn=>{const Qt=Pn*hn,mn=1/mt(Qt);g.zoom=Pn===1?re:b+g.scaleZoom(mn),this._rotating&&(g.bearing=l.z.number(T,N,Pn)),this._pitching&&(g.pitch=l.z.number(L,V,Pn)),this._padding&&(g.interpolatePadding(A,j,Pn),he=g.centerPoint.add(Y)),this.terrain&&!a.freezeElevation&&this._updateElevation(Pn);const vn=Pn===1?ge:g.unproject(je.add(xe.mult(Xt(Qt))).mult(mn));g.setLocationAtPoint(g.renderWorldCopies?vn.wrap():vn,he),this._applyUpdatedTransform(g),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},a),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(a,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,f)}if(!a){const m=this.handlers;m&&m.stop(!1)}return this}_ease(a,f,m){m.animate===!1||m.duration===0?(a(1),f()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=a,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(a,f){a=l.b1(a,-180,180);const m=Math.abs(a-f);return Math.abs(a-360-f)180?-360:m<-180?360:0}queryTerrainElevation(a){return this.terrain?this.terrain.getElevationForLngLatZoom(l.M.convert(a),this.transform.tileZoom)-this.transform.elevation:null}}const jp={compact:!0,customAttribution:'MapLibre'};class As{constructor(a=jp){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=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.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=a}getDefaultPosition(){return"bottom-right"}onAdd(a){return this._map=a,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.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(){C.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(a,f){const m=this._map._getUIString(`AttributionControl.${f}`);a.title=m,a.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let a=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=a.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&a.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const f=this._map.style.sourceCaches;for(const g in f){const b=f[g];if(b.used||b.usedForTerrain){const T=b.getSource();T.attribution&&a.indexOf(T.attribution)<0&&a.push(T.attribution)}}a=a.filter(g=>String(g).trim()),a.sort((g,b)=>g.length-b.length),a=a.filter((g,b)=>{for(let T=b+1;T=0)return!1;return!0});const m=a.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,a.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class cg{constructor(a={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const m=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=a}getDefaultPosition(){return"bottom-left"}onAdd(a){this._map=a,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const f=C.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Rc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const f=++this._id;return this._queue.push({callback:a,id:f,cancelled:!1}),f}remove(a){const f=this._currentlyRunning,m=f?this._queue.concat(f):this._queue;for(const g of m)if(g.id===a)return void(g.cancelled=!0)}run(a=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const m of f)if(!m.cancelled&&(m.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Fr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class ei extends l.E{constructor(a){super(),this.sourceCache=a,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,a.usedForTerrain=!0,a.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(a,f){this.sourceCache.update(a,f),this._renderableTilesKeys=[];const m={};for(const g of a.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),l.aN(g.posMatrix,0,l.W,0,l.W,0,1),this._tiles[g.key]=new us(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(a){for(const f in this._tiles){const m=this._tiles[f];(!a||m.tileID.equals(a)||m.tileID.isChildOf(a)||a.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(a=>this.getTileByID(a))}getTileByID(a){return this._tiles[a]}getTerrainCoords(a){const f={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(a.canonical)){const b=a.clone();b.posMatrix=new Float64Array(16),l.aN(b.posMatrix,0,l.W,0,l.W,0,1),f[m]=b}else if(g.canonical.isChildOf(a.canonical)){const b=a.clone();b.posMatrix=new Float64Array(16);const T=g.canonical.z-a.canonical.z,L=g.canonical.x-(g.canonical.x>>T<>T<>T;l.aN(b.posMatrix,0,N,0,N,0,1),l.H(b.posMatrix,b.posMatrix,[-L*N,-A*N,0]),f[m]=b}else if(a.canonical.isChildOf(g.canonical)){const b=a.clone();b.posMatrix=new Float64Array(16);const T=a.canonical.z-g.canonical.z,L=a.canonical.x-(a.canonical.x>>T<>T<>T;l.aN(b.posMatrix,0,l.W,0,l.W,0,1),l.H(b.posMatrix,b.posMatrix,[L*N,A*N,0]),l.J(b.posMatrix,b.posMatrix,[1/2**T,1/2**T,0]),f[m]=b}}return f}getSourceTile(a,f){const m=this.sourceCache._source;let g=a.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g=m.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(a.scaledTo(g--).key);return b}tilesAfterTime(a=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=a)}}class hg{constructor(a,f,m){this.painter=a,this.sourceCache=new ei(f),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(a,f,m,g=l.W){var b;if(!(f>=0&&f=0&&ma.canonical.z&&(a.canonical.z>=g?b=a.canonical.z-g:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const T=a.canonical.x-(a.canonical.x>>b<>b<>8<<4|b>>8,f[T+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new Q(a,m,a.gl.RGBA,{premultiply:!1});return g.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(a){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),m=this.painter.context,g=m.gl,b=Math.round(a.x*this.painter.pixelRatio/devicePixelRatio),T=Math.round(a.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(b,L-T-1,1,1,g.RGBA,g.UNSIGNED_BYTE,f),m.bindFramebuffer.set(null);const A=f[0]+(f[2]>>4<<8),N=f[1]+((15&f[2])<<8),V=this.coordsIndex[255-f[3]],j=V&&this.sourceCache.getTileByID(V);if(!j)return null;const Y=this._coordsTextureSize,he=(1<a.id!==f),this._recentlyUsed.push(a.id)}stampObject(a){a.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const a=this._createObject(this._objects.length);return this._objects.push(a),a}freeObject(a){a.inUse=!1}freeAllObjects(){for(const a of this._objects)this.freeObject(a)}isFull(){return!(this._objects.length!a.inUse)===!1}}const ka={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Gp{constructor(a,f){this.painter=a,this.terrain=f,this.pool=new Nc(a.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(a){return this.pool.getObjectForId(a.rtt[this._stacks.length-1].id).texture}prepareForRender(a,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=a._order.filter(m=>!a._layers[m].isHidden(f)),this._coordsDescendingInv={};for(const m in a.sourceCaches){this._coordsDescendingInv[m]={};const g=a.sourceCaches[m].getVisibleCoordinates();for(const b of g){const T=this.terrain.sourceCache.getTerrainCoords(b);for(const L in T)this._coordsDescendingInv[m][L]||(this._coordsDescendingInv[m][L]=[]),this._coordsDescendingInv[m][L].push(T[L])}}this._coordsDescendingInvStr={};for(const m of a._order){const g=a._layers[m],b=g.source;if(ka[g.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const T in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][T]=this._coordsDescendingInv[b][T].map(L=>L.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[g][m.tileID.key];b&&b!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(a){if(a.isHidden(this.painter.transform.zoom))return!1;const f=a.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===a.id;if(ka[f]&&(this._prevType&&ka[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(a.id),!g))return!0;if(ka[this._prevType]||ka[f]&&g){this._prevType=f;const b=this._stacks.length-1,T=this._stacks[b]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(Uh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[b]){const N=this.pool.getObjectForId(L.rtt[b].id);if(N.stamp===L.rtt[b].stamp){this.pool.useObject(N);continue}}const A=this.pool.getOrCreateFreeObject();this.pool.useObject(A),this.pool.stampObject(A),L.rtt[b]={id:A.id,stamp:A.stamp},m.context.bindFramebuffer.set(A.fbo.framebuffer),m.context.clear({color:l.aO.transparent,stencil:0}),m.currentStencilSource=void 0;for(let N=0;N{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Hp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Zp{constructor(a,f,m=!1){this.mousedown=T=>{this.startMouse(l.e({},T,{ctrlKey:!0,preventDefault:()=>T.preventDefault()}),C.mousePos(this.element,T)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=T=>{this.moveMouse(T,C.mousePos(this.element,T))},this.mouseup=T=>{this.mouseRotate.dragEnd(T),this.mousePitch&&this.mousePitch.dragEnd(T),this.offTemp()},this.touchstart=T=>{T.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,T.targetTouches)[0],this.startTouch(T,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=T=>{T.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,T.targetTouches)[0],this.moveTouch(T,this._lastPos))},this.touchend=T=>{T.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=a.dragRotate._mouseRotate.getClickTolerance(),b=a.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=ku({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:T,clickTolerance:L,bearingDegreesPerPixelMoved:A=.8})=>{const N=new It;return new Au({clickTolerance:L,move:(V,j)=>({bearingDelta:(j.x-V.x)*A}),moveStateManager:N,enable:T,assignEvents:Xh})})({clickTolerance:g,enable:!0}),this.map=a,m&&(this.mousePitch=Du({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:T,clickTolerance:L,pitchDegreesPerPixelMoved:A=-.5})=>{const N=new It;return new Au({clickTolerance:L,move:(V,j)=>({pitchDelta:(j.y-V.y)*A}),moveStateManager:N,enable:T,assignEvents:Xh})})({clickTolerance:b,enable:!0})),C.addEventListener(f,"mousedown",this.mousedown),C.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(f,"touchcancel",this.reset)}startMouse(a,f){this.mouseRotate.dragStart(a,f),this.mousePitch&&this.mousePitch.dragStart(a,f),C.disableDrag()}startTouch(a,f){this.touchRotate.dragStart(a,f),this.touchPitch&&this.touchPitch.dragStart(a,f),C.disableDrag()}moveMouse(a,f){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(a,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(a,f)||{};b&&m.setPitch(m.getPitch()+b)}}moveTouch(a,f){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(a,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(a,f)||{};b&&m.setPitch(m.getPitch()+b)}}off(){const a=this.element;C.removeEventListener(a,"mousedown",this.mousedown),C.removeEventListener(a,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(a,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let Da;function $h(y,a,f){const m=new l.M(y.lng,y.lat);if(y=new l.M(y.lng,y.lat),a){const g=new l.M(y.lng-360,y.lat),b=new l.M(y.lng+360,y.lat),T=f.locationPoint(y).distSqr(a);f.locationPoint(g).distSqr(a)180;){const g=f.locationPoint(y);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;y.lng>f.center.lng?y.lng-=360:y.lng+=360}return y.lng!==m.lng&&f.locationPoint(y).y>f.height/2-f.getHorizon()?y:m}const zc={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 Yh(y,a,f){const m=y.classList;for(const g in zc)m.remove(`maplibregl-${f}-anchor-${g}`);m.add(`maplibregl-${f}-anchor-${a}`)}class Fc extends l.E{constructor(a){if(super(),this._onKeyPress=f=>{const m=f.code,g=f.charCode||f.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=f=>{const m=f.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=f=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?$h(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let b="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let T="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?T="rotateX(0deg)":this._pitchAlignment==="map"&&(T=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${zc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${T} ${b}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=f.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 l.k("dragstart"))),this.fire(new l.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 l.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.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=a&&a.anchor||"center",this._color=a&&a.color||"#3FB1CE",this._scale=a&&a.scale||1,this._draggable=a&&a.draggable||!1,this._clickTolerance=a&&a.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=a&&a.rotation||0,this._rotationAlignment=a&&a.rotationAlignment||"auto",this._pitchAlignment=a&&a.pitchAlignment&&a.pitchAlignment!=="auto"?a.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(a==null?void 0:a.opacity,a==null?void 0:a.opacityWhenCovered),a&&a.element)this._element=a.element,this._offset=l.P.convert(a&&a.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div"),this._element.setAttribute("aria-label","Map marker");const f=C.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${m}px`),f.setAttributeNS(null,"width",`${g}px`),f.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const b=C.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 T=C.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill-rule","nonzero");const L=C.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");const A=[{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 Ie of A){const je=C.createNS("http://www.w3.org/2000/svg","ellipse");je.setAttributeNS(null,"opacity","0.04"),je.setAttributeNS(null,"cx","10.5"),je.setAttributeNS(null,"cy","5.80029008"),je.setAttributeNS(null,"rx",Ie.rx),je.setAttributeNS(null,"ry",Ie.ry),L.appendChild(je)}const N=C.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.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(V);const j=C.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"fill","#000000");const Y=C.createNS("http://www.w3.org/2000/svg","path");Y.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"),j.appendChild(Y);const he=C.createNS("http://www.w3.org/2000/svg","g");he.setAttributeNS(null,"transform","translate(6.0, 7.0)"),he.setAttributeNS(null,"fill","#FFFFFF");const ce=C.createNS("http://www.w3.org/2000/svg","g");ce.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ge=C.createNS("http://www.w3.org/2000/svg","circle");ge.setAttributeNS(null,"fill","#000000"),ge.setAttributeNS(null,"opacity","0.25"),ge.setAttributeNS(null,"cx","5.5"),ge.setAttributeNS(null,"cy","5.5"),ge.setAttributeNS(null,"r","5.4999962");const re=C.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#FFFFFF"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962"),ce.appendChild(ge),ce.appendChild(re),T.appendChild(L),T.appendChild(N),T.appendChild(j),T.appendChild(he),T.appendChild(ce),f.appendChild(T),f.setAttributeNS(null,"height",m*this._scale+"px"),f.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(f),this._offset=l.P.convert(a&&a.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Yh(this._element,this._anchor,"marker"),a&&a.className)for(const f of a.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(a){return this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._update),a.on("moveend",this._update),a.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),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=l.M.convert(a),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(a){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),a){if(!("offset"in a.options)){const g=Math.abs(13.5)/Math.SQRT2;a.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=a,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 a=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:a?(a.isOpen()?a.remove():(a.setLngLat(this._lngLat),a.addTo(this._map)),this):this}_updateOpacity(a=!1){var f,m;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(a)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const g=this._map,b=g.terrain.depthAtPoint(this._pos),T=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,T)-b<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/g.transform._pixelPerMeter,A=Math.sin(g.getPitch()*Math.PI/180)*L,N=g.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),V=g.transform.lngLatToCameraDepth(this._lngLat,T+A)-N>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(a){return this._offset=l.P.convert(a),this._update(),this}addClassName(a){this._element.classList.add(a)}removeClassName(a){this._element.classList.remove(a)}toggleClassName(a){return this._element.classList.toggle(a)}setDraggable(a){return this._draggable=!!a,this._map&&(a?(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(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a&&a!=="auto"?a:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(a,f){return a===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),a!==void 0&&(this._opacity=a),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Kh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Nu=0,Wl=!1;const Jh={maxWidth:100,unit:"metric"};function Qh(y,a,f){const m=f&&f.maxWidth||100,g=y._container.clientHeight/2,b=y.unproject([0,g]),T=y.unproject([m,g]),L=b.distanceTo(T);if(f&&f.unit==="imperial"){const A=3.2808*L;A>5280?Hl(a,m,A/5280,y._getUIString("ScaleControl.Miles")):Hl(a,m,A,y._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Hl(a,m,L/1852,y._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Hl(a,m,L/1e3,y._getUIString("ScaleControl.Kilometers")):Hl(a,m,L,y._getUIString("ScaleControl.Meters"))}function Hl(y,a,f,m){const g=function(b){const T=Math.pow(10,`${Math.floor(b)}`.length-1);let L=b/T;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(A){const N=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*N)/N}(L),T*L}(f);y.style.width=a*(g/f)+"px",y.innerHTML=`${g} ${m}`}const Xp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},$p=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ef(y){if(y){if(typeof y=="number"){const a=Math.round(Math.abs(y)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,y),"top-left":new l.P(a,a),"top-right":new l.P(-a,a),bottom:new l.P(0,-y),"bottom-left":new l.P(a,-a),"bottom-right":new l.P(-a,-a),left:new l.P(y,0),right:new l.P(-y,0)}}if(y instanceof l.P||Array.isArray(y)){const a=l.P.convert(y);return{center:a,top:a,"top-left":a,"top-right":a,bottom:a,"bottom-left":a,"bottom-right":a,left:a,right:a}}return{center:l.P.convert(y.center||[0,0]),top:l.P.convert(y.top||[0,0]),"top-left":l.P.convert(y["top-left"]||[0,0]),"top-right":l.P.convert(y["top-right"]||[0,0]),bottom:l.P.convert(y.bottom||[0,0]),"bottom-left":l.P.convert(y["bottom-left"]||[0,0]),"bottom-right":l.P.convert(y["bottom-right"]||[0,0]),left:l.P.convert(y.left||[0,0]),right:l.P.convert(y.right||[0,0])}}return ef(new l.P(0,0))}const fg=d;c.AJAXError=l.be,c.Evented=l.E,c.LngLat=l.M,c.MercatorCoordinate=l.Y,c.Point=l.P,c.addProtocol=l.bf,c.config=l.a,c.removeProtocol=l.bg,c.AttributionControl=As,c.BoxZoomHandler=Ps,c.CanvasSource=Cs,c.CooperativeGesturesHandler=Ot,c.DoubleClickZoomHandler=Vp,c.DragPanHandler=ug,c.DragRotateHandler=Ms,c.EdgeInsets=Pu,c.FullscreenControl=class extends l.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var a;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((a=f==null?void 0:f.shadowRoot)===null||a===void 0)&&a.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===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:l.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=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.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 l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=qr,c.GeolocateControl=class extends l.E{constructor(y){super(),this._onSuccess=a=>{if(this._map){if(this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=a,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(a),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(a),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",a)),this._finish()}},this._updateCamera=a=>{const f=new l.M(a.coords.longitude,a.coords.latitude),m=a.coords.accuracy,g=this._map.getBearing(),b=l.e({bearing:g},this.options.fitBoundsOptions),T=Ce.fromLngLat(f,m);this._map.fitBounds(T,b,{geolocateSource:!0})},this._updateMarker=a=>{if(a){const f=new l.M(a.coords.longitude,a.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=a.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=a=>{if(this._map){if(this.options.trackUserLocation)if(a.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 f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(a.code===3&&Wl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",a)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=a=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Fc({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.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 l.k("trackuserlocationend")))})}},this.options=l.e({},Kh,y)}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(a=!1){if(Da!==void 0&&!a)return Da;if(window.navigator.permissions===void 0)return Da=!!window.navigator.geolocation,Da;try{Da=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Da=!!window.navigator.geolocation}return Da})}().then(a=>this._setupUI(a)),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(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Nu=0,Wl=!1}_isOutOfMapMaxBounds(y){const a=this._map.getMaxBounds(),f=y.coords;return a&&(f.longitudea.getEast()||f.latitudea.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(),a=y.getSouthEast(),f=y.getNorthEast(),m=a.distanceTo(f),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return l.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 l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Nu--,Wl=!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 l.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 l.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"),Nu++,Nu>1?(y={maximumAge:6e5,timeout:0},Wl=!0):(y=this.options.positionOptions,Wl=!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)}},c.Hash=Op,c.ImageSource=ur,c.KeyboardHandler=al,c.LngLatBounds=Ce,c.LogoControl=cg,c.Map=class extends To{constructor(y){if(l.bc.mark(l.bd.create),(y=l.e({},Oc,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 jh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=a=>{a.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:a}))},this._contextRestored=a=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:a}))},this._onMapScroll=a=>{if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,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 Rc,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},qp,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new q(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 a=!1;const f=Np(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{a?f(m):a=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Up(this,y),this._hash=y.hash&&new Op(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,l.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 As(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new cg,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new l.k(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new l.k(`${a.dataType}dataloading`,a))}),this.on("dataabort",a=>{this.fire(new l.k("sourcedataabort",a))})}_getMapId(){return this._mapId}addControl(y,a){if(a===void 0&&(a=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=y.onAdd(this);this._controls.push(y);const m=this._controlPositions[a];return a.indexOf("bottom")!==-1?m.insertBefore(f,m.firstChild):m.appendChild(f),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const a=this._controls.indexOf(y);return a>-1&&this._controls.splice(a,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,a,f,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,a,f,m)}resize(y){var a;const f=this._containerDimensions(),m=f[0],g=f[1],b=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,b),this.painter.resize(m,g,b),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const A=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,A),this.painter.resize(m,g,A)}this.transform.resize(m,g),(a=this._requestedCameraState)===null||a===void 0||a.resize(m,g);const T=!this._moving;return T&&(this.stop(),this.fire(new l.k("movestart",y)).fire(new l.k("move",y))),this.fire(new l.k("resize",y)),T&&this.fire(new l.k("moveend",y)),this}_getClampedPixelRatio(y,a){const{0:f,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),b=y*g,T=a*g;return Math.min(b>f?f/b:1,T>m?m/T: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(Ce.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()}project(y){return this.transform.locationPoint(l.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(l.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,a,f){if(y==="mouseenter"||y==="mouseover"){let m=!1;return{layer:a,listener:f,delegates:{mousemove:b=>{const T=this.getLayer(a)?this.queryRenderedFeatures(b.point,{layers:[a]}):[];T.length?m||(m=!0,f.call(this,new Co(y,this,b.originalEvent,{features:T}))):m=!1},mouseout:()=>{m=!1}}}}if(y==="mouseleave"||y==="mouseout"){let m=!1;return{layer:a,listener:f,delegates:{mousemove:T=>{(this.getLayer(a)?this.queryRenderedFeatures(T.point,{layers:[a]}):[]).length?m=!0:m&&(m=!1,f.call(this,new Co(y,this,T.originalEvent)))},mouseout:T=>{m&&(m=!1,f.call(this,new Co(y,this,T.originalEvent)))}}}}{const m=g=>{const b=this.getLayer(a)?this.queryRenderedFeatures(g.point,{layers:[a]}):[];b.length&&(g.features=b,f.call(this,g),delete g.features)};return{layer:a,listener:f,delegates:{[y]:m}}}}on(y,a,f){if(f===void 0)return super.on(y,a);const m=this._createDelegatedListener(y,a,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(y,a,f){if(f===void 0)return super.once(y,a);const m=this._createDelegatedListener(y,a,f);for(const g in m.delegates)this.once(g,m.delegates[g]);return this}off(y,a,f){return f===void 0?super.off(y,a):(this._delegatedListeners&&this._delegatedListeners[y]&&(m=>{const g=this._delegatedListeners[y];for(let b=0;bthis._updateStyle(y,a));const f=this.style&&a.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Wo(this,a||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,a,f):this.style.loadJSON(y,a,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Wo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,a){if(typeof y=="string"){const f=this._requestManager.transformRequest(y,"Style");l.h(f,new AbortController).then(m=>{this._updateDiff(m.data,a)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof y=="object"&&this._updateDiff(y,a)}_updateDiff(y,a){try{this.style.setState(y,a)&&this._update(!0)}catch(f){l.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(y,a)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(y,a){return this._lazyInitEmptyStyle(),this.style.addSource(y,a),this._update(!0)}isSourceLoaded(y){const a=this.style&&this.style.sourceCaches[y];if(a!==void 0)return a.loaded();this.fire(new l.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 a=this.style.sourceCaches[y.source];if(!a)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&a.reload();for(const f in this.style._layers){const m=this.style._layers[f];m.type==="hillshade"&&m.source===y.source&&l.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 hg(this.painter,a,y),this.painter.renderToTexture=new Gp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=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(f.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:y})),this}getTerrain(){var y,a;return(a=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&a!==void 0?a:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const a in y){const f=y[a]._tiles;for(const m in f){const g=f[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,a,f={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:b,stretchY:T,content:L}=f;if(this._lazyInitEmptyStyle(),!(a instanceof HTMLImageElement||l.b(a))){if(a.width===void 0||a.height===void 0)return this.fire(new l.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:A,height:N,data:V}=a,j=a;return this.style.addImage(y,{data:new l.R({width:A,height:N},new Uint8Array(V)),pixelRatio:m,stretchX:b,stretchY:T,content:L,sdf:g,version:0,userImage:j}),j.onAdd&&j.onAdd(this,y),this}}{const{width:A,height:N,data:V}=E.getImageData(a);this.style.addImage(y,{data:new l.R({width:A,height:N},V),pixelRatio:m,stretchX:b,stretchY:T,content:L,sdf:g,version:0})}}updateImage(y,a){const f=this.style.getImage(y);if(!f)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=a instanceof HTMLImageElement||l.b(a)?E.getImageData(a):a,{width:g,height:b,data:T}=m;if(g===void 0||b===void 0)return this.fire(new l.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!==f.data.width||b!==f.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(a instanceof HTMLImageElement||l.b(a));return f.data.replace(T,L),this.style.updateImage(y,f),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return G.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,a){return this._lazyInitEmptyStyle(),this.style.addLayer(y,a),this._update(!0)}moveLayer(y,a){return this.style.moveLayer(y,a),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,a,f){return this.style.setLayerZoomRange(y,a,f),this._update(!0)}setFilter(y,a,f={}){return this.style.setFilter(y,a,f),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,a,f,m={}){return this.style.setPaintProperty(y,a,f,m),this._update(!0)}getPaintProperty(y,a){return this.style.getPaintProperty(y,a)}setLayoutProperty(y,a,f,m={}){return this.style.setLayoutProperty(y,a,f,m),this._update(!0)}getLayoutProperty(y,a){return this.style.getLayoutProperty(y,a)}setGlyphs(y,a={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,a),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,a,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,a,f,m=>{m||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,a={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,a,f=>{f||this._update(!0)}),this}setLight(y,a={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,a),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,a){return this.style.setFeatureState(y,a),this._update()}removeFeatureState(y,a){return this.style.removeFeatureState(y,a),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,a=0;return this._container&&(y=this._container.clientWidth||400,a=this._container.clientHeight||300),[y,a]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const a=this._canvasContainer=C.create("div","maplibregl-canvas-container",y);this._interactive&&a.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",a),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 f=this._containerDimensions(),m=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],m);const g=this._controlContainer=C.create("div","maplibregl-control-container",y),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(T=>{b[T]=C.create("div",`maplibregl-ctrl-${T} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,a,f){this._canvas.width=Math.floor(f*y),this._canvas.height=Math.floor(f*a),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${a}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let a=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{a={requestedAttributes:y},m&&(a.statusMessage=m.statusMessage,a.type=m.type)},{once:!0});const f=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!f){const m="Failed to initialize WebGL";throw a?(a.message=m,new Error(JSON.stringify(a))):new Error(m)}this.painter=new Jm(f,this.transform),M.testSupport(f)}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 a=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,b=E.now();this.style.zoomHistory.update(g,b);const T=new l.a8(g,{now:b,fadeDuration:a,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=T.crossFadingFactor();L===1&&L===this._crossFadingFactor||(f=!0,this._crossFadingFactor=L),this.style.update(T)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=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.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,a,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:a,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bc.mark(l.bd.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bc.mark(l.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),G.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bc.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(y=>{l.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}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 Wp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=Co,c.MapTouchEvent=ea,c.MapWheelEvent=zp,c.Marker=Fc,c.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const a=this._map.getZoom(),f=a===this._map.getMaxZoom(),m=a===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const a=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=a},this._setButtonTitle=(a,f)=>{const m=this._map._getUIString(`NavigationControl.${f}`);a.title=m,a.setAttribute("aria-label",m)},this.options=l.e({},Hp,y),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",a=>this._map.zoomIn({},{originalEvent:a})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",a=>this._map.zoomOut({},{originalEvent:a})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",a=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:a}):this._map.resetNorth({},{originalEvent:a})}),this._compassIcon=C.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 Zp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.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,a){const f=C.create("button",y,this._container);return f.type="button",f.addEventListener("click",a),f}},c.Popup=class extends l.E{constructor(y){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=a=>{this._update(a.point)},this._onMouseMove=a=>{this._update(a.point)},this._onDrag=a=>{this._update(a.point)},this._update=a=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const L of this.options.className.split(" "))this._container.classList.add(L);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?$h(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!a)return;const m=this._flatPos=this._pos=this._trackPointer&&a?a:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&a?a:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const b=ef(this.options.offset);if(!g){const L=this._container.offsetWidth,A=this._container.offsetHeight;let N;N=m.y+b.bottom.ythis._map.transform.height-A?["bottom"]:[],m.xthis._map.transform.width-L/2&&N.push("right"),g=N.length===0?"bottom":N.join("-")}let T=m.add(b[g]);this.options.subpixelPositioning||(T=T.round()),C.setTransform(this._container,`${zc[g]} translate(${T.x}px,${T.y}px)`),Yh(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Xp),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 l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=l.M.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const a=document.createDocumentFragment(),f=document.createElement("body");let m;for(f.innerHTML=y;m=f.firstChild,m;)a.appendChild(m);return this.setDOMContent(a)}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=C.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)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.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($p);y&&y.focus()}},c.RasterDEMTileSource=on,c.RasterTileSource=Re,c.ScaleControl=class{constructor(y){this._onMove=()=>{Qh(this._map,this._container,this.options)},this.setUnit=a=>{this.options.unit=a,Qh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Jh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Hh,c.Style=Wo,c.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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.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(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=sg,c.TwoFingersTouchRotateHandler=Bp,c.TwoFingersTouchZoomHandler=og,c.TwoFingersTouchZoomRotateHandler=kc,c.VectorTileSource=kt,c.VideoSource=Go,c.addSourceType=(y,a)=>l._(void 0,void 0,void 0,function*(){if(tl(y))throw new Error(`A source type called "${y}" already exists.`);((f,m)=>{Ks[f]=m})(y,a)}),c.clearPrewarmedResources=function(){const y=Jt;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Tt),Jt=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()"))},c.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return lt().getRTLTextPluginStatus()},c.getVersion=function(){return fg},c.getWorkerCount=function(){return tn.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(y){return Nr().broadcast("IS",y)},c.prewarm=function(){Nn().acquire(Tt)},c.setMaxParallelImageRequests=function(y){l.a.MAX_PARALLEL_IMAGE_REQUESTS=y},c.setRTLTextPlugin=function(y,a){return lt().setRTLTextPlugin(y,a)},c.setWorkerCount=function(y){tn.workerCount=y},c.setWorkerUrl=function(y){l.a.WORKER_URL=y}});var s=n;return s})})(qE);var ey=qE.exports;const Bs=d1(ey),mf=[];function R0(t,e){return{subscribe:Fn(t,e).subscribe}}function Fn(t,e=Ct){let n;const r=new Set;function i(l){if(Ut(t,l)&&(t=l,n)){const d=!mf.length;for(const v of r)v[1](),mf.push(v,t);if(d){for(let v=0;v{r.delete(v),r.size===0&&n&&(n(),n=null)}}return{set:i,update:s,subscribe:c}}let $t;const HE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&HE.decode();let Md=null;function Vd(){return(Md===null||Md.byteLength===0)&&(Md=new Uint8Array($t.memory.buffer)),Md}function vl(t,e){return t=t>>>0,HE.decode(Vd().subarray(t,t+e))}const ru=new Array(128).fill(void 0);ru.push(void 0,null,!0,!1);let Ud=ru.length;function Ui(t){Ud===ru.length&&ru.push(ru.length+1);const e=Ud;return Ud=ru[e],ru[e]=t,e}function Mn(t){return ru[t]}function hM(t){t<132||(ru[t]=Ud,Ud=t)}function Kg(t){const e=Mn(t);return hM(t),e}function N0(t){return t==null}let Ad=null;function fM(){return(Ad===null||Ad.byteLength===0)&&(Ad=new Float64Array($t.memory.buffer)),Ad}let kd=null;function mr(){return(kd===null||kd.byteLength===0)&&(kd=new Int32Array($t.memory.buffer)),kd}let Xu=0;const Jg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},pM=typeof Jg.encodeInto=="function"?function(t,e){return Jg.encodeInto(t,e)}:function(t,e){const n=Jg.encode(t);return e.set(n),{read:t.length,written:n.length}};function Og(t,e,n){if(n===void 0){const l=Jg.encode(t),d=e(l.length,1)>>>0;return Vd().subarray(d,d+l.length).set(l),Xu=l.length,d}let r=t.length,i=e(r,1)>>>0;const s=Vd();let c=0;for(;c127)break;s[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=Vd().subarray(i+c,i+r),d=pM(t,l);c+=d.written}return Xu=c,i}function mv(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=mv(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:r}function dM(t,e){const n=e(t.length*1,1)>>>0;return Vd().set(t,n/1),Xu=t.length,n}function O0(t,e){try{return t.apply(this,e)}catch(n){$t.__wbindgen_exn_store(Ui(n))}}class p_{static __wrap(e){e=e>>>0;const n=Object.create(p_.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();$t.__wbg_jsroutesnapper_free(e)}constructor(e){try{const s=$t.__wbindgen_add_to_stack_pointer(-16),c=dM(e,$t.__wbindgen_malloc),l=Xu;$t.jsroutesnapper_new(s,c,l);var n=mr()[s/4+0],r=mr()[s/4+1],i=mr()[s/4+2];if(i)throw Kg(r);return p_.__wrap(n)}finally{$t.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){$t.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Ui(e))}setAreaMode(){$t.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_getConfig(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}toFinalFeature(){try{const r=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_toFinalFeature(r,this.__wbg_ptr);var e=mr()[r/4+0],n=mr()[r/4+1];let i;return e!==0&&(i=vl(e,n).slice(),$t.__wbindgen_free(e,n*1)),i}finally{$t.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_renderGeojson(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}toggleSnapMode(){$t.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,n,r){return $t.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,n,r)!==0}onClick(){$t.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return $t.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return $t.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){$t.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const i=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_editExisting(i,this.__wbg_ptr,Ui(e));var n=mr()[i/4+0],r=mr()[i/4+1];if(r)throw Kg(n)}finally{$t.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_debugRenderGraph(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}debugSnappableNodes(){let e,n;try{const s=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_debugSnappableNodes(s,this.__wbg_ptr);var r=mr()[s/4+0],i=mr()[s/4+1];return e=r,n=i,vl(r,i)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(e,n,1)}}routeNameForWaypoints(e){let n,r;try{const S=$t.__wbindgen_add_to_stack_pointer(-16);$t.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Ui(e));var i=mr()[S/4+0],s=mr()[S/4+1],c=mr()[S/4+2],l=mr()[S/4+3],d=i,v=s;if(l)throw d=0,v=0,Kg(c);return n=d,r=v,vl(d,v)}finally{$t.__wbindgen_add_to_stack_pointer(16),$t.__wbindgen_free(n,r,1)}}addSnappedWaypoint(e,n){$t.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,n)}undo(){$t.jsroutesnapper_undo(this.__wbg_ptr)}}async function mM(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.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",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function gM(){const t={};return t.wbg={},t.wbg.__wbindgen_string_new=function(e,n){const r=vl(e,n);return Ui(r)},t.wbg.__wbindgen_object_drop_ref=function(e){Kg(e)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(vl(e,n));return Ui(r)},t.wbg.__wbindgen_is_object=function(e){const n=Mn(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return Mn(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return Mn(e)in Mn(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=Mn(n),i=typeof r=="number"?r:void 0;fM()[e/8+1]=N0(i)?0:i,mr()[e/4+0]=!N0(i)},t.wbg.__wbindgen_boolean_get=function(e){const n=Mn(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return Mn(e)==Mn(n)},t.wbg.__wbindgen_string_get=function(e,n){const r=Mn(n),i=typeof r=="string"?r:void 0;var s=N0(i)?0:Og(i,$t.__wbindgen_malloc,$t.__wbindgen_realloc),c=Xu;mr()[e/4+1]=c,mr()[e/4+0]=s},t.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,n){const r=Mn(e)[Mn(n)];return Ui(r)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=Mn(e);return Ui(n)},t.wbg.__wbg_String_4370c5505c674d30=function(e,n){const r=String(Mn(n)),i=Og(r,$t.__wbindgen_malloc,$t.__wbindgen_realloc),s=Xu;mr()[e/4+1]=s,mr()[e/4+0]=i},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ui(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=Mn(n).stack,i=Og(r,$t.__wbindgen_malloc,$t.__wbindgen_realloc),s=Xu;mr()[e/4+1]=s,mr()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(vl(e,n))}finally{$t.__wbindgen_free(r,i,1)}},t.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(Mn(e))},t.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(Mn(e))},t.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(Mn(e))},t.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(Mn(e))},t.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(Mn(e))},t.wbg.__wbg_get_44be0491f933a435=function(e,n){const r=Mn(e)[n>>>0];return Ui(r)},t.wbg.__wbg_length_fff51ee6522a1a18=function(e){return Mn(e).length},t.wbg.__wbindgen_is_function=function(e){return typeof Mn(e)=="function"},t.wbg.__wbg_next_526fc47e980da008=function(e){const n=Mn(e).next;return Ui(n)},t.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return O0(function(e){const n=Mn(e).next();return Ui(n)},arguments)},t.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return Mn(e).done},t.wbg.__wbg_value_1695675138684bd5=function(e){const n=Mn(e).value;return Ui(n)},t.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Ui(Symbol.iterator)},t.wbg.__wbg_get_97b561fb56f034b5=function(){return O0(function(e,n){const r=Reflect.get(Mn(e),Mn(n));return Ui(r)},arguments)},t.wbg.__wbg_call_cb65541d95d71282=function(){return O0(function(e,n){const r=Mn(e).call(Mn(n));return Ui(r)},arguments)},t.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(Mn(e))},t.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let n;try{n=Mn(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const n=Mn(e).buffer;return Ui(n)},t.wbg.__wbg_new_8125e318e6245eed=function(e){const n=new Uint8Array(Mn(e));return Ui(n)},t.wbg.__wbg_set_5cf90238115182c3=function(e,n,r){Mn(e).set(Mn(n),r>>>0)},t.wbg.__wbg_length_72e2208bbc0efc61=function(e){return Mn(e).length},t.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let n;try{n=Mn(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const r=mv(Mn(n)),i=Og(r,$t.__wbindgen_malloc,$t.__wbindgen_realloc),s=Xu;mr()[e/4+1]=s,mr()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(vl(e,n))},t.wbg.__wbindgen_memory=function(){const e=$t.memory;return Ui(e)},t}function _M(t,e){return $t=t.exports,ZE.__wbindgen_wasm_module=e,Ad=null,kd=null,Md=null,$t}async function ZE(t){if($t!==void 0)return $t;typeof t>"u"&&(t="/ltn/assets/route_snapper_bg.wasm");const e=gM();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await mM(await t,e);return _M(n,r)}var Ro=63710088e-1,m1={centimeters:Ro*100,centimetres:Ro*100,degrees:Ro/111325,feet:Ro*3.28084,inches:Ro*39.37,kilometers:Ro/1e3,kilometres:Ro/1e3,meters:Ro,metres:Ro,miles:Ro/1609.344,millimeters:Ro*1e3,millimetres:Ro*1e3,nauticalmiles:Ro/1852,radians:1,yards:Ro*1.0936},yM={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/Ro,yards:1.0936133},gv={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 ga(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function vM(t,e,n){switch(t){case"Point":return _s(e).geometry;case"LineString":return ha(e).geometry;case"Polygon":return g1(e).geometry;case"MultiPoint":return $E(e).geometry;case"MultiLineString":return XE(e).geometry;case"MultiPolygon":return YE(e).geometry;default:throw new Error(t+" is invalid")}}function _s(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d_(t[0])||!d_(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ga(r,e,n)}function bM(t,e,n){return n===void 0&&(n={}),Zc(t.map(function(r){return _s(r,e)}),n)}function g1(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function _1(t,e){e===void 0&&(e="kilometers");var n=m1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function ty(t,e){e===void 0&&(e="kilometers");var n=m1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function IM(t,e){return $d(ty(t,e))}function CM(t){var e=t%360;return e<0&&(e+=360),e}function $d(t){var e=t%(2*Math.PI);return e*180/Math.PI}function fa(t){var e=t%360;return e*Math.PI/180}function TM(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return _1(ty(t,e),n)}function LM(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=gv[e];if(!r)throw new Error("invalid original units");var i=gv[n];if(!i)throw new Error("invalid final units");return t/r*i}function d_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function y1(t){return!!t&&t.constructor===Object}function PM(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!d_(e))throw new Error("bbox must only contain numbers")})}function MM(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const AM=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:gv,bearingToAzimuth:CM,convertArea:LM,convertLength:TM,degreesToRadians:fa,earthRadius:Ro,factors:m1,feature:ga,featureCollection:Zc,geometry:vM,geometryCollection:SM,isNumber:d_,isObject:y1,lengthToDegrees:IM,lengthToRadians:ty,lineString:ha,lineStrings:wM,multiLineString:XE,multiPoint:$E,multiPolygon:YE,point:_s,points:bM,polygon:g1,polygons:xM,radiansToDegrees:$d,radiansToLength:_1,round:EM,unitsFactors:yM,validateBBox:PM,validateId:MM},Symbol.toStringTag,{value:"Module"}));function Yd(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Af(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function yd(t,e,n){n===void 0&&(n={});var r=Yd(t),i=Yd(e),s=fa(i[1]-r[1]),c=fa(i[0]-r[0]),l=fa(r[1]),d=fa(i[1]),v=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return _1(2*Math.atan2(Math.sqrt(v),Math.sqrt(1-v)),n.units)}function ym(t,e,n){if(t!==null)for(var r,i,s,c,l,d,v,S=0,E=0,C,M=t.type,k=M==="FeatureCollection",R=M==="Feature",F=k?t.features.length:1,U=0;Ud||k>v||R>S){l=E,d=r,v=k,S=R,s=0;return}var F=ha([l,E],n.properties);if(e(F,r,i,R,s)===!1)return!1;s++,l=E})===!1)return!1}}})}function FM(t,e,n){var r=n,i=!1;return JE(t,function(s,c,l,d,v){i===!1&&n===void 0?r=s:r=e(r,s,c,l,d,v),i=!0}),r}function QE(t,e){if(!t)throw new Error("geojson is required");ap(t,function(n,r,i){if(n.geometry!==null){var s=n.geometry.type,c=n.geometry.coordinates;switch(s){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;li?n:i,v=r>s?r:s;return[c,l,d,v]}var b1={exports:{}},tI={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(_m,function(){function n(z,G,q,X,de){(function ae(le,ye,ke,Q,oe){for(;Q>ke;){if(Q-ke>600){var qe=Q-ke+1,Pe=ye-ke+1,it=Math.log(qe),ft=.5*Math.exp(2*it/3),Xe=.5*Math.sqrt(it*ft*(qe-ft)/qe)*(Pe-qe/2<0?-1:1),Mt=Math.max(ke,Math.floor(ye-Pe*ft/qe+Xe)),At=Math.min(Q,Math.floor(ye+(qe-Pe)*ft/qe+Xe));ae(le,ye,Mt,At,oe)}var yt=le[ye],zt=ke,Tt=Q;for(r(le,ke,ye),oe(le[Q],yt)>0&&r(le,ke,Q);zt0;)Tt--}oe(le[ke],yt)===0?r(le,ke,Tt):r(le,++Tt,Q),Tt<=ye&&(ke=Tt+1),ye<=Tt&&(Q=Tt-1)}})(z,G,q||0,X||z.length-1,de||i)}function r(z,G,q){var X=z[G];z[G]=z[q],z[q]=X}function i(z,G){return zG?1:0}var s=function(z){z===void 0&&(z=9),this._maxEntries=Math.max(4,z),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(z,G,q){if(!q)return G.indexOf(z);for(var X=0;X=z.minX&&G.maxY>=z.minY}function F(z){return{children:z,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function U(z,G,q,X,de){for(var ae=[G,q];ae.length;)if(!((q=ae.pop())-(G=ae.pop())<=X)){var le=G+Math.ceil((q-G)/X/2)*X;n(z,le,G,q,de),ae.push(G,le,le,q)}}return s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(z){var G=this.data,q=[];if(!R(z,G))return q;for(var X=this.toBBox,de=[];G;){for(var ae=0;ae=0&&de[G].children.length>this._maxEntries;)this._split(de,G),G--;this._adjustParentBBoxes(X,de,G)},s.prototype._split=function(z,G){var q=z[G],X=q.children.length,de=this._minEntries;this._chooseSplitAxis(q,de,X);var ae=this._chooseSplitIndex(q,de,X),le=F(q.children.splice(ae,q.children.length-ae));le.height=q.height,le.leaf=q.leaf,l(q,this.toBBox),l(le,this.toBBox),G?z[G-1].children.push(le):this._splitRoot(q,le)},s.prototype._splitRoot=function(z,G){this.data=F([z,G]),this.data.height=z.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(z,G,q){for(var X,de,ae,le,ye,ke,Q,oe=1/0,qe=1/0,Pe=G;Pe<=q-G;Pe++){var it=d(z,0,Pe,this.toBBox),ft=d(z,Pe,q,this.toBBox),Xe=(de=it,ae=ft,le=void 0,ye=void 0,ke=void 0,Q=void 0,le=Math.max(de.minX,ae.minX),ye=Math.max(de.minY,ae.minY),ke=Math.min(de.maxX,ae.maxX),Q=Math.min(de.maxY,ae.maxY),Math.max(0,ke-le)*Math.max(0,Q-ye)),Mt=C(it)+C(ft);Xe=G;oe--){var qe=z.children[oe];v(le,z.leaf?de(qe):qe),ye+=M(le)}return ye},s.prototype._adjustParentBBoxes=function(z,G,q){for(var X=q;X>=0;X--)v(G[X],z)},s.prototype._condense=function(z){for(var G=z.length-1,q=void 0;G>=0;G--)z[G].children.length===0?G>0?(q=z[G-1].children).splice(q.indexOf(z[G]),1):this.clear():l(z[G],this.toBBox)},s})})(tI);var ZM=tI.exports;const XM=Q_(AM),$M=Q_(jM);var Kx=Object.prototype.toString,nI=function(e){var n=Kx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Kx.call(e.callee)==="[object Function]"),r},z0,Jx;function YM(){if(Jx)return z0;Jx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=nI,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(C){var M=C.constructor;return M&&M.prototype===C},v={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var C in window)try{if(!v["$"+C]&&e.call(window,C)&&window[C]!==null&&typeof window[C]=="object")try{d(window[C])}catch{return!0}}catch{return!0}return!1}(),E=function(C){if(typeof window>"u"||!S)return d(C);try{return d(C)}catch{return!1}};t=function(M){var k=M!==null&&typeof M=="object",R=n.call(M)==="[object Function]",F=r(M),U=k&&n.call(M)==="[object String]",z=[];if(!k&&!R&&!F)throw new TypeError("Object.keys called on a non-object");var G=c&&R;if(U&&M.length>0&&!e.call(M,0))for(var q=0;q0)for(var X=0;X"u"||!Ki?qn:Ki(Uint8Array),Hc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?qn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?qn:ArrayBuffer,"%ArrayIteratorPrototype%":gf&&Ki?Ki([][Symbol.iterator]()):qn,"%AsyncFromSyncIteratorPrototype%":qn,"%AsyncFunction%":Sf,"%AsyncGenerator%":Sf,"%AsyncGeneratorFunction%":Sf,"%AsyncIteratorPrototype%":Sf,"%Atomics%":typeof Atomics>"u"?qn:Atomics,"%BigInt%":typeof BigInt>"u"?qn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?qn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?qn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?qn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":yA,"%eval%":eval,"%EvalError%":vA,"%Float32Array%":typeof Float32Array>"u"?qn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?qn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?qn:FinalizationRegistry,"%Function%":oI,"%GeneratorFunction%":Sf,"%Int8Array%":typeof Int8Array>"u"?qn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?qn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?qn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":gf&&Ki?Ki(Ki([][Symbol.iterator]())):qn,"%JSON%":typeof JSON=="object"?JSON:qn,"%Map%":typeof Map>"u"?qn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!gf||!Ki?qn:Ki(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?qn:Promise,"%Proxy%":typeof Proxy>"u"?qn:Proxy,"%RangeError%":bA,"%ReferenceError%":xA,"%Reflect%":typeof Reflect>"u"?qn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?qn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!gf||!Ki?qn:Ki(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?qn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":gf&&Ki?Ki(""[Symbol.iterator]()):qn,"%Symbol%":gf?Symbol:qn,"%SyntaxError%":kf,"%ThrowTypeError%":SA,"%TypedArray%":IA,"%TypeError%":Pf,"%Uint8Array%":typeof Uint8Array>"u"?qn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?qn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?qn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?qn:Uint32Array,"%URIError%":wA,"%WeakMap%":typeof WeakMap>"u"?qn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?qn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?qn:WeakSet};if(Ki)try{null.error}catch(t){var CA=Ki(Ki(t));Hc["%Error.prototype%"]=CA}var TA=function t(e){var n;if(e==="%AsyncFunction%")n=B0("async function () {}");else if(e==="%GeneratorFunction%")n=B0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=B0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Ki&&(n=Ki(i.prototype))}return Hc[e]=n,n},rw={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vm=S1,g_=iI,LA=vm.call(Function.call,Array.prototype.concat),PA=vm.call(Function.apply,Array.prototype.splice),iw=vm.call(Function.call,String.prototype.replace),__=vm.call(Function.call,String.prototype.slice),MA=vm.call(Function.call,RegExp.prototype.exec),AA=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kA=/\\(\\)?/g,DA=function(e){var n=__(e,0,1),r=__(e,-1);if(n==="%"&&r!=="%")throw new kf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new kf("invalid intrinsic syntax, expected opening `%`");var i=[];return iw(e,AA,function(s,c,l,d){i[i.length]=l?iw(d,kA,"$1"):c||s}),i},RA=function(e,n){var r=e,i;if(g_(rw,r)&&(i=rw[r],r="%"+i[0]+"%"),g_(Hc,r)){var s=Hc[r];if(s===Sf&&(s=TA(r)),typeof s>"u"&&!n)throw new Pf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new kf("intrinsic "+e+" does not exist!")},Dl=function(e,n){if(typeof e!="string"||e.length===0)throw new Pf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Pf('"allowMissing" argument must be a boolean');if(MA(/^%?[^%]*%?$/,e)===null)throw new kf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=DA(e),i=r.length>0?r[0]:"",s=RA("%"+i+"%",n),c=s.name,l=s.value,d=!1,v=s.alias;v&&(i=v[0],PA(r,LA([0,1],v)));for(var S=1,E=!0;S=r.length){var R=Wc(l,C);E=!!R,E&&"get"in R&&!("originalValue"in R.get)?l=R.get:l=l[C]}else E=g_(l,C),l=l[C];E&&!d&&(Hc[c]=l)}}return l},U0,ow;function E1(){if(ow)return U0;ow=1;var t=Dl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return U0=e,U0}var NA=Dl,e_=NA("%Object.getOwnPropertyDescriptor%",!0);if(e_)try{e_([],"length")}catch{e_=null}var I1=e_,sw=E1(),OA=rI,_f=cc,aw=I1,C1=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new _f("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new _f("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _f("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _f("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _f("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _f("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,d=!!aw&&aw(e,n);if(sw)sw(e,n,{configurable:c===null&&d?d.configurable:!c,enumerable:i===null&&d?d.enumerable:!i,value:r,writable:s===null&&d?d.writable:!s});else if(l||!i&&!s&&!c)e[n]=r;else throw new OA("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_v=E1(),sI=function(){return!!_v};sI.hasArrayLengthDefineBug=function(){if(!_v)return null;try{return _v([],"length",{value:1}).length!==1}catch{return!0}};var T1=sI,zA=x1,FA=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",BA=Object.prototype.toString,VA=Array.prototype.concat,lw=C1,UA=function(t){return typeof t=="function"&&BA.call(t)==="[object Function]"},aI=T1(),jA=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!UA(r)||!r())return}aI?lw(t,e,n,!0):lw(t,e,n)},lI=function(t,e){var n=arguments.length>2?arguments[2]:{},r=zA(e);FA&&(r=VA.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||WA(n)!==n)throw new hw("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&cw){var c=cw(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(s=!1)}return(i||s||!r)&&(qA?uw(e,"length",n,!0,!0):uw(e,"length",n)),e};(function(t){var e=S1,n=Dl,r=HA,i=cc,s=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,s),d=E1(),v=n("%Math.max%");t.exports=function(C){if(typeof C!="function")throw new i("a function is required");var M=l(e,c,arguments);return r(M,1+v(0,C.length-(arguments.length-1)),!0)};var S=function(){return l(e,s,arguments)};d?d(t.exports,"apply",{value:S}):t.exports.apply=S})(uI);var lp=uI.exports,cI=Dl,hI=lp,ZA=hI(cI("String.prototype.indexOf")),Ta=function(e,n){var r=cI(e,!!n);return typeof r=="function"&&ZA(e,".prototype.")>-1?hI(r):r},XA=x1,fI=ny(),pI=Ta,fw=Object,$A=pI("Array.prototype.push"),pw=pI("Object.prototype.propertyIsEnumerable"),YA=fI?Object.getOwnPropertySymbols:null,dI=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=fw(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||hk)&&(ck?dw(e,"name",n,!0,!0):dw(e,"name",n)),e},dk=pk,mk=cc,gk=Object,yI=dk(function(){if(this==null||this!==gk(this))throw new mk("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),_k=yI,yk=uh.supportsDescriptors,vk=Object.getOwnPropertyDescriptor,vI=function(){if(yk&&/a/mig.flags==="gim"){var e=vk(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return _k},bk=uh.supportsDescriptors,xk=vI,wk=Object.getOwnPropertyDescriptor,Sk=Object.defineProperty,Ek=TypeError,mw=Object.getPrototypeOf,Ik=/a/,Ck=function(){if(!bk||!mw)throw new Ek("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=xk(),n=mw(Ik),r=wk(n,"flags");return(!r||r.get!==e)&&Sk(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},Tk=uh,Lk=lp,Pk=yI,bI=vI,Mk=Ck,xI=Lk(bI());Tk(xI,{getPolyfill:bI,implementation:Pk,shim:Mk});var Ak=xI,t_={exports:{}},kk=ny,ch=function(){return kk()&&!!Symbol.toStringTag},Dk=ch(),Rk=Ta,yv=Rk("Object.prototype.toString"),ry=function(e){return Dk&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:yv(e)==="[object Arguments]"},wI=function(e){return ry(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&yv(e)!=="[object Array]"&&yv(e.callee)==="[object Function]"},Nk=function(){return ry(arguments)}();ry.isLegacyArguments=wI;var SI=Nk?ry:wI;const Ok={},zk=Object.freeze(Object.defineProperty({__proto__:null,default:Ok},Symbol.toStringTag,{value:"Module"})),Fk=Q_(zk);var L1=typeof Map=="function"&&Map.prototype,G0=Object.getOwnPropertyDescriptor&&L1?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,y_=L1&&G0&&typeof G0.get=="function"?G0.get:null,gw=L1&&Map.prototype.forEach,P1=typeof Set=="function"&&Set.prototype,q0=Object.getOwnPropertyDescriptor&&P1?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,v_=P1&&q0&&typeof q0.get=="function"?q0.get:null,_w=P1&&Set.prototype.forEach,Bk=typeof WeakMap=="function"&&WeakMap.prototype,Gd=Bk?WeakMap.prototype.has:null,Vk=typeof WeakSet=="function"&&WeakSet.prototype,qd=Vk?WeakSet.prototype.has:null,Uk=typeof WeakRef=="function"&&WeakRef.prototype,yw=Uk?WeakRef.prototype.deref:null,jk=Boolean.prototype.valueOf,Gk=Object.prototype.toString,qk=Function.prototype.toString,Wk=String.prototype.match,M1=String.prototype.slice,$u=String.prototype.replace,Hk=String.prototype.toUpperCase,vw=String.prototype.toLowerCase,EI=RegExp.prototype.test,bw=Array.prototype.concat,bl=Array.prototype.join,Zk=Array.prototype.slice,xw=Math.floor,vv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,W0=Object.getOwnPropertySymbols,bv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Df=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Fo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Df||"symbol")?Symbol.toStringTag:null,II=Object.prototype.propertyIsEnumerable,ww=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Sw(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||EI.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-xw(-t):xw(t);if(r!==t){var i=String(r),s=M1.call(e,i.length+1);return $u.call(i,n,"$&_")+"."+$u.call($u.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $u.call(e,n,"$&_")}var xv=Fk,Ew=xv.custom,Iw=TI(Ew)?Ew:null,Xk=function t(e,n,r,i){var s=n||{};if(Hu(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Hu(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=Hu(s,"customInspect")?s.customInspect:!0;if(typeof c!="boolean"&&c!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Hu(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Hu(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return PI(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var d=String(e);return l?Sw(e,d):d}if(typeof e=="bigint"){var v=String(e)+"n";return l?Sw(e,v):v}var S=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof e=="object")return wv(e)?"[Array]":"[Object]";var E=f3(s,r);if(typeof i>"u")i=[];else if(LI(i,e)>=0)return"[Circular]";function C(qe,Pe,it){if(Pe&&(i=Zk.call(i),i.push(Pe)),it){var ft={depth:s.depth};return Hu(s,"quoteStyle")&&(ft.quoteStyle=s.quoteStyle),t(qe,ft,r+1,i)}return t(qe,s,r+1,i)}if(typeof e=="function"&&!Cw(e)){var M=r3(e),k=zg(e,C);return"[Function"+(M?": "+M:" (anonymous)")+"]"+(k.length>0?" { "+bl.call(k,", ")+" }":"")}if(TI(e)){var R=Df?$u.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):bv.call(e);return typeof e=="object"&&!Df?vd(R):R}if(u3(e)){for(var F="<"+vw.call(String(e.nodeName)),U=e.attributes||[],z=0;z",F}if(wv(e)){if(e.length===0)return"[]";var G=zg(e,C);return E&&!h3(G)?"["+Sv(G,E)+"]":"[ "+bl.call(G,", ")+" ]"}if(Kk(e)){var q=zg(e,C);return!("cause"in Error.prototype)&&"cause"in e&&!II.call(e,"cause")?"{ ["+String(e)+"] "+bl.call(bw.call("[cause]: "+C(e.cause),q),", ")+" }":q.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+bl.call(q,", ")+" }"}if(typeof e=="object"&&c){if(Iw&&typeof e[Iw]=="function"&&xv)return xv(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(i3(e)){var X=[];return gw&&gw.call(e,function(qe,Pe){X.push(C(Pe,e,!0)+" => "+C(qe,e))}),Tw("Map",y_.call(e),X,E)}if(a3(e)){var de=[];return _w&&_w.call(e,function(qe){de.push(C(qe,e))}),Tw("Set",v_.call(e),de,E)}if(o3(e))return H0("WeakMap");if(l3(e))return H0("WeakSet");if(s3(e))return H0("WeakRef");if(Qk(e))return vd(C(Number(e)));if(t3(e))return vd(C(vv.call(e)));if(e3(e))return vd(jk.call(e));if(Jk(e))return vd(C(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===_m)return"{ [object globalThis] }";if(!Yk(e)&&!Cw(e)){var ae=zg(e,C),le=ww?ww(e)===Object.prototype:e instanceof Object||e.constructor===Object,ye=e instanceof Object?"":"null prototype",ke=!le&&Fo&&Object(e)===e&&Fo in e?M1.call(hc(e),8,-1):ye?"Object":"",Q=le||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",oe=Q+(ke||ye?"["+bl.call(bw.call([],ke||[],ye||[]),": ")+"] ":"");return ae.length===0?oe+"{}":E?oe+"{"+Sv(ae,E)+"}":oe+"{ "+bl.call(ae,", ")+" }"}return String(e)};function CI(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function $k(t){return $u.call(String(t),/"/g,""")}function wv(t){return hc(t)==="[object Array]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Yk(t){return hc(t)==="[object Date]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Cw(t){return hc(t)==="[object RegExp]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Kk(t){return hc(t)==="[object Error]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Jk(t){return hc(t)==="[object String]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function Qk(t){return hc(t)==="[object Number]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function e3(t){return hc(t)==="[object Boolean]"&&(!Fo||!(typeof t=="object"&&Fo in t))}function TI(t){if(Df)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!bv)return!1;try{return bv.call(t),!0}catch{}return!1}function t3(t){if(!t||typeof t!="object"||!vv)return!1;try{return vv.call(t),!0}catch{}return!1}var n3=Object.prototype.hasOwnProperty||function(t){return t in this};function Hu(t,e){return n3.call(t,e)}function hc(t){return Gk.call(t)}function r3(t){if(t.name)return t.name;var e=Wk.call(qk.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function LI(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return PI(M1.call(t,0,e.maxStringLength),e)+r}var i=$u.call($u.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,c3);return CI(i,"single",e)}function c3(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+Hk.call(e.toString(16))}function vd(t){return"Object("+t+")"}function H0(t){return t+" { ? }"}function Tw(t,e,n,r){var i=r?Sv(n,r):bl.call(n,", ");return t+" ("+e+") {"+i+"}"}function h3(t){for(var e=0;e=0)return!1;return!0}function f3(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=bl.call(Array(t.indent+1)," ");else return null;return{base:n,prev:bl.call(Array(e+1),n)}}function Sv(t,e){if(t.length===0)return"";var n=` `+e.prev+e.base;return n+bl.call(t,","+n)+` -`+e.prev}function zg(t,e){var n=wv(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=Nw(e,n);if(i<55296||i>56319)return n+1;var s=Nw(e,n+1);return s<56320||s>57343?n+1:n+2},X0=function(e){var n=0;return{next:function(){var i=n>=e.length,s;return i||(s=e[n],n+=1),{done:i,value:s}}}},Ow=function(e,n){if(O3(e)||Aw(e))return X0(e);if(z3(e)){var r=0;return{next:function(){var s=U3(e,r),c=V3(e,r,s);return r=s,{done:s>e.length,value:c}}}}if(n&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!F3&&!B3)t_.exports=function(e){if(e!=null)return Ow(e,!0)};else{var j3=NI,G3=zI,zw=Fa("Map.prototype.forEach",!0),Fw=Fa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Bw=Fa("Map.prototype.iterator",!0),Vw=Fa("Set.prototype.iterator",!0);var Uw=Fa("Map.prototype.@@iterator",!0)||Fa("Map.prototype._es6-shim iterator_",!0),jw=Fa("Set.prototype.@@iterator",!0)||Fa("Set.prototype._es6-shim iterator_",!0),q3=function(e){if(j3(e)){if(Bw)return kw(Bw(e));if(Uw)return Uw(e);if(zw){var n=[];return zw(e,function(i,s){Rw(n,[s,i])}),X0(n)}}if(G3(e)){if(Vw)return kw(Vw(e));if(jw)return jw(e);if(Fw){var r=[];return Fw(e,function(i){Rw(r,i)}),X0(r)}}};t_.exports=function(e){return q3(e)||Ow(e)}}}var W3=t_.exports,Gw=function(t){return t!==t},FI=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||Gw(e)&&Gw(n))},H3=FI,BI=function(){return typeof Object.is=="function"?Object.is:H3},Z3=BI,X3=uh,$3=function(){var e=Z3();return X3(Object,{is:e},{is:function(){return Object.is!==e}}),e},Y3=uh,K3=lp,J3=FI,VI=BI,Q3=$3,UI=K3(VI(),Object);Y3(UI,{getPolyfill:VI,implementation:J3,shim:Q3});var e4=UI,t4=lp,jI=Ta,n4=Dl,Ev=n4("%ArrayBuffer%",!0),n_=jI("ArrayBuffer.prototype.byteLength",!0),r4=jI("Object.prototype.toString"),qw=!!Ev&&!n_&&new Ev(0).slice,Ww=!!qw&&t4(qw),GI=n_||Ww?function(e){if(!e||typeof e!="object")return!1;try{return n_?n_(e):Ww(e,0),!0}catch{return!1}}:Ev?function(e){return r4(e)==="[object ArrayBuffer]"}:function(e){return!1},i4=Date.prototype.getDay,o4=function(e){try{return i4.call(e),!0}catch{return!1}},s4=Object.prototype.toString,a4="[object Date]",l4=ch(),u4=function(e){return typeof e!="object"||e===null?!1:l4?o4(e):s4.call(e)===a4},Iv=Ta,qI=ch(),WI,HI,Cv,Tv;if(qI){WI=Iv("Object.prototype.hasOwnProperty"),HI=Iv("RegExp.prototype.exec"),Cv={};var $0=function(){throw Cv};Tv={toString:$0,valueOf:$0},typeof Symbol.toPrimitive=="symbol"&&(Tv[Symbol.toPrimitive]=$0)}var c4=Iv("Object.prototype.toString"),h4=Object.getOwnPropertyDescriptor,f4="[object RegExp]",p4=qI?function(e){if(!e||typeof e!="object")return!1;var n=h4(e,"lastIndex"),r=n&&WI(n,"value");if(!r)return!1;try{HI(e,Tv)}catch(i){return i===Cv}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:c4(e)===f4},d4=Ta,Hw=d4("SharedArrayBuffer.prototype.byteLength",!0),m4=Hw?function(e){if(!e||typeof e!="object")return!1;try{return Hw(e),!0}catch{return!1}}:function(e){return!1},g4=Number.prototype.toString,_4=function(e){try{return g4.call(e),!0}catch{return!1}},y4=Object.prototype.toString,v4="[object Number]",b4=ch(),x4=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:b4?_4(e):y4.call(e)===v4},ZI=Ta,w4=ZI("Boolean.prototype.toString"),S4=ZI("Object.prototype.toString"),E4=function(e){try{return w4(e),!0}catch{return!1}},I4="[object Boolean]",C4=ch(),T4=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:C4&&Symbol.toStringTag in e?E4(e):S4(e)===I4},Lv={exports:{}},L4=Object.prototype.toString,P4=w1();if(P4){var M4=Symbol.prototype.toString,A4=/^Symbol\(.*\)$/,k4=function(e){return typeof e.valueOf()!="symbol"?!1:A4.test(M4.call(e))};Lv.exports=function(e){if(typeof e=="symbol")return!0;if(L4.call(e)!=="[object Symbol]")return!1;try{return k4(e)}catch{return!1}}}else Lv.exports=function(e){return!1};var D4=Lv.exports,Pv={exports:{}},Zw=typeof BigInt<"u"&&BigInt,R4=function(){return typeof Zw=="function"&&typeof BigInt=="function"&&typeof Zw(42)=="bigint"&&typeof BigInt(42)=="bigint"},N4=R4();if(N4){var O4=BigInt.prototype.valueOf,z4=function(e){try{return O4.call(e),!0}catch{}return!1};Pv.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:z4(e)}}else Pv.exports=function(e){return!1};var F4=Pv.exports,B4=DI,V4=x4,U4=T4,j4=D4,G4=F4,q4=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(B4(e))return"String";if(V4(e))return"Number";if(U4(e))return"Boolean";if(j4(e))return"Symbol";if(G4(e))return"BigInt"},w_=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Xw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,S_;w_||(S_=function(e){return!1});var Mv=w_?w_.prototype.has:null,Y0=Xw?Xw.prototype.has:null;!S_&&!Mv&&(S_=function(e){return!1});var W4=S_||function(e){if(!e||typeof e!="object")return!1;try{if(Mv.call(e,Mv),Y0)try{Y0.call(e,Y0)}catch{return!0}return e instanceof w_}catch{}return!1},Av={exports:{}},H4=Dl,XI=Ta,Z4=H4("%WeakSet%",!0),K0=XI("WeakSet.prototype.has",!0);if(K0){var J0=XI("WeakMap.prototype.has",!0);Av.exports=function(e){if(!e||typeof e!="object")return!1;try{if(K0(e,K0),J0)try{J0(e,J0)}catch{return!0}return e instanceof Z4}catch{}return!1}}else Av.exports=function(e){return!1};var X4=Av.exports,$4=NI,Y4=zI,K4=W4,J4=X4,Q4=function(e){if(e&&typeof e=="object"){if($4(e))return"Map";if(Y4(e))return"Set";if(K4(e))return"WeakMap";if(J4(e))return"WeakSet"}return!1},$I=Function.prototype.toString,If=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,kv,r_;if(typeof If=="function"&&typeof Object.defineProperty=="function")try{kv=Object.defineProperty({},"length",{get:function(){throw r_}}),r_={},If(function(){throw 42},null,kv)}catch(t){t!==r_&&(If=null)}else If=null;var eD=/^\s*class\b/,Dv=function(e){try{var n=$I.call(e);return eD.test(n)}catch{return!1}},Q0=function(e){try{return Dv(e)?!1:($I.call(e),!0)}catch{return!1}},i_=Object.prototype.toString,tD="[object Object]",nD="[object Function]",rD="[object GeneratorFunction]",iD="[object HTMLAllCollection]",oD="[object HTML document.all class]",sD="[object HTMLCollection]",aD=typeof Symbol=="function"&&!!Symbol.toStringTag,lD=!(0 in[,]),Rv=function(){return!1};if(typeof document=="object"){var uD=document.all;i_.call(uD)===i_.call(document.all)&&(Rv=function(e){if((lD||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=i_.call(e);return(n===iD||n===oD||n===sD||n===tD)&&e("")==null}catch{}return!1})}var cD=If?function(e){if(Rv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{If(e,null,kv)}catch(n){if(n!==r_)return!1}return!Dv(e)&&Q0(e)}:function(e){if(Rv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(aD)return Q0(e);if(Dv(e))return!1;var n=i_.call(e);return n!==nD&&n!==rD&&!/^\[object HTML/.test(n)?!1:Q0(e)},hD=cD,fD=Object.prototype.toString,YI=Object.prototype.hasOwnProperty,pD=function(e,n,r){for(var i=0,s=e.length;i=3&&(i=r),fD.call(e)==="[object Array]"?pD(e,n,i):typeof e=="string"?dD(e,n,i):mD(e,n,i)},_D=gD,yD=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],ev=yD,vD=typeof globalThis>"u"?_m:globalThis,bD=function(){for(var e=[],n=0;n"u"?_m:globalThis,Nv=xD(),O1=N1("String.prototype.slice"),tv=Object.getPrototypeOf,SD=N1("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:ID(e)}return o_?ED(e):null},TD=Ta,Kw=TD("ArrayBuffer.prototype.byteLength",!0),LD=GI,PD=function(e){return LD(e)?Kw?Kw(e):e.byteLength:NaN},JI=ak,Rl=Ta,Jw=Ak,MD=Dl,Rf=W3,AD=AI,Qw=e4,e2=SI,t2=kI,n2=GI,r2=u4,i2=p4,o2=m4,s2=x1,a2=q4,l2=Q4,u2=CD,c2=PD,h2=Rl("SharedArrayBuffer.prototype.byteLength",!0),f2=Rl("Date.prototype.getTime"),nv=Object.getPrototypeOf,p2=Rl("Object.prototype.toString"),C_=MD("%Set%",!0),Ov=Rl("Map.prototype.has",!0),T_=Rl("Map.prototype.get",!0),d2=Rl("Map.prototype.size",!0),L_=Rl("Set.prototype.add",!0),QI=Rl("Set.prototype.delete",!0),P_=Rl("Set.prototype.has",!0),s_=Rl("Set.prototype.size",!0);function m2(t,e,n,r){for(var i=Rf(t),s;(s=i.next())&&!s.done;)if(ja(e,s.value,n,r))return QI(t,s.value),!0;return!1}function eC(t){if(typeof t>"u")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function kD(t,e,n,r,i,s){var c=eC(n);if(c!=null)return c;var l=T_(e,c),d=JI({},i,{strict:!1});return typeof l>"u"&&!Ov(e,c)||!ja(r,l,d,s)?!1:!Ov(t,c)&&ja(r,l,d,s)}function DD(t,e,n){var r=eC(n);return r??(P_(e,r)&&!P_(t,r))}function g2(t,e,n,r,i,s){for(var c=Rf(t),l,d;(l=c.next())&&!l.done;)if(d=l.value,ja(n,d,i,s)&&ja(r,T_(e,d),i,s))return QI(t,d),!0;return!1}function ja(t,e,n,r){var i=n||{};if(i.strict?Qw(t,e):t===e)return!0;var s=a2(t),c=a2(e);if(s!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Qw(t,e):t==e;var l=r.has(t),d=r.has(e),v;if(l&&d){if(r.get(t)===r.get(e))return!0}else v={};return l||r.set(t,v),d||r.set(e,v),OD(t,e,i,r)}function _2(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function RD(t,e,n,r){if(s_(t)!==s_(e))return!1;for(var i=Rf(t),s=Rf(e),c,l,d;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")d||(d=new C_),L_(d,c.value);else if(!P_(e,c.value)){if(n.strict||!DD(t,e,c.value))return!1;d||(d=new C_),L_(d,c.value)}if(d){for(;(l=s.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!m2(d,l.value,n.strict,r))return!1}else if(!n.strict&&!P_(t,l.value)&&!m2(d,l.value,n.strict,r))return!1;return s_(d)===0}return!0}function ND(t,e,n,r){if(d2(t)!==d2(e))return!1;for(var i=Rf(t),s=Rf(e),c,l,d,v,S,E;(c=i.next())&&!c.done;)if(v=c.value[0],S=c.value[1],v&&typeof v=="object")d||(d=new C_),L_(d,v);else if(E=T_(e,v),typeof E>"u"&&!Ov(e,v)||!ja(S,E,n,r)){if(n.strict||!kD(t,e,v,S,n,r))return!1;d||(d=new C_),L_(d,v)}if(d){for(;(l=s.next())&&!l.done;)if(v=l.value[0],E=l.value[1],v&&typeof v=="object"){if(!g2(d,t,v,E,n,r))return!1}else if(!n.strict&&(!t.has(v)||!ja(T_(t,v),E,n,r))&&!g2(d,t,v,E,JI({},n,{strict:!1}),r))return!1;return s_(d)===0}return!0}function OD(t,e,n,r){var i,s;if(typeof t!=typeof e||t==null||e==null||p2(t)!==p2(e)||e2(t)!==e2(e))return!1;var c=t2(t),l=t2(e);if(c!==l)return!1;var d=t instanceof Error,v=e instanceof Error;if(d!==v||(d||v)&&(t.name!==e.name||t.message!==e.message))return!1;var S=i2(t),E=i2(e);if(S!==E||(S||E)&&(t.source!==e.source||Jw(t)!==Jw(e)))return!1;var C=r2(t),M=r2(e);if(C!==M||(C||M)&&f2(t)!==f2(e)||n.strict&&nv&&nv(t)!==nv(e))return!1;var k=u2(t),R=u2(e);if(k!==R)return!1;if(k||R){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(_e[i]!=ae[i])return!1;for(i=_e.length-1;i>=0;i--)if(s=_e[i],!ja(t[s],e[s],n,r))return!1;var le=l2(t),ve=l2(e);return le!==ve?!1:le==="Set"||ve==="Set"?RD(t,e,n,r):le==="Map"?ND(t,e,n,r):!0}var zD=function(e,n,r){return ja(e,n,r,AD())};const tC=d1(zD);var FD=Object.defineProperty,hr=(t,e)=>FD(t,"name",{value:e,configurable:!0}),BD=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!Dd(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=zv(e),i=zv(n);return r.every(s=>i.some(c=>this.compare(s,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(s=>i.some(c=>this.compareLine(s,c,1,!0)))}return!1}compareGeometryCollection(e,n){return Dd(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?tC(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return Dd(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};hr(BD,"GeojsonEquality");function Dd(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}hr(Dd,"sameLength");function zv(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}hr(zv,"explode");var Os=63710088e-1,nC={centimeters:Os*100,centimetres:Os*100,degrees:360/(2*Math.PI),feet:Os*3.28084,inches:Os*39.37,kilometers:Os/1e3,kilometres:Os/1e3,meters:Os,metres:Os,miles:Os/1609.344,millimeters:Os*1e3,millimetres:Os*1e3,nauticalmiles:Os/1852,radians:1,yards:Os*1.0936},y2={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,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Cl(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}hr(Cl,"feature");function VD(t,e,n={}){switch(t){case"Point":return tu(e).geometry;case"LineString":return iu(e).geometry;case"Polygon":return z1(e).geometry;case"MultiPoint":return iC(e).geometry;case"MultiLineString":return rC(e).geometry;case"MultiPolygon":return oC(e).geometry;default:throw new Error(t+" is invalid")}}hr(VD,"geometry");function tu(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!M_(t[0])||!M_(t[1]))throw new Error("coordinates must contain numbers");return Cl({type:"Point",coordinates:t},e,n)}hr(tu,"point");function UD(t,e,n={}){return iy(t.map(r=>tu(r,e)),n)}hr(UD,"points");function z1(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let s=0;sz1(r,e)),n)}hr(jD,"polygons");function iu(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return Cl({type:"LineString",coordinates:t},e,n)}hr(iu,"lineString");function GD(t,e,n={}){return iy(t.map(r=>iu(r,e)),n)}hr(GD,"lineStrings");function iy(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}hr(iy,"featureCollection");function rC(t,e,n={}){return Cl({type:"MultiLineString",coordinates:t},e,n)}hr(rC,"multiLineString");function iC(t,e,n={}){return Cl({type:"MultiPoint",coordinates:t},e,n)}hr(iC,"multiPoint");function oC(t,e,n={}){return Cl({type:"MultiPolygon",coordinates:t},e,n)}hr(oC,"multiPolygon");function qD(t,e,n={}){return Cl({type:"GeometryCollection",geometries:t},e,n)}hr(qD,"geometryCollection");function WD(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}hr(WD,"round");function sC(t,e="kilometers"){const n=nC[e];if(!n)throw new Error(e+" units is invalid");return t*n}hr(sC,"radiansToLength");function F1(t,e="kilometers"){const n=nC[e];if(!n)throw new Error(e+" units is invalid");return t/n}hr(F1,"lengthToRadians");function HD(t,e){return aC(F1(t,e))}hr(HD,"lengthToDegrees");function ZD(t){let e=t%360;return e<0&&(e+=360),e}hr(ZD,"bearingToAzimuth");function aC(t){return t%(2*Math.PI)*180/Math.PI}hr(aC,"radiansToDegrees");function XD(t){return t%360*Math.PI/180}hr(XD,"degreesToRadians");function $D(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return sC(F1(t,e),n)}hr($D,"convertLength");function YD(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=y2[e];if(!r)throw new Error("invalid original units");const i=y2[n];if(!i)throw new Error("invalid final units");return t/r*i}hr(YD,"convertArea");function M_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}hr(M_,"isNumber");function B1(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}hr(B1,"isObject");function KD(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!M_(e))throw new Error("bbox must only contain numbers")})}hr(KD,"validateBBox");function JD(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}hr(JD,"validateId");var QD=Object.defineProperty,So=(t,e)=>QD(t,"name",{value:e,configurable:!0});function cp(t,e,n){if(t!==null)for(var r,i,s,c,l,d,v,S=0,E=0,C,M=t.type,k=M==="FeatureCollection",R=M==="Feature",N=k?t.features.length:1,B=0;Bd||k>v||R>S){l=E,d=r,v=k,S=R,s=0;return}var N=iu([l,E],n.properties);if(e(N,r,i,R,s)===!1)return!1;s++,l=E})===!1)return!1}}})}So(cC,"segmentEach");function sR(t,e,n){var r=n,i=!1;return cC(t,function(s,c,l,d,v){i===!1&&n===void 0?r=s:r=e(r,s,c,l,d,v),i=!0}),r}So(sR,"segmentReduce");function hC(t,e){if(!t)throw new Error("geojson is required");oy(t,function(n,r,i){if(n.geometry!==null){var s=n.geometry.type,c=n.geometry.coordinates;switch(s){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;lcR(t,"name",{value:e,configurable:!0});function U1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return cp(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2] line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],s=n[0][1],c=n[1][0],l=n[1][1],d=r[0][0],v=r[0][1],S=r[1][0],E=r[1][1],C=(E-v)*(c-i)-(S-d)*(l-s),M=(S-d)*(s-v)-(E-v)*(i-d),k=(c-i)*(s-v)-(l-s)*(i-d);if(C===0)return null;var R=M/C,N=k/C;if(R>=0&&R<=1&&N>=0&&N<=1){var B=i+R*(c-i),F=s+R*(l-s);return _s([B,F])}return null}function vR(t,e,n){n===void 0&&(n={});var r=_s([1/0,1/0],{dist:1/0}),i=0;return ap(t,function(s){for(var c=Af(s),l=0;l0&&(N=R.features[0],N.properties.dist=yd(e,N,n),N.properties.location=i+yd(d,N,n)),d.properties.dist{if(!this.active)return;const l=[c.point.x-bR,c.point.y],d=this.map.unproject(c.point).distanceTo(this.map.unproject(l));this.inner.onMouseMove(c.lngLat.lng,c.lngLat.lat,d)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=c=>{this.active&&(c.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=c=>{this.active&&c.key=="Escape"&&(c.stopPropagation(),this.cancel())},this.onKeyPress=c=>{this.active&&c.target.tagName!="INPUT"&&(c.key=="Enter"?(c.stopPropagation(),this.finish()):c.key=="s"||c.key=="S"?(c.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):c.key=="z"&&c.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new p_(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=r,this.snapMode=i,this.undoLength=s,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(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersSuccess)n(JSON.parse(e));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersUpdated)n(JSON.parse(e))}}const Fv="MZEJTanw3WpxRvt7qDfo";let uu=Fn(null),Bv=Fn("streets-v2"),Jd=Fn(!1),Ju=Fn(""),A_=Fn(!0),Gi=Fn(null),k_=Fn(null),Vv=Fn(new ey.LngLat(0,0)),Uv=Fn(new ey.LngLat(0,0)),x2=Fn(1),qu=Fn(1),bn=Fn({mode:"title"}),jv=Fn("walk_cycle_only"),w2=Fn(!1);function Nf(){let t=Fs(Ju);t||window.alert("Autosave failed; no projectName set?!"),window.localStorage.setItem(t,Fs(Gi).toSavefile())}function S2(t){let e,n;return e=new K_({props:{$$slots:{default:[wR,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&24&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function wR(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;function R(){return t[1](t[3])}return{c(){e=ge("h1"),e.textContent="The low-traffic neighbourhood (LTN) tool, v2",n=We(),r=ge("p"),r.innerHTML=`This is an experimental +`+e.prev}function zg(t,e){var n=wv(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=Nw(e,n);if(i<55296||i>56319)return n+1;var s=Nw(e,n+1);return s<56320||s>57343?n+1:n+2},X0=function(e){var n=0;return{next:function(){var i=n>=e.length,s;return i||(s=e[n],n+=1),{done:i,value:s}}}},Ow=function(e,n){if(O3(e)||Aw(e))return X0(e);if(z3(e)){var r=0;return{next:function(){var s=U3(e,r),c=V3(e,r,s);return r=s,{done:s>e.length,value:c}}}}if(n&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!F3&&!B3)t_.exports=function(e){if(e!=null)return Ow(e,!0)};else{var j3=NI,G3=zI,zw=Fa("Map.prototype.forEach",!0),Fw=Fa("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Bw=Fa("Map.prototype.iterator",!0),Vw=Fa("Set.prototype.iterator",!0);var Uw=Fa("Map.prototype.@@iterator",!0)||Fa("Map.prototype._es6-shim iterator_",!0),jw=Fa("Set.prototype.@@iterator",!0)||Fa("Set.prototype._es6-shim iterator_",!0),q3=function(e){if(j3(e)){if(Bw)return kw(Bw(e));if(Uw)return Uw(e);if(zw){var n=[];return zw(e,function(i,s){Rw(n,[s,i])}),X0(n)}}if(G3(e)){if(Vw)return kw(Vw(e));if(jw)return jw(e);if(Fw){var r=[];return Fw(e,function(i){Rw(r,i)}),X0(r)}}};t_.exports=function(e){return q3(e)||Ow(e)}}}var W3=t_.exports,Gw=function(t){return t!==t},FI=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||Gw(e)&&Gw(n))},H3=FI,BI=function(){return typeof Object.is=="function"?Object.is:H3},Z3=BI,X3=uh,$3=function(){var e=Z3();return X3(Object,{is:e},{is:function(){return Object.is!==e}}),e},Y3=uh,K3=lp,J3=FI,VI=BI,Q3=$3,UI=K3(VI(),Object);Y3(UI,{getPolyfill:VI,implementation:J3,shim:Q3});var e4=UI,t4=lp,jI=Ta,n4=Dl,Ev=n4("%ArrayBuffer%",!0),n_=jI("ArrayBuffer.prototype.byteLength",!0),r4=jI("Object.prototype.toString"),qw=!!Ev&&!n_&&new Ev(0).slice,Ww=!!qw&&t4(qw),GI=n_||Ww?function(e){if(!e||typeof e!="object")return!1;try{return n_?n_(e):Ww(e,0),!0}catch{return!1}}:Ev?function(e){return r4(e)==="[object ArrayBuffer]"}:function(e){return!1},i4=Date.prototype.getDay,o4=function(e){try{return i4.call(e),!0}catch{return!1}},s4=Object.prototype.toString,a4="[object Date]",l4=ch(),u4=function(e){return typeof e!="object"||e===null?!1:l4?o4(e):s4.call(e)===a4},Iv=Ta,qI=ch(),WI,HI,Cv,Tv;if(qI){WI=Iv("Object.prototype.hasOwnProperty"),HI=Iv("RegExp.prototype.exec"),Cv={};var $0=function(){throw Cv};Tv={toString:$0,valueOf:$0},typeof Symbol.toPrimitive=="symbol"&&(Tv[Symbol.toPrimitive]=$0)}var c4=Iv("Object.prototype.toString"),h4=Object.getOwnPropertyDescriptor,f4="[object RegExp]",p4=qI?function(e){if(!e||typeof e!="object")return!1;var n=h4(e,"lastIndex"),r=n&&WI(n,"value");if(!r)return!1;try{HI(e,Tv)}catch(i){return i===Cv}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:c4(e)===f4},d4=Ta,Hw=d4("SharedArrayBuffer.prototype.byteLength",!0),m4=Hw?function(e){if(!e||typeof e!="object")return!1;try{return Hw(e),!0}catch{return!1}}:function(e){return!1},g4=Number.prototype.toString,_4=function(e){try{return g4.call(e),!0}catch{return!1}},y4=Object.prototype.toString,v4="[object Number]",b4=ch(),x4=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:b4?_4(e):y4.call(e)===v4},ZI=Ta,w4=ZI("Boolean.prototype.toString"),S4=ZI("Object.prototype.toString"),E4=function(e){try{return w4(e),!0}catch{return!1}},I4="[object Boolean]",C4=ch(),T4=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:C4&&Symbol.toStringTag in e?E4(e):S4(e)===I4},Lv={exports:{}},L4=Object.prototype.toString,P4=w1();if(P4){var M4=Symbol.prototype.toString,A4=/^Symbol\(.*\)$/,k4=function(e){return typeof e.valueOf()!="symbol"?!1:A4.test(M4.call(e))};Lv.exports=function(e){if(typeof e=="symbol")return!0;if(L4.call(e)!=="[object Symbol]")return!1;try{return k4(e)}catch{return!1}}}else Lv.exports=function(e){return!1};var D4=Lv.exports,Pv={exports:{}},Zw=typeof BigInt<"u"&&BigInt,R4=function(){return typeof Zw=="function"&&typeof BigInt=="function"&&typeof Zw(42)=="bigint"&&typeof BigInt(42)=="bigint"},N4=R4();if(N4){var O4=BigInt.prototype.valueOf,z4=function(e){try{return O4.call(e),!0}catch{}return!1};Pv.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:z4(e)}}else Pv.exports=function(e){return!1};var F4=Pv.exports,B4=DI,V4=x4,U4=T4,j4=D4,G4=F4,q4=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(B4(e))return"String";if(V4(e))return"Number";if(U4(e))return"Boolean";if(j4(e))return"Symbol";if(G4(e))return"BigInt"},w_=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Xw=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,S_;w_||(S_=function(e){return!1});var Mv=w_?w_.prototype.has:null,Y0=Xw?Xw.prototype.has:null;!S_&&!Mv&&(S_=function(e){return!1});var W4=S_||function(e){if(!e||typeof e!="object")return!1;try{if(Mv.call(e,Mv),Y0)try{Y0.call(e,Y0)}catch{return!0}return e instanceof w_}catch{}return!1},Av={exports:{}},H4=Dl,XI=Ta,Z4=H4("%WeakSet%",!0),K0=XI("WeakSet.prototype.has",!0);if(K0){var J0=XI("WeakMap.prototype.has",!0);Av.exports=function(e){if(!e||typeof e!="object")return!1;try{if(K0(e,K0),J0)try{J0(e,J0)}catch{return!0}return e instanceof Z4}catch{}return!1}}else Av.exports=function(e){return!1};var X4=Av.exports,$4=NI,Y4=zI,K4=W4,J4=X4,Q4=function(e){if(e&&typeof e=="object"){if($4(e))return"Map";if(Y4(e))return"Set";if(K4(e))return"WeakMap";if(J4(e))return"WeakSet"}return!1},$I=Function.prototype.toString,If=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,kv,r_;if(typeof If=="function"&&typeof Object.defineProperty=="function")try{kv=Object.defineProperty({},"length",{get:function(){throw r_}}),r_={},If(function(){throw 42},null,kv)}catch(t){t!==r_&&(If=null)}else If=null;var eD=/^\s*class\b/,Dv=function(e){try{var n=$I.call(e);return eD.test(n)}catch{return!1}},Q0=function(e){try{return Dv(e)?!1:($I.call(e),!0)}catch{return!1}},i_=Object.prototype.toString,tD="[object Object]",nD="[object Function]",rD="[object GeneratorFunction]",iD="[object HTMLAllCollection]",oD="[object HTML document.all class]",sD="[object HTMLCollection]",aD=typeof Symbol=="function"&&!!Symbol.toStringTag,lD=!(0 in[,]),Rv=function(){return!1};if(typeof document=="object"){var uD=document.all;i_.call(uD)===i_.call(document.all)&&(Rv=function(e){if((lD||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=i_.call(e);return(n===iD||n===oD||n===sD||n===tD)&&e("")==null}catch{}return!1})}var cD=If?function(e){if(Rv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{If(e,null,kv)}catch(n){if(n!==r_)return!1}return!Dv(e)&&Q0(e)}:function(e){if(Rv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(aD)return Q0(e);if(Dv(e))return!1;var n=i_.call(e);return n!==nD&&n!==rD&&!/^\[object HTML/.test(n)?!1:Q0(e)},hD=cD,fD=Object.prototype.toString,YI=Object.prototype.hasOwnProperty,pD=function(e,n,r){for(var i=0,s=e.length;i=3&&(i=r),fD.call(e)==="[object Array]"?pD(e,n,i):typeof e=="string"?dD(e,n,i):mD(e,n,i)},_D=gD,yD=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],ev=yD,vD=typeof globalThis>"u"?_m:globalThis,bD=function(){for(var e=[],n=0;n"u"?_m:globalThis,Nv=xD(),O1=N1("String.prototype.slice"),tv=Object.getPrototypeOf,SD=N1("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:ID(e)}return o_?ED(e):null},TD=Ta,Kw=TD("ArrayBuffer.prototype.byteLength",!0),LD=GI,PD=function(e){return LD(e)?Kw?Kw(e):e.byteLength:NaN},JI=ak,Rl=Ta,Jw=Ak,MD=Dl,Rf=W3,AD=AI,Qw=e4,e2=SI,t2=kI,n2=GI,r2=u4,i2=p4,o2=m4,s2=x1,a2=q4,l2=Q4,u2=CD,c2=PD,h2=Rl("SharedArrayBuffer.prototype.byteLength",!0),f2=Rl("Date.prototype.getTime"),nv=Object.getPrototypeOf,p2=Rl("Object.prototype.toString"),C_=MD("%Set%",!0),Ov=Rl("Map.prototype.has",!0),T_=Rl("Map.prototype.get",!0),d2=Rl("Map.prototype.size",!0),L_=Rl("Set.prototype.add",!0),QI=Rl("Set.prototype.delete",!0),P_=Rl("Set.prototype.has",!0),s_=Rl("Set.prototype.size",!0);function m2(t,e,n,r){for(var i=Rf(t),s;(s=i.next())&&!s.done;)if(ja(e,s.value,n,r))return QI(t,s.value),!0;return!1}function eC(t){if(typeof t>"u")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function kD(t,e,n,r,i,s){var c=eC(n);if(c!=null)return c;var l=T_(e,c),d=JI({},i,{strict:!1});return typeof l>"u"&&!Ov(e,c)||!ja(r,l,d,s)?!1:!Ov(t,c)&&ja(r,l,d,s)}function DD(t,e,n){var r=eC(n);return r??(P_(e,r)&&!P_(t,r))}function g2(t,e,n,r,i,s){for(var c=Rf(t),l,d;(l=c.next())&&!l.done;)if(d=l.value,ja(n,d,i,s)&&ja(r,T_(e,d),i,s))return QI(t,d),!0;return!1}function ja(t,e,n,r){var i=n||{};if(i.strict?Qw(t,e):t===e)return!0;var s=a2(t),c=a2(e);if(s!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Qw(t,e):t==e;var l=r.has(t),d=r.has(e),v;if(l&&d){if(r.get(t)===r.get(e))return!0}else v={};return l||r.set(t,v),d||r.set(e,v),OD(t,e,i,r)}function _2(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function RD(t,e,n,r){if(s_(t)!==s_(e))return!1;for(var i=Rf(t),s=Rf(e),c,l,d;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")d||(d=new C_),L_(d,c.value);else if(!P_(e,c.value)){if(n.strict||!DD(t,e,c.value))return!1;d||(d=new C_),L_(d,c.value)}if(d){for(;(l=s.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!m2(d,l.value,n.strict,r))return!1}else if(!n.strict&&!P_(t,l.value)&&!m2(d,l.value,n.strict,r))return!1;return s_(d)===0}return!0}function ND(t,e,n,r){if(d2(t)!==d2(e))return!1;for(var i=Rf(t),s=Rf(e),c,l,d,v,S,E;(c=i.next())&&!c.done;)if(v=c.value[0],S=c.value[1],v&&typeof v=="object")d||(d=new C_),L_(d,v);else if(E=T_(e,v),typeof E>"u"&&!Ov(e,v)||!ja(S,E,n,r)){if(n.strict||!kD(t,e,v,S,n,r))return!1;d||(d=new C_),L_(d,v)}if(d){for(;(l=s.next())&&!l.done;)if(v=l.value[0],E=l.value[1],v&&typeof v=="object"){if(!g2(d,t,v,E,n,r))return!1}else if(!n.strict&&(!t.has(v)||!ja(T_(t,v),E,n,r))&&!g2(d,t,v,E,JI({},n,{strict:!1}),r))return!1;return s_(d)===0}return!0}function OD(t,e,n,r){var i,s;if(typeof t!=typeof e||t==null||e==null||p2(t)!==p2(e)||e2(t)!==e2(e))return!1;var c=t2(t),l=t2(e);if(c!==l)return!1;var d=t instanceof Error,v=e instanceof Error;if(d!==v||(d||v)&&(t.name!==e.name||t.message!==e.message))return!1;var S=i2(t),E=i2(e);if(S!==E||(S||E)&&(t.source!==e.source||Jw(t)!==Jw(e)))return!1;var C=r2(t),M=r2(e);if(C!==M||(C||M)&&f2(t)!==f2(e)||n.strict&&nv&&nv(t)!==nv(e))return!1;var k=u2(t),R=u2(e);if(k!==R)return!1;if(k||R){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(de[i]!=ae[i])return!1;for(i=de.length-1;i>=0;i--)if(s=de[i],!ja(t[s],e[s],n,r))return!1;var le=l2(t),ye=l2(e);return le!==ye?!1:le==="Set"||ye==="Set"?RD(t,e,n,r):le==="Map"?ND(t,e,n,r):!0}var zD=function(e,n,r){return ja(e,n,r,AD())};const tC=d1(zD);var FD=Object.defineProperty,hr=(t,e)=>FD(t,"name",{value:e,configurable:!0}),BD=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!Dd(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=zv(e),i=zv(n);return r.every(s=>i.some(c=>this.compare(s,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(s=>i.some(c=>this.compareLine(s,c,1,!0)))}return!1}compareGeometryCollection(e,n){return Dd(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?tC(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return Dd(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};hr(BD,"GeojsonEquality");function Dd(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}hr(Dd,"sameLength");function zv(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}hr(zv,"explode");var Os=63710088e-1,nC={centimeters:Os*100,centimetres:Os*100,degrees:360/(2*Math.PI),feet:Os*3.28084,inches:Os*39.37,kilometers:Os/1e3,kilometres:Os/1e3,meters:Os,metres:Os,miles:Os/1609.344,millimeters:Os*1e3,millimetres:Os*1e3,nauticalmiles:Os/1852,radians:1,yards:Os*1.0936},y2={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,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Cl(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}hr(Cl,"feature");function VD(t,e,n={}){switch(t){case"Point":return tu(e).geometry;case"LineString":return iu(e).geometry;case"Polygon":return z1(e).geometry;case"MultiPoint":return iC(e).geometry;case"MultiLineString":return rC(e).geometry;case"MultiPolygon":return oC(e).geometry;default:throw new Error(t+" is invalid")}}hr(VD,"geometry");function tu(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!M_(t[0])||!M_(t[1]))throw new Error("coordinates must contain numbers");return Cl({type:"Point",coordinates:t},e,n)}hr(tu,"point");function UD(t,e,n={}){return iy(t.map(r=>tu(r,e)),n)}hr(UD,"points");function z1(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let s=0;sz1(r,e)),n)}hr(jD,"polygons");function iu(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return Cl({type:"LineString",coordinates:t},e,n)}hr(iu,"lineString");function GD(t,e,n={}){return iy(t.map(r=>iu(r,e)),n)}hr(GD,"lineStrings");function iy(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}hr(iy,"featureCollection");function rC(t,e,n={}){return Cl({type:"MultiLineString",coordinates:t},e,n)}hr(rC,"multiLineString");function iC(t,e,n={}){return Cl({type:"MultiPoint",coordinates:t},e,n)}hr(iC,"multiPoint");function oC(t,e,n={}){return Cl({type:"MultiPolygon",coordinates:t},e,n)}hr(oC,"multiPolygon");function qD(t,e,n={}){return Cl({type:"GeometryCollection",geometries:t},e,n)}hr(qD,"geometryCollection");function WD(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}hr(WD,"round");function sC(t,e="kilometers"){const n=nC[e];if(!n)throw new Error(e+" units is invalid");return t*n}hr(sC,"radiansToLength");function F1(t,e="kilometers"){const n=nC[e];if(!n)throw new Error(e+" units is invalid");return t/n}hr(F1,"lengthToRadians");function HD(t,e){return aC(F1(t,e))}hr(HD,"lengthToDegrees");function ZD(t){let e=t%360;return e<0&&(e+=360),e}hr(ZD,"bearingToAzimuth");function aC(t){return t%(2*Math.PI)*180/Math.PI}hr(aC,"radiansToDegrees");function XD(t){return t%360*Math.PI/180}hr(XD,"degreesToRadians");function $D(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return sC(F1(t,e),n)}hr($D,"convertLength");function YD(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=y2[e];if(!r)throw new Error("invalid original units");const i=y2[n];if(!i)throw new Error("invalid final units");return t/r*i}hr(YD,"convertArea");function M_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}hr(M_,"isNumber");function B1(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}hr(B1,"isObject");function KD(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!M_(e))throw new Error("bbox must only contain numbers")})}hr(KD,"validateBBox");function JD(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}hr(JD,"validateId");var QD=Object.defineProperty,So=(t,e)=>QD(t,"name",{value:e,configurable:!0});function cp(t,e,n){if(t!==null)for(var r,i,s,c,l,d,v,S=0,E=0,C,M=t.type,k=M==="FeatureCollection",R=M==="Feature",F=k?t.features.length:1,U=0;Ud||k>v||R>S){l=E,d=r,v=k,S=R,s=0;return}var F=iu([l,E],n.properties);if(e(F,r,i,R,s)===!1)return!1;s++,l=E})===!1)return!1}}})}So(cC,"segmentEach");function sR(t,e,n){var r=n,i=!1;return cC(t,function(s,c,l,d,v){i===!1&&n===void 0?r=s:r=e(r,s,c,l,d,v),i=!0}),r}So(sR,"segmentReduce");function hC(t,e){if(!t)throw new Error("geojson is required");oy(t,function(n,r,i){if(n.geometry!==null){var s=n.geometry.type,c=n.geometry.coordinates;switch(s){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;lcR(t,"name",{value:e,configurable:!0});function U1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return cp(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2] line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],s=n[0][1],c=n[1][0],l=n[1][1],d=r[0][0],v=r[0][1],S=r[1][0],E=r[1][1],C=(E-v)*(c-i)-(S-d)*(l-s),M=(S-d)*(s-v)-(E-v)*(i-d),k=(c-i)*(s-v)-(l-s)*(i-d);if(C===0)return null;var R=M/C,F=k/C;if(R>=0&&R<=1&&F>=0&&F<=1){var U=i+R*(c-i),z=s+R*(l-s);return _s([U,z])}return null}function vR(t,e,n){n===void 0&&(n={});var r=_s([1/0,1/0],{dist:1/0}),i=0;return ap(t,function(s){for(var c=Af(s),l=0;l0&&(F=R.features[0],F.properties.dist=yd(e,F,n),F.properties.location=i+yd(d,F,n)),d.properties.dist{if(!this.active)return;const l=[c.point.x-bR,c.point.y],d=this.map.unproject(c.point).distanceTo(this.map.unproject(l));this.inner.onMouseMove(c.lngLat.lng,c.lngLat.lat,d)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=c=>{this.active&&(c.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=c=>{this.active&&c.key=="Escape"&&(c.stopPropagation(),this.cancel())},this.onKeyPress=c=>{this.active&&c.target.tagName!="INPUT"&&(c.key=="Enter"?(c.stopPropagation(),this.finish()):c.key=="s"||c.key=="S"?(c.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):c.key=="z"&&c.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new p_(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=r,this.snapMode=i,this.undoLength=s,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(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersSuccess)n(JSON.parse(e));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersUpdated)n(JSON.parse(e))}}const Fv="MZEJTanw3WpxRvt7qDfo";let uu=Fn(null),Bv=Fn("streets-v2"),Jd=Fn(!1),Qu=Fn(""),A_=Fn(!0),Gi=Fn(null),k_=Fn(null),Vv=Fn(new ey.LngLat(0,0)),Uv=Fn(new ey.LngLat(0,0)),x2=Fn(1),Wu=Fn(1),bn=Fn({mode:"title"}),jv=Fn("walk_cycle_only"),w2=Fn(!1);function Nf(){let t=Fs(Qu);t||window.alert("Autosave failed; no projectName set?!"),window.localStorage.setItem(t,Fs(Gi).toSavefile())}function S2(t){let e,n;return e=new K_({props:{$$slots:{default:[wR,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&24&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function wR(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;function R(){return t[1](t[3])}return{c(){e=_e("h1"),e.textContent="The low-traffic neighbourhood (LTN) tool, v2",n=We(),r=_e("p"),r.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.`,i=We(),s=ge("p"),s.textContent="To use this tool, you need to:",c=We(),l=ge("ol"),l.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.`,i=We(),s=_e("p"),s.textContent="To use this tool, you need to:",c=We(),l=_e("ol"),l.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
  • `,d=We(),v=ge("p"),v.innerHTML=`This tool is created by Dustin Carlino + effects`,d=We(),v=_e("p"),v.innerHTML=`This tool is created by Dustin Carlino and relies heavily on OpenStreetMap - data.`,S=We(),E=ge("center"),C=ge("button"),C.textContent="Start!"},m(N,B){be(N,e,B),be(N,n,B),be(N,r,B),be(N,i,B),be(N,s,B),be(N,c,B),be(N,l,B),be(N,d,B),be(N,v,B),be(N,S,B),be(N,E,B),te(E,C),M||(k=Lt(C,"click",R),M=!0)},p(N,B){t=N},d(N){N&&(ye(e),ye(n),ye(r),ye(i),ye(s),ye(c),ye(l),ye(d),ye(v),ye(S),ye(E)),M=!1,k()}}}function SR(t){let e,n,r=t[0]&&S2(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[0]?r?(r.p(i,s),s&1&&se(r,1)):(r=S2(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function ER(t,e,n){let r;return vt(t,A_,c=>n(0,r=c)),[r,c=>kr(c).close(),()=>Bt(A_,r=!1,r)]}class IR extends Zt{constructor(e){super(),Ht(this,e,ER,SR,Ut,{})}}const CR="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAk0lEQVRIS+3U0Q2AIAwEUNjMUXQydRJH0zZB0wjGuwJfSsKfuWfO1hg6n9g5P3wPWKTSXe6EVstUNEjoloIVghAG0OxR7swgLEAjHoBCvACM1AAQUgJ0DL0nm67WwJom7XrBlhVl4arUAHYniuE1ABTuBeBwD0CFs4D92T12fp9v9iPrnJ8LBu0KC0Ch9qEfeK3sAPceHxk8hJ17AAAAAElFTkSuQmCC",TR="/ltn/assets/logo-97f2d067.svg";let LR=Date.now();function hp(t){return`${t}-${LR++}`}const j1=Symbol.for("svelte-maplibre");function fp(){return RE(j1)}function PR(t){let e=new WeakMap;return n=>{var c;let r=e.get(n.originalEvent);if(r!==void 0)return r;let s=(c=n.target.queryRenderedFeatures(n.point).find(l=>{var d;return(d=t.get(l.layer.id))==null?void 0:d.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,s),s}}function MR(){let t=new Map;return p1(j1,{map:Fn(null),source:R0(null),layer:R0(null),popupTarget:R0(null),cluster:Fn(),loadedImages:Fn(new Set),minzoom:Fn(0),maxzoom:Fn(24),layerEvent:Fn(null),layerInfo:t,eventTopMost:PR(t)})}function E2(t){return{subscribe:t.subscribe}}function G1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=fp(),s=Fn(null),c=E2(s),l={...i,[t]:E2(s)};if(e&&(l.popupTarget=c),r){let d=Fn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Fn()),p1(j1,l),{...i,self:s}}function AR(){return G1({key:"source",setCluster:!0})}function kR(t=!0){return G1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function DR(){return G1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function RR(t){return"layerType"in t&&t.layerType==="deckgl"}function I2(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],s=n[r];i!==s&&t(r,s,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function NR(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function OR(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Of(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var Xc=zR;function zR(t){var e,n,r;if(t){if(Array.isArray(t)){for(e=[],n=t.length,r=0;r{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function BR(t,e,n){let r,i,s,c,l,d,v,S,E,C,M,k,{$$slots:R={},$$scope:N}=e,{id:B=hp("layer")}=e,{source:F=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:H=void 0}=e,{beforeLayerType:K=void 0}=e,{type:_e}=e,{paint:ae=void 0}=e,{layout:le=void 0}=e,{filter:ve=void 0}=e,{applyToClusters:ke=void 0}=e,{minzoom:Q=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:qe=!1}=e,{hovered:Pe=null}=e,{interactive:it=!0}=e,{hoverCursor:ft=void 0}=e,{eventsIfTopMost:Xe=!1}=e;const Mt=vu(),{map:At,source:yt,self:zt,minzoom:Tt,maxzoom:tn,eventTopMost:Rn,layerInfo:Jt}=kR();vt(t,At,ne=>n(31,E=ne)),vt(t,yt,ne=>n(32,C=ne)),vt(t,zt,ne=>n(0,S=ne)),vt(t,Tt,ne=>n(34,k=ne)),vt(t,tn,ne=>n(33,M=ne)),ro(()=>{S&&E&&(Jt.delete(S),E==null||E.removeLayer(S))});let pn;function Nn(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt={event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce};Mt(ne.type,kt)}function En(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;ft&&(E.getCanvas().style.cursor=ft);let Ce=ne.features??[];n(6,Pe=Ce[0]??null);let ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id;Mt("mouseenter",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Nr(ne){var Re,on,qr;if(!it||!E)return;if(Xe&&Rn(ne)!==S){n(6,Pe=null),qe&&pn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:G,id:pn},{hover:!1}),pn=void 0);return}E.getCanvas().style.cursor=ft;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt=(qr=Ce[0])==null?void 0:qr.id;kt!==pn&&(qe&&(pn!==void 0&&(E==null||E.setFeatureState({source:l,id:pn,sourceLayer:G},{hover:!1})),E==null||E.setFeatureState({source:l,id:kt,sourceLayer:G},{hover:!0})),pn=kt,n(6,Pe=Ce[0]??null)),Mt("mousemove",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Jn(ne){if(!(!it||!S||!E)){if(ft&&(E.getCanvas().style.cursor=""),n(6,Pe=null),qe&&pn!==void 0){const Ce={source:l,id:pn,sourceLayer:G};E==null||E.setFeatureState(Ce,{hover:!1}),pn=void 0}Mt("mouseleave",{map:E,layer:S,source:l})}}let On=!0;function Qn(ne){E&&(E.off("click",ne,Nn),E.off("dblclick",ne,Nn),E.off("contextmenu",ne,Nn),E.off("mouseenter",ne,En),E.off("mousemove",ne,Nr),E.off("mouseleave",ne,Jn))}return ro(()=>{E&&S&&Qn(S)}),t.$$set=ne=>{"id"in ne&&n(7,B=ne.id),"source"in ne&&n(8,F=ne.source),"sourceLayer"in ne&&n(9,G=ne.sourceLayer),"beforeId"in ne&&n(10,H=ne.beforeId),"beforeLayerType"in ne&&n(11,K=ne.beforeLayerType),"type"in ne&&n(12,_e=ne.type),"paint"in ne&&n(13,ae=ne.paint),"layout"in ne&&n(14,le=ne.layout),"filter"in ne&&n(15,ve=ne.filter),"applyToClusters"in ne&&n(16,ke=ne.applyToClusters),"minzoom"in ne&&n(17,Q=ne.minzoom),"maxzoom"in ne&&n(18,oe=ne.maxzoom),"manageHoverState"in ne&&n(19,qe=ne.manageHoverState),"hovered"in ne&&n(6,Pe=ne.hovered),"interactive"in ne&&n(20,it=ne.interactive),"hoverCursor"in ne&&n(21,ft=ne.hoverCursor),"eventsIfTopMost"in ne&&n(22,Xe=ne.eventsIfTopMost),"$$scope"in ne&&n(35,N=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=OR(ke)),t.$$.dirty[0]&1073774592&&n(24,i=NR("all",r,ve)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,s=Q??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??M),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=F||C),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==B&&l){S&&(Qn(S),Jt.delete(S));let ne=H;if(!H&&K){let Ce=E.getStyle().layers,ot=typeof K=="function"?K:Re=>Re.type===K,kt=Ce==null?void 0:Ce.find(ot);kt&&(ne=kt.id)}Bt(zt,S=B,S),E.addLayer(Xc({id:S,type:_e,source:l,"source-layer":G,filter:i,paint:ae,layout:le,minzoom:s,maxzoom:c}),ne),n(23,On=!0),E.on("click",S,Nn),E.on("dblclick",S,Nn),E.on("contextmenu",S,Nn),E.on("mouseenter",S,En),E.on("mousemove",S,Nr),E.on("mouseleave",S,Jn)}t.$$.dirty[0]&1048577&&S&&Jt.set(S,{interactive:it}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?I2((ne,Ce)=>E==null?void 0:E.setPaintProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,v=S?I2((ne,Ce)=>E==null?void 0:E.setLayoutProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(ae)),t.$$.dirty[0]&134234112&&(v==null||v(le)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(E==null||E.setLayerZoomRange(S,s,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(On?n(23,On=!1):E==null||E.setFilter(S,i))},[S,At,yt,zt,Tt,tn,Pe,B,F,G,H,K,_e,ae,le,ve,ke,Q,oe,qe,it,ft,Xe,On,i,c,s,v,d,l,r,E,C,M,k,N,R]}let sy=class extends Zt{constructor(e){super(),Ht(this,e,BR,FR,Ut,{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 VR(t){let e;const n=t[16].default,r=gr(n,t,t[24],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16777216)&&yr(r,n,i,i[24],e?_r(n,i[24],s,null):vr(i[24]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function UR(t){let e,n,r;function i(c){t[17](c)}let s={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[VR]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function jR(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{applyToClusters:M=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:B=!1}=e,{hovered:F=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:H=!0}=e;function K(oe){F=oe,n(0,F)}function _e(oe){gn.call(this,t,oe)}function ae(oe){gn.call(this,t,oe)}function le(oe){gn.call(this,t,oe)}function ve(oe){gn.call(this,t,oe)}function ke(oe){gn.call(this,t,oe)}function Q(oe){gn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,s=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,v=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,C=oe.filter),"applyToClusters"in oe&&n(9,M=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,R=oe.maxzoom),"hoverCursor"in oe&&n(12,N=oe.hoverCursor),"manageHoverState"in oe&&n(13,B=oe.manageHoverState),"hovered"in oe&&n(0,F=oe.hovered),"eventsIfTopMost"in oe&&n(14,G=oe.eventsIfTopMost),"interactive"in oe&&n(15,H=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[F,s,c,l,d,v,S,E,C,M,k,R,N,B,G,H,r,K,_e,ae,le,ve,ke,Q,i]}let bm=class extends Zt{constructor(e){super(),Ht(this,e,jR,UR,Ut,{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 GR(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function qR(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[GR]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function WR(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:N=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:F=!1}=e,{interactive:G=!0}=e;function H(Q){B=Q,n(0,B)}function K(Q){gn.call(this,t,Q)}function _e(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ve(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,N=Q.manageHoverState),"hovered"in Q&&n(0,B=Q.hovered),"eventsIfTopMost"in Q&&n(13,F=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[B,s,c,l,d,v,S,E,C,M,k,R,N,F,G,r,H,K,_e,ae,le,ve,ke,i]}let hc=class extends Zt{constructor(e){super(),Ht(this,e,WR,qR,Ut,{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 HR(t,e,n){let r;const{map:i}=fp();vt(t,i,d=>n(4,r=d));let{position:s="top-left"}=e,{container:c=void 0}=e,l=null;return ro(()=>{r!=null&&r.loaded()&&l&&r.removeControl(l)}),t.$$set=d=>{"position"in d&&n(1,s=d.position),"container"in d&&n(2,c=d.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!l){let d;typeof c=="string"?d=document.querySelector(c)??void 0:d=c,n(3,l=new Bs.FullscreenControl({container:d})),r.addControl(l,s)}},[i,s,c,l,r]}class ZR extends Zt{constructor(e){super(),Ht(this,e,HR,null,Ut,{position:1,container:2})}}function XR(t,e,n,r,i){let s=!1;t.getSource(e)&&(s=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(s){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function $R(t,e,n){zE().then(()=>{let r=Fs(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function L2(t){let e=t[0],n,r,i=P2(t);return{c(){i.c(),n=Pi()},m(s,c){i.m(s,c),be(s,n,c),r=!0},p(s,c){c&1&&Ut(e,e=s[0])?(kn(),de(i,1,1,Ct),Dn(),i=P2(s),i.c(),se(i,1),i.m(n.parentNode,n)):i.p(s,c)},i(s){r||(se(i),r=!0)},o(s){de(i),r=!1},d(s){s&&ye(n),i.d(s)}}}function P2(t){let e;const n=t[19].default,r=gr(n,t,t[18],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&262144)&&yr(r,n,i,i[18],e?_r(n,i[18],s,null):vr(i[18]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function YR(t){let e,n,r=t[0]&&L2(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[0]?r?(r.p(i,s),s&1&&se(r,1)):(r=L2(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function KR(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{id:d=hp("geojson")}=e,{data:v}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:C=void 0}=e,{lineMetrics:M=void 0}=e,{cluster:k=void 0}=e,{maxzoom:R=void 0}=e,{attribution:N=void 0}=e,{buffer:B=void 0}=e,{tolerance:F=void 0}=e;const{map:G,cluster:H,self:K}=AR();vt(t,G,le=>n(17,i=le)),vt(t,H,le=>n(20,s=le)),vt(t,K,le=>n(0,r=le));let _e,ae=!0;return ro(()=>{r&&_e&&i&&($R(G,r,_e),Bt(K,r=null,r),n(15,_e=void 0))}),t.$$set=le=>{"id"in le&&n(4,d=le.id),"data"in le&&n(5,v=le.data),"generateId"in le&&n(6,S=le.generateId),"promoteId"in le&&n(7,E=le.promoteId),"filter"in le&&n(8,C=le.filter),"lineMetrics"in le&&n(9,M=le.lineMetrics),"cluster"in le&&n(10,k=le.cluster),"maxzoom"in le&&n(11,R=le.maxzoom),"attribution"in le&&n(12,N=le.attribution),"buffer"in le&&n(13,B=le.buffer),"tolerance"in le&&n(14,F=le.tolerance),"$$scope"in le&&n(18,l=le.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Bt(H,s=k,s),t.$$.dirty&196593&&i&&r!==d&&(Bt(K,r=d,r),XR(i,r,Xc({type:"geojson",data:v,filter:C,lineMetrics:M,generateId:S,promoteId:E,cluster:!!k,clusterMinPoints:k==null?void 0:k.minPoints,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius,clusterProperties:k==null?void 0:k.properties,maxzoom:R,attribution:N,buffer:B,tolerance:F}),le=>i&&le===r,()=>{r&&(n(15,_e=i==null?void 0:i.getSource(r)),n(16,ae=!0))})),t.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,_e=i==null?void 0:i.getSource(d))})),t.$$.dirty&98336&&_e&&(ae?n(16,ae=!1):_e.setData(v)),t.$$.dirty&33792&&(_e==null||_e.setClusterOptions(Xc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,G,H,K,d,v,S,E,C,M,k,R,N,B,F,_e,ae,i,l,c]}let No=class extends Zt{constructor(e){super(),Ht(this,e,KR,YR,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function JR(t,e,n){let r;const{map:i}=fp();vt(t,i,C=>n(8,r=C));let{position:s="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:l=void 0}=e,{trackUserLocation:d=!1}=e,{showAccuracyCircle:v=!0}=e,{showUserLocation:S=!0}=e,{control:E=null}=e;return ro(()=>{r!=null&&r.loaded()&&E&&r.removeControl(E)}),t.$$set=C=>{"position"in C&&n(2,s=C.position),"positionOptions"in C&&n(3,c=C.positionOptions),"fitBoundsOptions"in C&&n(4,l=C.fitBoundsOptions),"trackUserLocation"in C&&n(5,d=C.trackUserLocation),"showAccuracyCircle"in C&&n(6,v=C.showAccuracyCircle),"showUserLocation"in C&&n(7,S=C.showUserLocation),"control"in C&&n(1,E=C.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!E&&(n(1,E=new Bs.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:d,showAccuracyCircle:v,showUserLocation:S})),r.addControl(E,s))},[i,E,s,c,l,d,v,S,r]}class QR extends Zt{constructor(e){super(),Ht(this,e,JR,null,Ut,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function eN(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function tN(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[eN]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function nN(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:N=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:F=!1}=e,{interactive:G=!0}=e;function H(Q){B=Q,n(0,B)}function K(Q){gn.call(this,t,Q)}function _e(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ve(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,N=Q.manageHoverState),"hovered"in Q&&n(0,B=Q.hovered),"eventsIfTopMost"in Q&&n(13,F=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[B,s,c,l,d,v,S,E,C,M,k,R,N,F,G,r,H,K,_e,ae,le,ve,ke,i]}let fc=class extends Zt{constructor(e){super(),Ht(this,e,nN,tN,Ut,{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 rN(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),s=Math.round(e.lat*i)/i,c=Math.round(e.lng*i)/i,l=`${n}/${s}/${c}`,d=t.getBearing(),v=t.getPitch();return(d||v)&&(l+=`/${Math.round(d*10)/10}`),v&&(l+=`/${Math.round(v)}`),`#${l}`}function iN(t){return t.replace("#","").split("/").map(parseFloat)}var vf=q1;function q1(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?M2(t,e):{}.toString.call(t)=="[object Set]"?M2(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?sN(t,e):oN(t,e)}function oN(t,e){return t.toString()===e.toString()}function M2(t,e){var n=t.length;if(n!=e.length)return!1;for(var r=0;rn(6,r=S));let{position:s="top-left"}=e,{showCompass:c=!0}=e,{showZoom:l=!0}=e,{visualizePitch:d=!1}=e,v=null;return ro(()=>{r!=null&&r.loaded()&&v&&r.removeControl(v)}),t.$$set=S=>{"position"in S&&n(1,s=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,l=S.showZoom),"visualizePitch"in S&&n(4,d=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!v&&(n(5,v=new Bs.NavigationControl({showCompass:c,showZoom:l,visualizePitch:d})),r.addControl(v,s))},[i,s,c,l,d,v,r]}class lN extends Zt{constructor(e){super(),Ht(this,e,aN,null,Ut,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function uN(t,e,n){let r;const{map:i}=fp();vt(t,i,v=>n(5,r=v));let{position:s="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:l="metric"}=e,d=null;return ro(()=>{r!=null&&r.loaded()&&d&&r.removeControl(d)}),t.$$set=v=>{"position"in v&&n(1,s=v.position),"maxWidth"in v&&n(2,c=v.maxWidth),"unit"in v&&n(3,l=v.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!d&&(n(4,d=new Bs.ScaleControl({maxWidth:c,unit:l})),r.addControl(d,s))},[i,s,c,l,d,r]}class cN extends Zt{constructor(e){super(),Ht(this,e,uN,null,Ut,{position:1,maxWidth:2,unit:3})}}const{window:hN}=h1,fN=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),A2=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function k2(t){let e,n,r=t[3]&&D2(t);const i=t[40].default,s=gr(i,t,t[39],A2);return{c(){r&&r.c(),e=We(),s&&s.c()},m(c,l){r&&r.m(c,l),be(c,e,l),s&&s.m(c,l),n=!0},p(c,l){c[3]?r?(r.p(c,l),l[0]&8&&se(r,1)):(r=D2(c),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn()),s&&s.p&&(!n||l[0]&112|l[1]&256)&&yr(s,i,c,c[39],n?_r(i,c[39],l,fN):vr(c[39]),A2)},i(c){n||(se(r),se(s,c),n=!0)},o(c){de(r),de(s,c),n=!1},d(c){c&&ye(e),r&&r.d(c),s&&s.d(c)}}}function D2(t){let e,n,r,i,s,c,l,d;return e=new lN({props:{position:t[7]}}),r=new QR({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),s=new ZR({props:{position:t[7]}}),l=new cN({props:{position:t[7]}}),{c(){je(e.$$.fragment),n=We(),je(r.$$.fragment),i=We(),je(s.$$.fragment),c=We(),je(l.$$.fragment)},m(v,S){Be(e,v,S),be(v,n,S),Be(r,v,S),be(v,i,S),Be(s,v,S),be(v,c,S),Be(l,v,S),d=!0},p(v,S){const E={};S[0]&128&&(E.position=v[7]),e.$set(E);const C={};S[0]&128&&(C.position=v[7]),r.$set(C);const M={};S[0]&128&&(M.position=v[7]),s.$set(M);const k={};S[0]&128&&(k.position=v[7]),l.$set(k)},i(v){d||(se(e.$$.fragment,v),se(r.$$.fragment,v),se(s.$$.fragment,v),se(l.$$.fragment,v),d=!0)},o(v){de(e.$$.fragment,v),de(r.$$.fragment,v),de(s.$$.fragment,v),de(l.$$.fragment,v),d=!1},d(v){v&&(ye(n),ye(i),ye(c)),Ve(e,v),Ve(r,v),Ve(s,v),Ve(l,v)}}}function pN(t){let e,n,r,i,s,c=t[4]&&t[0]&&k2(t);return{c(){e=ge("div"),c&&c.c(),Le(e,"class",n=c_(t[2])+" svelte-p00lfq"),Le(e,"data-testid","map-container"),xl(e,"expand-map",!t[2])},m(l,d){be(l,e,d),c&&c.m(e,null),t[41](e),r=!0,i||(s=[Lt(hN,"hashchange",t[11]),hv(t[10].call(null,e))],i=!0)},p(l,d){l[4]&&l[0]?c?(c.p(l,d),d[0]&17&&se(c,1)):(c=k2(l),c.c(),se(c,1),c.m(e,null)):c&&(kn(),de(c,1,1,()=>{c=null}),Dn()),(!r||d[0]&4&&n!==(n=c_(l[2])+" svelte-p00lfq"))&&Le(e,"class",n),(!r||d[0]&4)&&xl(e,"expand-map",!l[2])},i(l){r||(se(c),r=!0)},o(l){de(c),r=!1},d(l){l&&ye(e),c&&c.d(),t[41](null),i=!1,Yr(s)}}}function dN(t,e,n){let r,i,s,c,{$$slots:l={},$$scope:d}=e,{map:v=null}=e,{mapContainer:S=void 0}=e,{class:E=void 0}=e,{style:C}=e,{diffStyleUpdates:M=!1}=e,{center:k=void 0}=e,{zoom:R=void 0}=e,{pitch:N=0}=e,{bearing:B=0}=e,{bounds:F=void 0}=e,{hash:G=!1}=e,{updateHash:H=ne=>{window.history.replaceState(window.history.state,"",ne)}}=e,{loaded:K=!1}=e,{minZoom:_e=0}=e,{maxZoom:ae=22}=e,{antialias:le=void 0}=e,{zoomOnDoubleClick:ve=!0}=e,{locale:ke=void 0}=e,{interactive:Q=!0}=e,{attributionControl:oe=!0}=e,{cooperativeGestures:qe=!1}=e,{preserveDrawingBuffer:Pe=!1}=e,{maxBounds:it=void 0}=e,{images:ft=[]}=e,{standardControls:Xe=!1}=e,{filterLayers:Mt=void 0}=e,{transformRequest:At=void 0}=e;const yt=vu(),{map:zt,loadedImages:Tt}=MR();vt(t,zt,ne=>n(4,s=ne)),vt(t,Tt,ne=>n(5,c=ne));let tn=new Set;async function Rn(ne,Ce=!1){if(s&&!(!s.loaded()&&!Ce))if("url"in ne){tn.add(ne.id);try{let ot=await s.loadImage(ne.url);s==null||s.addImage(ne.id,ot.data,ne.options),c.add(ne.id),Tt.set(c)}catch(ot){yt("error",ot)}finally{tn.delete(ne.id)}}else s.addImage(ne.id,ne.data,ne.options),c.add(ne.id),Tt.set(c)}let Jt,pn,Nn,En;function Nr(ne){return On(),Bt(zt,s=new Bs.Map(Xc({container:ne,style:C,locale:ke,center:k,zoom:R,pitch:N,bearing:B,minZoom:_e,maxZoom:ae,antialias:le,interactive:Q,preserveDrawingBuffer:Pe,maxBounds:it,bounds:F,attributionControl:oe,transformRequest:At,cooperativeGestures:qe})),s),s.on("load",Ce=>{Ce.target.getContainer().setAttribute("data-testid","map"),Ce.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,K=!0),yt("load",s)}),s.on("error",Ce=>yt("error",{...Ce,map:s})),s.on("movestart",Ce=>yt("movestart",{...Ce,map:s})),s.on("moveend",Ce=>{if(n(12,k=Ce.target.getCenter()),n(13,R=Ce.target.getZoom()),n(14,N=Ce.target.getPitch()),n(15,B=Ce.target.getBearing()),n(16,F=Ce.target.getBounds()),yt("moveend",{...Ce,map:s}),G){let ot=new URL(window.location.href.replace(/(#.+)?$/,rN(s)));H(ot)}}),s.on("click",Ce=>yt("click",{...Ce,map:s})),s.on("dblclick",Ce=>yt("dblclick",{...Ce,map:s})),s.on("contextmenu",Ce=>yt("contextmenu",{...Ce,map:s})),s.on("zoomstart",Ce=>yt("zoomstart",{...Ce,map:s})),s.on("zoom",Ce=>{yt("zoom",{...Ce,map:s})}),s.on("zoomend",Ce=>{yt("zoomend",{...Ce,map:s})}),s.on("style.load",()=>{if(s){const Ce=s.getStyle();if(n(36,Jt=Ce.layers.map(ot=>ot.id)),n(37,pn=Object.keys(Ce.sources)),En)for(const[ot,kt]of Object.entries(En))s.addSource(ot,kt);if(Nn)for(const ot of Nn)s.addLayer(ot);for(const ot of ft)Rn(ot,!0)}}),s.on("styledata",Ce=>{if(s&&Mt){const ot=s.getStyle().layers;if(ot)for(let kt of ot)Mt(kt)||s.setLayoutProperty(kt.id,"visibility","none")}yt("styledata",{...Ce,map:s})}),{destroy(){n(0,K=!1),s==null||s.remove(),Bt(zt,s=null,s)}}}let Jn=C;function On(){if(G){let ne=iN(window.location.hash);ne.length>=3&&(n(13,R=ne[0]),n(12,k=[ne[2],ne[1]])),ne.length==5&&(n(15,B=ne[3]),n(14,N=ne[4]))}}function Qn(ne){si[ne?"unshift":"push"](()=>{S=ne,n(1,S)})}return t.$$set=ne=>{"map"in ne&&n(17,v=ne.map),"mapContainer"in ne&&n(1,S=ne.mapContainer),"class"in ne&&n(2,E=ne.class),"style"in ne&&n(18,C=ne.style),"diffStyleUpdates"in ne&&n(19,M=ne.diffStyleUpdates),"center"in ne&&n(12,k=ne.center),"zoom"in ne&&n(13,R=ne.zoom),"pitch"in ne&&n(14,N=ne.pitch),"bearing"in ne&&n(15,B=ne.bearing),"bounds"in ne&&n(16,F=ne.bounds),"hash"in ne&&n(20,G=ne.hash),"updateHash"in ne&&n(21,H=ne.updateHash),"loaded"in ne&&n(0,K=ne.loaded),"minZoom"in ne&&n(22,_e=ne.minZoom),"maxZoom"in ne&&n(23,ae=ne.maxZoom),"antialias"in ne&&n(24,le=ne.antialias),"zoomOnDoubleClick"in ne&&n(25,ve=ne.zoomOnDoubleClick),"locale"in ne&&n(26,ke=ne.locale),"interactive"in ne&&n(27,Q=ne.interactive),"attributionControl"in ne&&n(28,oe=ne.attributionControl),"cooperativeGestures"in ne&&n(29,qe=ne.cooperativeGestures),"preserveDrawingBuffer"in ne&&n(30,Pe=ne.preserveDrawingBuffer),"maxBounds"in ne&&n(31,it=ne.maxBounds),"images"in ne&&n(32,ft=ne.images),"standardControls"in ne&&n(3,Xe=ne.standardControls),"filterLayers"in ne&&n(33,Mt=ne.filterLayers),"transformRequest"in ne&&n(34,At=ne.transformRequest),"$$scope"in ne&&n(39,d=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof Xe=="boolean"?void 0:Xe),t.$$.dirty[0]&16&&n(17,v=s),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&s&&!vf(C,Jn)){const ne=s.getStyle();if(Jt&&(Nn=ne.layers.filter(Ce=>!Jt.includes(Ce.id))),pn){const Ce=Object.keys(ne.sources).filter(ot=>!pn.includes(ot));En={};for(const ot of Ce)En[ot]=ne.sources[ot]}n(38,Jn=C),s.setStyle(C,{diff:M}),Bt(Tt,c=new Set,c),n(35,tn=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&K&&s!=null&&s.loaded())for(let ne of ft)!c.has(ne.id)&&!tn.has(ne.id)&&!s.hasImage(ne.id)&&Rn(ne);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,i=ft.every(ne=>c.has(ne.id))),t.$$.dirty[0]&61456&&s){let ne={};k!=null&&!vf(k,s==null?void 0:s.getCenter())&&(ne.center=k),R!=null&&!vf(R,s==null?void 0:s.getZoom())&&(ne.zoom=R),B!=null&&!vf(B,s==null?void 0:s.getBearing())&&(ne.bearing=B),N!=null&&!vf(N,s==null?void 0:s.getPitch())&&(ne.pitch=N),Object.keys(ne).length&&s.easeTo(ne)}t.$$.dirty[0]&65552&&F&&!vf(F,s==null?void 0:s.getBounds())&&(s==null||s.fitBounds(F)),t.$$.dirty[0]&33554448&&(ve?s==null||s.doubleClickZoom.enable():s==null||s.doubleClickZoom.disable())},[K,S,E,Xe,s,c,i,r,zt,Tt,Nr,On,k,R,N,B,F,v,C,M,G,H,_e,ae,le,ve,ke,Q,oe,qe,Pe,it,ft,Mt,At,tn,Jt,pn,Jn,d,l,Qn]}class mN extends Zt{constructor(e){super(),Ht(this,e,dN,pN,Ut,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const gN=t=>({marker:t&8}),R2=t=>({marker:t[3]});function _N(t){let e,n,r,i,s,c,l;const d=t[19].default,v=gr(d,t,t[18],R2);return{c(){e=ge("div"),v&&v.c(),Le(e,"tabindex",n=t[1]?0:void 0),Le(e,"role",r=t[1]?"button":void 0),lr(e,"z-index",t[2])},m(S,E){be(S,e,E),v&&v.m(e,null),s=!0,c||(l=[hv(t[7].call(null,e)),hv(i=yN.call(null,e,t[0])),Lt(e,"click",k0(t[20])),Lt(e,"dblclick",k0(t[21])),Lt(e,"contextmenu",k0(t[22])),Lt(e,"mouseenter",t[23]),Lt(e,"mouseleave",t[24]),Lt(e,"mousemove",t[25]),Lt(e,"keydown",t[8])],c=!0)},p(S,[E]){v&&v.p&&(!s||E&262152)&&yr(v,d,S,S[18],s?_r(d,S[18],E,gN):vr(S[18]),R2),(!s||E&2&&n!==(n=S[1]?0:void 0))&&Le(e,"tabindex",n),(!s||E&2&&r!==(r=S[1]?"button":void 0))&&Le(e,"role",r),i&&X_(i.update)&&E&1&&i.update.call(null,S[0]),E&4&&lr(e,"z-index",S[2])},i(S){s||(se(v,S),s=!0)},o(S){de(v,S),s=!1},d(S){S&&ye(e),v&&v.d(S),c=!1,Yr(l)}}}function yN(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function vN(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{marker:d=void 0}=e,{lngLat:v}=e,{class:S=void 0}=e,{interactive:E=!0}=e,{asButton:C=!1}=e,{draggable:M=!1}=e,{feature:k=null}=e,{offset:R=void 0}=e,{zIndex:N=void 0}=e,{rotation:B=0}=e,{opacity:F=1}=e;const G=vu(),{map:H,layerEvent:K,self:_e}=DR();vt(t,H,Xe=>n(27,s=Xe)),vt(t,K,Xe=>n(26,r=Xe)),vt(t,_e,Xe=>n(3,i=Xe));function ae(Xe){Bt(_e,i=new Bs.Marker({element:Xe,rotation:B,draggable:M,offset:R,opacity:F.toString()}).setLngLat(v).addTo(s),i),n(11,d=i);const Mt=()=>ke("dragstart"),At=()=>{le(),ke("drag")},yt=()=>{le(),ke("dragend")};return M&&(i.on("dragstart",Mt),i.on("drag",At),i.on("dragend",yt)),{destroy(){M&&(i==null||i.off("dragstart",Mt),i==null||i.off("drag",At),i==null||i.off("dragend",yt)),n(11,d=void 0),i==null||i.remove()}}}function le(){let Xe=i==null?void 0:i.getLngLat();Xe&&(Array.isArray(v)?n(10,v=[Xe.lng,Xe.lat]):v&&"lon"in v?n(10,v={lon:Xe.lng,lat:Xe.lat}):n(10,v=Xe))}function ve(Xe){Xe.key===" "&&(Xe.preventDefault(),Xe.stopPropagation(),ke("click"))}function ke(Xe){if(!E)return;let Mt=i==null?void 0:i.getLngLat();if(!Mt)return;const At=[Mt.lng,Mt.lat];let yt={map:s,marker:i,lngLat:At,features:[{type:"Feature",properties:(k==null?void 0:k.properties)??{},geometry:{type:"Point",coordinates:At}}]};Bt(K,r={...yt,layerType:"marker",type:Xe},r),G(Xe,yt)}const Q=()=>ke("click"),oe=()=>ke("dblclick"),qe=()=>ke("contextmenu"),Pe=Xe=>{ke("mouseenter")},it=()=>{ke("mouseleave")},ft=()=>ke("mousemove");return t.$$set=Xe=>{"marker"in Xe&&n(11,d=Xe.marker),"lngLat"in Xe&&n(10,v=Xe.lngLat),"class"in Xe&&n(0,S=Xe.class),"interactive"in Xe&&n(12,E=Xe.interactive),"asButton"in Xe&&n(1,C=Xe.asButton),"draggable"in Xe&&n(13,M=Xe.draggable),"feature"in Xe&&n(14,k=Xe.feature),"offset"in Xe&&n(15,R=Xe.offset),"zIndex"in Xe&&n(2,N=Xe.zIndex),"rotation"in Xe&&n(16,B=Xe.rotation),"opacity"in Xe&&n(17,F=Xe.opacity),"$$scope"in Xe&&n(18,l=Xe.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(v)),t.$$.dirty&32776&&(i==null||i.setOffset(R??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(B)),t.$$.dirty&131080&&(i==null||i.setOpacity(F.toString()))},[S,C,N,i,H,K,_e,ae,ve,ke,v,d,E,M,k,R,B,F,l,c,Q,oe,qe,Pe,it,ft]}class N2 extends Zt{constructor(e){super(),Ht(this,e,vN,_N,Ut,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const bN=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),O2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function z2(t){let e,n,r=(t[4]||t[3]instanceof Bs.Marker)&&F2(t);return{c(){e=ge("div"),r&&r.c()},m(i,s){be(i,e,s),r&&r.m(e,null),t[32](e),n=!0},p(i,s){i[4]||i[3]instanceof Bs.Marker?r?(r.p(i,s),s[0]&24&&se(r,1)):(r=F2(i),r.c(),se(r,1),r.m(e,null)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(),t[32](null)}}}function F2(t){let e;const n=t[30].default,r=gr(n,t,t[29],O2);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[0]&536870933)&&yr(r,n,i,i[29],e?_r(n,i[29],s,bN):vr(i[29]),O2)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function xN(t){let e,n,r=t[9].default&&z2(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,s){i[9].default?r?(r.p(i,s),s[0]&512&&se(r,1)):(r=z2(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function wN(t,e,n){let r,i,s,c,l,d,{$$slots:v={},$$scope:S}=e;const E=BP(v);let{closeButton:C=void 0}=e,{closeOnClickOutside:M=!0}=e,{closeOnClickInside:k=!1}=e,{closeOnMove:R=!1}=e,{openOn:N="click"}=e,{openIfTopMost:B=!0}=e,{focusAfterOpen:F=!0}=e,{anchor:G=void 0}=e,{offset:H=void 0}=e,{popupClass:K=void 0}=e,{maxWidth:_e=void 0}=e,{lngLat:ae=void 0}=e,{html:le=void 0}=e,{open:ve=!1}=e;const ke=vu(),{map:Q,popupTarget:oe,layerEvent:qe,layer:Pe,eventTopMost:it}=fp();vt(t,Q,Ce=>n(2,s=Ce)),vt(t,oe,Ce=>n(3,l=Ce)),vt(t,qe,Ce=>n(28,c=Ce)),vt(t,Pe,Ce=>n(35,d=Ce));const ft=["click","dblclick","contextmenu"];let Xe,Mt=!1,At;function yt(){if(!Xe)return;let Ce=Xe.getElement();!Ce||Ce===At||(At=Ce,N==="hover"&&(At.style.pointerEvents="none"),At.addEventListener("mouseenter",()=>{n(24,Mt=!0)},{passive:!0}),At.addEventListener("mouseleave",()=>{n(24,Mt=!1)},{passive:!0}),At.addEventListener("click",()=>{k&&n(0,ve=!1)},{passive:!0}))}$_(()=>{if(s)return s.on("click",Jn),s.on("contextmenu",Jn),typeof l=="string"&&(s.on("click",l,Rn),s.on("dblclick",l,Rn),s.on("contextmenu",l,Rn),s.on("mousemove",l,Nr),s.on("mouseleave",l,En),s.on("touchstart",l,pn),s.on("touchend",l,Nn)),()=>{s!=null&&s.loaded()&&(Xe==null||Xe.remove(),s.off("click",Jn),s.off("contextmenu",Jn),l instanceof Bs.Marker?l.getPopup()===Xe&&l.setPopup(void 0):typeof l=="string"&&(s.off("click",l,Rn),s.off("dblclick",l,Rn),s.off("contextmenu",l,Rn),s.off("mousemove",l,Nr),s.off("mouseleave",l,En),s.off("touchstart",l,pn),s.off("touchend",l,Nn)))}});function zt(Ce){return B?!("marker"in Ce)&&!RR(Ce)&&it(Ce)!==d:!1}let Tt=null,tn="normal";function Rn(Ce){Ce.type===N&&(zt(Ce)||("layerType"in Ce?Ce.layerType==="deckgl"?(n(10,ae=Ce.coordinate),n(4,Tt=Ce.object?[Ce.object]:null)):(n(10,ae=Ce.lngLat),n(4,Tt=Ce.features??[])):(n(10,ae=Ce.lngLat),n(4,Tt=Ce.features??[])),setTimeout(()=>n(0,ve=!0))))}let Jt=null;function pn(Ce){Jt=Ce.point}function Nn(Ce){if(!Jt||N!=="hover")return;let ot=Jt.dist(Ce.point);Jt=null,ot<3&&(n(10,ae=Ce.lngLat),n(4,Tt=Ce.features??[]),Xe.isOpen()?n(25,tn="justOpened"):(n(25,tn="opening"),n(0,ve=!0)))}function En(Ce){N!=="hover"||Jt||tn!=="normal"||(n(0,ve=!1),n(4,Tt=null))}function Nr(Ce){if(!(N!=="hover"||Jt||tn!=="normal")){if(zt(Ce)){n(0,ve=!1),n(4,Tt=null);return}n(0,ve=!0),n(4,Tt=Ce.features??[]),n(10,ae=Ce.lngLat)}}function Jn(Ce){if(tn==="justOpened"){n(25,tn="normal");return}if(!M)return;let ot=[At,l instanceof Bs.Marker?l==null?void 0:l.getElement():null];ve&&Xe.isOpen()&&!ot.some(kt=>kt==null?void 0:kt.contains(Ce.originalEvent.target))&&(Ce.type==="contextmenu"&&N==="contextmenu"||Ce.type!=="contextmenu")&&n(0,ve=!1)}ro(()=>{s&&(Xe!=null&&Xe.isOpen())&&Xe.remove()});let On;const Qn=()=>n(0,ve=!1);function ne(Ce){si[Ce?"unshift":"push"](()=>{On=Ce,n(1,On)})}return t.$$set=Ce=>{"closeButton"in Ce&&n(11,C=Ce.closeButton),"closeOnClickOutside"in Ce&&n(12,M=Ce.closeOnClickOutside),"closeOnClickInside"in Ce&&n(13,k=Ce.closeOnClickInside),"closeOnMove"in Ce&&n(14,R=Ce.closeOnMove),"openOn"in Ce&&n(15,N=Ce.openOn),"openIfTopMost"in Ce&&n(16,B=Ce.openIfTopMost),"focusAfterOpen"in Ce&&n(17,F=Ce.focusAfterOpen),"anchor"in Ce&&n(18,G=Ce.anchor),"offset"in Ce&&n(19,H=Ce.offset),"popupClass"in Ce&&n(20,K=Ce.popupClass),"maxWidth"in Ce&&n(21,_e=Ce.maxWidth),"lngLat"in Ce&&n(10,ae=Ce.lngLat),"html"in Ce&&n(22,le=Ce.html),"open"in Ce&&n(0,ve=Ce.open),"$$scope"in Ce&&n(29,S=Ce.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=C??(!M&&!k)),t.$$.dirty[0]&146685952&&(Xe||(n(23,Xe=new Bs.Popup({closeButton:r,closeOnClick:!1,closeOnMove:R,focusAfterOpen:F,maxWidth:_e,className:K,anchor:G,offset:H})),At=Xe.getElement(),Xe.on("open",()=>{n(0,ve=!0),yt(),ke("open",Xe)}),Xe.on("close",()=>{n(0,ve=!1),ke("close",Xe)}),Xe.on("hover",()=>{ke("hover",Xe)}))),t.$$.dirty[0]&8421384&&Xe&&l instanceof Bs.Marker&&(N==="click"?l.setPopup(Xe):l.getPopup()===Xe&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&ft.includes(N)&&(c==null?void 0:c.type)===N&&(Rn(c),Bt(qe,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=N==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&N==="hover"&&qe&&(i&&c&&(c.layerType==="deckgl"?(n(10,ae=c.coordinate),n(4,Tt=c.object?[c.object]:null)):(n(10,ae=c.lngLat),n(4,Tt=c.features??[]))),n(0,ve=(i||Mt)??!1)),t.$$.dirty[0]&12582914&&(On?Xe.setDOMContent(On):le&&Xe.setHTML(le)),t.$$.dirty[0]&8389632&&ae&&Xe.setLngLat(ae),t.$$.dirty[0]&41943045&&s){let Ce=Xe.isOpen();ve&&!Ce?(Xe.addTo(s),tn==="opening"&&n(25,tn="justOpened")):!ve&&Ce&&Xe.remove()}},[ve,On,s,l,Tt,Q,oe,qe,Pe,E,ae,C,M,k,R,N,B,F,G,H,K,_e,le,Xe,Mt,tn,i,r,c,S,v,Qn,ne]}class SN extends Zt{constructor(e){super(),Ht(this,e,wN,xN,Ut,{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 EN(t){let e;const n=t[16].default,r=gr(n,t,t[24],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16777216)&&yr(r,n,i,i[24],e?_r(n,i[24],s,null):vr(i[24]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function IN(t){let e,n,r;function i(c){t[17](c)}let s={id:t[1],type:"symbol",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[EN]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function CN(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("symbol")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S=void 0}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{applyToClusters:M=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:B=!1}=e,{hovered:F=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:H=!0}=e;function K(oe){F=oe,n(0,F)}function _e(oe){gn.call(this,t,oe)}function ae(oe){gn.call(this,t,oe)}function le(oe){gn.call(this,t,oe)}function ve(oe){gn.call(this,t,oe)}function ke(oe){gn.call(this,t,oe)}function Q(oe){gn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,s=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,v=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,C=oe.filter),"applyToClusters"in oe&&n(9,M=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,R=oe.maxzoom),"hoverCursor"in oe&&n(12,N=oe.hoverCursor),"manageHoverState"in oe&&n(13,B=oe.manageHoverState),"hovered"in oe&&n(0,F=oe.hovered),"eventsIfTopMost"in oe&&n(14,G=oe.eventsIfTopMost),"interactive"in oe&&n(15,H=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[F,s,c,l,d,v,S,E,C,M,k,R,N,B,G,H,r,K,_e,ae,le,ve,ke,Q,i]}class mC extends Zt{constructor(e){super(),Ht(this,e,CN,IN,Ut,{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 xm=Uint8Array,gC=Uint16Array,TN=Int32Array,LN=new xm([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]),PN=new xm([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]),_C=function(t,e){for(var n=new gC(31),r=0;r<31;++r)n[r]=e+=1<>1|(ir&21845)<<1,eu=(eu&52428)>>2|(eu&13107)<<2,eu=(eu&61680)>>4|(eu&3855)<<4,kN[ir]=((eu&65280)>>8|(eu&255)<<8)>>1;var eu,ir,ay=new xm(288);for(ir=0;ir<144;++ir)ay[ir]=8;var ir;for(ir=144;ir<256;++ir)ay[ir]=9;var ir;for(ir=256;ir<280;++ir)ay[ir]=7;var ir;for(ir=280;ir<288;++ir)ay[ir]=8;var ir,DN=new xm(32);for(ir=0;ir<32;++ir)DN[ir]=5;var ir,RN=new xm(0),NN=typeof TextDecoder<"u"&&new TextDecoder,ON=0;try{NN.decode(RN,{stream:!0}),ON=1}catch{}var zN=Object.defineProperty,FN=(t,e,n)=>e in t?zN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B2=(t,e,n)=>(FN(t,typeof e!="symbol"?e+"":e,n),n);function Qd(){}function vC(t){return t()}function V2(){return Object.create(null)}function ly(t){t.forEach(vC)}function bC(t){return typeof t=="function"}function BN(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function VN(t){return Object.keys(t).length===0}function UN(t,e){t.appendChild(e)}function jN(t,e,n){t.insertBefore(e,n||null)}function xC(t){t.parentNode&&t.parentNode.removeChild(t)}function U2(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Uu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function GN(t){return Array.from(t.childNodes)}function Vg(t,e,n){t.classList.toggle(e,!!n)}let W1;function Wd(t){W1=t}const Ef=[],j2=[];let Mf=[];const G2=[],qN=Promise.resolve();let Gv=!1;function WN(){Gv||(Gv=!0,qN.then(wC))}function qv(t){Mf.push(t)}const rv=new Set;let bf=0;function wC(){if(bf!==0)return;const t=W1;do{try{for(;bft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Mf=e}const XN=new Set;function $N(t,e){t&&t.i&&(XN.delete(t),t.i(e))}function YN(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),qv(()=>{const s=t.$$.on_mount.map(vC).filter(bC);t.$$.on_destroy?t.$$.on_destroy.push(...s):ly(s),t.$$.on_mount=[]}),i.forEach(qv)}function KN(t,e){const n=t.$$;n.fragment!==null&&(ZN(n.after_update),ly(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function JN(t,e){t.$$.dirty[0]===-1&&(Ef.push(t),WN(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=M.length?M[0]:C;return v.ctx&&i(v.ctx[E],v.ctx[E]=k)&&(!v.skip_bound&&v.bound[E]&&v.bound[E](k),S&&JN(t,E)),C}):[],v.update(),S=!0,ly(v.before_update),v.fragment=r?r(v.ctx):!1,e.target){if(e.hydrate){const E=GN(e.target);v.fragment&&v.fragment.l(E),E.forEach(xC)}else v.fragment&&v.fragment.c();e.intro&&$N(t.$$.fragment),YN(t,e.target,e.anchor),wC()}Wd(d)}class eO{constructor(){B2(this,"$$"),B2(this,"$$set")}$destroy(){KN(this,1),this.$destroy=Qd}$on(e,n){if(!bC(n))return Qd;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!VN(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const tO="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(tO);function nO(t){let e,n,r;return{c(){e=U2("svg"),n=U2("path"),Uu(n,"stroke-width","4"),Uu(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"),Uu(n,"class","svelte-gzo3ar"),Uu(e,"width",r=t[0]==="list"?20:void 0),Uu(e,"viewBox","0 0 70 85"),Uu(e,"fill","none"),Uu(e,"class","svelte-gzo3ar"),Vg(e,"in-map",t[0]!=="list"),Vg(e,"list-icon",t[0]==="list")},m(i,s){jN(i,e,s),UN(e,n)},p(i,[s]){s&1&&r!==(r=i[0]==="list"?20:void 0)&&Uu(e,"width",r),s&1&&Vg(e,"in-map",i[0]!=="list"),s&1&&Vg(e,"list-icon",i[0]==="list")},i:Qd,o:Qd,d(i){i&&xC(e)}}}function rO(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class iO extends eO{constructor(e){super(),QN(this,e,rO,nO,BN,{displayIn:0})}}const oO=[{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"}],sO={decimalLatitude:40.123,decimalLongitude:-74.123},aO=[{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}],lO=[{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 uO(){const t=[];return oO.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...sO})}),[...t,...aO,...lO]}const cO=uO();cO.map(t=>t.verbatimCoordinates);/** + data.`,S=We(),E=_e("center"),C=_e("button"),C.textContent="Start!"},m(F,U){be(F,e,U),be(F,n,U),be(F,r,U),be(F,i,U),be(F,s,U),be(F,c,U),be(F,l,U),be(F,d,U),be(F,v,U),be(F,S,U),be(F,E,U),te(E,C),M||(k=Lt(C,"click",R),M=!0)},p(F,U){t=F},d(F){F&&(ve(e),ve(n),ve(r),ve(i),ve(s),ve(c),ve(l),ve(d),ve(v),ve(S),ve(E)),M=!1,k()}}}function SR(t){let e,n,r=t[0]&&S2(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[0]?r?(r.p(i,s),s&1&&se(r,1)):(r=S2(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function ER(t,e,n){let r;return vt(t,A_,c=>n(0,r=c)),[r,c=>kr(c).close(),()=>Bt(A_,r=!1,r)]}class IR extends Zt{constructor(e){super(),Ht(this,e,ER,SR,Ut,{})}}const CR="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAk0lEQVRIS+3U0Q2AIAwEUNjMUXQydRJH0zZB0wjGuwJfSsKfuWfO1hg6n9g5P3wPWKTSXe6EVstUNEjoloIVghAG0OxR7swgLEAjHoBCvACM1AAQUgJ0DL0nm67WwJom7XrBlhVl4arUAHYniuE1ABTuBeBwD0CFs4D92T12fp9v9iPrnJ8LBu0KC0Ch9qEfeK3sAPceHxk8hJ17AAAAAElFTkSuQmCC",TR="/ltn/assets/logo-97f2d067.svg";let LR=Date.now();function hp(t){return`${t}-${LR++}`}const j1=Symbol.for("svelte-maplibre");function fp(){return RE(j1)}function PR(t){let e=new WeakMap;return n=>{var c;let r=e.get(n.originalEvent);if(r!==void 0)return r;let s=(c=n.target.queryRenderedFeatures(n.point).find(l=>{var d;return(d=t.get(l.layer.id))==null?void 0:d.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,s),s}}function MR(){let t=new Map;return p1(j1,{map:Fn(null),source:R0(null),layer:R0(null),popupTarget:R0(null),cluster:Fn(),loadedImages:Fn(new Set),minzoom:Fn(0),maxzoom:Fn(24),layerEvent:Fn(null),layerInfo:t,eventTopMost:PR(t)})}function E2(t){return{subscribe:t.subscribe}}function G1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=fp(),s=Fn(null),c=E2(s),l={...i,[t]:E2(s)};if(e&&(l.popupTarget=c),r){let d=Fn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Fn()),p1(j1,l),{...i,self:s}}function AR(){return G1({key:"source",setCluster:!0})}function kR(t=!0){return G1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function DR(){return G1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function RR(t){return"layerType"in t&&t.layerType==="deckgl"}function I2(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],s=n[r];i!==s&&t(r,s,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function NR(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function OR(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Of(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var Xc=zR;function zR(t){var e,n,r;if(t){if(Array.isArray(t)){for(e=[],n=t.length,r=0;r{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function BR(t,e,n){let r,i,s,c,l,d,v,S,E,C,M,k,{$$slots:R={},$$scope:F}=e,{id:U=hp("layer")}=e,{source:z=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:q=void 0}=e,{beforeLayerType:X=void 0}=e,{type:de}=e,{paint:ae=void 0}=e,{layout:le=void 0}=e,{filter:ye=void 0}=e,{applyToClusters:ke=void 0}=e,{minzoom:Q=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:qe=!1}=e,{hovered:Pe=null}=e,{interactive:it=!0}=e,{hoverCursor:ft=void 0}=e,{eventsIfTopMost:Xe=!1}=e;const Mt=bu(),{map:At,source:yt,self:zt,minzoom:Tt,maxzoom:tn,eventTopMost:Rn,layerInfo:Jt}=kR();vt(t,At,ne=>n(31,E=ne)),vt(t,yt,ne=>n(32,C=ne)),vt(t,zt,ne=>n(0,S=ne)),vt(t,Tt,ne=>n(34,k=ne)),vt(t,tn,ne=>n(33,M=ne)),ro(()=>{S&&E&&(Jt.delete(S),E==null||E.removeLayer(S))});let pn;function Nn(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt={event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce};Mt(ne.type,kt)}function En(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;ft&&(E.getCanvas().style.cursor=ft);let Ce=ne.features??[];n(6,Pe=Ce[0]??null);let ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id;Mt("mouseenter",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Nr(ne){var Re,on,qr;if(!it||!E)return;if(Xe&&Rn(ne)!==S){n(6,Pe=null),qe&&pn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:G,id:pn},{hover:!1}),pn=void 0);return}E.getCanvas().style.cursor=ft;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt=(qr=Ce[0])==null?void 0:qr.id;kt!==pn&&(qe&&(pn!==void 0&&(E==null||E.setFeatureState({source:l,id:pn,sourceLayer:G},{hover:!1})),E==null||E.setFeatureState({source:l,id:kt,sourceLayer:G},{hover:!0})),pn=kt,n(6,Pe=Ce[0]??null)),Mt("mousemove",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Jn(ne){if(!(!it||!S||!E)){if(ft&&(E.getCanvas().style.cursor=""),n(6,Pe=null),qe&&pn!==void 0){const Ce={source:l,id:pn,sourceLayer:G};E==null||E.setFeatureState(Ce,{hover:!1}),pn=void 0}Mt("mouseleave",{map:E,layer:S,source:l})}}let On=!0;function Qn(ne){E&&(E.off("click",ne,Nn),E.off("dblclick",ne,Nn),E.off("contextmenu",ne,Nn),E.off("mouseenter",ne,En),E.off("mousemove",ne,Nr),E.off("mouseleave",ne,Jn))}return ro(()=>{E&&S&&Qn(S)}),t.$$set=ne=>{"id"in ne&&n(7,U=ne.id),"source"in ne&&n(8,z=ne.source),"sourceLayer"in ne&&n(9,G=ne.sourceLayer),"beforeId"in ne&&n(10,q=ne.beforeId),"beforeLayerType"in ne&&n(11,X=ne.beforeLayerType),"type"in ne&&n(12,de=ne.type),"paint"in ne&&n(13,ae=ne.paint),"layout"in ne&&n(14,le=ne.layout),"filter"in ne&&n(15,ye=ne.filter),"applyToClusters"in ne&&n(16,ke=ne.applyToClusters),"minzoom"in ne&&n(17,Q=ne.minzoom),"maxzoom"in ne&&n(18,oe=ne.maxzoom),"manageHoverState"in ne&&n(19,qe=ne.manageHoverState),"hovered"in ne&&n(6,Pe=ne.hovered),"interactive"in ne&&n(20,it=ne.interactive),"hoverCursor"in ne&&n(21,ft=ne.hoverCursor),"eventsIfTopMost"in ne&&n(22,Xe=ne.eventsIfTopMost),"$$scope"in ne&&n(35,F=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=OR(ke)),t.$$.dirty[0]&1073774592&&n(24,i=NR("all",r,ye)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,s=Q??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??M),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=z||C),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==U&&l){S&&(Qn(S),Jt.delete(S));let ne=q;if(!q&&X){let Ce=E.getStyle().layers,ot=typeof X=="function"?X:Re=>Re.type===X,kt=Ce==null?void 0:Ce.find(ot);kt&&(ne=kt.id)}Bt(zt,S=U,S),E.addLayer(Xc({id:S,type:de,source:l,"source-layer":G,filter:i,paint:ae,layout:le,minzoom:s,maxzoom:c}),ne),n(23,On=!0),E.on("click",S,Nn),E.on("dblclick",S,Nn),E.on("contextmenu",S,Nn),E.on("mouseenter",S,En),E.on("mousemove",S,Nr),E.on("mouseleave",S,Jn)}t.$$.dirty[0]&1048577&&S&&Jt.set(S,{interactive:it}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?I2((ne,Ce)=>E==null?void 0:E.setPaintProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,v=S?I2((ne,Ce)=>E==null?void 0:E.setLayoutProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(ae)),t.$$.dirty[0]&134234112&&(v==null||v(le)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(E==null||E.setLayerZoomRange(S,s,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(On?n(23,On=!1):E==null||E.setFilter(S,i))},[S,At,yt,zt,Tt,tn,Pe,U,z,G,q,X,de,ae,le,ye,ke,Q,oe,qe,it,ft,Xe,On,i,c,s,v,d,l,r,E,C,M,k,F,R]}let sy=class extends Zt{constructor(e){super(),Ht(this,e,BR,FR,Ut,{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 VR(t){let e;const n=t[16].default,r=gr(n,t,t[24],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16777216)&&yr(r,n,i,i[24],e?_r(n,i[24],s,null):vr(i[24]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function UR(t){let e,n,r;function i(c){t[17](c)}let s={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[VR]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function jR(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{applyToClusters:M=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:F=void 0}=e,{manageHoverState:U=!1}=e,{hovered:z=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:q=!0}=e;function X(oe){z=oe,n(0,z)}function de(oe){gn.call(this,t,oe)}function ae(oe){gn.call(this,t,oe)}function le(oe){gn.call(this,t,oe)}function ye(oe){gn.call(this,t,oe)}function ke(oe){gn.call(this,t,oe)}function Q(oe){gn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,s=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,v=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,C=oe.filter),"applyToClusters"in oe&&n(9,M=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,R=oe.maxzoom),"hoverCursor"in oe&&n(12,F=oe.hoverCursor),"manageHoverState"in oe&&n(13,U=oe.manageHoverState),"hovered"in oe&&n(0,z=oe.hovered),"eventsIfTopMost"in oe&&n(14,G=oe.eventsIfTopMost),"interactive"in oe&&n(15,q=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[z,s,c,l,d,v,S,E,C,M,k,R,F,U,G,q,r,X,de,ae,le,ye,ke,Q,i]}let bm=class extends Zt{constructor(e){super(),Ht(this,e,jR,UR,Ut,{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 GR(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function qR(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[GR]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function WR(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:F=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:z=!1}=e,{interactive:G=!0}=e;function q(Q){U=Q,n(0,U)}function X(Q){gn.call(this,t,Q)}function de(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ye(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,F=Q.manageHoverState),"hovered"in Q&&n(0,U=Q.hovered),"eventsIfTopMost"in Q&&n(13,z=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[U,s,c,l,d,v,S,E,C,M,k,R,F,z,G,r,q,X,de,ae,le,ye,ke,i]}let fc=class extends Zt{constructor(e){super(),Ht(this,e,WR,qR,Ut,{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 HR(t,e,n){let r;const{map:i}=fp();vt(t,i,d=>n(4,r=d));let{position:s="top-left"}=e,{container:c=void 0}=e,l=null;return ro(()=>{r!=null&&r.loaded()&&l&&r.removeControl(l)}),t.$$set=d=>{"position"in d&&n(1,s=d.position),"container"in d&&n(2,c=d.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!l){let d;typeof c=="string"?d=document.querySelector(c)??void 0:d=c,n(3,l=new Bs.FullscreenControl({container:d})),r.addControl(l,s)}},[i,s,c,l,r]}class ZR extends Zt{constructor(e){super(),Ht(this,e,HR,null,Ut,{position:1,container:2})}}function XR(t,e,n,r,i){let s=!1;t.getSource(e)&&(s=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(s){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function $R(t,e,n){zE().then(()=>{let r=Fs(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function L2(t){let e=t[0],n,r,i=P2(t);return{c(){i.c(),n=Pi()},m(s,c){i.m(s,c),be(s,n,c),r=!0},p(s,c){c&1&&Ut(e,e=s[0])?(kn(),me(i,1,1,Ct),Dn(),i=P2(s),i.c(),se(i,1),i.m(n.parentNode,n)):i.p(s,c)},i(s){r||(se(i),r=!0)},o(s){me(i),r=!1},d(s){s&&ve(n),i.d(s)}}}function P2(t){let e;const n=t[19].default,r=gr(n,t,t[18],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&262144)&&yr(r,n,i,i[18],e?_r(n,i[18],s,null):vr(i[18]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function YR(t){let e,n,r=t[0]&&L2(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[0]?r?(r.p(i,s),s&1&&se(r,1)):(r=L2(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function KR(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{id:d=hp("geojson")}=e,{data:v}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:C=void 0}=e,{lineMetrics:M=void 0}=e,{cluster:k=void 0}=e,{maxzoom:R=void 0}=e,{attribution:F=void 0}=e,{buffer:U=void 0}=e,{tolerance:z=void 0}=e;const{map:G,cluster:q,self:X}=AR();vt(t,G,le=>n(17,i=le)),vt(t,q,le=>n(20,s=le)),vt(t,X,le=>n(0,r=le));let de,ae=!0;return ro(()=>{r&&de&&i&&($R(G,r,de),Bt(X,r=null,r),n(15,de=void 0))}),t.$$set=le=>{"id"in le&&n(4,d=le.id),"data"in le&&n(5,v=le.data),"generateId"in le&&n(6,S=le.generateId),"promoteId"in le&&n(7,E=le.promoteId),"filter"in le&&n(8,C=le.filter),"lineMetrics"in le&&n(9,M=le.lineMetrics),"cluster"in le&&n(10,k=le.cluster),"maxzoom"in le&&n(11,R=le.maxzoom),"attribution"in le&&n(12,F=le.attribution),"buffer"in le&&n(13,U=le.buffer),"tolerance"in le&&n(14,z=le.tolerance),"$$scope"in le&&n(18,l=le.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Bt(q,s=k,s),t.$$.dirty&196593&&i&&r!==d&&(Bt(X,r=d,r),XR(i,r,Xc({type:"geojson",data:v,filter:C,lineMetrics:M,generateId:S,promoteId:E,cluster:!!k,clusterMinPoints:k==null?void 0:k.minPoints,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius,clusterProperties:k==null?void 0:k.properties,maxzoom:R,attribution:F,buffer:U,tolerance:z}),le=>i&&le===r,()=>{r&&(n(15,de=i==null?void 0:i.getSource(r)),n(16,ae=!0))})),t.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,de=i==null?void 0:i.getSource(d))})),t.$$.dirty&98336&&de&&(ae?n(16,ae=!1):de.setData(v)),t.$$.dirty&33792&&(de==null||de.setClusterOptions(Xc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,G,q,X,d,v,S,E,C,M,k,R,F,U,z,de,ae,i,l,c]}let No=class extends Zt{constructor(e){super(),Ht(this,e,KR,YR,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function JR(t,e,n){let r;const{map:i}=fp();vt(t,i,C=>n(8,r=C));let{position:s="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:l=void 0}=e,{trackUserLocation:d=!1}=e,{showAccuracyCircle:v=!0}=e,{showUserLocation:S=!0}=e,{control:E=null}=e;return ro(()=>{r!=null&&r.loaded()&&E&&r.removeControl(E)}),t.$$set=C=>{"position"in C&&n(2,s=C.position),"positionOptions"in C&&n(3,c=C.positionOptions),"fitBoundsOptions"in C&&n(4,l=C.fitBoundsOptions),"trackUserLocation"in C&&n(5,d=C.trackUserLocation),"showAccuracyCircle"in C&&n(6,v=C.showAccuracyCircle),"showUserLocation"in C&&n(7,S=C.showUserLocation),"control"in C&&n(1,E=C.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!E&&(n(1,E=new Bs.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:d,showAccuracyCircle:v,showUserLocation:S})),r.addControl(E,s))},[i,E,s,c,l,d,v,S,r]}class QR extends Zt{constructor(e){super(),Ht(this,e,JR,null,Ut,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function eN(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function tN(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[eN]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function nN(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:F=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:z=!1}=e,{interactive:G=!0}=e;function q(Q){U=Q,n(0,U)}function X(Q){gn.call(this,t,Q)}function de(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ye(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,F=Q.manageHoverState),"hovered"in Q&&n(0,U=Q.hovered),"eventsIfTopMost"in Q&&n(13,z=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[U,s,c,l,d,v,S,E,C,M,k,R,F,z,G,r,q,X,de,ae,le,ye,ke,i]}let cu=class extends Zt{constructor(e){super(),Ht(this,e,nN,tN,Ut,{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 rN(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),s=Math.round(e.lat*i)/i,c=Math.round(e.lng*i)/i,l=`${n}/${s}/${c}`,d=t.getBearing(),v=t.getPitch();return(d||v)&&(l+=`/${Math.round(d*10)/10}`),v&&(l+=`/${Math.round(v)}`),`#${l}`}function iN(t){return t.replace("#","").split("/").map(parseFloat)}var vf=q1;function q1(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?M2(t,e):{}.toString.call(t)=="[object Set]"?M2(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?sN(t,e):oN(t,e)}function oN(t,e){return t.toString()===e.toString()}function M2(t,e){var n=t.length;if(n!=e.length)return!1;for(var r=0;rn(6,r=S));let{position:s="top-left"}=e,{showCompass:c=!0}=e,{showZoom:l=!0}=e,{visualizePitch:d=!1}=e,v=null;return ro(()=>{r!=null&&r.loaded()&&v&&r.removeControl(v)}),t.$$set=S=>{"position"in S&&n(1,s=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,l=S.showZoom),"visualizePitch"in S&&n(4,d=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!v&&(n(5,v=new Bs.NavigationControl({showCompass:c,showZoom:l,visualizePitch:d})),r.addControl(v,s))},[i,s,c,l,d,v,r]}class lN extends Zt{constructor(e){super(),Ht(this,e,aN,null,Ut,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function uN(t,e,n){let r;const{map:i}=fp();vt(t,i,v=>n(5,r=v));let{position:s="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:l="metric"}=e,d=null;return ro(()=>{r!=null&&r.loaded()&&d&&r.removeControl(d)}),t.$$set=v=>{"position"in v&&n(1,s=v.position),"maxWidth"in v&&n(2,c=v.maxWidth),"unit"in v&&n(3,l=v.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!d&&(n(4,d=new Bs.ScaleControl({maxWidth:c,unit:l})),r.addControl(d,s))},[i,s,c,l,d,r]}class cN extends Zt{constructor(e){super(),Ht(this,e,uN,null,Ut,{position:1,maxWidth:2,unit:3})}}const{window:hN}=h1,fN=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),A2=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function k2(t){let e,n,r=t[3]&&D2(t);const i=t[40].default,s=gr(i,t,t[39],A2);return{c(){r&&r.c(),e=We(),s&&s.c()},m(c,l){r&&r.m(c,l),be(c,e,l),s&&s.m(c,l),n=!0},p(c,l){c[3]?r?(r.p(c,l),l[0]&8&&se(r,1)):(r=D2(c),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn()),s&&s.p&&(!n||l[0]&112|l[1]&256)&&yr(s,i,c,c[39],n?_r(i,c[39],l,fN):vr(c[39]),A2)},i(c){n||(se(r),se(s,c),n=!0)},o(c){me(r),me(s,c),n=!1},d(c){c&&ve(e),r&&r.d(c),s&&s.d(c)}}}function D2(t){let e,n,r,i,s,c,l,d;return e=new lN({props:{position:t[7]}}),r=new QR({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),s=new ZR({props:{position:t[7]}}),l=new cN({props:{position:t[7]}}),{c(){Ue(e.$$.fragment),n=We(),Ue(r.$$.fragment),i=We(),Ue(s.$$.fragment),c=We(),Ue(l.$$.fragment)},m(v,S){Be(e,v,S),be(v,n,S),Be(r,v,S),be(v,i,S),Be(s,v,S),be(v,c,S),Be(l,v,S),d=!0},p(v,S){const E={};S[0]&128&&(E.position=v[7]),e.$set(E);const C={};S[0]&128&&(C.position=v[7]),r.$set(C);const M={};S[0]&128&&(M.position=v[7]),s.$set(M);const k={};S[0]&128&&(k.position=v[7]),l.$set(k)},i(v){d||(se(e.$$.fragment,v),se(r.$$.fragment,v),se(s.$$.fragment,v),se(l.$$.fragment,v),d=!0)},o(v){me(e.$$.fragment,v),me(r.$$.fragment,v),me(s.$$.fragment,v),me(l.$$.fragment,v),d=!1},d(v){v&&(ve(n),ve(i),ve(c)),Ve(e,v),Ve(r,v),Ve(s,v),Ve(l,v)}}}function pN(t){let e,n,r,i,s,c=t[4]&&t[0]&&k2(t);return{c(){e=_e("div"),c&&c.c(),Le(e,"class",n=c_(t[2])+" svelte-p00lfq"),Le(e,"data-testid","map-container"),xl(e,"expand-map",!t[2])},m(l,d){be(l,e,d),c&&c.m(e,null),t[41](e),r=!0,i||(s=[Lt(hN,"hashchange",t[11]),hv(t[10].call(null,e))],i=!0)},p(l,d){l[4]&&l[0]?c?(c.p(l,d),d[0]&17&&se(c,1)):(c=k2(l),c.c(),se(c,1),c.m(e,null)):c&&(kn(),me(c,1,1,()=>{c=null}),Dn()),(!r||d[0]&4&&n!==(n=c_(l[2])+" svelte-p00lfq"))&&Le(e,"class",n),(!r||d[0]&4)&&xl(e,"expand-map",!l[2])},i(l){r||(se(c),r=!0)},o(l){me(c),r=!1},d(l){l&&ve(e),c&&c.d(),t[41](null),i=!1,Kr(s)}}}function dN(t,e,n){let r,i,s,c,{$$slots:l={},$$scope:d}=e,{map:v=null}=e,{mapContainer:S=void 0}=e,{class:E=void 0}=e,{style:C}=e,{diffStyleUpdates:M=!1}=e,{center:k=void 0}=e,{zoom:R=void 0}=e,{pitch:F=0}=e,{bearing:U=0}=e,{bounds:z=void 0}=e,{hash:G=!1}=e,{updateHash:q=ne=>{window.history.replaceState(window.history.state,"",ne)}}=e,{loaded:X=!1}=e,{minZoom:de=0}=e,{maxZoom:ae=22}=e,{antialias:le=void 0}=e,{zoomOnDoubleClick:ye=!0}=e,{locale:ke=void 0}=e,{interactive:Q=!0}=e,{attributionControl:oe=!0}=e,{cooperativeGestures:qe=!1}=e,{preserveDrawingBuffer:Pe=!1}=e,{maxBounds:it=void 0}=e,{images:ft=[]}=e,{standardControls:Xe=!1}=e,{filterLayers:Mt=void 0}=e,{transformRequest:At=void 0}=e;const yt=bu(),{map:zt,loadedImages:Tt}=MR();vt(t,zt,ne=>n(4,s=ne)),vt(t,Tt,ne=>n(5,c=ne));let tn=new Set;async function Rn(ne,Ce=!1){if(s&&!(!s.loaded()&&!Ce))if("url"in ne){tn.add(ne.id);try{let ot=await s.loadImage(ne.url);s==null||s.addImage(ne.id,ot.data,ne.options),c.add(ne.id),Tt.set(c)}catch(ot){yt("error",ot)}finally{tn.delete(ne.id)}}else s.addImage(ne.id,ne.data,ne.options),c.add(ne.id),Tt.set(c)}let Jt,pn,Nn,En;function Nr(ne){return On(),Bt(zt,s=new Bs.Map(Xc({container:ne,style:C,locale:ke,center:k,zoom:R,pitch:F,bearing:U,minZoom:de,maxZoom:ae,antialias:le,interactive:Q,preserveDrawingBuffer:Pe,maxBounds:it,bounds:z,attributionControl:oe,transformRequest:At,cooperativeGestures:qe})),s),s.on("load",Ce=>{Ce.target.getContainer().setAttribute("data-testid","map"),Ce.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,X=!0),yt("load",s)}),s.on("error",Ce=>yt("error",{...Ce,map:s})),s.on("movestart",Ce=>yt("movestart",{...Ce,map:s})),s.on("moveend",Ce=>{if(n(12,k=Ce.target.getCenter()),n(13,R=Ce.target.getZoom()),n(14,F=Ce.target.getPitch()),n(15,U=Ce.target.getBearing()),n(16,z=Ce.target.getBounds()),yt("moveend",{...Ce,map:s}),G){let ot=new URL(window.location.href.replace(/(#.+)?$/,rN(s)));q(ot)}}),s.on("click",Ce=>yt("click",{...Ce,map:s})),s.on("dblclick",Ce=>yt("dblclick",{...Ce,map:s})),s.on("contextmenu",Ce=>yt("contextmenu",{...Ce,map:s})),s.on("zoomstart",Ce=>yt("zoomstart",{...Ce,map:s})),s.on("zoom",Ce=>{yt("zoom",{...Ce,map:s})}),s.on("zoomend",Ce=>{yt("zoomend",{...Ce,map:s})}),s.on("style.load",()=>{if(s){const Ce=s.getStyle();if(n(36,Jt=Ce.layers.map(ot=>ot.id)),n(37,pn=Object.keys(Ce.sources)),En)for(const[ot,kt]of Object.entries(En))s.addSource(ot,kt);if(Nn)for(const ot of Nn)s.addLayer(ot);for(const ot of ft)Rn(ot,!0)}}),s.on("styledata",Ce=>{if(s&&Mt){const ot=s.getStyle().layers;if(ot)for(let kt of ot)Mt(kt)||s.setLayoutProperty(kt.id,"visibility","none")}yt("styledata",{...Ce,map:s})}),{destroy(){n(0,X=!1),s==null||s.remove(),Bt(zt,s=null,s)}}}let Jn=C;function On(){if(G){let ne=iN(window.location.hash);ne.length>=3&&(n(13,R=ne[0]),n(12,k=[ne[2],ne[1]])),ne.length==5&&(n(15,U=ne[3]),n(14,F=ne[4]))}}function Qn(ne){si[ne?"unshift":"push"](()=>{S=ne,n(1,S)})}return t.$$set=ne=>{"map"in ne&&n(17,v=ne.map),"mapContainer"in ne&&n(1,S=ne.mapContainer),"class"in ne&&n(2,E=ne.class),"style"in ne&&n(18,C=ne.style),"diffStyleUpdates"in ne&&n(19,M=ne.diffStyleUpdates),"center"in ne&&n(12,k=ne.center),"zoom"in ne&&n(13,R=ne.zoom),"pitch"in ne&&n(14,F=ne.pitch),"bearing"in ne&&n(15,U=ne.bearing),"bounds"in ne&&n(16,z=ne.bounds),"hash"in ne&&n(20,G=ne.hash),"updateHash"in ne&&n(21,q=ne.updateHash),"loaded"in ne&&n(0,X=ne.loaded),"minZoom"in ne&&n(22,de=ne.minZoom),"maxZoom"in ne&&n(23,ae=ne.maxZoom),"antialias"in ne&&n(24,le=ne.antialias),"zoomOnDoubleClick"in ne&&n(25,ye=ne.zoomOnDoubleClick),"locale"in ne&&n(26,ke=ne.locale),"interactive"in ne&&n(27,Q=ne.interactive),"attributionControl"in ne&&n(28,oe=ne.attributionControl),"cooperativeGestures"in ne&&n(29,qe=ne.cooperativeGestures),"preserveDrawingBuffer"in ne&&n(30,Pe=ne.preserveDrawingBuffer),"maxBounds"in ne&&n(31,it=ne.maxBounds),"images"in ne&&n(32,ft=ne.images),"standardControls"in ne&&n(3,Xe=ne.standardControls),"filterLayers"in ne&&n(33,Mt=ne.filterLayers),"transformRequest"in ne&&n(34,At=ne.transformRequest),"$$scope"in ne&&n(39,d=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof Xe=="boolean"?void 0:Xe),t.$$.dirty[0]&16&&n(17,v=s),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&s&&!vf(C,Jn)){const ne=s.getStyle();if(Jt&&(Nn=ne.layers.filter(Ce=>!Jt.includes(Ce.id))),pn){const Ce=Object.keys(ne.sources).filter(ot=>!pn.includes(ot));En={};for(const ot of Ce)En[ot]=ne.sources[ot]}n(38,Jn=C),s.setStyle(C,{diff:M}),Bt(Tt,c=new Set,c),n(35,tn=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&X&&s!=null&&s.loaded())for(let ne of ft)!c.has(ne.id)&&!tn.has(ne.id)&&!s.hasImage(ne.id)&&Rn(ne);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,i=ft.every(ne=>c.has(ne.id))),t.$$.dirty[0]&61456&&s){let ne={};k!=null&&!vf(k,s==null?void 0:s.getCenter())&&(ne.center=k),R!=null&&!vf(R,s==null?void 0:s.getZoom())&&(ne.zoom=R),U!=null&&!vf(U,s==null?void 0:s.getBearing())&&(ne.bearing=U),F!=null&&!vf(F,s==null?void 0:s.getPitch())&&(ne.pitch=F),Object.keys(ne).length&&s.easeTo(ne)}t.$$.dirty[0]&65552&&z&&!vf(z,s==null?void 0:s.getBounds())&&(s==null||s.fitBounds(z)),t.$$.dirty[0]&33554448&&(ye?s==null||s.doubleClickZoom.enable():s==null||s.doubleClickZoom.disable())},[X,S,E,Xe,s,c,i,r,zt,Tt,Nr,On,k,R,F,U,z,v,C,M,G,q,de,ae,le,ye,ke,Q,oe,qe,Pe,it,ft,Mt,At,tn,Jt,pn,Jn,d,l,Qn]}class mN extends Zt{constructor(e){super(),Ht(this,e,dN,pN,Ut,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const gN=t=>({marker:t&8}),R2=t=>({marker:t[3]});function _N(t){let e,n,r,i,s,c,l;const d=t[19].default,v=gr(d,t,t[18],R2);return{c(){e=_e("div"),v&&v.c(),Le(e,"tabindex",n=t[1]?0:void 0),Le(e,"role",r=t[1]?"button":void 0),lr(e,"z-index",t[2])},m(S,E){be(S,e,E),v&&v.m(e,null),s=!0,c||(l=[hv(t[7].call(null,e)),hv(i=yN.call(null,e,t[0])),Lt(e,"click",k0(t[20])),Lt(e,"dblclick",k0(t[21])),Lt(e,"contextmenu",k0(t[22])),Lt(e,"mouseenter",t[23]),Lt(e,"mouseleave",t[24]),Lt(e,"mousemove",t[25]),Lt(e,"keydown",t[8])],c=!0)},p(S,[E]){v&&v.p&&(!s||E&262152)&&yr(v,d,S,S[18],s?_r(d,S[18],E,gN):vr(S[18]),R2),(!s||E&2&&n!==(n=S[1]?0:void 0))&&Le(e,"tabindex",n),(!s||E&2&&r!==(r=S[1]?"button":void 0))&&Le(e,"role",r),i&&X_(i.update)&&E&1&&i.update.call(null,S[0]),E&4&&lr(e,"z-index",S[2])},i(S){s||(se(v,S),s=!0)},o(S){me(v,S),s=!1},d(S){S&&ve(e),v&&v.d(S),c=!1,Kr(l)}}}function yN(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function vN(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{marker:d=void 0}=e,{lngLat:v}=e,{class:S=void 0}=e,{interactive:E=!0}=e,{asButton:C=!1}=e,{draggable:M=!1}=e,{feature:k=null}=e,{offset:R=void 0}=e,{zIndex:F=void 0}=e,{rotation:U=0}=e,{opacity:z=1}=e;const G=bu(),{map:q,layerEvent:X,self:de}=DR();vt(t,q,Xe=>n(27,s=Xe)),vt(t,X,Xe=>n(26,r=Xe)),vt(t,de,Xe=>n(3,i=Xe));function ae(Xe){Bt(de,i=new Bs.Marker({element:Xe,rotation:U,draggable:M,offset:R,opacity:z.toString()}).setLngLat(v).addTo(s),i),n(11,d=i);const Mt=()=>ke("dragstart"),At=()=>{le(),ke("drag")},yt=()=>{le(),ke("dragend")};return M&&(i.on("dragstart",Mt),i.on("drag",At),i.on("dragend",yt)),{destroy(){M&&(i==null||i.off("dragstart",Mt),i==null||i.off("drag",At),i==null||i.off("dragend",yt)),n(11,d=void 0),i==null||i.remove()}}}function le(){let Xe=i==null?void 0:i.getLngLat();Xe&&(Array.isArray(v)?n(10,v=[Xe.lng,Xe.lat]):v&&"lon"in v?n(10,v={lon:Xe.lng,lat:Xe.lat}):n(10,v=Xe))}function ye(Xe){Xe.key===" "&&(Xe.preventDefault(),Xe.stopPropagation(),ke("click"))}function ke(Xe){if(!E)return;let Mt=i==null?void 0:i.getLngLat();if(!Mt)return;const At=[Mt.lng,Mt.lat];let yt={map:s,marker:i,lngLat:At,features:[{type:"Feature",properties:(k==null?void 0:k.properties)??{},geometry:{type:"Point",coordinates:At}}]};Bt(X,r={...yt,layerType:"marker",type:Xe},r),G(Xe,yt)}const Q=()=>ke("click"),oe=()=>ke("dblclick"),qe=()=>ke("contextmenu"),Pe=Xe=>{ke("mouseenter")},it=()=>{ke("mouseleave")},ft=()=>ke("mousemove");return t.$$set=Xe=>{"marker"in Xe&&n(11,d=Xe.marker),"lngLat"in Xe&&n(10,v=Xe.lngLat),"class"in Xe&&n(0,S=Xe.class),"interactive"in Xe&&n(12,E=Xe.interactive),"asButton"in Xe&&n(1,C=Xe.asButton),"draggable"in Xe&&n(13,M=Xe.draggable),"feature"in Xe&&n(14,k=Xe.feature),"offset"in Xe&&n(15,R=Xe.offset),"zIndex"in Xe&&n(2,F=Xe.zIndex),"rotation"in Xe&&n(16,U=Xe.rotation),"opacity"in Xe&&n(17,z=Xe.opacity),"$$scope"in Xe&&n(18,l=Xe.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(v)),t.$$.dirty&32776&&(i==null||i.setOffset(R??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(U)),t.$$.dirty&131080&&(i==null||i.setOpacity(z.toString()))},[S,C,F,i,q,X,de,ae,ye,ke,v,d,E,M,k,R,U,z,l,c,Q,oe,qe,Pe,it,ft]}class N2 extends Zt{constructor(e){super(),Ht(this,e,vN,_N,Ut,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const bN=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),O2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function z2(t){let e,n,r=(t[4]||t[3]instanceof Bs.Marker)&&F2(t);return{c(){e=_e("div"),r&&r.c()},m(i,s){be(i,e,s),r&&r.m(e,null),t[32](e),n=!0},p(i,s){i[4]||i[3]instanceof Bs.Marker?r?(r.p(i,s),s[0]&24&&se(r,1)):(r=F2(i),r.c(),se(r,1),r.m(e,null)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(),t[32](null)}}}function F2(t){let e;const n=t[30].default,r=gr(n,t,t[29],O2);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[0]&536870933)&&yr(r,n,i,i[29],e?_r(n,i[29],s,bN):vr(i[29]),O2)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function xN(t){let e,n,r=t[9].default&&z2(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,s){i[9].default?r?(r.p(i,s),s[0]&512&&se(r,1)):(r=z2(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function wN(t,e,n){let r,i,s,c,l,d,{$$slots:v={},$$scope:S}=e;const E=BP(v);let{closeButton:C=void 0}=e,{closeOnClickOutside:M=!0}=e,{closeOnClickInside:k=!1}=e,{closeOnMove:R=!1}=e,{openOn:F="click"}=e,{openIfTopMost:U=!0}=e,{focusAfterOpen:z=!0}=e,{anchor:G=void 0}=e,{offset:q=void 0}=e,{popupClass:X=void 0}=e,{maxWidth:de=void 0}=e,{lngLat:ae=void 0}=e,{html:le=void 0}=e,{open:ye=!1}=e;const ke=bu(),{map:Q,popupTarget:oe,layerEvent:qe,layer:Pe,eventTopMost:it}=fp();vt(t,Q,Ce=>n(2,s=Ce)),vt(t,oe,Ce=>n(3,l=Ce)),vt(t,qe,Ce=>n(28,c=Ce)),vt(t,Pe,Ce=>n(35,d=Ce));const ft=["click","dblclick","contextmenu"];let Xe,Mt=!1,At;function yt(){if(!Xe)return;let Ce=Xe.getElement();!Ce||Ce===At||(At=Ce,F==="hover"&&(At.style.pointerEvents="none"),At.addEventListener("mouseenter",()=>{n(24,Mt=!0)},{passive:!0}),At.addEventListener("mouseleave",()=>{n(24,Mt=!1)},{passive:!0}),At.addEventListener("click",()=>{k&&n(0,ye=!1)},{passive:!0}))}$_(()=>{if(s)return s.on("click",Jn),s.on("contextmenu",Jn),typeof l=="string"&&(s.on("click",l,Rn),s.on("dblclick",l,Rn),s.on("contextmenu",l,Rn),s.on("mousemove",l,Nr),s.on("mouseleave",l,En),s.on("touchstart",l,pn),s.on("touchend",l,Nn)),()=>{s!=null&&s.loaded()&&(Xe==null||Xe.remove(),s.off("click",Jn),s.off("contextmenu",Jn),l instanceof Bs.Marker?l.getPopup()===Xe&&l.setPopup(void 0):typeof l=="string"&&(s.off("click",l,Rn),s.off("dblclick",l,Rn),s.off("contextmenu",l,Rn),s.off("mousemove",l,Nr),s.off("mouseleave",l,En),s.off("touchstart",l,pn),s.off("touchend",l,Nn)))}});function zt(Ce){return U?!("marker"in Ce)&&!RR(Ce)&&it(Ce)!==d:!1}let Tt=null,tn="normal";function Rn(Ce){Ce.type===F&&(zt(Ce)||("layerType"in Ce?Ce.layerType==="deckgl"?(n(10,ae=Ce.coordinate),n(4,Tt=Ce.object?[Ce.object]:null)):(n(10,ae=Ce.lngLat),n(4,Tt=Ce.features??[])):(n(10,ae=Ce.lngLat),n(4,Tt=Ce.features??[])),setTimeout(()=>n(0,ye=!0))))}let Jt=null;function pn(Ce){Jt=Ce.point}function Nn(Ce){if(!Jt||F!=="hover")return;let ot=Jt.dist(Ce.point);Jt=null,ot<3&&(n(10,ae=Ce.lngLat),n(4,Tt=Ce.features??[]),Xe.isOpen()?n(25,tn="justOpened"):(n(25,tn="opening"),n(0,ye=!0)))}function En(Ce){F!=="hover"||Jt||tn!=="normal"||(n(0,ye=!1),n(4,Tt=null))}function Nr(Ce){if(!(F!=="hover"||Jt||tn!=="normal")){if(zt(Ce)){n(0,ye=!1),n(4,Tt=null);return}n(0,ye=!0),n(4,Tt=Ce.features??[]),n(10,ae=Ce.lngLat)}}function Jn(Ce){if(tn==="justOpened"){n(25,tn="normal");return}if(!M)return;let ot=[At,l instanceof Bs.Marker?l==null?void 0:l.getElement():null];ye&&Xe.isOpen()&&!ot.some(kt=>kt==null?void 0:kt.contains(Ce.originalEvent.target))&&(Ce.type==="contextmenu"&&F==="contextmenu"||Ce.type!=="contextmenu")&&n(0,ye=!1)}ro(()=>{s&&(Xe!=null&&Xe.isOpen())&&Xe.remove()});let On;const Qn=()=>n(0,ye=!1);function ne(Ce){si[Ce?"unshift":"push"](()=>{On=Ce,n(1,On)})}return t.$$set=Ce=>{"closeButton"in Ce&&n(11,C=Ce.closeButton),"closeOnClickOutside"in Ce&&n(12,M=Ce.closeOnClickOutside),"closeOnClickInside"in Ce&&n(13,k=Ce.closeOnClickInside),"closeOnMove"in Ce&&n(14,R=Ce.closeOnMove),"openOn"in Ce&&n(15,F=Ce.openOn),"openIfTopMost"in Ce&&n(16,U=Ce.openIfTopMost),"focusAfterOpen"in Ce&&n(17,z=Ce.focusAfterOpen),"anchor"in Ce&&n(18,G=Ce.anchor),"offset"in Ce&&n(19,q=Ce.offset),"popupClass"in Ce&&n(20,X=Ce.popupClass),"maxWidth"in Ce&&n(21,de=Ce.maxWidth),"lngLat"in Ce&&n(10,ae=Ce.lngLat),"html"in Ce&&n(22,le=Ce.html),"open"in Ce&&n(0,ye=Ce.open),"$$scope"in Ce&&n(29,S=Ce.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=C??(!M&&!k)),t.$$.dirty[0]&146685952&&(Xe||(n(23,Xe=new Bs.Popup({closeButton:r,closeOnClick:!1,closeOnMove:R,focusAfterOpen:z,maxWidth:de,className:X,anchor:G,offset:q})),At=Xe.getElement(),Xe.on("open",()=>{n(0,ye=!0),yt(),ke("open",Xe)}),Xe.on("close",()=>{n(0,ye=!1),ke("close",Xe)}),Xe.on("hover",()=>{ke("hover",Xe)}))),t.$$.dirty[0]&8421384&&Xe&&l instanceof Bs.Marker&&(F==="click"?l.setPopup(Xe):l.getPopup()===Xe&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&ft.includes(F)&&(c==null?void 0:c.type)===F&&(Rn(c),Bt(qe,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=F==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&F==="hover"&&qe&&(i&&c&&(c.layerType==="deckgl"?(n(10,ae=c.coordinate),n(4,Tt=c.object?[c.object]:null)):(n(10,ae=c.lngLat),n(4,Tt=c.features??[]))),n(0,ye=(i||Mt)??!1)),t.$$.dirty[0]&12582914&&(On?Xe.setDOMContent(On):le&&Xe.setHTML(le)),t.$$.dirty[0]&8389632&&ae&&Xe.setLngLat(ae),t.$$.dirty[0]&41943045&&s){let Ce=Xe.isOpen();ye&&!Ce?(Xe.addTo(s),tn==="opening"&&n(25,tn="justOpened")):!ye&&Ce&&Xe.remove()}},[ye,On,s,l,Tt,Q,oe,qe,Pe,E,ae,C,M,k,R,F,U,z,G,q,X,de,le,Xe,Mt,tn,i,r,c,S,v,Qn,ne]}class SN extends Zt{constructor(e){super(),Ht(this,e,wN,xN,Ut,{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 EN(t){let e;const n=t[16].default,r=gr(n,t,t[24],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16777216)&&yr(r,n,i,i[24],e?_r(n,i[24],s,null):vr(i[24]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function IN(t){let e,n,r;function i(c){t[17](c)}let s={id:t[1],type:"symbol",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[EN]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new sy({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function CN(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=hp("symbol")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S=void 0}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{applyToClusters:M=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:F=void 0}=e,{manageHoverState:U=!1}=e,{hovered:z=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:q=!0}=e;function X(oe){z=oe,n(0,z)}function de(oe){gn.call(this,t,oe)}function ae(oe){gn.call(this,t,oe)}function le(oe){gn.call(this,t,oe)}function ye(oe){gn.call(this,t,oe)}function ke(oe){gn.call(this,t,oe)}function Q(oe){gn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,s=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,v=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,C=oe.filter),"applyToClusters"in oe&&n(9,M=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,R=oe.maxzoom),"hoverCursor"in oe&&n(12,F=oe.hoverCursor),"manageHoverState"in oe&&n(13,U=oe.manageHoverState),"hovered"in oe&&n(0,z=oe.hovered),"eventsIfTopMost"in oe&&n(14,G=oe.eventsIfTopMost),"interactive"in oe&&n(15,q=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[z,s,c,l,d,v,S,E,C,M,k,R,F,U,G,q,r,X,de,ae,le,ye,ke,Q,i]}class mC extends Zt{constructor(e){super(),Ht(this,e,CN,IN,Ut,{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 xm=Uint8Array,gC=Uint16Array,TN=Int32Array,LN=new xm([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]),PN=new xm([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]),_C=function(t,e){for(var n=new gC(31),r=0;r<31;++r)n[r]=e+=1<>1|(ir&21845)<<1,eu=(eu&52428)>>2|(eu&13107)<<2,eu=(eu&61680)>>4|(eu&3855)<<4,kN[ir]=((eu&65280)>>8|(eu&255)<<8)>>1;var eu,ir,ay=new xm(288);for(ir=0;ir<144;++ir)ay[ir]=8;var ir;for(ir=144;ir<256;++ir)ay[ir]=9;var ir;for(ir=256;ir<280;++ir)ay[ir]=7;var ir;for(ir=280;ir<288;++ir)ay[ir]=8;var ir,DN=new xm(32);for(ir=0;ir<32;++ir)DN[ir]=5;var ir,RN=new xm(0),NN=typeof TextDecoder<"u"&&new TextDecoder,ON=0;try{NN.decode(RN,{stream:!0}),ON=1}catch{}var zN=Object.defineProperty,FN=(t,e,n)=>e in t?zN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B2=(t,e,n)=>(FN(t,typeof e!="symbol"?e+"":e,n),n);function Qd(){}function vC(t){return t()}function V2(){return Object.create(null)}function ly(t){t.forEach(vC)}function bC(t){return typeof t=="function"}function BN(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function VN(t){return Object.keys(t).length===0}function UN(t,e){t.appendChild(e)}function jN(t,e,n){t.insertBefore(e,n||null)}function xC(t){t.parentNode&&t.parentNode.removeChild(t)}function U2(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ju(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function GN(t){return Array.from(t.childNodes)}function Vg(t,e,n){t.classList.toggle(e,!!n)}let W1;function Wd(t){W1=t}const Ef=[],j2=[];let Mf=[];const G2=[],qN=Promise.resolve();let Gv=!1;function WN(){Gv||(Gv=!0,qN.then(wC))}function qv(t){Mf.push(t)}const rv=new Set;let bf=0;function wC(){if(bf!==0)return;const t=W1;do{try{for(;bft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Mf=e}const XN=new Set;function $N(t,e){t&&t.i&&(XN.delete(t),t.i(e))}function YN(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),qv(()=>{const s=t.$$.on_mount.map(vC).filter(bC);t.$$.on_destroy?t.$$.on_destroy.push(...s):ly(s),t.$$.on_mount=[]}),i.forEach(qv)}function KN(t,e){const n=t.$$;n.fragment!==null&&(ZN(n.after_update),ly(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function JN(t,e){t.$$.dirty[0]===-1&&(Ef.push(t),WN(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const k=M.length?M[0]:C;return v.ctx&&i(v.ctx[E],v.ctx[E]=k)&&(!v.skip_bound&&v.bound[E]&&v.bound[E](k),S&&JN(t,E)),C}):[],v.update(),S=!0,ly(v.before_update),v.fragment=r?r(v.ctx):!1,e.target){if(e.hydrate){const E=GN(e.target);v.fragment&&v.fragment.l(E),E.forEach(xC)}else v.fragment&&v.fragment.c();e.intro&&$N(t.$$.fragment),YN(t,e.target,e.anchor),wC()}Wd(d)}class eO{constructor(){B2(this,"$$"),B2(this,"$$set")}$destroy(){KN(this,1),this.$destroy=Qd}$on(e,n){if(!bC(n))return Qd;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!VN(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const tO="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(tO);function nO(t){let e,n,r;return{c(){e=U2("svg"),n=U2("path"),ju(n,"stroke-width","4"),ju(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"),ju(n,"class","svelte-gzo3ar"),ju(e,"width",r=t[0]==="list"?20:void 0),ju(e,"viewBox","0 0 70 85"),ju(e,"fill","none"),ju(e,"class","svelte-gzo3ar"),Vg(e,"in-map",t[0]!=="list"),Vg(e,"list-icon",t[0]==="list")},m(i,s){jN(i,e,s),UN(e,n)},p(i,[s]){s&1&&r!==(r=i[0]==="list"?20:void 0)&&ju(e,"width",r),s&1&&Vg(e,"in-map",i[0]!=="list"),s&1&&Vg(e,"list-icon",i[0]==="list")},i:Qd,o:Qd,d(i){i&&xC(e)}}}function rO(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class iO extends eO{constructor(e){super(),QN(this,e,rO,nO,BN,{displayIn:0})}}const oO=[{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"}],sO={decimalLatitude:40.123,decimalLongitude:-74.123},aO=[{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}],lO=[{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 uO(){const t=[];return oO.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...sO})}),[...t,...aO,...lO]}const cO=uO();cO.map(t=>t.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -611,24 +611,24 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. -***************************************************************************** */function hO(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(v){return function(S){return d([v,S])}}function d(v){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(s=v[0]&2?i.return:v[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,v[1])).done)return s;switch(i=0,s&&(v=[v[0]&2,s.value]),v[0]){case 0:case 1:s=v;break;case 4:return n.label++,{value:v[1],done:!1};case 5:n.label++,i=v[1],v=[0];continue;case 7:v=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(v[0]===6||v[0]===2)){n=0;continue}if(v[0]===3&&(!s||v[1]>s[0]&&v[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var l=e.right;if(e.right=l.left,l.left=e,e=l,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,s.left=e.right,e.left=r.right,e.right=r.left,e}function iv(t,e,n,r){var i=new Qu(t,e);if(n===null)return i.left=i.right=null,i;n=Hu(t,n,r);var s=r(t,n.key);return s<0?(i.left=n.left,i.right=n,n.left=null):s>=0&&(i.right=n.right,i.left=n,n.right=null),i}function q2(t,e,n){var r=null,i=null;if(e){e=Hu(t,e,n);var s=n(e.key,t);s===0?(r=e.left,i=e.right):s<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function pO(t,e,n){return e===null?t:(t===null||(e=Hu(t.key,e,n),e.left=t),e)}function Wv(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` -`);var s=e+(n?" ":"│ ");t.left&&Wv(t.left,s,!1,r,i),t.right&&Wv(t.right,s,!0,r,i)}}var H1=function(){function t(e){e===void 0&&(e=fO),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=iv(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new Qu(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,s=Hu(e,this._root,i),c=i(e,s.key);return c===0?this._root=s:(c<0?(r.left=s.left,r.right=s,s.left=null):c>0&&(r.right=s.right,r.left=s,s.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=Hu(e,n,r);var s=r(e,n.key);return s===0?(n.left===null?i=n.right:(i=Hu(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=Hu(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=Hu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],s=!1;!s;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):s=!0;return this},t.prototype.range=function(e,n,r,i){for(var s=[],c=this._comparator,l=this._root,d;s.length!==0||l;)if(l)s.push(l),l=l.left;else{if(l=s.pop(),d=c(l.key,n),d>0)break;if(c(l.key,e)>=0&&r.call(i,l))return this;l=l.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,s=[];!r;)if(n)s.push(n),n=n.left;else if(s.length>0){if(n=s.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var s=i(e.key,n.key);if(s===0)break;s<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var s=i(e.key,n.key);if(s===0)break;s<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return mO(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,s=this._comparator;if(r&&Xv(e,n,0,i-1,s),this._root===null)this._root=Hv(e,n,0,i),this._size=i;else{var c=gO(this.toList(),dO(e,n),s);i=this._size+i,this._root=Zv({head:c},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return Wv(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,s=q2(e,this._root,i),c=s.left,l=s.right;i(e,n)<0?l=iv(n,r,l,i):c=iv(n,r,c,i),this._root=pO(c,l,i)},t.prototype.split=function(e){return q2(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return hO(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function Hv(t,e,n,r){var i=r-n;if(i>0){var s=n+Math.floor(i/2),c=t[s],l=e[s],d=new Qu(c,l);return d.left=Hv(t,e,n,s),d.right=Hv(t,e,s+1,r),d}return null}function dO(t,e){for(var n=new Qu(null,null),r=n,i=0;i0?(e=s=s.next=n.pop(),e=e.right):r=!0;return s.next=null,i.next}function Zv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),s=Zv(t,e,i),c=t.head;return c.left=s,t.head=t.head.next,c.right=Zv(t,i+1,n),c}return null}function gO(t,e,n){for(var r=new Qu(null,null),i=r,s=t,c=e;s!==null&&c!==null;)n(s.key,c.key)<0?(i.next=s,s=s.next):(i.next=c,c=c.next),i=i.next;return s!==null?i.next=s:c!==null&&(i.next=c),r.next}function Xv(t,e,n,r,i){if(!(n>=r)){for(var s=t[n+r>>1],c=n-1,l=r+1;;){do c++;while(i(t[c],s)<0);do l--;while(i(t[l],s)>0);if(c>=l)break;var d=t[c];t[c]=t[l],t[l]=d,d=e[c],e[c]=e[l],e[l]=d}Xv(t,e,n,l,i),Xv(t,e,l+1,r,i)}}function La(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W2(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){La(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return rs(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r=0&&E>=0?vC?-1:0:d<0&&E<0?vC?1:0:Ed?1:0}}}]),t}(),wO=0,R_=function(){rs(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,s=e.rightSE.point.x,c=n.rightSE.point.x;if(cl&&d>v)return-1;var E=e.comparePoint(n.leftSE.point);if(E<0)return 1;if(E>0)return-1;var C=n.comparePoint(e.rightSE.point);return C!==0?C:-1}if(r>i){if(ld&&l>S)return 1;var M=n.comparePoint(e.leftSE.point);if(M!==0)return M;var k=e.comparePoint(n.rightSE.point);return k<0?1:k>0?-1:1}if(ld)return 1;if(sc){var N=e.comparePoint(n.rightSE.point);if(N<0)return 1;if(N>0)return-1}if(s!==c){var B=v-l,F=s-r,G=S-d,H=c-i;if(B>F&&GH)return-1}return s>c?1:sS?1:e.idn.id?1:0}}]);function t(e,n,r,i){La(this,t),this.id=++wO,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return rs(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e: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(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&l.swapEvents(),_l.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),s.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var s=n;n=r,r=s}if(n.prev===r){var c=n;n=r,r=c}for(var l=0,d=r.rings.length;l0)i=n,s=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var d=new _l(i,!0),v=new _l(s,!1);return new t(d,v,[r],[c])}}]),t}(),Y2=function(){function t(e,n,r){if(La(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=em.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var s=i,c=1,l=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),s=d)}(i.x!==s.x||i.y!==s.y)&&this.segments.push(R_.fromRing(s,i,this))}return rs(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=n}return rs(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=n}return rs(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n0&&(e=i)}for(var s=e.segment.prevInResult(),c=s?s.prevInResult():null;;){if(!s)return null;if(!c)return s.ringOut;if(c.ringOut!==s.ringOut)return c.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=c.prevInResult(),c=s?s.prevInResult():null}}}]),t}(),J2=function(){function t(e){La(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return rs(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:R_.compare;La(this,t),this.queue=e,this.tree=new H1(n),this.segments=[]}return rs(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)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 s=i,c=i,l=void 0,d=void 0;l===void 0;)s=this.tree.prev(s),s===null?l=null:s.key.consumedBy===void 0&&(l=s.key);for(;d===void 0;)c=this.tree.next(c),c===null?d=null:c.key.consumedBy===void 0&&(d=c.key);if(e.isLeft){var v=null;if(l){var S=l.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(v=S),!l.isAnEndpoint(S)))for(var E=this._splitSafely(l,S),C=0,M=E.length;C0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&d){var le=l.getIntersection(d);if(le!==null){if(!l.isAnEndpoint(le))for(var ve=this._splitSafely(l,le),ke=0,Q=ve.length;keQ2)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var H=new CO(k),K=k.size,_e=k.pop();_e;){var ae=_e.key;if(k.size===K){var le=ae.segment;throw new Error("Unable to pop() ".concat(ae.isLeft?"left":"right"," SweepEvent ")+"[".concat(ae.point.x,", ").concat(ae.point.y,"] from segment #").concat(le.id," ")+"[".concat(le.leftSE.point.x,", ").concat(le.leftSE.point.y,"] -> ")+"[".concat(le.rightSE.point.x,", ").concat(le.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(k.size>Q2)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(H.segments.length>TO)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ve=H.process(ae),ke=0,Q=ve.length;ke1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};ze.prototype.clone=function(){};ze.prototype.copy=function(){return new ze(this)};ze.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};ze.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)};ze.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};ze.prototype.hashCode=function(){var t=17;return t=37*t+ze.hashCode(this.x),t=37*t+ze.hashCode(this.y),t};ze.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};ze.prototype.interfaces_=function(){return[Es,cy,Is]};ze.prototype.getClass=function(){return ze};ze.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=rn.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};hh.DimensionalComparator.get=function(){return ou};hh.serialVersionUID.get=function(){return 6683108902428367e3};hh.NULL_ORDINATE.get=function(){return rn.NaN};hh.X.get=function(){return 0};hh.Y.get=function(){return 1};hh.Z.get=function(){return 2};Object.defineProperties(ze,hh);var ou=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new br("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};ou.prototype.compare=function(t,e){var n=t,r=e,i=ou.compare(n.x,r.x);if(i!==0)return i;var s=ou.compare(n.y,r.y);if(s!==0)return s;if(this._dimensionsToTest<=2)return 0;var c=ou.compare(n.z,r.z);return c};ou.prototype.interfaces_=function(){return[zf]};ou.prototype.getClass=function(){return ou};ou.compare=function(t,e){return te?1:rn.isNaN(t)?rn.isNaN(e)?0:-1:rn.isNaN(e)?1:0};var Ff=function(){};Ff.prototype.create=function(){};Ff.prototype.interfaces_=function(){return[]};Ff.prototype.getClass=function(){return Ff};var Fe=function(){},wm={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Fe.prototype.interfaces_=function(){return[]};Fe.prototype.getClass=function(){return Fe};Fe.toLocationSymbol=function(t){switch(t){case Fe.EXTERIOR:return"e";case Fe.BOUNDARY:return"b";case Fe.INTERIOR:return"i";case Fe.NONE:return"-"}throw new br("Unknown location value: "+t)};wm.INTERIOR.get=function(){return 0};wm.BOUNDARY.get=function(){return 1};wm.EXTERIOR.get=function(){return 2};wm.NONE.get=function(){return-1};Object.defineProperties(Fe,wm);var Kt=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},is=function(){},AC={LOG_10:{configurable:!0}};is.prototype.interfaces_=function(){return[]};is.prototype.getClass=function(){return is};is.log10=function(t){var e=Math.log(t);return rn.isInfinite(e)||rn.isNaN(e)?e:e/is.LOG_10};is.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],s=arguments[2];return rs?s:r}};is.wrap=function(t,e){return t<0?e- -t%e:t%e};is.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],s=arguments[1],c=arguments[2],l=arguments[3],d=i;return s>d&&(d=s),c>d&&(d=c),l>d&&(d=l),d}};is.average=function(t,e){return(t+e)/2};AC.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(is,AC);var Pa=function(t){this.str=t};Pa.prototype.append=function(t){this.str+=t};Pa.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};Pa.prototype.toString=function(t){return this.str};var _a=function(t){this.value=t};_a.prototype.intValue=function(){return this.value};_a.prototype.compareTo=function(t){return this.valuet?1:0};_a.isNaN=function(t){return Number.isNaN(t)};var tm=function(){};tm.isWhitespace=function(t){return t<=32&&t>=0||t===127};tm.toUpperCase=function(t){return t.toUpperCase()};var $e=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i,s)}},$s={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}};$e.prototype.le=function(t){return(this._hi9?(S=!0,E="9"):E="0"+v,c.append(E),n=n.subtract($e.valueOf(v)).multiply($e.TEN),S&&n.selfAdd($e.TEN);var C=!0,M=$e.magnitude(n._hi);if(M<0&&Math.abs(M)>=l-d&&(C=!1),!C)break}return e[0]=r,c.toString()};$e.prototype.sqr=function(){return this.multiply(this)};$e.prototype.doubleValue=function(){return this._hi+this._lo};$e.prototype.subtract=function(){if(arguments[0]instanceof $e){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};$e.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};$e.prototype.isZero=function(){return this._hi===0&&this._lo===0};$e.prototype.selfSubtract=function(){if(arguments[0]instanceof $e){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};$e.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};$e.prototype.min=function(t){return this.le(t)?this:t};$e.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof $e){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,s=null,c=null,l=null,d=null,v=null,S=null,E=null;return d=this._hi/n,v=$e.SPLIT*d,i=v-d,E=$e.SPLIT*n,i=v-i,s=d-i,c=E-n,S=d*n,c=E-c,l=n-c,E=i*c-S+i*l+s*c+s*l,v=(this._hi-S-E+this._lo-d*r)/n,E=d+v,this._hi=E,this._lo=d-E+v,this}};$e.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};$e.prototype.divide=function(){if(arguments[0]instanceof $e){var t=arguments[0],e=null,n=null,r=null,i=null,s=null,c=null,l=null,d=null;s=this._hi/t._hi,c=$e.SPLIT*s,e=c-s,d=$e.SPLIT*t._hi,e=c-e,n=s-e,r=d-t._hi,l=s*t._hi,r=d-r,i=t._hi-r,d=e*r-l+e*i+n*r+n*i,c=(this._hi-l-d+this._lo-s*t._lo)/t._hi,d=s+c;var v=d,S=s-d+c;return new $e(v,S)}else if(typeof arguments[0]=="number"){var E=arguments[0];return rn.isNaN(E)?$e.createNaN():$e.copy(this).selfDivide(E,0)}};$e.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};$e.prototype.pow=function(t){if(t===0)return $e.valueOf(1);var e=new $e(this),n=$e.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(e),r/=2,r>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};$e.prototype.ceil=function(){if(this.isNaN())return $e.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new $e(t,e)};$e.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};$e.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};$e.prototype.setValue=function(){if(arguments[0]instanceof $e){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};$e.prototype.max=function(t){return this.ge(t)?this:t};$e.prototype.sqrt=function(){if(this.isZero())return $e.valueOf(0);if(this.isNegative())return $e.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=$e.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};$e.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof $e){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,s=null,c=null,l=null;return i=this._hi+e,c=i-this._hi,s=i-c,s=e-c+(this._hi-s),l=s+this._lo,n=i+l,r=l+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],v=arguments[1],S=null,E=null,C=null,M=null,k=null,R=null,N=null,B=null;k=this._hi+d,C=this._lo+v,N=k-this._hi,B=C-this._lo,R=k-N,M=C-B,R=d-N+(this._hi-R),M=v-B+(this._lo-M),N=R+C,S=k+N,E=N+(k-S),N=M+E;var F=S+N,G=N+(S-F);return this._hi=F,this._lo=G,this}};$e.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof $e){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,s=null,c=null,l=null,d=null,v=null;d=$e.SPLIT*this._hi,i=d-this._hi,v=$e.SPLIT*n,i=d-i,s=this._hi-i,c=v-n,d=this._hi*n,c=v-c,l=n-c,v=i*c-d+i*l+s*c+s*l+(this._hi*r+this._lo*n);var S=d+v;i=d-S;var E=v+i;return this._hi=S,this._lo=E,this}};$e.prototype.selfSqr=function(){return this.selfMultiply(this)};$e.prototype.floor=function(){if(this.isNaN())return $e.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new $e(t,e)};$e.prototype.negate=function(){return this.isNaN()?this:new $e(-this._hi,-this._lo)};$e.prototype.clone=function(){};$e.prototype.multiply=function(){if(arguments[0]instanceof $e){var t=arguments[0];return t.isNaN()?$e.createNaN():$e.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return rn.isNaN(e)?$e.createNaN():$e.copy(this).selfMultiply(e,0)}};$e.prototype.isNaN=function(){return rn.isNaN(this._hi)};$e.prototype.intValue=function(){return Math.trunc(this._hi)};$e.prototype.toString=function(){var t=$e.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};$e.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+$e.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var s=r-n.length,c=$e.stringOfChar("0",s);i=n+c+".0"}return this.isNegative()?"-"+i:i};$e.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,s=null,c=null,l=null;i=1/this._hi,s=$e.SPLIT*i,t=s-i,l=$e.SPLIT*this._hi,t=s-t,e=i-t,n=l-this._hi,c=i*this._hi,n=l-n,r=this._hi-n,l=t*n-c+t*r+e*n+e*r,s=(1-c-l-i*this._lo)/this._hi;var d=i+s,v=i-d+s;return new $e(d,v)};$e.prototype.toSciNotation=function(){if(this.isZero())return $e.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=$e.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var s=n.charAt(0)+"."+i;return this.isNegative()?"-"+s+r:s+r};$e.prototype.abs=function(){return this.isNaN()?$e.NaN:this.isNegative()?this.negate():new $e(this)};$e.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};$e.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};$e.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};$e.prototype.trunc=function(){return this.isNaN()?$e.NaN:this.isPositive()?this.floor():this.ceil()};$e.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};$e.prototype.interfaces_=function(){return[Is,Es,cy]};$e.prototype.getClass=function(){return $e};$e.sqr=function(t){return $e.valueOf(t).selfMultiply(t)};$e.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return $e.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new $e(e)}};$e.sqrt=function(t){return $e.valueOf(t).sqrt()};$e.parse=function(t){for(var e=0,n=t.length;tm.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var v=t.charAt(e);if(e++,tm.isDigit(v)){var S=v-"0";s.selfMultiply($e.TEN),s.selfAdd(S),c++;continue}if(v==="."){l=c;continue}if(v==="e"||v==="E"){var E=t.substring(e);try{d=_a.parseInt(E)}catch(N){throw N instanceof Error?new Error("Invalid exponent "+E+" in string "+t):N}finally{}break}throw new Error("Unexpected character '"+v+"' at position "+e+" in string "+t)}var C=s,M=c-l-d;if(M===0)C=s;else if(M>0){var k=$e.TEN.pow(M);C=s.divide(k)}else if(M<0){var R=$e.TEN.pow(-M);C=s.multiply(R)}return r?C.negate():C};$e.createNaN=function(){return new $e(rn.NaN,rn.NaN)};$e.copy=function(t){return new $e(t)};$e.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=e&&(r+=1),r};$e.stringOfChar=function(t,e){for(var n=new Pa,r=0;r0){if(s<=0)return yo.signum(c);r=i+s}else if(i<0){if(s>=0)return yo.signum(c);r=-i-s}else return yo.signum(c);var l=yo.DP_SAFE_EPSILON*r;return c>=l||-c>=l?yo.signum(c):2};yo.signum=function(t){return t>0?1:t<0?-1:0};kC.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(yo,kC);var An=function(){},Sm={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Sm.X.get=function(){return 0};Sm.Y.get=function(){return 1};Sm.Z.get=function(){return 2};Sm.M.get=function(){return 3};An.prototype.setOrdinate=function(t,e,n){};An.prototype.size=function(){};An.prototype.getOrdinate=function(t,e){};An.prototype.getCoordinate=function(){};An.prototype.getCoordinateCopy=function(t){};An.prototype.getDimension=function(){};An.prototype.getX=function(t){};An.prototype.clone=function(){};An.prototype.expandEnvelope=function(t){};An.prototype.copy=function(){};An.prototype.getY=function(t){};An.prototype.toCoordinateArray=function(){};An.prototype.interfaces_=function(){return[cy]};An.prototype.getClass=function(){return An};Object.defineProperties(An,Sm);var DC=function(){},pp=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(DC),Ni=function(){};Ni.arraycopy=function(t,e,n,r,i){for(var s=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Vt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};Vt.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};Vt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Vt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Vt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Vt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Vt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Vt.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Vt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof ze){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Vt.prototype.centre=function(){return this.isNull()?null:new ze((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Vt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof ze){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Vt){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],c=arguments[2],l=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Vt.prototype.hashCode=function(){var t=17;return t=37*t+ze.hashCode(this._minx),t=37*t+ze.hashCode(this._maxx),t=37*t+ze.hashCode(this._miny),t=37*t+ze.hashCode(this._maxy),t};Vt.prototype.interfaces_=function(){return[Es,Is]};Vt.prototype.getClass=function(){return Vt};Vt.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],s=arguments[2],c=arguments[3],l=Math.min(s.x,c.x),d=Math.max(s.x,c.x),v=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(v>d||Sd)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};Ir.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};Ir.prototype.setPrecisionModel=function(t){this._precisionModel=t};Ir.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ni?s=r:s=i;else{var c=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y);r>i?s=c:s=l,s===0&&!t.equals(e)&&(s=Math.max(c,l))}return fn.isTrue(!(s===0&&!t.equals(e)),"Bad distance calculation"),s};Ir.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,s=Math.sqrt(r*r+i*i);return fn.isTrue(!(s===0&&!t.equals(e)),"Invalid distance calculation"),s};fh.DONT_INTERSECT.get=function(){return 0};fh.DO_INTERSECT.get=function(){return 1};fh.COLLINEAR.get=function(){return 2};fh.NO_INTERSECTION.get=function(){return 0};fh.POINT_INTERSECTION.get=function(){return 1};fh.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(Ir,fh);var pc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new Vt(this._inputLines[0][0],this._inputLines[0][1]),i=new Vt(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Vt.intersects(r,i,n)&&Et.orientationIndex(r,i,n)===0&&Et.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,s,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,s.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,s.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,s.x-=c.x,s.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,s){var c=null;try{c=Vs.intersection(n,r,i,s)}catch(l){if(l instanceof pp)c=e.nearestEndpoint(n,r,i,s);else throw l}finally{}return c},e.prototype.intersection=function(n,r,i,s){var c=this.intersectionWithNormalization(n,r,i,s);return this.isInSegmentEnvelopes(c)||(c=new ze(e.nearestEndpoint(n,r,i,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c},e.prototype.smallestInAbsValue=function(n,r,i,s){var c=n,l=Math.abs(c);return Math.abs(r)1e-4&&Ni.out.println("Distance = "+c.distance(l))},e.prototype.intersectionWithNormalization=function(n,r,i,s){var c=new ze(n),l=new ze(r),d=new ze(i),v=new ze(s),S=new ze;this.normalizeToEnvCentre(c,l,d,v,S);var E=this.safeHCoordinateIntersection(c,l,d,v);return E.x+=S.x,E.y+=S.y,E},e.prototype.computeCollinearIntersection=function(n,r,i,s){var c=Vt.intersects(n,r,i),l=Vt.intersects(n,r,s),d=Vt.intersects(i,s,n),v=Vt.intersects(i,s,r);return c&&l?(this._intPt[0]=i,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):d&&v?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&d?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!l&&!v?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&v?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!l&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&d?(this._intPt[0]=s,this._intPt[1]=n,s.equals(n)&&!c&&!v?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&v?(this._intPt[0]=s,this._intPt[1]=r,s.equals(r)&&!c&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,s,c){var l=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,E=i.xs.x?i.x:s.x,k=i.y>s.y?i.y:s.y,R=l>E?l:E,N=vC?d:C,F=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var d=Et.orientationIndex(i,s,n),v=Et.orientationIndex(i,s,r);if(d>0&&v>0||d<0&&v<0)return t.NO_INTERSECTION;var S=c===0&&l===0&&d===0&&v===0;return S?this.computeCollinearIntersection(n,r,i,s):(c===0||l===0||d===0||v===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(s)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(s)?this._intPt[0]=r:c===0?this._intPt[0]=new ze(i):l===0?this._intPt[0]=new ze(s):d===0?this._intPt[0]=new ze(n):v===0&&(this._intPt[0]=new ze(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,s)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,s){var c=n,l=Et.distancePointLine(n,i,s),d=Et.distancePointLine(r,i,s);return d0?n>0?-i:i:n>0?i:-i;if(e===0||n===0)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,s=t,t=n,n=s,s=e,e=r,r=s):e<=-r?(i=-i,n=-n,r=-r):(s=t,t=-n,n=s,s=e,e=-r,r=s):r>0?-e<=r?(i=-i,t=-t,e=-e):(s=-t,t=n,n=s,s=-e,e=r,r=s):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,s=-t,t=-n,n=s,s=-e,e=-r,r=s),t>0)if(n>0){if(!(t<=n))return i}else return i;else{if(n>0)return-i;if(t>=n)i=-i,t=-t,n=-n;else return-i}for(;;){if(c=Math.floor(n/t),n=n-c*t,r=r-c*e,r<0)return-i;if(r>e)return i;if(t>n+n){if(er+r)return-i;n=t-n,r=e-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(c=Math.floor(t/n),t=t-c*n,e=e-c*r,e<0))return i;if(e>r)return-i;if(n>t+t){if(re+e)return i;t=n-t,e=r-e,i=-i}if(e===0)return t===0?0:i;if(t===0)return-i}};var da=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};da.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,s=t.y-this._p.y,c=e.x-this._p.x,l=e.y-this._p.y,d=Yc.signOfDet2x2(i,s,c,l);if(d===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};da.prototype.isPointInPolygon=function(){return this.getLocation()!==Fe.EXTERIOR};da.prototype.getLocation=function(){return this._isPointOnSegment?Fe.BOUNDARY:this._crossingCount%2===1?Fe.INTERIOR:Fe.EXTERIOR};da.prototype.isOnSegment=function(){return this._isPointOnSegment};da.prototype.interfaces_=function(){return[]};da.prototype.getClass=function(){return da};da.locatePointInRing=function(){if(arguments[0]instanceof ze&&Kt(arguments[1],An)){for(var t=arguments[0],e=arguments[1],n=new da(t),r=new ze,i=new ze,s=1;s1||d<0||d>1)&&(i=!0)}}return i?is.min(Et.distancePointLine(t,n,r),Et.distancePointLine(e,n,r),Et.distancePointLine(n,t,e),Et.distancePointLine(r,t,e)):0};Et.isPointInRing=function(t,e){return Et.locatePointInRing(t,e)!==Fe.EXTERIOR};Et.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new ze;t.getCoordinate(0,r);for(var i=r.x,s=r.y,c=1;cn.y&&(n=s,r=i)}var c=r;do c=c-1,c<0&&(c=e);while(t[c].equals2D(n)&&c!==r);var l=r;do l=(l+1)%e;while(t[l].equals2D(n)&&l!==r);var d=t[c],v=t[l];if(d.equals2D(n)||v.equals2D(n)||d.equals2D(v))return!1;var S=Et.computeOrientation(d,n,v),E=!1;return S===0?E=d.x>v.x:E=S>0,E};Et.locatePointInRing=function(t,e){return da.locatePointInRing(t,e)};Et.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};Et.computeOrientation=function(t,e,n){return Et.orientationIndex(t,e,n)};Et.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new br("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return s.distance(l);var S=((c.y-s.y)*(l.x-c.x)-(c.x-s.x)*(l.y-c.y))/d;return Math.abs(S)*Math.sqrt(d)}};Et.isOnLine=function(t,e){for(var n=new pc,r=1;r0};Vf.prototype.interfaces_=function(){return[xs]};Vf.prototype.getClass=function(){return Vf};var Uf=function(){};Uf.prototype.isInBoundary=function(t){return t>1};Uf.prototype.interfaces_=function(){return[xs]};Uf.prototype.getClass=function(){return Uf};var jf=function(){};jf.prototype.isInBoundary=function(t){return t===1};jf.prototype.interfaces_=function(){return[xs]};jf.prototype.getClass=function(){return jf};var ti=function(){};ti.prototype.add=function(){};ti.prototype.addAll=function(){};ti.prototype.isEmpty=function(){};ti.prototype.iterator=function(){};ti.prototype.size=function(){};ti.prototype.toArray=function(){};ti.prototype.remove=function(){};function X1(t){this.message=t||""}X1.prototype=new Error;X1.prototype.name="IndexOutOfBoundsException";var dp=function(){};dp.prototype.hasNext=function(){};dp.prototype.next=function(){};dp.prototype.remove=function(){};var Us=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(ti);function mp(t){this.message=t||""}mp.prototype=new Error;mp.prototype.name="NoSuchElementException";var _t=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof ti&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,ti]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},e.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},e.prototype.iterator=function(){return new FO(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new X1;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],i=0,s=this.array_.length;i=1){var v=this.get(this.size()-1);if(v.equals2D(l))return null}t.prototype.add.call(this,l)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],E=arguments[1];return this.add(S,E),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var C=arguments[0],M=arguments[1],k=arguments[2];if(k)for(var R=0;R=0;N--)r.add(C[N],M);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof ze){var B=arguments[0],F=arguments[1],G=arguments[2];if(!G){var H=this.size();if(H>0){if(B>0){var K=this.get(B-1);if(K.equals2D(F))return null}if(Bke&&(Q=-1);for(var oe=ve;oe!==ke;oe+=Q)r.add(ae[oe],le);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ze(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(_t),Sn=function(){},fy={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};fy.ForwardComparator.get=function(){return nm};fy.BidirectionalComparator.get=function(){return Gf};fy.coordArrayType.get=function(){return new Array(0).fill(null)};Sn.prototype.interfaces_=function(){return[]};Sn.prototype.getClass=function(){return Sn};Sn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};Sn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};Sn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};Sn.extract=function(t,e,n){e=is.clamp(e,0,t.length),n=is.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=Sn.compare(n,r),s=Sn.isEqualReversed(n,r);return s?0:i};Gf.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=Sn.increasingDirection(n),s=Sn.increasingDirection(r),c=i>0?0:n.length-1,l=s>0?0:n.length-1,d=0;d0)e=e.right;else return e.value}return null};qi.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:yl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var s=n.value;return n.value=e,s}while(n!==null);var c={key:t,left:null,right:null,value:e,parent:r,color:yl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};qi.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=ju;t!=null&&t!==this.root_&&t.parent.color===ju;)if(nr(t)===ov(nr(nr(t)))){var n=rS(nr(nr(t)));nS(n)===ju?(dl(nr(t),yl),dl(n,yl),dl(nr(nr(t)),ju),t=nr(nr(t))):(t===rS(nr(t))&&(t=nr(t),e.rotateLeft(t)),dl(nr(t),yl),dl(nr(nr(t)),ju),e.rotateRight(nr(nr(t))))}else{var r=ov(nr(nr(t)));nS(r)===ju?(dl(nr(t),yl),dl(r,yl),dl(nr(nr(t)),ju),t=nr(nr(t))):(t===ov(nr(t))&&(t=nr(t),e.rotateRight(t)),dl(nr(t),yl),dl(nr(nr(t)),ju),e.rotateLeft(nr(nr(t))))}this.root_.color=yl};qi.prototype.values=function(){var t=new _t,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=qi.successor(e))!==null;)t.add(e.value);return t};qi.prototype.entrySet=function(){var t=new $1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=qi.successor(e))!==null;)t.add(e);return t};qi.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};qi.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};qi.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};qi.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};qi.prototype.size=function(){return this.size_};var rm=function(){};rm.prototype.interfaces_=function(){return[]};rm.prototype.getClass=function(){return rm};function NC(){}NC.prototype=new py;function ya(){this.array_=[],arguments[0]instanceof ti&&this.addAll(arguments[0])}ya.prototype=new NC;ya.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var c=i.substring(0,s);r.add(c),i=i.substring(s+n),s=i.indexOf(e)}i.length>0&&r.add(i);for(var l=new Array(r.size()).fill(null),d=0;d0)for(var s=i;s0&&r.append(" ");for(var s=0;s0&&r.append(","),r.append(vs.toString(t.getOrdinate(i,s)))}return r.append(")"),r.toString()}};jr.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return jr.createClosedRing(t,e,4);var r=e.getOrdinate(0,An.X)===e.getOrdinate(n-1,An.X)&&e.getOrdinate(0,An.Y)===e.getOrdinate(n-1,An.Y);return r?e:jr.createClosedRing(t,e,n+1)};jr.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();jr.copy(e,0,r,0,i);for(var s=i;s0&&jr.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Bn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Et.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();jr.reverse(r);var i=this.getFactory().createLineString(r);return i},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],s=i,c=0,l=0;c= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=this,s=0;s=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Dr),Ga=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Yt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,s=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};sm.prototype.interfaces_=function(){return[ws.GeometryEditorOperation]};sm.prototype.getClass=function(){return sm};var am=function(){};am.prototype.edit=function(t,e){return t instanceof Ha?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Dr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Bo?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};am.prototype.interfaces_=function(){return[ws.GeometryEditorOperation]};am.prototype.getClass=function(){return am};var Vr=function(){var t=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 e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new Pa(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Vr(n):new Vr(n,r)}};Za.prototype.interfaces_=function(){return[Ff,Is]};Za.prototype.getClass=function(){return Za};Za.instance=function(){return Za.instanceObject};K1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};K1.instanceObject.get=function(){return new Za};Object.defineProperties(Za,K1);var zC=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new _t,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new $1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(dh),Un=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ba){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},J1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Un.prototype.equals=function(t){if(!(t instanceof Un))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Un.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new _a(n).compareTo(new _a(r))};Un.prototype.getScale=function(){return this._scale};Un.prototype.isFloating=function(){return this._modelType===Un.FLOATING||this._modelType===Un.FLOATING_SINGLE};Un.prototype.getType=function(){return this._modelType};Un.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Un.FLOATING?t="Floating":this._modelType===Un.FLOATING_SINGLE?t="Floating-Single":this._modelType===Un.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Un.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(rn.isNaN(t))return t;if(this._modelType===Un.FLOATING_SINGLE){var e=t;return e}return this._modelType===Un.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof ze){var n=arguments[0];if(this._modelType===Un.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Un.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Un.FLOATING?t=16:this._modelType===Un.FLOATING_SINGLE?t=6:this._modelType===Un.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Un.prototype.setScale=function(t){this._scale=Math.abs(t)};Un.prototype.interfaces_=function(){return[Is,Es]};Un.prototype.getClass=function(){return Un};Un.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};J1.serialVersionUID.get=function(){return 7777263578777804e3};J1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Un,J1);var ba=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Q1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ba.prototype.readResolve=function(){return ba.nameToTypeMap.get(this._name)};ba.prototype.toString=function(){return this._name};ba.prototype.interfaces_=function(){return[Is]};ba.prototype.getClass=function(){return ba};Q1.serialVersionUID.get=function(){return-552860263173159e4};Q1.nameToTypeMap.get=function(){return new zC};Object.defineProperties(ba,Q1);Un.Type=ba;Un.FIXED=new ba("FIXED");Un.FLOATING=new ba("FLOATING");Un.FLOATING_SINGLE=new ba("FLOATING SINGLE");var wn=function t(){this._precisionModel=new Un,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Kt(arguments[0],Ff)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Un&&(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]))},FC={serialVersionUID:{configurable:!0}};wn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new ze(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new ze(t.getMinX(),t.getMinY()),new ze(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new ze(t.getMinX(),t.getMinY()),new ze(t.getMinX(),t.getMaxY()),new ze(t.getMaxX(),t.getMaxY()),new ze(t.getMaxX(),t.getMinY()),new ze(t.getMinX(),t.getMinY())]),null)};wn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Dr(this.getCoordinateSequenceFactory().create(t),this);if(Kt(t,An))return new Dr(t,this)}else return new Dr(this.getCoordinateSequenceFactory().create([]),this)};wn.prototype.createMultiLineString=function(){if(arguments.length===0)return new ec(null,this);if(arguments.length===1){var t=arguments[0];return new ec(t,this)}};wn.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var s=i.next(),c=s.getClass();e===null&&(e=c),c!==e&&(n=!0),s.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(wn.toGeometryArray(t));var l=t.iterator().next(),d=t.size()>1;if(d){if(l instanceof li)return this.createMultiPolygon(wn.toPolygonArray(t));if(l instanceof Dr)return this.createMultiLineString(wn.toLineStringArray(t));if(l instanceof Bo)return this.createMultiPoint(wn.toPointArray(t));fn.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};wn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};wn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof ze){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Kt(arguments[0],An)){var e=arguments[0];return new Bo(e,this)}}};wn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};wn.prototype.createPolygon=function(){if(arguments.length===0)return new li(null,null,this);if(arguments.length===1){if(Kt(arguments[0],An)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Ha){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new li(r,i,this)}};wn.prototype.getSRID=function(){return this._SRID};wn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new io(null,this);if(arguments.length===1){var t=arguments[0];return new io(t,this)}};wn.prototype.createGeometry=function(t){var e=new ws(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};wn.prototype.getPrecisionModel=function(){return this._precisionModel};wn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Kt(arguments[0],An)){var e=arguments[0];return new Ha(e,this)}}};wn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ga(null,this);if(arguments.length===1){var t=arguments[0];return new Ga(t,this)}};wn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new qf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new qf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Kt(arguments[0],An)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),s=0;s=this.size())throw new Error;return this.array_[t]};Ma.prototype.push=function(t){return this.array_.push(t),t};Ma.prototype.pop=function(t){if(this.array_.length===0)throw new yy;return this.array_.pop()};Ma.prototype.peek=function(){if(this.array_.length===0)throw new yy;return this.array_[this.array_.length-1]};Ma.prototype.empty=function(){return this.array_.length===0};Ma.prototype.isEmpty=function(){return this.empty()};Ma.prototype.search=function(t){return this.array_.indexOf(t)};Ma.prototype.size=function(){return this.array_.length};Ma.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===Et.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};xa.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var i=ut.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};xa.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};xa.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}fn.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 i=this.getRightmostSide(this._minDe,this._minIndex);i===ut.LEFT&&(this._orientedDe=this._minDe.getSym())};xa.prototype.interfaces_=function(){return[]};xa.prototype.getClass=function(){return xa};var Pl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new ze(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(Tl),vy=function(){this.array_=[]};vy.prototype.addLast=function(t){this.array_.push(t)};vy.prototype.removeFirst=function(){return this.array_.shift()};vy.prototype.isEmpty=function(){return this.array_.length===0};var oo=function(){this._finder=null,this._dirEdgeList=new _t,this._nodes=new _t,this._rightMostCoord=null,this._env=null,this._finder=new xa};oo.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};oo.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};oo.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new Pl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var s=t.getEdges().iterator();s.hasNext();){var c=s.next();c.setVisited(!0),e.copySymDepths(c)}};oo.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ut.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};oo.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};oo.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ut.RIGHT)>=1&&e.getDepth(ut.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};oo.prototype.computeDepths=function(t){var e=this,n=new $1,r=new vy,i=t.getNode();for(r.addLast(i),n.add(i),t.setVisited(!0);!r.isEmpty();){var s=r.removeFirst();n.add(s),e.computeNodeDepth(s);for(var c=s.getEdges().iterator();c.hasNext();){var l=c.next(),d=l.getSym();if(!d.isVisited()){var v=d.getNode();n.contains(v)||(r.addLast(v),n.add(v))}}}};oo.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};oo.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Vt,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ut.ON]=this.location[ut.ON],n[ut.LEFT]=Fe.NONE,n[ut.RIGHT]=Fe.NONE,this.location=n}for(var r=0;r1&&t.append(Fe.toLocationSymbol(this.location[ut.LEFT])),t.append(Fe.toLocationSymbol(this.location[ut.ON])),this.location.length>1&&t.append(Fe.toLocationSymbol(this.location[ut.RIGHT])),t.toString()};rr.prototype.setLocations=function(t,e,n){this.location[ut.ON]=t,this.location[ut.LEFT]=e,this.location[ut.RIGHT]=n};rr.prototype.get=function(t){return t1};rr.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};$r.prototype.addPoints=function(t,e,n){var r=this,i=t.getCoordinates();if(e){var s=1;n&&(s=0);for(var c=s;c=0;d--)r._pts.add(i[d])}};$r.prototype.isHole=function(){return this._isHole};$r.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};$r.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!Et.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};$r.prototype.addHole=function(t){this._holes.add(t)};$r.prototype.isShell=function(){return this._shell===null};$r.prototype.getLabel=function(){return this._label};$r.prototype.getEdges=function(){return this._edges};$r.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};$r.prototype.getShell=function(){return this._shell};$r.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,ut.RIGHT);if(r===Fe.NONE)return null;if(this._label.getLocation(n)===Fe.NONE)return this._label.setLocation(n,r),null}};$r.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};$r.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};os.prototype.isInResult=function(){return this._isInResult};os.prototype.isVisited=function(){return this._isVisited};os.prototype.interfaces_=function(){return[]};os.prototype.getClass=function(){return os};var by=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Wn(0,Fe.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var i=Fe.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var s=n.getLocation(r);i!==Fe.BOUNDARY&&(i=s)}return i},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Wn(n,r):this._label.setLocation(n,r)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Wn)for(var i=arguments[0],s=0;s<2;s++){var c=n.computeMergedLocation(i,s),l=n._label.getLocation(s);l===Fe.NONE&&n._label.setLocation(s,c)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=Fe.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Fe.BOUNDARY:i=Fe.INTERIOR;break;case Fe.INTERIOR:i=Fe.BOUNDARY;break;default:i=Fe.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(os),wa=function(){this.nodeMap=new qi,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};wa.prototype.find=function(t){return this.nodeMap.get(t)};wa.prototype.addNode=function(){if(arguments[0]instanceof ze){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof by){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};wa.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};wa.prototype.iterator=function(){return this.nodeMap.values().iterator()};wa.prototype.values=function(){return this.nodeMap.values()};wa.prototype.getBoundaryNodes=function(t){for(var e=new _t,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Fe.BOUNDARY&&e.add(r)}return e};wa.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};wa.prototype.interfaces_=function(){return[]};wa.prototype.getClass=function(){return wa};var Zn=function(){},Cm={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Zn.prototype.interfaces_=function(){return[]};Zn.prototype.getClass=function(){return Zn};Zn.isNorthern=function(t){return t===Zn.NE||t===Zn.NW};Zn.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Zn.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var r=te?t:e;return r===0&&i===3?3:r};Zn.isInHalfPlane=function(t,e){return e===Zn.SE?t===Zn.SE||t===Zn.SW:t===e||t===e+1};Zn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new br("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Zn.NE:Zn.SE:e>=0?Zn.NW:Zn.SW}else if(arguments[0]instanceof ze&&arguments[1]instanceof ze){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new br("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Zn.NE:Zn.SE:r.y>=n.y?Zn.NW:Zn.SW}};Cm.NE.get=function(){return 0};Cm.NW.get=function(){return 1};Cm.SW.get=function(){return 2};Cm.SE.get=function(){return 3};Object.defineProperties(Zn,Cm);var Wi=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 t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var s=arguments[0],c=arguments[1],l=arguments[2],d=arguments[3];this._edge=s,this.init(c,l),this._label=d}};Wi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var l=c.buildMinimalRings(),d=r.findShell(l);d!==null?(r.placePolygonHoles(d,l),e.add(d)):n.addAll(l)}else i.add(c)}return i};Vo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Vo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new _t,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var s=new $O(i,e._geometryFactory);n.add(s),s.setInResult()}}return n};Vo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Vo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Vo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),s=null,c=null,l=e.iterator();l.hasNext();){var d=l.next(),v=d.getLinearRing(),S=v.getEnvelopeInternal();s!==null&&(c=s.getLinearRing().getEnvelopeInternal());var E=!1;S.contains(r)&&Et.isPointInRing(i,v.getCoordinates())&&(E=!0),E&&(s===null||c.contains(S))&&(s=d)}return s};Vo.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return fn.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Vo.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];Cr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new _t,s=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(s,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Vo.prototype.interfaces_=function(){return[]};Vo.prototype.getClass=function(){return Vo};var Hf=function(){};Hf.prototype.getBounds=function(){};Hf.prototype.interfaces_=function(){return[]};Hf.prototype.getClass=function(){return Hf};var qs=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};qs.prototype.getItem=function(){return this._item};qs.prototype.getBounds=function(){return this._bounds};qs.prototype.interfaces_=function(){return[Hf,Is]};qs.prototype.getClass=function(){return qs};var Ml=function(){this._size=null,this._items=null,this._size=0,this._items=new _t,this._items.add(null)};Ml.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};Ml.prototype.size=function(){return this._size};Ml.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)};Ml.prototype.clear=function(){this._size=0,this._items.clear()};Ml.prototype.isEmpty=function(){return this._size===0};Ml.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)};Ml.prototype.interfaces_=function(){return[]};Ml.prototype.getClass=function(){return Ml};var hu=function(){};hu.prototype.visitItem=function(t){};hu.prototype.interfaces_=function(){return[]};hu.prototype.getClass=function(){return hu};var Kc=function(){};Kc.prototype.insert=function(t,e){};Kc.prototype.remove=function(t,e){};Kc.prototype.query=function(){};Kc.prototype.interfaces_=function(){return[]};Kc.prototype.getClass=function(){return Kc};var ii=function(){if(this._childBoundables=new _t,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},VC={serialVersionUID:{configurable:!0}};ii.prototype.getLevel=function(){return this._level};ii.prototype.size=function(){return this._childBoundables.size()};ii.prototype.getChildBoundables=function(){return this._childBoundables};ii.prototype.addChildBoundable=function(t){fn.isTrue(this._bounds===null),this._childBoundables.add(t)};ii.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};ii.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};ii.prototype.interfaces_=function(){return[Hf,Is]};ii.prototype.getClass=function(){return ii};VC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(ii,VC);var Ws=function(){};Ws.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ws.min=function(t){return Ws.sort(t),t.get(0)};Ws.sort=function(t,e){var n=t.toArray();e?Yu.sort(n,e):Yu.sort(n);for(var r=t.iterator(),i=0,s=n.length;iZr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new br("neither boundable is composite")};Zr.prototype.isLeaves=function(){return!(Zr.isComposite(this._boundable1)||Zr.isComposite(this._boundable2))};Zr.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Zr.prototype.expand=function(t,e,n,r){for(var i=this,s=t.getChildBoundables(),c=s.iterator();c.hasNext();){var l=c.next(),d=new Zr(l,e,i._itemDistance);d.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},xy={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ci.prototype.getNodeCapacity=function(){return this._nodeCapacity};Ci.prototype.lastNode=function(t){return t.get(t.size()-1)};Ci.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof ii?n+=t.size(i):i instanceof qs&&(n+=1)}return n}};Ci.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof qs&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};Ci.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new _t:e}else if(arguments.length===1){for(var n=arguments[0],r=new _t,i=n.getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof ii){var c=t.itemsTree(s);c!==null&&r.add(c)}else s instanceof qs?r.add(s.getItem()):fn.shouldNeverReachHere()}return r.size()<=0?null:r}};Ci.prototype.insert=function(t,e){fn.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new qs(t,e))};Ci.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new _t;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];if(fn.isTrue(r>-2),i.getLevel()===r)return s.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var l=c.next();l instanceof ii?t.boundablesAtLevel(r,l,s):(fn.isTrue(l instanceof qs),r===-1&&s.add(l))}return null}};Ci.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new _t;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Kt(arguments[2],hu)&&arguments[0]instanceof Object&&arguments[1]instanceof ii)for(var s=arguments[0],c=arguments[1],l=arguments[2],d=c.getChildBoundables(),v=0;vn&&(n=s)}}return n+1}};Ci.prototype.createParentBoundables=function(t,e){var n=this;fn.isTrue(!t.isEmpty());var r=new _t;r.add(this.createNode(e));var i=new _t(t);Ws.sort(i,this.getComparator());for(var s=i.iterator();s.hasNext();){var c=s.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};Ci.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Ci.prototype.interfaces_=function(){return[Is]};Ci.prototype.getClass=function(){return Ci};Ci.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new _t,l=0;l0;){var k=M.poll(),R=k.getDistance();if(R>=E)break;k.isLeaves()?(E=R,C=k):k.expandToQueue(M,E)}return[C.getBoundable(0).getItem(),C.getBoundable(1).getItem()]}}else if(arguments.length===3){var N=arguments[0],B=arguments[1],F=arguments[2],G=new qs(N,B),H=new Zr(this.getRoot(),G,F);return this.nearestNeighbour(H)[0]}},e.prototype.interfaces_=function(){return[Kc,Is]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return iS},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[zf]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[zf]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Ci),iS=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Vt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ii),_o=function(){};_o.prototype.interfaces_=function(){return[]};_o.prototype.getClass=function(){return _o};_o.relativeSign=function(t,e){return te?1:0};_o.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=_o.relativeSign(e.x,n.x),i=_o.relativeSign(e.y,n.y);switch(t){case 0:return _o.compareValue(r,i);case 1:return _o.compareValue(i,r);case 2:return _o.compareValue(i,-r);case 3:return _o.compareValue(-r,i);case 4:return _o.compareValue(-r,-i);case 5:return _o.compareValue(-i,-r);case 6:return _o.compareValue(-i,r);case 7:return _o.compareValue(r,-i)}return fn.shouldNeverReachHere("invalid octant value"),0};_o.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var fu=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new ze(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};fu.prototype.getCoordinate=function(){return this.coord};fu.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};fu.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:_o.compare(this._segmentOctant,this.coord,e.coord)};fu.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};fu.prototype.isInterior=function(){return this._isInterior};fu.prototype.interfaces_=function(){return[Es]};fu.prototype.getClass=function(){return fu};var so=function(){this._nodeMap=new qi,this._edge=null;var t=arguments[0];this._edge=t};so.prototype.getSplitCoordinates=function(){var t=this,e=new Em;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();t.addEdgeCoordinates(r,i,e),r=i}return e.toCoordinateArray()};so.prototype.addCollapsedNodes=function(){var t=this,e=new _t;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};so.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};so.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof ze&&arguments[1]instanceof ze){var i=arguments[0],s=arguments[1],c=s.x-i.x,l=s.y-i.y;if(c===0&&l===0)throw new br("Cannot compute the octant for two identical points "+i);return Jc.octant(c,l)}};var Xa=function(){};Xa.prototype.getCoordinates=function(){};Xa.prototype.size=function(){};Xa.prototype.getCoordinate=function(t){};Xa.prototype.isClosed=function(){};Xa.prototype.setData=function(t){};Xa.prototype.getData=function(){};Xa.prototype.interfaces_=function(){return[]};Xa.prototype.getClass=function(){return Xa};var lm=function(){};lm.prototype.addIntersection=function(t,e){};lm.prototype.interfaces_=function(){return[Xa]};lm.prototype.getClass=function(){return lm};var Gr=function(){this._nodeList=new so(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Gr.prototype.getCoordinates=function(){return this._pts};Gr.prototype.size=function(){return this._pts.length};Gr.prototype.getCoordinate=function(t){return this._pts[t]};Gr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Gr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};Gr.prototype.setData=function(t){this._data=t};Gr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Jc.octant(t,e)};Gr.prototype.getData=function(){return this._data};Gr.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],s=new ze(n.getIntersection(i));this.addIntersection(s,r)}};Gr.prototype.toString=function(){return js.toLineString(new Vr(this._pts))};Gr.prototype.getNodeList=function(){return this._nodeList};Gr.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof ze){var r=arguments[0];return Et.orientationIndex(this.p0,this.p1,r)}};jt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};jt.prototype.isVertical=function(){return this.p0.x===this.p1.x};jt.prototype.equals=function(t){if(!(t instanceof jt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};jt.prototype.intersection=function(t){var e=new pc;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};jt.prototype.project=function(){if(arguments[0]instanceof ze){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new ze(t);var e=this.projectionFactor(t),n=new ze;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof jt){var r=arguments[0],i=this.projectionFactor(r.p0),s=this.projectionFactor(r.p1);if(i>=1&&s>=1||i<=0&&s<=0)return null;var c=this.project(r.p0);i<0&&(c=this.p0),i>1&&(c=this.p1);var l=this.project(r.p1);return s<0&&(l=this.p0),s>1&&(l=this.p1),new jt(c,l)}};jt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};jt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};jt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};jt.prototype.distancePerpendicular=function(t){return Et.distancePointLinePerpendicular(t,this.p0,this.p1)};jt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};jt.prototype.midPoint=function(){return jt.midPoint(this.p0,this.p1)};jt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return rn.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};jt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=rn.MAX_VALUE,i=null,s=this.closestPoint(t.p0);r=s.distance(t.p0),n[0]=s,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||rn.isNaN(e))&&(e=1),e};jt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};jt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};jt.prototype.distance=function(){if(arguments[0]instanceof jt){var t=arguments[0];return Et.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof ze){var e=arguments[0];return Et.distancePointLine(e,this.p0,this.p1)}};jt.prototype.pointAlong=function(t){var e=new ze;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};jt.prototype.hashCode=function(){var t=rn.doubleToLongBits(this.p0.x);t^=rn.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=rn.doubleToLongBits(this.p1.x);n^=rn.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};jt.prototype.interfaces_=function(){return[Es,Is]};jt.prototype.getClass=function(){return jt};jt.midPoint=function(t,e){return new ze((t.x+e.x)/2,(t.y+e.y)/2)};jC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(jt,jC);var um=function(){this.tempEnv1=new Vt,this.tempEnv2=new Vt,this._overlapSeg1=new jt,this._overlapSeg2=new jt};um.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};um.prototype.interfaces_=function(){return[]};um.prototype.getClass=function(){return um};var Uo=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Uo.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Uo.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],s=this._pts[n];if(r.tempEnv1.init(i,s),n-e===1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var c=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=Zn.quadrant(t[n],t[n+1]),i=e+1;ic.getId()&&(c.computeOverlaps(v,i),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return oS},Object.defineProperties(e,n),e}(cm),oS=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],s=arguments[3],c=n.getContext(),l=i.getContext();this._si.processIntersections(c,r,l,s)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(um),Vn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],c=arguments[2],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(s),this.setJoinStyle(c),this.setMitreLimit(l)}}},Ol={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}};Vn.prototype.getEndCapStyle=function(){return this._endCapStyle};Vn.prototype.isSingleSided=function(){return this._isSingleSided};Vn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Vn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Vn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Vn.JOIN_ROUND&&(this._quadrantSegments=Vn.DEFAULT_QUADRANT_SEGMENTS)};Vn.prototype.getJoinStyle=function(){return this._joinStyle};Vn.prototype.setJoinStyle=function(t){this._joinStyle=t};Vn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Vn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Vn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Vn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Vn.prototype.getMitreLimit=function(){return this._mitreLimit};Vn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Vn.prototype.setSingleSided=function(t){this._isSingleSided=t};Vn.prototype.interfaces_=function(){return[]};Vn.prototype.getClass=function(){return Vn};Vn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Ol.CAP_ROUND.get=function(){return 1};Ol.CAP_FLAT.get=function(){return 2};Ol.CAP_SQUARE.get=function(){return 3};Ol.JOIN_ROUND.get=function(){return 1};Ol.JOIN_MITRE.get=function(){return 2};Ol.JOIN_BEVEL.get=function(){return 3};Ol.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Ol.DEFAULT_MITRE_LIMIT.get=function(){return 5};Ol.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Vn,Ol);var Rr=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Et.COUNTERCLOCKWISE,this._inputLine=t||null},Tm={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Rr.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],s=this._inputLine[e],c=this._inputLine[n];return!this.isConcave(i,s,c)||!this.isShallow(i,s,c,r)?!1:this.isShallowSampled(i,s,t,n,r)};Rr.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};ss.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=Cn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Cn.PI_TIMES_2;return t};Cn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}};Cn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,s=n.x-e.x,c=n.y-e.y,l=r*s+i*c;return l>0};Cn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,s=n.x-e.x,c=n.y-e.y,l=r*s+i*c;return l<0};Cn.interiorAngle=function(t,e,n){var r=Cn.angle(e,t),i=Cn.angle(e,n);return Math.abs(i-r)};Cn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Cn.PI_TIMES_2;t>=Cn.PI_TIMES_2&&(t=0)}else{for(;t>=Cn.PI_TIMES_2;)t-=Cn.PI_TIMES_2;t<0&&(t=0)}return t};Cn.angleBetween=function(t,e,n){var r=Cn.angle(e,t),i=Cn.angle(e,n);return Cn.diff(r,i)};Cn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Cn.toRadians=function(t){return t*Math.PI/180};Cn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Cn.COUNTERCLOCKWISE:n<0?Cn.CLOCKWISE:Cn.NONE};Cn.angleBetweenOriented=function(t,e,n){var r=Cn.angle(e,t),i=Cn.angle(e,n),s=i-r;return s<=-Math.PI?s+Cn.PI_TIMES_2:s>Math.PI?s-Cn.PI_TIMES_2:s};mh.PI_TIMES_2.get=function(){return 2*Math.PI};mh.PI_OVER_2.get=function(){return Math.PI/2};mh.PI_OVER_4.get=function(){return Math.PI/4};mh.COUNTERCLOCKWISE.get=function(){return Et.COUNTERCLOCKWISE};mh.CLOCKWISE.get=function(){return Et.CLOCKWISE};mh.NONE.get=function(){return Et.COLLINEAR};Object.defineProperties(Cn,mh);var cr=function t(){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 jt,this._seg1=new jt,this._offset0=new jt,this._offset1=new jt,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new pc,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Vn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Lm={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}};cr.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,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=Et.computeOrientation(this._s0,this._s1,this._s2),r=n===Et.CLOCKWISE&&this._side===ut.LEFT||n===Et.COUNTERCLOCKWISE&&this._side===ut.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};cr.prototype.addLineEndCap=function(t,e){var n=new jt(t,e),r=new jt;this.computeOffsetSegment(n,ut.LEFT,this._distance,r);var i=new jt;this.computeOffsetSegment(n,ut.RIGHT,this._distance,i);var s=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,s);switch(this._bufParams.getEndCapStyle()){case Vn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,Et.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Vn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Vn.CAP_SQUARE:var d=new ze;d.x=Math.abs(this._distance)*Math.cos(l),d.y=Math.abs(this._distance)*Math.sin(l);var v=new ze(r.p1.x+d.x,r.p1.y+d.y),S=new ze(i.p1.x+d.x,i.p1.y+d.y);this._segList.addPt(v),this._segList.addPt(S);break}};cr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};cr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,s=null;try{s=Vs.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:s.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(l){if(l instanceof pp)s=new ze(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(s):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};cr.prototype.addFilletCorner=function(t,e,n,r,i){var s=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,s),d=n.x-t.x,v=n.y-t.y,S=Math.atan2(v,d);r===Et.CLOCKWISE?l<=S&&(l+=2*Math.PI):l>=S&&(l-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,l,S,r,i),this._segList.addPt(n)};cr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new ze((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 r=new ze((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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};cr.prototype.createCircle=function(t){var e=new ze(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};cr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};cr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ss,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*cr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};cr.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===Vn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Vn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Et.CLOCKWISE,this._distance))};cr.prototype.closeRing=function(){this._segList.closeRing()};cr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};cr.prototype.interfaces_=function(){return[]};cr.prototype.getClass=function(){return cr};Lm.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Lm.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Lm.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Lm.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(cr,Lm);var bo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};bo.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var s=i.getCoordinates();return n&&Sn.reverse(s),s};bo.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Rr.simplify(t,-r),s=i.length-1;n.initSideSegments(i[s],i[s-1],ut.LEFT),n.addFirstSegment();for(var c=s-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var l=Rr.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],ut.LEFT),n.addFirstSegment();for(var v=2;v<=d;v++)n.addNextSegment(l[v],!0)}n.addLastSegment(),n.closeRing()};bo.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===ut.RIGHT&&(r=-r);var i=Rr.simplify(t,r),s=i.length-1;n.initSideSegments(i[s-1],i[0],e);for(var c=1;c<=s;c++){var l=c!==1;n.addNextSegment(i[c],l)}n.closeRing()};bo.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Rr.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],ut.LEFT);for(var s=2;s<=i;s++)e.addNextSegment(r[s],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=Rr.simplify(t,-n),l=c.length-1;e.initSideSegments(c[l],c[l-1],ut.LEFT);for(var d=l-2;d>=0;d--)e.addNextSegment(c[d],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};bo.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Vn.CAP_ROUND:e.createCircle(t);break;case Vn.CAP_SQUARE:e.createSquare(t);break}};bo.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);var s=r.getCoordinates();return s};bo.prototype.getBufferParameters=function(){return this._bufParams};bo.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};bo.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return bo.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};bo.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Rr.simplify(t,-r),s=i.length-1;n.initSideSegments(i[s],i[s-1],ut.LEFT),n.addFirstSegment();for(var c=s-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var l=Rr.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],ut.LEFT),n.addFirstSegment();for(var v=2;v<=d;v++)n.addNextSegment(l[v],!0)}n.addLastSegment()};bo.prototype.getSegGen=function(t){return new cr(this._precisionModel,this._bufParams,t)};bo.prototype.interfaces_=function(){return[]};bo.prototype.getClass=function(){return bo};bo.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;ns.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Kt(arguments[2],Us)&&arguments[0]instanceof ze&&arguments[1]instanceof Qv)for(var c=arguments[0],l=arguments[1],d=arguments[2],v=l.getEdge().getCoordinates(),S=0;St._seg.p1.y&&t._seg.reverse();var E=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Et._seg.p1.y)&&Et.computeOrientation(t._seg.p0,t._seg.p1,c)!==Et.RIGHT){var C=l.getDepth(ut.LEFT);t._seg.p0.equals(v[S])||(C=l.getDepth(ut.RIGHT));var M=new nc(t._seg,C);d.add(M)}}else if(Kt(arguments[2],Us)&&arguments[0]instanceof ze&&Kt(arguments[1],Us))for(var k=arguments[0],R=arguments[1],N=arguments[2],B=R.iterator();B.hasNext();){var F=B.next();F.isForward()&&t.findStabbedSegments(k,F,N)}}};Qc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ws.min(e);return n._leftDepth};Qc.prototype.interfaces_=function(){return[]};Qc.prototype.getClass=function(){return Qc};qC.DepthSegment.get=function(){return nc};Object.defineProperties(Qc,qC);var nc=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new jt(t),this._leftDepth=e};nc.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};nc.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};nc.prototype.toString=function(){return this._upwardSeg.toString()};nc.prototype.interfaces_=function(){return[Es]};nc.prototype.getClass=function(){return nc};var jn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};jn.prototype.area=function(){return jn.area(this.p0,this.p1,this.p2)};jn.prototype.signedArea=function(){return jn.signedArea(this.p0,this.p1,this.p2)};jn.prototype.interpolateZ=function(t){if(t===null)throw new br("Supplied point is null.");return jn.interpolateZ(t,this.p0,this.p1,this.p2)};jn.prototype.longestSideLength=function(){return jn.longestSideLength(this.p0,this.p1,this.p2)};jn.prototype.isAcute=function(){return jn.isAcute(this.p0,this.p1,this.p2)};jn.prototype.circumcentre=function(){return jn.circumcentre(this.p0,this.p1,this.p2)};jn.prototype.area3D=function(){return jn.area3D(this.p0,this.p1,this.p2)};jn.prototype.centroid=function(){return jn.centroid(this.p0,this.p1,this.p2)};jn.prototype.inCentre=function(){return jn.inCentre(this.p0,this.p1,this.p2)};jn.prototype.interfaces_=function(){return[]};jn.prototype.getClass=function(){return jn};jn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)};jn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};jn.det=function(t,e,n,r){return t*r-e*n};jn.interpolateZ=function(t,e,n,r){var i=e.x,s=e.y,c=n.x-i,l=r.x-i,d=n.y-s,v=r.y-s,S=c*v-l*d,E=t.x-i,C=t.y-s,M=(v*E-l*C)/S,k=(-d*E+c*C)/S,R=e.z+M*(n.z-e.z)+k*(r.z-e.z);return R};jn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),s=n.distance(t),c=r;return i>c&&(c=i),s>c&&(c=s),c};jn.isAcute=function(t,e,n){return!(!Cn.isAcute(t,e,n)||!Cn.isAcute(e,n,t)||!Cn.isAcute(n,t,e))};jn.circumcentre=function(t,e,n){var r=n.x,i=n.y,s=t.x-r,c=t.y-i,l=e.x-r,d=e.y-i,v=2*jn.det(s,c,l,d),S=jn.det(c,s*s+c*c,d,l*l+d*d),E=jn.det(s,s*s+c*c,l,l*l+d*d),C=r-S/v,M=i+E/v;return new ze(C,M)};jn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Vs(t.x+n/2,t.y+r/2,1),s=new Vs(t.x-r+n/2,t.y+n+r/2,1);return new Vs(i,s)};jn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),s=r/(r+i),c=n.x-t.x,l=n.y-t.y,d=new ze(t.x+s*c,t.y+s*l);return d};jn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,s=e.z-t.z,c=n.x-t.x,l=n.y-t.y,d=n.z-t.z,v=i*d-s*l,S=s*c-r*d,E=r*l-i*c,C=v*v+S*S+E*E,M=Math.sqrt(C)/2;return M};jn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new ze(r,i)};jn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),s=t.distance(e),c=r+i+s,l=(r*t.x+i*e.x+s*n.x)/c,d=(r*t.y+i*e.y+s*n.y)/c;return new ze(l,d)};var Ss=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new _t;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Ss.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Fe.EXTERIOR,Fe.INTERIOR)};Ss.prototype.addPolygon=function(t){var e=this,n=this._distance,r=ut.LEFT;this._distance<0&&(n=-this._distance,r=ut.RIGHT);var i=t.getExteriorRing(),s=Sn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&s.length<3)return null;this.addPolygonRing(s,n,r,Fe.EXTERIOR,Fe.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(l,-e._distance)||e.addPolygonRing(d,n,ut.opposite(r),Fe.INTERIOR,Fe.EXTERIOR)}};Ss.prototype.isTriangleErodedCompletely=function(t,e){var n=new jn(t[0],t[1],t[2]),r=n.inCentre(),i=Et.distancePointLine(r,n.p0,n.p1);return i=Ha.MINIMUM_VALID_SIZE&&Et.isCCW(t)&&(s=i,c=r,n=ut.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,s,c)};Ss.prototype.add=function(t){if(t.isEmpty())return null;t instanceof li?this.addPolygon(t):t instanceof Dr?this.addLineString(t):t instanceof Bo?this.addPoint(t):t instanceof qf?this.addCollection(t):t instanceof ec?this.addCollection(t):t instanceof Ga?this.addCollection(t):t instanceof io&&this.addCollection(t)};Ss.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};Ss.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new mp;var t=this._parent.getGeometryN(this._index++);return t instanceof io?(this._subcollectionIterator=new qa(t),this._subcollectionIterator.next()):t};qa.prototype.remove=function(){throw new Error(this.getClass().getName())};qa.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)};qa.prototype.interfaces_=function(){return[dp]};qa.prototype.getClass=function(){return qa};qa.isAtomic=function(t){return!(t instanceof io)};var ns=function(){this._geom=null;var t=arguments[0];this._geom=t};ns.prototype.locate=function(t){return ns.locate(t,this._geom)};ns.prototype.interfaces_=function(){return[Xf]};ns.prototype.getClass=function(){return ns};ns.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Et.isPointInRing(t,e.getCoordinates()):!1};ns.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!ns.isPointInRing(t,n))return!1;for(var r=0;r0&&s[s.length-1])&&(v[0]===6||v[0]===2)){n=0;continue}if(v[0]===3&&(!s||v[1]>s[0]&&v[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var l=e.right;if(e.right=l.left,l.left=e,e=l,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,s.left=e.right,e.left=r.right,e.right=r.left,e}function iv(t,e,n,r){var i=new ec(t,e);if(n===null)return i.left=i.right=null,i;n=Zu(t,n,r);var s=r(t,n.key);return s<0?(i.left=n.left,i.right=n,n.left=null):s>=0&&(i.right=n.right,i.left=n,n.right=null),i}function q2(t,e,n){var r=null,i=null;if(e){e=Zu(t,e,n);var s=n(e.key,t);s===0?(r=e.left,i=e.right):s<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function pO(t,e,n){return e===null?t:(t===null||(e=Zu(t.key,e,n),e.left=t),e)}function Wv(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` +`);var s=e+(n?" ":"│ ");t.left&&Wv(t.left,s,!1,r,i),t.right&&Wv(t.right,s,!0,r,i)}}var H1=function(){function t(e){e===void 0&&(e=fO),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=iv(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new ec(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,s=Zu(e,this._root,i),c=i(e,s.key);return c===0?this._root=s:(c<0?(r.left=s.left,r.right=s,s.left=null):c>0&&(r.right=s.right,r.left=s,s.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=Zu(e,n,r);var s=r(e,n.key);return s===0?(n.left===null?i=n.right:(i=Zu(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=Zu(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=Zu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],s=!1;!s;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):s=!0;return this},t.prototype.range=function(e,n,r,i){for(var s=[],c=this._comparator,l=this._root,d;s.length!==0||l;)if(l)s.push(l),l=l.left;else{if(l=s.pop(),d=c(l.key,n),d>0)break;if(c(l.key,e)>=0&&r.call(i,l))return this;l=l.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,s=[];!r;)if(n)s.push(n),n=n.left;else if(s.length>0){if(n=s.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var s=i(e.key,n.key);if(s===0)break;s<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var s=i(e.key,n.key);if(s===0)break;s<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return mO(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,s=this._comparator;if(r&&Xv(e,n,0,i-1,s),this._root===null)this._root=Hv(e,n,0,i),this._size=i;else{var c=gO(this.toList(),dO(e,n),s);i=this._size+i,this._root=Zv({head:c},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return Wv(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,s=q2(e,this._root,i),c=s.left,l=s.right;i(e,n)<0?l=iv(n,r,l,i):c=iv(n,r,c,i),this._root=pO(c,l,i)},t.prototype.split=function(e){return q2(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return hO(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function Hv(t,e,n,r){var i=r-n;if(i>0){var s=n+Math.floor(i/2),c=t[s],l=e[s],d=new ec(c,l);return d.left=Hv(t,e,n,s),d.right=Hv(t,e,s+1,r),d}return null}function dO(t,e){for(var n=new ec(null,null),r=n,i=0;i0?(e=s=s.next=n.pop(),e=e.right):r=!0;return s.next=null,i.next}function Zv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),s=Zv(t,e,i),c=t.head;return c.left=s,t.head=t.head.next,c.right=Zv(t,i+1,n),c}return null}function gO(t,e,n){for(var r=new ec(null,null),i=r,s=t,c=e;s!==null&&c!==null;)n(s.key,c.key)<0?(i.next=s,s=s.next):(i.next=c,c=c.next),i=i.next;return s!==null?i.next=s:c!==null&&(i.next=c),r.next}function Xv(t,e,n,r,i){if(!(n>=r)){for(var s=t[n+r>>1],c=n-1,l=r+1;;){do c++;while(i(t[c],s)<0);do l--;while(i(t[l],s)>0);if(c>=l)break;var d=t[c];t[c]=t[l],t[l]=d,d=e[c],e[c]=e[l],e[l]=d}Xv(t,e,n,l,i),Xv(t,e,l+1,r,i)}}function La(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W2(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){La(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return rs(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r=0&&E>=0?vC?-1:0:d<0&&E<0?vC?1:0:Ed?1:0}}}]),t}(),wO=0,R_=function(){rs(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,s=e.rightSE.point.x,c=n.rightSE.point.x;if(cl&&d>v)return-1;var E=e.comparePoint(n.leftSE.point);if(E<0)return 1;if(E>0)return-1;var C=n.comparePoint(e.rightSE.point);return C!==0?C:-1}if(r>i){if(ld&&l>S)return 1;var M=n.comparePoint(e.leftSE.point);if(M!==0)return M;var k=e.comparePoint(n.rightSE.point);return k<0?1:k>0?-1:1}if(ld)return 1;if(sc){var F=e.comparePoint(n.rightSE.point);if(F<0)return 1;if(F>0)return-1}if(s!==c){var U=v-l,z=s-r,G=S-d,q=c-i;if(U>z&&Gq)return-1}return s>c?1:sS?1:e.idn.id?1:0}}]);function t(e,n,r,i){La(this,t),this.id=++wO,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return rs(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e: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(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&l.swapEvents(),_l.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),s.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var s=n;n=r,r=s}if(n.prev===r){var c=n;n=r,r=c}for(var l=0,d=r.rings.length;l0)i=n,s=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var d=new _l(i,!0),v=new _l(s,!1);return new t(d,v,[r],[c])}}]),t}(),Y2=function(){function t(e,n,r){if(La(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=em.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var s=i,c=1,l=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),s=d)}(i.x!==s.x||i.y!==s.y)&&this.segments.push(R_.fromRing(s,i,this))}return rs(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=n}return rs(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=n}return rs(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n0&&(e=i)}for(var s=e.segment.prevInResult(),c=s?s.prevInResult():null;;){if(!s)return null;if(!c)return s.ringOut;if(c.ringOut!==s.ringOut)return c.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=c.prevInResult(),c=s?s.prevInResult():null}}}]),t}(),J2=function(){function t(e){La(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return rs(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:R_.compare;La(this,t),this.queue=e,this.tree=new H1(n),this.segments=[]}return rs(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)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 s=i,c=i,l=void 0,d=void 0;l===void 0;)s=this.tree.prev(s),s===null?l=null:s.key.consumedBy===void 0&&(l=s.key);for(;d===void 0;)c=this.tree.next(c),c===null?d=null:c.key.consumedBy===void 0&&(d=c.key);if(e.isLeft){var v=null;if(l){var S=l.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(v=S),!l.isAnEndpoint(S)))for(var E=this._splitSafely(l,S),C=0,M=E.length;C0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&d){var le=l.getIntersection(d);if(le!==null){if(!l.isAnEndpoint(le))for(var ye=this._splitSafely(l,le),ke=0,Q=ye.length;keQ2)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var q=new CO(k),X=k.size,de=k.pop();de;){var ae=de.key;if(k.size===X){var le=ae.segment;throw new Error("Unable to pop() ".concat(ae.isLeft?"left":"right"," SweepEvent ")+"[".concat(ae.point.x,", ").concat(ae.point.y,"] from segment #").concat(le.id," ")+"[".concat(le.leftSE.point.x,", ").concat(le.leftSE.point.y,"] -> ")+"[".concat(le.rightSE.point.x,", ").concat(le.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(k.size>Q2)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(q.segments.length>TO)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ye=q.process(ae),ke=0,Q=ye.length;ke1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};ze.prototype.clone=function(){};ze.prototype.copy=function(){return new ze(this)};ze.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};ze.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)};ze.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};ze.prototype.hashCode=function(){var t=17;return t=37*t+ze.hashCode(this.x),t=37*t+ze.hashCode(this.y),t};ze.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};ze.prototype.interfaces_=function(){return[Es,cy,Is]};ze.prototype.getClass=function(){return ze};ze.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=rn.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};hh.DimensionalComparator.get=function(){return ou};hh.serialVersionUID.get=function(){return 6683108902428367e3};hh.NULL_ORDINATE.get=function(){return rn.NaN};hh.X.get=function(){return 0};hh.Y.get=function(){return 1};hh.Z.get=function(){return 2};Object.defineProperties(ze,hh);var ou=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new br("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};ou.prototype.compare=function(t,e){var n=t,r=e,i=ou.compare(n.x,r.x);if(i!==0)return i;var s=ou.compare(n.y,r.y);if(s!==0)return s;if(this._dimensionsToTest<=2)return 0;var c=ou.compare(n.z,r.z);return c};ou.prototype.interfaces_=function(){return[zf]};ou.prototype.getClass=function(){return ou};ou.compare=function(t,e){return te?1:rn.isNaN(t)?rn.isNaN(e)?0:-1:rn.isNaN(e)?1:0};var Ff=function(){};Ff.prototype.create=function(){};Ff.prototype.interfaces_=function(){return[]};Ff.prototype.getClass=function(){return Ff};var Fe=function(){},wm={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Fe.prototype.interfaces_=function(){return[]};Fe.prototype.getClass=function(){return Fe};Fe.toLocationSymbol=function(t){switch(t){case Fe.EXTERIOR:return"e";case Fe.BOUNDARY:return"b";case Fe.INTERIOR:return"i";case Fe.NONE:return"-"}throw new br("Unknown location value: "+t)};wm.INTERIOR.get=function(){return 0};wm.BOUNDARY.get=function(){return 1};wm.EXTERIOR.get=function(){return 2};wm.NONE.get=function(){return-1};Object.defineProperties(Fe,wm);var Kt=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},is=function(){},AC={LOG_10:{configurable:!0}};is.prototype.interfaces_=function(){return[]};is.prototype.getClass=function(){return is};is.log10=function(t){var e=Math.log(t);return rn.isInfinite(e)||rn.isNaN(e)?e:e/is.LOG_10};is.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],s=arguments[2];return rs?s:r}};is.wrap=function(t,e){return t<0?e- -t%e:t%e};is.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],s=arguments[1],c=arguments[2],l=arguments[3],d=i;return s>d&&(d=s),c>d&&(d=c),l>d&&(d=l),d}};is.average=function(t,e){return(t+e)/2};AC.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(is,AC);var Pa=function(t){this.str=t};Pa.prototype.append=function(t){this.str+=t};Pa.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};Pa.prototype.toString=function(t){return this.str};var _a=function(t){this.value=t};_a.prototype.intValue=function(){return this.value};_a.prototype.compareTo=function(t){return this.valuet?1:0};_a.isNaN=function(t){return Number.isNaN(t)};var tm=function(){};tm.isWhitespace=function(t){return t<=32&&t>=0||t===127};tm.toUpperCase=function(t){return t.toUpperCase()};var $e=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i,s)}},$s={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}};$e.prototype.le=function(t){return(this._hi9?(S=!0,E="9"):E="0"+v,c.append(E),n=n.subtract($e.valueOf(v)).multiply($e.TEN),S&&n.selfAdd($e.TEN);var C=!0,M=$e.magnitude(n._hi);if(M<0&&Math.abs(M)>=l-d&&(C=!1),!C)break}return e[0]=r,c.toString()};$e.prototype.sqr=function(){return this.multiply(this)};$e.prototype.doubleValue=function(){return this._hi+this._lo};$e.prototype.subtract=function(){if(arguments[0]instanceof $e){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};$e.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};$e.prototype.isZero=function(){return this._hi===0&&this._lo===0};$e.prototype.selfSubtract=function(){if(arguments[0]instanceof $e){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};$e.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};$e.prototype.min=function(t){return this.le(t)?this:t};$e.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof $e){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,s=null,c=null,l=null,d=null,v=null,S=null,E=null;return d=this._hi/n,v=$e.SPLIT*d,i=v-d,E=$e.SPLIT*n,i=v-i,s=d-i,c=E-n,S=d*n,c=E-c,l=n-c,E=i*c-S+i*l+s*c+s*l,v=(this._hi-S-E+this._lo-d*r)/n,E=d+v,this._hi=E,this._lo=d-E+v,this}};$e.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};$e.prototype.divide=function(){if(arguments[0]instanceof $e){var t=arguments[0],e=null,n=null,r=null,i=null,s=null,c=null,l=null,d=null;s=this._hi/t._hi,c=$e.SPLIT*s,e=c-s,d=$e.SPLIT*t._hi,e=c-e,n=s-e,r=d-t._hi,l=s*t._hi,r=d-r,i=t._hi-r,d=e*r-l+e*i+n*r+n*i,c=(this._hi-l-d+this._lo-s*t._lo)/t._hi,d=s+c;var v=d,S=s-d+c;return new $e(v,S)}else if(typeof arguments[0]=="number"){var E=arguments[0];return rn.isNaN(E)?$e.createNaN():$e.copy(this).selfDivide(E,0)}};$e.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};$e.prototype.pow=function(t){if(t===0)return $e.valueOf(1);var e=new $e(this),n=$e.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(e),r/=2,r>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};$e.prototype.ceil=function(){if(this.isNaN())return $e.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new $e(t,e)};$e.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};$e.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};$e.prototype.setValue=function(){if(arguments[0]instanceof $e){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};$e.prototype.max=function(t){return this.ge(t)?this:t};$e.prototype.sqrt=function(){if(this.isZero())return $e.valueOf(0);if(this.isNegative())return $e.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=$e.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};$e.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof $e){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,s=null,c=null,l=null;return i=this._hi+e,c=i-this._hi,s=i-c,s=e-c+(this._hi-s),l=s+this._lo,n=i+l,r=l+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],v=arguments[1],S=null,E=null,C=null,M=null,k=null,R=null,F=null,U=null;k=this._hi+d,C=this._lo+v,F=k-this._hi,U=C-this._lo,R=k-F,M=C-U,R=d-F+(this._hi-R),M=v-U+(this._lo-M),F=R+C,S=k+F,E=F+(k-S),F=M+E;var z=S+F,G=F+(S-z);return this._hi=z,this._lo=G,this}};$e.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof $e){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,s=null,c=null,l=null,d=null,v=null;d=$e.SPLIT*this._hi,i=d-this._hi,v=$e.SPLIT*n,i=d-i,s=this._hi-i,c=v-n,d=this._hi*n,c=v-c,l=n-c,v=i*c-d+i*l+s*c+s*l+(this._hi*r+this._lo*n);var S=d+v;i=d-S;var E=v+i;return this._hi=S,this._lo=E,this}};$e.prototype.selfSqr=function(){return this.selfMultiply(this)};$e.prototype.floor=function(){if(this.isNaN())return $e.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new $e(t,e)};$e.prototype.negate=function(){return this.isNaN()?this:new $e(-this._hi,-this._lo)};$e.prototype.clone=function(){};$e.prototype.multiply=function(){if(arguments[0]instanceof $e){var t=arguments[0];return t.isNaN()?$e.createNaN():$e.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return rn.isNaN(e)?$e.createNaN():$e.copy(this).selfMultiply(e,0)}};$e.prototype.isNaN=function(){return rn.isNaN(this._hi)};$e.prototype.intValue=function(){return Math.trunc(this._hi)};$e.prototype.toString=function(){var t=$e.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};$e.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+$e.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var s=r-n.length,c=$e.stringOfChar("0",s);i=n+c+".0"}return this.isNegative()?"-"+i:i};$e.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,s=null,c=null,l=null;i=1/this._hi,s=$e.SPLIT*i,t=s-i,l=$e.SPLIT*this._hi,t=s-t,e=i-t,n=l-this._hi,c=i*this._hi,n=l-n,r=this._hi-n,l=t*n-c+t*r+e*n+e*r,s=(1-c-l-i*this._lo)/this._hi;var d=i+s,v=i-d+s;return new $e(d,v)};$e.prototype.toSciNotation=function(){if(this.isZero())return $e.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=$e.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var s=n.charAt(0)+"."+i;return this.isNegative()?"-"+s+r:s+r};$e.prototype.abs=function(){return this.isNaN()?$e.NaN:this.isNegative()?this.negate():new $e(this)};$e.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};$e.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};$e.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};$e.prototype.trunc=function(){return this.isNaN()?$e.NaN:this.isPositive()?this.floor():this.ceil()};$e.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};$e.prototype.interfaces_=function(){return[Is,Es,cy]};$e.prototype.getClass=function(){return $e};$e.sqr=function(t){return $e.valueOf(t).selfMultiply(t)};$e.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return $e.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new $e(e)}};$e.sqrt=function(t){return $e.valueOf(t).sqrt()};$e.parse=function(t){for(var e=0,n=t.length;tm.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var v=t.charAt(e);if(e++,tm.isDigit(v)){var S=v-"0";s.selfMultiply($e.TEN),s.selfAdd(S),c++;continue}if(v==="."){l=c;continue}if(v==="e"||v==="E"){var E=t.substring(e);try{d=_a.parseInt(E)}catch(F){throw F instanceof Error?new Error("Invalid exponent "+E+" in string "+t):F}finally{}break}throw new Error("Unexpected character '"+v+"' at position "+e+" in string "+t)}var C=s,M=c-l-d;if(M===0)C=s;else if(M>0){var k=$e.TEN.pow(M);C=s.divide(k)}else if(M<0){var R=$e.TEN.pow(-M);C=s.multiply(R)}return r?C.negate():C};$e.createNaN=function(){return new $e(rn.NaN,rn.NaN)};$e.copy=function(t){return new $e(t)};$e.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=e&&(r+=1),r};$e.stringOfChar=function(t,e){for(var n=new Pa,r=0;r0){if(s<=0)return yo.signum(c);r=i+s}else if(i<0){if(s>=0)return yo.signum(c);r=-i-s}else return yo.signum(c);var l=yo.DP_SAFE_EPSILON*r;return c>=l||-c>=l?yo.signum(c):2};yo.signum=function(t){return t>0?1:t<0?-1:0};kC.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(yo,kC);var An=function(){},Sm={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Sm.X.get=function(){return 0};Sm.Y.get=function(){return 1};Sm.Z.get=function(){return 2};Sm.M.get=function(){return 3};An.prototype.setOrdinate=function(t,e,n){};An.prototype.size=function(){};An.prototype.getOrdinate=function(t,e){};An.prototype.getCoordinate=function(){};An.prototype.getCoordinateCopy=function(t){};An.prototype.getDimension=function(){};An.prototype.getX=function(t){};An.prototype.clone=function(){};An.prototype.expandEnvelope=function(t){};An.prototype.copy=function(){};An.prototype.getY=function(t){};An.prototype.toCoordinateArray=function(){};An.prototype.interfaces_=function(){return[cy]};An.prototype.getClass=function(){return An};Object.defineProperties(An,Sm);var DC=function(){},pp=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(DC),Ni=function(){};Ni.arraycopy=function(t,e,n,r,i){for(var s=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Vt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};Vt.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};Vt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Vt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Vt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Vt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Vt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Vt.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Vt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Vt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof ze){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Vt.prototype.centre=function(){return this.isNull()?null:new ze((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Vt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof ze){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Vt){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],c=arguments[2],l=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Vt.prototype.hashCode=function(){var t=17;return t=37*t+ze.hashCode(this._minx),t=37*t+ze.hashCode(this._maxx),t=37*t+ze.hashCode(this._miny),t=37*t+ze.hashCode(this._maxy),t};Vt.prototype.interfaces_=function(){return[Es,Is]};Vt.prototype.getClass=function(){return Vt};Vt.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],s=arguments[2],c=arguments[3],l=Math.min(s.x,c.x),d=Math.max(s.x,c.x),v=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(v>d||Sd)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};Ir.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};Ir.prototype.setPrecisionModel=function(t){this._precisionModel=t};Ir.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ni?s=r:s=i;else{var c=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y);r>i?s=c:s=l,s===0&&!t.equals(e)&&(s=Math.max(c,l))}return fn.isTrue(!(s===0&&!t.equals(e)),"Bad distance calculation"),s};Ir.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,s=Math.sqrt(r*r+i*i);return fn.isTrue(!(s===0&&!t.equals(e)),"Invalid distance calculation"),s};fh.DONT_INTERSECT.get=function(){return 0};fh.DO_INTERSECT.get=function(){return 1};fh.COLLINEAR.get=function(){return 2};fh.NO_INTERSECTION.get=function(){return 0};fh.POINT_INTERSECTION.get=function(){return 1};fh.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(Ir,fh);var pc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new Vt(this._inputLines[0][0],this._inputLines[0][1]),i=new Vt(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Vt.intersects(r,i,n)&&Et.orientationIndex(r,i,n)===0&&Et.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,s,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,s.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,s.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,s.x-=c.x,s.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,s){var c=null;try{c=Vs.intersection(n,r,i,s)}catch(l){if(l instanceof pp)c=e.nearestEndpoint(n,r,i,s);else throw l}finally{}return c},e.prototype.intersection=function(n,r,i,s){var c=this.intersectionWithNormalization(n,r,i,s);return this.isInSegmentEnvelopes(c)||(c=new ze(e.nearestEndpoint(n,r,i,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c},e.prototype.smallestInAbsValue=function(n,r,i,s){var c=n,l=Math.abs(c);return Math.abs(r)1e-4&&Ni.out.println("Distance = "+c.distance(l))},e.prototype.intersectionWithNormalization=function(n,r,i,s){var c=new ze(n),l=new ze(r),d=new ze(i),v=new ze(s),S=new ze;this.normalizeToEnvCentre(c,l,d,v,S);var E=this.safeHCoordinateIntersection(c,l,d,v);return E.x+=S.x,E.y+=S.y,E},e.prototype.computeCollinearIntersection=function(n,r,i,s){var c=Vt.intersects(n,r,i),l=Vt.intersects(n,r,s),d=Vt.intersects(i,s,n),v=Vt.intersects(i,s,r);return c&&l?(this._intPt[0]=i,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):d&&v?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&d?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!l&&!v?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&v?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!l&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&d?(this._intPt[0]=s,this._intPt[1]=n,s.equals(n)&&!c&&!v?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&v?(this._intPt[0]=s,this._intPt[1]=r,s.equals(r)&&!c&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,s,c){var l=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,E=i.xs.x?i.x:s.x,k=i.y>s.y?i.y:s.y,R=l>E?l:E,F=vC?d:C,z=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var d=Et.orientationIndex(i,s,n),v=Et.orientationIndex(i,s,r);if(d>0&&v>0||d<0&&v<0)return t.NO_INTERSECTION;var S=c===0&&l===0&&d===0&&v===0;return S?this.computeCollinearIntersection(n,r,i,s):(c===0||l===0||d===0||v===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(s)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(s)?this._intPt[0]=r:c===0?this._intPt[0]=new ze(i):l===0?this._intPt[0]=new ze(s):d===0?this._intPt[0]=new ze(n):v===0&&(this._intPt[0]=new ze(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,s)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,s){var c=n,l=Et.distancePointLine(n,i,s),d=Et.distancePointLine(r,i,s);return d0?n>0?-i:i:n>0?i:-i;if(e===0||n===0)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,s=t,t=n,n=s,s=e,e=r,r=s):e<=-r?(i=-i,n=-n,r=-r):(s=t,t=-n,n=s,s=e,e=-r,r=s):r>0?-e<=r?(i=-i,t=-t,e=-e):(s=-t,t=n,n=s,s=-e,e=r,r=s):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,s=-t,t=-n,n=s,s=-e,e=-r,r=s),t>0)if(n>0){if(!(t<=n))return i}else return i;else{if(n>0)return-i;if(t>=n)i=-i,t=-t,n=-n;else return-i}for(;;){if(c=Math.floor(n/t),n=n-c*t,r=r-c*e,r<0)return-i;if(r>e)return i;if(t>n+n){if(er+r)return-i;n=t-n,r=e-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(c=Math.floor(t/n),t=t-c*n,e=e-c*r,e<0))return i;if(e>r)return-i;if(n>t+t){if(re+e)return i;t=n-t,e=r-e,i=-i}if(e===0)return t===0?0:i;if(t===0)return-i}};var da=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};da.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,s=t.y-this._p.y,c=e.x-this._p.x,l=e.y-this._p.y,d=Yc.signOfDet2x2(i,s,c,l);if(d===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};da.prototype.isPointInPolygon=function(){return this.getLocation()!==Fe.EXTERIOR};da.prototype.getLocation=function(){return this._isPointOnSegment?Fe.BOUNDARY:this._crossingCount%2===1?Fe.INTERIOR:Fe.EXTERIOR};da.prototype.isOnSegment=function(){return this._isPointOnSegment};da.prototype.interfaces_=function(){return[]};da.prototype.getClass=function(){return da};da.locatePointInRing=function(){if(arguments[0]instanceof ze&&Kt(arguments[1],An)){for(var t=arguments[0],e=arguments[1],n=new da(t),r=new ze,i=new ze,s=1;s1||d<0||d>1)&&(i=!0)}}return i?is.min(Et.distancePointLine(t,n,r),Et.distancePointLine(e,n,r),Et.distancePointLine(n,t,e),Et.distancePointLine(r,t,e)):0};Et.isPointInRing=function(t,e){return Et.locatePointInRing(t,e)!==Fe.EXTERIOR};Et.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new ze;t.getCoordinate(0,r);for(var i=r.x,s=r.y,c=1;cn.y&&(n=s,r=i)}var c=r;do c=c-1,c<0&&(c=e);while(t[c].equals2D(n)&&c!==r);var l=r;do l=(l+1)%e;while(t[l].equals2D(n)&&l!==r);var d=t[c],v=t[l];if(d.equals2D(n)||v.equals2D(n)||d.equals2D(v))return!1;var S=Et.computeOrientation(d,n,v),E=!1;return S===0?E=d.x>v.x:E=S>0,E};Et.locatePointInRing=function(t,e){return da.locatePointInRing(t,e)};Et.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};Et.computeOrientation=function(t,e,n){return Et.orientationIndex(t,e,n)};Et.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new br("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return s.distance(l);var S=((c.y-s.y)*(l.x-c.x)-(c.x-s.x)*(l.y-c.y))/d;return Math.abs(S)*Math.sqrt(d)}};Et.isOnLine=function(t,e){for(var n=new pc,r=1;r0};Vf.prototype.interfaces_=function(){return[xs]};Vf.prototype.getClass=function(){return Vf};var Uf=function(){};Uf.prototype.isInBoundary=function(t){return t>1};Uf.prototype.interfaces_=function(){return[xs]};Uf.prototype.getClass=function(){return Uf};var jf=function(){};jf.prototype.isInBoundary=function(t){return t===1};jf.prototype.interfaces_=function(){return[xs]};jf.prototype.getClass=function(){return jf};var ni=function(){};ni.prototype.add=function(){};ni.prototype.addAll=function(){};ni.prototype.isEmpty=function(){};ni.prototype.iterator=function(){};ni.prototype.size=function(){};ni.prototype.toArray=function(){};ni.prototype.remove=function(){};function X1(t){this.message=t||""}X1.prototype=new Error;X1.prototype.name="IndexOutOfBoundsException";var dp=function(){};dp.prototype.hasNext=function(){};dp.prototype.next=function(){};dp.prototype.remove=function(){};var Us=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(ni);function mp(t){this.message=t||""}mp.prototype=new Error;mp.prototype.name="NoSuchElementException";var _t=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof ni&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,ni]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},e.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},e.prototype.iterator=function(){return new FO(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new X1;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],i=0,s=this.array_.length;i=1){var v=this.get(this.size()-1);if(v.equals2D(l))return null}t.prototype.add.call(this,l)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],E=arguments[1];return this.add(S,E),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var C=arguments[0],M=arguments[1],k=arguments[2];if(k)for(var R=0;R=0;F--)r.add(C[F],M);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof ze){var U=arguments[0],z=arguments[1],G=arguments[2];if(!G){var q=this.size();if(q>0){if(U>0){var X=this.get(U-1);if(X.equals2D(z))return null}if(Uke&&(Q=-1);for(var oe=ye;oe!==ke;oe+=Q)r.add(ae[oe],le);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ze(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(_t),Sn=function(){},fy={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};fy.ForwardComparator.get=function(){return nm};fy.BidirectionalComparator.get=function(){return Gf};fy.coordArrayType.get=function(){return new Array(0).fill(null)};Sn.prototype.interfaces_=function(){return[]};Sn.prototype.getClass=function(){return Sn};Sn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};Sn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};Sn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};Sn.extract=function(t,e,n){e=is.clamp(e,0,t.length),n=is.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=Sn.compare(n,r),s=Sn.isEqualReversed(n,r);return s?0:i};Gf.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=Sn.increasingDirection(n),s=Sn.increasingDirection(r),c=i>0?0:n.length-1,l=s>0?0:n.length-1,d=0;d0)e=e.right;else return e.value}return null};qi.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:yl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var s=n.value;return n.value=e,s}while(n!==null);var c={key:t,left:null,right:null,value:e,parent:r,color:yl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};qi.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Gu;t!=null&&t!==this.root_&&t.parent.color===Gu;)if(nr(t)===ov(nr(nr(t)))){var n=rS(nr(nr(t)));nS(n)===Gu?(dl(nr(t),yl),dl(n,yl),dl(nr(nr(t)),Gu),t=nr(nr(t))):(t===rS(nr(t))&&(t=nr(t),e.rotateLeft(t)),dl(nr(t),yl),dl(nr(nr(t)),Gu),e.rotateRight(nr(nr(t))))}else{var r=ov(nr(nr(t)));nS(r)===Gu?(dl(nr(t),yl),dl(r,yl),dl(nr(nr(t)),Gu),t=nr(nr(t))):(t===ov(nr(t))&&(t=nr(t),e.rotateRight(t)),dl(nr(t),yl),dl(nr(nr(t)),Gu),e.rotateLeft(nr(nr(t))))}this.root_.color=yl};qi.prototype.values=function(){var t=new _t,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=qi.successor(e))!==null;)t.add(e.value);return t};qi.prototype.entrySet=function(){var t=new $1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=qi.successor(e))!==null;)t.add(e);return t};qi.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};qi.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};qi.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};qi.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};qi.prototype.size=function(){return this.size_};var rm=function(){};rm.prototype.interfaces_=function(){return[]};rm.prototype.getClass=function(){return rm};function NC(){}NC.prototype=new py;function ya(){this.array_=[],arguments[0]instanceof ni&&this.addAll(arguments[0])}ya.prototype=new NC;ya.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var c=i.substring(0,s);r.add(c),i=i.substring(s+n),s=i.indexOf(e)}i.length>0&&r.add(i);for(var l=new Array(r.size()).fill(null),d=0;d0)for(var s=i;s0&&r.append(" ");for(var s=0;s0&&r.append(","),r.append(vs.toString(t.getOrdinate(i,s)))}return r.append(")"),r.toString()}};jr.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return jr.createClosedRing(t,e,4);var r=e.getOrdinate(0,An.X)===e.getOrdinate(n-1,An.X)&&e.getOrdinate(0,An.Y)===e.getOrdinate(n-1,An.Y);return r?e:jr.createClosedRing(t,e,n+1)};jr.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();jr.copy(e,0,r,0,i);for(var s=i;s0&&jr.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Bn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Et.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();jr.reverse(r);var i=this.getFactory().createLineString(r);return i},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],s=i,c=0,l=0;c= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=this,s=0;s=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Dr),Ga=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Yt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,s=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};sm.prototype.interfaces_=function(){return[ws.GeometryEditorOperation]};sm.prototype.getClass=function(){return sm};var am=function(){};am.prototype.edit=function(t,e){return t instanceof Ha?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Dr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Bo?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};am.prototype.interfaces_=function(){return[ws.GeometryEditorOperation]};am.prototype.getClass=function(){return am};var Vr=function(){var t=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 e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new Pa(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Vr(n):new Vr(n,r)}};Za.prototype.interfaces_=function(){return[Ff,Is]};Za.prototype.getClass=function(){return Za};Za.instance=function(){return Za.instanceObject};K1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};K1.instanceObject.get=function(){return new Za};Object.defineProperties(Za,K1);var zC=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new _t,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new $1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(dh),Un=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ba){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},J1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Un.prototype.equals=function(t){if(!(t instanceof Un))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Un.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new _a(n).compareTo(new _a(r))};Un.prototype.getScale=function(){return this._scale};Un.prototype.isFloating=function(){return this._modelType===Un.FLOATING||this._modelType===Un.FLOATING_SINGLE};Un.prototype.getType=function(){return this._modelType};Un.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Un.FLOATING?t="Floating":this._modelType===Un.FLOATING_SINGLE?t="Floating-Single":this._modelType===Un.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Un.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(rn.isNaN(t))return t;if(this._modelType===Un.FLOATING_SINGLE){var e=t;return e}return this._modelType===Un.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof ze){var n=arguments[0];if(this._modelType===Un.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Un.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Un.FLOATING?t=16:this._modelType===Un.FLOATING_SINGLE?t=6:this._modelType===Un.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Un.prototype.setScale=function(t){this._scale=Math.abs(t)};Un.prototype.interfaces_=function(){return[Is,Es]};Un.prototype.getClass=function(){return Un};Un.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};J1.serialVersionUID.get=function(){return 7777263578777804e3};J1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Un,J1);var ba=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Q1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ba.prototype.readResolve=function(){return ba.nameToTypeMap.get(this._name)};ba.prototype.toString=function(){return this._name};ba.prototype.interfaces_=function(){return[Is]};ba.prototype.getClass=function(){return ba};Q1.serialVersionUID.get=function(){return-552860263173159e4};Q1.nameToTypeMap.get=function(){return new zC};Object.defineProperties(ba,Q1);Un.Type=ba;Un.FIXED=new ba("FIXED");Un.FLOATING=new ba("FLOATING");Un.FLOATING_SINGLE=new ba("FLOATING SINGLE");var wn=function t(){this._precisionModel=new Un,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Kt(arguments[0],Ff)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Un&&(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]))},FC={serialVersionUID:{configurable:!0}};wn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new ze(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new ze(t.getMinX(),t.getMinY()),new ze(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new ze(t.getMinX(),t.getMinY()),new ze(t.getMinX(),t.getMaxY()),new ze(t.getMaxX(),t.getMaxY()),new ze(t.getMaxX(),t.getMinY()),new ze(t.getMinX(),t.getMinY())]),null)};wn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Dr(this.getCoordinateSequenceFactory().create(t),this);if(Kt(t,An))return new Dr(t,this)}else return new Dr(this.getCoordinateSequenceFactory().create([]),this)};wn.prototype.createMultiLineString=function(){if(arguments.length===0)return new tc(null,this);if(arguments.length===1){var t=arguments[0];return new tc(t,this)}};wn.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var s=i.next(),c=s.getClass();e===null&&(e=c),c!==e&&(n=!0),s.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(wn.toGeometryArray(t));var l=t.iterator().next(),d=t.size()>1;if(d){if(l instanceof ui)return this.createMultiPolygon(wn.toPolygonArray(t));if(l instanceof Dr)return this.createMultiLineString(wn.toLineStringArray(t));if(l instanceof Bo)return this.createMultiPoint(wn.toPointArray(t));fn.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};wn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};wn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof ze){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Kt(arguments[0],An)){var e=arguments[0];return new Bo(e,this)}}};wn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};wn.prototype.createPolygon=function(){if(arguments.length===0)return new ui(null,null,this);if(arguments.length===1){if(Kt(arguments[0],An)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Ha){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new ui(r,i,this)}};wn.prototype.getSRID=function(){return this._SRID};wn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new io(null,this);if(arguments.length===1){var t=arguments[0];return new io(t,this)}};wn.prototype.createGeometry=function(t){var e=new ws(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};wn.prototype.getPrecisionModel=function(){return this._precisionModel};wn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Kt(arguments[0],An)){var e=arguments[0];return new Ha(e,this)}}};wn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Ga(null,this);if(arguments.length===1){var t=arguments[0];return new Ga(t,this)}};wn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new qf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new qf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Kt(arguments[0],An)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),s=0;s=this.size())throw new Error;return this.array_[t]};Ma.prototype.push=function(t){return this.array_.push(t),t};Ma.prototype.pop=function(t){if(this.array_.length===0)throw new yy;return this.array_.pop()};Ma.prototype.peek=function(){if(this.array_.length===0)throw new yy;return this.array_[this.array_.length-1]};Ma.prototype.empty=function(){return this.array_.length===0};Ma.prototype.isEmpty=function(){return this.empty()};Ma.prototype.search=function(t){return this.array_.indexOf(t)};Ma.prototype.size=function(){return this.array_.length};Ma.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===Et.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};xa.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var i=ut.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};xa.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};xa.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}fn.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 i=this.getRightmostSide(this._minDe,this._minIndex);i===ut.LEFT&&(this._orientedDe=this._minDe.getSym())};xa.prototype.interfaces_=function(){return[]};xa.prototype.getClass=function(){return xa};var Pl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new ze(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(Tl),vy=function(){this.array_=[]};vy.prototype.addLast=function(t){this.array_.push(t)};vy.prototype.removeFirst=function(){return this.array_.shift()};vy.prototype.isEmpty=function(){return this.array_.length===0};var oo=function(){this._finder=null,this._dirEdgeList=new _t,this._nodes=new _t,this._rightMostCoord=null,this._env=null,this._finder=new xa};oo.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};oo.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};oo.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new Pl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var s=t.getEdges().iterator();s.hasNext();){var c=s.next();c.setVisited(!0),e.copySymDepths(c)}};oo.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ut.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};oo.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};oo.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ut.RIGHT)>=1&&e.getDepth(ut.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};oo.prototype.computeDepths=function(t){var e=this,n=new $1,r=new vy,i=t.getNode();for(r.addLast(i),n.add(i),t.setVisited(!0);!r.isEmpty();){var s=r.removeFirst();n.add(s),e.computeNodeDepth(s);for(var c=s.getEdges().iterator();c.hasNext();){var l=c.next(),d=l.getSym();if(!d.isVisited()){var v=d.getNode();n.contains(v)||(r.addLast(v),n.add(v))}}}};oo.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};oo.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Vt,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ut.ON]=this.location[ut.ON],n[ut.LEFT]=Fe.NONE,n[ut.RIGHT]=Fe.NONE,this.location=n}for(var r=0;r1&&t.append(Fe.toLocationSymbol(this.location[ut.LEFT])),t.append(Fe.toLocationSymbol(this.location[ut.ON])),this.location.length>1&&t.append(Fe.toLocationSymbol(this.location[ut.RIGHT])),t.toString()};rr.prototype.setLocations=function(t,e,n){this.location[ut.ON]=t,this.location[ut.LEFT]=e,this.location[ut.RIGHT]=n};rr.prototype.get=function(t){return t1};rr.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};Yr.prototype.addPoints=function(t,e,n){var r=this,i=t.getCoordinates();if(e){var s=1;n&&(s=0);for(var c=s;c=0;d--)r._pts.add(i[d])}};Yr.prototype.isHole=function(){return this._isHole};Yr.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Yr.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!Et.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};Yr.prototype.addHole=function(t){this._holes.add(t)};Yr.prototype.isShell=function(){return this._shell===null};Yr.prototype.getLabel=function(){return this._label};Yr.prototype.getEdges=function(){return this._edges};Yr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Yr.prototype.getShell=function(){return this._shell};Yr.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,ut.RIGHT);if(r===Fe.NONE)return null;if(this._label.getLocation(n)===Fe.NONE)return this._label.setLocation(n,r),null}};Yr.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Yr.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};os.prototype.isInResult=function(){return this._isInResult};os.prototype.isVisited=function(){return this._isVisited};os.prototype.interfaces_=function(){return[]};os.prototype.getClass=function(){return os};var by=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Wn(0,Fe.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var i=Fe.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var s=n.getLocation(r);i!==Fe.BOUNDARY&&(i=s)}return i},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Wn(n,r):this._label.setLocation(n,r)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Wn)for(var i=arguments[0],s=0;s<2;s++){var c=n.computeMergedLocation(i,s),l=n._label.getLocation(s);l===Fe.NONE&&n._label.setLocation(s,c)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=Fe.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Fe.BOUNDARY:i=Fe.INTERIOR;break;case Fe.INTERIOR:i=Fe.BOUNDARY;break;default:i=Fe.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(os),wa=function(){this.nodeMap=new qi,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};wa.prototype.find=function(t){return this.nodeMap.get(t)};wa.prototype.addNode=function(){if(arguments[0]instanceof ze){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof by){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};wa.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};wa.prototype.iterator=function(){return this.nodeMap.values().iterator()};wa.prototype.values=function(){return this.nodeMap.values()};wa.prototype.getBoundaryNodes=function(t){for(var e=new _t,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Fe.BOUNDARY&&e.add(r)}return e};wa.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};wa.prototype.interfaces_=function(){return[]};wa.prototype.getClass=function(){return wa};var Zn=function(){},Cm={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Zn.prototype.interfaces_=function(){return[]};Zn.prototype.getClass=function(){return Zn};Zn.isNorthern=function(t){return t===Zn.NE||t===Zn.NW};Zn.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Zn.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var r=te?t:e;return r===0&&i===3?3:r};Zn.isInHalfPlane=function(t,e){return e===Zn.SE?t===Zn.SE||t===Zn.SW:t===e||t===e+1};Zn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new br("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Zn.NE:Zn.SE:e>=0?Zn.NW:Zn.SW}else if(arguments[0]instanceof ze&&arguments[1]instanceof ze){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new br("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Zn.NE:Zn.SE:r.y>=n.y?Zn.NW:Zn.SW}};Cm.NE.get=function(){return 0};Cm.NW.get=function(){return 1};Cm.SW.get=function(){return 2};Cm.SE.get=function(){return 3};Object.defineProperties(Zn,Cm);var Wi=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 t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var s=arguments[0],c=arguments[1],l=arguments[2],d=arguments[3];this._edge=s,this.init(c,l),this._label=d}};Wi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var l=c.buildMinimalRings(),d=r.findShell(l);d!==null?(r.placePolygonHoles(d,l),e.add(d)):n.addAll(l)}else i.add(c)}return i};Vo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Vo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new _t,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var s=new $O(i,e._geometryFactory);n.add(s),s.setInResult()}}return n};Vo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Vo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Vo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),s=null,c=null,l=e.iterator();l.hasNext();){var d=l.next(),v=d.getLinearRing(),S=v.getEnvelopeInternal();s!==null&&(c=s.getLinearRing().getEnvelopeInternal());var E=!1;S.contains(r)&&Et.isPointInRing(i,v.getCoordinates())&&(E=!0),E&&(s===null||c.contains(S))&&(s=d)}return s};Vo.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return fn.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Vo.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];Cr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new _t,s=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(s,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Vo.prototype.interfaces_=function(){return[]};Vo.prototype.getClass=function(){return Vo};var Hf=function(){};Hf.prototype.getBounds=function(){};Hf.prototype.interfaces_=function(){return[]};Hf.prototype.getClass=function(){return Hf};var qs=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};qs.prototype.getItem=function(){return this._item};qs.prototype.getBounds=function(){return this._bounds};qs.prototype.interfaces_=function(){return[Hf,Is]};qs.prototype.getClass=function(){return qs};var Ml=function(){this._size=null,this._items=null,this._size=0,this._items=new _t,this._items.add(null)};Ml.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};Ml.prototype.size=function(){return this._size};Ml.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)};Ml.prototype.clear=function(){this._size=0,this._items.clear()};Ml.prototype.isEmpty=function(){return this._size===0};Ml.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)};Ml.prototype.interfaces_=function(){return[]};Ml.prototype.getClass=function(){return Ml};var fu=function(){};fu.prototype.visitItem=function(t){};fu.prototype.interfaces_=function(){return[]};fu.prototype.getClass=function(){return fu};var Kc=function(){};Kc.prototype.insert=function(t,e){};Kc.prototype.remove=function(t,e){};Kc.prototype.query=function(){};Kc.prototype.interfaces_=function(){return[]};Kc.prototype.getClass=function(){return Kc};var oi=function(){if(this._childBoundables=new _t,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},VC={serialVersionUID:{configurable:!0}};oi.prototype.getLevel=function(){return this._level};oi.prototype.size=function(){return this._childBoundables.size()};oi.prototype.getChildBoundables=function(){return this._childBoundables};oi.prototype.addChildBoundable=function(t){fn.isTrue(this._bounds===null),this._childBoundables.add(t)};oi.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};oi.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};oi.prototype.interfaces_=function(){return[Hf,Is]};oi.prototype.getClass=function(){return oi};VC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(oi,VC);var Ws=function(){};Ws.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ws.min=function(t){return Ws.sort(t),t.get(0)};Ws.sort=function(t,e){var n=t.toArray();e?Ku.sort(n,e):Ku.sort(n);for(var r=t.iterator(),i=0,s=n.length;iZr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new br("neither boundable is composite")};Zr.prototype.isLeaves=function(){return!(Zr.isComposite(this._boundable1)||Zr.isComposite(this._boundable2))};Zr.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Zr.prototype.expand=function(t,e,n,r){for(var i=this,s=t.getChildBoundables(),c=s.iterator();c.hasNext();){var l=c.next(),d=new Zr(l,e,i._itemDistance);d.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},xy={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ci.prototype.getNodeCapacity=function(){return this._nodeCapacity};Ci.prototype.lastNode=function(t){return t.get(t.size()-1)};Ci.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof oi?n+=t.size(i):i instanceof qs&&(n+=1)}return n}};Ci.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof qs&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};Ci.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new _t:e}else if(arguments.length===1){for(var n=arguments[0],r=new _t,i=n.getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof oi){var c=t.itemsTree(s);c!==null&&r.add(c)}else s instanceof qs?r.add(s.getItem()):fn.shouldNeverReachHere()}return r.size()<=0?null:r}};Ci.prototype.insert=function(t,e){fn.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new qs(t,e))};Ci.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new _t;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];if(fn.isTrue(r>-2),i.getLevel()===r)return s.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var l=c.next();l instanceof oi?t.boundablesAtLevel(r,l,s):(fn.isTrue(l instanceof qs),r===-1&&s.add(l))}return null}};Ci.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new _t;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Kt(arguments[2],fu)&&arguments[0]instanceof Object&&arguments[1]instanceof oi)for(var s=arguments[0],c=arguments[1],l=arguments[2],d=c.getChildBoundables(),v=0;vn&&(n=s)}}return n+1}};Ci.prototype.createParentBoundables=function(t,e){var n=this;fn.isTrue(!t.isEmpty());var r=new _t;r.add(this.createNode(e));var i=new _t(t);Ws.sort(i,this.getComparator());for(var s=i.iterator();s.hasNext();){var c=s.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};Ci.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Ci.prototype.interfaces_=function(){return[Is]};Ci.prototype.getClass=function(){return Ci};Ci.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new _t,l=0;l0;){var k=M.poll(),R=k.getDistance();if(R>=E)break;k.isLeaves()?(E=R,C=k):k.expandToQueue(M,E)}return[C.getBoundable(0).getItem(),C.getBoundable(1).getItem()]}}else if(arguments.length===3){var F=arguments[0],U=arguments[1],z=arguments[2],G=new qs(F,U),q=new Zr(this.getRoot(),G,z);return this.nearestNeighbour(q)[0]}},e.prototype.interfaces_=function(){return[Kc,Is]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return iS},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[zf]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[zf]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Ci),iS=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Vt(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(oi),_o=function(){};_o.prototype.interfaces_=function(){return[]};_o.prototype.getClass=function(){return _o};_o.relativeSign=function(t,e){return te?1:0};_o.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=_o.relativeSign(e.x,n.x),i=_o.relativeSign(e.y,n.y);switch(t){case 0:return _o.compareValue(r,i);case 1:return _o.compareValue(i,r);case 2:return _o.compareValue(i,-r);case 3:return _o.compareValue(-r,i);case 4:return _o.compareValue(-r,-i);case 5:return _o.compareValue(-i,-r);case 6:return _o.compareValue(-i,r);case 7:return _o.compareValue(r,-i)}return fn.shouldNeverReachHere("invalid octant value"),0};_o.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var pu=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new ze(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};pu.prototype.getCoordinate=function(){return this.coord};pu.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};pu.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:_o.compare(this._segmentOctant,this.coord,e.coord)};pu.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};pu.prototype.isInterior=function(){return this._isInterior};pu.prototype.interfaces_=function(){return[Es]};pu.prototype.getClass=function(){return pu};var so=function(){this._nodeMap=new qi,this._edge=null;var t=arguments[0];this._edge=t};so.prototype.getSplitCoordinates=function(){var t=this,e=new Em;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();t.addEdgeCoordinates(r,i,e),r=i}return e.toCoordinateArray()};so.prototype.addCollapsedNodes=function(){var t=this,e=new _t;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};so.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};so.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof ze&&arguments[1]instanceof ze){var i=arguments[0],s=arguments[1],c=s.x-i.x,l=s.y-i.y;if(c===0&&l===0)throw new br("Cannot compute the octant for two identical points "+i);return Jc.octant(c,l)}};var Xa=function(){};Xa.prototype.getCoordinates=function(){};Xa.prototype.size=function(){};Xa.prototype.getCoordinate=function(t){};Xa.prototype.isClosed=function(){};Xa.prototype.setData=function(t){};Xa.prototype.getData=function(){};Xa.prototype.interfaces_=function(){return[]};Xa.prototype.getClass=function(){return Xa};var lm=function(){};lm.prototype.addIntersection=function(t,e){};lm.prototype.interfaces_=function(){return[Xa]};lm.prototype.getClass=function(){return lm};var Gr=function(){this._nodeList=new so(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Gr.prototype.getCoordinates=function(){return this._pts};Gr.prototype.size=function(){return this._pts.length};Gr.prototype.getCoordinate=function(t){return this._pts[t]};Gr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Gr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};Gr.prototype.setData=function(t){this._data=t};Gr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Jc.octant(t,e)};Gr.prototype.getData=function(){return this._data};Gr.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],s=new ze(n.getIntersection(i));this.addIntersection(s,r)}};Gr.prototype.toString=function(){return js.toLineString(new Vr(this._pts))};Gr.prototype.getNodeList=function(){return this._nodeList};Gr.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof ze){var r=arguments[0];return Et.orientationIndex(this.p0,this.p1,r)}};jt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};jt.prototype.isVertical=function(){return this.p0.x===this.p1.x};jt.prototype.equals=function(t){if(!(t instanceof jt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};jt.prototype.intersection=function(t){var e=new pc;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};jt.prototype.project=function(){if(arguments[0]instanceof ze){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new ze(t);var e=this.projectionFactor(t),n=new ze;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof jt){var r=arguments[0],i=this.projectionFactor(r.p0),s=this.projectionFactor(r.p1);if(i>=1&&s>=1||i<=0&&s<=0)return null;var c=this.project(r.p0);i<0&&(c=this.p0),i>1&&(c=this.p1);var l=this.project(r.p1);return s<0&&(l=this.p0),s>1&&(l=this.p1),new jt(c,l)}};jt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};jt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};jt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};jt.prototype.distancePerpendicular=function(t){return Et.distancePointLinePerpendicular(t,this.p0,this.p1)};jt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};jt.prototype.midPoint=function(){return jt.midPoint(this.p0,this.p1)};jt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return rn.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};jt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=rn.MAX_VALUE,i=null,s=this.closestPoint(t.p0);r=s.distance(t.p0),n[0]=s,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||rn.isNaN(e))&&(e=1),e};jt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};jt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};jt.prototype.distance=function(){if(arguments[0]instanceof jt){var t=arguments[0];return Et.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof ze){var e=arguments[0];return Et.distancePointLine(e,this.p0,this.p1)}};jt.prototype.pointAlong=function(t){var e=new ze;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};jt.prototype.hashCode=function(){var t=rn.doubleToLongBits(this.p0.x);t^=rn.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=rn.doubleToLongBits(this.p1.x);n^=rn.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};jt.prototype.interfaces_=function(){return[Es,Is]};jt.prototype.getClass=function(){return jt};jt.midPoint=function(t,e){return new ze((t.x+e.x)/2,(t.y+e.y)/2)};jC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(jt,jC);var um=function(){this.tempEnv1=new Vt,this.tempEnv2=new Vt,this._overlapSeg1=new jt,this._overlapSeg2=new jt};um.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};um.prototype.interfaces_=function(){return[]};um.prototype.getClass=function(){return um};var Uo=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Uo.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Uo.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],s=this._pts[n];if(r.tempEnv1.init(i,s),n-e===1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var c=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=Zn.quadrant(t[n],t[n+1]),i=e+1;ic.getId()&&(c.computeOverlaps(v,i),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return oS},Object.defineProperties(e,n),e}(cm),oS=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],s=arguments[3],c=n.getContext(),l=i.getContext();this._si.processIntersections(c,r,l,s)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(um),Vn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],c=arguments[2],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(s),this.setJoinStyle(c),this.setMitreLimit(l)}}},Ol={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}};Vn.prototype.getEndCapStyle=function(){return this._endCapStyle};Vn.prototype.isSingleSided=function(){return this._isSingleSided};Vn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Vn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Vn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Vn.JOIN_ROUND&&(this._quadrantSegments=Vn.DEFAULT_QUADRANT_SEGMENTS)};Vn.prototype.getJoinStyle=function(){return this._joinStyle};Vn.prototype.setJoinStyle=function(t){this._joinStyle=t};Vn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Vn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Vn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Vn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Vn.prototype.getMitreLimit=function(){return this._mitreLimit};Vn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Vn.prototype.setSingleSided=function(t){this._isSingleSided=t};Vn.prototype.interfaces_=function(){return[]};Vn.prototype.getClass=function(){return Vn};Vn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Ol.CAP_ROUND.get=function(){return 1};Ol.CAP_FLAT.get=function(){return 2};Ol.CAP_SQUARE.get=function(){return 3};Ol.JOIN_ROUND.get=function(){return 1};Ol.JOIN_MITRE.get=function(){return 2};Ol.JOIN_BEVEL.get=function(){return 3};Ol.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Ol.DEFAULT_MITRE_LIMIT.get=function(){return 5};Ol.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Vn,Ol);var Rr=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Et.COUNTERCLOCKWISE,this._inputLine=t||null},Tm={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Rr.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],s=this._inputLine[e],c=this._inputLine[n];return!this.isConcave(i,s,c)||!this.isShallow(i,s,c,r)?!1:this.isShallowSampled(i,s,t,n,r)};Rr.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};ss.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=Cn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Cn.PI_TIMES_2;return t};Cn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}};Cn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,s=n.x-e.x,c=n.y-e.y,l=r*s+i*c;return l>0};Cn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,s=n.x-e.x,c=n.y-e.y,l=r*s+i*c;return l<0};Cn.interiorAngle=function(t,e,n){var r=Cn.angle(e,t),i=Cn.angle(e,n);return Math.abs(i-r)};Cn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Cn.PI_TIMES_2;t>=Cn.PI_TIMES_2&&(t=0)}else{for(;t>=Cn.PI_TIMES_2;)t-=Cn.PI_TIMES_2;t<0&&(t=0)}return t};Cn.angleBetween=function(t,e,n){var r=Cn.angle(e,t),i=Cn.angle(e,n);return Cn.diff(r,i)};Cn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Cn.toRadians=function(t){return t*Math.PI/180};Cn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Cn.COUNTERCLOCKWISE:n<0?Cn.CLOCKWISE:Cn.NONE};Cn.angleBetweenOriented=function(t,e,n){var r=Cn.angle(e,t),i=Cn.angle(e,n),s=i-r;return s<=-Math.PI?s+Cn.PI_TIMES_2:s>Math.PI?s-Cn.PI_TIMES_2:s};mh.PI_TIMES_2.get=function(){return 2*Math.PI};mh.PI_OVER_2.get=function(){return Math.PI/2};mh.PI_OVER_4.get=function(){return Math.PI/4};mh.COUNTERCLOCKWISE.get=function(){return Et.COUNTERCLOCKWISE};mh.CLOCKWISE.get=function(){return Et.CLOCKWISE};mh.NONE.get=function(){return Et.COLLINEAR};Object.defineProperties(Cn,mh);var cr=function t(){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 jt,this._seg1=new jt,this._offset0=new jt,this._offset1=new jt,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new pc,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Vn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Lm={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}};cr.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,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=Et.computeOrientation(this._s0,this._s1,this._s2),r=n===Et.CLOCKWISE&&this._side===ut.LEFT||n===Et.COUNTERCLOCKWISE&&this._side===ut.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};cr.prototype.addLineEndCap=function(t,e){var n=new jt(t,e),r=new jt;this.computeOffsetSegment(n,ut.LEFT,this._distance,r);var i=new jt;this.computeOffsetSegment(n,ut.RIGHT,this._distance,i);var s=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,s);switch(this._bufParams.getEndCapStyle()){case Vn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,Et.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Vn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Vn.CAP_SQUARE:var d=new ze;d.x=Math.abs(this._distance)*Math.cos(l),d.y=Math.abs(this._distance)*Math.sin(l);var v=new ze(r.p1.x+d.x,r.p1.y+d.y),S=new ze(i.p1.x+d.x,i.p1.y+d.y);this._segList.addPt(v),this._segList.addPt(S);break}};cr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};cr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,s=null;try{s=Vs.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:s.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(l){if(l instanceof pp)s=new ze(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(s):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};cr.prototype.addFilletCorner=function(t,e,n,r,i){var s=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,s),d=n.x-t.x,v=n.y-t.y,S=Math.atan2(v,d);r===Et.CLOCKWISE?l<=S&&(l+=2*Math.PI):l>=S&&(l-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,l,S,r,i),this._segList.addPt(n)};cr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new ze((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 r=new ze((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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};cr.prototype.createCircle=function(t){var e=new ze(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};cr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};cr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ss,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*cr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};cr.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===Vn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Vn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Et.CLOCKWISE,this._distance))};cr.prototype.closeRing=function(){this._segList.closeRing()};cr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};cr.prototype.interfaces_=function(){return[]};cr.prototype.getClass=function(){return cr};Lm.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Lm.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Lm.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Lm.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(cr,Lm);var bo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};bo.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var s=i.getCoordinates();return n&&Sn.reverse(s),s};bo.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Rr.simplify(t,-r),s=i.length-1;n.initSideSegments(i[s],i[s-1],ut.LEFT),n.addFirstSegment();for(var c=s-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var l=Rr.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],ut.LEFT),n.addFirstSegment();for(var v=2;v<=d;v++)n.addNextSegment(l[v],!0)}n.addLastSegment(),n.closeRing()};bo.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===ut.RIGHT&&(r=-r);var i=Rr.simplify(t,r),s=i.length-1;n.initSideSegments(i[s-1],i[0],e);for(var c=1;c<=s;c++){var l=c!==1;n.addNextSegment(i[c],l)}n.closeRing()};bo.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Rr.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],ut.LEFT);for(var s=2;s<=i;s++)e.addNextSegment(r[s],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=Rr.simplify(t,-n),l=c.length-1;e.initSideSegments(c[l],c[l-1],ut.LEFT);for(var d=l-2;d>=0;d--)e.addNextSegment(c[d],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};bo.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Vn.CAP_ROUND:e.createCircle(t);break;case Vn.CAP_SQUARE:e.createSquare(t);break}};bo.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);var s=r.getCoordinates();return s};bo.prototype.getBufferParameters=function(){return this._bufParams};bo.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};bo.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return bo.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};bo.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Rr.simplify(t,-r),s=i.length-1;n.initSideSegments(i[s],i[s-1],ut.LEFT),n.addFirstSegment();for(var c=s-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var l=Rr.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],ut.LEFT),n.addFirstSegment();for(var v=2;v<=d;v++)n.addNextSegment(l[v],!0)}n.addLastSegment()};bo.prototype.getSegGen=function(t){return new cr(this._precisionModel,this._bufParams,t)};bo.prototype.interfaces_=function(){return[]};bo.prototype.getClass=function(){return bo};bo.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;ns.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Kt(arguments[2],Us)&&arguments[0]instanceof ze&&arguments[1]instanceof Qv)for(var c=arguments[0],l=arguments[1],d=arguments[2],v=l.getEdge().getCoordinates(),S=0;St._seg.p1.y&&t._seg.reverse();var E=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Et._seg.p1.y)&&Et.computeOrientation(t._seg.p0,t._seg.p1,c)!==Et.RIGHT){var C=l.getDepth(ut.LEFT);t._seg.p0.equals(v[S])||(C=l.getDepth(ut.RIGHT));var M=new rc(t._seg,C);d.add(M)}}else if(Kt(arguments[2],Us)&&arguments[0]instanceof ze&&Kt(arguments[1],Us))for(var k=arguments[0],R=arguments[1],F=arguments[2],U=R.iterator();U.hasNext();){var z=U.next();z.isForward()&&t.findStabbedSegments(k,z,F)}}};Qc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ws.min(e);return n._leftDepth};Qc.prototype.interfaces_=function(){return[]};Qc.prototype.getClass=function(){return Qc};qC.DepthSegment.get=function(){return rc};Object.defineProperties(Qc,qC);var rc=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new jt(t),this._leftDepth=e};rc.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};rc.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};rc.prototype.toString=function(){return this._upwardSeg.toString()};rc.prototype.interfaces_=function(){return[Es]};rc.prototype.getClass=function(){return rc};var jn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};jn.prototype.area=function(){return jn.area(this.p0,this.p1,this.p2)};jn.prototype.signedArea=function(){return jn.signedArea(this.p0,this.p1,this.p2)};jn.prototype.interpolateZ=function(t){if(t===null)throw new br("Supplied point is null.");return jn.interpolateZ(t,this.p0,this.p1,this.p2)};jn.prototype.longestSideLength=function(){return jn.longestSideLength(this.p0,this.p1,this.p2)};jn.prototype.isAcute=function(){return jn.isAcute(this.p0,this.p1,this.p2)};jn.prototype.circumcentre=function(){return jn.circumcentre(this.p0,this.p1,this.p2)};jn.prototype.area3D=function(){return jn.area3D(this.p0,this.p1,this.p2)};jn.prototype.centroid=function(){return jn.centroid(this.p0,this.p1,this.p2)};jn.prototype.inCentre=function(){return jn.inCentre(this.p0,this.p1,this.p2)};jn.prototype.interfaces_=function(){return[]};jn.prototype.getClass=function(){return jn};jn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)};jn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};jn.det=function(t,e,n,r){return t*r-e*n};jn.interpolateZ=function(t,e,n,r){var i=e.x,s=e.y,c=n.x-i,l=r.x-i,d=n.y-s,v=r.y-s,S=c*v-l*d,E=t.x-i,C=t.y-s,M=(v*E-l*C)/S,k=(-d*E+c*C)/S,R=e.z+M*(n.z-e.z)+k*(r.z-e.z);return R};jn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),s=n.distance(t),c=r;return i>c&&(c=i),s>c&&(c=s),c};jn.isAcute=function(t,e,n){return!(!Cn.isAcute(t,e,n)||!Cn.isAcute(e,n,t)||!Cn.isAcute(n,t,e))};jn.circumcentre=function(t,e,n){var r=n.x,i=n.y,s=t.x-r,c=t.y-i,l=e.x-r,d=e.y-i,v=2*jn.det(s,c,l,d),S=jn.det(c,s*s+c*c,d,l*l+d*d),E=jn.det(s,s*s+c*c,l,l*l+d*d),C=r-S/v,M=i+E/v;return new ze(C,M)};jn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Vs(t.x+n/2,t.y+r/2,1),s=new Vs(t.x-r+n/2,t.y+n+r/2,1);return new Vs(i,s)};jn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),s=r/(r+i),c=n.x-t.x,l=n.y-t.y,d=new ze(t.x+s*c,t.y+s*l);return d};jn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,s=e.z-t.z,c=n.x-t.x,l=n.y-t.y,d=n.z-t.z,v=i*d-s*l,S=s*c-r*d,E=r*l-i*c,C=v*v+S*S+E*E,M=Math.sqrt(C)/2;return M};jn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new ze(r,i)};jn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),s=t.distance(e),c=r+i+s,l=(r*t.x+i*e.x+s*n.x)/c,d=(r*t.y+i*e.y+s*n.y)/c;return new ze(l,d)};var Ss=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new _t;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Ss.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Fe.EXTERIOR,Fe.INTERIOR)};Ss.prototype.addPolygon=function(t){var e=this,n=this._distance,r=ut.LEFT;this._distance<0&&(n=-this._distance,r=ut.RIGHT);var i=t.getExteriorRing(),s=Sn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&s.length<3)return null;this.addPolygonRing(s,n,r,Fe.EXTERIOR,Fe.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(l,-e._distance)||e.addPolygonRing(d,n,ut.opposite(r),Fe.INTERIOR,Fe.EXTERIOR)}};Ss.prototype.isTriangleErodedCompletely=function(t,e){var n=new jn(t[0],t[1],t[2]),r=n.inCentre(),i=Et.distancePointLine(r,n.p0,n.p1);return i=Ha.MINIMUM_VALID_SIZE&&Et.isCCW(t)&&(s=i,c=r,n=ut.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,s,c)};Ss.prototype.add=function(t){if(t.isEmpty())return null;t instanceof ui?this.addPolygon(t):t instanceof Dr?this.addLineString(t):t instanceof Bo?this.addPoint(t):t instanceof qf?this.addCollection(t):t instanceof tc?this.addCollection(t):t instanceof Ga?this.addCollection(t):t instanceof io&&this.addCollection(t)};Ss.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};Ss.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new mp;var t=this._parent.getGeometryN(this._index++);return t instanceof io?(this._subcollectionIterator=new qa(t),this._subcollectionIterator.next()):t};qa.prototype.remove=function(){throw new Error(this.getClass().getName())};qa.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)};qa.prototype.interfaces_=function(){return[dp]};qa.prototype.getClass=function(){return qa};qa.isAtomic=function(t){return!(t instanceof io)};var ns=function(){this._geom=null;var t=arguments[0];this._geom=t};ns.prototype.locate=function(t){return ns.locate(t,this._geom)};ns.prototype.interfaces_=function(){return[Xf]};ns.prototype.getClass=function(){return ns};ns.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Et.isPointInRing(t,e.getCoordinates()):!1};ns.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!ns.isPointInRing(t,n))return!1;for(var r=0;r=0;s--){var c=n._edgeList.get(s),l=c.getSym();i===null&&(i=l),r!==null&&l.setNext(r),r=c}i.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),s=r.getDepth(ut.LEFT),c=r.getDepth(ut.RIGHT),l=this.computeDepths(i+1,this._edgeList.size(),s),d=this.computeDepths(0,i,l);if(d!==c)throw new Pl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var v=arguments[0],S=arguments[1],E=arguments[2],C=E,M=v;M=0;l--){var d=r._resultAreaEdgeList.get(l),v=d.getSym();switch(i===null&&d.getEdgeRing()===n&&(i=d),c){case r._SCANNING_FOR_INCOMING:if(v.getEdgeRing()!==n)continue;s=v,c=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(d.getEdgeRing()!==n)continue;s.setNextMin(d),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(fn.isTrue(i!==null,"found null for first outgoing dirEdge"),fn.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),s.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var s=arguments[0],c=0,l=this.iterator();l.hasNext();){var d=l.next();d.getEdgeRing()===s&&c++}return c}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Fe.NONE,r=this.iterator();r.hasNext();){var i=r.next(),s=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Fe.INTERIOR;break}if(s.isInResult()){n=Fe.EXTERIOR;break}}}if(n===Fe.NONE)return null;for(var c=n,l=this.iterator();l.hasNext();){var d=l.next(),v=d.getSym();d.isLineEdge()?d.getEdge().setCovered(c===Fe.INTERIOR):(d.isInResult()&&(c=Fe.EXTERIOR),v.isInResult()&&(c=Fe.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new Wn(Fe.NONE);for(var i=this.iterator();i.hasNext();)for(var s=i.next(),c=s.getEdge(),l=c.getLabel(),d=0;d<2;d++){var v=l.getLocation(d);(v===Fe.INTERIOR||v===Fe.BOUNDARY)&&r._label.setLocation(d,Fe.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Hi),WC=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new by(n,new KO)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Wf),pu=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};pu.prototype.compareTo=function(t){var e=t,n=pu.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};pu.prototype.interfaces_=function(){return[Es]};pu.prototype.getClass=function(){return pu};pu.orientation=function(t){return Sn.increasingDirection(t)===1};pu.compareOriented=function(t,e,n,r){for(var i=e?1:-1,s=r?1:-1,c=e?t.length:-1,l=r?n.length:-1,d=e?0:t.length-1,v=r?0:n.length-1;;){var S=t[d].compareTo(n[v]);if(S!==0)return S;d+=i,v+=s;var E=d===c,C=v===l;if(E&&!C)return-1;if(!E&&C)return 1;if(E&&C)return 0}};var Hs=function(){this._edges=new _t,this._ocaMap=new qi};Hs.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),s=0;s0&&t.print(","),t.print(i[s].x+" "+i[s].y);t.println(")")}t.print(") ")};Hs.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};Hs.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);s||r--;var c=new Array(r).fill(null),l=0;c[l++]=new ze(t.coord);for(var d=t.segmentIndex+1;d<=e.segmentIndex;d++)c[l++]=n.edge.pts[d];return s&&(c[l]=e.coord),new F_(c,new Wn(this.edge._label))};$a.prototype.add=function(t,e,n){var r=new Sa(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};$a.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};$a.prototype.interfaces_=function(){return[]};$a.prototype.getClass=function(){return $a};var ic=function(){};ic.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new _t;r.add(new _a(n));do{var i=e.findChainEnd(t,n);r.add(new _a(i)),n=i}while(nn?e:n};Al.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ri.prototype.getDelta=function(t){return this._depth[t][ut.RIGHT]-this._depth[t][ut.LEFT]};Ri.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Fe.EXTERIOR:Fe.INTERIOR};Ri.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ri.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===Fe.EXTERIOR||i===Fe.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ri.depthAtLocation(i):t._depth[n][r]+=Ri.depthAtLocation(i))}else if(arguments.length===3){var s=arguments[0],c=arguments[1],l=arguments[2];l===Fe.INTERIOR&&this._depth[s][c]++}};Ri.prototype.interfaces_=function(){return[]};Ri.prototype.getClass=function(){return Ri};Ri.depthAtLocation=function(t){return t===Fe.EXTERIOR?0:t===Fe.INTERIOR?1:Ri.NULL_VALUE};HC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ri,HC);var F_=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new $a(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ri,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,Wn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var s=!0,c=!0,l=this.pts.length,d=0;d0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Al(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Vt;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxys;if(c)return!1;var l=this.intersectsToleranceSquare(t,e);return fn.isTrue(!(c&&l),"Found bad envelope test"),l};xo.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ze(this._maxx,this._maxy),this._corner[1]=new ze(this._minx,this._maxy),this._corner[2]=new ze(this._minx,this._miny),this._corner[3]=new ze(this._maxx,this._miny)};xo.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};xo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};xo.prototype.getCoordinate=function(){return this._originalPt};xo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};xo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=xo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Vt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};xo.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};xo.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||t.equals(this._pt)||e.equals(this._pt))};xo.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return this.intersects(n,r)?(t.addIntersection(this.getCoordinate(),e),!0):!1};xo.prototype.interfaces_=function(){return[]};xo.prototype.getClass=function(){return xo};XC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(xo,XC);var hm=function(){this.tempEnv1=new Vt,this.selectedSegment=new jt};hm.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};hm.prototype.interfaces_=function(){return[]};hm.prototype.getClass=function(){return hm};var $f=function(){this._index=null;var t=arguments[0];this._index=t},$C={HotPixelSnapAction:{configurable:!0}};$f.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),s=new YC(e,n,r);return this._index.query(i,{interfaces_:function(){return[hu]},visitItem:function(c){var l=c;l.select(i,s)}}),s.isNodeAdded()}};$f.prototype.interfaces_=function(){return[]};$f.prototype.getClass=function(){return $f};$C.HotPixelSnapAction.get=function(){return YC};Object.defineProperties($f,$C);var YC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(hm),eh=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new _t};eh.prototype.processIntersections=function(t,e,n,r){var i=this;if(t===n&&e===r)return null;var s=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];if(this._li.computeIntersection(s,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var v=0;v=0;e--){try{t.bufferReducedPrecision(e)}catch(s){if(s instanceof Pl)t._saveException=s;else throw s}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=Di.precisionScaleFactor(this._argGeom,this._distance,n),i=new Un(r);this.bufferFixedPrecision(i)}};Di.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Un.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Di.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Di.prototype.bufferOriginalPrecision=function(){try{var t=new no(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof Tl)this._saveException=e;else throw e}finally{}};Di.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Di.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Di.prototype.interfaces_=function(){return[]};Di.prototype.getClass=function(){return Di};Di.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Di(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Yt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1],c=arguments[2],l=new Di(i);l.setQuadrantSegments(c);var d=l.getResultGeometry(s);return d}else if(arguments[2]instanceof Vn&&arguments[0]instanceof Yt&&typeof arguments[1]=="number"){var v=arguments[0],S=arguments[1],E=arguments[2],C=new Di(v,E),M=C.getResultGeometry(S);return M}}else if(arguments.length===4){var k=arguments[0],R=arguments[1],N=arguments[2],B=arguments[3],F=new Di(k);F.setQuadrantSegments(N),F.setEndCapStyle(B);var G=F.getResultGeometry(R);return G}};Di.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=is.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),s=e>0?e:0,c=i+2*s,l=Math.trunc(Math.log(c)/Math.log(10)+1),d=n-l,v=Math.pow(10,d);return v};gp.CAP_ROUND.get=function(){return Vn.CAP_ROUND};gp.CAP_BUTT.get=function(){return Vn.CAP_FLAT};gp.CAP_FLAT.get=function(){return Vn.CAP_FLAT};gp.CAP_SQUARE.get=function(){return Vn.CAP_SQUARE};gp.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Di,gp);var Qi=function(){this._pt=[new ze,new ze],this._distance=rn.NaN,this._isNull=!0};Qi.prototype.getCoordinates=function(){return this._pt};Qi.prototype.getCoordinate=function(t){return this._pt[t]};Qi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};Qi.prototype.interfaces_=function(){return[]};Qi.prototype.getClass=function(){return Qi};var Va=function(){};Va.prototype.interfaces_=function(){return[]};Va.prototype.getClass=function(){return Va};Va.computeDistance=function(){if(arguments[2]instanceof Qi&&arguments[0]instanceof Dr&&arguments[1]instanceof ze)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new jt,s=0;s0||this._isIn?Fe.INTERIOR:Fe.EXTERIOR)};Zs.prototype.interfaces_=function(){return[]};Zs.prototype.getClass=function(){return Zs};var eo=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._component=r,this._segIndex=i,this._pt=s}},KC={INSIDE_AREA:{configurable:!0}};eo.prototype.isInsideArea=function(){return this._segIndex===eo.INSIDE_AREA};eo.prototype.getCoordinate=function(){return this._pt};eo.prototype.getGeometryComponent=function(){return this._component};eo.prototype.getSegmentIndex=function(){return this._segIndex};eo.prototype.interfaces_=function(){return[]};eo.prototype.getClass=function(){return eo};KC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(eo,KC);var au=function(t){this._pts=t||null};au.prototype.filter=function(t){t instanceof Bo&&this._pts.add(t)};au.prototype.interfaces_=function(){return[va]};au.prototype.getClass=function(){return au};au.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Bo?Ws.singletonList(t):au.getPoints(t,new _t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Bo?n.add(e):e instanceof io&&e.apply(new au(n)),n}};var nh=function(){this._locations=null;var t=arguments[0];this._locations=t};nh.prototype.filter=function(t){(t instanceof Bo||t instanceof Dr||t instanceof li)&&this._locations.add(new eo(t,0,t.getCoordinate()))};nh.prototype.interfaces_=function(){return[va]};nh.prototype.getClass=function(){return nh};nh.getLocations=function(t){var e=new _t;return t.apply(new nh(e)),e};var Oi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Zs,this._minDistanceLocation=null,this._minDistance=rn.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Oi.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,s=Sl.getPolygons(this._geom[n]);if(s.size()>0){var c=nh.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,s,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Kt(arguments[0],Us)&&Kt(arguments[1],Us)){for(var l=arguments[0],d=arguments[1],v=arguments[2],S=0;Sthis._minDistance)return null;for(var i=e.getCoordinates(),s=n.getCoordinate(),c=0;cthis._minDistance)return null;for(var M=S.getCoordinates(),k=E.getCoordinates(),R=0;Rthis._distance&&this.initialize(e,n,r)}};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};var ca=function(){};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};ca.computeDistance=function(){if(arguments[2]instanceof ji&&arguments[0]instanceof Dr&&arguments[1]instanceof ze)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new jt,i=t.getCoordinates(),s=0;s1||t<=0)throw new br("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};bs.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};bs.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};bs.prototype.computeOrientedDistance=function(t,e,n){var r=new rh(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new gu(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};bs.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};bs.prototype.interfaces_=function(){return[]};bs.prototype.getClass=function(){return bs};bs.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new bs(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2],c=new bs(r,i);return c.setDensifyFraction(s),c.distance()}};rb.MaxPointDistanceFilter.get=function(){return rh};rb.MaxDensifiedByFractionDistanceFilter.get=function(){return gu};Object.defineProperties(bs,rb);var rh=function(){this._maxPtDist=new ji,this._minPtDist=new ji,this._euclideanDist=new ca,this._geom=null;var t=arguments[0];this._geom=t};rh.prototype.filter=function(t){this._minPtDist.initialize(),ca.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};rh.prototype.getMaxPointDistance=function(){return this._maxPtDist};rh.prototype.interfaces_=function(){return[Wa]};rh.prototype.getClass=function(){return rh};var gu=function(){this._maxPtDist=new ji,this._minPtDist=new ji,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};gu.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),s=(i.x-r.x)/this._numSubSegs,c=(i.y-r.y)/this._numSubSegs,l=0;ln){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+js.toLineString(i[0],i[1])+")"}};Oo.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Oo.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Oo.VERBOSE&&Ni.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Oo.prototype.checkNegativeValid=function(){if(!(this._input instanceof li||this._input instanceof Ga||this._input instanceof io))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};Oo.prototype.getErrorIndicator=function(){return this._errorIndicator};Oo.prototype.checkMinimumDistance=function(t,e,n){var r=new Oi(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=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")};zi.prototype.report=function(t){if(!zi.VERBOSE)return null;Ni.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};zi.prototype.getErrorMessage=function(){return this._errorMsg};zi.prototype.interfaces_=function(){return[]};zi.prototype.getClass=function(){return zi};zi.isValidMsg=function(t,e,n){var r=new zi(t,e,n);return r.isValid()?null:r.getErrorMessage()};zi.isValid=function(t,e,n){var r=new zi(t,e,n);return!!r.isValid()};ob.VERBOSE.get=function(){return!1};ob.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(zi,ob);var Ia=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ia.prototype.getCoordinates=function(){return this._pts};Ia.prototype.size=function(){return this._pts.length};Ia.prototype.getCoordinate=function(t){return this._pts[t]};Ia.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ia.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Jc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};Ia.prototype.setData=function(t){this._data=t};Ia.prototype.getData=function(){return this._data};Ia.prototype.toString=function(){return js.toLineString(new Vr(this._pts))};Ia.prototype.interfaces_=function(){return[Xa]};Ia.prototype.getClass=function(){return Ia};var Ti=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new _t,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Ti.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Ti.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};Ti.prototype.getIntersectionSegments=function(){return this._intSegments};Ti.prototype.count=function(){return this._intersectionCount};Ti.prototype.getIntersections=function(){return this._intersections};Ti.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ti.prototype.setKeepIntersections=function(t){this._keepIntersections=t};Ti.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(t,e)||this.isEndSegment(n,r);if(!i)return null}var s=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];this._li.computeIntersection(s,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=c,this._intSegments[2]=l,this._intSegments[3]=d,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};Ti.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};Ti.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Ti.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Ti.prototype.interfaces_=function(){return[rc]};Ti.prototype.getClass=function(){return Ti};Ti.createAllIntersectionsFinder=function(t){var e=new Ti(t);return e.setFindAllIntersections(!0),e};Ti.createAnyIntersectionFinder=function(t){return new Ti(t)};Ti.createIntersectionCounter=function(t){var e=new Ti(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Xs=function(){this._li=new pc,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Xs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Xs.prototype.getIntersections=function(){return this._segInt.getIntersections()};Xs.prototype.isValid=function(){return this.execute(),this._isValid};Xs.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Xs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Ti(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new tb;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Xs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Pl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Xs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+js.toLineString(t[0],t[1])+" and "+js.toLineString(t[2],t[3])};Xs.prototype.interfaces_=function(){return[]};Xs.prototype.getClass=function(){return Xs};Xs.computeIntersections=function(t){var e=new Xs(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var sc=function t(){this._nv=null;var e=arguments[0];this._nv=new Xs(t.toSegmentStrings(e))};sc.prototype.checkValid=function(){this._nv.checkValid()};sc.prototype.interfaces_=function(){return[]};sc.prototype.getClass=function(){return sc};sc.toSegmentStrings=function(t){for(var e=new _t,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Ia(r.getCoordinates(),r))}return e};sc.checkValid=function(t){var e=new sc(t);e.checkValid()};var ih=function(t){this._mapOp=t};ih.prototype.map=function(t){for(var e=this,n=new _t,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};wo.prototype.interfaces_=function(){return[]};wo.prototype.getClass=function(){return wo};var Ka=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new jt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Dr&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Ka.prototype.snapVertices=function(t,e){for(var n=this,r=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(c+1,new ze(s),!1)}};Ka.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=rn.MAX_VALUE,i=-1,s=0;se&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return Math.min(Ur.computeOverlaySnapTolerance(i),Ur.computeOverlaySnapTolerance(s))}};Ur.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Ur.SNAP_PRECISION_FACTOR;return r};Ur.snapToSelf=function(t,e,n){var r=new Ur(t);return r.snapToSelf(e,n)};JC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Ur,JC);var QC=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var i=new Ka(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),s=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(s)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wo),Ji=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Ji.prototype.getCommon=function(){return rn.longBitsToDouble(this._commonBits)};Ji.prototype.add=function(t){var e=rn.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Ji.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Ji.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Ji.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Ji.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Ji.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=rn.longBitsToDouble(t),n=rn.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),s=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return s}};Ji.prototype.interfaces_=function(){return[]};Ji.prototype.getClass=function(){return Ji};Ji.getBit=function(t,e){var n=1<>52};Ji.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Ji.getBit(t,r)!==Ji.getBit(e,r))return n;n++}return 52};var _u=function(){this._commonCoord=null,this._ccFilter=new sh},sb={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};_u.prototype.addCommonBits=function(t){var e=new yu(this._commonCoord);t.apply(e),t.geometryChanged()};_u.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new ze(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new yu(e);return t.apply(n),t.geometryChanged(),t};_u.prototype.getCommonCoordinate=function(){return this._commonCoord};_u.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};_u.prototype.interfaces_=function(){return[]};_u.prototype.getClass=function(){return _u};sb.CommonCoordinateFilter.get=function(){return sh};sb.Translater.get=function(){return yu};Object.defineProperties(_u,sb);var sh=function(){this._commonBitsX=new Ji,this._commonBitsY=new Ji};sh.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};sh.prototype.getCommonCoordinate=function(){return new ze(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};sh.prototype.interfaces_=function(){return[Wa]};sh.prototype.getClass=function(){return sh};var yu=function(){this.trans=null;var t=arguments[0];this.trans=t};yu.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)};yu.prototype.isDone=function(){return!1};yu.prototype.isGeometryChanged=function(){return!0};yu.prototype.interfaces_=function(){return[Gs]};yu.prototype.getClass=function(){return yu};var Li=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Li.prototype.selfSnap=function(t){var e=new Ur(t),n=e.snapTo(t,this._snapTolerance);return n};Li.prototype.removeCommonBits=function(t){this._cbr=new _u,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};Li.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};Li.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=ln.overlayOp(e[0],e[1],t);return this.prepareResult(n)};Li.prototype.checkValid=function(t){t.isValid()||Ni.out.println("Snapped geometry is invalid")};Li.prototype.computeSnapTolerance=function(){this._snapTolerance=Ur.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};Li.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Ur.snap(e[0],e[1],this._snapTolerance);return n};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.overlayOp=function(t,e,n){var r=new Li(t,e);return r.getResultGeometry(n)};Li.union=function(t,e){return Li.overlayOp(t,e,ln.UNION)};Li.intersection=function(t,e){return Li.overlayOp(t,e,ln.INTERSECTION)};Li.symDifference=function(t,e){return Li.overlayOp(t,e,ln.SYMDIFFERENCE)};Li.difference=function(t,e){return Li.overlayOp(t,e,ln.DIFFERENCE)};var ao=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};ao.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=ln.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(s){if(s instanceof Tl)r=s;else throw s}finally{}if(!n)try{e=Li.overlayOp(this._geom[0],this._geom[1],t)}catch(s){throw s instanceof Tl?r:s}finally{}return e};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};ao.overlayOp=function(t,e,n){var r=new ao(t,e);return r.getResultGeometry(n)};ao.union=function(t,e){return ao.overlayOp(t,e,ln.UNION)};ao.intersection=function(t,e){return ao.overlayOp(t,e,ln.INTERSECTION)};ao.symDifference=function(t,e){return ao.overlayOp(t,e,ln.SYMDIFFERENCE)};ao.difference=function(t,e){return ao.overlayOp(t,e,ln.DIFFERENCE)};var fm=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};fm.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};fm.prototype.interfaces_=function(){return[]};fm.prototype.getClass=function(){return fm};var jo=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=s}},ab={INSERT:{configurable:!0},DELETE:{configurable:!0}};jo.prototype.isDelete=function(){return this._eventType===jo.DELETE};jo.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};jo.prototype.getObject=function(){return this._obj};jo.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};jo.prototype.getInsertEvent=function(){return this._insertEvent};jo.prototype.isInsert=function(){return this._eventType===jo.INSERT};jo.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};jo.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};jo.prototype.interfaces_=function(){return[Es]};jo.prototype.getClass=function(){return jo};ab.INSERT.get=function(){return 1};ab.DELETE.get=function(){return 2};Object.defineProperties(jo,ab);var B_=function(){};B_.prototype.interfaces_=function(){return[]};B_.prototype.getClass=function(){return B_};var Fi=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 t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};Fi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Fi.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Fi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Fi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Fi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Fi.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Fi.prototype.hasProperIntersection=function(){return this._hasProper};Fi.prototype.hasIntersection=function(){return this._hasIntersection};Fi.prototype.isDone=function(){return this._isDone};Fi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Fi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Fi.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],s=t.getCoordinates()[e+1],c=n.getCoordinates()[r],l=n.getCoordinates()[r+1];this._li.computeIntersection(i,s,c,l),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,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))))};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};Fi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var JO=function(t){function e(){t.call(this),this.events=new _t,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;Ws.sort(this.events);for(var r=0;re||this._maxs?1:0};pm.prototype.interfaces_=function(){return[zf]};pm.prototype.getClass=function(){return pm};var QO=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ja),e5=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ja),Qa=function(){this._leaves=new _t,this._root=null,this._level=0};Qa.prototype.buildTree=function(){var t=this;Ws.sort(this._leaves,new Ja.NodeComparator);for(var e=this._leaves,n=null,r=new _t;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};Qa.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new QO(t,e,n))};Qa.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};Qa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Qa.prototype.printNode=function(t){Ni.out.println(js.toLineString(new ze(t._min,this._level),new ze(t._max,this._level)))};Qa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Qa.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,s=n.iterator();s.hasNext();){var c=s.next();r[i++]=c.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===Fe.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},e.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var s=Sn.removeRepeatedPoints(n.getCoordinates());if(s.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var c=r,l=i;Et.isCCW(s)&&(c=i,l=r);var d=new F_(s,new Wn(this._argIndex,Fe.BOUNDARY,c,l));this._lineEdgeMap.put(n,d),this.insertEdge(d),this.insertPoint(this._argIndex,s[0],Fe.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var s=this._nodes.addNode(r),c=s.getLabel();c===null?s._label=new Wn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new JO},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var s=i.next(),c=s.getLabel().getLocation(n),l=s.eiList.iterator();l.hasNext();){var d=l.next();r.addSelfIntersectionNode(n,d.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ga&&(this._useBoundaryDeterminationRule=!1),n instanceof li)this.addPolygon(n);else if(n instanceof Dr)this.addLineString(n);else if(n instanceof Bo)this.addPoint(n);else if(n instanceof qf)this.addCollection(n);else if(n instanceof ec)this.addCollection(n);else if(n instanceof Ga)this.addCollection(n);else if(n instanceof io)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Kf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?Fe.BOUNDARY:Fe.INTERIOR},e}(Cr),Qf=function(){if(this._li=new pc,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Sd(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=xs.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sd(0,e,r),this._arg[1]=new Sd(1,n,r)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],c=arguments[2];i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sd(0,i,c),this._arg[1]=new Sd(1,s,c)}};Qf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Qf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Qf.prototype.interfaces_=function(){return[]};Qf.prototype.getClass=function(){return Qf};var Ku=function(){};Ku.prototype.interfaces_=function(){return[]};Ku.prototype.getClass=function(){return Ku};Ku.map=function(){if(arguments[0]instanceof Yt&&Kt(arguments[1],Ku.MapOp)){for(var t=arguments[0],e=arguments[1],n=new _t,r=0;r=t.size()?null:t.get(e)};Xr.union=function(t){var e=new Xr(t);return e.union()};nT.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Xr,nT);var V_=function(){};V_.prototype.interfaces_=function(){return[]};V_.prototype.getClass=function(){return V_};V_.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ln.createEmptyResult(ln.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ao.overlayOp(t,e,ln.UNION)};function dc(){return new U_}function U_(){this.reset()}U_.prototype={constructor:U_,reset:function(){this.s=this.t=0},add:function(t){sS(Ug,t,this.t),sS(this,Ug.s,this.s),this.s?this.t+=Ug.t:this.s=Ug.t},valueOf:function(){return this.s}};var Ug=new U_;function sS(t,e,n){var r=t.s=e+n,i=r-e,s=r-i;t.t=e-s+(n-i)}var Ar=1e-6,Kn=Math.PI,wl=Kn/2,aS=Kn/4,kl=Kn*2,Gu=180/Kn,la=Kn/180,to=Math.abs,t5=Math.atan,tp=Math.atan2,ni=Math.cos,ri=Math.sin,_p=Math.sqrt;function rT(t){return t>1?0:t<-1?Kn:Math.acos(t)}function ah(t){return t>1?wl:t<-1?-wl:Math.asin(t)}function Rd(){}function j_(t,e){t&&uS.hasOwnProperty(t.type)&&uS[t.type](t,e)}var lS={Feature:function(t,e){j_(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rKn?t-kl:t<-Kn?t+kl:t,e]}r1.invert=r1;function r5(t,e,n){return(t%=kl)?e||n?iT(fS(t),pS(e,n)):fS(t):e||n?pS(e,n):r1}function hS(t){return function(e,n){return e+=t,[e>Kn?e-kl:e<-Kn?e+kl:e,n]}}function fS(t){var e=hS(t);return e.invert=hS(-t),e}function pS(t,e){var n=ni(t),r=ri(t),i=ni(e),s=ri(e);function c(l,d){var v=ni(d),S=ni(l)*v,E=ri(l)*v,C=ri(d),M=C*n+S*r;return[tp(E*i-M*s,S*n-C*r),ah(M*i+E*s)]}return c.invert=function(l,d){var v=ni(d),S=ni(l)*v,E=ri(l)*v,C=ri(d),M=C*i-E*s;return[tp(E*i+C*s,S*n+M*r),ah(M*n-S*r)]},c}function i5(t,e,n,r,i,s){if(n){var c=ni(e),l=ri(e),d=r*n;i==null?(i=e+r*kl,s=e-d/2):(i=dS(c,i),s=dS(c,s),(r>0?is)&&(i+=r*kl));for(var v,S=i;r>0?S>s:S1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function o5(t,e,n,r,i,s){var c=t[0],l=t[1],d=e[0],v=e[1],S=0,E=1,C=d-c,M=v-l,k;if(k=n-c,!(!C&&k>0)){if(k/=C,C<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=i-c,!(!C&&k<0)){if(k/=C,C<0){if(k>E)return;k>S&&(S=k)}else if(C>0){if(k0)){if(k/=M,M<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=s-l,!(!M&&k<0)){if(k/=M,M<0){if(k>E)return;k>S&&(S=k)}else if(M>0){if(k0&&(t[0]=c+S*C,t[1]=l+S*M),E<1&&(e[0]=c+E*C,e[1]=l+E*M),!0}}}}}function a_(t,e){return to(t[0]-e[0])=0;--l)i.point((E=S[l])[0],E[1]);else r(C.x,C.p.x,-1,i);C=C.p}C=C.o,S=C.z,M=!M}while(!C.v);i.lineEnd()}}}function mS(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function s5(t){return t.length===1&&(t=a5(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[s],n)<0?r=s+1:i=s}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[s],n)>0?i=s:r=s+1}return r}}}function a5(t){return function(e,n){return aT(t(e),n)}}s5(aT);function lT(t){for(var e=t.length,n,r=-1,i=0,s,c;++r=0;)for(c=t[e],n=c.length;--n>=0;)s[--i]=c[n];return s}var Nd=1e9,Wg=-Nd;function l5(t,e,n,r){function i(v,S){return t<=v&&v<=n&&e<=S&&S<=r}function s(v,S,E,C){var M=0,k=0;if(v==null||(M=c(v,E))!==(k=c(S,E))||d(v,S)<0^E>0)do C.point(M===0||M===3?t:n,M>1?r:e);while((M=(M+E+4)%4)!==k);else C.point(S[0],S[1])}function c(v,S){return to(v[0]-t)0?0:3:to(v[0]-n)0?2:1:to(v[1]-e)0?1:0:S>0?3:2}function l(v,S){return d(v.x,S.x)}function d(v,S){var E=c(v,1),C=c(S,1);return E!==C?E-C:E===0?S[1]-v[1]:E===1?v[0]-S[0]:E===2?v[1]-S[1]:S[0]-v[0]}return function(v){var S=v,E=oT(),C,M,k,R,N,B,F,G,H,K,_e,ae={point:le,lineStart:oe,lineEnd:qe,polygonStart:ke,polygonEnd:Q};function le(it,ft){i(it,ft)&&S.point(it,ft)}function ve(){for(var it=0,ft=0,Xe=M.length;ftr&&(Rn-Tt)*(r-tn)>(Jt-tn)*(t-Tt)&&++it:Jt<=r&&(Rn-Tt)*(r-tn)<(Jt-tn)*(t-Tt)&&--it;return it}function ke(){S=E,C=[],M=[],_e=!0}function Q(){var it=ve(),ft=_e&&it,Xe=(C=lT(C)).length;(ft||Xe)&&(v.polygonStart(),ft&&(v.lineStart(),s(null,null,1,v),v.lineEnd()),Xe&&sT(C,l,it,s,v),v.polygonEnd()),S=v,C=M=k=null}function oe(){ae.point=Pe,M&&M.push(k=[]),K=!0,H=!1,F=G=NaN}function qe(){C&&(Pe(R,N),B&&H&&E.rejoin(),C.push(E.result())),ae.point=le,H&&S.lineEnd()}function Pe(it,ft){var Xe=i(it,ft);if(M&&k.push([it,ft]),K)R=it,N=ft,B=Xe,K=!1,Xe&&(S.lineStart(),S.point(it,ft));else if(Xe&&H)S.point(it,ft);else{var Mt=[F=Math.max(Wg,Math.min(Nd,F)),G=Math.max(Wg,Math.min(Nd,G))],At=[it=Math.max(Wg,Math.min(Nd,it)),ft=Math.max(Wg,Math.min(Nd,ft))];o5(Mt,At,t,e,n,r)?(H||(S.lineStart(),S.point(Mt[0],Mt[1])),S.point(At[0],At[1]),Xe||S.lineEnd(),_e=!1):Xe&&(S.lineStart(),S.point(it,ft),_e=!1)}F=it,G=ft,H=Xe}return ae}}var av=dc();function u5(t,e){var n=e[0],r=e[1],i=[ri(n),-ni(n),0],s=0,c=0;av.reset();for(var l=0,d=t.length;l=0?1:-1,le=ae*_e,ve=le>Kn,ke=k*H;if(av.add(tp(ke*ae*ri(le),R*K+ke*ni(le))),s+=ve?_e+ae*kl:_e,ve^C>=n^F>=n){var Q=G_(np(E),np(B));n1(Q);var oe=G_(i,Q);n1(oe);var qe=(ve^_e>=0?-1:1)*ah(oe[2]);(r>qe||r===qe&&(Q[0]||Q[1]))&&(c+=ve^_e>=0?1:-1)}}return(s<-Ar||sdm&&(dm=t),eW_&&(W_=e)}dc();function uT(t,e,n,r){return function(i,s){var c=e(s),l=i.invert(r[0],r[1]),d=oT(),v=e(d),S=!1,E,C,M,k={point:R,lineStart:B,lineEnd:F,polygonStart:function(){k.point=G,k.lineStart=H,k.lineEnd=K,C=[],E=[]},polygonEnd:function(){k.point=R,k.lineStart=B,k.lineEnd=F,C=lT(C);var _e=u5(E,l);C.length?(S||(s.polygonStart(),S=!0),sT(C,f5,_e,n,s)):_e&&(S||(s.polygonStart(),S=!0),s.lineStart(),n(null,null,1,s),s.lineEnd()),S&&(s.polygonEnd(),S=!1),C=E=null},sphere:function(){s.polygonStart(),s.lineStart(),n(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function R(_e,ae){var le=i(_e,ae);t(_e=le[0],ae=le[1])&&s.point(_e,ae)}function N(_e,ae){var le=i(_e,ae);c.point(le[0],le[1])}function B(){k.point=N,c.lineStart()}function F(){k.point=R,c.lineEnd()}function G(_e,ae){M.push([_e,ae]);var le=i(_e,ae);v.point(le[0],le[1])}function H(){v.lineStart(),M=[]}function K(){G(M[0][0],M[0][1]),v.lineEnd();var _e=v.clean(),ae=d.result(),le,ve=ae.length,ke,Q,oe;if(M.pop(),E.push(M),M=null,!!ve){if(_e&1){if(Q=ae[0],(ke=Q.length-1)>0){for(S||(s.polygonStart(),S=!0),s.lineStart(),le=0;le1&&_e&2&&ae.push(ae.pop().concat(ae.shift())),C.push(ae.filter(h5))}}return k}}function h5(t){return t.length>1}function f5(t,e){return((t=t.x)[0]<0?t[1]-wl-Ar:wl-t[1])-((e=e.x)[0]<0?e[1]-wl-Ar:wl-e[1])}const yS=uT(function(){return!0},p5,m5,[-Kn,-wl]);function p5(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(s,c){var l=s>0?Kn:-Kn,d=to(s-e);to(d-Kn)0?wl:-wl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(s,n),i=0):r!==l&&d>=Kn&&(to(e-r)Ar?t5((ri(e)*(s=ni(r))*ri(n)-ri(r)*(i=ni(e))*ri(t))/(i*s*c)):(e+r)/2}function m5(t,e,n,r){var i;if(t==null)i=n*wl,r.point(-Kn,i),r.point(0,i),r.point(Kn,i),r.point(Kn,0),r.point(Kn,-i),r.point(0,-i),r.point(-Kn,-i),r.point(-Kn,0),r.point(-Kn,i);else if(to(t[0]-e[0])>Ar){var s=t[0]0,i=to(n)>Ar;function s(S,E,C,M){i5(M,t,e,C,S,E)}function c(S,E){return ni(S)*ni(E)>n}function l(S){var E,C,M,k,R;return{lineStart:function(){k=M=!1,R=1},point:function(N,B){var F=[N,B],G,H=c(N,B),K=r?H?0:v(N,B):H?v(N+(N<0?Kn:-Kn),B):0;if(!E&&(k=M=H)&&S.lineStart(),H!==M&&(G=d(E,F),(!G||a_(E,G)||a_(F,G))&&(F[0]+=Ar,F[1]+=Ar,H=c(F[0],F[1]))),H!==M)R=0,H?(S.lineStart(),G=d(F,E),S.point(G[0],G[1])):(G=d(E,F),S.point(G[0],G[1]),S.lineEnd()),E=G;else if(i&&E&&r^H){var _e;!(K&C)&&(_e=d(F,E,!0))&&(R=0,r?(S.lineStart(),S.point(_e[0][0],_e[0][1]),S.point(_e[1][0],_e[1][1]),S.lineEnd()):(S.point(_e[1][0],_e[1][1]),S.lineEnd(),S.lineStart(),S.point(_e[0][0],_e[0][1])))}H&&(!E||!a_(E,F))&&S.point(F[0],F[1]),E=F,M=H,C=K},lineEnd:function(){M&&S.lineEnd(),E=null},clean:function(){return R|(k&&M)<<1}}}function d(S,E,C){var M=np(S),k=np(E),R=[1,0,0],N=G_(M,k),B=jg(N,N),F=N[0],G=B-F*F;if(!G)return!C&&S;var H=n*B/G,K=-n*F/G,_e=G_(R,N),ae=Gg(R,H),le=Gg(N,K);sv(ae,le);var ve=_e,ke=jg(ae,ve),Q=jg(ve,ve),oe=ke*ke-Q*(jg(ae,ae)-1);if(!(oe<0)){var qe=_p(oe),Pe=Gg(ve,(-ke-qe)/Q);if(sv(Pe,ae),Pe=t1(Pe),!C)return Pe;var it=S[0],ft=E[0],Xe=S[1],Mt=E[1],At;ft0^Pe[1]<(to(Pe[0]-it)Kn^(it<=Pe[0]&&Pe[0]<=ft)){var tn=Gg(ve,(-ke+qe)/Q);return sv(tn,ae),[Pe,t1(tn)]}}}function v(S,E){var C=r?t:Kn-t,M=0;return S<-C?M|=1:S>C&&(M|=2),E<-C?M|=4:E>C&&(M|=8),M}return uT(c,l,s,r?[0,-t]:[-Kn,t-Kn])}function cT(t){return function(e){var n=new i1;for(var r in t)n[r]=t[r];return n.stream=e,n}}function i1(){}i1.prototype={constructor:i1,point:function(t,e){this.stream.point(t,e)},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 hT(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),s!=null&&t.clipExtent(null),n5(n,t.stream(_S));var c=_S.result(),l=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),d=+e[0][0]+(r-l*(c[1][0]+c[0][0]))/2,v=+e[0][1]+(i-l*(c[1][1]+c[0][1]))/2;return s!=null&&t.clipExtent(s),t.scale(l*150).translate([d,v])}function _5(t,e,n){return hT(t,[[0,0],e],n)}var vS=16,y5=ni(30*la);function bS(t,e){return+e?b5(t,e):v5(t)}function v5(t){return cT({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function b5(t,e){function n(r,i,s,c,l,d,v,S,E,C,M,k,R,N){var B=v-r,F=S-i,G=B*B+F*F;if(G>4*e&&R--){var H=c+C,K=l+M,_e=d+k,ae=_p(H*H+K*K+_e*_e),le=ah(_e/=ae),ve=to(to(_e)-1)e||to((B*qe+F*Pe)/G-.5)>.3||c*C+l*M+d*k2?Pe[2]%360*la:0,oe()):[v*Gu,S*Gu,E*Gu]},ve.precision=function(Pe){return arguments.length?(_e=bS(Q,K=Pe*Pe),qe()):_p(K)},ve.fitExtent=function(Pe,it){return hT(ve,Pe,it)},ve.fitSize=function(Pe,it){return _5(ve,Pe,it)};function oe(){M=iT(C=r5(v,S,E),e);var Pe=e(l,d);return s=r-Pe[0]*n,c=i+Pe[1]*n,qe()}function qe(){return ae=le=null,ve}return function(){return e=t.apply(this,arguments),ve.invert=e.invert&&ke,oe()}}function fT(t){return function(e,n){var r=ni(e),i=ni(n),s=t(r*i);return[s*i*ri(e),s*ri(n)]}}function pT(t){return function(e,n){var r=_p(e*e+n*n),i=t(r),s=ri(i),c=ni(i);return[tp(e*s,r*c),ah(r&&n*s/r)]}}var E5=fT(function(t){return _p(2/(1+t))});E5.invert=pT(function(t){return 2*ah(t/2)});var dT=fT(function(t){return(t=rT(t))&&t/ri(t)});dT.invert=pT(function(t){return t});function I5(){return w5(dT).scale(79.4188).clipAngle(180-.001)}function xS(t,e){return[t,e]}xS.invert=xS;function C5(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var s=[];switch(t.type){case"GeometryCollection":return PC(t,function(c){var l=l_(c,e,r,i);l&&s.push(l)}),Kv(s);case"FeatureCollection":return tS(t,function(c){var l=l_(c,e,r,i);l&&tS(l,function(d){d&&s.push(d)})}),Kv(s)}return l_(t,e,r,i)}function l_(t,e,n,r){var i=t.properties||{},s=t.type==="Feature"?t.geometry:t;if(s.type==="GeometryCollection"){var c=[];return PC(t,function(R){var N=l_(R,e,n,r);N&&c.push(N)}),Kv(c)}var l=T5(s),d={type:s.type,coordinates:gT(s.coordinates,l)},v=new eb,S=v.read(d),E=RO(NO(e,n),"meters"),C=Di.bufferOp(S,E,r),M=new BC;if(C=M.write(C),!mT(C.coordinates)){var k={type:C.type,coordinates:_T(C.coordinates,l)};return uy(k,i)}}function mT(t){return Array.isArray(t[0])?mT(t[0]):isNaN(t[0])}function gT(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return gT(n,e)})}function _T(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return _T(n,e)})}function T5(t){var e=zO(t).geometry.coordinates,n=[-e[0],-e[1]];return I5().rotate(n).scale(Qo)}function L5(t,e){var n=N_(t),r=N_(e),i=t.properties||{},s=EC.difference(n.coordinates,r.coordinates);return s.length===0?null:s.length===1?CC(s[0],i):TC(s,i)}function wS(t){let e;for(const n of t)e&&n[0]-e[0]>=180?n[0]-=360:e&&n[0]-e[0]<-180&&(n[0]+=360),e=n}function SS(t,e){const n=L5({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=C5(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)wS(i);else for(const i of r.geometry.coordinates)for(const s of i)wS(s);e({type:"FeatureCollection",features:[r,n]})}let ES={type:"FeatureCollection",features:[]};function P5(t,e,n=!0,r=!0,i={},s={},c={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 l,d=[],v,S;function E(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:ES}),c!=null&&c.fill&&t.addLayer({...c==null?void 0:c.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),c!=null&&c.line&&t.addLayer({...c==null?void 0:c.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?E():t.once("load",()=>{E()});const C=k=>{l==null||l({type:"mapClick",coordinates:[k.lngLat.lng,k.lngLat.lat]})};function M(k=!1){if(!e)throw new Error;const R=document.createElement("div");return k&&R.classList.add("marker-interactive"),new iO({props:{displayIn:"maplibre"},target:R}),new e.Marker({element:R,offset:[1,-13]})}return{setEventHandler(k){k?(l=k,t.on("click",C)):(l=void 0,t.off("click",C))},flyTo(k,R){t.flyTo({center:k,zoom:R,...i})},fitBounds(k,R,N){t.fitBounds([[k[0],k[1]],[k[2],k[3]]],{padding:R,maxZoom:N,...s})},indicateReverse(k){t.getCanvasContainer().style.cursor=k?"crosshair":""},setReverseMarker(k){!e||!n||(S?k?S.setLngLat(k):(S.remove(),S=void 0):k&&(S=(typeof n=="object"?new e.Marker(n):M()).setLngLat(k).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(k,R){if(!n)return;function N(B){var F;(F=t.getSource("full-geom"))==null||F.setData(B)}for(const B of d)B.remove();if(d.length=0,N(ES),!!e){if(R){let B=!1;if(R.geometry.type==="GeometryCollection"){const F=R.geometry.geometries.filter(G=>G.type==="Polygon"||G.type==="MultiPolygon");if(F.length>0){let G=F.pop();for(const H of F)G=OO(G,H);SS({...R,geometry:G},N),B=!0}else{const G=R.geometry.geometries.filter(H=>H.type==="LineString"||H.type==="MultiLineString");G.length>0&&(N({...R,geometry:{type:"GeometryCollection",geometries:G}}),B=!0)}}if(!B){if(R.geometry.type==="Polygon"||R.geometry.type==="MultiPolygon")SS(R,N);else if(R.geometry.type==="LineString"||R.geometry.type==="MultiLineString"){N(R);return}}n&&d.push((typeof n=="object"?new e.Marker(n):M()).setLngLat(R.center).addTo(t))}if(r)for(const B of k??[]){if(B===R)continue;const F=(typeof r=="object"?new e.Marker(r):M(!0)).setLngLat(B.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(B.place_type[0]==="reverse"?B.place_name:B.place_name.replace(/,.*/,""))).addTo(t),G=F.getElement();G.addEventListener("click",H=>{H.stopPropagation(),l==null||l({type:"markerClick",id:B.id})}),G.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:B.id}),F.togglePopup()}),G.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:B.id}),F.togglePopup()}),d.push(F)}}},setSelectedMarker(k){v&&v.getElement().classList.toggle("marker-selected",!1),v=k>-1?d[k]:void 0,v==null||v.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const k=t.getCenter();return[t.getZoom(),k.lng,k.lat]}}}function M5(t){let e,n;return{c(){e=su("svg"),n=su("path"),Le(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"),Le(e,"viewBox","0 0 14 14"),Le(e,"width","13"),Le(e,"height","13"),Le(e,"class","svelte-en2qvf")},m(r,i){be(r,e,i),te(e,n)},p:Ct,i:Ct,o:Ct,d(r){r&&ye(e)}}}class yT extends Zt{constructor(e){super(),Ht(this,e,null,M5,Ut,{})}}function A5(t){let e,n;return{c(){e=su("svg"),n=su("path"),Le(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"),Le(e,"viewBox","0 0 30 30"),Le(e,"fill","none"),Le(e,"xmlns","http://www.w3.org/2000/svg"),Le(e,"class","svelte-d2loi5")},m(r,i){be(r,e,i),te(e,n)},p:Ct,i:Ct,o:Ct,d(r){r&&ye(e)}}}class vT extends Zt{constructor(e){super(),Ht(this,e,null,A5,Ut,{})}}function k5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"area.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"area.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function D5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"reverse.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"reverse.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function R5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"poi.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"poi.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function N5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"postal_code.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"postal_code.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function O5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"street.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"street.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function z5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"road.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"road.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function F5(t){let e,n;return{c(){e=ge("img"),ai(e.src,n=t[3]+"housenumber.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!ai(e.src,n=r[3]+"housenumber.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ye(e)}}}function B5(t){let e,n,r,i;return{c(){e=ge("img"),ai(e.src,n=t[5])||Le(e,"src",n),Le(e,"alt",t[4]),Le(e,"class","svelte-ltkwvy")},m(s,c){be(s,e,c),r||(i=Lt(e,"error",t[14]),r=!0)},p(s,c){c&32&&!ai(e.src,n=s[5])&&Le(e,"src",n),c&16&&Le(e,"alt",s[4])},d(s){s&&ye(e),r=!1,i()}}}function IS(t){let e,n;return{c(){e=ge("span"),n=nt(t[6]),Le(e,"class","secondary svelte-ltkwvy")},m(r,i){be(r,e,i),te(e,n)},p(r,i){i&64&&Hn(n,r[6])},d(r){r&&ye(e)}}}function V5(t){var ae,le;let e,n,r,i,s,c,l,d,v=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,E,C=t[2]==="always"||t[2]&&!t[0].address&&((ae=t[0].properties)==null?void 0:ae.kind)!=="road"&&((le=t[0].properties)==null?void 0:le.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],M,k,R=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",N,B,F;function G(ve,ke){var Q,oe;return ke&1&&(n=null),ke&1&&(r=null),ke&1&&(i=null),ve[5]?B5:ve[0].address?F5:((Q=ve[0].properties)==null?void 0:Q.kind)==="road"||((oe=ve[0].properties)==null?void 0:oe.kind)==="road_relation"?z5:(n==null&&(n=!!ve[0].id.startsWith("address.")),n?O5:(r==null&&(r=!!ve[0].id.startsWith("postal_code.")),r?N5:(i==null&&(i=!!ve[0].id.startsWith("poi.")),i?R5:ve[7]?D5:k5)))}let H=G(t,-1),K=H(t),_e=C&&IS(t);return{c(){e=ge("li"),K.c(),s=We(),c=ge("span"),l=ge("span"),d=ge("span"),S=nt(v),E=We(),_e&&_e.c(),M=We(),k=ge("span"),N=nt(R),Le(d,"class","primary svelte-ltkwvy"),Le(l,"class","svelte-ltkwvy"),Le(k,"class","line2 svelte-ltkwvy"),Le(c,"class","texts svelte-ltkwvy"),Le(e,"tabindex","0"),Le(e,"data-selected",t[1]),Le(e,"class","svelte-ltkwvy"),xl(e,"selected",t[1])},m(ve,ke){be(ve,e,ke),K.m(e,null),te(e,s),te(e,c),te(c,l),te(l,d),te(d,S),te(l,E),_e&&_e.m(l,null),te(c,M),te(c,k),te(k,N),B||(F=[Lt(e,"mouseenter",t[12]),Lt(e,"focus",t[13])],B=!0)},p(ve,[ke]){var Q,oe;H===(H=G(ve,ke))&&K?K.p(ve,ke):(K.d(1),K=H(ve),K&&(K.c(),K.m(e,s))),ke&1&&v!==(v=(ve[7]?ve[0].place_name:ve[0].place_name.replace(/,.*/,""))+"")&&Hn(S,v),ke&37&&(C=ve[2]==="always"||ve[2]&&!ve[0].address&&((Q=ve[0].properties)==null?void 0:Q.kind)!=="road"&&((oe=ve[0].properties)==null?void 0:oe.kind)!=="road_relation"&&!ve[0].id.startsWith("address.")&&!ve[0].id.startsWith("postal_code.")&&(!ve[0].id.startsWith("poi.")||!ve[5])&&!ve[7]),C?_e?_e.p(ve,ke):(_e=IS(ve),_e.c(),_e.m(l,null)):_e&&(_e.d(1),_e=null),ke&1&&R!==(R=(ve[7]?"":ve[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Hn(N,R),ke&2&&Le(e,"data-selected",ve[1]),ke&2&&xl(e,"selected",ve[1])},i:Ct,o:Ct,d(ve){ve&&ye(e),K.d(),_e&&_e.d(),B=!1,Yr(F)}}}function U5(t,e,n){var G;let r,i,{feature:s}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:d}=e,{iconsBaseUrl:v}=e;const S=(G=s.properties)==null?void 0:G.categories;let E,C,M=0,k=s.place_type[0]==="reverse";function R(H){C&&d.add(C),n(10,M++,M)}function N(H){gn.call(this,t,H)}function B(H){gn.call(this,t,H)}const F=H=>R(H.currentTarget);return t.$$set=H=>{"feature"in H&&n(0,s=H.feature),"selected"in H&&n(1,c=H.selected),"showPlaceType"in H&&n(2,l=H.showPlaceType),"missingIconsCache"in H&&n(9,d=H.missingIconsCache),"iconsBaseUrl"in H&&n(3,v=H.iconsBaseUrl)},t.$$.update=()=>{var H,K,_e,ae;if(t.$$.dirty&3640)do n(11,r--,r),n(4,E=S==null?void 0:S[r]),n(5,C=E?v+E.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!C||d.has(C)));t.$$.dirty&1&&n(6,i=s.id.startsWith("poi.")?(K=(H=s.properties)==null?void 0:H.categories)==null?void 0:K.join(", "):((ae=(_e=s.properties)==null?void 0:_e.place_type_name)==null?void 0:ae[0])??s.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[s,c,l,v,E,C,i,k,R,d,M,r,N,B,F]}class j5 extends Zt{constructor(e){super(),Ht(this,e,U5,V5,Ut,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function G5(t){let e;return{c(){e=ge("div"),e.innerHTML='',Le(e,"class","svelte-7cmwmc")},m(n,r){be(n,e,r)},p:Ct,i:Ct,o:Ct,d(n){n&&ye(e)}}}class q5 extends Zt{constructor(e){super(),Ht(this,e,null,G5,Ut,{})}}function W5(t){let e,n;return{c(){e=su("svg"),n=su("path"),Le(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"),Le(e,"viewBox","0 0 60.006 21.412"),Le(e,"width","14"),Le(e,"height","20"),Le(e,"class","svelte-en2qvf")},m(r,i){be(r,e,i),te(e,n)},p:Ct,i:Ct,o:Ct,d(r){r&&ye(e)}}}class H5 extends Zt{constructor(e){super(),Ht(this,e,null,W5,Ut,{})}}function Z5(t){let e,n,r;return{c(){e=su("svg"),n=su("circle"),r=su("path"),Le(n,"cx","4.789"),Le(n,"cy","4.787"),Le(n,"r","3.85"),lr(n,"stroke-width","1.875"),lr(n,"fill","none"),Le(r,"d","M12.063 12.063 7.635 7.635"),lr(r,"stroke-width","1.875"),lr(r,"stroke-linecap","round"),Le(e,"xmlns","http://www.w3.org/2000/svg"),Le(e,"width","13"),Le(e,"height","13"),Le(e,"viewBox","0 0 13 13"),Le(e,"class","svelte-1bpbt60")},m(i,s){be(i,e,s),te(e,n),te(e,r)},p:Ct,i:Ct,o:Ct,d(i){i&&ye(e)}}}class X5 extends Zt{constructor(e){super(),Ht(this,e,null,Z5,Ut,{})}}function $5(t,e,n){const r=e[1],i=e[0],s=r-i;return t===r&&n?t:((t-i)%s+s)%s+i}function CS(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Ed.coords)break e;return Ed.coords}let s;try{return s=await new Promise((c,l)=>{n.signal.addEventListener("abort",()=>{l(Error("aborted"))}),navigator.geolocation.getCurrentPosition(d=>{c([d.coords.longitude,d.coords.latitude].map(v=>v.toFixed(6)).join(","))},d=>{l(d)},i)}),s}catch{}finally{i.cachedLocationExpiry&&(Ed={time:Date.now(),coords:s})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const TS=/(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,LS=/(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,PS=/(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,MS=/(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 K5(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(c=>Number(c.trim()));let n=AS(e[0],t),r=AS(e[1],t);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=e[0]>=0?" N":" S",s=e[1]>=0?" E":" W";return`${n+i}, ${r+s}`}else throw new Error("no decimal coordinates to convert")}function AS(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=J5(i,3).toFixed(3).padStart(6,"0");return`${r}° ${l}'`}let s=Math.floor(i),c=((i-s)*60).toFixed(1).padStart(4,"0");return s=s.toString().padStart(2,"0"),`${r}° ${s}' ${c}"`}function J5(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function ub(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",s="",c=[],l=!1;if(TS.test(t))if(c=TS.exec(t),l=Hg(c),l){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(i=c[1],s=c[5]):c[4]&&(i=c[4],s=c[8])}else throw new Error("invalid decimal coordinate format");else if(LS.test(t))if(c=LS.exec(t),l=Hg(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6].replace(",",".")/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(i=c[1],s=c[8]):c[7]&&(i=c[7],s=c[14]);else throw new Error("invalid DMS coordinates format");else if(PS.test(t))if(c=PS.exec(t),l=Hg(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],s=c[9]):c[8]&&(i=c[8],s=c[16]);else throw new Error("invalid DMS coordinates format");else if(MS.test(t))if(c=MS.exec(t),l=Hg(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],s=c[9]):c[8]&&(i=c[8],s=c[16]);else throw new Error("invalid coordinates format");if(l){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||s)&&(!i||!s))throw new Error("invalid coordinates format");if(i&&i==s)throw new Error("invalid coordinates format");let d=/S|SOUTH/i;d.test(i)&&n>0&&(n=-1*n),d=/W|WEST/i,d.test(s)&&r>0&&(r=-1*r);const v=c[0].trim();let S,E;const C=/[,/;\u0020]/g,M=v.match(C);if(M==null){const N=Math.floor(t.length/2);S=v.substring(0,N).trim(),E=v.substring(N).trim()}else{let N;M.length%2==1?N=Math.floor(M.length/2):N=M.length/2-1;let B=0;if(N==0)B=v.indexOf(M[0]),S=v.substring(0,B).trim(),E=v.substring(B+1).trim();else{let F=0,G=0;for(;F<=N;)B=v.indexOf(M[F],G),G=B+1,F++;S=v.substring(0,B).trim(),E=v.substring(B+1).trim()}}const k=S.split(".");if(k.length==2&&k[1]==0&&k[1].length!=2)throw new Error("invalid coordinates format");const R=E.split(".");if(R.length==2&&R[1]==0&&R[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(E))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(e)),Object.freeze({verbatimCoordinates:v,verbatimLatitude:S,verbatimLongitude:E,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:Q5,toCoordinateFormat:K5})}else throw new Error("coordinates pattern match failed")}function Hg(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=e.length/2;for(let s=0;s{e.decimalLatitude?t.push(e):t.push({...e,...nz})}),[...t,...rz,...iz]}const sz=oz();ub.formats=sz.map(t=>t.verbatimCoordinates);const az=ub;function DS(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function RS(t){let e,n;return e=new q5({}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function NS(t){let e,n,r,i,s;return n=new H5({}),{c(){e=ge("button"),je(n.$$.fragment),Le(e,"type","button"),Le(e,"title",t[9]),Le(e,"class","svelte-zh3kmv"),xl(e,"active",t[0])},m(c,l){be(c,e,l),Be(n,e,null),r=!0,i||(s=Lt(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Le(e,"title",c[9]),(!r||l[0]&1)&&xl(e,"active",c[0])},i(c){r||(se(n.$$.fragment,c),r=!0)},o(c){de(n.$$.fragment,c),r=!1},d(c){c&&ye(e),Ve(n),i=!1,s()}}}function lz(t){let e,n=[],r=new Map,i,s,c,l=zo(t[14]);const d=v=>v[81].id+(v[81].address?","+v[81].address:"");for(let v=0;v{ae=null}),Dn()),(!G||it[0]&2)&&xl(v,"displayable",Pe[1]!==""),Pe[5]===!0?le?(le.p(Pe,it),it[0]&32&&se(le,1)):(le=NS(Pe),le.c(),se(le,1),le.m(r,k)):le&&(kn(),de(le,1,1,()=>{le=null}),Dn()),ke&&ke.p&&(!G||it[1]&134217728)&&yr(ke,ve,Pe,Pe[58],G?_r(ve,Pe[58],it,null):vr(Pe[58]),null);let ft=N;N=qe(Pe),N===ft?~N&&oe[N].p(Pe,it):(B&&(kn(),de(oe[ft],1,1,()=>{oe[ft]=null}),Dn()),~N?(B=oe[N],B?B.p(Pe,it):(B=oe[N]=Q[N](Pe),B.c()),se(B,1),B.m(n,null)):B=null),(!G||it[0]&4&&F!==(F=c_(Pe[2])+" svelte-zh3kmv"))&&Le(n,"class",F),(!G||it[0]&22)&&xl(n,"can-collapse",Pe[4]&&Pe[1]==="")},i(Pe){G||(se(_e),se(s.$$.fragment,Pe),se(E.$$.fragment,Pe),se(ae),se(le),se(ke,Pe),se(B),G=!0)},o(Pe){de(_e),de(s.$$.fragment,Pe),de(E.$$.fragment,Pe),de(ae),de(le),de(ke,Pe),de(B),G=!1},d(Pe){Pe&&(ye(e),ye(n)),Ve(s),t[61](null),Ve(E),ae&&ae.d(),le&&le.d(),ke&&ke.d(Pe),~N&&oe[N].d(),H=!1,Yr(K)}}}function pz(t,e,n){let r,{$$slots:i={},$$scope:s}=e,{class:c=void 0}=e,{apiKey:l}=e,{bbox:d=void 0}=e,{clearButtonTitle:v="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:E=!1}=e,{country:C=void 0}=e,{debounceSearch:M=200}=e,{enableReverse:k=!1}=e,{errorMessage:R="Something went wrong…"}=e,{filter:N=()=>!0}=e,{flyTo:B=!0}=e,{fuzzyMatch:F=!0}=e,{language:G=void 0}=e,{limit:H=void 0}=e,{mapController:K=void 0}=e,{minLength:_e=2}=e,{noResultsMessage:ae="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!"}=e,{placeholder:le="Search"}=e,{proximity:ve=[{type:"server-geolocation"}]}=e,{reverseActive:ke=k==="always"}=e,{reverseButtonTitle:Q="toggle reverse geocoding"}=e,{searchValue:oe=""}=e,{showFullGeometry:qe=!0}=e,{showPlaceType:Pe="ifNeeded"}=e,{showResultsWhileTyping:it=!0}=e,{selectFirst:ft=!0}=e,{flyToSelected:Xe=!1}=e,{markerOnSelected:Mt=!0}=e,{types:At=void 0}=e,{excludeTypes:yt=!1}=e,{zoom:zt=16}=e,{maxZoom:Tt=18}=e,{apiUrl:tn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Rn={}}=e,{iconsBaseUrl:Jt="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:pn=ee=>{}}=e;function Nn(){Re.focus()}function En(){Re.blur()}function Nr(ee,Me=!0){n(1,oe=ee),Me?(n(15,on=-1),zl()):(ui(),setTimeout(()=>{Re.focus(),Re.select()}))}function Jn(){n(14,ne=void 0),n(55,ot=void 0),n(15,on=-1)}function On(){n(54,Ce=[]),n(55,ot=void 0)}let Qn=!1,ne,Ce,ot,kt="",Re,on=-1,qr,_n=[],ur,Go,Cs,Ks;const tl=new Set,Bi=vu();ro(()=>{K&&(K.setEventHandler(void 0),K.indicateReverse(!1),K.setSelectedMarker(-1),K.setMarkers(void 0,void 0))});function zl(ee){if(Go&&(clearTimeout(Go),Go=void 0),on>-1&&ne)n(55,ot=ne[on]),n(1,oe=ot.place_type[0]==="reverse"?ot.place_name:ot.place_name.replace(/,.*/,"")),n(18,qr=void 0),n(54,Ce=void 0),n(15,on=-1);else if(oe){const Me=ee||!Ts(oe);lt(oe,{exact:!0}).then(()=>{n(54,Ce=ne),n(55,ot=void 0),Me&&us()}).catch(Se=>n(18,qr=Se))}}function Ts(ee){try{return az(ee,6)}catch{return!1}}async function lt(ee,{byId:Me=!1,exact:Se=!1}={}){n(18,qr=void 0),ur==null||ur.abort();const Ne=new AbortController;n(19,ur=Ne);try{const He=Ts(ee),Ye=new URLSearchParams;if(G!==void 0&&Ye.set("language",Array.isArray(G)?G.join(","):G??""),At&&Ye.set("types",At.join(",")),yt&&Ye.set("excludeTypes",String(yt)),d&&Ye.set("bbox",d.map(en=>en.toFixed(6)).join(",")),C&&Ye.set("country",Array.isArray(C)?C.join(","):C),!Me&&!He){const en=await Y5(K,ve,Ne);en&&Ye.set("proximity",en),(Se||!it)&&Ye.set("autocomplete","false"),Ye.set("fuzzyMatch",String(F))}H!==void 0&&(!He||(At==null?void 0:At.length)===1)&&Ye.set("limit",String(H)),Ye.set("key",l),pn(Ye);const Je=tn+"/"+encodeURIComponent(He?He.decimalLongitude+","+He.decimalLatitude:ee)+".json?"+Ye.toString();if(Je===kt){Me?(n(14,ne=void 0),n(55,ot=_n[0])):n(14,ne=_n);return}kt=Je;const Rt=await fetch(Je,{signal:Ne.signal,...Rn});if(!Rt.ok)throw new Error(await Rt.text());const Ft=await Rt.json();Bi("response",{url:Je,featureCollection:Ft}),Me?(n(14,ne=void 0),n(55,ot=Ft.features[0]),_n=[ot]):(n(14,ne=Ft.features.filter(N)),He&&ne.unshift({type:"Feature",properties:{},id:"reverse_"+He.decimalLongitude+"_"+He.decimalLatitude,text:He.decimalLatitude+", "+He.decimalLongitude,place_name:He.decimalLatitude+", "+He.decimalLongitude,place_type:["reverse"],center:[He.decimalLongitude,He.decimalLatitude],bbox:[He.decimalLongitude,He.decimalLatitude,He.decimalLongitude,He.decimalLatitude],geometry:{type:"Point",coordinates:[He.decimalLongitude,He.decimalLatitude]}}),_n=ne,He&&Re.focus())}catch(He){if(He&&typeof He=="object"&&"name"in He&&He.name==="AbortError")return;throw He}finally{Ne===ur&&n(19,ur=void 0)}}function us(){var Se;if(!(Ce!=null&&Ce.length)||!B)return;const ee=[180,90,-180,-90],Me=!Ce.some(Ne=>!Ne.matching_text);for(const Ne of Ce)if(Me||!Ne.matching_text)for(const He of[0,1,2,3])ee[He]=Math[He<2?"min":"max"](ee[He],((Se=Ne.bbox)==null?void 0:Se[He])??Ne.center[He%2]);K&&Ce.length>0&&(ot&&ee[0]===ee[2]&&ee[1]===ee[3]?K.flyTo(ot.center,zt):K.fitBounds(CS(ee),50,Tt))}function lo(ee){n(0,ke=k==="always"),n(14,ne=void 0),n(55,ot=void 0),n(15,on=-1),Nr(ee[1].toFixed(6)+", "+$5(ee[0],[-180,180],!0).toFixed(6),!1)}function Fl(ee){if(!ne)return;let Me=ee.key==="ArrowDown"?1:ee.key==="ArrowUp"?-1:0;Me&&(on===(ft?0:-1)&&Me===-1&&n(15,on=ne.length),n(15,on+=Me),on>=ne.length&&n(15,on=-1),on<0&&ft&&n(15,on=0),ee.preventDefault())}function ui(ee=!0){if(n(18,qr=void 0),it){if(Go&&clearTimeout(Go),oe.length<_e)return;const Me=oe;Go=window.setTimeout(()=>{lt(Me).catch(Se=>n(18,qr=Se))},ee?M:0)}else n(14,ne=void 0),n(18,qr=void 0)}function pt(ee){n(55,ot=ee),n(1,oe=ee.place_name),n(15,on=-1)}const un=()=>Re.focus();function an(ee){si[ee?"unshift":"push"](()=>{Re=ee,n(17,Re)})}function Wr(){oe=this.value,n(1,oe),n(13,Qn),n(27,S)}const cs=()=>n(13,Qn=!0),sn=()=>n(13,Qn=!1),Aa=()=>ui(),Kr=()=>{n(1,oe=""),Re.focus()},pe=()=>n(0,ke=!ke),q=()=>n(18,qr=void 0),Z=ee=>n(15,on=ee),J=ee=>pt(ee),ue=()=>{ft||n(15,on=-1)},Te=()=>{};return t.$$set=ee=>{"class"in ee&&n(2,c=ee.class),"apiKey"in ee&&n(25,l=ee.apiKey),"bbox"in ee&&n(26,d=ee.bbox),"clearButtonTitle"in ee&&n(3,v=ee.clearButtonTitle),"clearOnBlur"in ee&&n(27,S=ee.clearOnBlur),"collapsed"in ee&&n(4,E=ee.collapsed),"country"in ee&&n(28,C=ee.country),"debounceSearch"in ee&&n(29,M=ee.debounceSearch),"enableReverse"in ee&&n(5,k=ee.enableReverse),"errorMessage"in ee&&n(6,R=ee.errorMessage),"filter"in ee&&n(30,N=ee.filter),"flyTo"in ee&&n(31,B=ee.flyTo),"fuzzyMatch"in ee&&n(32,F=ee.fuzzyMatch),"language"in ee&&n(33,G=ee.language),"limit"in ee&&n(34,H=ee.limit),"mapController"in ee&&n(35,K=ee.mapController),"minLength"in ee&&n(36,_e=ee.minLength),"noResultsMessage"in ee&&n(7,ae=ee.noResultsMessage),"placeholder"in ee&&n(8,le=ee.placeholder),"proximity"in ee&&n(37,ve=ee.proximity),"reverseActive"in ee&&n(0,ke=ee.reverseActive),"reverseButtonTitle"in ee&&n(9,Q=ee.reverseButtonTitle),"searchValue"in ee&&n(1,oe=ee.searchValue),"showFullGeometry"in ee&&n(38,qe=ee.showFullGeometry),"showPlaceType"in ee&&n(10,Pe=ee.showPlaceType),"showResultsWhileTyping"in ee&&n(39,it=ee.showResultsWhileTyping),"selectFirst"in ee&&n(11,ft=ee.selectFirst),"flyToSelected"in ee&&n(40,Xe=ee.flyToSelected),"markerOnSelected"in ee&&n(41,Mt=ee.markerOnSelected),"types"in ee&&n(42,At=ee.types),"excludeTypes"in ee&&n(43,yt=ee.excludeTypes),"zoom"in ee&&n(44,zt=ee.zoom),"maxZoom"in ee&&n(45,Tt=ee.maxZoom),"apiUrl"in ee&&n(46,tn=ee.apiUrl),"fetchParameters"in ee&&n(47,Rn=ee.fetchParameters),"iconsBaseUrl"in ee&&n(12,Jt=ee.iconsBaseUrl),"adjustUrlQuery"in ee&&n(48,pn=ee.adjustUrlQuery),"$$scope"in ee&&n(58,s=ee.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,Cs=Qn),S&&!Qn&&n(1,oe="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&oe.length<_e&&(n(55,ot=void 0),n(14,ne=void 0),n(18,qr=void 0),n(54,Ce=ne)),t.$$.dirty[1]&16777344&&qe&&ot&&!ot.address&&ot.geometry.type==="Point"&&ot.place_type[0]!=="reverse"&<(ot.id,{byId:!0}).catch(ee=>n(18,qr=ee)),t.$$.dirty[1]&50356241&&(K&&ot&&ot.id!==Ks&&B&&(!ot.bbox||ot.bbox[0]===ot.bbox[2]&&ot.bbox[1]===ot.bbox[3]?K.flyTo(ot.center,ot.id.startsWith("poi.")||ot.id.startsWith("address.")?Tt:zt):K.fitBounds(CS(ot.bbox),50,Tt),n(14,ne=void 0),n(54,Ce=void 0),n(15,on=-1)),n(56,Ks=ot==null?void 0:ot.id)),t.$$.dirty[0]&18432&&ft&&ne!=null&&ne.length&&n(15,on=0),t.$$.dirty[0]&2050&&(ft||n(15,on=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Ce!==ne&&n(54,Ce=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&K&&K.setEventHandler(ee=>{switch(ee.type){case"mapClick":ke&&lo(ee.coordinates);break;case"markerClick":{const Me=ne==null?void 0:ne.find(Se=>Se.id===ee.id);Me&&pt(Me)}break;case"markerMouseEnter":Ce&&n(15,on=Cs?(ne==null?void 0:ne.findIndex(Me=>Me.id===ee.id))??-1:-1);break;case"markerMouseLeave":Ce&&n(15,on=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ne==null?void 0:ne[on]),t.$$.dirty[1]&67133969&&K&&r&&B&&Xe&&K.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Tt:zt),t.$$.dirty[1]&1040&&(Mt||K==null||K.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&K&&Mt&&!Ce&&(K.setMarkers(r?[r]:void 0,void 0),K.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&K&&K.setMarkers(Ce,ot),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Ce&&K&&K.setSelectedMarker(on),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&K){const ee=Ts(oe);K.setReverseMarker(ee?[ee.decimalLongitude,ee.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Bi("select",r),t.$$.dirty[1]&16777216&&Bi("pick",ot),t.$$.dirty[0]&81920&&Bi("optionsVisibilityChange",Cs&&!!ne),t.$$.dirty[0]&16384&&Bi("featuresListed",ne),t.$$.dirty[1]&8388608&&Bi("featuresMarked",Ce),t.$$.dirty[0]&1&&Bi("reverseToggle",ke),t.$$.dirty[0]&2&&Bi("queryChange",oe),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&K&&K.indicateReverse(ke)},[ke,oe,c,v,E,k,R,ae,le,Q,Pe,ft,Jt,Qn,ne,on,Cs,Re,qr,ur,tl,zl,Fl,ui,pt,l,d,S,C,M,N,B,F,G,H,K,_e,ve,qe,it,Xe,Mt,At,yt,zt,Tt,tn,Rn,pn,Nn,En,Nr,Jn,On,Ce,ot,Ks,r,s,i,un,an,Wr,cs,sn,Aa,Kr,pe,q,Z,J,ue,Te]}class dz extends Zt{constructor(e){super(),Ht(this,e,pz,fz,Ut,{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 zS(t){let e,n,r;return n=new dz({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"class","svelte-ixhnie")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&2&&(c.mapController=i[1]),s&1&&(c.apiKey=i[0]),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function mz(t){let e,n,r=t[1]&&zS(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[1]?r?(r.p(i,s),s&2&&se(r,1)):(r=zS(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function gz(t,e,n){let r,{apiKey:i}=e,{map:s}=e;return t.$$set=c=>{"apiKey"in c&&n(0,i=c.apiKey),"map"in c&&n(2,s=c.map)},t.$$.update=()=>{t.$$.dirty&4&&n(1,r=s?P5(s,Bs):null)},[i,r,s]}class _z extends Zt{constructor(e){super(),Ht(this,e,gz,mz,Ut,{apiKey:0,map:2})}}const bT=["==",["geometry-type"],"Polygon"],xT=["==",["geometry-type"],"LineString"],yz=["==",["geometry-type"],"Point"];function Od(t,e,n){let r=["match",t];for(let[i,s]of Object.entries(e))r.push(i),r.push(s);return r.push(n),r}const vz=t=>({}),FS=t=>({}),bz=t=>({}),BS=t=>({}),xz=t=>({}),VS=t=>({});function wz(t){let e,n,r,i,s,c;const l=t[1].top,d=gr(l,t,t[0],VS),v=t[1].left,S=gr(v,t,t[0],BS),E=t[1].main,C=gr(E,t,t[0],FS);return{c(){e=ge("div"),d&&d.c(),n=We(),r=ge("div"),S&&S.c(),i=We(),s=ge("div"),C&&C.c(),Le(e,"class","top svelte-mpick2"),Le(r,"class","left svelte-mpick2"),Le(s,"class","main svelte-mpick2")},m(M,k){be(M,e,k),d&&d.m(e,null),be(M,n,k),be(M,r,k),S&&S.m(r,null),be(M,i,k),be(M,s,k),C&&C.m(s,null),c=!0},p(M,[k]){d&&d.p&&(!c||k&1)&&yr(d,l,M,M[0],c?_r(l,M[0],k,xz):vr(M[0]),VS),S&&S.p&&(!c||k&1)&&yr(S,v,M,M[0],c?_r(v,M[0],k,bz):vr(M[0]),BS),C&&C.p&&(!c||k&1)&&yr(C,E,M,M[0],c?_r(E,M[0],k,vz):vr(M[0]),FS)},i(M){c||(se(d,M),se(S,M),se(C,M),c=!0)},o(M){de(d,M),de(S,M),de(C,M),c=!1},d(M){M&&(ye(e),ye(n),ye(r),ye(i),ye(s)),d&&d.d(M),S&&S.d(M),C&&C.d(M)}}}function Sz(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&n(0,i=s.$$scope)},[i,r]}class Ez extends Zt{constructor(e){super(),Ht(this,e,Sz,wz,Ut,{})}}const Iz=t=>({}),US=t=>({}),Cz=t=>({}),jS=t=>({}),Tz=t=>({}),GS=t=>({});function Lz(t){let e,n,r,i,s,c;const l=t[4].top,d=gr(l,t,t[3],GS),v=t[4].sidebar,S=gr(v,t,t[3],jS),E=t[4].map,C=gr(E,t,t[3],US);return{c(){e=ge("div"),d&&d.c(),n=We(),r=ge("div"),S&&S.c(),i=We(),s=ge("div"),C&&C.c()},m(M,k){be(M,e,k),d&&d.m(e,null),t[5](e),be(M,n,k),be(M,r,k),S&&S.m(r,null),t[6](r),be(M,i,k),be(M,s,k),C&&C.m(s,null),t[7](s),c=!0},p(M,[k]){d&&d.p&&(!c||k&8)&&yr(d,l,M,M[3],c?_r(l,M[3],k,Tz):vr(M[3]),GS),S&&S.p&&(!c||k&8)&&yr(S,v,M,M[3],c?_r(v,M[3],k,Cz):vr(M[3]),jS),C&&C.p&&(!c||k&8)&&yr(C,E,M,M[3],c?_r(E,M[3],k,Iz):vr(M[3]),US)},i(M){c||(se(d,M),se(S,M),se(C,M),c=!0)},o(M){de(d,M),de(S,M),de(C,M),c=!1},d(M){M&&(ye(e),ye(n),ye(r),ye(i),ye(s)),d&&d.d(M),t[5](null),S&&S.d(M),t[6](null),C&&C.d(M),t[7](null)}}}function Pz(t,e,n){let r,i,s;vt(t,o1,E=>n(0,r=E)),vt(t,s1,E=>n(1,i=E)),vt(t,a1,E=>n(2,s=E));let{$$slots:c={},$$scope:l}=e;function d(E){si[E?"unshift":"push"](()=>{r=E,o1.set(r)})}function v(E){si[E?"unshift":"push"](()=>{i=E,s1.set(i)})}function S(E){si[E?"unshift":"push"](()=>{s=E,a1.set(s)})}return t.$$set=E=>{"$$scope"in E&&n(3,l=E.$$scope)},[r,i,s,l,c,d,v,S]}class bu extends Zt{constructor(e){super(),Ht(this,e,Pz,Lz,Ut,{})}}let o1=Fn(null),s1=Fn(null),a1=Fn(null);function Mz(t){let e,n,r,i,s,c,l,d,v;return{c(){e=ge("label"),n=nt(`Basemap: - `),r=ge("select"),i=ge("option"),i.textContent="MapTiler Dataviz",s=ge("option"),s.textContent="MapTiler Streets",c=ge("option"),c.textContent="MapTiler Satellite",l=ge("option"),l.textContent="OS Open Zoomstack",i.__value="dataviz",vo(i,i.__value),s.__value="streets-v2",vo(s,s.__value),c.__value="hybrid",vo(c,c.__value),l.__value="uk-openzoomstack-light",vo(l,l.__value),t[0]===void 0&&Xd(()=>t[1].call(r))},m(S,E){be(S,e,E),te(e,n),te(e,r),te(r,i),te(r,s),te(r,c),te(r,l),h_(r,t[0],!0),d||(v=Lt(r,"change",t[1]),d=!0)},p(S,[E]){E&1&&h_(r,S[0])},i:Ct,o:Ct,d(S){S&&ye(e),d=!1,v()}}}function Az(t,e,n){let r;vt(t,Bv,s=>n(0,r=s));function i(){r=DE(this),Bv.set(r)}return[r,i]}class kz extends Zt{constructor(e){super(),Ht(this,e,Az,Mz,Ut,{})}}let u_=Fn(!0);function Dz(t){let e,n;return e=new hc({props:{paint:{"fill-color":"black","fill-opacity":0},layout:{visibility:t[0]?"none":"visible"}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&1&&(s.layout={visibility:r[0]?"none":"visible"}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Rz(t){let e,n;return e=new No({props:{data:t[1],$$slots:{default:[Dz]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&5&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Nz(t,e,n){let r;return vt(t,u_,s=>n(0,r=s)),[r,{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]}}]}class Oz extends Zt{constructor(e){super(),Ht(this,e,Nz,Rz,Ut,{})}}const zz="/ltn/assets/help-d011708a.svg";function qS(t){let e,n;return e=new K_({props:{$$slots:{default:[Fz]},$$scope:{ctx:t}}}),e.$on("close",t[3]),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&16&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Fz(t){let e,n,r;const i=t[1].default,s=gr(i,t,t[4],null);return{c(){e=ge("h2"),e.textContent="Help",n=We(),s&&s.c()},m(c,l){be(c,e,l),be(c,n,l),s&&s.m(c,l),r=!0},p(c,l){s&&s.p&&(!r||l&16)&&yr(s,i,c,c[4],r?_r(i,c[4],l,null):vr(c[4]),null)},i(c){r||(se(s,c),r=!0)},o(c){de(s,c),r=!1},d(c){c&&(ye(e),ye(n)),s&&s.d(c)}}}function Bz(t){let e,n,r,i,s,c,l=t[0]&&qS(t);return{c(){e=ge("button"),e.innerHTML=`Help`,n=We(),l&&l.c(),r=Pi(),Le(e,"class","svelte-gb6dzm")},m(d,v){be(d,e,v),be(d,n,v),l&&l.m(d,v),be(d,r,v),i=!0,s||(c=Lt(e,"click",t[2]),s=!0)},p(d,[v]){d[0]?l?(l.p(d,v),v&1&&se(l,1)):(l=qS(d),l.c(),se(l,1),l.m(r.parentNode,r)):l&&(kn(),de(l,1,1,()=>{l=null}),Dn())},i(d){i||(se(l),i=!0)},o(d){de(l),i=!1},d(d){d&&(ye(e),ye(n),ye(r)),l&&l.d(d),s=!1,c()}}}function Vz(t,e,n){let{$$slots:r={},$$scope:i}=e,s=!1;const c=()=>n(0,s=!0),l=()=>n(0,s=!1);return t.$$set=d=>{"$$scope"in d&&n(4,i=d.$$scope)},[s,r,c,l,i]}class wT extends Zt{constructor(e){super(),Ht(this,e,Vz,Bz,Ut,{})}}function Uz(t){let e,n,r,i;const s=t[1].default,c=gr(s,t,t[0],null);return{c(){e=ge("a"),c&&c.c(),Le(e,"href","#")},m(l,d){be(l,e,d),c&&c.m(e,null),n=!0,r||(i=Lt(e,"click",kE(t[2])),r=!0)},p(l,[d]){c&&c.p&&(!n||d&1)&&yr(c,s,l,l[0],n?_r(s,l[0],d,null):vr(l[0]),null)},i(l){n||(se(c,l),n=!0)},o(l){de(c,l),n=!1},d(l){l&&ye(e),c&&c.d(l),r=!1,i()}}}function jz(t,e,n){let{$$slots:r={},$$scope:i}=e;function s(c){gn.call(this,t,c)}return t.$$set=c=>{"$$scope"in c&&n(0,i=c.$$scope)},[i,r,s]}class or extends Zt{constructor(e){super(),Ht(this,e,jz,Uz,Ut,{})}}const Gz=t=>({props:t&8}),WS=t=>({props:Hz(t[3])});function qz(t){let e;const n=t[1].default,r=gr(n,t,t[2],WS);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&12)&&yr(r,n,i,i[2],e?_r(n,i[2],s,Gz):vr(i[2]),WS)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function Wz(t){let e,n;return e=new SN({props:{openOn:t[0],popupClass:"popup",$$slots:{default:[qz,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&1&&(s.openOn=r[0]),i&12&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Hz(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function Zz(t,e,n){let{$$slots:r={},$$scope:i}=e,{openOn:s="hover"}=e;return t.$$set=c=>{"openOn"in c&&n(0,s=c.openOn),"$$scope"in c&&n(2,i=c.$$scope)},[s,r,i]}class xu extends Zt{constructor(e){super(),Ht(this,e,Zz,Wz,Ut,{openOn:0})}}function Xz(t,e){let n=new Set(t.getStyle().layers.filter(r=>r.type=="line").map(r=>r.id));if(e=="dataviz")return["Road network","Path"].filter(r=>n.has(r));if(e=="hybrid")return["Path","Road","Tunnel"].filter(r=>n.has(r));if(e=="streets-v2"){let r=[];for(let i of["road","bridge","tunnel"])for(let s of["link","minor","minor_construction","motorway","motorway_construction","motorway_link","path_pedestrian","secondary_tertiary","secondary_tertiary_construction","service_track","service_track_construction","street","trunk_primary","trunk_primary_construction","trunk_primary_link"])r.push(`${i}_${s}`);return r.filter(i=>n.has(i))}return e=="uk-openzoomstack-light"?t.getStyle().layers.filter(r=>r["source-layer"]=="roads"&&r.type=="line").map(r=>r.id):[]}const{window:$z}=h1;function Yz(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R;return M=VP(t[8][0]),{c(){e=ge("button"),e.textContent="Stop StreetView",n=We(),r=ge("fieldset"),i=ge("legend"),i.textContent="Source:",s=We(),c=ge("label"),l=ge("input"),d=nt(` - Google Street View`),v=We(),S=ge("label"),E=ge("input"),C=nt(` - Bing Streetside`),Le(e,"class","secondary"),Le(l,"type","radio"),l.__value="google",vo(l,l.__value),Le(E,"type","radio"),E.__value="bing",vo(E,E.__value),M.p(l,E)},m(N,B){be(N,e,B),be(N,n,B),be(N,r,B),te(r,i),te(r,s),te(r,c),te(c,l),l.checked=l.__value===t[0],te(c,d),te(r,v),te(r,S),te(S,E),E.checked=E.__value===t[0],te(S,C),k||(R=[Lt(e,"click",t[3]),Lt(l,"change",t[7]),Lt(E,"change",t[9])],k=!0)},p(N,B){B&1&&(l.checked=l.__value===N[0]),B&1&&(E.checked=E.__value===N[0])},d(N){N&&(ye(e),ye(n),ye(r)),M.r(),k=!1,Yr(R)}}}function Kz(t){let e,n,r;return{c(){e=ge("button"),e.textContent="StreetView",Le(e,"class","secondary")},m(i,s){be(i,e,s),n||(r=Lt(e,"click",t[2]),n=!0)},p:Ct,d(i){i&&ye(e),n=!1,r()}}}function Jz(t){let e,n,r;function i(l,d){return l[1]?Kz:Yz}let s=i(t),c=s(t);return{c(){c.c(),e=Pi()},m(l,d){c.m(l,d),be(l,e,d),n||(r=Lt($z,"keydown",t[4]),n=!0)},p(l,[d]){s===(s=i(l))&&c?c.p(l,d):(c.d(1),c=s(l),c&&(c.c(),c.m(e.parentNode,e)))},i:Ct,o:Ct,d(l){l&&ye(e),c.d(l),n=!1,r()}}}function Qz(t,e,n){let r;vt(t,u_,R=>n(1,r=R));let{map:i}=e,{maptilerBasemap:s}=e,c="google",l=[];function d(){Bt(u_,r=!1,r),i.on("click",S),i.getCanvas().style.cursor="crosshair";for(let R of Xz(i,s))l.push([R,i.getPaintProperty(R,"line-color")]),i.setPaintProperty(R,"line-color","cyan")}function v(){Bt(u_,r=!0,r),i.off("click",S),i.getCanvas().style.cursor="inherit";for(let[R,N]of l)i.setPaintProperty(R,"line-color",N);l=[]}ro(v);function S(R){let N=R.lngLat.lng,B=R.lngLat.lat;c=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${B},${N}&cbp=11,0,0,0,0`,"_blank"):c=="bing"&&window.open(`https://www.bing.com/maps?cp=${B}~${N}&style=x`,"_blank")}function E(R){!r&&R.key=="Escape"&&(R.stopPropagation(),v())}const C=[[]];function M(){c=this.__value,n(0,c)}function k(){c=this.__value,n(0,c)}return t.$$set=R=>{"map"in R&&n(5,i=R.map),"maptilerBasemap"in R&&n(6,s=R.maptilerBasemap)},[c,r,d,v,E,i,s,M,C,k]}class eF extends Zt{constructor(e){super(),Ht(this,e,Qz,Jz,Ut,{map:5,maptilerBasemap:6})}}function gi(t){return{id:t,beforeId:tF(t)}}function tF(t){let e=Fs(uu);if(!e){console.warn(`getBeforeId(${t}) called before map is ready. Z-ordering may be incorrect.`);return}let n,r=!1;for(let i=HS.length-1;i>=0;i--){let s=HS[i];if(s==t){r=!0;break}e.getLayer(s)&&(n=s)}if(!r)throw new Error(`Layer ID ${t} not defined in layerZorder`);return n}let lv=t=>t,uv=t=>t;const HS=[lv(uv("Background")),"neighbourhood-boundaries",lv("Ferry line"),"debug-borders","debug-crosses","debug-filters","cells","interior-roads","compare-route","shortcuts","shortcuts-focus",uv("Building"),"route-debug-nodes","route-points","route-lines","route-polygons","one-ways",uv("Road labels"),lv("road_label"),"animate-shortcuts","modal-filters","boundary","neighbourhood-boundary","auto-boundaries-areas","auto-boundaries-severances","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"];function nF(t){let e;return{c(){e=nt("Back")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function rF(t){let e,n,r,i;return e=new or({props:{$$slots:{default:[nF]},$$scope:{ctx:t}}}),e.$on("click",t[2]),{c(){je(e.$$.fragment)},m(s,c){Be(e,s,c),n=!0,r||(i=Lt(window,"keydown",t[1]),r=!0)},p(s,[c]){const l={};c&8&&(l.$$scope={dirty:c,ctx:s}),e.$set(l)},i(s){n||(se(e.$$.fragment,s),n=!0)},o(s){de(e.$$.fragment,s),n=!1},d(s){Ve(e,s),r=!1,i()}}}function iF(t){let e=vu();function n(i){i.key=="Escape"&&(i.stopPropagation(),e("click"))}return[e,n,()=>e("click")]}class wy extends Zt{constructor(e){super(),Ht(this,e,iF,rF,Ut,{})}}function oF(t){let e,n;const r=[gi("one-ways"),{filter:["all",["==",["get","kind"],"interior_road"],["!=",["get","direction"],"both"]]},{layout:{"icon-image":"oneway-arrow","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 i={};for(let s=0;s({}),ZS=t=>({}),lF=t=>({}),XS=t=>({});function uF(t){let e,n;const r=[gi("neighbourhood-boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let i={};for(let s=0;s{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function hF(t){let e,n,r,i,s,c,l,d,v;e=new No({props:{data:YS(t[3]),$$slots:{default:[uF]},$$scope:{ctx:t}}});const S=[gi("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let E={};for(let N=0;Nn.properties.kind=="boundary");return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]],e.geometry.coordinates[0]]}}}function pF(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{gjInput:d}=e,{interactive:v=!0}=e,{onClickLine:S=(C,M)=>{}}=e;const E=C=>v&&S(C.detail.features[0],C.detail.event.lngLat);return t.$$set=C=>{"gjInput"in C&&n(4,d=C.gjInput),"interactive"in C&&n(0,v=C.interactive),"onClickLine"in C&&n(1,S=C.onClickLine),"$$scope"in C&&n(8,l=C.$$scope)},t.$$.update=()=>{t.$$.dirty&16&&n(3,r=l1(d)),t.$$.dirty&16&&n(5,i=Math.max(...d.features.map(C=>C.properties.kind=="interior_road"?C.properties.shortcuts:0))),t.$$.dirty&32&&n(2,s=Of(["interpolate-hcl",["linear"],["get","shortcuts"],0,"white",1,"#F19A93",i,"#A32015"],"blue"))},[v,S,s,r,d,i,c,E,l]}class Sy extends Zt{constructor(e){super(),Ht(this,e,pF,fF,Ut,{gjInput:4,interactive:0,onClickLine:1})}}function dF(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function mF(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function gF(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function _F(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;return s=new or({props:{$$slots:{default:[dF]},$$scope:{ctx:t}}}),s.$on("click",t[4]),d=new or({props:{$$slots:{default:[mF]},$$scope:{ctx:t}}}),d.$on("click",t[5]),E=new or({props:{$$slots:{default:[gF]},$$scope:{ctx:t}}}),E.$on("click",t[6]),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),je(d.$$.fragment),v=We(),S=ge("li"),je(E.$$.fragment),C=We(),M=ge("li"),M.textContent="Debug mode",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(R,N){be(R,e,N),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),Be(E,S,null),te(r,C),te(r,M),k=!0},p(R,N){const B={};N&256&&(B.$$scope={dirty:N,ctx:R}),s.$set(B);const F={};N&256&&(F.$$scope={dirty:N,ctx:R}),d.$set(F);const G={};N&256&&(G.$$scope={dirty:N,ctx:R}),E.$set(G)},i(R){k||(se(s.$$.fragment,R),se(d.$$.fragment,R),se(E.$$.fragment,R),k=!0)},o(R){de(s.$$.fragment,R),de(d.$$.fragment,R),de(E.$$.fragment,R),k=!1},d(R){R&&ye(e),Ve(s),Ve(d),Ve(E)}}}function yF(t){let e,n,r;return n=new wy({}),n.$on("click",t[3]),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","sidebar")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p:Ct,i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function vF(t){let e,n;return e=new J_({props:{properties:t[7]}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&128&&(s.properties=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function bF(t){let e,n,r;return n=new xu({props:{openOn:"hover",$$slots:{default:[vF,({props:i})=>({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:t}}}),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","line-popup")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&384&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function xF(t){let e,n;return e=new J_({props:{properties:t[7]}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&128&&(s.properties=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function wF(t){let e,n;return e=new xu({props:{openOn:"hover",$$slots:{default:[xF,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&384&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function SF(t){let e,n;return e=new J_({props:{properties:t[7]}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&128&&(s.properties=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function EF(t){let e,n;return e=new xu({props:{openOn:"hover",$$slots:{default:[SF,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&384&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function IF(t){let e,n,r,i;const s=[gi("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let c={$$slots:{default:[wF]},$$scope:{ctx:t}};for(let v=0;v({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&384&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function LF(t){let e,n;const r=[gi("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let i={$$slots:{default:[TF]},$$scope:{ctx:t}};for(let s=0;sn(0,r=S)),vt(t,bn,S=>n(1,i=S)),[r,i,(S,E)=>window.open(kr(S.properties).way,"_blank"),()=>Bt(bn,i={mode:"neighbourhood"},i),()=>Bt(bn,i={mode:"title"},i),()=>Bt(bn,i={mode:"network"},i),()=>Bt(bn,i={mode:"neighbourhood"},i)]}class kF extends Zt{constructor(e){super(),Ht(this,e,AF,MF,Ut,{})}}function KS(t,e,n){const r=t.slice();return r[7]=e[n][0],r[8]=e[n][1],r[9]=e[n][2],r}function JS(t){let e,n,r,i,s,c,l=t[8]+"",d,v,S,E,C;function M(){return t[3](t[7])}return{c(){e=ge("button"),n=ge("img"),i=We(),s=ge("br"),c=We(),d=nt(l),v=We(),ai(n.src,r=`/ltn//filters/${t[7]}_icon.gif`)||Le(n,"src",r),Le(n,"width","80"),Le(n,"alt",t[8]),Le(e,"class","outline"),lr(e,"width","100%"),e.disabled=S=t[0]==t[7]},m(k,R){be(k,e,R),te(e,n),te(e,i),te(e,s),te(e,c),te(e,d),te(e,v),E||(C=Lt(e,"click",M),E=!0)},p(k,R){t=k,R&1&&S!==(S=t[0]==t[7])&&(e.disabled=S)},d(k){k&&ye(e),E=!1,C()}}}function DF(t){let e,n,r,i,s,c,l,d,v,S,E,C,M=t[1][2]+"",k,R,N,B,F,G,H=zo(t[2]),K=[];for(let ae=0;ae({6:r}),({dialog:r})=>r?64:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&4163&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function NF(t,e,n){let r,i;vt(t,jv,v=>n(0,i=v));let s=[["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 c=v=>Bt(jv,i=v,i),l=v=>kr(v).close();function d(v){gn.call(this,t,v)}return t.$$.update=()=>{t.$$.dirty&1&&n(1,r=s.find(v=>v[0]==i))},[i,r,s,c,l,d]}class OF extends Zt{constructor(e){super(),Ht(this,e,NF,RF,Ut,{})}}function QS(t){let e,n;return e=new No({props:{data:t[0],$$slots:{default:[zF]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&1&&(s.data=r[0]),i&64&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function zF(t){let e,n;const r=[gi("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let i={};for(let s=0;s{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function BF(t,e,n){let{map:r}=e,i=null;const s=vu();r.on("dragstart",c),r.on("mousemove",l),r.on("mouseup",d),ro(()=>{r.dragPan.enable(),r.off("dragstart",c),r.off("mousemove",l),r.off("mouseup",d)});function c(){r.dragPan.disable(),n(0,i={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function l(v){i&&(i.geometry.coordinates.push(v.lngLat.toArray()),n(0,i))}function d(){i&&(s("done",i),n(0,i=null))}return t.$$set=v=>{"map"in v&&n(1,r=v.map)},[i,r]}class VF extends Zt{constructor(e){super(),Ht(this,e,BF,FF,Ut,{map:1})}}function UF(t){let e;const n=t[3].default,r=gr(n,t,t[5],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&32)&&yr(r,n,i,i[5],e?_r(n,i[5],s,null):vr(i[5]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function jF(t){let e,n;const r=[gi("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}},{paint:{"icon-opacity":["case",["get","edited"],1,.5]}}];let i={$$slots:{default:[UF]},$$scope:{ctx:t}};for(let s=0;sn(1,i=v)),vt(t,qu,v=>n(2,s=v));let{$$slots:c={},$$scope:l}=e;function d(v){gn.call(this,t,v)}return t.$$set=v=>{"$$scope"in v&&n(5,l=v.$$scope)},t.$$.update=()=>{t.$$.dirty&6&&n(0,r=s>0?JSON.parse(i.renderModalFilters()):null)},[r,i,s,c,d,l]}class Ey extends Zt{constructor(e){super(),Ht(this,e,qF,GF,Ut,{})}}var WF=Object.defineProperty,fr=(t,e)=>WF(t,"name",{value:e,configurable:!0}),HF=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!zd(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=u1(e),i=u1(n);return r.every(s=>i.some(c=>this.compare(s,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(s=>i.some(c=>this.compareLine(s,c,1,!0)))}return!1}compareGeometryCollection(e,n){return zd(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?tC(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return zd(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};fr(HF,"GeojsonEquality");function zd(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}fr(zd,"sameLength");function u1(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}fr(u1,"explode");var zs=63710088e-1,ST={centimeters:zs*100,centimetres:zs*100,degrees:360/(2*Math.PI),feet:zs*3.28084,inches:zs*39.37,kilometers:zs/1e3,kilometres:zs/1e3,meters:zs,metres:zs,miles:zs/1609.344,millimeters:zs*1e3,millimetres:zs*1e3,nauticalmiles:zs/1852,radians:1,yards:zs*1.0936},eE={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,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function mc(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}fr(mc,"feature");function ZF(t,e,n={}){switch(t){case"Point":return ip(e).geometry;case"LineString":return hb(e).geometry;case"Polygon":return cb(e).geometry;case"MultiPoint":return IT(e).geometry;case"MultiLineString":return ET(e).geometry;case"MultiPolygon":return CT(e).geometry;default:throw new Error(t+" is invalid")}}fr(ZF,"geometry");function ip(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!op(t[0])||!op(t[1]))throw new Error("coordinates must contain numbers");return mc({type:"Point",coordinates:t},e,n)}fr(ip,"point");function XF(t,e,n={}){return Iy(t.map(r=>ip(r,e)),n)}fr(XF,"points");function cb(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let s=0;scb(r,e)),n)}fr($F,"polygons");function hb(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return mc({type:"LineString",coordinates:t},e,n)}fr(hb,"lineString");function YF(t,e,n={}){return Iy(t.map(r=>hb(r,e)),n)}fr(YF,"lineStrings");function Iy(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}fr(Iy,"featureCollection");function ET(t,e,n={}){return mc({type:"MultiLineString",coordinates:t},e,n)}fr(ET,"multiLineString");function IT(t,e,n={}){return mc({type:"MultiPoint",coordinates:t},e,n)}fr(IT,"multiPoint");function CT(t,e,n={}){return mc({type:"MultiPolygon",coordinates:t},e,n)}fr(CT,"multiPolygon");function KF(t,e,n={}){return mc({type:"GeometryCollection",geometries:t},e,n)}fr(KF,"geometryCollection");function JF(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}fr(JF,"round");function fb(t,e="kilometers"){const n=ST[e];if(!n)throw new Error(e+" units is invalid");return t*n}fr(fb,"radiansToLength");function Cy(t,e="kilometers"){const n=ST[e];if(!n)throw new Error(e+" units is invalid");return t/n}fr(Cy,"lengthToRadians");function QF(t,e){return mm(Cy(t,e))}fr(QF,"lengthToDegrees");function e6(t){let e=t%360;return e<0&&(e+=360),e}fr(e6,"bearingToAzimuth");function mm(t){return t%(2*Math.PI)*180/Math.PI}fr(mm,"radiansToDegrees");function pa(t){return t%360*Math.PI/180}fr(pa,"degreesToRadians");function t6(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return fb(Cy(t,e),n)}fr(t6,"convertLength");function n6(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=eE[e];if(!r)throw new Error("invalid original units");const i=eE[n];if(!i)throw new Error("invalid final units");return t/r*i}fr(n6,"convertArea");function op(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}fr(op,"isNumber");function r6(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}fr(r6,"isObject");function i6(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!op(e))throw new Error("bbox must only contain numbers")})}fr(i6,"validateBBox");function o6(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}fr(o6,"validateId");var s6=Object.defineProperty,gc=(t,e)=>s6(t,"name",{value:e,configurable:!0});function sp(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return[...t.geometry.coordinates];if(t.type==="Point")return[...t.coordinates]}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return[...t];throw new Error("coord must be GeoJSON Point or an Array of numbers")}gc(sp,"getCoord");function a6(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}gc(a6,"getCoords");function TT(t){if(t.length>1&&op(t[0])&&op(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return TT(t[0]);throw new Error("coordinates must only contain numbers")}gc(TT,"containsNumber");function l6(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}gc(l6,"geojsonType");function u6(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}gc(u6,"featureOf");function c6(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(const r of t.features){if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.geometry.type)}}gc(c6,"collectionOf");function LT(t){return t.type==="Feature"?t.geometry:t}gc(LT,"getGeom");function h6(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}gc(h6,"getType");var f6=Object.defineProperty,PT=(t,e)=>f6(t,"name",{value:e,configurable:!0});function pb(t,e,n={}){if(n.final===!0)return MT(t,e);const r=sp(t),i=sp(e),s=pa(r[0]),c=pa(i[0]),l=pa(r[1]),d=pa(i[1]),v=Math.sin(c-s)*Math.cos(d),S=Math.cos(l)*Math.sin(d)-Math.sin(l)*Math.cos(d)*Math.cos(c-s);return mm(Math.atan2(v,S))}PT(pb,"bearing");function MT(t,e){let n=pb(e,t);return n=(n+180)%360,n}PT(MT,"calculateFinalBearing");var p6=Object.defineProperty,d6=(t,e)=>p6(t,"name",{value:e,configurable:!0});function AT(t,e,n,r={}){const i=sp(t),s=pa(i[0]),c=pa(i[1]),l=pa(n),d=Cy(e,r.units),v=Math.asin(Math.sin(c)*Math.cos(d)+Math.cos(c)*Math.sin(d)*Math.cos(l)),S=s+Math.atan2(Math.sin(l)*Math.sin(d)*Math.cos(c),Math.cos(d)-Math.sin(c)*Math.sin(v)),E=mm(S),C=mm(v);return ip([E,C],r.properties)}d6(AT,"destination");var m6=Object.defineProperty,g6=(t,e)=>m6(t,"name",{value:e,configurable:!0});function kT(t,e,n={}){var r=sp(t),i=sp(e),s=pa(i[1]-r[1]),c=pa(i[0]-r[0]),l=pa(r[1]),d=pa(i[1]),v=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return fb(2*Math.atan2(Math.sqrt(v),Math.sqrt(1-v)),n.units)}g6(kT,"distance");var _6=Object.defineProperty,y6=(t,e)=>_6(t,"name",{value:e,configurable:!0});function DT(t,e,n={}){const i=LT(t).coordinates;let s=0;for(let c=0;c=s&&c===i.length-1);c++)if(s>=e){const l=e-s;if(l){const d=pb(i[c],i[c-1])-180;return AT(i[c],l,d,n)}else return ip(i[c])}else s+=kT(i[c],i[c+1],n);return ip(i[i.length-1])}y6(DT,"along");var v6=DT;function b6(t){let e,n;const r=[gi("animate-shortcuts"),{paint:{"circle-radius":10,"circle-color":"purple","circle-stroke-color":"black","circle-stroke-width":1}}];let i={};for(let s=0;sclearInterval(l));function d(){return r.features.map(M=>1/M.properties.directness).reduce((M,k)=>M+k,0)}function v(){return r.features.length==0?[]:Array.from({length:w6},S)}function S(){let M=Math.random()*i,k=0;for(let[R,N]of r.features.entries())if(k+=1/N.properties.directness,Mv6(r.features[M],k,{units:"kilometers"}))}}function C(){for(let[M,k]of s.entries())k.distance+=E6,k.distance>=r.features[k.idx].properties.length_meters/1e3&&(s[M]=S());n(0,c=E())}return t.$$set=M=>{"paths"in M&&n(1,r=M.paths)},t.$$.update=()=>{t.$$.dirty&2&&r&&(i=d(),s=v())},[c,r]}class C6 extends Zt{constructor(e){super(),Ht(this,e,I6,x6,Ut,{paths:1})}}function T6(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function L6(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function P6(t){let e;return{c(){e=ge("p"),e.textContent=`Now that you've defined a neighbourhood boundary, you can see the +`)}return t.toString()};Hi.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.computeLabel(t)}};Hi.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],r=this.iterator();r.hasNext();)for(var i=r.next(),s=i.getLabel(),c=0;c<2;c++)s.isLine(c)&&s.getLocation(c)===Fe.BOUNDARY&&(n[c]=!0);for(var l=this.iterator();l.hasNext();)for(var d=l.next(),v=d.getLabel(),S=0;S<2;S++)if(v.isAnyNull(S)){var E=Fe.NONE;if(n[S])E=Fe.EXTERIOR;else{var C=d.getCoordinate();E=e.getLocation(S,C,t)}v.setAllLocationsIfNull(S,E)}};Hi.prototype.getDegree=function(){return this._edgeMap.size()};Hi.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null};Hi.prototype.interfaces_=function(){return[]};Hi.prototype.getClass=function(){return Hi};var KO=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var r=null,i=null,s=this._SCANNING_FOR_INCOMING,c=0;c=0;s--){var c=n._edgeList.get(s),l=c.getSym();i===null&&(i=l),r!==null&&l.setNext(r),r=c}i.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),s=r.getDepth(ut.LEFT),c=r.getDepth(ut.RIGHT),l=this.computeDepths(i+1,this._edgeList.size(),s),d=this.computeDepths(0,i,l);if(d!==c)throw new Pl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var v=arguments[0],S=arguments[1],E=arguments[2],C=E,M=v;M=0;l--){var d=r._resultAreaEdgeList.get(l),v=d.getSym();switch(i===null&&d.getEdgeRing()===n&&(i=d),c){case r._SCANNING_FOR_INCOMING:if(v.getEdgeRing()!==n)continue;s=v,c=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(d.getEdgeRing()!==n)continue;s.setNextMin(d),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(fn.isTrue(i!==null,"found null for first outgoing dirEdge"),fn.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),s.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var s=arguments[0],c=0,l=this.iterator();l.hasNext();){var d=l.next();d.getEdgeRing()===s&&c++}return c}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Fe.NONE,r=this.iterator();r.hasNext();){var i=r.next(),s=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Fe.INTERIOR;break}if(s.isInResult()){n=Fe.EXTERIOR;break}}}if(n===Fe.NONE)return null;for(var c=n,l=this.iterator();l.hasNext();){var d=l.next(),v=d.getSym();d.isLineEdge()?d.getEdge().setCovered(c===Fe.INTERIOR):(d.isInResult()&&(c=Fe.EXTERIOR),v.isInResult()&&(c=Fe.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new Wn(Fe.NONE);for(var i=this.iterator();i.hasNext();)for(var s=i.next(),c=s.getEdge(),l=c.getLabel(),d=0;d<2;d++){var v=l.getLocation(d);(v===Fe.INTERIOR||v===Fe.BOUNDARY)&&r._label.setLocation(d,Fe.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Hi),WC=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new by(n,new KO)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Wf),du=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};du.prototype.compareTo=function(t){var e=t,n=du.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};du.prototype.interfaces_=function(){return[Es]};du.prototype.getClass=function(){return du};du.orientation=function(t){return Sn.increasingDirection(t)===1};du.compareOriented=function(t,e,n,r){for(var i=e?1:-1,s=r?1:-1,c=e?t.length:-1,l=r?n.length:-1,d=e?0:t.length-1,v=r?0:n.length-1;;){var S=t[d].compareTo(n[v]);if(S!==0)return S;d+=i,v+=s;var E=d===c,C=v===l;if(E&&!C)return-1;if(!E&&C)return 1;if(E&&C)return 0}};var Hs=function(){this._edges=new _t,this._ocaMap=new qi};Hs.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),s=0;s0&&t.print(","),t.print(i[s].x+" "+i[s].y);t.println(")")}t.print(") ")};Hs.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};Hs.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);s||r--;var c=new Array(r).fill(null),l=0;c[l++]=new ze(t.coord);for(var d=t.segmentIndex+1;d<=e.segmentIndex;d++)c[l++]=n.edge.pts[d];return s&&(c[l]=e.coord),new F_(c,new Wn(this.edge._label))};$a.prototype.add=function(t,e,n){var r=new Sa(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};$a.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};$a.prototype.interfaces_=function(){return[]};$a.prototype.getClass=function(){return $a};var oc=function(){};oc.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new _t;r.add(new _a(n));do{var i=e.findChainEnd(t,n);r.add(new _a(i)),n=i}while(nn?e:n};Al.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ri.prototype.getDelta=function(t){return this._depth[t][ut.RIGHT]-this._depth[t][ut.LEFT]};Ri.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Fe.EXTERIOR:Fe.INTERIOR};Ri.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ri.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===Fe.EXTERIOR||i===Fe.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ri.depthAtLocation(i):t._depth[n][r]+=Ri.depthAtLocation(i))}else if(arguments.length===3){var s=arguments[0],c=arguments[1],l=arguments[2];l===Fe.INTERIOR&&this._depth[s][c]++}};Ri.prototype.interfaces_=function(){return[]};Ri.prototype.getClass=function(){return Ri};Ri.depthAtLocation=function(t){return t===Fe.EXTERIOR?0:t===Fe.INTERIOR?1:Ri.NULL_VALUE};HC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ri,HC);var F_=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new $a(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ri,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,Wn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var s=!0,c=!0,l=this.pts.length,d=0;d0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Al(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Vt;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxys;if(c)return!1;var l=this.intersectsToleranceSquare(t,e);return fn.isTrue(!(c&&l),"Found bad envelope test"),l};xo.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ze(this._maxx,this._maxy),this._corner[1]=new ze(this._minx,this._maxy),this._corner[2]=new ze(this._minx,this._miny),this._corner[3]=new ze(this._maxx,this._miny)};xo.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};xo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};xo.prototype.getCoordinate=function(){return this._originalPt};xo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};xo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=xo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Vt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};xo.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};xo.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||t.equals(this._pt)||e.equals(this._pt))};xo.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return this.intersects(n,r)?(t.addIntersection(this.getCoordinate(),e),!0):!1};xo.prototype.interfaces_=function(){return[]};xo.prototype.getClass=function(){return xo};XC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(xo,XC);var hm=function(){this.tempEnv1=new Vt,this.selectedSegment=new jt};hm.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};hm.prototype.interfaces_=function(){return[]};hm.prototype.getClass=function(){return hm};var $f=function(){this._index=null;var t=arguments[0];this._index=t},$C={HotPixelSnapAction:{configurable:!0}};$f.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),s=new YC(e,n,r);return this._index.query(i,{interfaces_:function(){return[fu]},visitItem:function(c){var l=c;l.select(i,s)}}),s.isNodeAdded()}};$f.prototype.interfaces_=function(){return[]};$f.prototype.getClass=function(){return $f};$C.HotPixelSnapAction.get=function(){return YC};Object.defineProperties($f,$C);var YC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(hm),eh=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new _t};eh.prototype.processIntersections=function(t,e,n,r){var i=this;if(t===n&&e===r)return null;var s=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];if(this._li.computeIntersection(s,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var v=0;v=0;e--){try{t.bufferReducedPrecision(e)}catch(s){if(s instanceof Pl)t._saveException=s;else throw s}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=Di.precisionScaleFactor(this._argGeom,this._distance,n),i=new Un(r);this.bufferFixedPrecision(i)}};Di.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Un.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Di.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Di.prototype.bufferOriginalPrecision=function(){try{var t=new no(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof Tl)this._saveException=e;else throw e}finally{}};Di.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Di.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Di.prototype.interfaces_=function(){return[]};Di.prototype.getClass=function(){return Di};Di.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Di(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Yt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1],c=arguments[2],l=new Di(i);l.setQuadrantSegments(c);var d=l.getResultGeometry(s);return d}else if(arguments[2]instanceof Vn&&arguments[0]instanceof Yt&&typeof arguments[1]=="number"){var v=arguments[0],S=arguments[1],E=arguments[2],C=new Di(v,E),M=C.getResultGeometry(S);return M}}else if(arguments.length===4){var k=arguments[0],R=arguments[1],F=arguments[2],U=arguments[3],z=new Di(k);z.setQuadrantSegments(F),z.setEndCapStyle(U);var G=z.getResultGeometry(R);return G}};Di.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=is.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),s=e>0?e:0,c=i+2*s,l=Math.trunc(Math.log(c)/Math.log(10)+1),d=n-l,v=Math.pow(10,d);return v};gp.CAP_ROUND.get=function(){return Vn.CAP_ROUND};gp.CAP_BUTT.get=function(){return Vn.CAP_FLAT};gp.CAP_FLAT.get=function(){return Vn.CAP_FLAT};gp.CAP_SQUARE.get=function(){return Vn.CAP_SQUARE};gp.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Di,gp);var Qi=function(){this._pt=[new ze,new ze],this._distance=rn.NaN,this._isNull=!0};Qi.prototype.getCoordinates=function(){return this._pt};Qi.prototype.getCoordinate=function(t){return this._pt[t]};Qi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};Qi.prototype.interfaces_=function(){return[]};Qi.prototype.getClass=function(){return Qi};var Va=function(){};Va.prototype.interfaces_=function(){return[]};Va.prototype.getClass=function(){return Va};Va.computeDistance=function(){if(arguments[2]instanceof Qi&&arguments[0]instanceof Dr&&arguments[1]instanceof ze)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new jt,s=0;s0||this._isIn?Fe.INTERIOR:Fe.EXTERIOR)};Zs.prototype.interfaces_=function(){return[]};Zs.prototype.getClass=function(){return Zs};var eo=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._component=r,this._segIndex=i,this._pt=s}},KC={INSIDE_AREA:{configurable:!0}};eo.prototype.isInsideArea=function(){return this._segIndex===eo.INSIDE_AREA};eo.prototype.getCoordinate=function(){return this._pt};eo.prototype.getGeometryComponent=function(){return this._component};eo.prototype.getSegmentIndex=function(){return this._segIndex};eo.prototype.interfaces_=function(){return[]};eo.prototype.getClass=function(){return eo};KC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(eo,KC);var au=function(t){this._pts=t||null};au.prototype.filter=function(t){t instanceof Bo&&this._pts.add(t)};au.prototype.interfaces_=function(){return[va]};au.prototype.getClass=function(){return au};au.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Bo?Ws.singletonList(t):au.getPoints(t,new _t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Bo?n.add(e):e instanceof io&&e.apply(new au(n)),n}};var nh=function(){this._locations=null;var t=arguments[0];this._locations=t};nh.prototype.filter=function(t){(t instanceof Bo||t instanceof Dr||t instanceof ui)&&this._locations.add(new eo(t,0,t.getCoordinate()))};nh.prototype.interfaces_=function(){return[va]};nh.prototype.getClass=function(){return nh};nh.getLocations=function(t){var e=new _t;return t.apply(new nh(e)),e};var Oi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Zs,this._minDistanceLocation=null,this._minDistance=rn.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Oi.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,s=Sl.getPolygons(this._geom[n]);if(s.size()>0){var c=nh.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,s,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Kt(arguments[0],Us)&&Kt(arguments[1],Us)){for(var l=arguments[0],d=arguments[1],v=arguments[2],S=0;Sthis._minDistance)return null;for(var i=e.getCoordinates(),s=n.getCoordinate(),c=0;cthis._minDistance)return null;for(var M=S.getCoordinates(),k=E.getCoordinates(),R=0;Rthis._distance&&this.initialize(e,n,r)}};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};var ca=function(){};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};ca.computeDistance=function(){if(arguments[2]instanceof ji&&arguments[0]instanceof Dr&&arguments[1]instanceof ze)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new jt,i=t.getCoordinates(),s=0;s1||t<=0)throw new br("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};bs.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};bs.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};bs.prototype.computeOrientedDistance=function(t,e,n){var r=new rh(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new _u(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};bs.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};bs.prototype.interfaces_=function(){return[]};bs.prototype.getClass=function(){return bs};bs.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new bs(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2],c=new bs(r,i);return c.setDensifyFraction(s),c.distance()}};rb.MaxPointDistanceFilter.get=function(){return rh};rb.MaxDensifiedByFractionDistanceFilter.get=function(){return _u};Object.defineProperties(bs,rb);var rh=function(){this._maxPtDist=new ji,this._minPtDist=new ji,this._euclideanDist=new ca,this._geom=null;var t=arguments[0];this._geom=t};rh.prototype.filter=function(t){this._minPtDist.initialize(),ca.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};rh.prototype.getMaxPointDistance=function(){return this._maxPtDist};rh.prototype.interfaces_=function(){return[Wa]};rh.prototype.getClass=function(){return rh};var _u=function(){this._maxPtDist=new ji,this._minPtDist=new ji,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};_u.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),s=(i.x-r.x)/this._numSubSegs,c=(i.y-r.y)/this._numSubSegs,l=0;ln){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+js.toLineString(i[0],i[1])+")"}};Oo.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Oo.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Oo.VERBOSE&&Ni.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Oo.prototype.checkNegativeValid=function(){if(!(this._input instanceof ui||this._input instanceof Ga||this._input instanceof io))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};Oo.prototype.getErrorIndicator=function(){return this._errorIndicator};Oo.prototype.checkMinimumDistance=function(t,e,n){var r=new Oi(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=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")};zi.prototype.report=function(t){if(!zi.VERBOSE)return null;Ni.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};zi.prototype.getErrorMessage=function(){return this._errorMsg};zi.prototype.interfaces_=function(){return[]};zi.prototype.getClass=function(){return zi};zi.isValidMsg=function(t,e,n){var r=new zi(t,e,n);return r.isValid()?null:r.getErrorMessage()};zi.isValid=function(t,e,n){var r=new zi(t,e,n);return!!r.isValid()};ob.VERBOSE.get=function(){return!1};ob.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(zi,ob);var Ia=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ia.prototype.getCoordinates=function(){return this._pts};Ia.prototype.size=function(){return this._pts.length};Ia.prototype.getCoordinate=function(t){return this._pts[t]};Ia.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ia.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Jc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};Ia.prototype.setData=function(t){this._data=t};Ia.prototype.getData=function(){return this._data};Ia.prototype.toString=function(){return js.toLineString(new Vr(this._pts))};Ia.prototype.interfaces_=function(){return[Xa]};Ia.prototype.getClass=function(){return Ia};var Ti=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new _t,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Ti.prototype.getInteriorIntersection=function(){return this._interiorIntersection};Ti.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};Ti.prototype.getIntersectionSegments=function(){return this._intSegments};Ti.prototype.count=function(){return this._intersectionCount};Ti.prototype.getIntersections=function(){return this._intersections};Ti.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Ti.prototype.setKeepIntersections=function(t){this._keepIntersections=t};Ti.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(t,e)||this.isEndSegment(n,r);if(!i)return null}var s=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];this._li.computeIntersection(s,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=c,this._intSegments[2]=l,this._intSegments[3]=d,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};Ti.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};Ti.prototype.hasIntersection=function(){return this._interiorIntersection!==null};Ti.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};Ti.prototype.interfaces_=function(){return[ic]};Ti.prototype.getClass=function(){return Ti};Ti.createAllIntersectionsFinder=function(t){var e=new Ti(t);return e.setFindAllIntersections(!0),e};Ti.createAnyIntersectionFinder=function(t){return new Ti(t)};Ti.createIntersectionCounter=function(t){var e=new Ti(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Xs=function(){this._li=new pc,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Xs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Xs.prototype.getIntersections=function(){return this._segInt.getIntersections()};Xs.prototype.isValid=function(){return this.execute(),this._isValid};Xs.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Xs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Ti(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new tb;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Xs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Pl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Xs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+js.toLineString(t[0],t[1])+" and "+js.toLineString(t[2],t[3])};Xs.prototype.interfaces_=function(){return[]};Xs.prototype.getClass=function(){return Xs};Xs.computeIntersections=function(t){var e=new Xs(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var ac=function t(){this._nv=null;var e=arguments[0];this._nv=new Xs(t.toSegmentStrings(e))};ac.prototype.checkValid=function(){this._nv.checkValid()};ac.prototype.interfaces_=function(){return[]};ac.prototype.getClass=function(){return ac};ac.toSegmentStrings=function(t){for(var e=new _t,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Ia(r.getCoordinates(),r))}return e};ac.checkValid=function(t){var e=new ac(t);e.checkValid()};var ih=function(t){this._mapOp=t};ih.prototype.map=function(t){for(var e=this,n=new _t,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};wo.prototype.interfaces_=function(){return[]};wo.prototype.getClass=function(){return wo};var Ka=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new jt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Dr&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Ka.prototype.snapVertices=function(t,e){for(var n=this,r=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(c+1,new ze(s),!1)}};Ka.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=rn.MAX_VALUE,i=-1,s=0;se&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return Math.min(Ur.computeOverlaySnapTolerance(i),Ur.computeOverlaySnapTolerance(s))}};Ur.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Ur.SNAP_PRECISION_FACTOR;return r};Ur.snapToSelf=function(t,e,n){var r=new Ur(t);return r.snapToSelf(e,n)};JC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Ur,JC);var QC=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var i=new Ka(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),s=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(s)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wo),Ji=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Ji.prototype.getCommon=function(){return rn.longBitsToDouble(this._commonBits)};Ji.prototype.add=function(t){var e=rn.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Ji.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Ji.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Ji.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Ji.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Ji.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=rn.longBitsToDouble(t),n=rn.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),s=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return s}};Ji.prototype.interfaces_=function(){return[]};Ji.prototype.getClass=function(){return Ji};Ji.getBit=function(t,e){var n=1<>52};Ji.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(Ji.getBit(t,r)!==Ji.getBit(e,r))return n;n++}return 52};var yu=function(){this._commonCoord=null,this._ccFilter=new sh},sb={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};yu.prototype.addCommonBits=function(t){var e=new vu(this._commonCoord);t.apply(e),t.geometryChanged()};yu.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new ze(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new vu(e);return t.apply(n),t.geometryChanged(),t};yu.prototype.getCommonCoordinate=function(){return this._commonCoord};yu.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};yu.prototype.interfaces_=function(){return[]};yu.prototype.getClass=function(){return yu};sb.CommonCoordinateFilter.get=function(){return sh};sb.Translater.get=function(){return vu};Object.defineProperties(yu,sb);var sh=function(){this._commonBitsX=new Ji,this._commonBitsY=new Ji};sh.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};sh.prototype.getCommonCoordinate=function(){return new ze(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};sh.prototype.interfaces_=function(){return[Wa]};sh.prototype.getClass=function(){return sh};var vu=function(){this.trans=null;var t=arguments[0];this.trans=t};vu.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)};vu.prototype.isDone=function(){return!1};vu.prototype.isGeometryChanged=function(){return!0};vu.prototype.interfaces_=function(){return[Gs]};vu.prototype.getClass=function(){return vu};var Li=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Li.prototype.selfSnap=function(t){var e=new Ur(t),n=e.snapTo(t,this._snapTolerance);return n};Li.prototype.removeCommonBits=function(t){this._cbr=new yu,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};Li.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};Li.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=ln.overlayOp(e[0],e[1],t);return this.prepareResult(n)};Li.prototype.checkValid=function(t){t.isValid()||Ni.out.println("Snapped geometry is invalid")};Li.prototype.computeSnapTolerance=function(){this._snapTolerance=Ur.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};Li.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Ur.snap(e[0],e[1],this._snapTolerance);return n};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.overlayOp=function(t,e,n){var r=new Li(t,e);return r.getResultGeometry(n)};Li.union=function(t,e){return Li.overlayOp(t,e,ln.UNION)};Li.intersection=function(t,e){return Li.overlayOp(t,e,ln.INTERSECTION)};Li.symDifference=function(t,e){return Li.overlayOp(t,e,ln.SYMDIFFERENCE)};Li.difference=function(t,e){return Li.overlayOp(t,e,ln.DIFFERENCE)};var ao=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};ao.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=ln.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(s){if(s instanceof Tl)r=s;else throw s}finally{}if(!n)try{e=Li.overlayOp(this._geom[0],this._geom[1],t)}catch(s){throw s instanceof Tl?r:s}finally{}return e};ao.prototype.interfaces_=function(){return[]};ao.prototype.getClass=function(){return ao};ao.overlayOp=function(t,e,n){var r=new ao(t,e);return r.getResultGeometry(n)};ao.union=function(t,e){return ao.overlayOp(t,e,ln.UNION)};ao.intersection=function(t,e){return ao.overlayOp(t,e,ln.INTERSECTION)};ao.symDifference=function(t,e){return ao.overlayOp(t,e,ln.SYMDIFFERENCE)};ao.difference=function(t,e){return ao.overlayOp(t,e,ln.DIFFERENCE)};var fm=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};fm.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};fm.prototype.interfaces_=function(){return[]};fm.prototype.getClass=function(){return fm};var jo=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=s}},ab={INSERT:{configurable:!0},DELETE:{configurable:!0}};jo.prototype.isDelete=function(){return this._eventType===jo.DELETE};jo.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};jo.prototype.getObject=function(){return this._obj};jo.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};jo.prototype.getInsertEvent=function(){return this._insertEvent};jo.prototype.isInsert=function(){return this._eventType===jo.INSERT};jo.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};jo.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};jo.prototype.interfaces_=function(){return[Es]};jo.prototype.getClass=function(){return jo};ab.INSERT.get=function(){return 1};ab.DELETE.get=function(){return 2};Object.defineProperties(jo,ab);var B_=function(){};B_.prototype.interfaces_=function(){return[]};B_.prototype.getClass=function(){return B_};var Fi=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 t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};Fi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Fi.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Fi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Fi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Fi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Fi.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Fi.prototype.hasProperIntersection=function(){return this._hasProper};Fi.prototype.hasIntersection=function(){return this._hasIntersection};Fi.prototype.isDone=function(){return this._isDone};Fi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Fi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Fi.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],s=t.getCoordinates()[e+1],c=n.getCoordinates()[r],l=n.getCoordinates()[r+1];this._li.computeIntersection(i,s,c,l),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,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))))};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};Fi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var JO=function(t){function e(){t.call(this),this.events=new _t,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;Ws.sort(this.events);for(var r=0;re||this._maxs?1:0};pm.prototype.interfaces_=function(){return[zf]};pm.prototype.getClass=function(){return pm};var QO=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ja),e5=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ja),Qa=function(){this._leaves=new _t,this._root=null,this._level=0};Qa.prototype.buildTree=function(){var t=this;Ws.sort(this._leaves,new Ja.NodeComparator);for(var e=this._leaves,n=null,r=new _t;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};Qa.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new QO(t,e,n))};Qa.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};Qa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Qa.prototype.printNode=function(t){Ni.out.println(js.toLineString(new ze(t._min,this._level),new ze(t._max,this._level)))};Qa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Qa.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,s=n.iterator();s.hasNext();){var c=s.next();r[i++]=c.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===Fe.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},e.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var s=Sn.removeRepeatedPoints(n.getCoordinates());if(s.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var c=r,l=i;Et.isCCW(s)&&(c=i,l=r);var d=new F_(s,new Wn(this._argIndex,Fe.BOUNDARY,c,l));this._lineEdgeMap.put(n,d),this.insertEdge(d),this.insertPoint(this._argIndex,s[0],Fe.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var s=this._nodes.addNode(r),c=s.getLabel();c===null?s._label=new Wn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new JO},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var s=i.next(),c=s.getLabel().getLocation(n),l=s.eiList.iterator();l.hasNext();){var d=l.next();r.addSelfIntersectionNode(n,d.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ga&&(this._useBoundaryDeterminationRule=!1),n instanceof ui)this.addPolygon(n);else if(n instanceof Dr)this.addLineString(n);else if(n instanceof Bo)this.addPoint(n);else if(n instanceof qf)this.addCollection(n);else if(n instanceof tc)this.addCollection(n);else if(n instanceof Ga)this.addCollection(n);else if(n instanceof io)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Kf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?Fe.BOUNDARY:Fe.INTERIOR},e}(Cr),Qf=function(){if(this._li=new pc,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Sd(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=xs.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sd(0,e,r),this._arg[1]=new Sd(1,n,r)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],c=arguments[2];i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sd(0,i,c),this._arg[1]=new Sd(1,s,c)}};Qf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Qf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Qf.prototype.interfaces_=function(){return[]};Qf.prototype.getClass=function(){return Qf};var Ju=function(){};Ju.prototype.interfaces_=function(){return[]};Ju.prototype.getClass=function(){return Ju};Ju.map=function(){if(arguments[0]instanceof Yt&&Kt(arguments[1],Ju.MapOp)){for(var t=arguments[0],e=arguments[1],n=new _t,r=0;r=t.size()?null:t.get(e)};Xr.union=function(t){var e=new Xr(t);return e.union()};nT.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Xr,nT);var V_=function(){};V_.prototype.interfaces_=function(){return[]};V_.prototype.getClass=function(){return V_};V_.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ln.createEmptyResult(ln.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ao.overlayOp(t,e,ln.UNION)};function dc(){return new U_}function U_(){this.reset()}U_.prototype={constructor:U_,reset:function(){this.s=this.t=0},add:function(t){sS(Ug,t,this.t),sS(this,Ug.s,this.s),this.s?this.t+=Ug.t:this.s=Ug.t},valueOf:function(){return this.s}};var Ug=new U_;function sS(t,e,n){var r=t.s=e+n,i=r-e,s=r-i;t.t=e-s+(n-i)}var Ar=1e-6,Kn=Math.PI,wl=Kn/2,aS=Kn/4,kl=Kn*2,qu=180/Kn,la=Kn/180,to=Math.abs,t5=Math.atan,tp=Math.atan2,ri=Math.cos,ii=Math.sin,_p=Math.sqrt;function rT(t){return t>1?0:t<-1?Kn:Math.acos(t)}function ah(t){return t>1?wl:t<-1?-wl:Math.asin(t)}function Rd(){}function j_(t,e){t&&uS.hasOwnProperty(t.type)&&uS[t.type](t,e)}var lS={Feature:function(t,e){j_(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rKn?t-kl:t<-Kn?t+kl:t,e]}r1.invert=r1;function r5(t,e,n){return(t%=kl)?e||n?iT(fS(t),pS(e,n)):fS(t):e||n?pS(e,n):r1}function hS(t){return function(e,n){return e+=t,[e>Kn?e-kl:e<-Kn?e+kl:e,n]}}function fS(t){var e=hS(t);return e.invert=hS(-t),e}function pS(t,e){var n=ri(t),r=ii(t),i=ri(e),s=ii(e);function c(l,d){var v=ri(d),S=ri(l)*v,E=ii(l)*v,C=ii(d),M=C*n+S*r;return[tp(E*i-M*s,S*n-C*r),ah(M*i+E*s)]}return c.invert=function(l,d){var v=ri(d),S=ri(l)*v,E=ii(l)*v,C=ii(d),M=C*i-E*s;return[tp(E*i+C*s,S*n+M*r),ah(M*n-S*r)]},c}function i5(t,e,n,r,i,s){if(n){var c=ri(e),l=ii(e),d=r*n;i==null?(i=e+r*kl,s=e-d/2):(i=dS(c,i),s=dS(c,s),(r>0?is)&&(i+=r*kl));for(var v,S=i;r>0?S>s:S1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function o5(t,e,n,r,i,s){var c=t[0],l=t[1],d=e[0],v=e[1],S=0,E=1,C=d-c,M=v-l,k;if(k=n-c,!(!C&&k>0)){if(k/=C,C<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=i-c,!(!C&&k<0)){if(k/=C,C<0){if(k>E)return;k>S&&(S=k)}else if(C>0){if(k0)){if(k/=M,M<0){if(k0){if(k>E)return;k>S&&(S=k)}if(k=s-l,!(!M&&k<0)){if(k/=M,M<0){if(k>E)return;k>S&&(S=k)}else if(M>0){if(k0&&(t[0]=c+S*C,t[1]=l+S*M),E<1&&(e[0]=c+E*C,e[1]=l+E*M),!0}}}}}function a_(t,e){return to(t[0]-e[0])=0;--l)i.point((E=S[l])[0],E[1]);else r(C.x,C.p.x,-1,i);C=C.p}C=C.o,S=C.z,M=!M}while(!C.v);i.lineEnd()}}}function mS(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function s5(t){return t.length===1&&(t=a5(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[s],n)<0?r=s+1:i=s}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[s],n)>0?i=s:r=s+1}return r}}}function a5(t){return function(e,n){return aT(t(e),n)}}s5(aT);function lT(t){for(var e=t.length,n,r=-1,i=0,s,c;++r=0;)for(c=t[e],n=c.length;--n>=0;)s[--i]=c[n];return s}var Nd=1e9,Wg=-Nd;function l5(t,e,n,r){function i(v,S){return t<=v&&v<=n&&e<=S&&S<=r}function s(v,S,E,C){var M=0,k=0;if(v==null||(M=c(v,E))!==(k=c(S,E))||d(v,S)<0^E>0)do C.point(M===0||M===3?t:n,M>1?r:e);while((M=(M+E+4)%4)!==k);else C.point(S[0],S[1])}function c(v,S){return to(v[0]-t)0?0:3:to(v[0]-n)0?2:1:to(v[1]-e)0?1:0:S>0?3:2}function l(v,S){return d(v.x,S.x)}function d(v,S){var E=c(v,1),C=c(S,1);return E!==C?E-C:E===0?S[1]-v[1]:E===1?v[0]-S[0]:E===2?v[1]-S[1]:S[0]-v[0]}return function(v){var S=v,E=oT(),C,M,k,R,F,U,z,G,q,X,de,ae={point:le,lineStart:oe,lineEnd:qe,polygonStart:ke,polygonEnd:Q};function le(it,ft){i(it,ft)&&S.point(it,ft)}function ye(){for(var it=0,ft=0,Xe=M.length;ftr&&(Rn-Tt)*(r-tn)>(Jt-tn)*(t-Tt)&&++it:Jt<=r&&(Rn-Tt)*(r-tn)<(Jt-tn)*(t-Tt)&&--it;return it}function ke(){S=E,C=[],M=[],de=!0}function Q(){var it=ye(),ft=de&&it,Xe=(C=lT(C)).length;(ft||Xe)&&(v.polygonStart(),ft&&(v.lineStart(),s(null,null,1,v),v.lineEnd()),Xe&&sT(C,l,it,s,v),v.polygonEnd()),S=v,C=M=k=null}function oe(){ae.point=Pe,M&&M.push(k=[]),X=!0,q=!1,z=G=NaN}function qe(){C&&(Pe(R,F),U&&q&&E.rejoin(),C.push(E.result())),ae.point=le,q&&S.lineEnd()}function Pe(it,ft){var Xe=i(it,ft);if(M&&k.push([it,ft]),X)R=it,F=ft,U=Xe,X=!1,Xe&&(S.lineStart(),S.point(it,ft));else if(Xe&&q)S.point(it,ft);else{var Mt=[z=Math.max(Wg,Math.min(Nd,z)),G=Math.max(Wg,Math.min(Nd,G))],At=[it=Math.max(Wg,Math.min(Nd,it)),ft=Math.max(Wg,Math.min(Nd,ft))];o5(Mt,At,t,e,n,r)?(q||(S.lineStart(),S.point(Mt[0],Mt[1])),S.point(At[0],At[1]),Xe||S.lineEnd(),de=!1):Xe&&(S.lineStart(),S.point(it,ft),de=!1)}z=it,G=ft,q=Xe}return ae}}var av=dc();function u5(t,e){var n=e[0],r=e[1],i=[ii(n),-ri(n),0],s=0,c=0;av.reset();for(var l=0,d=t.length;l=0?1:-1,le=ae*de,ye=le>Kn,ke=k*q;if(av.add(tp(ke*ae*ii(le),R*X+ke*ri(le))),s+=ye?de+ae*kl:de,ye^C>=n^z>=n){var Q=G_(np(E),np(U));n1(Q);var oe=G_(i,Q);n1(oe);var qe=(ye^de>=0?-1:1)*ah(oe[2]);(r>qe||r===qe&&(Q[0]||Q[1]))&&(c+=ye^de>=0?1:-1)}}return(s<-Ar||sdm&&(dm=t),eW_&&(W_=e)}dc();function uT(t,e,n,r){return function(i,s){var c=e(s),l=i.invert(r[0],r[1]),d=oT(),v=e(d),S=!1,E,C,M,k={point:R,lineStart:U,lineEnd:z,polygonStart:function(){k.point=G,k.lineStart=q,k.lineEnd=X,C=[],E=[]},polygonEnd:function(){k.point=R,k.lineStart=U,k.lineEnd=z,C=lT(C);var de=u5(E,l);C.length?(S||(s.polygonStart(),S=!0),sT(C,f5,de,n,s)):de&&(S||(s.polygonStart(),S=!0),s.lineStart(),n(null,null,1,s),s.lineEnd()),S&&(s.polygonEnd(),S=!1),C=E=null},sphere:function(){s.polygonStart(),s.lineStart(),n(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function R(de,ae){var le=i(de,ae);t(de=le[0],ae=le[1])&&s.point(de,ae)}function F(de,ae){var le=i(de,ae);c.point(le[0],le[1])}function U(){k.point=F,c.lineStart()}function z(){k.point=R,c.lineEnd()}function G(de,ae){M.push([de,ae]);var le=i(de,ae);v.point(le[0],le[1])}function q(){v.lineStart(),M=[]}function X(){G(M[0][0],M[0][1]),v.lineEnd();var de=v.clean(),ae=d.result(),le,ye=ae.length,ke,Q,oe;if(M.pop(),E.push(M),M=null,!!ye){if(de&1){if(Q=ae[0],(ke=Q.length-1)>0){for(S||(s.polygonStart(),S=!0),s.lineStart(),le=0;le1&&de&2&&ae.push(ae.pop().concat(ae.shift())),C.push(ae.filter(h5))}}return k}}function h5(t){return t.length>1}function f5(t,e){return((t=t.x)[0]<0?t[1]-wl-Ar:wl-t[1])-((e=e.x)[0]<0?e[1]-wl-Ar:wl-e[1])}const yS=uT(function(){return!0},p5,m5,[-Kn,-wl]);function p5(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(s,c){var l=s>0?Kn:-Kn,d=to(s-e);to(d-Kn)0?wl:-wl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(s,n),i=0):r!==l&&d>=Kn&&(to(e-r)Ar?t5((ii(e)*(s=ri(r))*ii(n)-ii(r)*(i=ri(e))*ii(t))/(i*s*c)):(e+r)/2}function m5(t,e,n,r){var i;if(t==null)i=n*wl,r.point(-Kn,i),r.point(0,i),r.point(Kn,i),r.point(Kn,0),r.point(Kn,-i),r.point(0,-i),r.point(-Kn,-i),r.point(-Kn,0),r.point(-Kn,i);else if(to(t[0]-e[0])>Ar){var s=t[0]0,i=to(n)>Ar;function s(S,E,C,M){i5(M,t,e,C,S,E)}function c(S,E){return ri(S)*ri(E)>n}function l(S){var E,C,M,k,R;return{lineStart:function(){k=M=!1,R=1},point:function(F,U){var z=[F,U],G,q=c(F,U),X=r?q?0:v(F,U):q?v(F+(F<0?Kn:-Kn),U):0;if(!E&&(k=M=q)&&S.lineStart(),q!==M&&(G=d(E,z),(!G||a_(E,G)||a_(z,G))&&(z[0]+=Ar,z[1]+=Ar,q=c(z[0],z[1]))),q!==M)R=0,q?(S.lineStart(),G=d(z,E),S.point(G[0],G[1])):(G=d(E,z),S.point(G[0],G[1]),S.lineEnd()),E=G;else if(i&&E&&r^q){var de;!(X&C)&&(de=d(z,E,!0))&&(R=0,r?(S.lineStart(),S.point(de[0][0],de[0][1]),S.point(de[1][0],de[1][1]),S.lineEnd()):(S.point(de[1][0],de[1][1]),S.lineEnd(),S.lineStart(),S.point(de[0][0],de[0][1])))}q&&(!E||!a_(E,z))&&S.point(z[0],z[1]),E=z,M=q,C=X},lineEnd:function(){M&&S.lineEnd(),E=null},clean:function(){return R|(k&&M)<<1}}}function d(S,E,C){var M=np(S),k=np(E),R=[1,0,0],F=G_(M,k),U=jg(F,F),z=F[0],G=U-z*z;if(!G)return!C&&S;var q=n*U/G,X=-n*z/G,de=G_(R,F),ae=Gg(R,q),le=Gg(F,X);sv(ae,le);var ye=de,ke=jg(ae,ye),Q=jg(ye,ye),oe=ke*ke-Q*(jg(ae,ae)-1);if(!(oe<0)){var qe=_p(oe),Pe=Gg(ye,(-ke-qe)/Q);if(sv(Pe,ae),Pe=t1(Pe),!C)return Pe;var it=S[0],ft=E[0],Xe=S[1],Mt=E[1],At;ft0^Pe[1]<(to(Pe[0]-it)Kn^(it<=Pe[0]&&Pe[0]<=ft)){var tn=Gg(ye,(-ke+qe)/Q);return sv(tn,ae),[Pe,t1(tn)]}}}function v(S,E){var C=r?t:Kn-t,M=0;return S<-C?M|=1:S>C&&(M|=2),E<-C?M|=4:E>C&&(M|=8),M}return uT(c,l,s,r?[0,-t]:[-Kn,t-Kn])}function cT(t){return function(e){var n=new i1;for(var r in t)n[r]=t[r];return n.stream=e,n}}function i1(){}i1.prototype={constructor:i1,point:function(t,e){this.stream.point(t,e)},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 hT(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),s!=null&&t.clipExtent(null),n5(n,t.stream(_S));var c=_S.result(),l=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),d=+e[0][0]+(r-l*(c[1][0]+c[0][0]))/2,v=+e[0][1]+(i-l*(c[1][1]+c[0][1]))/2;return s!=null&&t.clipExtent(s),t.scale(l*150).translate([d,v])}function _5(t,e,n){return hT(t,[[0,0],e],n)}var vS=16,y5=ri(30*la);function bS(t,e){return+e?b5(t,e):v5(t)}function v5(t){return cT({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function b5(t,e){function n(r,i,s,c,l,d,v,S,E,C,M,k,R,F){var U=v-r,z=S-i,G=U*U+z*z;if(G>4*e&&R--){var q=c+C,X=l+M,de=d+k,ae=_p(q*q+X*X+de*de),le=ah(de/=ae),ye=to(to(de)-1)e||to((U*qe+z*Pe)/G-.5)>.3||c*C+l*M+d*k2?Pe[2]%360*la:0,oe()):[v*qu,S*qu,E*qu]},ye.precision=function(Pe){return arguments.length?(de=bS(Q,X=Pe*Pe),qe()):_p(X)},ye.fitExtent=function(Pe,it){return hT(ye,Pe,it)},ye.fitSize=function(Pe,it){return _5(ye,Pe,it)};function oe(){M=iT(C=r5(v,S,E),e);var Pe=e(l,d);return s=r-Pe[0]*n,c=i+Pe[1]*n,qe()}function qe(){return ae=le=null,ye}return function(){return e=t.apply(this,arguments),ye.invert=e.invert&&ke,oe()}}function fT(t){return function(e,n){var r=ri(e),i=ri(n),s=t(r*i);return[s*i*ii(e),s*ii(n)]}}function pT(t){return function(e,n){var r=_p(e*e+n*n),i=t(r),s=ii(i),c=ri(i);return[tp(e*s,r*c),ah(r&&n*s/r)]}}var E5=fT(function(t){return _p(2/(1+t))});E5.invert=pT(function(t){return 2*ah(t/2)});var dT=fT(function(t){return(t=rT(t))&&t/ii(t)});dT.invert=pT(function(t){return t});function I5(){return w5(dT).scale(79.4188).clipAngle(180-.001)}function xS(t,e){return[t,e]}xS.invert=xS;function C5(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var s=[];switch(t.type){case"GeometryCollection":return PC(t,function(c){var l=l_(c,e,r,i);l&&s.push(l)}),Kv(s);case"FeatureCollection":return tS(t,function(c){var l=l_(c,e,r,i);l&&tS(l,function(d){d&&s.push(d)})}),Kv(s)}return l_(t,e,r,i)}function l_(t,e,n,r){var i=t.properties||{},s=t.type==="Feature"?t.geometry:t;if(s.type==="GeometryCollection"){var c=[];return PC(t,function(R){var F=l_(R,e,n,r);F&&c.push(F)}),Kv(c)}var l=T5(s),d={type:s.type,coordinates:gT(s.coordinates,l)},v=new eb,S=v.read(d),E=RO(NO(e,n),"meters"),C=Di.bufferOp(S,E,r),M=new BC;if(C=M.write(C),!mT(C.coordinates)){var k={type:C.type,coordinates:_T(C.coordinates,l)};return uy(k,i)}}function mT(t){return Array.isArray(t[0])?mT(t[0]):isNaN(t[0])}function gT(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return gT(n,e)})}function _T(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return _T(n,e)})}function T5(t){var e=zO(t).geometry.coordinates,n=[-e[0],-e[1]];return I5().rotate(n).scale(Qo)}function L5(t,e){var n=N_(t),r=N_(e),i=t.properties||{},s=EC.difference(n.coordinates,r.coordinates);return s.length===0?null:s.length===1?CC(s[0],i):TC(s,i)}function wS(t){let e;for(const n of t)e&&n[0]-e[0]>=180?n[0]-=360:e&&n[0]-e[0]<-180&&(n[0]+=360),e=n}function SS(t,e){const n=L5({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=C5(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)wS(i);else for(const i of r.geometry.coordinates)for(const s of i)wS(s);e({type:"FeatureCollection",features:[r,n]})}let ES={type:"FeatureCollection",features:[]};function P5(t,e,n=!0,r=!0,i={},s={},c={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 l,d=[],v,S;function E(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:ES}),c!=null&&c.fill&&t.addLayer({...c==null?void 0:c.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),c!=null&&c.line&&t.addLayer({...c==null?void 0:c.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?E():t.once("load",()=>{E()});const C=k=>{l==null||l({type:"mapClick",coordinates:[k.lngLat.lng,k.lngLat.lat]})};function M(k=!1){if(!e)throw new Error;const R=document.createElement("div");return k&&R.classList.add("marker-interactive"),new iO({props:{displayIn:"maplibre"},target:R}),new e.Marker({element:R,offset:[1,-13]})}return{setEventHandler(k){k?(l=k,t.on("click",C)):(l=void 0,t.off("click",C))},flyTo(k,R){t.flyTo({center:k,zoom:R,...i})},fitBounds(k,R,F){t.fitBounds([[k[0],k[1]],[k[2],k[3]]],{padding:R,maxZoom:F,...s})},indicateReverse(k){t.getCanvasContainer().style.cursor=k?"crosshair":""},setReverseMarker(k){!e||!n||(S?k?S.setLngLat(k):(S.remove(),S=void 0):k&&(S=(typeof n=="object"?new e.Marker(n):M()).setLngLat(k).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(k,R){if(!n)return;function F(U){var z;(z=t.getSource("full-geom"))==null||z.setData(U)}for(const U of d)U.remove();if(d.length=0,F(ES),!!e){if(R){let U=!1;if(R.geometry.type==="GeometryCollection"){const z=R.geometry.geometries.filter(G=>G.type==="Polygon"||G.type==="MultiPolygon");if(z.length>0){let G=z.pop();for(const q of z)G=OO(G,q);SS({...R,geometry:G},F),U=!0}else{const G=R.geometry.geometries.filter(q=>q.type==="LineString"||q.type==="MultiLineString");G.length>0&&(F({...R,geometry:{type:"GeometryCollection",geometries:G}}),U=!0)}}if(!U){if(R.geometry.type==="Polygon"||R.geometry.type==="MultiPolygon")SS(R,F);else if(R.geometry.type==="LineString"||R.geometry.type==="MultiLineString"){F(R);return}}n&&d.push((typeof n=="object"?new e.Marker(n):M()).setLngLat(R.center).addTo(t))}if(r)for(const U of k??[]){if(U===R)continue;const z=(typeof r=="object"?new e.Marker(r):M(!0)).setLngLat(U.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(U.place_type[0]==="reverse"?U.place_name:U.place_name.replace(/,.*/,""))).addTo(t),G=z.getElement();G.addEventListener("click",q=>{q.stopPropagation(),l==null||l({type:"markerClick",id:U.id})}),G.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:U.id}),z.togglePopup()}),G.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:U.id}),z.togglePopup()}),d.push(z)}}},setSelectedMarker(k){v&&v.getElement().classList.toggle("marker-selected",!1),v=k>-1?d[k]:void 0,v==null||v.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const k=t.getCenter();return[t.getZoom(),k.lng,k.lat]}}}function M5(t){let e,n;return{c(){e=su("svg"),n=su("path"),Le(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"),Le(e,"viewBox","0 0 14 14"),Le(e,"width","13"),Le(e,"height","13"),Le(e,"class","svelte-en2qvf")},m(r,i){be(r,e,i),te(e,n)},p:Ct,i:Ct,o:Ct,d(r){r&&ve(e)}}}class yT extends Zt{constructor(e){super(),Ht(this,e,null,M5,Ut,{})}}function A5(t){let e,n;return{c(){e=su("svg"),n=su("path"),Le(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"),Le(e,"viewBox","0 0 30 30"),Le(e,"fill","none"),Le(e,"xmlns","http://www.w3.org/2000/svg"),Le(e,"class","svelte-d2loi5")},m(r,i){be(r,e,i),te(e,n)},p:Ct,i:Ct,o:Ct,d(r){r&&ve(e)}}}class vT extends Zt{constructor(e){super(),Ht(this,e,null,A5,Ut,{})}}function k5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"area.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"area.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function D5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"reverse.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"reverse.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function R5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"poi.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"poi.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function N5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"postal_code.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"postal_code.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function O5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"street.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"street.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function z5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"road.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"road.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function F5(t){let e,n;return{c(){e=_e("img"),li(e.src,n=t[3]+"housenumber.svg")||Le(e,"src",n),Le(e,"alt",t[6]),Le(e,"class","svelte-ltkwvy")},m(r,i){be(r,e,i)},p(r,i){i&8&&!li(e.src,n=r[3]+"housenumber.svg")&&Le(e,"src",n),i&64&&Le(e,"alt",r[6])},d(r){r&&ve(e)}}}function B5(t){let e,n,r,i;return{c(){e=_e("img"),li(e.src,n=t[5])||Le(e,"src",n),Le(e,"alt",t[4]),Le(e,"class","svelte-ltkwvy")},m(s,c){be(s,e,c),r||(i=Lt(e,"error",t[14]),r=!0)},p(s,c){c&32&&!li(e.src,n=s[5])&&Le(e,"src",n),c&16&&Le(e,"alt",s[4])},d(s){s&&ve(e),r=!1,i()}}}function IS(t){let e,n;return{c(){e=_e("span"),n=nt(t[6]),Le(e,"class","secondary svelte-ltkwvy")},m(r,i){be(r,e,i),te(e,n)},p(r,i){i&64&&Hn(n,r[6])},d(r){r&&ve(e)}}}function V5(t){var ae,le;let e,n,r,i,s,c,l,d,v=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,E,C=t[2]==="always"||t[2]&&!t[0].address&&((ae=t[0].properties)==null?void 0:ae.kind)!=="road"&&((le=t[0].properties)==null?void 0:le.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],M,k,R=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",F,U,z;function G(ye,ke){var Q,oe;return ke&1&&(n=null),ke&1&&(r=null),ke&1&&(i=null),ye[5]?B5:ye[0].address?F5:((Q=ye[0].properties)==null?void 0:Q.kind)==="road"||((oe=ye[0].properties)==null?void 0:oe.kind)==="road_relation"?z5:(n==null&&(n=!!ye[0].id.startsWith("address.")),n?O5:(r==null&&(r=!!ye[0].id.startsWith("postal_code.")),r?N5:(i==null&&(i=!!ye[0].id.startsWith("poi.")),i?R5:ye[7]?D5:k5)))}let q=G(t,-1),X=q(t),de=C&&IS(t);return{c(){e=_e("li"),X.c(),s=We(),c=_e("span"),l=_e("span"),d=_e("span"),S=nt(v),E=We(),de&&de.c(),M=We(),k=_e("span"),F=nt(R),Le(d,"class","primary svelte-ltkwvy"),Le(l,"class","svelte-ltkwvy"),Le(k,"class","line2 svelte-ltkwvy"),Le(c,"class","texts svelte-ltkwvy"),Le(e,"tabindex","0"),Le(e,"data-selected",t[1]),Le(e,"class","svelte-ltkwvy"),xl(e,"selected",t[1])},m(ye,ke){be(ye,e,ke),X.m(e,null),te(e,s),te(e,c),te(c,l),te(l,d),te(d,S),te(l,E),de&&de.m(l,null),te(c,M),te(c,k),te(k,F),U||(z=[Lt(e,"mouseenter",t[12]),Lt(e,"focus",t[13])],U=!0)},p(ye,[ke]){var Q,oe;q===(q=G(ye,ke))&&X?X.p(ye,ke):(X.d(1),X=q(ye),X&&(X.c(),X.m(e,s))),ke&1&&v!==(v=(ye[7]?ye[0].place_name:ye[0].place_name.replace(/,.*/,""))+"")&&Hn(S,v),ke&37&&(C=ye[2]==="always"||ye[2]&&!ye[0].address&&((Q=ye[0].properties)==null?void 0:Q.kind)!=="road"&&((oe=ye[0].properties)==null?void 0:oe.kind)!=="road_relation"&&!ye[0].id.startsWith("address.")&&!ye[0].id.startsWith("postal_code.")&&(!ye[0].id.startsWith("poi.")||!ye[5])&&!ye[7]),C?de?de.p(ye,ke):(de=IS(ye),de.c(),de.m(l,null)):de&&(de.d(1),de=null),ke&1&&R!==(R=(ye[7]?"":ye[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Hn(F,R),ke&2&&Le(e,"data-selected",ye[1]),ke&2&&xl(e,"selected",ye[1])},i:Ct,o:Ct,d(ye){ye&&ve(e),X.d(),de&&de.d(),U=!1,Kr(z)}}}function U5(t,e,n){var G;let r,i,{feature:s}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:d}=e,{iconsBaseUrl:v}=e;const S=(G=s.properties)==null?void 0:G.categories;let E,C,M=0,k=s.place_type[0]==="reverse";function R(q){C&&d.add(C),n(10,M++,M)}function F(q){gn.call(this,t,q)}function U(q){gn.call(this,t,q)}const z=q=>R(q.currentTarget);return t.$$set=q=>{"feature"in q&&n(0,s=q.feature),"selected"in q&&n(1,c=q.selected),"showPlaceType"in q&&n(2,l=q.showPlaceType),"missingIconsCache"in q&&n(9,d=q.missingIconsCache),"iconsBaseUrl"in q&&n(3,v=q.iconsBaseUrl)},t.$$.update=()=>{var q,X,de,ae;if(t.$$.dirty&3640)do n(11,r--,r),n(4,E=S==null?void 0:S[r]),n(5,C=E?v+E.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!C||d.has(C)));t.$$.dirty&1&&n(6,i=s.id.startsWith("poi.")?(X=(q=s.properties)==null?void 0:q.categories)==null?void 0:X.join(", "):((ae=(de=s.properties)==null?void 0:de.place_type_name)==null?void 0:ae[0])??s.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[s,c,l,v,E,C,i,k,R,d,M,r,F,U,z]}class j5 extends Zt{constructor(e){super(),Ht(this,e,U5,V5,Ut,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function G5(t){let e;return{c(){e=_e("div"),e.innerHTML='',Le(e,"class","svelte-7cmwmc")},m(n,r){be(n,e,r)},p:Ct,i:Ct,o:Ct,d(n){n&&ve(e)}}}class q5 extends Zt{constructor(e){super(),Ht(this,e,null,G5,Ut,{})}}function W5(t){let e,n;return{c(){e=su("svg"),n=su("path"),Le(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"),Le(e,"viewBox","0 0 60.006 21.412"),Le(e,"width","14"),Le(e,"height","20"),Le(e,"class","svelte-en2qvf")},m(r,i){be(r,e,i),te(e,n)},p:Ct,i:Ct,o:Ct,d(r){r&&ve(e)}}}class H5 extends Zt{constructor(e){super(),Ht(this,e,null,W5,Ut,{})}}function Z5(t){let e,n,r;return{c(){e=su("svg"),n=su("circle"),r=su("path"),Le(n,"cx","4.789"),Le(n,"cy","4.787"),Le(n,"r","3.85"),lr(n,"stroke-width","1.875"),lr(n,"fill","none"),Le(r,"d","M12.063 12.063 7.635 7.635"),lr(r,"stroke-width","1.875"),lr(r,"stroke-linecap","round"),Le(e,"xmlns","http://www.w3.org/2000/svg"),Le(e,"width","13"),Le(e,"height","13"),Le(e,"viewBox","0 0 13 13"),Le(e,"class","svelte-1bpbt60")},m(i,s){be(i,e,s),te(e,n),te(e,r)},p:Ct,i:Ct,o:Ct,d(i){i&&ve(e)}}}class X5 extends Zt{constructor(e){super(),Ht(this,e,null,Z5,Ut,{})}}function $5(t,e,n){const r=e[1],i=e[0],s=r-i;return t===r&&n?t:((t-i)%s+s)%s+i}function CS(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Ed.coords)break e;return Ed.coords}let s;try{return s=await new Promise((c,l)=>{n.signal.addEventListener("abort",()=>{l(Error("aborted"))}),navigator.geolocation.getCurrentPosition(d=>{c([d.coords.longitude,d.coords.latitude].map(v=>v.toFixed(6)).join(","))},d=>{l(d)},i)}),s}catch{}finally{i.cachedLocationExpiry&&(Ed={time:Date.now(),coords:s})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const TS=/(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,LS=/(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,PS=/(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,MS=/(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 K5(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(c=>Number(c.trim()));let n=AS(e[0],t),r=AS(e[1],t);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=e[0]>=0?" N":" S",s=e[1]>=0?" E":" W";return`${n+i}, ${r+s}`}else throw new Error("no decimal coordinates to convert")}function AS(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=J5(i,3).toFixed(3).padStart(6,"0");return`${r}° ${l}'`}let s=Math.floor(i),c=((i-s)*60).toFixed(1).padStart(4,"0");return s=s.toString().padStart(2,"0"),`${r}° ${s}' ${c}"`}function J5(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function ub(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",s="",c=[],l=!1;if(TS.test(t))if(c=TS.exec(t),l=Hg(c),l){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(i=c[1],s=c[5]):c[4]&&(i=c[4],s=c[8])}else throw new Error("invalid decimal coordinate format");else if(LS.test(t))if(c=LS.exec(t),l=Hg(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6].replace(",",".")/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(i=c[1],s=c[8]):c[7]&&(i=c[7],s=c[14]);else throw new Error("invalid DMS coordinates format");else if(PS.test(t))if(c=PS.exec(t),l=Hg(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],s=c[9]):c[8]&&(i=c[8],s=c[16]);else throw new Error("invalid DMS coordinates format");else if(MS.test(t))if(c=MS.exec(t),l=Hg(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],s=c[9]):c[8]&&(i=c[8],s=c[16]);else throw new Error("invalid coordinates format");if(l){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||s)&&(!i||!s))throw new Error("invalid coordinates format");if(i&&i==s)throw new Error("invalid coordinates format");let d=/S|SOUTH/i;d.test(i)&&n>0&&(n=-1*n),d=/W|WEST/i,d.test(s)&&r>0&&(r=-1*r);const v=c[0].trim();let S,E;const C=/[,/;\u0020]/g,M=v.match(C);if(M==null){const F=Math.floor(t.length/2);S=v.substring(0,F).trim(),E=v.substring(F).trim()}else{let F;M.length%2==1?F=Math.floor(M.length/2):F=M.length/2-1;let U=0;if(F==0)U=v.indexOf(M[0]),S=v.substring(0,U).trim(),E=v.substring(U+1).trim();else{let z=0,G=0;for(;z<=F;)U=v.indexOf(M[z],G),G=U+1,z++;S=v.substring(0,U).trim(),E=v.substring(U+1).trim()}}const k=S.split(".");if(k.length==2&&k[1]==0&&k[1].length!=2)throw new Error("invalid coordinates format");const R=E.split(".");if(R.length==2&&R[1]==0&&R[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(E))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(e)),Object.freeze({verbatimCoordinates:v,verbatimLatitude:S,verbatimLongitude:E,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:Q5,toCoordinateFormat:K5})}else throw new Error("coordinates pattern match failed")}function Hg(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=e.length/2;for(let s=0;s{e.decimalLatitude?t.push(e):t.push({...e,...nz})}),[...t,...rz,...iz]}const sz=oz();ub.formats=sz.map(t=>t.verbatimCoordinates);const az=ub;function DS(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function RS(t){let e,n;return e=new q5({}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function NS(t){let e,n,r,i,s;return n=new H5({}),{c(){e=_e("button"),Ue(n.$$.fragment),Le(e,"type","button"),Le(e,"title",t[9]),Le(e,"class","svelte-zh3kmv"),xl(e,"active",t[0])},m(c,l){be(c,e,l),Be(n,e,null),r=!0,i||(s=Lt(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Le(e,"title",c[9]),(!r||l[0]&1)&&xl(e,"active",c[0])},i(c){r||(se(n.$$.fragment,c),r=!0)},o(c){me(n.$$.fragment,c),r=!1},d(c){c&&ve(e),Ve(n),i=!1,s()}}}function lz(t){let e,n=[],r=new Map,i,s,c,l=zo(t[14]);const d=v=>v[81].id+(v[81].address?","+v[81].address:"");for(let v=0;v{ae=null}),Dn()),(!G||it[0]&2)&&xl(v,"displayable",Pe[1]!==""),Pe[5]===!0?le?(le.p(Pe,it),it[0]&32&&se(le,1)):(le=NS(Pe),le.c(),se(le,1),le.m(r,k)):le&&(kn(),me(le,1,1,()=>{le=null}),Dn()),ke&&ke.p&&(!G||it[1]&134217728)&&yr(ke,ye,Pe,Pe[58],G?_r(ye,Pe[58],it,null):vr(Pe[58]),null);let ft=F;F=qe(Pe),F===ft?~F&&oe[F].p(Pe,it):(U&&(kn(),me(oe[ft],1,1,()=>{oe[ft]=null}),Dn()),~F?(U=oe[F],U?U.p(Pe,it):(U=oe[F]=Q[F](Pe),U.c()),se(U,1),U.m(n,null)):U=null),(!G||it[0]&4&&z!==(z=c_(Pe[2])+" svelte-zh3kmv"))&&Le(n,"class",z),(!G||it[0]&22)&&xl(n,"can-collapse",Pe[4]&&Pe[1]==="")},i(Pe){G||(se(de),se(s.$$.fragment,Pe),se(E.$$.fragment,Pe),se(ae),se(le),se(ke,Pe),se(U),G=!0)},o(Pe){me(de),me(s.$$.fragment,Pe),me(E.$$.fragment,Pe),me(ae),me(le),me(ke,Pe),me(U),G=!1},d(Pe){Pe&&(ve(e),ve(n)),Ve(s),t[61](null),Ve(E),ae&&ae.d(),le&&le.d(),ke&&ke.d(Pe),~F&&oe[F].d(),q=!1,Kr(X)}}}function pz(t,e,n){let r,{$$slots:i={},$$scope:s}=e,{class:c=void 0}=e,{apiKey:l}=e,{bbox:d=void 0}=e,{clearButtonTitle:v="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:E=!1}=e,{country:C=void 0}=e,{debounceSearch:M=200}=e,{enableReverse:k=!1}=e,{errorMessage:R="Something went wrong…"}=e,{filter:F=()=>!0}=e,{flyTo:U=!0}=e,{fuzzyMatch:z=!0}=e,{language:G=void 0}=e,{limit:q=void 0}=e,{mapController:X=void 0}=e,{minLength:de=2}=e,{noResultsMessage:ae="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!"}=e,{placeholder:le="Search"}=e,{proximity:ye=[{type:"server-geolocation"}]}=e,{reverseActive:ke=k==="always"}=e,{reverseButtonTitle:Q="toggle reverse geocoding"}=e,{searchValue:oe=""}=e,{showFullGeometry:qe=!0}=e,{showPlaceType:Pe="ifNeeded"}=e,{showResultsWhileTyping:it=!0}=e,{selectFirst:ft=!0}=e,{flyToSelected:Xe=!1}=e,{markerOnSelected:Mt=!0}=e,{types:At=void 0}=e,{excludeTypes:yt=!1}=e,{zoom:zt=16}=e,{maxZoom:Tt=18}=e,{apiUrl:tn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Rn={}}=e,{iconsBaseUrl:Jt="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:pn=ee=>{}}=e;function Nn(){Re.focus()}function En(){Re.blur()}function Nr(ee,Me=!0){n(1,oe=ee),Me?(n(15,on=-1),zl()):(ci(),setTimeout(()=>{Re.focus(),Re.select()}))}function Jn(){n(14,ne=void 0),n(55,ot=void 0),n(15,on=-1)}function On(){n(54,Ce=[]),n(55,ot=void 0)}let Qn=!1,ne,Ce,ot,kt="",Re,on=-1,qr,_n=[],ur,Go,Cs,Ks;const tl=new Set,Bi=bu();ro(()=>{X&&(X.setEventHandler(void 0),X.indicateReverse(!1),X.setSelectedMarker(-1),X.setMarkers(void 0,void 0))});function zl(ee){if(Go&&(clearTimeout(Go),Go=void 0),on>-1&&ne)n(55,ot=ne[on]),n(1,oe=ot.place_type[0]==="reverse"?ot.place_name:ot.place_name.replace(/,.*/,"")),n(18,qr=void 0),n(54,Ce=void 0),n(15,on=-1);else if(oe){const Me=ee||!Ts(oe);lt(oe,{exact:!0}).then(()=>{n(54,Ce=ne),n(55,ot=void 0),Me&&us()}).catch(Se=>n(18,qr=Se))}}function Ts(ee){try{return az(ee,6)}catch{return!1}}async function lt(ee,{byId:Me=!1,exact:Se=!1}={}){n(18,qr=void 0),ur==null||ur.abort();const Ne=new AbortController;n(19,ur=Ne);try{const He=Ts(ee),Ye=new URLSearchParams;if(G!==void 0&&Ye.set("language",Array.isArray(G)?G.join(","):G??""),At&&Ye.set("types",At.join(",")),yt&&Ye.set("excludeTypes",String(yt)),d&&Ye.set("bbox",d.map(en=>en.toFixed(6)).join(",")),C&&Ye.set("country",Array.isArray(C)?C.join(","):C),!Me&&!He){const en=await Y5(X,ye,Ne);en&&Ye.set("proximity",en),(Se||!it)&&Ye.set("autocomplete","false"),Ye.set("fuzzyMatch",String(z))}q!==void 0&&(!He||(At==null?void 0:At.length)===1)&&Ye.set("limit",String(q)),Ye.set("key",l),pn(Ye);const Je=tn+"/"+encodeURIComponent(He?He.decimalLongitude+","+He.decimalLatitude:ee)+".json?"+Ye.toString();if(Je===kt){Me?(n(14,ne=void 0),n(55,ot=_n[0])):n(14,ne=_n);return}kt=Je;const Rt=await fetch(Je,{signal:Ne.signal,...Rn});if(!Rt.ok)throw new Error(await Rt.text());const Ft=await Rt.json();Bi("response",{url:Je,featureCollection:Ft}),Me?(n(14,ne=void 0),n(55,ot=Ft.features[0]),_n=[ot]):(n(14,ne=Ft.features.filter(F)),He&&ne.unshift({type:"Feature",properties:{},id:"reverse_"+He.decimalLongitude+"_"+He.decimalLatitude,text:He.decimalLatitude+", "+He.decimalLongitude,place_name:He.decimalLatitude+", "+He.decimalLongitude,place_type:["reverse"],center:[He.decimalLongitude,He.decimalLatitude],bbox:[He.decimalLongitude,He.decimalLatitude,He.decimalLongitude,He.decimalLatitude],geometry:{type:"Point",coordinates:[He.decimalLongitude,He.decimalLatitude]}}),_n=ne,He&&Re.focus())}catch(He){if(He&&typeof He=="object"&&"name"in He&&He.name==="AbortError")return;throw He}finally{Ne===ur&&n(19,ur=void 0)}}function us(){var Se;if(!(Ce!=null&&Ce.length)||!U)return;const ee=[180,90,-180,-90],Me=!Ce.some(Ne=>!Ne.matching_text);for(const Ne of Ce)if(Me||!Ne.matching_text)for(const He of[0,1,2,3])ee[He]=Math[He<2?"min":"max"](ee[He],((Se=Ne.bbox)==null?void 0:Se[He])??Ne.center[He%2]);X&&Ce.length>0&&(ot&&ee[0]===ee[2]&&ee[1]===ee[3]?X.flyTo(ot.center,zt):X.fitBounds(CS(ee),50,Tt))}function lo(ee){n(0,ke=k==="always"),n(14,ne=void 0),n(55,ot=void 0),n(15,on=-1),Nr(ee[1].toFixed(6)+", "+$5(ee[0],[-180,180],!0).toFixed(6),!1)}function Fl(ee){if(!ne)return;let Me=ee.key==="ArrowDown"?1:ee.key==="ArrowUp"?-1:0;Me&&(on===(ft?0:-1)&&Me===-1&&n(15,on=ne.length),n(15,on+=Me),on>=ne.length&&n(15,on=-1),on<0&&ft&&n(15,on=0),ee.preventDefault())}function ci(ee=!0){if(n(18,qr=void 0),it){if(Go&&clearTimeout(Go),oe.length{lt(Me).catch(Se=>n(18,qr=Se))},ee?M:0)}else n(14,ne=void 0),n(18,qr=void 0)}function pt(ee){n(55,ot=ee),n(1,oe=ee.place_name),n(15,on=-1)}const un=()=>Re.focus();function an(ee){si[ee?"unshift":"push"](()=>{Re=ee,n(17,Re)})}function Wr(){oe=this.value,n(1,oe),n(13,Qn),n(27,S)}const cs=()=>n(13,Qn=!0),sn=()=>n(13,Qn=!1),Aa=()=>ci(),Jr=()=>{n(1,oe=""),Re.focus()},pe=()=>n(0,ke=!ke),W=()=>n(18,qr=void 0),Z=ee=>n(15,on=ee),J=ee=>pt(ee),ue=()=>{ft||n(15,on=-1)},Te=()=>{};return t.$$set=ee=>{"class"in ee&&n(2,c=ee.class),"apiKey"in ee&&n(25,l=ee.apiKey),"bbox"in ee&&n(26,d=ee.bbox),"clearButtonTitle"in ee&&n(3,v=ee.clearButtonTitle),"clearOnBlur"in ee&&n(27,S=ee.clearOnBlur),"collapsed"in ee&&n(4,E=ee.collapsed),"country"in ee&&n(28,C=ee.country),"debounceSearch"in ee&&n(29,M=ee.debounceSearch),"enableReverse"in ee&&n(5,k=ee.enableReverse),"errorMessage"in ee&&n(6,R=ee.errorMessage),"filter"in ee&&n(30,F=ee.filter),"flyTo"in ee&&n(31,U=ee.flyTo),"fuzzyMatch"in ee&&n(32,z=ee.fuzzyMatch),"language"in ee&&n(33,G=ee.language),"limit"in ee&&n(34,q=ee.limit),"mapController"in ee&&n(35,X=ee.mapController),"minLength"in ee&&n(36,de=ee.minLength),"noResultsMessage"in ee&&n(7,ae=ee.noResultsMessage),"placeholder"in ee&&n(8,le=ee.placeholder),"proximity"in ee&&n(37,ye=ee.proximity),"reverseActive"in ee&&n(0,ke=ee.reverseActive),"reverseButtonTitle"in ee&&n(9,Q=ee.reverseButtonTitle),"searchValue"in ee&&n(1,oe=ee.searchValue),"showFullGeometry"in ee&&n(38,qe=ee.showFullGeometry),"showPlaceType"in ee&&n(10,Pe=ee.showPlaceType),"showResultsWhileTyping"in ee&&n(39,it=ee.showResultsWhileTyping),"selectFirst"in ee&&n(11,ft=ee.selectFirst),"flyToSelected"in ee&&n(40,Xe=ee.flyToSelected),"markerOnSelected"in ee&&n(41,Mt=ee.markerOnSelected),"types"in ee&&n(42,At=ee.types),"excludeTypes"in ee&&n(43,yt=ee.excludeTypes),"zoom"in ee&&n(44,zt=ee.zoom),"maxZoom"in ee&&n(45,Tt=ee.maxZoom),"apiUrl"in ee&&n(46,tn=ee.apiUrl),"fetchParameters"in ee&&n(47,Rn=ee.fetchParameters),"iconsBaseUrl"in ee&&n(12,Jt=ee.iconsBaseUrl),"adjustUrlQuery"in ee&&n(48,pn=ee.adjustUrlQuery),"$$scope"in ee&&n(58,s=ee.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,Cs=Qn),S&&!Qn&&n(1,oe="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&oe.lengthn(18,qr=ee)),t.$$.dirty[1]&50356241&&(X&&ot&&ot.id!==Ks&&U&&(!ot.bbox||ot.bbox[0]===ot.bbox[2]&&ot.bbox[1]===ot.bbox[3]?X.flyTo(ot.center,ot.id.startsWith("poi.")||ot.id.startsWith("address.")?Tt:zt):X.fitBounds(CS(ot.bbox),50,Tt),n(14,ne=void 0),n(54,Ce=void 0),n(15,on=-1)),n(56,Ks=ot==null?void 0:ot.id)),t.$$.dirty[0]&18432&&ft&&ne!=null&&ne.length&&n(15,on=0),t.$$.dirty[0]&2050&&(ft||n(15,on=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Ce!==ne&&n(54,Ce=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&X&&X.setEventHandler(ee=>{switch(ee.type){case"mapClick":ke&&lo(ee.coordinates);break;case"markerClick":{const Me=ne==null?void 0:ne.find(Se=>Se.id===ee.id);Me&&pt(Me)}break;case"markerMouseEnter":Ce&&n(15,on=Cs?(ne==null?void 0:ne.findIndex(Me=>Me.id===ee.id))??-1:-1);break;case"markerMouseLeave":Ce&&n(15,on=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ne==null?void 0:ne[on]),t.$$.dirty[1]&67133969&&X&&r&&U&&Xe&&X.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Tt:zt),t.$$.dirty[1]&1040&&(Mt||X==null||X.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&X&&Mt&&!Ce&&(X.setMarkers(r?[r]:void 0,void 0),X.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&X&&X.setMarkers(Ce,ot),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Ce&&X&&X.setSelectedMarker(on),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&X){const ee=Ts(oe);X.setReverseMarker(ee?[ee.decimalLongitude,ee.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Bi("select",r),t.$$.dirty[1]&16777216&&Bi("pick",ot),t.$$.dirty[0]&81920&&Bi("optionsVisibilityChange",Cs&&!!ne),t.$$.dirty[0]&16384&&Bi("featuresListed",ne),t.$$.dirty[1]&8388608&&Bi("featuresMarked",Ce),t.$$.dirty[0]&1&&Bi("reverseToggle",ke),t.$$.dirty[0]&2&&Bi("queryChange",oe),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&X&&X.indicateReverse(ke)},[ke,oe,c,v,E,k,R,ae,le,Q,Pe,ft,Jt,Qn,ne,on,Cs,Re,qr,ur,tl,zl,Fl,ci,pt,l,d,S,C,M,F,U,z,G,q,X,de,ye,qe,it,Xe,Mt,At,yt,zt,Tt,tn,Rn,pn,Nn,En,Nr,Jn,On,Ce,ot,Ks,r,s,i,un,an,Wr,cs,sn,Aa,Jr,pe,W,Z,J,ue,Te]}class dz extends Zt{constructor(e){super(),Ht(this,e,pz,fz,Ut,{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 zS(t){let e,n,r;return n=new dz({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"class","svelte-ixhnie")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&2&&(c.mapController=i[1]),s&1&&(c.apiKey=i[0]),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function mz(t){let e,n,r=t[1]&&zS(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[1]?r?(r.p(i,s),s&2&&se(r,1)):(r=zS(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function gz(t,e,n){let r,{apiKey:i}=e,{map:s}=e;return t.$$set=c=>{"apiKey"in c&&n(0,i=c.apiKey),"map"in c&&n(2,s=c.map)},t.$$.update=()=>{t.$$.dirty&4&&n(1,r=s?P5(s,Bs):null)},[i,r,s]}class _z extends Zt{constructor(e){super(),Ht(this,e,gz,mz,Ut,{apiKey:0,map:2})}}const bT=["==",["geometry-type"],"Polygon"],xT=["==",["geometry-type"],"LineString"],yz=["==",["geometry-type"],"Point"];function Od(t,e,n){let r=["match",t];for(let[i,s]of Object.entries(e))r.push(i),r.push(s);return r.push(n),r}const vz=t=>({}),FS=t=>({}),bz=t=>({}),BS=t=>({}),xz=t=>({}),VS=t=>({});function wz(t){let e,n,r,i,s,c;const l=t[1].top,d=gr(l,t,t[0],VS),v=t[1].left,S=gr(v,t,t[0],BS),E=t[1].main,C=gr(E,t,t[0],FS);return{c(){e=_e("div"),d&&d.c(),n=We(),r=_e("div"),S&&S.c(),i=We(),s=_e("div"),C&&C.c(),Le(e,"class","top svelte-mpick2"),Le(r,"class","left svelte-mpick2"),Le(s,"class","main svelte-mpick2")},m(M,k){be(M,e,k),d&&d.m(e,null),be(M,n,k),be(M,r,k),S&&S.m(r,null),be(M,i,k),be(M,s,k),C&&C.m(s,null),c=!0},p(M,[k]){d&&d.p&&(!c||k&1)&&yr(d,l,M,M[0],c?_r(l,M[0],k,xz):vr(M[0]),VS),S&&S.p&&(!c||k&1)&&yr(S,v,M,M[0],c?_r(v,M[0],k,bz):vr(M[0]),BS),C&&C.p&&(!c||k&1)&&yr(C,E,M,M[0],c?_r(E,M[0],k,vz):vr(M[0]),FS)},i(M){c||(se(d,M),se(S,M),se(C,M),c=!0)},o(M){me(d,M),me(S,M),me(C,M),c=!1},d(M){M&&(ve(e),ve(n),ve(r),ve(i),ve(s)),d&&d.d(M),S&&S.d(M),C&&C.d(M)}}}function Sz(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&n(0,i=s.$$scope)},[i,r]}class Ez extends Zt{constructor(e){super(),Ht(this,e,Sz,wz,Ut,{})}}const Iz=t=>({}),US=t=>({}),Cz=t=>({}),jS=t=>({}),Tz=t=>({}),GS=t=>({});function Lz(t){let e,n,r,i,s,c;const l=t[4].top,d=gr(l,t,t[3],GS),v=t[4].sidebar,S=gr(v,t,t[3],jS),E=t[4].map,C=gr(E,t,t[3],US);return{c(){e=_e("div"),d&&d.c(),n=We(),r=_e("div"),S&&S.c(),i=We(),s=_e("div"),C&&C.c()},m(M,k){be(M,e,k),d&&d.m(e,null),t[5](e),be(M,n,k),be(M,r,k),S&&S.m(r,null),t[6](r),be(M,i,k),be(M,s,k),C&&C.m(s,null),t[7](s),c=!0},p(M,[k]){d&&d.p&&(!c||k&8)&&yr(d,l,M,M[3],c?_r(l,M[3],k,Tz):vr(M[3]),GS),S&&S.p&&(!c||k&8)&&yr(S,v,M,M[3],c?_r(v,M[3],k,Cz):vr(M[3]),jS),C&&C.p&&(!c||k&8)&&yr(C,E,M,M[3],c?_r(E,M[3],k,Iz):vr(M[3]),US)},i(M){c||(se(d,M),se(S,M),se(C,M),c=!0)},o(M){me(d,M),me(S,M),me(C,M),c=!1},d(M){M&&(ve(e),ve(n),ve(r),ve(i),ve(s)),d&&d.d(M),t[5](null),S&&S.d(M),t[6](null),C&&C.d(M),t[7](null)}}}function Pz(t,e,n){let r,i,s;vt(t,o1,E=>n(0,r=E)),vt(t,s1,E=>n(1,i=E)),vt(t,a1,E=>n(2,s=E));let{$$slots:c={},$$scope:l}=e;function d(E){si[E?"unshift":"push"](()=>{r=E,o1.set(r)})}function v(E){si[E?"unshift":"push"](()=>{i=E,s1.set(i)})}function S(E){si[E?"unshift":"push"](()=>{s=E,a1.set(s)})}return t.$$set=E=>{"$$scope"in E&&n(3,l=E.$$scope)},[r,i,s,l,c,d,v,S]}class xu extends Zt{constructor(e){super(),Ht(this,e,Pz,Lz,Ut,{})}}let o1=Fn(null),s1=Fn(null),a1=Fn(null);function Mz(t){let e,n,r,i,s,c,l,d,v;return{c(){e=_e("label"),n=nt(`Basemap: + `),r=_e("select"),i=_e("option"),i.textContent="MapTiler Dataviz",s=_e("option"),s.textContent="MapTiler Streets",c=_e("option"),c.textContent="MapTiler Satellite",l=_e("option"),l.textContent="OS Open Zoomstack",i.__value="dataviz",vo(i,i.__value),s.__value="streets-v2",vo(s,s.__value),c.__value="hybrid",vo(c,c.__value),l.__value="uk-openzoomstack-light",vo(l,l.__value),t[0]===void 0&&Xd(()=>t[1].call(r))},m(S,E){be(S,e,E),te(e,n),te(e,r),te(r,i),te(r,s),te(r,c),te(r,l),h_(r,t[0],!0),d||(v=Lt(r,"change",t[1]),d=!0)},p(S,[E]){E&1&&h_(r,S[0])},i:Ct,o:Ct,d(S){S&&ve(e),d=!1,v()}}}function Az(t,e,n){let r;vt(t,Bv,s=>n(0,r=s));function i(){r=DE(this),Bv.set(r)}return[r,i]}class kz extends Zt{constructor(e){super(),Ht(this,e,Az,Mz,Ut,{})}}let u_=Fn(!0);function Dz(t){let e,n;return e=new fc({props:{paint:{"fill-color":"black","fill-opacity":0},layout:{visibility:t[0]?"none":"visible"}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&1&&(s.layout={visibility:r[0]?"none":"visible"}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Rz(t){let e,n;return e=new No({props:{data:t[1],$$slots:{default:[Dz]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&5&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Nz(t,e,n){let r;return vt(t,u_,s=>n(0,r=s)),[r,{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]}}]}class Oz extends Zt{constructor(e){super(),Ht(this,e,Nz,Rz,Ut,{})}}const zz="/ltn/assets/help-d011708a.svg";function qS(t){let e,n;return e=new K_({props:{$$slots:{default:[Fz]},$$scope:{ctx:t}}}),e.$on("close",t[3]),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&16&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Fz(t){let e,n,r;const i=t[1].default,s=gr(i,t,t[4],null);return{c(){e=_e("h2"),e.textContent="Help",n=We(),s&&s.c()},m(c,l){be(c,e,l),be(c,n,l),s&&s.m(c,l),r=!0},p(c,l){s&&s.p&&(!r||l&16)&&yr(s,i,c,c[4],r?_r(i,c[4],l,null):vr(c[4]),null)},i(c){r||(se(s,c),r=!0)},o(c){me(s,c),r=!1},d(c){c&&(ve(e),ve(n)),s&&s.d(c)}}}function Bz(t){let e,n,r,i,s,c,l=t[0]&&qS(t);return{c(){e=_e("button"),e.innerHTML=`Help`,n=We(),l&&l.c(),r=Pi(),Le(e,"class","svelte-gb6dzm")},m(d,v){be(d,e,v),be(d,n,v),l&&l.m(d,v),be(d,r,v),i=!0,s||(c=Lt(e,"click",t[2]),s=!0)},p(d,[v]){d[0]?l?(l.p(d,v),v&1&&se(l,1)):(l=qS(d),l.c(),se(l,1),l.m(r.parentNode,r)):l&&(kn(),me(l,1,1,()=>{l=null}),Dn())},i(d){i||(se(l),i=!0)},o(d){me(l),i=!1},d(d){d&&(ve(e),ve(n),ve(r)),l&&l.d(d),s=!1,c()}}}function Vz(t,e,n){let{$$slots:r={},$$scope:i}=e,s=!1;const c=()=>n(0,s=!0),l=()=>n(0,s=!1);return t.$$set=d=>{"$$scope"in d&&n(4,i=d.$$scope)},[s,r,c,l,i]}class wT extends Zt{constructor(e){super(),Ht(this,e,Vz,Bz,Ut,{})}}function Uz(t){let e,n,r,i;const s=t[1].default,c=gr(s,t,t[0],null);return{c(){e=_e("a"),c&&c.c(),Le(e,"href","#")},m(l,d){be(l,e,d),c&&c.m(e,null),n=!0,r||(i=Lt(e,"click",kE(t[2])),r=!0)},p(l,[d]){c&&c.p&&(!n||d&1)&&yr(c,s,l,l[0],n?_r(s,l[0],d,null):vr(l[0]),null)},i(l){n||(se(c,l),n=!0)},o(l){me(c,l),n=!1},d(l){l&&ve(e),c&&c.d(l),r=!1,i()}}}function jz(t,e,n){let{$$slots:r={},$$scope:i}=e;function s(c){gn.call(this,t,c)}return t.$$set=c=>{"$$scope"in c&&n(0,i=c.$$scope)},[i,r,s]}class or extends Zt{constructor(e){super(),Ht(this,e,jz,Uz,Ut,{})}}const Gz=t=>({props:t&8}),WS=t=>({props:Hz(t[3])});function qz(t){let e;const n=t[1].default,r=gr(n,t,t[2],WS);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&12)&&yr(r,n,i,i[2],e?_r(n,i[2],s,Gz):vr(i[2]),WS)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function Wz(t){let e,n;return e=new SN({props:{openOn:t[0],popupClass:"popup",$$slots:{default:[qz,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&1&&(s.openOn=r[0]),i&12&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Hz(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function Zz(t,e,n){let{$$slots:r={},$$scope:i}=e,{openOn:s="hover"}=e;return t.$$set=c=>{"openOn"in c&&n(0,s=c.openOn),"$$scope"in c&&n(2,i=c.$$scope)},[s,r,i]}class wu extends Zt{constructor(e){super(),Ht(this,e,Zz,Wz,Ut,{openOn:0})}}function Xz(t,e){let n=new Set(t.getStyle().layers.filter(r=>r.type=="line").map(r=>r.id));if(e=="dataviz")return["Road network","Path"].filter(r=>n.has(r));if(e=="hybrid")return["Path","Road","Tunnel"].filter(r=>n.has(r));if(e=="streets-v2"){let r=[];for(let i of["road","bridge","tunnel"])for(let s of["link","minor","minor_construction","motorway","motorway_construction","motorway_link","path_pedestrian","secondary_tertiary","secondary_tertiary_construction","service_track","service_track_construction","street","trunk_primary","trunk_primary_construction","trunk_primary_link"])r.push(`${i}_${s}`);return r.filter(i=>n.has(i))}return e=="uk-openzoomstack-light"?t.getStyle().layers.filter(r=>r["source-layer"]=="roads"&&r.type=="line").map(r=>r.id):[]}const{window:$z}=h1;function Yz(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R;return M=VP(t[8][0]),{c(){e=_e("button"),e.textContent="Stop StreetView",n=We(),r=_e("fieldset"),i=_e("legend"),i.textContent="Source:",s=We(),c=_e("label"),l=_e("input"),d=nt(` + Google Street View`),v=We(),S=_e("label"),E=_e("input"),C=nt(` + Bing Streetside`),Le(e,"class","secondary"),Le(l,"type","radio"),l.__value="google",vo(l,l.__value),Le(E,"type","radio"),E.__value="bing",vo(E,E.__value),M.p(l,E)},m(F,U){be(F,e,U),be(F,n,U),be(F,r,U),te(r,i),te(r,s),te(r,c),te(c,l),l.checked=l.__value===t[0],te(c,d),te(r,v),te(r,S),te(S,E),E.checked=E.__value===t[0],te(S,C),k||(R=[Lt(e,"click",t[3]),Lt(l,"change",t[7]),Lt(E,"change",t[9])],k=!0)},p(F,U){U&1&&(l.checked=l.__value===F[0]),U&1&&(E.checked=E.__value===F[0])},d(F){F&&(ve(e),ve(n),ve(r)),M.r(),k=!1,Kr(R)}}}function Kz(t){let e,n,r;return{c(){e=_e("button"),e.textContent="StreetView",Le(e,"class","secondary")},m(i,s){be(i,e,s),n||(r=Lt(e,"click",t[2]),n=!0)},p:Ct,d(i){i&&ve(e),n=!1,r()}}}function Jz(t){let e,n,r;function i(l,d){return l[1]?Kz:Yz}let s=i(t),c=s(t);return{c(){c.c(),e=Pi()},m(l,d){c.m(l,d),be(l,e,d),n||(r=Lt($z,"keydown",t[4]),n=!0)},p(l,[d]){s===(s=i(l))&&c?c.p(l,d):(c.d(1),c=s(l),c&&(c.c(),c.m(e.parentNode,e)))},i:Ct,o:Ct,d(l){l&&ve(e),c.d(l),n=!1,r()}}}function Qz(t,e,n){let r;vt(t,u_,R=>n(1,r=R));let{map:i}=e,{maptilerBasemap:s}=e,c="google",l=[];function d(){Bt(u_,r=!1,r),i.on("click",S),i.getCanvas().style.cursor="crosshair";for(let R of Xz(i,s))l.push([R,i.getPaintProperty(R,"line-color")]),i.setPaintProperty(R,"line-color","cyan")}function v(){Bt(u_,r=!0,r),i.off("click",S),i.getCanvas().style.cursor="inherit";for(let[R,F]of l)i.setPaintProperty(R,"line-color",F);l=[]}ro(v);function S(R){let F=R.lngLat.lng,U=R.lngLat.lat;c=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${U},${F}&cbp=11,0,0,0,0`,"_blank"):c=="bing"&&window.open(`https://www.bing.com/maps?cp=${U}~${F}&style=x`,"_blank")}function E(R){!r&&R.key=="Escape"&&(R.stopPropagation(),v())}const C=[[]];function M(){c=this.__value,n(0,c)}function k(){c=this.__value,n(0,c)}return t.$$set=R=>{"map"in R&&n(5,i=R.map),"maptilerBasemap"in R&&n(6,s=R.maptilerBasemap)},[c,r,d,v,E,i,s,M,C,k]}class eF extends Zt{constructor(e){super(),Ht(this,e,Qz,Jz,Ut,{map:5,maptilerBasemap:6})}}function ai(t){return{id:t,beforeId:tF(t)}}function tF(t){let e=Fs(uu);if(!e){console.warn(`getBeforeId(${t}) called before map is ready. Z-ordering may be incorrect.`);return}let n,r=!1;for(let i=HS.length-1;i>=0;i--){let s=HS[i];if(s==t){r=!0;break}e.getLayer(s)&&(n=s)}if(!r)throw new Error(`Layer ID ${t} not defined in layerZorder`);return n}let lv=t=>t,uv=t=>t;const HS=[lv(uv("Background")),"neighbourhood-boundaries",lv("Ferry line"),"debug-borders","debug-crosses","debug-filters","cells","interior-roads-outlines","interior-roads","compare-route","shortcuts","shortcuts-focus",uv("Building"),"route-debug-nodes","route-points","route-lines","route-polygons","one-ways",uv("Road labels"),lv("road_label"),"animate-shortcuts","modal-filters","boundary","neighbourhood-boundary","auto-boundaries-areas","auto-boundaries-severances","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"];function nF(t){let e;return{c(){e=nt("Back")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function rF(t){let e,n,r,i;return e=new or({props:{$$slots:{default:[nF]},$$scope:{ctx:t}}}),e.$on("click",t[2]),{c(){Ue(e.$$.fragment)},m(s,c){Be(e,s,c),n=!0,r||(i=Lt(window,"keydown",t[1]),r=!0)},p(s,[c]){const l={};c&8&&(l.$$scope={dirty:c,ctx:s}),e.$set(l)},i(s){n||(se(e.$$.fragment,s),n=!0)},o(s){me(e.$$.fragment,s),n=!1},d(s){Ve(e,s),r=!1,i()}}}function iF(t){let e=bu();function n(i){i.key=="Escape"&&(i.stopPropagation(),e("click"))}return[e,n,()=>e("click")]}class wy extends Zt{constructor(e){super(),Ht(this,e,iF,rF,Ut,{})}}function oF(t){let e,n;const r=[ai("one-ways"),{filter:["all",["==",["get","kind"],"interior_road"],["!=",["get","direction"],"both"]]},{layout:{"icon-image":"oneway-arrow","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 i={};for(let s=0;s({}),ZS=t=>({}),lF=t=>({}),XS=t=>({});function uF(t){let e,n;const r=[ai("neighbourhood-boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let i={};for(let s=0;s{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function hF(t){let e,n,r,i,s,c,l,d,v,S,E;e=new No({props:{data:YS(t[3]),$$slots:{default:[uF]},$$scope:{ctx:t}}});const C=[ai("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.8}}];let M={};for(let q=0;qn.properties.kind=="boundary");return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]],e.geometry.coordinates[0]]}}}function pF(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{gjInput:d}=e,{interactive:v=!0}=e,{onClickLine:S=(C,M)=>{}}=e;const E=C=>v&&S(C.detail.features[0],C.detail.event.lngLat);return t.$$set=C=>{"gjInput"in C&&n(4,d=C.gjInput),"interactive"in C&&n(0,v=C.interactive),"onClickLine"in C&&n(1,S=C.onClickLine),"$$scope"in C&&n(8,l=C.$$scope)},t.$$.update=()=>{t.$$.dirty&16&&n(3,r=l1(d)),t.$$.dirty&16&&n(5,i=Math.max(...d.features.map(C=>C.properties.kind=="interior_road"?C.properties.shortcuts:0))),t.$$.dirty&32&&n(2,s=Of(["interpolate-hcl",["linear"],["get","shortcuts"],0,"white",1,"#F19A93",i,"#A32015"],"blue"))},[v,S,s,r,d,i,c,E,l]}class Sy extends Zt{constructor(e){super(),Ht(this,e,pF,fF,Ut,{gjInput:4,interactive:0,onClickLine:1})}}function dF(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function mF(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function gF(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function _F(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;return s=new or({props:{$$slots:{default:[dF]},$$scope:{ctx:t}}}),s.$on("click",t[4]),d=new or({props:{$$slots:{default:[mF]},$$scope:{ctx:t}}}),d.$on("click",t[5]),E=new or({props:{$$slots:{default:[gF]},$$scope:{ctx:t}}}),E.$on("click",t[6]),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),Ue(d.$$.fragment),v=We(),S=_e("li"),Ue(E.$$.fragment),C=We(),M=_e("li"),M.textContent="Debug mode",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(R,F){be(R,e,F),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),Be(E,S,null),te(r,C),te(r,M),k=!0},p(R,F){const U={};F&256&&(U.$$scope={dirty:F,ctx:R}),s.$set(U);const z={};F&256&&(z.$$scope={dirty:F,ctx:R}),d.$set(z);const G={};F&256&&(G.$$scope={dirty:F,ctx:R}),E.$set(G)},i(R){k||(se(s.$$.fragment,R),se(d.$$.fragment,R),se(E.$$.fragment,R),k=!0)},o(R){me(s.$$.fragment,R),me(d.$$.fragment,R),me(E.$$.fragment,R),k=!1},d(R){R&&ve(e),Ve(s),Ve(d),Ve(E)}}}function yF(t){let e,n,r;return n=new wy({}),n.$on("click",t[3]),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","sidebar")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p:Ct,i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function vF(t){let e,n;return e=new J_({props:{properties:t[7]}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&128&&(s.properties=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function bF(t){let e,n,r;return n=new wu({props:{openOn:"hover",$$slots:{default:[vF,({props:i})=>({7:i}),({props:i})=>i?128:0]},$$scope:{ctx:t}}}),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","line-popup")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&384&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function xF(t){let e,n;return e=new J_({props:{properties:t[7]}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&128&&(s.properties=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function wF(t){let e,n;return e=new wu({props:{openOn:"hover",$$slots:{default:[xF,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&384&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function SF(t){let e,n;return e=new J_({props:{properties:t[7]}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&128&&(s.properties=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function EF(t){let e,n;return e=new wu({props:{openOn:"hover",$$slots:{default:[SF,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&384&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function IF(t){let e,n,r,i;const s=[ai("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let c={$$slots:{default:[wF]},$$scope:{ctx:t}};for(let v=0;v({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&384&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function LF(t){let e,n;const r=[ai("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let i={$$slots:{default:[TF]},$$scope:{ctx:t}};for(let s=0;sn(0,r=S)),vt(t,bn,S=>n(1,i=S)),[r,i,(S,E)=>window.open(kr(S.properties).way,"_blank"),()=>Bt(bn,i={mode:"neighbourhood"},i),()=>Bt(bn,i={mode:"title"},i),()=>Bt(bn,i={mode:"network"},i),()=>Bt(bn,i={mode:"neighbourhood"},i)]}class kF extends Zt{constructor(e){super(),Ht(this,e,AF,MF,Ut,{})}}function KS(t,e,n){const r=t.slice();return r[7]=e[n][0],r[8]=e[n][1],r[9]=e[n][2],r}function JS(t){let e,n,r,i,s,c,l=t[8]+"",d,v,S,E,C;function M(){return t[3](t[7])}return{c(){e=_e("button"),n=_e("img"),i=We(),s=_e("br"),c=We(),d=nt(l),v=We(),li(n.src,r=`/ltn//filters/${t[7]}_icon.gif`)||Le(n,"src",r),Le(n,"width","80"),Le(n,"alt",t[8]),Le(e,"class","outline"),lr(e,"width","100%"),e.disabled=S=t[0]==t[7]},m(k,R){be(k,e,R),te(e,n),te(e,i),te(e,s),te(e,c),te(e,d),te(e,v),E||(C=Lt(e,"click",M),E=!0)},p(k,R){t=k,R&1&&S!==(S=t[0]==t[7])&&(e.disabled=S)},d(k){k&&ve(e),E=!1,C()}}}function DF(t){let e,n,r,i,s,c,l,d,v,S,E,C,M=t[1][2]+"",k,R,F,U,z,G,q=zo(t[2]),X=[];for(let ae=0;ae({6:r}),({dialog:r})=>r?64:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&4163&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function NF(t,e,n){let r,i;vt(t,jv,v=>n(0,i=v));let s=[["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 c=v=>Bt(jv,i=v,i),l=v=>kr(v).close();function d(v){gn.call(this,t,v)}return t.$$.update=()=>{t.$$.dirty&1&&n(1,r=s.find(v=>v[0]==i))},[i,r,s,c,l,d]}class OF extends Zt{constructor(e){super(),Ht(this,e,NF,RF,Ut,{})}}function QS(t){let e,n;return e=new No({props:{data:t[0],$$slots:{default:[zF]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&1&&(s.data=r[0]),i&64&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function zF(t){let e,n;const r=[ai("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let i={};for(let s=0;s{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function BF(t,e,n){let{map:r}=e,i=null;const s=bu();r.on("dragstart",c),r.on("mousemove",l),r.on("mouseup",d),ro(()=>{r.dragPan.enable(),r.off("dragstart",c),r.off("mousemove",l),r.off("mouseup",d)});function c(){r.dragPan.disable(),n(0,i={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function l(v){i&&(i.geometry.coordinates.push(v.lngLat.toArray()),n(0,i))}function d(){i&&(s("done",i),n(0,i=null))}return t.$$set=v=>{"map"in v&&n(1,r=v.map)},[i,r]}class VF extends Zt{constructor(e){super(),Ht(this,e,BF,FF,Ut,{map:1})}}function UF(t){let e;const n=t[3].default,r=gr(n,t,t[5],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&32)&&yr(r,n,i,i[5],e?_r(n,i[5],s,null):vr(i[5]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function jF(t){let e,n;const r=[ai("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}},{paint:{"icon-opacity":["case",["get","edited"],1,.5]}}];let i={$$slots:{default:[UF]},$$scope:{ctx:t}};for(let s=0;sn(1,i=v)),vt(t,Wu,v=>n(2,s=v));let{$$slots:c={},$$scope:l}=e;function d(v){gn.call(this,t,v)}return t.$$set=v=>{"$$scope"in v&&n(5,l=v.$$scope)},t.$$.update=()=>{t.$$.dirty&6&&n(0,r=s>0?JSON.parse(i.renderModalFilters()):null)},[r,i,s,c,d,l]}class Ey extends Zt{constructor(e){super(),Ht(this,e,qF,GF,Ut,{})}}var WF=Object.defineProperty,fr=(t,e)=>WF(t,"name",{value:e,configurable:!0}),HF=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!zd(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=u1(e),i=u1(n);return r.every(s=>i.some(c=>this.compare(s,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(s=>i.some(c=>this.compareLine(s,c,1,!0)))}return!1}compareGeometryCollection(e,n){return zd(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?tC(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return zd(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};fr(HF,"GeojsonEquality");function zd(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}fr(zd,"sameLength");function u1(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}fr(u1,"explode");var zs=63710088e-1,ST={centimeters:zs*100,centimetres:zs*100,degrees:360/(2*Math.PI),feet:zs*3.28084,inches:zs*39.37,kilometers:zs/1e3,kilometres:zs/1e3,meters:zs,metres:zs,miles:zs/1609.344,millimeters:zs*1e3,millimetres:zs*1e3,nauticalmiles:zs/1852,radians:1,yards:zs*1.0936},eE={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,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function mc(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}fr(mc,"feature");function ZF(t,e,n={}){switch(t){case"Point":return ip(e).geometry;case"LineString":return hb(e).geometry;case"Polygon":return cb(e).geometry;case"MultiPoint":return IT(e).geometry;case"MultiLineString":return ET(e).geometry;case"MultiPolygon":return CT(e).geometry;default:throw new Error(t+" is invalid")}}fr(ZF,"geometry");function ip(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!op(t[0])||!op(t[1]))throw new Error("coordinates must contain numbers");return mc({type:"Point",coordinates:t},e,n)}fr(ip,"point");function XF(t,e,n={}){return Iy(t.map(r=>ip(r,e)),n)}fr(XF,"points");function cb(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let s=0;scb(r,e)),n)}fr($F,"polygons");function hb(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return mc({type:"LineString",coordinates:t},e,n)}fr(hb,"lineString");function YF(t,e,n={}){return Iy(t.map(r=>hb(r,e)),n)}fr(YF,"lineStrings");function Iy(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}fr(Iy,"featureCollection");function ET(t,e,n={}){return mc({type:"MultiLineString",coordinates:t},e,n)}fr(ET,"multiLineString");function IT(t,e,n={}){return mc({type:"MultiPoint",coordinates:t},e,n)}fr(IT,"multiPoint");function CT(t,e,n={}){return mc({type:"MultiPolygon",coordinates:t},e,n)}fr(CT,"multiPolygon");function KF(t,e,n={}){return mc({type:"GeometryCollection",geometries:t},e,n)}fr(KF,"geometryCollection");function JF(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}fr(JF,"round");function fb(t,e="kilometers"){const n=ST[e];if(!n)throw new Error(e+" units is invalid");return t*n}fr(fb,"radiansToLength");function Cy(t,e="kilometers"){const n=ST[e];if(!n)throw new Error(e+" units is invalid");return t/n}fr(Cy,"lengthToRadians");function QF(t,e){return mm(Cy(t,e))}fr(QF,"lengthToDegrees");function e6(t){let e=t%360;return e<0&&(e+=360),e}fr(e6,"bearingToAzimuth");function mm(t){return t%(2*Math.PI)*180/Math.PI}fr(mm,"radiansToDegrees");function pa(t){return t%360*Math.PI/180}fr(pa,"degreesToRadians");function t6(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return fb(Cy(t,e),n)}fr(t6,"convertLength");function n6(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=eE[e];if(!r)throw new Error("invalid original units");const i=eE[n];if(!i)throw new Error("invalid final units");return t/r*i}fr(n6,"convertArea");function op(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}fr(op,"isNumber");function r6(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}fr(r6,"isObject");function i6(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!op(e))throw new Error("bbox must only contain numbers")})}fr(i6,"validateBBox");function o6(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}fr(o6,"validateId");var s6=Object.defineProperty,gc=(t,e)=>s6(t,"name",{value:e,configurable:!0});function sp(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return[...t.geometry.coordinates];if(t.type==="Point")return[...t.coordinates]}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return[...t];throw new Error("coord must be GeoJSON Point or an Array of numbers")}gc(sp,"getCoord");function a6(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}gc(a6,"getCoords");function TT(t){if(t.length>1&&op(t[0])&&op(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return TT(t[0]);throw new Error("coordinates must only contain numbers")}gc(TT,"containsNumber");function l6(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}gc(l6,"geojsonType");function u6(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}gc(u6,"featureOf");function c6(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(const r of t.features){if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.geometry.type)}}gc(c6,"collectionOf");function LT(t){return t.type==="Feature"?t.geometry:t}gc(LT,"getGeom");function h6(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}gc(h6,"getType");var f6=Object.defineProperty,PT=(t,e)=>f6(t,"name",{value:e,configurable:!0});function pb(t,e,n={}){if(n.final===!0)return MT(t,e);const r=sp(t),i=sp(e),s=pa(r[0]),c=pa(i[0]),l=pa(r[1]),d=pa(i[1]),v=Math.sin(c-s)*Math.cos(d),S=Math.cos(l)*Math.sin(d)-Math.sin(l)*Math.cos(d)*Math.cos(c-s);return mm(Math.atan2(v,S))}PT(pb,"bearing");function MT(t,e){let n=pb(e,t);return n=(n+180)%360,n}PT(MT,"calculateFinalBearing");var p6=Object.defineProperty,d6=(t,e)=>p6(t,"name",{value:e,configurable:!0});function AT(t,e,n,r={}){const i=sp(t),s=pa(i[0]),c=pa(i[1]),l=pa(n),d=Cy(e,r.units),v=Math.asin(Math.sin(c)*Math.cos(d)+Math.cos(c)*Math.sin(d)*Math.cos(l)),S=s+Math.atan2(Math.sin(l)*Math.sin(d)*Math.cos(c),Math.cos(d)-Math.sin(c)*Math.sin(v)),E=mm(S),C=mm(v);return ip([E,C],r.properties)}d6(AT,"destination");var m6=Object.defineProperty,g6=(t,e)=>m6(t,"name",{value:e,configurable:!0});function kT(t,e,n={}){var r=sp(t),i=sp(e),s=pa(i[1]-r[1]),c=pa(i[0]-r[0]),l=pa(r[1]),d=pa(i[1]),v=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return fb(2*Math.atan2(Math.sqrt(v),Math.sqrt(1-v)),n.units)}g6(kT,"distance");var _6=Object.defineProperty,y6=(t,e)=>_6(t,"name",{value:e,configurable:!0});function DT(t,e,n={}){const i=LT(t).coordinates;let s=0;for(let c=0;c=s&&c===i.length-1);c++)if(s>=e){const l=e-s;if(l){const d=pb(i[c],i[c-1])-180;return AT(i[c],l,d,n)}else return ip(i[c])}else s+=kT(i[c],i[c+1],n);return ip(i[i.length-1])}y6(DT,"along");var v6=DT;function b6(t){let e,n;const r=[ai("animate-shortcuts"),{paint:{"circle-radius":10,"circle-color":"purple","circle-stroke-color":"black","circle-stroke-width":1}}];let i={};for(let s=0;sclearInterval(l));function d(){return r.features.map(M=>1/M.properties.directness).reduce((M,k)=>M+k,0)}function v(){return r.features.length==0?[]:Array.from({length:w6},S)}function S(){let M=Math.random()*i,k=0;for(let[R,F]of r.features.entries())if(k+=1/F.properties.directness,Mv6(r.features[M],k,{units:"kilometers"}))}}function C(){for(let[M,k]of s.entries())k.distance+=E6,k.distance>=r.features[k.idx].properties.length_meters/1e3&&(s[M]=S());n(0,c=E())}return t.$$set=M=>{"paths"in M&&n(1,r=M.paths)},t.$$.update=()=>{t.$$.dirty&2&&r&&(i=d(),s=v())},[c,r]}class C6 extends Zt{constructor(e){super(),Ht(this,e,I6,x6,Ut,{paths:1})}}function T6(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function L6(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function P6(t){let e;return{c(){e=_e("p"),e.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.`},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function M6(t){let e;return{c(){e=nt("View shortcuts")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function A6(t){let e;return{c(){e=nt("Route")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function k6(t){let e;return{c(){e=nt("Change this boundary")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function D6(t){let e;return{c(){e=nt("Debug")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function R6(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,N,B,F,G,H,K,_e,ae,le,ve,ke,Q;return s=new or({props:{$$slots:{default:[T6]},$$scope:{ctx:t}}}),s.$on("click",t[25]),d=new or({props:{$$slots:{default:[L6]},$$scope:{ctx:t}}}),d.$on("click",t[26]),C=new wT({props:{$$slots:{default:[P6]},$$scope:{ctx:t}}}),B=new or({props:{$$slots:{default:[M6]},$$scope:{ctx:t}}}),B.$on("click",t[27]),H=new or({props:{$$slots:{default:[A6]},$$scope:{ctx:t}}}),H.$on("click",t[28]),ae=new or({props:{$$slots:{default:[k6]},$$scope:{ctx:t}}}),ae.$on("click",t[29]),ke=new or({props:{$$slots:{default:[D6]},$$scope:{ctx:t}}}),ke.$on("click",t[30]),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),je(d.$$.fragment),v=We(),S=ge("li"),E=nt(`Editing - `),je(C.$$.fragment),M=We(),k=ge("nav"),R=ge("ul"),N=ge("li"),je(B.$$.fragment),F=We(),G=ge("li"),je(H.$$.fragment),K=We(),_e=ge("li"),je(ae.$$.fragment),le=We(),ve=ge("li"),je(ke.$$.fragment),Le(n,"aria-label","breadcrumb"),Le(e,"slot","top"),lr(e,"display","flex"),lr(e,"justify-content","space-between")},m(oe,qe){be(oe,e,qe),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),te(S,E),Be(C,S,null),te(e,M),te(e,k),te(k,R),te(R,N),Be(B,N,null),te(R,F),te(R,G),Be(H,G,null),te(R,K),te(R,_e),Be(ae,_e,null),te(R,le),te(R,ve),Be(ke,ve,null),Q=!0},p(oe,qe){const Pe={};qe[1]&8&&(Pe.$$scope={dirty:qe,ctx:oe}),s.$set(Pe);const it={};qe[1]&8&&(it.$$scope={dirty:qe,ctx:oe}),d.$set(it);const ft={};qe[1]&8&&(ft.$$scope={dirty:qe,ctx:oe}),C.$set(ft);const Xe={};qe[1]&8&&(Xe.$$scope={dirty:qe,ctx:oe}),B.$set(Xe);const Mt={};qe[1]&8&&(Mt.$$scope={dirty:qe,ctx:oe}),H.$set(Mt);const At={};qe[1]&8&&(At.$$scope={dirty:qe,ctx:oe}),ae.$set(At);const yt={};qe[1]&8&&(yt.$$scope={dirty:qe,ctx:oe}),ke.$set(yt)},i(oe){Q||(se(s.$$.fragment,oe),se(d.$$.fragment,oe),se(C.$$.fragment,oe),se(B.$$.fragment,oe),se(H.$$.fragment,oe),se(ae.$$.fragment,oe),se(ke.$$.fragment,oe),Q=!0)},o(oe){de(s.$$.fragment,oe),de(d.$$.fragment,oe),de(C.$$.fragment,oe),de(B.$$.fragment,oe),de(H.$$.fragment,oe),de(ae.$$.fragment,oe),de(ke.$$.fragment,oe),Q=!1},d(oe){oe&&ye(e),Ve(s),Ve(d),Ve(C),Ve(B),Ve(H),Ve(ae),Ve(ke)}}}function tE(t){let e;return{c(){e=ge("mark"),e.textContent=`Some parts of the neighbourhood aren't reachable by drivers, shown in - red`},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function N6(t){let e,n,r;return{c(){e=nt("Undo ("),n=nt(t[4]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s[0]&16&&Hn(n,i[4])},d(i){i&&(ye(e),ye(n),ye(r))}}}function O6(t){let e;return{c(){e=nt("Undo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function z6(t){let e,n,r;return{c(){e=nt("Redo ("),n=nt(t[5]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s[0]&32&&Hn(n,i[5])},d(i){i&&(ye(e),ye(n),ye(r))}}}function F6(t){let e;return{c(){e=nt("Redo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function nE(t){let e,n;return e=new OF({}),e.$on("close",t[24]),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p:Ct,i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function B6(t){let e,n,r,i,s=kr(t[6]).properties.name+"",c,l,d=t[1].area_km2.toFixed(1)+"",v,S,E,C,M,k,R,N,B,F,G,H,K,_e,ae,le,ve,ke,Q,oe,qe,Pe,it,ft,Xe,Mt,At,yt,zt,Tt,tn,Rn,Jt,pn,Nn,En=t[8]>0&&tE();function Nr(kt,Re){return kt[4]==0?O6:N6}let Jn=Nr(t),On=Jn(t);function Qn(kt,Re){return kt[5]==0?F6:z6}let ne=Qn(t),Ce=ne(t),ot=t[3]&&nE(t);return{c(){e=ge("div"),n=ge("p"),r=nt("Editing neighbourhood "),i=ge("u"),c=nt(s),l=nt(` - , with an area of `),v=nt(d),S=nt(" km²"),E=We(),En&&En.c(),C=We(),M=ge("div"),k=ge("button"),R=ge("img"),B=nt(` - Add a modal filter`),G=We(),H=ge("button"),K=nt("Add many modal filters along line"),ae=We(),le=ge("button"),ve=nt("Reverse directions"),Q=We(),oe=ge("button"),oe.textContent="Change modal filter type",qe=We(),Pe=ge("label"),it=ge("input"),ft=nt(` - Animate shortcuts`),Xe=We(),Mt=ge("div"),At=ge("button"),On.c(),zt=We(),Tt=ge("button"),Ce.c(),Rn=We(),ot&&ot.c(),ai(R.src,N=`/ltn//filters/${t[9]}_icon.gif`)||Le(R,"src",N),Le(R,"width","30"),Le(R,"alt","Add a modal filter"),k.disabled=F=t[0]=="filter",Le(k,"data-tooltip","hotkey 1"),H.disabled=_e=t[0]=="freehand-filters",Le(H,"data-tooltip","hotkey 2"),le.disabled=ke=t[0]=="oneway",Le(le,"data-tooltip","hotkey 3"),lr(M,"display","flex"),lr(M,"justify-content","space-between"),Le(it,"type","checkbox"),At.disabled=yt=t[4]==0,Le(At,"data-tooltip","Ctrl+Z"),Tt.disabled=tn=t[5]==0,Le(Tt,"data-tooltip","Ctrl+Y"),lr(Mt,"display","flex"),lr(Mt,"justify-content","space-between"),Le(e,"slot","sidebar")},m(kt,Re){be(kt,e,Re),te(e,n),te(n,r),te(n,i),te(i,c),te(n,l),te(n,v),te(n,S),te(e,E),En&&En.m(e,null),te(e,C),te(e,M),te(M,k),te(k,R),te(k,B),te(M,G),te(M,H),te(H,K),te(M,ae),te(M,le),te(le,ve),te(e,Q),te(e,oe),te(e,qe),te(e,Pe),te(Pe,it),it.checked=t[10],te(Pe,ft),te(e,Xe),te(e,Mt),te(Mt,At),On.m(At,null),te(Mt,zt),te(Mt,Tt),Ce.m(Tt,null),te(e,Rn),ot&&ot.m(e,null),Jt=!0,pn||(Nn=[Lt(k,"click",t[19]),Lt(H,"click",t[20]),Lt(le,"click",t[21]),Lt(oe,"click",t[22]),Lt(it,"change",t[23]),Lt(At,"click",t[15]),Lt(Tt,"click",t[16])],pn=!0)},p(kt,Re){(!Jt||Re[0]&64)&&s!==(s=kr(kt[6]).properties.name+"")&&Hn(c,s),(!Jt||Re[0]&2)&&d!==(d=kt[1].area_km2.toFixed(1)+"")&&Hn(v,d),kt[8]>0?En||(En=tE(),En.c(),En.m(e,C)):En&&(En.d(1),En=null),(!Jt||Re[0]&512&&!ai(R.src,N=`/ltn//filters/${kt[9]}_icon.gif`))&&Le(R,"src",N),(!Jt||Re[0]&1&&F!==(F=kt[0]=="filter"))&&(k.disabled=F),(!Jt||Re[0]&1&&_e!==(_e=kt[0]=="freehand-filters"))&&(H.disabled=_e),(!Jt||Re[0]&1&&ke!==(ke=kt[0]=="oneway"))&&(le.disabled=ke),Re[0]&1024&&(it.checked=kt[10]),Jn===(Jn=Nr(kt))&&On?On.p(kt,Re):(On.d(1),On=Jn(kt),On&&(On.c(),On.m(At,null))),(!Jt||Re[0]&16&&yt!==(yt=kt[4]==0))&&(At.disabled=yt),ne===(ne=Qn(kt))&&Ce?Ce.p(kt,Re):(Ce.d(1),Ce=ne(kt),Ce&&(Ce.c(),Ce.m(Tt,null))),(!Jt||Re[0]&32&&tn!==(tn=kt[5]==0))&&(Tt.disabled=tn),kt[3]?ot?(ot.p(kt,Re),Re[0]&8&&se(ot,1)):(ot=nE(kt),ot.c(),se(ot,1),ot.m(e,null)):ot&&(kn(),de(ot,1,1,()=>{ot=null}),Dn())},i(kt){Jt||(se(ot),Jt=!0)},o(kt){de(ot),Jt=!1},d(kt){kt&&ye(e),En&&En.d(),On.d(),Ce.d(),ot&&ot.d(),pn=!1,Yr(Nn)}}}function V6(t){let e;return{c(){e=ge("p"),e.textContent="Click to change direction"},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function U6(t){let e,n,r,i;return{c(){e=ge("div"),n=ge("img"),i=nt(` - Click to add modal filter`),ai(n.src,r=`/ltn//filters/${t[9]}_icon.gif`)||Le(n,"src",r),Le(n,"width","20"),Le(n,"alt","Add modal filter")},m(s,c){be(s,e,c),te(e,n),te(e,i)},p(s,c){c[0]&512&&!ai(n.src,r=`/ltn//filters/${s[9]}_icon.gif`)&&Le(n,"src",r)},d(s){s&&ye(e)}}}function j6(t){let e,n=t[33].shortcuts+"",r,i,s=(t[33].name??"unnamed road")+"",c,l,d;function v(C,M){return C[0]=="filter"?U6:V6}let S=v(t),E=S(t);return{c(){e=ge("p"),r=nt(n),i=nt(" shortcuts through "),c=nt(s),l=We(),E.c(),d=Pi()},m(C,M){be(C,e,M),te(e,r),te(e,i),te(e,c),be(C,l,M),E.m(C,M),be(C,d,M)},p(C,M){M[1]&4&&n!==(n=C[33].shortcuts+"")&&Hn(r,n),M[1]&4&&s!==(s=(C[33].name??"unnamed road")+"")&&Hn(c,s),S===(S=v(C))&&E?E.p(C,M):(E.d(1),E=S(C),E&&(E.c(),E.m(d.parentNode,d)))},d(C){C&&(ye(e),ye(l),ye(d)),E.d(C)}}}function G6(t){let e,n,r;return n=new xu({props:{openOn:"hover",$$slots:{default:[j6,({props:i})=>({33:i}),({props:i})=>[0,i?4:0]]},$$scope:{ctx:t}}}),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","line-popup")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s[0]&513|s[1]&12&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function rE(t){let e,n;return e=new C6({props:{paths:t[7]}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i[0]&128&&(s.paths=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function q6(t){let e;return{c(){e=nt("Click to delete")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function W6(t){let e,n;return e=new xu({props:{openOn:"hover",$$slots:{default:[q6]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i[1]&8&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function iE(t){let e,n;return e=new VF({props:{map:kr(t[2])}}),e.$on("done",t[17]),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i[0]&4&&(s.map=kr(r[2])),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function H6(t){let e,n,r,i,s,c,l;n=new Sy({props:{gjInput:t[1],interactive:t[0]=="filter"||t[0]=="oneway",onClickLine:t[12],$$slots:{"line-popup":[G6]},$$scope:{ctx:t}}});let d=t[10]&&rE(t);s=new Ey({props:{$$slots:{default:[W6]},$$scope:{ctx:t}}}),s.$on("click",t[13]);let v=t[0]=="freehand-filters"&&iE(t);return{c(){e=ge("div"),je(n.$$.fragment),r=We(),d&&d.c(),i=We(),je(s.$$.fragment),c=We(),v&&v.c(),Le(e,"slot","map")},m(S,E){be(S,e,E),Be(n,e,null),te(e,r),d&&d.m(e,null),te(e,i),Be(s,e,null),te(e,c),v&&v.m(e,null),l=!0},p(S,E){const C={};E[0]&2&&(C.gjInput=S[1]),E[0]&1&&(C.interactive=S[0]=="filter"||S[0]=="oneway"),E[0]&513|E[1]&8&&(C.$$scope={dirty:E,ctx:S}),n.$set(C),S[10]?d?(d.p(S,E),E[0]&1024&&se(d,1)):(d=rE(S),d.c(),se(d,1),d.m(e,i)):d&&(kn(),de(d,1,1,()=>{d=null}),Dn());const M={};E[1]&8&&(M.$$scope={dirty:E,ctx:S}),s.$set(M),S[0]=="freehand-filters"?v?(v.p(S,E),E[0]&1&&se(v,1)):(v=iE(S),v.c(),se(v,1),v.m(e,null)):v&&(kn(),de(v,1,1,()=>{v=null}),Dn())},i(S){l||(se(n.$$.fragment,S),se(d),se(s.$$.fragment,S),se(v),l=!0)},o(S){de(n.$$.fragment,S),de(d),de(s.$$.fragment,S),de(v),l=!1},d(S){S&&ye(e),Ve(n),d&&d.d(),Ve(s),v&&v.d()}}}function Z6(t){let e,n,r,i;return e=new bu({props:{$$slots:{map:[H6],sidebar:[B6],top:[R6]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(s,c){Be(e,s,c),n=!0,r||(i=Lt(window,"keydown",t[14]),r=!0)},p(s,c){const l={};c[0]&4095|c[1]&8&&(l.$$scope={dirty:c,ctx:s}),e.$set(l)},i(s){n||(se(e.$$.fragment,s),n=!0)},o(s){de(e.$$.fragment,s),n=!1},d(s){Ve(e,s),r=!1,i()}}}function X6(t,e,n){let r,i,s,c,l,d,v;vt(t,qu,yt=>n(18,i=yt)),vt(t,jv,yt=>n(9,s=yt)),vt(t,Gi,yt=>n(31,c=yt)),vt(t,uu,yt=>n(2,l=yt)),vt(t,w2,yt=>n(10,d=yt)),vt(t,bn,yt=>n(11,v=yt));let S="filter",E=!1,C=0,M=0,k,R,N=JSON.parse(c.getAllShortcuts());ro(()=>{l.doubleClickZoom.enable()});function B(yt){n(1,R=JSON.parse(c.renderNeighbourhood())),n(6,k=R.features.find(zt=>zt.properties.kind=="boundary")),n(4,C=R.undo_length),n(5,M=R.redo_length),n(7,N=JSON.parse(c.getAllShortcuts())),Nf()}function F(yt,zt){S=="filter"?(c.addModalFilter(zt,s),Bt(qu,i++,i)):S=="oneway"&&(c.toggleDirection(yt.properties.road),Bt(qu,i++,i))}function G(yt){let zt=yt.detail.features[0];c.deleteModalFilter(zt.properties.road),Bt(qu,i++,i)}function H(yt){yt.target.tagName!="INPUT"&&(yt.ctrlKey&&yt.key=="z"&&K(),yt.ctrlKey&&yt.key=="y"&&_e(),yt.key=="1"&&n(0,S="filter"),yt.key=="2"&&n(0,S="freehand-filters"),yt.key=="3"&&n(0,S="oneway"))}function K(){c.undo(),Bt(qu,i++,i)}function _e(){c.redo(),Bt(qu,i++,i)}function ae(yt){let zt=yt.detail;zt&&(c.addManyModalFilters(zt,s),Bt(qu,i++,i)),n(0,S="filter")}const le=()=>n(0,S="filter"),ve=()=>n(0,S="freehand-filters"),ke=()=>n(0,S="oneway"),Q=()=>n(3,E=!0);function oe(){d=this.checked,w2.set(d)}const qe=()=>n(3,E=!1),Pe=()=>Bt(bn,v={mode:"title"},v),it=()=>Bt(bn,v={mode:"network"},v),ft=()=>Bt(bn,v={mode:"view-shortcuts"},v),Xe=()=>Bt(bn,v={mode:"route",prevMode:"neighbourhood"},v),Mt=()=>Bt(bn,v={mode:"set-boundary",name:kr(k).properties.name,existing:k},v),At=()=>Bt(bn,v={mode:"debug"},v);return t.$$.update=()=>{t.$$.dirty[0]&5&&(S=="oneway"?l.doubleClickZoom.disable():l.doubleClickZoom.enable()),t.$$.dirty[0]&262144&&B(),t.$$.dirty[0]&2&&n(8,r=R.features.filter(yt=>yt.properties.kind=="cell"&&yt.properties.cell_color=="disconnected").length)},[S,R,l,E,C,M,k,N,r,s,d,v,F,G,H,K,_e,ae,i,le,ve,ke,Q,oe,qe,Pe,it,ft,Xe,Mt,At]}class $6 extends Zt{constructor(e){super(),Ht(this,e,X6,Z6,Ut,{},null,[-1,-1])}}const RT="/ltn/assets/delete-ec75e756.svg",NT="/ltn/assets/edit-f3f51206.svg";function oE(t,e,n){const r=t.slice();return r[19]=e[n],r}function Y6(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function K6(t){let e;return{c(){e=ge("p"),e.textContent=`Inside the neighbourhood you define, the goal is to eliminate (or + leaving the boundary you've drawn.`},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function M6(t){let e;return{c(){e=nt("View shortcuts")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function A6(t){let e;return{c(){e=nt("Route")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function k6(t){let e;return{c(){e=nt("Change this boundary")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function D6(t){let e;return{c(){e=nt("Debug")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function R6(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,F,U,z,G,q,X,de,ae,le,ye,ke,Q;return s=new or({props:{$$slots:{default:[T6]},$$scope:{ctx:t}}}),s.$on("click",t[25]),d=new or({props:{$$slots:{default:[L6]},$$scope:{ctx:t}}}),d.$on("click",t[26]),C=new wT({props:{$$slots:{default:[P6]},$$scope:{ctx:t}}}),U=new or({props:{$$slots:{default:[M6]},$$scope:{ctx:t}}}),U.$on("click",t[27]),q=new or({props:{$$slots:{default:[A6]},$$scope:{ctx:t}}}),q.$on("click",t[28]),ae=new or({props:{$$slots:{default:[k6]},$$scope:{ctx:t}}}),ae.$on("click",t[29]),ke=new or({props:{$$slots:{default:[D6]},$$scope:{ctx:t}}}),ke.$on("click",t[30]),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),Ue(d.$$.fragment),v=We(),S=_e("li"),E=nt(`Editing + `),Ue(C.$$.fragment),M=We(),k=_e("nav"),R=_e("ul"),F=_e("li"),Ue(U.$$.fragment),z=We(),G=_e("li"),Ue(q.$$.fragment),X=We(),de=_e("li"),Ue(ae.$$.fragment),le=We(),ye=_e("li"),Ue(ke.$$.fragment),Le(n,"aria-label","breadcrumb"),Le(e,"slot","top"),lr(e,"display","flex"),lr(e,"justify-content","space-between")},m(oe,qe){be(oe,e,qe),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),te(S,E),Be(C,S,null),te(e,M),te(e,k),te(k,R),te(R,F),Be(U,F,null),te(R,z),te(R,G),Be(q,G,null),te(R,X),te(R,de),Be(ae,de,null),te(R,le),te(R,ye),Be(ke,ye,null),Q=!0},p(oe,qe){const Pe={};qe[1]&8&&(Pe.$$scope={dirty:qe,ctx:oe}),s.$set(Pe);const it={};qe[1]&8&&(it.$$scope={dirty:qe,ctx:oe}),d.$set(it);const ft={};qe[1]&8&&(ft.$$scope={dirty:qe,ctx:oe}),C.$set(ft);const Xe={};qe[1]&8&&(Xe.$$scope={dirty:qe,ctx:oe}),U.$set(Xe);const Mt={};qe[1]&8&&(Mt.$$scope={dirty:qe,ctx:oe}),q.$set(Mt);const At={};qe[1]&8&&(At.$$scope={dirty:qe,ctx:oe}),ae.$set(At);const yt={};qe[1]&8&&(yt.$$scope={dirty:qe,ctx:oe}),ke.$set(yt)},i(oe){Q||(se(s.$$.fragment,oe),se(d.$$.fragment,oe),se(C.$$.fragment,oe),se(U.$$.fragment,oe),se(q.$$.fragment,oe),se(ae.$$.fragment,oe),se(ke.$$.fragment,oe),Q=!0)},o(oe){me(s.$$.fragment,oe),me(d.$$.fragment,oe),me(C.$$.fragment,oe),me(U.$$.fragment,oe),me(q.$$.fragment,oe),me(ae.$$.fragment,oe),me(ke.$$.fragment,oe),Q=!1},d(oe){oe&&ve(e),Ve(s),Ve(d),Ve(C),Ve(U),Ve(q),Ve(ae),Ve(ke)}}}function tE(t){let e;return{c(){e=_e("mark"),e.textContent=`Some parts of the neighbourhood aren't reachable by drivers, shown in + red`},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function N6(t){let e,n,r;return{c(){e=nt("Undo ("),n=nt(t[4]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s[0]&16&&Hn(n,i[4])},d(i){i&&(ve(e),ve(n),ve(r))}}}function O6(t){let e;return{c(){e=nt("Undo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function z6(t){let e,n,r;return{c(){e=nt("Redo ("),n=nt(t[5]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s[0]&32&&Hn(n,i[5])},d(i){i&&(ve(e),ve(n),ve(r))}}}function F6(t){let e;return{c(){e=nt("Redo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function nE(t){let e,n;return e=new OF({}),e.$on("close",t[24]),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p:Ct,i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function B6(t){let e,n,r,i,s=kr(t[6]).properties.name+"",c,l,d=t[1].area_km2.toFixed(1)+"",v,S,E,C,M,k,R,F,U,z,G,q,X,de,ae,le,ye,ke,Q,oe,qe,Pe,it,ft,Xe,Mt,At,yt,zt,Tt,tn,Rn,Jt,pn,Nn,En=t[8]>0&&tE();function Nr(kt,Re){return kt[4]==0?O6:N6}let Jn=Nr(t),On=Jn(t);function Qn(kt,Re){return kt[5]==0?F6:z6}let ne=Qn(t),Ce=ne(t),ot=t[3]&&nE(t);return{c(){e=_e("div"),n=_e("p"),r=nt("Editing neighbourhood "),i=_e("u"),c=nt(s),l=nt(` + , with an area of `),v=nt(d),S=nt(" km²"),E=We(),En&&En.c(),C=We(),M=_e("div"),k=_e("button"),R=_e("img"),U=nt(` + Add a modal filter`),G=We(),q=_e("button"),X=nt("Add many modal filters along line"),ae=We(),le=_e("button"),ye=nt("Reverse directions"),Q=We(),oe=_e("button"),oe.textContent="Change modal filter type",qe=We(),Pe=_e("label"),it=_e("input"),ft=nt(` + Animate shortcuts`),Xe=We(),Mt=_e("div"),At=_e("button"),On.c(),zt=We(),Tt=_e("button"),Ce.c(),Rn=We(),ot&&ot.c(),li(R.src,F=`/ltn//filters/${t[9]}_icon.gif`)||Le(R,"src",F),Le(R,"width","30"),Le(R,"alt","Add a modal filter"),k.disabled=z=t[0]=="filter",Le(k,"data-tooltip","hotkey 1"),q.disabled=de=t[0]=="freehand-filters",Le(q,"data-tooltip","hotkey 2"),le.disabled=ke=t[0]=="oneway",Le(le,"data-tooltip","hotkey 3"),lr(M,"display","flex"),lr(M,"justify-content","space-between"),Le(it,"type","checkbox"),At.disabled=yt=t[4]==0,Le(At,"data-tooltip","Ctrl+Z"),Tt.disabled=tn=t[5]==0,Le(Tt,"data-tooltip","Ctrl+Y"),lr(Mt,"display","flex"),lr(Mt,"justify-content","space-between"),Le(e,"slot","sidebar")},m(kt,Re){be(kt,e,Re),te(e,n),te(n,r),te(n,i),te(i,c),te(n,l),te(n,v),te(n,S),te(e,E),En&&En.m(e,null),te(e,C),te(e,M),te(M,k),te(k,R),te(k,U),te(M,G),te(M,q),te(q,X),te(M,ae),te(M,le),te(le,ye),te(e,Q),te(e,oe),te(e,qe),te(e,Pe),te(Pe,it),it.checked=t[10],te(Pe,ft),te(e,Xe),te(e,Mt),te(Mt,At),On.m(At,null),te(Mt,zt),te(Mt,Tt),Ce.m(Tt,null),te(e,Rn),ot&&ot.m(e,null),Jt=!0,pn||(Nn=[Lt(k,"click",t[19]),Lt(q,"click",t[20]),Lt(le,"click",t[21]),Lt(oe,"click",t[22]),Lt(it,"change",t[23]),Lt(At,"click",t[15]),Lt(Tt,"click",t[16])],pn=!0)},p(kt,Re){(!Jt||Re[0]&64)&&s!==(s=kr(kt[6]).properties.name+"")&&Hn(c,s),(!Jt||Re[0]&2)&&d!==(d=kt[1].area_km2.toFixed(1)+"")&&Hn(v,d),kt[8]>0?En||(En=tE(),En.c(),En.m(e,C)):En&&(En.d(1),En=null),(!Jt||Re[0]&512&&!li(R.src,F=`/ltn//filters/${kt[9]}_icon.gif`))&&Le(R,"src",F),(!Jt||Re[0]&1&&z!==(z=kt[0]=="filter"))&&(k.disabled=z),(!Jt||Re[0]&1&&de!==(de=kt[0]=="freehand-filters"))&&(q.disabled=de),(!Jt||Re[0]&1&&ke!==(ke=kt[0]=="oneway"))&&(le.disabled=ke),Re[0]&1024&&(it.checked=kt[10]),Jn===(Jn=Nr(kt))&&On?On.p(kt,Re):(On.d(1),On=Jn(kt),On&&(On.c(),On.m(At,null))),(!Jt||Re[0]&16&&yt!==(yt=kt[4]==0))&&(At.disabled=yt),ne===(ne=Qn(kt))&&Ce?Ce.p(kt,Re):(Ce.d(1),Ce=ne(kt),Ce&&(Ce.c(),Ce.m(Tt,null))),(!Jt||Re[0]&32&&tn!==(tn=kt[5]==0))&&(Tt.disabled=tn),kt[3]?ot?(ot.p(kt,Re),Re[0]&8&&se(ot,1)):(ot=nE(kt),ot.c(),se(ot,1),ot.m(e,null)):ot&&(kn(),me(ot,1,1,()=>{ot=null}),Dn())},i(kt){Jt||(se(ot),Jt=!0)},o(kt){me(ot),Jt=!1},d(kt){kt&&ve(e),En&&En.d(),On.d(),Ce.d(),ot&&ot.d(),pn=!1,Kr(Nn)}}}function V6(t){let e;return{c(){e=_e("p"),e.textContent="Click to change direction"},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function U6(t){let e,n,r,i;return{c(){e=_e("div"),n=_e("img"),i=nt(` + Click to add modal filter`),li(n.src,r=`/ltn//filters/${t[9]}_icon.gif`)||Le(n,"src",r),Le(n,"width","20"),Le(n,"alt","Add modal filter")},m(s,c){be(s,e,c),te(e,n),te(e,i)},p(s,c){c[0]&512&&!li(n.src,r=`/ltn//filters/${s[9]}_icon.gif`)&&Le(n,"src",r)},d(s){s&&ve(e)}}}function j6(t){let e,n=t[33].shortcuts+"",r,i,s=(t[33].name??"unnamed road")+"",c,l,d;function v(C,M){return C[0]=="filter"?U6:V6}let S=v(t),E=S(t);return{c(){e=_e("p"),r=nt(n),i=nt(" shortcuts through "),c=nt(s),l=We(),E.c(),d=Pi()},m(C,M){be(C,e,M),te(e,r),te(e,i),te(e,c),be(C,l,M),E.m(C,M),be(C,d,M)},p(C,M){M[1]&4&&n!==(n=C[33].shortcuts+"")&&Hn(r,n),M[1]&4&&s!==(s=(C[33].name??"unnamed road")+"")&&Hn(c,s),S===(S=v(C))&&E?E.p(C,M):(E.d(1),E=S(C),E&&(E.c(),E.m(d.parentNode,d)))},d(C){C&&(ve(e),ve(l),ve(d)),E.d(C)}}}function G6(t){let e,n,r;return n=new wu({props:{openOn:"hover",$$slots:{default:[j6,({props:i})=>({33:i}),({props:i})=>[0,i?4:0]]},$$scope:{ctx:t}}}),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","line-popup")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s[0]&513|s[1]&12&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function rE(t){let e,n;return e=new C6({props:{paths:t[7]}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i[0]&128&&(s.paths=r[7]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function q6(t){let e;return{c(){e=nt("Click to delete")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function W6(t){let e,n;return e=new wu({props:{openOn:"hover",$$slots:{default:[q6]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i[1]&8&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function iE(t){let e,n;return e=new VF({props:{map:kr(t[2])}}),e.$on("done",t[17]),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i[0]&4&&(s.map=kr(r[2])),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function H6(t){let e,n,r,i,s,c,l;n=new Sy({props:{gjInput:t[1],interactive:t[0]=="filter"||t[0]=="oneway",onClickLine:t[12],$$slots:{"line-popup":[G6]},$$scope:{ctx:t}}});let d=t[10]&&rE(t);s=new Ey({props:{$$slots:{default:[W6]},$$scope:{ctx:t}}}),s.$on("click",t[13]);let v=t[0]=="freehand-filters"&&iE(t);return{c(){e=_e("div"),Ue(n.$$.fragment),r=We(),d&&d.c(),i=We(),Ue(s.$$.fragment),c=We(),v&&v.c(),Le(e,"slot","map")},m(S,E){be(S,e,E),Be(n,e,null),te(e,r),d&&d.m(e,null),te(e,i),Be(s,e,null),te(e,c),v&&v.m(e,null),l=!0},p(S,E){const C={};E[0]&2&&(C.gjInput=S[1]),E[0]&1&&(C.interactive=S[0]=="filter"||S[0]=="oneway"),E[0]&513|E[1]&8&&(C.$$scope={dirty:E,ctx:S}),n.$set(C),S[10]?d?(d.p(S,E),E[0]&1024&&se(d,1)):(d=rE(S),d.c(),se(d,1),d.m(e,i)):d&&(kn(),me(d,1,1,()=>{d=null}),Dn());const M={};E[1]&8&&(M.$$scope={dirty:E,ctx:S}),s.$set(M),S[0]=="freehand-filters"?v?(v.p(S,E),E[0]&1&&se(v,1)):(v=iE(S),v.c(),se(v,1),v.m(e,null)):v&&(kn(),me(v,1,1,()=>{v=null}),Dn())},i(S){l||(se(n.$$.fragment,S),se(d),se(s.$$.fragment,S),se(v),l=!0)},o(S){me(n.$$.fragment,S),me(d),me(s.$$.fragment,S),me(v),l=!1},d(S){S&&ve(e),Ve(n),d&&d.d(),Ve(s),v&&v.d()}}}function Z6(t){let e,n,r,i;return e=new xu({props:{$$slots:{map:[H6],sidebar:[B6],top:[R6]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(s,c){Be(e,s,c),n=!0,r||(i=Lt(window,"keydown",t[14]),r=!0)},p(s,c){const l={};c[0]&4095|c[1]&8&&(l.$$scope={dirty:c,ctx:s}),e.$set(l)},i(s){n||(se(e.$$.fragment,s),n=!0)},o(s){me(e.$$.fragment,s),n=!1},d(s){Ve(e,s),r=!1,i()}}}function X6(t,e,n){let r,i,s,c,l,d,v;vt(t,Wu,yt=>n(18,i=yt)),vt(t,jv,yt=>n(9,s=yt)),vt(t,Gi,yt=>n(31,c=yt)),vt(t,uu,yt=>n(2,l=yt)),vt(t,w2,yt=>n(10,d=yt)),vt(t,bn,yt=>n(11,v=yt));let S="filter",E=!1,C=0,M=0,k,R,F=JSON.parse(c.getAllShortcuts());ro(()=>{l.doubleClickZoom.enable()});function U(yt){n(1,R=JSON.parse(c.renderNeighbourhood())),n(6,k=R.features.find(zt=>zt.properties.kind=="boundary")),n(4,C=R.undo_length),n(5,M=R.redo_length),n(7,F=JSON.parse(c.getAllShortcuts())),Nf()}function z(yt,zt){S=="filter"?(c.addModalFilter(zt,s),Bt(Wu,i++,i)):S=="oneway"&&(c.toggleDirection(yt.properties.road),Bt(Wu,i++,i))}function G(yt){let zt=yt.detail.features[0];c.deleteModalFilter(zt.properties.road),Bt(Wu,i++,i)}function q(yt){yt.target.tagName!="INPUT"&&(yt.ctrlKey&&yt.key=="z"&&X(),yt.ctrlKey&&yt.key=="y"&&de(),yt.key=="1"&&n(0,S="filter"),yt.key=="2"&&n(0,S="freehand-filters"),yt.key=="3"&&n(0,S="oneway"))}function X(){c.undo(),Bt(Wu,i++,i)}function de(){c.redo(),Bt(Wu,i++,i)}function ae(yt){let zt=yt.detail;zt&&(c.addManyModalFilters(zt,s),Bt(Wu,i++,i)),n(0,S="filter")}const le=()=>n(0,S="filter"),ye=()=>n(0,S="freehand-filters"),ke=()=>n(0,S="oneway"),Q=()=>n(3,E=!0);function oe(){d=this.checked,w2.set(d)}const qe=()=>n(3,E=!1),Pe=()=>Bt(bn,v={mode:"title"},v),it=()=>Bt(bn,v={mode:"network"},v),ft=()=>Bt(bn,v={mode:"view-shortcuts"},v),Xe=()=>Bt(bn,v={mode:"route",prevMode:"neighbourhood"},v),Mt=()=>Bt(bn,v={mode:"set-boundary",name:kr(k).properties.name,existing:k},v),At=()=>Bt(bn,v={mode:"debug"},v);return t.$$.update=()=>{t.$$.dirty[0]&5&&(S=="oneway"?l.doubleClickZoom.disable():l.doubleClickZoom.enable()),t.$$.dirty[0]&262144&&U(),t.$$.dirty[0]&2&&n(8,r=R.features.filter(yt=>yt.properties.kind=="cell"&&yt.properties.cell_color=="disconnected").length)},[S,R,l,E,C,M,k,F,r,s,d,v,z,G,q,X,de,ae,i,le,ye,ke,Q,oe,qe,Pe,it,ft,Xe,Mt,At]}class $6 extends Zt{constructor(e){super(),Ht(this,e,X6,Z6,Ut,{},null,[-1,-1])}}const RT="/ltn/assets/delete-ec75e756.svg",NT="/ltn/assets/edit-f3f51206.svg";function oE(t,e,n){const r=t.slice();return r[19]=e[n],r}function Y6(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function K6(t){let e;return{c(){e=_e("p"),e.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 @@ -636,12 +636,12 @@ and limitations under the License. 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."`},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function J6(t){let e;return{c(){e=nt("Route")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function Q6(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R;return s=new or({props:{$$slots:{default:[Y6]},$$scope:{ctx:t}}}),s.$on("click",t[16]),v=new wT({props:{$$slots:{default:[K6]},$$scope:{ctx:t}}}),k=new or({props:{$$slots:{default:[J6]},$$scope:{ctx:t}}}),k.$on("click",t[17]),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),d=nt(`Pick neighbourhood - `),je(v.$$.fragment),S=We(),E=ge("nav"),C=ge("ul"),M=ge("li"),je(k.$$.fragment),Le(n,"aria-label","breadcrumb"),Le(e,"slot","top"),lr(e,"display","flex"),lr(e,"justify-content","space-between")},m(N,B){be(N,e,B),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),te(l,d),Be(v,l,null),te(e,S),te(e,E),te(E,C),te(C,M),Be(k,M,null),R=!0},p(N,B){const F={};B&4194304&&(F.$$scope={dirty:B,ctx:N}),s.$set(F);const G={};B&4194304&&(G.$$scope={dirty:B,ctx:N}),v.$set(G);const H={};B&4194304&&(H.$$scope={dirty:B,ctx:N}),k.$set(H)},i(N){R||(se(s.$$.fragment,N),se(v.$$.fragment,N),se(k.$$.fragment,N),R=!0)},o(N){de(s.$$.fragment,N),de(v.$$.fragment,N),de(k.$$.fragment,N),R=!1},d(N){N&&ye(e),Ve(s),Ve(v),Ve(k)}}}function eB(t){let e;return{c(){e=nt("Draw a new boundary")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function tB(t){let e;return{c(){e=nt("Use an auto-generated boundary")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function nB(t){let e=t[19]+"",n;return{c(){n=nt(e)},m(r,i){be(r,n,i)},p(r,i){i&2&&e!==(e=r[19]+"")&&Hn(n,e)},d(r){r&&ye(n)}}}function sE(t){let e,n,r,i,s,c,l,d,v,S,E;function C(){return t[13](t[19])}r=new or({props:{$$slots:{default:[nB]},$$scope:{ctx:t}}}),r.$on("click",C);function M(){return t[14](t[19])}function k(){return t[15](t[19])}return{c(){e=ge("li"),n=ge("span"),je(r.$$.fragment),i=We(),s=ge("button"),s.innerHTML=`Rename neighbourhood`,c=We(),l=ge("button"),l.innerHTML=`Delete neighbourhood`,d=We(),Le(s,"class","secondary"),Le(l,"class","secondary"),lr(n,"display","flex"),lr(n,"justify-content","space-between")},m(R,N){be(R,e,N),te(e,n),Be(r,n,null),te(n,i),te(n,s),te(n,c),te(n,l),te(e,d),v=!0,S||(E=[Lt(s,"click",M),Lt(l,"click",k)],S=!0)},p(R,N){t=R;const B={};N&4194306&&(B.$$scope={dirty:N,ctx:t}),r.$set(B)},i(R){v||(se(r.$$.fragment,R),v=!0)},o(R){de(r.$$.fragment,R),v=!1},d(R){R&&ye(e),Ve(r),S=!1,Yr(E)}}}function rB(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,N,B,F,G,H,K;r=new or({props:{$$slots:{default:[eB]},$$scope:{ctx:t}}}),r.$on("click",t[7]),c=new or({props:{$$slots:{default:[tB]},$$scope:{ctx:t}}}),c.$on("click",t[12]);let _e=zo(t[1]),ae=[];for(let ve=0;ve<_e.length;ve+=1)ae[ve]=sE(oE(t,_e,ve));const le=ve=>de(ae[ve],1,1,()=>{ae[ve]=null});return{c(){e=ge("div"),n=ge("div"),je(r.$$.fragment),i=We(),s=ge("div"),je(c.$$.fragment),l=We(),d=ge("ul");for(let ve=0;ve({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&4456448&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function sB(t){let e,n;const r=[gi("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":Of(.3,.5)}},{eventsIfTopMost:!0},{manageHoverState:!0},{hoverCursor:"pointer"}];let i={$$slots:{default:[oB]},$$scope:{ctx:t}};for(let s=0;sn(10,s=K)),vt(t,Ju,K=>n(2,c=K)),vt(t,bn,K=>n(3,l=K));function d(K){s.setCurrentNeighbourhood(K),Bt(bn,l={mode:"neighbourhood"},l)}function v(K){window.confirm(`Really delete neighbourhood ${K}? You can't undo this.`)&&(s.deleteNeighbourhoodBoundary(K),Nf(),n(0,r=JSON.parse(s.toSavefile())))}function S(K){let _e=window.prompt(`Rename neighbourhood ${K} to what?`,K);_e&&(s.renameNeighbourhoodBoundary(K,_e),Nf(),n(0,r=JSON.parse(s.toSavefile())))}function E(){let K=window.prompt("What do you want to name the neighbourhood?");K&&Bt(bn,l={mode:"set-boundary",name:K,existing:null},l)}function C(){f_(c+".geojson",s.toSavefile())}function M(){f_("debug_route_snapper.geojson",s.toRouteSnapperGj())}const k=K=>d(kr(K.detail.features[0].properties).name),R=()=>Bt(bn,l={mode:"auto-boundaries"},l),N=K=>d(K),B=K=>S(K),F=K=>v(K),G=()=>Bt(bn,l={mode:"title"},l),H=()=>Bt(bn,l={mode:"route",prevMode:"network"},l);return t.$$.update=()=>{t.$$.dirty&1024&&n(0,r=JSON.parse(s.toSavefile())),t.$$.dirty&1&&n(1,i=r.features.filter(K=>K.properties.kind=="boundary").map(K=>K.properties.name))},[r,i,c,l,d,v,S,E,C,M,s,k,R,N,B,F,G,H]}class cB extends Zt{constructor(e){super(),Ht(this,e,uB,lB,Ut,{})}}function hB(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function fB(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function aE(t){let e,n,r;return n=new or({props:{$$slots:{default:[pB]},$$scope:{ctx:t}}}),n.$on("click",t[13]),{c(){e=ge("li"),je(n.$$.fragment)},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&16384&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function pB(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function dB(t){let e,n,r,i,s,c,l,d,v,S,E,C;s=new or({props:{$$slots:{default:[hB]},$$scope:{ctx:t}}}),s.$on("click",t[11]),d=new or({props:{$$slots:{default:[fB]},$$scope:{ctx:t}}}),d.$on("click",t[12]);let M=t[0]=="neighbourhood"&&aE(t);return{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),je(d.$$.fragment),v=We(),M&&M.c(),S=We(),E=ge("li"),E.textContent="Routing",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(k,R){be(k,e,R),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),M&&M.m(r,null),te(r,S),te(r,E),C=!0},p(k,R){const N={};R&16384&&(N.$$scope={dirty:R,ctx:k}),s.$set(N);const B={};R&16384&&(B.$$scope={dirty:R,ctx:k}),d.$set(B),k[0]=="neighbourhood"?M?(M.p(k,R),R&1&&se(M,1)):(M=aE(k),M.c(),se(M,1),M.m(r,S)):M&&(kn(),de(M,1,1,()=>{M=null}),Dn())},i(k){C||(se(s.$$.fragment,k),se(d.$$.fragment,k),se(M),C=!0)},o(k){de(s.$$.fragment,k),de(d.$$.fragment,k),de(M),C=!1},d(k){k&&ye(e),Ve(s),Ve(d),M&&M.d()}}}function mB(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,N,B;return n=new wy({}),n.$on("click",t[7]),{c(){e=ge("div"),je(n.$$.fragment),r=We(),i=ge("p"),i.textContent="Drag markers for a route",s=We(),c=ge("p"),c.innerHTML=`Route before + definition of "neighbourhood."`},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function J6(t){let e;return{c(){e=nt("Route")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function Q6(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R;return s=new or({props:{$$slots:{default:[Y6]},$$scope:{ctx:t}}}),s.$on("click",t[16]),v=new wT({props:{$$slots:{default:[K6]},$$scope:{ctx:t}}}),k=new or({props:{$$slots:{default:[J6]},$$scope:{ctx:t}}}),k.$on("click",t[17]),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),d=nt(`Pick neighbourhood + `),Ue(v.$$.fragment),S=We(),E=_e("nav"),C=_e("ul"),M=_e("li"),Ue(k.$$.fragment),Le(n,"aria-label","breadcrumb"),Le(e,"slot","top"),lr(e,"display","flex"),lr(e,"justify-content","space-between")},m(F,U){be(F,e,U),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),te(l,d),Be(v,l,null),te(e,S),te(e,E),te(E,C),te(C,M),Be(k,M,null),R=!0},p(F,U){const z={};U&4194304&&(z.$$scope={dirty:U,ctx:F}),s.$set(z);const G={};U&4194304&&(G.$$scope={dirty:U,ctx:F}),v.$set(G);const q={};U&4194304&&(q.$$scope={dirty:U,ctx:F}),k.$set(q)},i(F){R||(se(s.$$.fragment,F),se(v.$$.fragment,F),se(k.$$.fragment,F),R=!0)},o(F){me(s.$$.fragment,F),me(v.$$.fragment,F),me(k.$$.fragment,F),R=!1},d(F){F&&ve(e),Ve(s),Ve(v),Ve(k)}}}function eB(t){let e;return{c(){e=nt("Draw a new boundary")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function tB(t){let e;return{c(){e=nt("Use an auto-generated boundary")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function nB(t){let e=t[19]+"",n;return{c(){n=nt(e)},m(r,i){be(r,n,i)},p(r,i){i&2&&e!==(e=r[19]+"")&&Hn(n,e)},d(r){r&&ve(n)}}}function sE(t){let e,n,r,i,s,c,l,d,v,S,E;function C(){return t[13](t[19])}r=new or({props:{$$slots:{default:[nB]},$$scope:{ctx:t}}}),r.$on("click",C);function M(){return t[14](t[19])}function k(){return t[15](t[19])}return{c(){e=_e("li"),n=_e("span"),Ue(r.$$.fragment),i=We(),s=_e("button"),s.innerHTML=`Rename neighbourhood`,c=We(),l=_e("button"),l.innerHTML=`Delete neighbourhood`,d=We(),Le(s,"class","secondary"),Le(l,"class","secondary"),lr(n,"display","flex"),lr(n,"justify-content","space-between")},m(R,F){be(R,e,F),te(e,n),Be(r,n,null),te(n,i),te(n,s),te(n,c),te(n,l),te(e,d),v=!0,S||(E=[Lt(s,"click",M),Lt(l,"click",k)],S=!0)},p(R,F){t=R;const U={};F&4194306&&(U.$$scope={dirty:F,ctx:t}),r.$set(U)},i(R){v||(se(r.$$.fragment,R),v=!0)},o(R){me(r.$$.fragment,R),v=!1},d(R){R&&ve(e),Ve(r),S=!1,Kr(E)}}}function rB(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,F,U,z,G,q,X;r=new or({props:{$$slots:{default:[eB]},$$scope:{ctx:t}}}),r.$on("click",t[7]),c=new or({props:{$$slots:{default:[tB]},$$scope:{ctx:t}}}),c.$on("click",t[12]);let de=zo(t[1]),ae=[];for(let ye=0;yeme(ae[ye],1,1,()=>{ae[ye]=null});return{c(){e=_e("div"),n=_e("div"),Ue(r.$$.fragment),i=We(),s=_e("div"),Ue(c.$$.fragment),l=We(),d=_e("ul");for(let ye=0;ye({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&4456448&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function sB(t){let e,n;const r=[ai("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":Of(.3,.5)}},{eventsIfTopMost:!0},{manageHoverState:!0},{hoverCursor:"pointer"}];let i={$$slots:{default:[oB]},$$scope:{ctx:t}};for(let s=0;sn(10,s=X)),vt(t,Qu,X=>n(2,c=X)),vt(t,bn,X=>n(3,l=X));function d(X){s.setCurrentNeighbourhood(X),Bt(bn,l={mode:"neighbourhood"},l)}function v(X){window.confirm(`Really delete neighbourhood ${X}? You can't undo this.`)&&(s.deleteNeighbourhoodBoundary(X),Nf(),n(0,r=JSON.parse(s.toSavefile())))}function S(X){let de=window.prompt(`Rename neighbourhood ${X} to what?`,X);de&&(s.renameNeighbourhoodBoundary(X,de),Nf(),n(0,r=JSON.parse(s.toSavefile())))}function E(){let X=window.prompt("What do you want to name the neighbourhood?");X&&Bt(bn,l={mode:"set-boundary",name:X,existing:null},l)}function C(){f_(c+".geojson",s.toSavefile())}function M(){f_("debug_route_snapper.geojson",s.toRouteSnapperGj())}const k=X=>d(kr(X.detail.features[0].properties).name),R=()=>Bt(bn,l={mode:"auto-boundaries"},l),F=X=>d(X),U=X=>S(X),z=X=>v(X),G=()=>Bt(bn,l={mode:"title"},l),q=()=>Bt(bn,l={mode:"route",prevMode:"network"},l);return t.$$.update=()=>{t.$$.dirty&1024&&n(0,r=JSON.parse(s.toSavefile())),t.$$.dirty&1&&n(1,i=r.features.filter(X=>X.properties.kind=="boundary").map(X=>X.properties.name))},[r,i,c,l,d,v,S,E,C,M,s,k,R,F,U,z,G,q]}class cB extends Zt{constructor(e){super(),Ht(this,e,uB,lB,Ut,{})}}function hB(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function fB(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function aE(t){let e,n,r;return n=new or({props:{$$slots:{default:[pB]},$$scope:{ctx:t}}}),n.$on("click",t[13]),{c(){e=_e("li"),Ue(n.$$.fragment)},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&16384&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function pB(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function dB(t){let e,n,r,i,s,c,l,d,v,S,E,C;s=new or({props:{$$slots:{default:[hB]},$$scope:{ctx:t}}}),s.$on("click",t[11]),d=new or({props:{$$slots:{default:[fB]},$$scope:{ctx:t}}}),d.$on("click",t[12]);let M=t[0]=="neighbourhood"&&aE(t);return{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),Ue(d.$$.fragment),v=We(),M&&M.c(),S=We(),E=_e("li"),E.textContent="Routing",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(k,R){be(k,e,R),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),M&&M.m(r,null),te(r,S),te(r,E),C=!0},p(k,R){const F={};R&16384&&(F.$$scope={dirty:R,ctx:k}),s.$set(F);const U={};R&16384&&(U.$$scope={dirty:R,ctx:k}),d.$set(U),k[0]=="neighbourhood"?M?(M.p(k,R),R&1&&se(M,1)):(M=aE(k),M.c(),se(M,1),M.m(r,S)):M&&(kn(),me(M,1,1,()=>{M=null}),Dn())},i(k){C||(se(s.$$.fragment,k),se(d.$$.fragment,k),se(M),C=!0)},o(k){me(s.$$.fragment,k),me(d.$$.fragment,k),me(M),C=!1},d(k){k&&ve(e),Ve(s),Ve(d),M&&M.d()}}}function mB(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,F,U;return n=new wy({}),n.$on("click",t[7]),{c(){e=_e("div"),Ue(n.$$.fragment),r=We(),i=_e("p"),i.textContent="Drag markers for a route",s=We(),c=_e("p"),c.innerHTML=`Route before , - route after`,l=We(),d=ge("label"),v=nt("Slow-down factor for main roads: "),S=nt(t[1]),E=We(),C=ge("input"),M=We(),k=ge("i"),k.textContent=`Increase to see how drivers may detour in heavy traffic. 1 means - free-flow.`,Le(C,"type","range"),Le(C,"min","1.0"),Le(C,"max","5.0"),Le(C,"step","0.1"),Le(e,"slot","sidebar")},m(F,G){be(F,e,G),Be(n,e,null),te(e,r),te(e,i),te(e,s),te(e,c),te(e,l),te(e,d),te(d,v),te(d,S),te(d,E),te(d,C),vo(C,t[1]),te(e,M),te(e,k),R=!0,N||(B=[Lt(C,"change",t[10]),Lt(C,"input",t[10])],N=!0)},p(F,G){(!R||G&2)&&Hn(S,F[1]),G&2&&vo(C,F[1])},i(F){R||(se(n.$$.fragment,F),R=!0)},o(F){de(n.$$.fragment,F),R=!1},d(F){F&&ye(e),Ve(n),N=!1,Yr(B)}}}function lE(t){let e,n;return e=new Sy({props:{gjInput:JSON.parse(kr(t[4]).renderNeighbourhood()),interactive:!1}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&16&&(s.gjInput=JSON.parse(kr(r[4]).renderNeighbourhood())),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function gB(t){let e,n;const r=[gi("compare-route"),{paint:{"line-width":10,"line-color":Od(["get","kind"],{before:"red",after:"blue"},"red")}}];let i={};for(let s=0;sIl(l,"lngLat",k));function N(F){t[9](F)}let B={draggable:!0,$$slots:{default:[yB]},$$scope:{ctx:t}};return t[2]!==void 0&&(B.lngLat=t[2]),S=new N2({props:B}),si.push(()=>Il(S,"lngLat",N)),{c(){e=ge("div"),M&&M.c(),n=We(),je(r.$$.fragment),i=We(),je(s.$$.fragment),c=We(),je(l.$$.fragment),v=We(),je(S.$$.fragment),Le(e,"slot","map")},m(F,G){be(F,e,G),M&&M.m(e,null),te(e,n),Be(r,e,null),te(e,i),Be(s,e,null),te(e,c),Be(l,e,null),te(e,v),Be(S,e,null),C=!0},p(F,G){F[0]=="neighbourhood"?M?(M.p(F,G),G&1&&se(M,1)):(M=lE(F),M.c(),se(M,1),M.m(e,n)):M&&(kn(),de(M,1,1,()=>{M=null}),Dn());const H={};G&32&&(H.data=F[5]),G&16384&&(H.$$scope={dirty:G,ctx:F}),s.$set(H);const K={};G&16384&&(K.$$scope={dirty:G,ctx:F}),!d&&G&8&&(d=!0,K.lngLat=F[3],El(()=>d=!1)),l.$set(K);const _e={};G&16384&&(_e.$$scope={dirty:G,ctx:F}),!E&&G&4&&(E=!0,_e.lngLat=F[2],El(()=>E=!1)),S.$set(_e)},i(F){C||(se(M),se(r.$$.fragment,F),se(s.$$.fragment,F),se(l.$$.fragment,F),se(S.$$.fragment,F),C=!0)},o(F){de(M),de(r.$$.fragment,F),de(s.$$.fragment,F),de(l.$$.fragment,F),de(S.$$.fragment,F),C=!1},d(F){F&&ye(e),M&&M.d(),Ve(r),Ve(s),Ve(l),Ve(S)}}}function bB(t){let e,n;return e=new bu({props:{$$slots:{map:[vB],sidebar:[mB],top:[dB]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&16511&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function xB(t,e,n){let r,i,s,c,l,d;vt(t,bn,B=>n(6,i=B)),vt(t,x2,B=>n(1,s=B)),vt(t,Uv,B=>n(2,c=B)),vt(t,Vv,B=>n(3,l=B)),vt(t,Gi,B=>n(4,d=B));let{prevMode:v}=e;function S(){Bt(bn,i={mode:v},i)}function E(B){l=B,Vv.set(l)}function C(B){c=B,Uv.set(c)}function M(){s=f1(this.value),x2.set(s)}const k=()=>Bt(bn,i={mode:"title"},i),R=()=>Bt(bn,i={mode:"network"},i),N=()=>Bt(bn,i={mode:"neighbourhood"},i);return t.$$set=B=>{"prevMode"in B&&n(0,v=B.prevMode)},t.$$.update=()=>{t.$$.dirty&30&&n(5,r=JSON.parse(d.compareRoute(l.lng,l.lat,c.lng,c.lat,s)))},[v,s,c,l,d,r,i,S,E,C,M,k,R,N]}class wB extends Zt{constructor(e){super(),Ht(this,e,xB,bB,Ut,{prevMode:0})}}const SB="/ltn/assets/settings-342fb430.svg";function uE(t){let e,n;return e=new K_({props:{$$slots:{default:[EB]},$$scope:{ctx:t}}}),e.$on("close",t[3]),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&17&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function EB(t){let e,n,r,i,s,c,l,d,v;return r=new kz({}),{c(){e=ge("h1"),e.textContent="Settings",n=We(),je(r.$$.fragment),i=We(),s=ge("center"),c=ge("button"),c.textContent="Confirm"},m(S,E){be(S,e,E),be(S,n,E),Be(r,S,E),be(S,i,E),be(S,s,E),te(s,c),l=!0,d||(v=Lt(c,"click",t[2]),d=!0)},p:Ct,i(S){l||(se(r.$$.fragment,S),l=!0)},o(S){de(r.$$.fragment,S),l=!1},d(S){S&&(ye(e),ye(n),ye(i),ye(s)),Ve(r,S),d=!1,v()}}}function IB(t){let e,n,r,i,s,c,l=t[0]&&uE(t);return{c(){e=ge("button"),e.innerHTML=`Settings`,n=We(),l&&l.c(),r=Pi(),Le(e,"class","outline")},m(d,v){be(d,e,v),be(d,n,v),l&&l.m(d,v),be(d,r,v),i=!0,s||(c=Lt(e,"click",t[1]),s=!0)},p(d,[v]){d[0]?l?(l.p(d,v),v&1&&se(l,1)):(l=uE(d),l.c(),se(l,1),l.m(r.parentNode,r)):l&&(kn(),de(l,1,1,()=>{l=null}),Dn())},i(d){i||(se(l),i=!0)},o(d){de(l),i=!1},d(d){d&&(ye(e),ye(n),ye(r)),l&&l.d(d),s=!1,c()}}}function CB(t,e,n){let r=!1;return[r,()=>n(0,r=!0),()=>n(0,r=!1),()=>n(0,r=!1)]}class TB extends Zt{constructor(e){super(),Ht(this,e,CB,IB,Ut,{})}}const OT=Fn({type:"FeatureCollection",features:[]}),LB=Fn(!0),zT=Fn(0),H_=Fn(!1),Z_=Fn({type:"FeatureCollection",features:[]});function PB(t){let e,n,r,i,s,c;const l=[gi("route-points"),{filter:yz},{paint:{"circle-color":Od(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Od(["get","type"],{node:Zg/2},Zg)}}];let d={};for(let M=0;Mn(0,r=c)),vt(t,Z_,c=>n(1,i=c)),vt(t,H_,c=>n(2,s=c)),[r,i,s]}class DB extends Zt{constructor(e){super(),Ht(this,e,kB,AB,Ut,{})}}function RB(t){let e,n,r;return{c(){e=nt("Undo ("),n=nt(t[2]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s&4&&Hn(n,i[2])},d(i){i&&(ye(e),ye(n),ye(r))}}}function NB(t){let e;return{c(){e=nt("Undo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function OB(t){let e,n,r,i,s,c,l,d,v,S;function E(k,R){return k[2]==0?NB:RB}let C=E(t),M=C(t);return{c(){e=ge("button"),M.c(),r=We(),i=ge("label"),s=ge("input"),c=nt(` - Show all snappable points`),l=We(),d=ge("ul"),d.innerHTML=`
  • Click + route after`,l=We(),d=_e("label"),v=nt("Slow-down factor for main roads: "),S=nt(t[1]),E=We(),C=_e("input"),M=We(),k=_e("i"),k.textContent=`Increase to see how drivers may detour in heavy traffic. 1 means + free-flow.`,Le(C,"type","range"),Le(C,"min","1.0"),Le(C,"max","5.0"),Le(C,"step","0.1"),Le(e,"slot","sidebar")},m(z,G){be(z,e,G),Be(n,e,null),te(e,r),te(e,i),te(e,s),te(e,c),te(e,l),te(e,d),te(d,v),te(d,S),te(d,E),te(d,C),vo(C,t[1]),te(e,M),te(e,k),R=!0,F||(U=[Lt(C,"change",t[10]),Lt(C,"input",t[10])],F=!0)},p(z,G){(!R||G&2)&&Hn(S,z[1]),G&2&&vo(C,z[1])},i(z){R||(se(n.$$.fragment,z),R=!0)},o(z){me(n.$$.fragment,z),R=!1},d(z){z&&ve(e),Ve(n),F=!1,Kr(U)}}}function lE(t){let e,n;return e=new Sy({props:{gjInput:JSON.parse(kr(t[4]).renderNeighbourhood()),interactive:!1}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&16&&(s.gjInput=JSON.parse(kr(r[4]).renderNeighbourhood())),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function gB(t){let e,n;const r=[ai("compare-route"),{paint:{"line-width":10,"line-color":Od(["get","kind"],{before:"red",after:"blue"},"red")}}];let i={};for(let s=0;sIl(l,"lngLat",k));function F(z){t[9](z)}let U={draggable:!0,$$slots:{default:[yB]},$$scope:{ctx:t}};return t[2]!==void 0&&(U.lngLat=t[2]),S=new N2({props:U}),si.push(()=>Il(S,"lngLat",F)),{c(){e=_e("div"),M&&M.c(),n=We(),Ue(r.$$.fragment),i=We(),Ue(s.$$.fragment),c=We(),Ue(l.$$.fragment),v=We(),Ue(S.$$.fragment),Le(e,"slot","map")},m(z,G){be(z,e,G),M&&M.m(e,null),te(e,n),Be(r,e,null),te(e,i),Be(s,e,null),te(e,c),Be(l,e,null),te(e,v),Be(S,e,null),C=!0},p(z,G){z[0]=="neighbourhood"?M?(M.p(z,G),G&1&&se(M,1)):(M=lE(z),M.c(),se(M,1),M.m(e,n)):M&&(kn(),me(M,1,1,()=>{M=null}),Dn());const q={};G&32&&(q.data=z[5]),G&16384&&(q.$$scope={dirty:G,ctx:z}),s.$set(q);const X={};G&16384&&(X.$$scope={dirty:G,ctx:z}),!d&&G&8&&(d=!0,X.lngLat=z[3],El(()=>d=!1)),l.$set(X);const de={};G&16384&&(de.$$scope={dirty:G,ctx:z}),!E&&G&4&&(E=!0,de.lngLat=z[2],El(()=>E=!1)),S.$set(de)},i(z){C||(se(M),se(r.$$.fragment,z),se(s.$$.fragment,z),se(l.$$.fragment,z),se(S.$$.fragment,z),C=!0)},o(z){me(M),me(r.$$.fragment,z),me(s.$$.fragment,z),me(l.$$.fragment,z),me(S.$$.fragment,z),C=!1},d(z){z&&ve(e),M&&M.d(),Ve(r),Ve(s),Ve(l),Ve(S)}}}function bB(t){let e,n;return e=new xu({props:{$$slots:{map:[vB],sidebar:[mB],top:[dB]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&16511&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function xB(t,e,n){let r,i,s,c,l,d;vt(t,bn,U=>n(6,i=U)),vt(t,x2,U=>n(1,s=U)),vt(t,Uv,U=>n(2,c=U)),vt(t,Vv,U=>n(3,l=U)),vt(t,Gi,U=>n(4,d=U));let{prevMode:v}=e;function S(){Bt(bn,i={mode:v},i)}function E(U){l=U,Vv.set(l)}function C(U){c=U,Uv.set(c)}function M(){s=f1(this.value),x2.set(s)}const k=()=>Bt(bn,i={mode:"title"},i),R=()=>Bt(bn,i={mode:"network"},i),F=()=>Bt(bn,i={mode:"neighbourhood"},i);return t.$$set=U=>{"prevMode"in U&&n(0,v=U.prevMode)},t.$$.update=()=>{t.$$.dirty&30&&n(5,r=JSON.parse(d.compareRoute(l.lng,l.lat,c.lng,c.lat,s)))},[v,s,c,l,d,r,i,S,E,C,M,k,R,F]}class wB extends Zt{constructor(e){super(),Ht(this,e,xB,bB,Ut,{prevMode:0})}}const SB="/ltn/assets/settings-342fb430.svg";function uE(t){let e,n;return e=new K_({props:{$$slots:{default:[EB]},$$scope:{ctx:t}}}),e.$on("close",t[3]),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&17&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function EB(t){let e,n,r,i,s,c,l,d,v;return r=new kz({}),{c(){e=_e("h1"),e.textContent="Settings",n=We(),Ue(r.$$.fragment),i=We(),s=_e("center"),c=_e("button"),c.textContent="Confirm"},m(S,E){be(S,e,E),be(S,n,E),Be(r,S,E),be(S,i,E),be(S,s,E),te(s,c),l=!0,d||(v=Lt(c,"click",t[2]),d=!0)},p:Ct,i(S){l||(se(r.$$.fragment,S),l=!0)},o(S){me(r.$$.fragment,S),l=!1},d(S){S&&(ve(e),ve(n),ve(i),ve(s)),Ve(r,S),d=!1,v()}}}function IB(t){let e,n,r,i,s,c,l=t[0]&&uE(t);return{c(){e=_e("button"),e.innerHTML=`Settings`,n=We(),l&&l.c(),r=Pi(),Le(e,"class","outline")},m(d,v){be(d,e,v),be(d,n,v),l&&l.m(d,v),be(d,r,v),i=!0,s||(c=Lt(e,"click",t[1]),s=!0)},p(d,[v]){d[0]?l?(l.p(d,v),v&1&&se(l,1)):(l=uE(d),l.c(),se(l,1),l.m(r.parentNode,r)):l&&(kn(),me(l,1,1,()=>{l=null}),Dn())},i(d){i||(se(l),i=!0)},o(d){me(l),i=!1},d(d){d&&(ve(e),ve(n),ve(r)),l&&l.d(d),s=!1,c()}}}function CB(t,e,n){let r=!1;return[r,()=>n(0,r=!0),()=>n(0,r=!1),()=>n(0,r=!1)]}class TB extends Zt{constructor(e){super(),Ht(this,e,CB,IB,Ut,{})}}const OT=Fn({type:"FeatureCollection",features:[]}),LB=Fn(!0),zT=Fn(0),H_=Fn(!1),Z_=Fn({type:"FeatureCollection",features:[]});function PB(t){let e,n,r,i,s,c;const l=[ai("route-points"),{filter:yz},{paint:{"circle-color":Od(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Od(["get","type"],{node:Zg/2},Zg)}}];let d={};for(let M=0;Mn(0,r=c)),vt(t,Z_,c=>n(1,i=c)),vt(t,H_,c=>n(2,s=c)),[r,i,s]}class DB extends Zt{constructor(e){super(),Ht(this,e,kB,AB,Ut,{})}}function RB(t){let e,n,r;return{c(){e=nt("Undo ("),n=nt(t[2]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s&4&&Hn(n,i[2])},d(i){i&&(ve(e),ve(n),ve(r))}}}function NB(t){let e;return{c(){e=nt("Undo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function OB(t){let e,n,r,i,s,c,l,d,v,S;function E(k,R){return k[2]==0?NB:RB}let C=E(t),M=C(t);return{c(){e=_e("button"),M.c(),r=We(),i=_e("label"),s=_e("input"),c=nt(` + Show all snappable points`),l=We(),d=_e("ul"),d.innerHTML=`
  • Click the map to add points
  • Click and drag any point to move it
  • Click a waypoint to delete it
  • Press Control+Z @@ -649,12 +649,12 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,e.disabled=n=t[2]==0,Le(e,"data-tooltip","Ctrl+Z"),Le(s,"type","checkbox")},m(k,R){be(k,e,R),M.m(e,null),be(k,r,R),be(k,i,R),te(i,s),s.checked=t[1],te(i,c),be(k,l,R),be(k,d,R),v||(S=[Lt(e,"click",t[3]),Lt(s,"change",t[4])],v=!0)},p(k,[R]){C===(C=E(k))&&M?M.p(k,R):(M.d(1),M=C(k),M&&(M.c(),M.m(e,null))),R&4&&n!==(n=k[2]==0)&&(e.disabled=n),R&2&&(s.checked=k[1])},i:Ct,o:Ct,d(k){k&&(ye(e),ye(r),ye(i),ye(l),ye(d)),M.d(),v=!1,Yr(S)}}}function zB(t,e,n){let r,i,s;vt(t,H_,S=>n(1,r=S)),vt(t,Z_,S=>n(5,i=S)),vt(t,zT,S=>n(2,s=S));let{route_tool:c}=e;function l(S){S&&i.features.length==0&&Bt(Z_,i=JSON.parse(c.inner.debugSnappableNodes()),i)}const d=()=>c.undo();function v(){r=this.checked,H_.set(r)}return t.$$set=S=>{"route_tool"in S&&n(0,c=S.route_tool)},t.$$.update=()=>{t.$$.dirty&2&&l(r)},[c,r,s,d,v]}class FB extends Zt{constructor(e){super(),Ht(this,e,zB,OB,Ut,{route_tool:0})}}function BB(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function VB(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function UB(t){let e;return{c(){e=ge("li"),e.textContent="Creating new neighbourhood boundary"},m(n,r){be(n,e,r)},p:Ct,i:Ct,o:Ct,d(n){n&&ye(e)}}}function jB(t){let e,n,r,i,s;return n=new or({props:{$$slots:{default:[GB]},$$scope:{ctx:t}}}),n.$on("click",t[8]),{c(){e=ge("li"),je(n.$$.fragment),r=We(),i=ge("li"),i.textContent="Changing neighbourhood boundary"},m(c,l){be(c,e,l),Be(n,e,null),be(c,r,l),be(c,i,l),s=!0},p(c,l){const d={};l&1024&&(d.$$scope={dirty:l,ctx:c}),n.$set(d)},i(c){s||(se(n.$$.fragment,c),s=!0)},o(c){de(n.$$.fragment,c),s=!1},d(c){c&&(ye(e),ye(r),ye(i)),Ve(n)}}}function GB(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function qB(t){let e,n,r,i,s,c,l,d,v,S,E,C;s=new or({props:{$$slots:{default:[BB]},$$scope:{ctx:t}}}),s.$on("click",t[6]),d=new or({props:{$$slots:{default:[VB]},$$scope:{ctx:t}}}),d.$on("click",t[7]);const M=[jB,UB],k=[];function R(N,B){return N[1]?0:1}return S=R(t),E=k[S]=M[S](t),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),je(d.$$.fragment),v=We(),E.c(),Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(N,B){be(N,e,B),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),k[S].m(r,null),C=!0},p(N,B){const F={};B&1024&&(F.$$scope={dirty:B,ctx:N}),s.$set(F);const G={};B&1024&&(G.$$scope={dirty:B,ctx:N}),d.$set(G);let H=S;S=R(N),S===H?k[S].p(N,B):(kn(),de(k[H],1,1,()=>{k[H]=null}),Dn(),E=k[S],E?E.p(N,B):(E=k[S]=M[S](N),E.c()),se(E,1),E.m(r,null))},i(N){C||(se(s.$$.fragment,N),se(d.$$.fragment,N),se(E),C=!0)},o(N){de(s.$$.fragment,N),de(d.$$.fragment,N),de(E),C=!1},d(N){N&&ye(e),Ve(s),Ve(d),k[S].d()}}}function WB(t){let e;return{c(){e=nt("Finish")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function HB(t){let e;return{c(){e=nt("Cancel")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function ZB(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;return l=new or({props:{$$slots:{default:[WB]},$$scope:{ctx:t}}}),l.$on("click",t[5]),v=new or({props:{$$slots:{default:[HB]},$$scope:{ctx:t}}}),v.$on("click",t[4]),M=new FB({props:{route_tool:kr(t[2])}}),{c(){e=ge("div"),n=ge("h1"),r=nt("Draw your neighbourhood boundary for "),i=nt(t[0]),s=We(),c=ge("div"),je(l.$$.fragment),d=We(),je(v.$$.fragment),S=We(),E=ge("p"),E.textContent="TODO: maybe move the instructions from the previous screen to here...",C=We(),je(M.$$.fragment),lr(c,"display","flex"),lr(c,"justify-content","space-between"),Le(e,"slot","sidebar")},m(R,N){be(R,e,N),te(e,n),te(n,r),te(n,i),te(e,s),te(e,c),Be(l,c,null),te(c,d),Be(v,c,null),te(e,S),te(e,E),te(e,C),Be(M,e,null),k=!0},p(R,N){(!k||N&1)&&Hn(i,R[0]);const B={};N&1024&&(B.$$scope={dirty:N,ctx:R}),l.$set(B);const F={};N&1024&&(F.$$scope={dirty:N,ctx:R}),v.$set(F);const G={};N&4&&(G.route_tool=kr(R[2])),M.$set(G)},i(R){k||(se(l.$$.fragment,R),se(v.$$.fragment,R),se(M.$$.fragment,R),k=!0)},o(R){de(l.$$.fragment,R),de(v.$$.fragment,R),de(M.$$.fragment,R),k=!1},d(R){R&&ye(e),Ve(l),Ve(v),Ve(M)}}}function XB(t){let e,n,r;return n=new DB({}),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","map")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p:Ct,i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function $B(t){let e,n;return e=new bu({props:{$$slots:{map:[XB],sidebar:[ZB],top:[qB]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&1039&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function YB(t,e,n){let r,i,s;vt(t,k_,M=>n(2,r=M)),vt(t,bn,M=>n(3,i=M)),vt(t,Gi,M=>n(9,s=M));let{name:c}=e,{existing:l}=e;l?r.editExistingArea(l):r.startArea(),ro(()=>{r==null||r.clearEventListeners(),r==null||r.stop()});function d(){l?Bt(bn,i={mode:"neighbourhood"},i):Bt(bn,i={mode:"network"},i)}r.addEventListenerSuccess(M=>{try{s.setNeighbourhoodBoundary(c,M),Nf(),s.setCurrentNeighbourhood(c),Bt(bn,i={mode:"neighbourhood"},i)}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),d()}}),r.addEventListenerFailure(d);const v=()=>kr(r).finish(),S=()=>Bt(bn,i={mode:"title"},i),E=()=>Bt(bn,i={mode:"network"},i),C=()=>Bt(bn,i={mode:"neighbourhood"},i);return t.$$set=M=>{"name"in M&&n(0,c=M.name),"existing"in M&&n(1,l=M.existing)},[c,l,r,i,d,v,S,E,C]}class KB extends Zt{constructor(e){super(),Ht(this,e,YB,$B,Ut,{name:0,existing:1})}}function JB(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function QB(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function e8(t){let e,n,r,i,s,c,l,d,v,S,E;return s=new or({props:{$$slots:{default:[JB]},$$scope:{ctx:t}}}),s.$on("click",t[10]),d=new or({props:{$$slots:{default:[QB]},$$scope:{ctx:t}}}),d.$on("click",t[11]),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),je(d.$$.fragment),v=We(),S=ge("li"),S.textContent="Use an auto-generated boundary",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(C,M){be(C,e,M),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),E=!0},p(C,M){const k={};M&16384&&(k.$$scope={dirty:M,ctx:C}),s.$set(k);const R={};M&16384&&(R.$$scope={dirty:M,ctx:C}),d.$set(R)},i(C){E||(se(s.$$.fragment,C),se(d.$$.fragment,C),E=!0)},o(C){de(s.$$.fragment,C),de(d.$$.fragment,C),E=!1},d(C){C&&ye(e),Ve(s),Ve(d)}}}function t8(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,N,B;return n=new wy({}),n.$on("click",t[7]),{c(){e=ge("div"),je(n.$$.fragment),r=We(),i=ge("p"),i.textContent=`Click an area to use it as a neighbourhood. These are generated by finding + to cancel`,e.disabled=n=t[2]==0,Le(e,"data-tooltip","Ctrl+Z"),Le(s,"type","checkbox")},m(k,R){be(k,e,R),M.m(e,null),be(k,r,R),be(k,i,R),te(i,s),s.checked=t[1],te(i,c),be(k,l,R),be(k,d,R),v||(S=[Lt(e,"click",t[3]),Lt(s,"change",t[4])],v=!0)},p(k,[R]){C===(C=E(k))&&M?M.p(k,R):(M.d(1),M=C(k),M&&(M.c(),M.m(e,null))),R&4&&n!==(n=k[2]==0)&&(e.disabled=n),R&2&&(s.checked=k[1])},i:Ct,o:Ct,d(k){k&&(ve(e),ve(r),ve(i),ve(l),ve(d)),M.d(),v=!1,Kr(S)}}}function zB(t,e,n){let r,i,s;vt(t,H_,S=>n(1,r=S)),vt(t,Z_,S=>n(5,i=S)),vt(t,zT,S=>n(2,s=S));let{route_tool:c}=e;function l(S){S&&i.features.length==0&&Bt(Z_,i=JSON.parse(c.inner.debugSnappableNodes()),i)}const d=()=>c.undo();function v(){r=this.checked,H_.set(r)}return t.$$set=S=>{"route_tool"in S&&n(0,c=S.route_tool)},t.$$.update=()=>{t.$$.dirty&2&&l(r)},[c,r,s,d,v]}class FB extends Zt{constructor(e){super(),Ht(this,e,zB,OB,Ut,{route_tool:0})}}function BB(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function VB(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function UB(t){let e;return{c(){e=_e("li"),e.textContent="Creating new neighbourhood boundary"},m(n,r){be(n,e,r)},p:Ct,i:Ct,o:Ct,d(n){n&&ve(e)}}}function jB(t){let e,n,r,i,s;return n=new or({props:{$$slots:{default:[GB]},$$scope:{ctx:t}}}),n.$on("click",t[8]),{c(){e=_e("li"),Ue(n.$$.fragment),r=We(),i=_e("li"),i.textContent="Changing neighbourhood boundary"},m(c,l){be(c,e,l),Be(n,e,null),be(c,r,l),be(c,i,l),s=!0},p(c,l){const d={};l&1024&&(d.$$scope={dirty:l,ctx:c}),n.$set(d)},i(c){s||(se(n.$$.fragment,c),s=!0)},o(c){me(n.$$.fragment,c),s=!1},d(c){c&&(ve(e),ve(r),ve(i)),Ve(n)}}}function GB(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function qB(t){let e,n,r,i,s,c,l,d,v,S,E,C;s=new or({props:{$$slots:{default:[BB]},$$scope:{ctx:t}}}),s.$on("click",t[6]),d=new or({props:{$$slots:{default:[VB]},$$scope:{ctx:t}}}),d.$on("click",t[7]);const M=[jB,UB],k=[];function R(F,U){return F[1]?0:1}return S=R(t),E=k[S]=M[S](t),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),Ue(d.$$.fragment),v=We(),E.c(),Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(F,U){be(F,e,U),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),k[S].m(r,null),C=!0},p(F,U){const z={};U&1024&&(z.$$scope={dirty:U,ctx:F}),s.$set(z);const G={};U&1024&&(G.$$scope={dirty:U,ctx:F}),d.$set(G);let q=S;S=R(F),S===q?k[S].p(F,U):(kn(),me(k[q],1,1,()=>{k[q]=null}),Dn(),E=k[S],E?E.p(F,U):(E=k[S]=M[S](F),E.c()),se(E,1),E.m(r,null))},i(F){C||(se(s.$$.fragment,F),se(d.$$.fragment,F),se(E),C=!0)},o(F){me(s.$$.fragment,F),me(d.$$.fragment,F),me(E),C=!1},d(F){F&&ve(e),Ve(s),Ve(d),k[S].d()}}}function WB(t){let e;return{c(){e=nt("Finish")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function HB(t){let e;return{c(){e=nt("Cancel")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function ZB(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;return l=new or({props:{$$slots:{default:[WB]},$$scope:{ctx:t}}}),l.$on("click",t[5]),v=new or({props:{$$slots:{default:[HB]},$$scope:{ctx:t}}}),v.$on("click",t[4]),M=new FB({props:{route_tool:kr(t[2])}}),{c(){e=_e("div"),n=_e("h1"),r=nt("Draw your neighbourhood boundary for "),i=nt(t[0]),s=We(),c=_e("div"),Ue(l.$$.fragment),d=We(),Ue(v.$$.fragment),S=We(),E=_e("p"),E.textContent="TODO: maybe move the instructions from the previous screen to here...",C=We(),Ue(M.$$.fragment),lr(c,"display","flex"),lr(c,"justify-content","space-between"),Le(e,"slot","sidebar")},m(R,F){be(R,e,F),te(e,n),te(n,r),te(n,i),te(e,s),te(e,c),Be(l,c,null),te(c,d),Be(v,c,null),te(e,S),te(e,E),te(e,C),Be(M,e,null),k=!0},p(R,F){(!k||F&1)&&Hn(i,R[0]);const U={};F&1024&&(U.$$scope={dirty:F,ctx:R}),l.$set(U);const z={};F&1024&&(z.$$scope={dirty:F,ctx:R}),v.$set(z);const G={};F&4&&(G.route_tool=kr(R[2])),M.$set(G)},i(R){k||(se(l.$$.fragment,R),se(v.$$.fragment,R),se(M.$$.fragment,R),k=!0)},o(R){me(l.$$.fragment,R),me(v.$$.fragment,R),me(M.$$.fragment,R),k=!1},d(R){R&&ve(e),Ve(l),Ve(v),Ve(M)}}}function XB(t){let e,n,r;return n=new DB({}),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","map")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p:Ct,i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function $B(t){let e,n;return e=new xu({props:{$$slots:{map:[XB],sidebar:[ZB],top:[qB]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&1039&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function YB(t,e,n){let r,i,s;vt(t,k_,M=>n(2,r=M)),vt(t,bn,M=>n(3,i=M)),vt(t,Gi,M=>n(9,s=M));let{name:c}=e,{existing:l}=e;l?r.editExistingArea(l):r.startArea(),ro(()=>{r==null||r.clearEventListeners(),r==null||r.stop()});function d(){l?Bt(bn,i={mode:"neighbourhood"},i):Bt(bn,i={mode:"network"},i)}r.addEventListenerSuccess(M=>{try{s.setNeighbourhoodBoundary(c,M),Nf(),s.setCurrentNeighbourhood(c),Bt(bn,i={mode:"neighbourhood"},i)}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),d()}}),r.addEventListenerFailure(d);const v=()=>kr(r).finish(),S=()=>Bt(bn,i={mode:"title"},i),E=()=>Bt(bn,i={mode:"network"},i),C=()=>Bt(bn,i={mode:"neighbourhood"},i);return t.$$set=M=>{"name"in M&&n(0,c=M.name),"existing"in M&&n(1,l=M.existing)},[c,l,r,i,d,v,S,E,C]}class KB extends Zt{constructor(e){super(),Ht(this,e,YB,$B,Ut,{name:0,existing:1})}}function JB(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function QB(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function e8(t){let e,n,r,i,s,c,l,d,v,S,E;return s=new or({props:{$$slots:{default:[JB]},$$scope:{ctx:t}}}),s.$on("click",t[10]),d=new or({props:{$$slots:{default:[QB]},$$scope:{ctx:t}}}),d.$on("click",t[11]),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),Ue(d.$$.fragment),v=We(),S=_e("li"),S.textContent="Use an auto-generated boundary",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(C,M){be(C,e,M),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),E=!0},p(C,M){const k={};M&16384&&(k.$$scope={dirty:M,ctx:C}),s.$set(k);const R={};M&16384&&(R.$$scope={dirty:M,ctx:C}),d.$set(R)},i(C){E||(se(s.$$.fragment,C),se(d.$$.fragment,C),E=!0)},o(C){me(s.$$.fragment,C),me(d.$$.fragment,C),E=!1},d(C){C&&ve(e),Ve(s),Ve(d)}}}function t8(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k,R,F,U;return n=new wy({}),n.$on("click",t[7]),{c(){e=_e("div"),Ue(n.$$.fragment),r=We(),i=_e("p"),i.textContent=`Click an area to use it as a neighbourhood. These are generated by finding roads, railways, and water that form severances. There are many bugs; this - is experimental. The colors are arbitrary, just to distinguish better.`,s=We(),c=ge("button"),c.textContent="Export to GeoJSON",l=We(),d=ge("label"),v=nt(`Minimum area (km²) - `),S=ge("input"),E=We(),C=ge("label"),M=ge("input"),k=nt(` - Remove areas not touching a big road`),Le(c,"class","secondary"),Le(S,"type","number"),Le(S,"min","0"),Le(S,"max","1"),Le(S,"step","0.01"),Le(M,"type","checkbox"),Le(e,"slot","sidebar")},m(F,G){be(F,e,G),Be(n,e,null),te(e,r),te(e,i),te(e,s),te(e,c),te(e,l),te(e,d),te(d,v),te(d,S),vo(S,t[0]),te(e,E),te(e,C),te(C,M),M.checked=t[1],te(C,k),R=!0,N||(B=[Lt(c,"click",t[5]),Lt(S,"input",t[8]),Lt(M,"change",t[9])],N=!0)},p(F,G){G&1&&f1(S.value)!==F[0]&&vo(S,F[0]),G&2&&(M.checked=F[1])},i(F){R||(se(n.$$.fragment,F),R=!0)},o(F){de(n.$$.fragment,F),R=!1},d(F){F&&ye(e),Ve(n),N=!1,Yr(B)}}}function n8(t){let e,n,r=t[13].area_km2.toFixed(1)+"",i,s,c,l,d,v=t[13].touches_big_road+"",S,E,C=t[13].touches_railway+"",M,k,R=t[13].touches_waterway+"",N;return{c(){e=ge("p"),n=nt("Area: "),i=nt(r),s=nt(" km²"),c=We(),l=ge("p"),d=nt("Borders roads = "),S=nt(v),E=nt(", railway = "),M=nt(C),k=nt(`, - water = `),N=nt(R)},m(B,F){be(B,e,F),te(e,n),te(e,i),te(e,s),be(B,c,F),be(B,l,F),te(l,d),te(l,S),te(l,E),te(l,M),te(l,k),te(l,N)},p(B,F){F&8192&&r!==(r=B[13].area_km2.toFixed(1)+"")&&Hn(i,r),F&8192&&v!==(v=B[13].touches_big_road+"")&&Hn(S,v),F&8192&&C!==(C=B[13].touches_railway+"")&&Hn(M,C),F&8192&&R!==(R=B[13].touches_waterway+"")&&Hn(N,R)},d(B){B&&(ye(e),ye(c),ye(l))}}}function r8(t){let e,n;return e=new xu({props:{openOn:"hover",$$slots:{default:[n8,({props:r})=>({13:r}),({props:r})=>r?8192:0]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&24576&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function i8(t){let e,n,r,i;const s=[gi("auto-boundaries-areas"),{filter:t[6](t[0],t[1])},{manageHoverState:!0},{paint:{"fill-color":["match",["%",["id"],5],0,"blue",1,"yellow",2,"green",3,"purple",4,"orange","black"],"fill-opacity":Of(.3,.7)}},{hoverCursor:"pointer"}];let c={$$slots:{default:[r8]},$$scope:{ctx:t}};for(let v=0;vn(2,r=N)),vt(t,Gi,N=>n(12,i=N));let s=JSON.parse(i.renderAutoBoundaries()),c=0,l=!0;function d(N){let B=window.prompt("What do you want to name the neighbourhood?");if(B)try{let F={type:"Feature",properties:{},geometry:s.features[N.detail.features[0].id].geometry};i.setNeighbourhoodBoundary(B,F),Nf(),i.setCurrentNeighbourhood(B),Bt(bn,r={mode:"neighbourhood"},r)}catch(F){console.log(F),window.alert("Known georust bug hit, sorry. You may need to just refresh the page now.")}}function v(){f_("auto_boundaries.geojson",JSON.stringify(s,null," "))}function S(N,B){let F=["all",bT,[">=",["get","area_km2"],N]];return B&&F.push(["get","touches_big_road"]),F}const E=()=>Bt(bn,r={mode:"network"},r);function C(){c=f1(this.value),n(0,c)}function M(){l=this.checked,n(1,l)}return[c,l,r,s,d,v,S,E,C,M,()=>Bt(bn,r={mode:"title"},r),()=>Bt(bn,r={mode:"network"},r)]}class l8 extends Zt{constructor(e){super(),Ht(this,e,a8,s8,Ut,{})}}const u8=["==",["geometry-type"],"Polygon"],c8=["==",["geometry-type"],"LineString"],h8=["==",["geometry-type"],"Point"];function FT(){return{type:"FeatureCollection",features:[]}}function cv(t){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:BT(t)}}}function BT(t){return[Math.round(t[0]*1e7)/1e7,Math.round(t[1]*1e7)/1e7]}const VT=Fn(FT()),UT=Fn(0),f8=100;class p8{constructor(e){Ai(this,"map");Ai(this,"active");Ai(this,"eventListenersSuccess");Ai(this,"eventListenersUpdated");Ai(this,"eventListenersFailure");Ai(this,"points");Ai(this,"cursor");Ai(this,"hover");Ai(this,"dragFrom");Ai(this,"previousStates");Ai(this,"onMouseMove",e=>{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,r=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});Ai(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(cE(this.points).forEach((r,i)=>{n.push([i+1,vR(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}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(e))});Ai(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=cv(e.lngLat.toArray()),this.onClick(e),this.finish())});Ai(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Ai(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Ai(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});Ai(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,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 e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.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 e=FT();this.points.forEach((i,s)=>{let c=cv(i);c.properties.hover=this.hover==s,c.properties.idx=s,e.features.push(c)}),e.features=e.features.concat(cE(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),VT.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,UT.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.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=cv(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(BT),n=[JSON.parse(JSON.stringify(e))];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>f8&&this.previousStates.shift()}}function cE(t){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[t[t.length-1],t[0]]},properties:{}}),e}function d8(t){let e,n,r;return{c(){e=nt("Undo ("),n=nt(t[1]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s&2&&Hn(n,i[1])},d(i){i&&(ye(e),ye(n),ye(r))}}}function m8(t){let e;return{c(){e=nt("Undo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function g8(t){let e,n,r,i,s,c,l,d,v,S,E;function C(R,N){return R[1]==0?m8:d8}let M=C(t),k=M(t);return{c(){e=ge("div"),n=ge("button"),n.textContent="Finish",r=We(),i=ge("button"),i.textContent="Cancel",s=We(),c=ge("button"),k.c(),d=We(),v=ge("ul"),v.innerHTML=`
  • Click + is experimental. The colors are arbitrary, just to distinguish better.`,s=We(),c=_e("button"),c.textContent="Export to GeoJSON",l=We(),d=_e("label"),v=nt(`Minimum area (km²) + `),S=_e("input"),E=We(),C=_e("label"),M=_e("input"),k=nt(` + Remove areas not touching a big road`),Le(c,"class","secondary"),Le(S,"type","number"),Le(S,"min","0"),Le(S,"max","1"),Le(S,"step","0.01"),Le(M,"type","checkbox"),Le(e,"slot","sidebar")},m(z,G){be(z,e,G),Be(n,e,null),te(e,r),te(e,i),te(e,s),te(e,c),te(e,l),te(e,d),te(d,v),te(d,S),vo(S,t[0]),te(e,E),te(e,C),te(C,M),M.checked=t[1],te(C,k),R=!0,F||(U=[Lt(c,"click",t[5]),Lt(S,"input",t[8]),Lt(M,"change",t[9])],F=!0)},p(z,G){G&1&&f1(S.value)!==z[0]&&vo(S,z[0]),G&2&&(M.checked=z[1])},i(z){R||(se(n.$$.fragment,z),R=!0)},o(z){me(n.$$.fragment,z),R=!1},d(z){z&&ve(e),Ve(n),F=!1,Kr(U)}}}function n8(t){let e,n,r=t[13].area_km2.toFixed(1)+"",i,s,c,l,d,v=t[13].touches_big_road+"",S,E,C=t[13].touches_railway+"",M,k,R=t[13].touches_waterway+"",F;return{c(){e=_e("p"),n=nt("Area: "),i=nt(r),s=nt(" km²"),c=We(),l=_e("p"),d=nt("Borders roads = "),S=nt(v),E=nt(", railway = "),M=nt(C),k=nt(`, + water = `),F=nt(R)},m(U,z){be(U,e,z),te(e,n),te(e,i),te(e,s),be(U,c,z),be(U,l,z),te(l,d),te(l,S),te(l,E),te(l,M),te(l,k),te(l,F)},p(U,z){z&8192&&r!==(r=U[13].area_km2.toFixed(1)+"")&&Hn(i,r),z&8192&&v!==(v=U[13].touches_big_road+"")&&Hn(S,v),z&8192&&C!==(C=U[13].touches_railway+"")&&Hn(M,C),z&8192&&R!==(R=U[13].touches_waterway+"")&&Hn(F,R)},d(U){U&&(ve(e),ve(c),ve(l))}}}function r8(t){let e,n;return e=new wu({props:{openOn:"hover",$$slots:{default:[n8,({props:r})=>({13:r}),({props:r})=>r?8192:0]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&24576&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function i8(t){let e,n,r,i;const s=[ai("auto-boundaries-areas"),{filter:t[6](t[0],t[1])},{manageHoverState:!0},{paint:{"fill-color":["match",["%",["id"],5],0,"blue",1,"yellow",2,"green",3,"purple",4,"orange","black"],"fill-opacity":Of(.3,.7)}},{hoverCursor:"pointer"}];let c={$$slots:{default:[r8]},$$scope:{ctx:t}};for(let v=0;vn(2,r=F)),vt(t,Gi,F=>n(12,i=F));let s=JSON.parse(i.renderAutoBoundaries()),c=0,l=!0;function d(F){let U=window.prompt("What do you want to name the neighbourhood?");if(U)try{let z={type:"Feature",properties:{},geometry:s.features[F.detail.features[0].id].geometry};i.setNeighbourhoodBoundary(U,z),Nf(),i.setCurrentNeighbourhood(U),Bt(bn,r={mode:"neighbourhood"},r)}catch(z){console.log(z),window.alert("Known georust bug hit, sorry. You may need to just refresh the page now.")}}function v(){f_("auto_boundaries.geojson",JSON.stringify(s,null," "))}function S(F,U){let z=["all",bT,[">=",["get","area_km2"],F]];return U&&z.push(["get","touches_big_road"]),z}const E=()=>Bt(bn,r={mode:"network"},r);function C(){c=f1(this.value),n(0,c)}function M(){l=this.checked,n(1,l)}return[c,l,r,s,d,v,S,E,C,M,()=>Bt(bn,r={mode:"title"},r),()=>Bt(bn,r={mode:"network"},r)]}class l8 extends Zt{constructor(e){super(),Ht(this,e,a8,s8,Ut,{})}}const u8=["==",["geometry-type"],"Polygon"],c8=["==",["geometry-type"],"LineString"],h8=["==",["geometry-type"],"Point"];function FT(){return{type:"FeatureCollection",features:[]}}function cv(t){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:BT(t)}}}function BT(t){return[Math.round(t[0]*1e7)/1e7,Math.round(t[1]*1e7)/1e7]}const VT=Fn(FT()),UT=Fn(0),f8=100;class p8{constructor(e){Ai(this,"map");Ai(this,"active");Ai(this,"eventListenersSuccess");Ai(this,"eventListenersUpdated");Ai(this,"eventListenersFailure");Ai(this,"points");Ai(this,"cursor");Ai(this,"hover");Ai(this,"dragFrom");Ai(this,"previousStates");Ai(this,"onMouseMove",e=>{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,r=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});Ai(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(cE(this.points).forEach((r,i)=>{n.push([i+1,vR(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}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(e))});Ai(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=cv(e.lngLat.toArray()),this.onClick(e),this.finish())});Ai(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Ai(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Ai(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});Ai(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,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 e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.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 e=FT();this.points.forEach((i,s)=>{let c=cv(i);c.properties.hover=this.hover==s,c.properties.idx=s,e.features.push(c)}),e.features=e.features.concat(cE(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),VT.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,UT.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.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=cv(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(BT),n=[JSON.parse(JSON.stringify(e))];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>f8&&this.previousStates.shift()}}function cE(t){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[t[t.length-1],t[0]]},properties:{}}),e}function d8(t){let e,n,r;return{c(){e=nt("Undo ("),n=nt(t[1]),r=nt(")")},m(i,s){be(i,e,s),be(i,n,s),be(i,r,s)},p(i,s){s&2&&Hn(n,i[1])},d(i){i&&(ve(e),ve(n),ve(r))}}}function m8(t){let e;return{c(){e=nt("Undo")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function g8(t){let e,n,r,i,s,c,l,d,v,S,E;function C(R,F){return R[1]==0?m8:d8}let M=C(t),k=M(t);return{c(){e=_e("div"),n=_e("button"),n.textContent="Finish",r=We(),i=_e("button"),i.textContent="Cancel",s=We(),c=_e("button"),k.c(),d=We(),v=_e("ul"),v.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 @@ -662,14 +662,14 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,c.disabled=l=t[1]==0,lr(e,"display","flex"),lr(e,"justify-content","space-between")},m(R,N){be(R,e,N),te(e,n),te(e,r),te(e,i),te(e,s),te(e,c),k.m(c,null),be(R,d,N),be(R,v,N),S||(E=[Lt(n,"click",t[2]),Lt(i,"click",t[3]),Lt(c,"click",t[4])],S=!0)},p(R,[N]){M===(M=C(R))&&k?k.p(R,N):(k.d(1),k=M(R),k&&(k.c(),k.m(c,null))),N&2&&l!==(l=R[1]==0)&&(c.disabled=l)},i:Ct,o:Ct,d(R){R&&(ye(e),ye(d),ye(v)),k.d(),S=!1,Yr(E)}}}function _8(t,e,n){let r;vt(t,UT,d=>n(1,r=d));let{polygonTool:i}=e;const s=()=>i.finish(),c=()=>i.cancel(),l=()=>i.undo();return t.$$set=d=>{"polygonTool"in d&&n(0,i=d.polygonTool)},[i,r,s,c,l]}class y8 extends Zt{constructor(e){super(),Ht(this,e,_8,g8,Ut,{polygonTool:0})}}let v8=Date.now();function Pm(t){return`${t}-${v8++}`}const jT=Symbol.for("svelte-maplibre");function b8(){return RE(jT)}function hE(t){return{subscribe:t.subscribe}}function GT({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=b8(),s=Fn(null),c=hE(s),l={...i,[t]:hE(s)};if(e&&(l.popupTarget=c),r){let d=Fn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Fn()),p1(jT,l),{...i,self:s}}function x8(){return GT({key:"source",setCluster:!0})}function w8(t=!0){return GT({key:"layer",setPopupTarget:t,setMouseEvent:t})}function fE(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],s=n[r];i!==s&&t(r,s,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function S8(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function E8(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function pE(t){let e=t[0],n,r,i=dE(t);return{c(){i.c(),n=Pi()},m(s,c){i.m(s,c),be(s,n,c),r=!0},p(s,c){c[0]&1&&Ut(e,e=s[0])?(kn(),de(i,1,1,Ct),Dn(),i=dE(s),i.c(),se(i,1),i.m(n.parentNode,n)):i.p(s,c)},i(s){r||(se(i),r=!0)},o(s){de(i),r=!1},d(s){s&&ye(n),i.d(s)}}}function dE(t){let e;const n=t[36].default,r=gr(n,t,t[35],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[1]&16)&&yr(r,n,i,i[35],e?_r(n,i[35],s,null):vr(i[35]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function I8(t){let e,n,r=t[0]&&pE(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,s){i[0]?r?(r.p(i,s),s[0]&1&&se(r,1)):(r=pE(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function C8(t,e,n){let r,i,s,c,l,d,v,S,E,C,M,k,{$$slots:R={},$$scope:N}=e,{id:B=Pm("layer")}=e,{source:F=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:H=void 0}=e,{beforeLayerType:K=void 0}=e,{type:_e}=e,{paint:ae=void 0}=e,{layout:le=void 0}=e,{filter:ve=void 0}=e,{applyToClusters:ke=void 0}=e,{minzoom:Q=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:qe=!1}=e,{hovered:Pe=null}=e,{interactive:it=!0}=e,{hoverCursor:ft=void 0}=e,{eventsIfTopMost:Xe=!1}=e;const Mt=vu(),{map:At,source:yt,self:zt,minzoom:Tt,maxzoom:tn,eventTopMost:Rn,layerInfo:Jt}=w8();vt(t,At,ne=>n(31,E=ne)),vt(t,yt,ne=>n(32,C=ne)),vt(t,zt,ne=>n(0,S=ne)),vt(t,Tt,ne=>n(34,k=ne)),vt(t,tn,ne=>n(33,M=ne)),ro(()=>{S&&E&&(Jt.delete(S),E==null||E.removeLayer(S))});let pn;function Nn(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt={event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce};Mt(ne.type,kt)}function En(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;ft&&(E.getCanvas().style.cursor=ft);let Ce=ne.features??[];n(6,Pe=Ce[0]??null);let ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id;Mt("mouseenter",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Nr(ne){var Re,on,qr;if(!it||!E)return;if(Xe&&Rn(ne)!==S){n(6,Pe=null),qe&&pn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:G,id:pn},{hover:!1}),pn=void 0);return}E.getCanvas().style.cursor=ft;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt=(qr=Ce[0])==null?void 0:qr.id;kt!==pn&&(qe&&(pn!==void 0&&(E==null||E.setFeatureState({source:l,id:pn,sourceLayer:G},{hover:!1})),E==null||E.setFeatureState({source:l,id:kt,sourceLayer:G},{hover:!0})),pn=kt,n(6,Pe=Ce[0]??null)),Mt("mousemove",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Jn(ne){if(!(!it||!S||!E)){if(ft&&(E.getCanvas().style.cursor=""),n(6,Pe=null),qe&&pn!==void 0){const Ce={source:l,id:pn,sourceLayer:G};E==null||E.setFeatureState(Ce,{hover:!1}),pn=void 0}Mt("mouseleave",{map:E,layer:S,source:l})}}let On=!0;function Qn(ne){E&&(E.off("click",ne,Nn),E.off("dblclick",ne,Nn),E.off("contextmenu",ne,Nn),E.off("mouseenter",ne,En),E.off("mousemove",ne,Nr),E.off("mouseleave",ne,Jn))}return ro(()=>{E&&S&&Qn(S)}),t.$$set=ne=>{"id"in ne&&n(7,B=ne.id),"source"in ne&&n(8,F=ne.source),"sourceLayer"in ne&&n(9,G=ne.sourceLayer),"beforeId"in ne&&n(10,H=ne.beforeId),"beforeLayerType"in ne&&n(11,K=ne.beforeLayerType),"type"in ne&&n(12,_e=ne.type),"paint"in ne&&n(13,ae=ne.paint),"layout"in ne&&n(14,le=ne.layout),"filter"in ne&&n(15,ve=ne.filter),"applyToClusters"in ne&&n(16,ke=ne.applyToClusters),"minzoom"in ne&&n(17,Q=ne.minzoom),"maxzoom"in ne&&n(18,oe=ne.maxzoom),"manageHoverState"in ne&&n(19,qe=ne.manageHoverState),"hovered"in ne&&n(6,Pe=ne.hovered),"interactive"in ne&&n(20,it=ne.interactive),"hoverCursor"in ne&&n(21,ft=ne.hoverCursor),"eventsIfTopMost"in ne&&n(22,Xe=ne.eventsIfTopMost),"$$scope"in ne&&n(35,N=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=E8(ke)),t.$$.dirty[0]&1073774592&&n(24,i=S8("all",r,ve)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,s=Q??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??M),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=F||C),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==B&&l){S&&(Qn(S),Jt.delete(S));let ne=H;if(!H&&K){let Ce=E.getStyle().layers,ot=typeof K=="function"?K:Re=>Re.type===K,kt=Ce==null?void 0:Ce.find(ot);kt&&(ne=kt.id)}Bt(zt,S=B,S),E.addLayer(Xc({id:S,type:_e,source:l,"source-layer":G,filter:i,paint:ae,layout:le,minzoom:s,maxzoom:c}),ne),n(23,On=!0),E.on("click",S,Nn),E.on("dblclick",S,Nn),E.on("contextmenu",S,Nn),E.on("mouseenter",S,En),E.on("mousemove",S,Nr),E.on("mouseleave",S,Jn)}t.$$.dirty[0]&1048577&&S&&Jt.set(S,{interactive:it}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?fE((ne,Ce)=>E==null?void 0:E.setPaintProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,v=S?fE((ne,Ce)=>E==null?void 0:E.setLayoutProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(ae)),t.$$.dirty[0]&134234112&&(v==null||v(le)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(E==null||E.setLayerZoomRange(S,s,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(On?n(23,On=!1):E==null||E.setFilter(S,i))},[S,At,yt,zt,Tt,tn,Pe,B,F,G,H,K,_e,ae,le,ve,ke,Q,oe,qe,it,ft,Xe,On,i,c,s,v,d,l,r,E,C,M,k,N,R]}class db extends Zt{constructor(e){super(),Ht(this,e,C8,I8,Ut,{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 T8(t){let e;const n=t[16].default,r=gr(n,t,t[24],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16777216)&&yr(r,n,i,i[24],e?_r(n,i[24],s,null):vr(i[24]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function L8(t){let e,n,r;function i(c){t[17](c)}let s={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[T8]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new db({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function P8(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=Pm("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{applyToClusters:M=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:B=!1}=e,{hovered:F=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:H=!0}=e;function K(oe){F=oe,n(0,F)}function _e(oe){gn.call(this,t,oe)}function ae(oe){gn.call(this,t,oe)}function le(oe){gn.call(this,t,oe)}function ve(oe){gn.call(this,t,oe)}function ke(oe){gn.call(this,t,oe)}function Q(oe){gn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,s=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,v=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,C=oe.filter),"applyToClusters"in oe&&n(9,M=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,R=oe.maxzoom),"hoverCursor"in oe&&n(12,N=oe.hoverCursor),"manageHoverState"in oe&&n(13,B=oe.manageHoverState),"hovered"in oe&&n(0,F=oe.hovered),"eventsIfTopMost"in oe&&n(14,G=oe.eventsIfTopMost),"interactive"in oe&&n(15,H=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[F,s,c,l,d,v,S,E,C,M,k,R,N,B,G,H,r,K,_e,ae,le,ve,ke,Q,i]}class M8 extends Zt{constructor(e){super(),Ht(this,e,P8,L8,Ut,{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 A8(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function k8(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[A8]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new db({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function D8(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=Pm("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:N=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:F=!1}=e,{interactive:G=!0}=e;function H(Q){B=Q,n(0,B)}function K(Q){gn.call(this,t,Q)}function _e(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ve(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,N=Q.manageHoverState),"hovered"in Q&&n(0,B=Q.hovered),"eventsIfTopMost"in Q&&n(13,F=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[B,s,c,l,d,v,S,E,C,M,k,R,N,F,G,r,H,K,_e,ae,le,ve,ke,i]}class R8 extends Zt{constructor(e){super(),Ht(this,e,D8,k8,Ut,{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 N8(t,e,n,r,i){let s=!1;t.getSource(e)&&(s=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(s){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function O8(t,e,n){zE().then(()=>{let r=Fs(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function mE(t){let e=t[0],n,r,i=gE(t);return{c(){i.c(),n=Pi()},m(s,c){i.m(s,c),be(s,n,c),r=!0},p(s,c){c&1&&Ut(e,e=s[0])?(kn(),de(i,1,1,Ct),Dn(),i=gE(s),i.c(),se(i,1),i.m(n.parentNode,n)):i.p(s,c)},i(s){r||(se(i),r=!0)},o(s){de(i),r=!1},d(s){s&&ye(n),i.d(s)}}}function gE(t){let e;const n=t[15].default,r=gr(n,t,t[14],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16384)&&yr(r,n,i,i[14],e?_r(n,i[14],s,null):vr(i[14]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function z8(t){let e,n,r=t[0]&&mE(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[0]?r?(r.p(i,s),s&1&&se(r,1)):(r=mE(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),de(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){de(r),n=!1},d(i){i&&ye(e),r&&r.d(i)}}}function F8(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{id:d=Pm("geojson")}=e,{data:v}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:C=void 0}=e,{lineMetrics:M=void 0}=e,{cluster:k=void 0}=e;const{map:R,cluster:N,self:B}=x8();vt(t,R,H=>n(13,i=H)),vt(t,N,H=>n(16,s=H)),vt(t,B,H=>n(0,r=H));let F,G=!0;return ro(()=>{r&&F&&i&&(O8(R,r,F),Bt(B,r=null,r),n(11,F=void 0))}),t.$$set=H=>{"id"in H&&n(4,d=H.id),"data"in H&&n(5,v=H.data),"generateId"in H&&n(6,S=H.generateId),"promoteId"in H&&n(7,E=H.promoteId),"filter"in H&&n(8,C=H.filter),"lineMetrics"in H&&n(9,M=H.lineMetrics),"cluster"in H&&n(10,k=H.cluster),"$$scope"in H&&n(14,l=H.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Bt(N,s=k,s),t.$$.dirty&12273&&i&&r!==d&&(Bt(B,r=d,r),N8(i,r,Xc({type:"geojson",data:v,filter:C,lineMetrics:M,generateId:S,promoteId:E,cluster:!!k,clusterMinPoints:k==null?void 0:k.minPoints,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius,clusterProperties:k==null?void 0:k.properties}),H=>i&&H===r,()=>{r&&(n(11,F=i==null?void 0:i.getSource(r)),n(12,G=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,F=i==null?void 0:i.getSource(d))})),t.$$.dirty&6176&&F&&(G?n(12,G=!1):F.setData(v)),t.$$.dirty&3072&&(F==null||F.setClusterOptions(Xc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,R,N,B,d,v,S,E,C,M,k,F,G,i,l,c]}class B8 extends Zt{constructor(e){super(),Ht(this,e,F8,z8,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function V8(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){de(r,i),e=!1},d(i){r&&r.d(i)}}}function U8(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[V8]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new db({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){je(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){de(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function j8(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=Pm("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:N=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:F=!1}=e,{interactive:G=!0}=e;function H(Q){B=Q,n(0,B)}function K(Q){gn.call(this,t,Q)}function _e(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ve(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,N=Q.manageHoverState),"hovered"in Q&&n(0,B=Q.hovered),"eventsIfTopMost"in Q&&n(13,F=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[B,s,c,l,d,v,S,E,C,M,k,R,N,F,G,r,H,K,_e,ae,le,ve,ke,i]}class G8 extends Zt{constructor(e){super(),Ht(this,e,j8,U8,Ut,{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 q8(t){let e,n,r,i,s,c;return e=new R8({props:{id:"edit-polygon-fill",filter:u8,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new G8({props:{id:"edit-polygon-lines",filter:c8,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),s=new M8({props:{id:"edit-polygon-vertices",filter:h8,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){je(e.$$.fragment),n=We(),je(r.$$.fragment),i=We(),je(s.$$.fragment)},m(l,d){Be(e,l,d),be(l,n,d),Be(r,l,d),be(l,i,d),Be(s,l,d),c=!0},p:Ct,i(l){c||(se(e.$$.fragment,l),se(r.$$.fragment,l),se(s.$$.fragment,l),c=!0)},o(l){de(e.$$.fragment,l),de(r.$$.fragment,l),de(s.$$.fragment,l),c=!1},d(l){l&&(ye(n),ye(i)),Ve(e,l),Ve(r,l),Ve(s,l)}}}function W8(t){let e,n;return e=new B8({props:{data:t[0],$$slots:{default:[q8]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&1&&(s.data=r[0]),i&2&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function H8(t,e,n){let r;return vt(t,VT,i=>n(0,r=i)),[r]}class Z8 extends Zt{constructor(e){super(),Ht(this,e,H8,W8,Ut,{})}}function X8(t){let e,n,r,i,s,c,l;return{c(){e=ge("button"),e.textContent="Import current view",n=We(),r=ge("i"),r.textContent="or...",i=We(),s=ge("button"),s.textContent="Draw an area to import on the map",Le(e,"type","button"),Le(s,"type","button")},m(d,v){be(d,e,v),be(d,n,v),be(d,r,v),be(d,i,v),be(d,s,v),c||(l=[Lt(e,"click",t[2]),Lt(s,"click",t[3])],c=!0)},p:Ct,i:Ct,o:Ct,d(d){d&&(ye(e),ye(n),ye(r),ye(i),ye(s)),c=!1,Yr(l)}}}function $8(t){let e,n;return e=new y8({props:{polygonTool:t[0]}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&1&&(s.polygonTool=r[0]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Y8(t){let e,n,r,i,s,c,l,d,v;const S=[$8,X8],E=[];function C(M,k){return M[0]?0:1}return e=C(t),n=E[e]=S[e](t),{c(){n.c(),r=We(),i=ge("label"),s=ge("input"),c=nt(`Save a copy of the osm.xml - after importing`),Le(s,"type","checkbox")},m(M,k){E[e].m(M,k),be(M,r,k),be(M,i,k),te(i,s),s.checked=t[1],te(i,c),l=!0,d||(v=Lt(s,"change",t[5]),d=!0)},p(M,[k]){let R=e;e=C(M),e===R?E[e].p(M,k):(kn(),de(E[R],1,1,()=>{E[R]=null}),Dn(),n=E[e],n?n.p(M,k):(n=E[e]=S[e](M),n.c()),se(n,1),n.m(r.parentNode,r)),k&2&&(s.checked=M[1])},i(M){l||(se(n),l=!0)},o(M){de(n),l=!1},d(M){M&&(ye(r),ye(i)),E[e].d(M),d=!1,v()}}}function Id(t){return[t.lng,t.lat]}function K8(t,e,n){let{map:r}=e;const i=vu();let s=null,c=!1;async function l(C){try{i("loading","Loading from Overpass");let k=await(await fetch(qT(C))).text();c&&f_("osm.xml",k),i("gotXml",{xml:k,boundary:C})}catch(M){i("error",M.toString())}}function d(){let C=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Id(C.getSouthWest()),Id(C.getNorthWest()),Id(C.getNorthEast()),Id(C.getSouthEast()),Id(C.getSouthWest())]],type:"Polygon"}}}async function v(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await l(d())}}function S(){r&&(n(0,s=new p8(r)),s.startNew(),s.addEventListenerSuccess(async C=>{n(0,s=null),await l(C)}),s.addEventListenerFailure(()=>{n(0,s=null)}))}function E(){c=this.checked,n(1,c)}return t.$$set=C=>{"map"in C&&n(4,r=C.map)},[s,c,v,S,r,E]}class J8 extends Zt{constructor(e){super(),Ht(this,e,K8,Y8,Ut,{map:4})}}function qT(t){let e='poly:"';for(let[r,i]of t.geometry.coordinates[0])e+=`${i} ${r} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}async function c1(t){Ju.set(t);try{let e=JSON.parse(window.localStorage.getItem(t));console.time("get OSM input");let[n,r]=await Q8(e);console.timeEnd("get OSM input"),console.time("load"),Gi.set(new jE(new Uint8Array(n),r,e.study_area_name||void 0)),Fs(Gi).loadSavefile(e),console.timeEnd("load"),WT()}catch(e){window.alert(`Couldn't open project: ${e}`),Ju.set("")}}async function Q8(t){if(t.study_area_name){let e=Fs(Jd)?`/osm/${t.study_area_name}.pbf`:`https://assets.od2net.org/severance_pbfs/${t.study_area_name}.pbf`;console.log(`Grabbing ${e}`);let r=await(await fetch(e)).arrayBuffer(),i=Fs(Jd)?`/boundaries/${t.study_area_name}.geojson`:`https://assets.od2net.org/boundaries/${t.study_area_name}.geojson`,c=await(await fetch(i)).json();return[r,c]}else{console.log("Grabbing from Overpass");let e=t.features.find(i=>i.properties.kind=="study_area_boundary");return[await(await fetch(qT(e))).arrayBuffer(),e]}}function WT(){bn.set({mode:"network"}),k_.set(new xR(Fs(uu),Fs(Gi).toRouteSnapper(),OT,LB,zT)),H_.set(!1),Z_.set({type:"FeatureCollection",features:[]}),Fs(uu).fitBounds(Array.from(Fs(Gi).getBounds()),{animate:!1}),Vv.set(_E()),Uv.set(_E())}function _E(){let t=Fs(Gi).getBounds(),e=t[0]+Math.random()*(t[2]-t[0]),n=t[1]+Math.random()*(t[3]-t[1]);return new ey.LngLat(e,n)}function yE(t,e,n){const r=t.slice();return r[18]=e[n][0],r[19]=e[n][1],r}function vE(t,e,n){const r=t.slice();return r[22]=e[n],r}function e7(t){let e;return{c(){e=ge("div"),e.innerHTML='',Le(e,"slot","top")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function t7(t){let e;return{c(){e=ge("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){be(n,e,r)},p:Ct,i:Ct,o:Ct,d(n){n&&ye(e)}}}function n7(t){let e,n,r,i,s,c,l,d,v,S,E,C,M;n=new or({props:{$$slots:{default:[r7]},$$scope:{ctx:t}}}),n.$on("click",t[10]);let k=zo(t[2].entries()),R=[];for(let B=0;Bde(R[B],1,1,()=>{R[B]=null});return{c(){e=ge("div"),je(n.$$.fragment),r=We(),i=ge("p"),i.textContent="Load a saved project:",s=We(),c=ge("ul");for(let B=0;B`,c=We(),l=ge("button"),l.innerHTML=`Delete project`,d=We(),Le(s,"class","secondary"),Le(l,"class","secondary"),lr(n,"display","flex"),lr(n,"justify-content","space-between")},m(R,N){be(R,e,N),te(e,n),Be(r,n,null),te(n,i),te(n,s),te(n,c),te(n,l),te(e,d),v=!0,S||(E=[Lt(s,"click",M),Lt(l,"click",k)],S=!0)},p(R,N){t=R;const B={};N&33554436&&(B.$$scope={dirty:N,ctx:t}),r.$set(B)},i(R){v||(se(r.$$.fragment,R),v=!0)},o(R){de(r.$$.fragment,R),v=!1},d(R){R&&ye(e),Ve(r),S=!1,Yr(E)}}}function xE(t){let e,n=(t[18]??"custom area")+"",r,i,s,c,l=zo(t[19]),d=[];for(let S=0;Sde(d[S],1,1,()=>{d[S]=null});return{c(){e=ge("u"),r=nt(n),i=We();for(let S=0;S{c[S]=null}),Dn(),r=c[n],r?r.p(d,v):(r=c[n]=s[n](d),r.c()),se(r,1),r.m(e,null))},i(d){i||(se(r),i=!0)},o(d){de(r),i=!1},d(d){d&&ye(e),c[n].d()}}}function s7(t){let e,n,r,i;return e=new BE({props:{loading:t[1]}}),r=new bu({props:{$$slots:{sidebar:[o7],top:[e7]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment),n=We(),je(r.$$.fragment)},m(s,c){Be(e,s,c),be(s,n,c),Be(r,s,c),i=!0},p(s,[c]){const l={};c&2&&(l.loading=s[1]),e.$set(l);const d={};c&33554493&&(d.$$scope={dirty:c,ctx:s}),r.$set(d)},i(s){i||(se(e.$$.fragment,s),se(r.$$.fragment,s),i=!0)},o(s){de(e.$$.fragment,s),de(r.$$.fragment,s),i=!1},d(s){s&&ye(n),Ve(e,s),Ve(r,s)}}}function Xg(){let t=new Map;for(let e=0;en(15,r=K)),vt(t,k_,K=>n(16,i=K)),vt(t,Gi,K=>n(17,s=K)),vt(t,uu,K=>n(4,c=K)),vt(t,bn,K=>n(5,l=K));let{wasmReady:d}=e,v="";Bt(Gi,s=null,s),Bt(k_,i=null,i),Bt(Ju,r="",r);let S=Xg(),E;async function C(K){let _e="ltn_"+E.files[0].name;n(1,v=`Loading from file ${_e}`),window.localStorage.setItem(_e,await E.files[0].text()),n(2,S=Xg()),await c1(_e),n(1,v="")}function M(K){window.confirm(`Really delete project ${K}? You can't undo this.`)&&(window.localStorage.removeItem(K),n(2,S=Xg()))}function k(K){let _e=window.prompt(`Rename project ${K} to what?`,K);if(_e){_e.startsWith("ltn_")||(_e=`ltn_${_e}`);let ae=window.localStorage.getItem(K);window.localStorage.setItem(_e,ae),window.localStorage.removeItem(K),n(2,S=Xg())}}async function R(K){n(1,v=`Loading project ${K}`),await c1(K),n(1,v="")}const N=()=>Bt(bn,l={mode:"new-project"},l),B=K=>R(K),F=K=>k(K),G=K=>M(K);function H(K){si[K?"unshift":"push"](()=>{E=K,n(3,E)})}return t.$$set=K=>{"wasmReady"in K&&n(0,d=K.wasmReady)},[d,v,S,E,c,l,C,M,k,R,N,B,F,G,H]}class l7 extends Zt{constructor(e){super(),Ht(this,e,a7,s7,Ut,{wasmReady:0})}}function wE(t,e,n){const r=t.slice();return r[17]=e[n][0],r[18]=e[n][1],r}function SE(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function u7(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function c7(t){let e,n,r,i,s,c,l,d;return s=new or({props:{$$slots:{default:[u7]},$$scope:{ctx:t}}}),s.$on("click",t[13]),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),l.textContent="New project",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(v,S){be(v,e,S),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),d=!0},p(v,S){const E={};S&33554432&&(E.$$scope={dirty:S,ctx:v}),s.$set(E)},i(v){d||(se(s.$$.fragment,v),d=!0)},o(v){de(s.$$.fragment,v),d=!1},d(v){v&&ye(e),Ve(s)}}}function EE(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;e=new BE({props:{loading:t[4]}});let R=zo(t[3]),N=[];for(let B=0;Bt[9].call(s))},m(B,F){Be(e,B,F),be(B,n,F),be(B,r,F),te(r,i),te(r,s),te(s,c);for(let G=0;G{S=null}),Dn())},i(E){l||(se(S),l=!0)},o(E){de(S),l=!1},d(E){E&&ye(e),S&&S.d(),d=!1,v()}}}function f7(t){let e,n,r;return n=new Z8({}),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","map")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p:Ct,i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function p7(t){let e,n;return e=new bu({props:{$$slots:{map:[f7],sidebar:[h7],top:[c7]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&33554558&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function d7(t,e,n){let r,i,s,c,l;vt(t,Ju,H=>n(14,r=H)),vt(t,Gi,H=>n(15,i=H)),vt(t,Jd,H=>n(16,s=H)),vt(t,uu,H=>n(5,c=H)),vt(t,bn,H=>n(6,l=H));let d="",v="",S=[],E="";$_(async()=>{let H=await fetch(s?"/osm/areas.json":"https://assets.od2net.org/severance_pbfs/areas.json");n(3,S=await H.json())});function C(H){n(4,E="Loading OSM");try{Bt(Gi,i=new jE(new TextEncoder().encode(H.detail.xml),H.detail.boundary,void 0),i),Bt(Ju,r=`ltn_${d}`,r),WT(),Nf()}catch(K){window.alert(`Couldn't import from Overpass: ${K}`)}n(4,E="")}async function M(){if(v=="")return;let H=`ltn_${d}`;window.localStorage.setItem(H,JSON.stringify({type:"FeatureCollection",features:[],study_area_name:v})),n(4,E=`Loading pre-clipped OSM area ${v}`),await c1(H),n(4,E="")}function k(){d=this.value,n(1,d)}function R(){v=DE(this),n(2,v),n(3,S)}return[M,d,v,S,E,c,l,C,k,R,()=>M(),H=>n(4,E=H.detail),H=>window.alert(H.detail),()=>Bt(bn,l={mode:"title"},l)]}class m7 extends Zt{constructor(e){super(),Ht(this,e,d7,p7,Ut,{loadExample:0})}get loadExample(){return this.$$.ctx[0]}}const{window:g7}=h1;function _7(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function y7(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function v7(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ye(e)}}}function b7(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;return s=new or({props:{$$slots:{default:[_7]},$$scope:{ctx:t}}}),s.$on("click",t[9]),d=new or({props:{$$slots:{default:[y7]},$$scope:{ctx:t}}}),d.$on("click",t[10]),E=new or({props:{$$slots:{default:[v7]},$$scope:{ctx:t}}}),E.$on("click",t[5]),{c(){e=ge("div"),n=ge("nav"),r=ge("ul"),i=ge("li"),je(s.$$.fragment),c=We(),l=ge("li"),je(d.$$.fragment),v=We(),S=ge("li"),je(E.$$.fragment),C=We(),M=ge("li"),M.textContent="Viewing shortcuts",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(R,N){be(R,e,N),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),Be(E,S,null),te(r,C),te(r,M),k=!0},p(R,N){const B={};N&8192&&(B.$$scope={dirty:N,ctx:R}),s.$set(B);const F={};N&8192&&(F.$$scope={dirty:N,ctx:R}),d.$set(F);const G={};N&8192&&(G.$$scope={dirty:N,ctx:R}),E.$set(G)},i(R){k||(se(s.$$.fragment,R),se(d.$$.fragment,R),se(E.$$.fragment,R),k=!0)},o(R){de(s.$$.fragment,R),de(d.$$.fragment,R),de(E.$$.fragment,R),k=!1},d(R){R&&ye(e),Ve(s),Ve(d),Ve(E)}}}function x7(t){let e,n,r,i,s,c,l,d,v,S=t[0].shortcutIndex+1+"",E,C,M=t[0].gj.features.length+"",k,R,N,B,F,G,H,K,_e,ae=kr(t[0].gj.features[t[0].shortcutIndex].properties).directness.toFixed(1)+"",le,ve,ke,Q,oe;return{c(){e=ge("p"),e.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. + to cancel`,c.disabled=l=t[1]==0,lr(e,"display","flex"),lr(e,"justify-content","space-between")},m(R,F){be(R,e,F),te(e,n),te(e,r),te(e,i),te(e,s),te(e,c),k.m(c,null),be(R,d,F),be(R,v,F),S||(E=[Lt(n,"click",t[2]),Lt(i,"click",t[3]),Lt(c,"click",t[4])],S=!0)},p(R,[F]){M===(M=C(R))&&k?k.p(R,F):(k.d(1),k=M(R),k&&(k.c(),k.m(c,null))),F&2&&l!==(l=R[1]==0)&&(c.disabled=l)},i:Ct,o:Ct,d(R){R&&(ve(e),ve(d),ve(v)),k.d(),S=!1,Kr(E)}}}function _8(t,e,n){let r;vt(t,UT,d=>n(1,r=d));let{polygonTool:i}=e;const s=()=>i.finish(),c=()=>i.cancel(),l=()=>i.undo();return t.$$set=d=>{"polygonTool"in d&&n(0,i=d.polygonTool)},[i,r,s,c,l]}class y8 extends Zt{constructor(e){super(),Ht(this,e,_8,g8,Ut,{polygonTool:0})}}let v8=Date.now();function Pm(t){return`${t}-${v8++}`}const jT=Symbol.for("svelte-maplibre");function b8(){return RE(jT)}function hE(t){return{subscribe:t.subscribe}}function GT({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=b8(),s=Fn(null),c=hE(s),l={...i,[t]:hE(s)};if(e&&(l.popupTarget=c),r){let d=Fn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Fn()),p1(jT,l),{...i,self:s}}function x8(){return GT({key:"source",setCluster:!0})}function w8(t=!0){return GT({key:"layer",setPopupTarget:t,setMouseEvent:t})}function fE(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],s=n[r];i!==s&&t(r,s,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function S8(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function E8(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function pE(t){let e=t[0],n,r,i=dE(t);return{c(){i.c(),n=Pi()},m(s,c){i.m(s,c),be(s,n,c),r=!0},p(s,c){c[0]&1&&Ut(e,e=s[0])?(kn(),me(i,1,1,Ct),Dn(),i=dE(s),i.c(),se(i,1),i.m(n.parentNode,n)):i.p(s,c)},i(s){r||(se(i),r=!0)},o(s){me(i),r=!1},d(s){s&&ve(n),i.d(s)}}}function dE(t){let e;const n=t[36].default,r=gr(n,t,t[35],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[1]&16)&&yr(r,n,i,i[35],e?_r(n,i[35],s,null):vr(i[35]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function I8(t){let e,n,r=t[0]&&pE(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,s){i[0]?r?(r.p(i,s),s[0]&1&&se(r,1)):(r=pE(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function C8(t,e,n){let r,i,s,c,l,d,v,S,E,C,M,k,{$$slots:R={},$$scope:F}=e,{id:U=Pm("layer")}=e,{source:z=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:q=void 0}=e,{beforeLayerType:X=void 0}=e,{type:de}=e,{paint:ae=void 0}=e,{layout:le=void 0}=e,{filter:ye=void 0}=e,{applyToClusters:ke=void 0}=e,{minzoom:Q=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:qe=!1}=e,{hovered:Pe=null}=e,{interactive:it=!0}=e,{hoverCursor:ft=void 0}=e,{eventsIfTopMost:Xe=!1}=e;const Mt=bu(),{map:At,source:yt,self:zt,minzoom:Tt,maxzoom:tn,eventTopMost:Rn,layerInfo:Jt}=w8();vt(t,At,ne=>n(31,E=ne)),vt(t,yt,ne=>n(32,C=ne)),vt(t,zt,ne=>n(0,S=ne)),vt(t,Tt,ne=>n(34,k=ne)),vt(t,tn,ne=>n(33,M=ne)),ro(()=>{S&&E&&(Jt.delete(S),E==null||E.removeLayer(S))});let pn;function Nn(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt={event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce};Mt(ne.type,kt)}function En(ne){var Re,on;if(!it||!S||!E||Xe&&Rn(ne)!==S)return;ft&&(E.getCanvas().style.cursor=ft);let Ce=ne.features??[];n(6,Pe=Ce[0]??null);let ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id;Mt("mouseenter",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Nr(ne){var Re,on,qr;if(!it||!E)return;if(Xe&&Rn(ne)!==S){n(6,Pe=null),qe&&pn!==void 0&&(E==null||E.setFeatureState({source:l,sourceLayer:G,id:pn},{hover:!1}),pn=void 0);return}E.getCanvas().style.cursor=ft;let Ce=ne.features??[],ot=(on=(Re=Ce[0])==null?void 0:Re.properties)==null?void 0:on.cluster_id,kt=(qr=Ce[0])==null?void 0:qr.id;kt!==pn&&(qe&&(pn!==void 0&&(E==null||E.setFeatureState({source:l,id:pn,sourceLayer:G},{hover:!1})),E==null||E.setFeatureState({source:l,id:kt,sourceLayer:G},{hover:!0})),pn=kt,n(6,Pe=Ce[0]??null)),Mt("mousemove",{event:ne,map:E,clusterId:ot,layer:S,source:l,features:Ce})}function Jn(ne){if(!(!it||!S||!E)){if(ft&&(E.getCanvas().style.cursor=""),n(6,Pe=null),qe&&pn!==void 0){const Ce={source:l,id:pn,sourceLayer:G};E==null||E.setFeatureState(Ce,{hover:!1}),pn=void 0}Mt("mouseleave",{map:E,layer:S,source:l})}}let On=!0;function Qn(ne){E&&(E.off("click",ne,Nn),E.off("dblclick",ne,Nn),E.off("contextmenu",ne,Nn),E.off("mouseenter",ne,En),E.off("mousemove",ne,Nr),E.off("mouseleave",ne,Jn))}return ro(()=>{E&&S&&Qn(S)}),t.$$set=ne=>{"id"in ne&&n(7,U=ne.id),"source"in ne&&n(8,z=ne.source),"sourceLayer"in ne&&n(9,G=ne.sourceLayer),"beforeId"in ne&&n(10,q=ne.beforeId),"beforeLayerType"in ne&&n(11,X=ne.beforeLayerType),"type"in ne&&n(12,de=ne.type),"paint"in ne&&n(13,ae=ne.paint),"layout"in ne&&n(14,le=ne.layout),"filter"in ne&&n(15,ye=ne.filter),"applyToClusters"in ne&&n(16,ke=ne.applyToClusters),"minzoom"in ne&&n(17,Q=ne.minzoom),"maxzoom"in ne&&n(18,oe=ne.maxzoom),"manageHoverState"in ne&&n(19,qe=ne.manageHoverState),"hovered"in ne&&n(6,Pe=ne.hovered),"interactive"in ne&&n(20,it=ne.interactive),"hoverCursor"in ne&&n(21,ft=ne.hoverCursor),"eventsIfTopMost"in ne&&n(22,Xe=ne.eventsIfTopMost),"$$scope"in ne&&n(35,F=ne.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=E8(ke)),t.$$.dirty[0]&1073774592&&n(24,i=S8("all",r,ye)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,s=Q??k),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??M),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=z||C),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&E&&S!==U&&l){S&&(Qn(S),Jt.delete(S));let ne=q;if(!q&&X){let Ce=E.getStyle().layers,ot=typeof X=="function"?X:Re=>Re.type===X,kt=Ce==null?void 0:Ce.find(ot);kt&&(ne=kt.id)}Bt(zt,S=U,S),E.addLayer(Xc({id:S,type:de,source:l,"source-layer":G,filter:i,paint:ae,layout:le,minzoom:s,maxzoom:c}),ne),n(23,On=!0),E.on("click",S,Nn),E.on("dblclick",S,Nn),E.on("contextmenu",S,Nn),E.on("mouseenter",S,En),E.on("mousemove",S,Nr),E.on("mouseleave",S,Jn)}t.$$.dirty[0]&1048577&&S&&Jt.set(S,{interactive:it}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?fE((ne,Ce)=>E==null?void 0:E.setPaintProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,v=S?fE((ne,Ce)=>E==null?void 0:E.setLayoutProperty(S,ne,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(ae)),t.$$.dirty[0]&134234112&&(v==null||v(le)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(E==null||E.setLayerZoomRange(S,s,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(On?n(23,On=!1):E==null||E.setFilter(S,i))},[S,At,yt,zt,Tt,tn,Pe,U,z,G,q,X,de,ae,le,ye,ke,Q,oe,qe,it,ft,Xe,On,i,c,s,v,d,l,r,E,C,M,k,F,R]}class db extends Zt{constructor(e){super(),Ht(this,e,C8,I8,Ut,{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 T8(t){let e;const n=t[16].default,r=gr(n,t,t[24],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16777216)&&yr(r,n,i,i[24],e?_r(n,i[24],s,null):vr(i[24]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function L8(t){let e,n,r;function i(c){t[17](c)}let s={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[T8]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new db({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function P8(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=Pm("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{applyToClusters:M=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:R=void 0}=e,{hoverCursor:F=void 0}=e,{manageHoverState:U=!1}=e,{hovered:z=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:q=!0}=e;function X(oe){z=oe,n(0,z)}function de(oe){gn.call(this,t,oe)}function ae(oe){gn.call(this,t,oe)}function le(oe){gn.call(this,t,oe)}function ye(oe){gn.call(this,t,oe)}function ke(oe){gn.call(this,t,oe)}function Q(oe){gn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,s=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,v=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,E=oe.layout),"filter"in oe&&n(8,C=oe.filter),"applyToClusters"in oe&&n(9,M=oe.applyToClusters),"minzoom"in oe&&n(10,k=oe.minzoom),"maxzoom"in oe&&n(11,R=oe.maxzoom),"hoverCursor"in oe&&n(12,F=oe.hoverCursor),"manageHoverState"in oe&&n(13,U=oe.manageHoverState),"hovered"in oe&&n(0,z=oe.hovered),"eventsIfTopMost"in oe&&n(14,G=oe.eventsIfTopMost),"interactive"in oe&&n(15,q=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[z,s,c,l,d,v,S,E,C,M,k,R,F,U,G,q,r,X,de,ae,le,ye,ke,Q,i]}class M8 extends Zt{constructor(e){super(),Ht(this,e,P8,L8,Ut,{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 A8(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function k8(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[A8]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new db({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function D8(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=Pm("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:F=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:z=!1}=e,{interactive:G=!0}=e;function q(Q){U=Q,n(0,U)}function X(Q){gn.call(this,t,Q)}function de(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ye(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,F=Q.manageHoverState),"hovered"in Q&&n(0,U=Q.hovered),"eventsIfTopMost"in Q&&n(13,z=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[U,s,c,l,d,v,S,E,C,M,k,R,F,z,G,r,q,X,de,ae,le,ye,ke,i]}class R8 extends Zt{constructor(e){super(),Ht(this,e,D8,k8,Ut,{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 N8(t,e,n,r,i){let s=!1;t.getSource(e)&&(s=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(s){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function O8(t,e,n){zE().then(()=>{let r=Fs(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function mE(t){let e=t[0],n,r,i=gE(t);return{c(){i.c(),n=Pi()},m(s,c){i.m(s,c),be(s,n,c),r=!0},p(s,c){c&1&&Ut(e,e=s[0])?(kn(),me(i,1,1,Ct),Dn(),i=gE(s),i.c(),se(i,1),i.m(n.parentNode,n)):i.p(s,c)},i(s){r||(se(i),r=!0)},o(s){me(i),r=!1},d(s){s&&ve(n),i.d(s)}}}function gE(t){let e;const n=t[15].default,r=gr(n,t,t[14],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16384)&&yr(r,n,i,i[14],e?_r(n,i[14],s,null):vr(i[14]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function z8(t){let e,n,r=t[0]&&mE(t);return{c(){r&&r.c(),e=Pi()},m(i,s){r&&r.m(i,s),be(i,e,s),n=!0},p(i,[s]){i[0]?r?(r.p(i,s),s&1&&se(r,1)):(r=mE(i),r.c(),se(r,1),r.m(e.parentNode,e)):r&&(kn(),me(r,1,1,()=>{r=null}),Dn())},i(i){n||(se(r),n=!0)},o(i){me(r),n=!1},d(i){i&&ve(e),r&&r.d(i)}}}function F8(t,e,n){let r,i,s,{$$slots:c={},$$scope:l}=e,{id:d=Pm("geojson")}=e,{data:v}=e,{generateId:S=!1}=e,{promoteId:E=void 0}=e,{filter:C=void 0}=e,{lineMetrics:M=void 0}=e,{cluster:k=void 0}=e;const{map:R,cluster:F,self:U}=x8();vt(t,R,q=>n(13,i=q)),vt(t,F,q=>n(16,s=q)),vt(t,U,q=>n(0,r=q));let z,G=!0;return ro(()=>{r&&z&&i&&(O8(R,r,z),Bt(U,r=null,r),n(11,z=void 0))}),t.$$set=q=>{"id"in q&&n(4,d=q.id),"data"in q&&n(5,v=q.data),"generateId"in q&&n(6,S=q.generateId),"promoteId"in q&&n(7,E=q.promoteId),"filter"in q&&n(8,C=q.filter),"lineMetrics"in q&&n(9,M=q.lineMetrics),"cluster"in q&&n(10,k=q.cluster),"$$scope"in q&&n(14,l=q.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Bt(F,s=k,s),t.$$.dirty&12273&&i&&r!==d&&(Bt(U,r=d,r),N8(i,r,Xc({type:"geojson",data:v,filter:C,lineMetrics:M,generateId:S,promoteId:E,cluster:!!k,clusterMinPoints:k==null?void 0:k.minPoints,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius,clusterProperties:k==null?void 0:k.properties}),q=>i&&q===r,()=>{r&&(n(11,z=i==null?void 0:i.getSource(r)),n(12,G=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,z=i==null?void 0:i.getSource(d))})),t.$$.dirty&6176&&z&&(G?n(12,G=!1):z.setData(v)),t.$$.dirty&3072&&(z==null||z.setClusterOptions(Xc({cluster:!!k,clusterMaxZoom:k==null?void 0:k.maxZoom,clusterRadius:k==null?void 0:k.radius})))},[r,R,F,U,d,v,S,E,C,M,k,z,G,i,l,c]}class B8 extends Zt{constructor(e){super(),Ht(this,e,F8,z8,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function V8(t){let e;const n=t[15].default,r=gr(n,t,t[23],null);return{c(){r&&r.c()},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8388608)&&yr(r,n,i,i[23],e?_r(n,i[23],s,null):vr(i[23]),null)},i(i){e||(se(r,i),e=!0)},o(i){me(r,i),e=!1},d(i){r&&r.d(i)}}}function U8(t){let e,n,r;function i(c){t[16](c)}let s={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[V8]},$$scope:{ctx:t}};return t[0]!==void 0&&(s.hovered=t[0]),e=new db({props:s}),si.push(()=>Il(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){Ue(e.$$.fragment)},m(c,l){Be(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],El(()=>n=!1)),e.$set(d)},i(c){r||(se(e.$$.fragment,c),r=!0)},o(c){me(e.$$.fragment,c),r=!1},d(c){Ve(e,c)}}}function j8(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:s=Pm("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:v=void 0}=e,{paint:S}=e,{layout:E=void 0}=e,{filter:C=void 0}=e,{minzoom:M=void 0}=e,{maxzoom:k=void 0}=e,{hoverCursor:R=void 0}=e,{manageHoverState:F=!1}=e,{hovered:U=null}=e,{eventsIfTopMost:z=!1}=e,{interactive:G=!0}=e;function q(Q){U=Q,n(0,U)}function X(Q){gn.call(this,t,Q)}function de(Q){gn.call(this,t,Q)}function ae(Q){gn.call(this,t,Q)}function le(Q){gn.call(this,t,Q)}function ye(Q){gn.call(this,t,Q)}function ke(Q){gn.call(this,t,Q)}return t.$$set=Q=>{"id"in Q&&n(1,s=Q.id),"source"in Q&&n(2,c=Q.source),"sourceLayer"in Q&&n(3,l=Q.sourceLayer),"beforeId"in Q&&n(4,d=Q.beforeId),"beforeLayerType"in Q&&n(5,v=Q.beforeLayerType),"paint"in Q&&n(6,S=Q.paint),"layout"in Q&&n(7,E=Q.layout),"filter"in Q&&n(8,C=Q.filter),"minzoom"in Q&&n(9,M=Q.minzoom),"maxzoom"in Q&&n(10,k=Q.maxzoom),"hoverCursor"in Q&&n(11,R=Q.hoverCursor),"manageHoverState"in Q&&n(12,F=Q.manageHoverState),"hovered"in Q&&n(0,U=Q.hovered),"eventsIfTopMost"in Q&&n(13,z=Q.eventsIfTopMost),"interactive"in Q&&n(14,G=Q.interactive),"$$scope"in Q&&n(23,i=Q.$$scope)},[U,s,c,l,d,v,S,E,C,M,k,R,F,z,G,r,q,X,de,ae,le,ye,ke,i]}class G8 extends Zt{constructor(e){super(),Ht(this,e,j8,U8,Ut,{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 q8(t){let e,n,r,i,s,c;return e=new R8({props:{id:"edit-polygon-fill",filter:u8,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new G8({props:{id:"edit-polygon-lines",filter:c8,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),s=new M8({props:{id:"edit-polygon-vertices",filter:h8,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){Ue(e.$$.fragment),n=We(),Ue(r.$$.fragment),i=We(),Ue(s.$$.fragment)},m(l,d){Be(e,l,d),be(l,n,d),Be(r,l,d),be(l,i,d),Be(s,l,d),c=!0},p:Ct,i(l){c||(se(e.$$.fragment,l),se(r.$$.fragment,l),se(s.$$.fragment,l),c=!0)},o(l){me(e.$$.fragment,l),me(r.$$.fragment,l),me(s.$$.fragment,l),c=!1},d(l){l&&(ve(n),ve(i)),Ve(e,l),Ve(r,l),Ve(s,l)}}}function W8(t){let e,n;return e=new B8({props:{data:t[0],$$slots:{default:[q8]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&1&&(s.data=r[0]),i&2&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function H8(t,e,n){let r;return vt(t,VT,i=>n(0,r=i)),[r]}class Z8 extends Zt{constructor(e){super(),Ht(this,e,H8,W8,Ut,{})}}function X8(t){let e,n,r,i,s,c,l;return{c(){e=_e("button"),e.textContent="Import current view",n=We(),r=_e("i"),r.textContent="or...",i=We(),s=_e("button"),s.textContent="Draw an area to import on the map",Le(e,"type","button"),Le(s,"type","button")},m(d,v){be(d,e,v),be(d,n,v),be(d,r,v),be(d,i,v),be(d,s,v),c||(l=[Lt(e,"click",t[2]),Lt(s,"click",t[3])],c=!0)},p:Ct,i:Ct,o:Ct,d(d){d&&(ve(e),ve(n),ve(r),ve(i),ve(s)),c=!1,Kr(l)}}}function $8(t){let e,n;return e=new y8({props:{polygonTool:t[0]}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&1&&(s.polygonTool=r[0]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function Y8(t){let e,n,r,i,s,c,l,d,v;const S=[$8,X8],E=[];function C(M,k){return M[0]?0:1}return e=C(t),n=E[e]=S[e](t),{c(){n.c(),r=We(),i=_e("label"),s=_e("input"),c=nt(`Save a copy of the osm.xml + after importing`),Le(s,"type","checkbox")},m(M,k){E[e].m(M,k),be(M,r,k),be(M,i,k),te(i,s),s.checked=t[1],te(i,c),l=!0,d||(v=Lt(s,"change",t[5]),d=!0)},p(M,[k]){let R=e;e=C(M),e===R?E[e].p(M,k):(kn(),me(E[R],1,1,()=>{E[R]=null}),Dn(),n=E[e],n?n.p(M,k):(n=E[e]=S[e](M),n.c()),se(n,1),n.m(r.parentNode,r)),k&2&&(s.checked=M[1])},i(M){l||(se(n),l=!0)},o(M){me(n),l=!1},d(M){M&&(ve(r),ve(i)),E[e].d(M),d=!1,v()}}}function Id(t){return[t.lng,t.lat]}function K8(t,e,n){let{map:r}=e;const i=bu();let s=null,c=!1;async function l(C){try{i("loading","Loading from Overpass");let k=await(await fetch(qT(C))).text();c&&f_("osm.xml",k),i("gotXml",{xml:k,boundary:C})}catch(M){i("error",M.toString())}}function d(){let C=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Id(C.getSouthWest()),Id(C.getNorthWest()),Id(C.getNorthEast()),Id(C.getSouthEast()),Id(C.getSouthWest())]],type:"Polygon"}}}async function v(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await l(d())}}function S(){r&&(n(0,s=new p8(r)),s.startNew(),s.addEventListenerSuccess(async C=>{n(0,s=null),await l(C)}),s.addEventListenerFailure(()=>{n(0,s=null)}))}function E(){c=this.checked,n(1,c)}return t.$$set=C=>{"map"in C&&n(4,r=C.map)},[s,c,v,S,r,E]}class J8 extends Zt{constructor(e){super(),Ht(this,e,K8,Y8,Ut,{map:4})}}function qT(t){let e='poly:"';for(let[r,i]of t.geometry.coordinates[0])e+=`${i} ${r} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}async function c1(t){Qu.set(t);try{let e=JSON.parse(window.localStorage.getItem(t));console.time("get OSM input");let[n,r]=await Q8(e);console.timeEnd("get OSM input"),console.time("load"),Gi.set(new jE(new Uint8Array(n),r,e.study_area_name||void 0)),Fs(Gi).loadSavefile(e),console.timeEnd("load"),WT()}catch(e){window.alert(`Couldn't open project: ${e}`),Qu.set("")}}async function Q8(t){if(t.study_area_name){let e=Fs(Jd)?`/osm/${t.study_area_name}.pbf`:`https://assets.od2net.org/severance_pbfs/${t.study_area_name}.pbf`;console.log(`Grabbing ${e}`);let r=await(await fetch(e)).arrayBuffer(),i=Fs(Jd)?`/boundaries/${t.study_area_name}.geojson`:`https://assets.od2net.org/boundaries/${t.study_area_name}.geojson`,c=await(await fetch(i)).json();return[r,c]}else{console.log("Grabbing from Overpass");let e=t.features.find(i=>i.properties.kind=="study_area_boundary");return[await(await fetch(qT(e))).arrayBuffer(),e]}}function WT(){bn.set({mode:"network"}),k_.set(new xR(Fs(uu),Fs(Gi).toRouteSnapper(),OT,LB,zT)),H_.set(!1),Z_.set({type:"FeatureCollection",features:[]}),Fs(uu).fitBounds(Array.from(Fs(Gi).getBounds()),{animate:!1}),Vv.set(_E()),Uv.set(_E())}function _E(){let t=Fs(Gi).getBounds(),e=t[0]+Math.random()*(t[2]-t[0]),n=t[1]+Math.random()*(t[3]-t[1]);return new ey.LngLat(e,n)}function yE(t,e,n){const r=t.slice();return r[18]=e[n][0],r[19]=e[n][1],r}function vE(t,e,n){const r=t.slice();return r[22]=e[n],r}function e7(t){let e;return{c(){e=_e("div"),e.innerHTML='',Le(e,"slot","top")},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function t7(t){let e;return{c(){e=_e("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){be(n,e,r)},p:Ct,i:Ct,o:Ct,d(n){n&&ve(e)}}}function n7(t){let e,n,r,i,s,c,l,d,v,S,E,C,M;n=new or({props:{$$slots:{default:[r7]},$$scope:{ctx:t}}}),n.$on("click",t[10]);let k=zo(t[2].entries()),R=[];for(let U=0;Ume(R[U],1,1,()=>{R[U]=null});return{c(){e=_e("div"),Ue(n.$$.fragment),r=We(),i=_e("p"),i.textContent="Load a saved project:",s=We(),c=_e("ul");for(let U=0;U`,c=We(),l=_e("button"),l.innerHTML=`Delete project`,d=We(),Le(s,"class","secondary"),Le(l,"class","secondary"),lr(n,"display","flex"),lr(n,"justify-content","space-between")},m(R,F){be(R,e,F),te(e,n),Be(r,n,null),te(n,i),te(n,s),te(n,c),te(n,l),te(e,d),v=!0,S||(E=[Lt(s,"click",M),Lt(l,"click",k)],S=!0)},p(R,F){t=R;const U={};F&33554436&&(U.$$scope={dirty:F,ctx:t}),r.$set(U)},i(R){v||(se(r.$$.fragment,R),v=!0)},o(R){me(r.$$.fragment,R),v=!1},d(R){R&&ve(e),Ve(r),S=!1,Kr(E)}}}function xE(t){let e,n=(t[18]??"custom area")+"",r,i,s,c,l=zo(t[19]),d=[];for(let S=0;Sme(d[S],1,1,()=>{d[S]=null});return{c(){e=_e("u"),r=nt(n),i=We();for(let S=0;S{c[S]=null}),Dn(),r=c[n],r?r.p(d,v):(r=c[n]=s[n](d),r.c()),se(r,1),r.m(e,null))},i(d){i||(se(r),i=!0)},o(d){me(r),i=!1},d(d){d&&ve(e),c[n].d()}}}function s7(t){let e,n,r,i;return e=new BE({props:{loading:t[1]}}),r=new xu({props:{$$slots:{sidebar:[o7],top:[e7]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment),n=We(),Ue(r.$$.fragment)},m(s,c){Be(e,s,c),be(s,n,c),Be(r,s,c),i=!0},p(s,[c]){const l={};c&2&&(l.loading=s[1]),e.$set(l);const d={};c&33554493&&(d.$$scope={dirty:c,ctx:s}),r.$set(d)},i(s){i||(se(e.$$.fragment,s),se(r.$$.fragment,s),i=!0)},o(s){me(e.$$.fragment,s),me(r.$$.fragment,s),i=!1},d(s){s&&ve(n),Ve(e,s),Ve(r,s)}}}function Xg(){let t=new Map;for(let e=0;en(15,r=X)),vt(t,k_,X=>n(16,i=X)),vt(t,Gi,X=>n(17,s=X)),vt(t,uu,X=>n(4,c=X)),vt(t,bn,X=>n(5,l=X));let{wasmReady:d}=e,v="";Bt(Gi,s=null,s),Bt(k_,i=null,i),Bt(Qu,r="",r);let S=Xg(),E;async function C(X){let de="ltn_"+E.files[0].name;n(1,v=`Loading from file ${de}`),window.localStorage.setItem(de,await E.files[0].text()),n(2,S=Xg()),await c1(de),n(1,v="")}function M(X){window.confirm(`Really delete project ${X}? You can't undo this.`)&&(window.localStorage.removeItem(X),n(2,S=Xg()))}function k(X){let de=window.prompt(`Rename project ${X} to what?`,X);if(de){de.startsWith("ltn_")||(de=`ltn_${de}`);let ae=window.localStorage.getItem(X);window.localStorage.setItem(de,ae),window.localStorage.removeItem(X),n(2,S=Xg())}}async function R(X){n(1,v=`Loading project ${X}`),await c1(X),n(1,v="")}const F=()=>Bt(bn,l={mode:"new-project"},l),U=X=>R(X),z=X=>k(X),G=X=>M(X);function q(X){si[X?"unshift":"push"](()=>{E=X,n(3,E)})}return t.$$set=X=>{"wasmReady"in X&&n(0,d=X.wasmReady)},[d,v,S,E,c,l,C,M,k,R,F,U,z,G,q]}class l7 extends Zt{constructor(e){super(),Ht(this,e,a7,s7,Ut,{wasmReady:0})}}function wE(t,e,n){const r=t.slice();return r[17]=e[n][0],r[18]=e[n][1],r}function SE(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function u7(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function c7(t){let e,n,r,i,s,c,l,d;return s=new or({props:{$$slots:{default:[u7]},$$scope:{ctx:t}}}),s.$on("click",t[13]),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),l.textContent="New project",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(v,S){be(v,e,S),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),d=!0},p(v,S){const E={};S&33554432&&(E.$$scope={dirty:S,ctx:v}),s.$set(E)},i(v){d||(se(s.$$.fragment,v),d=!0)},o(v){me(s.$$.fragment,v),d=!1},d(v){v&&ve(e),Ve(s)}}}function EE(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;e=new BE({props:{loading:t[4]}});let R=zo(t[3]),F=[];for(let U=0;Ut[9].call(s))},m(U,z){Be(e,U,z),be(U,n,z),be(U,r,z),te(r,i),te(r,s),te(s,c);for(let G=0;G{S=null}),Dn())},i(E){l||(se(S),l=!0)},o(E){me(S),l=!1},d(E){E&&ve(e),S&&S.d(),d=!1,v()}}}function f7(t){let e,n,r;return n=new Z8({}),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","map")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p:Ct,i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function p7(t){let e,n;return e=new xu({props:{$$slots:{map:[f7],sidebar:[h7],top:[c7]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,[i]){const s={};i&33554558&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function d7(t,e,n){let r,i,s,c,l;vt(t,Qu,q=>n(14,r=q)),vt(t,Gi,q=>n(15,i=q)),vt(t,Jd,q=>n(16,s=q)),vt(t,uu,q=>n(5,c=q)),vt(t,bn,q=>n(6,l=q));let d="",v="",S=[],E="";$_(async()=>{let q=await fetch(s?"/osm/areas.json":"https://assets.od2net.org/severance_pbfs/areas.json");n(3,S=await q.json())});function C(q){n(4,E="Loading OSM");try{Bt(Gi,i=new jE(new TextEncoder().encode(q.detail.xml),q.detail.boundary,void 0),i),Bt(Qu,r=`ltn_${d}`,r),WT(),Nf()}catch(X){window.alert(`Couldn't import from Overpass: ${X}`)}n(4,E="")}async function M(){if(v=="")return;let q=`ltn_${d}`;window.localStorage.setItem(q,JSON.stringify({type:"FeatureCollection",features:[],study_area_name:v})),n(4,E=`Loading pre-clipped OSM area ${v}`),await c1(q),n(4,E="")}function k(){d=this.value,n(1,d)}function R(){v=DE(this),n(2,v),n(3,S)}return[M,d,v,S,E,c,l,C,k,R,()=>M(),q=>n(4,E=q.detail),q=>window.alert(q.detail),()=>Bt(bn,l={mode:"title"},l)]}class m7 extends Zt{constructor(e){super(),Ht(this,e,d7,p7,Ut,{loadExample:0})}get loadExample(){return this.$$.ctx[0]}}const{window:g7}=h1;function _7(t){let e;return{c(){e=nt("Choose project")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function y7(t){let e;return{c(){e=nt("Pick neighbourhood")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function v7(t){let e;return{c(){e=nt("Editing")},m(n,r){be(n,e,r)},d(n){n&&ve(e)}}}function b7(t){let e,n,r,i,s,c,l,d,v,S,E,C,M,k;return s=new or({props:{$$slots:{default:[_7]},$$scope:{ctx:t}}}),s.$on("click",t[9]),d=new or({props:{$$slots:{default:[y7]},$$scope:{ctx:t}}}),d.$on("click",t[10]),E=new or({props:{$$slots:{default:[v7]},$$scope:{ctx:t}}}),E.$on("click",t[5]),{c(){e=_e("div"),n=_e("nav"),r=_e("ul"),i=_e("li"),Ue(s.$$.fragment),c=We(),l=_e("li"),Ue(d.$$.fragment),v=We(),S=_e("li"),Ue(E.$$.fragment),C=We(),M=_e("li"),M.textContent="Viewing shortcuts",Le(n,"aria-label","breadcrumb"),Le(e,"slot","top")},m(R,F){be(R,e,F),te(e,n),te(n,r),te(r,i),Be(s,i,null),te(r,c),te(r,l),Be(d,l,null),te(r,v),te(r,S),Be(E,S,null),te(r,C),te(r,M),k=!0},p(R,F){const U={};F&8192&&(U.$$scope={dirty:F,ctx:R}),s.$set(U);const z={};F&8192&&(z.$$scope={dirty:F,ctx:R}),d.$set(z);const G={};F&8192&&(G.$$scope={dirty:F,ctx:R}),E.$set(G)},i(R){k||(se(s.$$.fragment,R),se(d.$$.fragment,R),se(E.$$.fragment,R),k=!0)},o(R){me(s.$$.fragment,R),me(d.$$.fragment,R),me(E.$$.fragment,R),k=!1},d(R){R&&ve(e),Ve(s),Ve(d),Ve(E)}}}function x7(t){let e,n,r,i,s,c,l,d,v,S=t[0].shortcutIndex+1+"",E,C,M=t[0].gj.features.length+"",k,R,F,U,z,G,q,X,de,ae=kr(t[0].gj.features[t[0].shortcutIndex].properties).directness.toFixed(1)+"",le,ye,ke,Q,oe;return{c(){e=_e("p"),e.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=We(),r=ge("button"),r.textContent="Pick a different road",i=We(),s=ge("div"),c=ge("button"),l=nt("Previous"),v=We(),E=nt(S),C=nt(" / "),k=nt(M),R=We(),N=ge("button"),B=nt("Next"),G=We(),H=ge("p"),K=nt("This shortcut is "),_e=ge("b"),le=nt(ae),ve=nt("x"),ke=nt(` - the length of the shortest route using all roads, not just this neighbourhood`),c.disabled=d=t[0].shortcutIndex==0,Le(c,"data-tooltip","Left"),N.disabled=F=t[0].shortcutIndex==t[0].gj.features.length-1,Le(N,"data-tooltip","Right"),lr(s,"display","flex"),lr(s,"justify-content","space-between")},m(qe,Pe){be(qe,e,Pe),be(qe,n,Pe),be(qe,r,Pe),be(qe,i,Pe),be(qe,s,Pe),te(s,c),te(c,l),te(s,v),te(s,E),te(s,C),te(s,k),te(s,R),te(s,N),te(N,B),be(qe,G,Pe),be(qe,H,Pe),te(H,K),te(H,_e),te(_e,le),te(_e,ve),te(H,ke),Q||(oe=[Lt(r,"click",t[8]),Lt(c,"click",t[6]),Lt(N,"click",t[7])],Q=!0)},p(qe,Pe){Pe&1&&d!==(d=qe[0].shortcutIndex==0)&&(c.disabled=d),Pe&1&&S!==(S=qe[0].shortcutIndex+1+"")&&Hn(E,S),Pe&1&&M!==(M=qe[0].gj.features.length+"")&&Hn(k,M),Pe&1&&F!==(F=qe[0].shortcutIndex==qe[0].gj.features.length-1)&&(N.disabled=F),Pe&1&&ae!==(ae=kr(qe[0].gj.features[qe[0].shortcutIndex].properties).directness.toFixed(1)+"")&&Hn(le,ae)},d(qe){qe&&(ye(e),ye(n),ye(r),ye(i),ye(s),ye(G),ye(H)),Q=!1,Yr(oe)}}}function w7(t){let e;return{c(){e=ge("p"),e.textContent="Click a road to see shortcuts"},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ye(e)}}}function S7(t){let e,n,r,i;n=new wy({}),n.$on("click",t[5]);function s(d,v){if(d[0].state=="neutral")return w7;if(d[0].state=="chose-road")return x7}let c=s(t),l=c&&c(t);return{c(){e=ge("div"),je(n.$$.fragment),r=We(),l&&l.c(),Le(e,"slot","sidebar")},m(d,v){be(d,e,v),Be(n,e,null),te(e,r),l&&l.m(e,null),i=!0},p(d,v){c===(c=s(d))&&l?l.p(d,v):(l&&l.d(1),l=c&&c(d),l&&(l.c(),l.m(e,null)))},i(d){i||(se(n.$$.fragment,d),i=!0)},o(d){de(n.$$.fragment,d),i=!1},d(d){d&&ye(e),Ve(n),l&&l.d()}}}function E7(t){let e,n,r,i,s,c;return e=new No({props:{data:l1(JSON.parse(kr(t[2]).renderNeighbourhood())),$$slots:{default:[C7]},$$scope:{ctx:t}}}),r=new No({props:{data:t[0].gj.features[t[0].shortcutIndex],$$slots:{default:[T7]},$$scope:{ctx:t}}}),s=new No({props:{data:t[0].roadGj,$$slots:{default:[L7]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment),n=We(),je(r.$$.fragment),i=We(),je(s.$$.fragment)},m(l,d){Be(e,l,d),be(l,n,d),Be(r,l,d),be(l,i,d),Be(s,l,d),c=!0},p(l,d){const v={};d&4&&(v.data=l1(JSON.parse(kr(l[2]).renderNeighbourhood()))),d&8192&&(v.$$scope={dirty:d,ctx:l}),e.$set(v);const S={};d&1&&(S.data=l[0].gj.features[l[0].shortcutIndex]),d&8192&&(S.$$scope={dirty:d,ctx:l}),r.$set(S);const E={};d&1&&(E.data=l[0].roadGj),d&8192&&(E.$$scope={dirty:d,ctx:l}),s.$set(E)},i(l){c||(se(e.$$.fragment,l),se(r.$$.fragment,l),se(s.$$.fragment,l),c=!0)},o(l){de(e.$$.fragment,l),de(r.$$.fragment,l),de(s.$$.fragment,l),c=!1},d(l){l&&(ye(n),ye(i)),Ve(e,l),Ve(r,l),Ve(s,l)}}}function I7(t){let e,n;return e=new Sy({props:{gjInput:JSON.parse(kr(t[2]).renderNeighbourhood()),onClickLine:t[3],$$slots:{"line-popup":[M7]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&4&&(s.gjInput=JSON.parse(kr(r[2]).renderNeighbourhood())),i&8192&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function C7(t){let e,n;const r=[gi("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let i={};for(let s=0;s({12:i}),({props:i})=>i?4096:0]},$$scope:{ctx:t}}}),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","line-popup")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&12288&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){de(n.$$.fragment,i),r=!1},d(i){i&&ye(e),Ve(n)}}}function A7(t){let e,n,r,i,s,c;const l=[I7,E7],d=[];function v(S,E){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(n=v(t))&&(r=d[n]=l[n](t)),s=new Ey({}),{c(){e=ge("div"),r&&r.c(),i=We(),je(s.$$.fragment),Le(e,"slot","map")},m(S,E){be(S,e,E),~n&&d[n].m(e,null),te(e,i),Be(s,e,null),c=!0},p(S,E){let C=n;n=v(S),n===C?~n&&d[n].p(S,E):(r&&(kn(),de(d[C],1,1,()=>{d[C]=null}),Dn()),~n?(r=d[n],r?r.p(S,E):(r=d[n]=l[n](S),r.c()),se(r,1),r.m(e,i)):r=null)},i(S){c||(se(r),se(s.$$.fragment,S),c=!0)},o(S){de(r),de(s.$$.fragment,S),c=!1},d(S){S&&ye(e),~n&&d[n].d(),Ve(s)}}}function k7(t){let e,n,r,i;return e=new bu({props:{$$slots:{map:[A7],sidebar:[S7],top:[b7]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment)},m(s,c){Be(e,s,c),n=!0,r||(i=Lt(g7,"keydown",t[4]),r=!0)},p(s,[c]){const l={};c&8199&&(l.$$scope={dirty:c,ctx:s}),e.$set(l)},i(s){n||(se(e.$$.fragment,s),n=!0)},o(s){de(e.$$.fragment,s),n=!1},d(s){Ve(e,s),r=!1,i()}}}function D7(t,e,n){let r,i,s;vt(t,bn,R=>n(1,r=R)),vt(t,uu,R=>n(11,i=R)),vt(t,Gi,R=>n(2,s=R));let c={state:"neutral"};function l(R,N){let B=JSON.parse(s.getShortcutsCrossingRoad(R.properties.id));if(B.features.length==0){window.alert("No shortcuts here");return}n(0,c={state:"chose-road",roadGj:R,gj:B,shortcutIndex:0})}$_(()=>{i==null||i.keyboard.disable()}),ro(()=>{i==null||i.keyboard.enable()});function d(R){c.state=="chose-road"&&(R.key=="ArrowLeft"&&c.shortcutIndex>0&&(R.stopPropagation(),n(0,c.shortcutIndex--,c)),R.key=="ArrowRight"&&(R.stopPropagation(),c.shortcutIndex!=c.gj.features.length-1&&n(0,c.shortcutIndex++,c)))}function v(){Bt(bn,r={mode:"neighbourhood"},r)}function S(){c.state=="chose-road"&&n(0,c.shortcutIndex--,c)}function E(){c.state=="chose-road"&&n(0,c.shortcutIndex++,c)}return[c,r,s,l,d,v,S,E,()=>n(0,c={state:"neutral"}),()=>Bt(bn,r={mode:"title"},r),()=>Bt(bn,r={mode:"network"},r)]}class R7 extends Zt{constructor(e){super(),Ht(this,e,D7,k7,Ut,{})}}function N7(t){let e,n,r,i,s,c,l,d,v;return i=new TB({}),{c(){e=ge("div"),n=ge("button"),n.innerHTML=`A/B Street logo`,r=We(),je(i.$$.fragment),s=We(),c=ge("span"),Le(n,"class","outline"),lr(c,"width","100%"),Le(e,"slot","top"),lr(e,"display","flex")},m(S,E){be(S,e,E),te(e,n),te(e,r),Be(i,e,null),te(e,s),te(e,c),t[19](c),l=!0,d||(v=Lt(n,"click",t[18]),d=!0)},p:Ct,i(S){l||(se(i.$$.fragment,S),l=!0)},o(S){de(i.$$.fragment,S),l=!1},d(S){S&&ye(e),Ve(i),t[19](null),d=!1,v()}}}function TE(t){let e,n,r,i,s,c;return r=new eF({props:{map:kr(t[6]),maptilerBasemap:t[7]}}),{c(){e=ge("button"),e.textContent="Zoom to fit study area",n=We(),je(r.$$.fragment),Le(e,"class","secondary")},m(l,d){be(l,e,d),be(l,n,d),Be(r,l,d),i=!0,s||(c=Lt(e,"click",t[10]),s=!0)},p(l,d){const v={};d&64&&(v.map=kr(l[6])),d&128&&(v.maptilerBasemap=l[7]),r.$set(v)},i(l){i||(se(r.$$.fragment,l),i=!0)},o(l){de(r.$$.fragment,l),i=!1},d(l){l&&(ye(e),ye(n)),Ve(r,l),s=!1,c()}}}function O7(t){let e,n,r,i,s,c,l=t[5]&&TE(t);return{c(){e=ge("div"),n=ge("div"),r=We(),i=ge("hr"),s=We(),l&&l.c(),Le(e,"slot","left")},m(d,v){be(d,e,v),te(e,n),t[17](n),te(e,r),te(e,i),te(e,s),l&&l.m(e,null),c=!0},p(d,v){d[5]?l?(l.p(d,v),v&32&&se(l,1)):(l=TE(d),l.c(),se(l,1),l.m(e,null)):l&&(kn(),de(l,1,1,()=>{l=null}),Dn())},i(d){c||(se(l),c=!0)},o(d){de(l),c=!1},d(d){d&&ye(e),t[17](null),l&&l.d()}}}function z7(t){let e,n;return e=new m7({}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p:Ct,i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function F7(t){let e,n;return e=new l7({props:{wasmReady:t[4]}}),{c(){je(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&16&&(s.wasmReady=r[4]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){de(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function LE(t){let e,n,r,i,s,c;e=new No({props:{data:JSON.parse(t[5].getInvertedBoundary()),$$slots:{default:[B7]},$$scope:{ctx:t}}});const l=[H7,W7,q7,G7,j7,U7,V7],d=[];function v(S,E){return S[8].mode=="network"?0:S[8].mode=="set-boundary"?1:S[8].mode=="auto-boundaries"?2:S[8].mode=="neighbourhood"?3:S[8].mode=="view-shortcuts"?4:S[8].mode=="route"?5:S[8].mode=="debug"?6:-1}return~(r=v(t))&&(i=d[r]=l[r](t)),{c(){je(e.$$.fragment),n=We(),i&&i.c(),s=Pi()},m(S,E){Be(e,S,E),be(S,n,E),~r&&d[r].m(S,E),be(S,s,E),c=!0},p(S,E){const C={};E&32&&(C.data=JSON.parse(S[5].getInvertedBoundary())),E&2097152&&(C.$$scope={dirty:E,ctx:S}),e.$set(C);let M=r;r=v(S),r===M?~r&&d[r].p(S,E):(i&&(kn(),de(d[M],1,1,()=>{d[M]=null}),Dn()),~r?(i=d[r],i?i.p(S,E):(i=d[r]=l[r](S),i.c()),se(i,1),i.m(s.parentNode,s)):i=null)},i(S){c||(se(e.$$.fragment,S),se(i),c=!0)},o(S){de(e.$$.fragment,S),de(i),c=!1},d(S){S&&(ye(n),ye(s)),Ve(e,S),~r&&d[r].d(S)}}}function B7(t){let e,n;const r=[gi("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let i={};for(let s=0;s{C[F]=null}),Dn()),~s?(c=C[s],c?c.p(R,N):(c=C[s]=E[s](R),c.c()),se(c,1),c.m(l.parentNode,l)):c=null),R[5]?k?(k.p(R,N),N&32&&se(k,1)):(k=LE(R),k.c(),se(k,1),k.m(d.parentNode,d)):k&&(kn(),de(k,1,1,()=>{k=null}),Dn())},i(R){S||(se(e.$$.fragment,R),se(c),se(k),se(v.$$.fragment,R),S=!0)},o(R){de(e.$$.fragment,R),de(c),de(k),de(v.$$.fragment,R),S=!1},d(R){R&&(ye(n),ye(r),ye(i),ye(l),ye(d)),Ve(e,R),t[14](null),~s&&C[s].d(R),k&&k.d(R),Ve(v,R)}}}function X7(t){let e,n,r,i;function s(l){t[15](l)}let c={style:`https://api.maptiler.com/maps/${t[7]}/style.json?key=${Fv}`,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"},{id:"oneway-arrow",url:CR}],$$slots:{default:[Z7]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new mN({props:c}),si.push(()=>Il(n,"map",s)),n.$on("error",t[16]),{c(){e=ge("div"),je(n.$$.fragment),Le(e,"slot","main"),lr(e,"position","relative"),lr(e,"width","100%"),lr(e,"height","100%")},m(l,d){be(l,e,d),Be(n,e,null),i=!0},p(l,d){const v={};d&128&&(v.style=`https://api.maptiler.com/maps/${l[7]}/style.json?key=${Fv}`),d&2097465&&(v.$$scope={dirty:d,ctx:l}),!r&&d&1&&(r=!0,v.map=l[0],El(()=>r=!1)),n.$set(v)},i(l){i||(se(n.$$.fragment,l),i=!0)},o(l){de(n.$$.fragment,l),i=!1},d(l){l&&ye(e),Ve(n)}}}function $7(t){let e,n,r,i;return e=new IR({}),r=new Ez({props:{$$slots:{main:[X7],left:[O7],top:[N7]},$$scope:{ctx:t}}}),{c(){je(e.$$.fragment),n=We(),je(r.$$.fragment)},m(s,c){Be(e,s,c),be(s,n,c),Be(r,s,c),i=!0},p(s,[c]){const l={};c&2098175&&(l.$$scope={dirty:c,ctx:s}),r.$set(l)},i(s){i||(se(e.$$.fragment,s),se(r.$$.fragment,s),i=!0)},o(s){de(e.$$.fragment,s),de(r.$$.fragment,s),i=!1},d(s){s&&ye(n),Ve(e,s),Ve(r,s)}}}function Y7(t,e,n){let r,i,s,c,l,d,v,S,E;vt(t,a1,le=>n(11,r=le)),vt(t,s1,le=>n(12,i=le)),vt(t,o1,le=>n(13,s=le)),vt(t,Gi,le=>n(5,c=le)),vt(t,uu,le=>n(6,l=le)),vt(t,Jd,le=>n(20,d=le)),vt(t,Bv,le=>n(7,v=le)),vt(t,bn,le=>n(8,S=le)),vt(t,A_,le=>n(9,E=le));let C=!1;$_(async()=>{await GE(),await ZE(),n(4,C=!0);try{(await fetch("/osm/areas.json")).ok&&(Bt(Jd,d=!0,d),console.log("Using local cache, not od2net.org"))}catch{}});let M;function k(){l.fitBounds(Array.from(c.getBounds()),{animate:!1})}let R,N,B;function F(le){si[le?"unshift":"push"](()=>{B=le,n(3,B),n(11,r)})}function G(le){M=le,n(0,M)}const H=le=>{console.log(le.detail.error)};function K(le){si[le?"unshift":"push"](()=>{N=le,n(2,N),n(12,i)})}const _e=()=>Bt(A_,E=!0,E);function ae(le){si[le?"unshift":"push"](()=>{R=le,n(1,R),n(13,s)})}return t.$$.update=()=>{t.$$.dirty&1&&M&&uu.set(M),t.$$.dirty&8194&&R&&s&&(n(1,R.innerHTML="",R),R.appendChild(s)),t.$$.dirty&4100&&N&&i&&(n(2,N.innerHTML="",N),N.appendChild(i)),t.$$.dirty&2056&&B&&r&&(n(3,B.innerHTML="",B),B.appendChild(r))},[M,R,N,B,C,c,l,v,S,E,k,r,i,s,F,G,H,K,_e,ae]}class K7 extends Zt{constructor(e){super(),Ht(this,e,Y7,$7,Ut,{})}}new K7({target:document.getElementById("app")}); + view lets you understand the limits of this assumption.`,n=We(),r=_e("button"),r.textContent="Pick a different road",i=We(),s=_e("div"),c=_e("button"),l=nt("Previous"),v=We(),E=nt(S),C=nt(" / "),k=nt(M),R=We(),F=_e("button"),U=nt("Next"),G=We(),q=_e("p"),X=nt("This shortcut is "),de=_e("b"),le=nt(ae),ye=nt("x"),ke=nt(` + the length of the shortest route using all roads, not just this neighbourhood`),c.disabled=d=t[0].shortcutIndex==0,Le(c,"data-tooltip","Left"),F.disabled=z=t[0].shortcutIndex==t[0].gj.features.length-1,Le(F,"data-tooltip","Right"),lr(s,"display","flex"),lr(s,"justify-content","space-between")},m(qe,Pe){be(qe,e,Pe),be(qe,n,Pe),be(qe,r,Pe),be(qe,i,Pe),be(qe,s,Pe),te(s,c),te(c,l),te(s,v),te(s,E),te(s,C),te(s,k),te(s,R),te(s,F),te(F,U),be(qe,G,Pe),be(qe,q,Pe),te(q,X),te(q,de),te(de,le),te(de,ye),te(q,ke),Q||(oe=[Lt(r,"click",t[8]),Lt(c,"click",t[6]),Lt(F,"click",t[7])],Q=!0)},p(qe,Pe){Pe&1&&d!==(d=qe[0].shortcutIndex==0)&&(c.disabled=d),Pe&1&&S!==(S=qe[0].shortcutIndex+1+"")&&Hn(E,S),Pe&1&&M!==(M=qe[0].gj.features.length+"")&&Hn(k,M),Pe&1&&z!==(z=qe[0].shortcutIndex==qe[0].gj.features.length-1)&&(F.disabled=z),Pe&1&&ae!==(ae=kr(qe[0].gj.features[qe[0].shortcutIndex].properties).directness.toFixed(1)+"")&&Hn(le,ae)},d(qe){qe&&(ve(e),ve(n),ve(r),ve(i),ve(s),ve(G),ve(q)),Q=!1,Kr(oe)}}}function w7(t){let e;return{c(){e=_e("p"),e.textContent="Click a road to see shortcuts"},m(n,r){be(n,e,r)},p:Ct,d(n){n&&ve(e)}}}function S7(t){let e,n,r,i;n=new wy({}),n.$on("click",t[5]);function s(d,v){if(d[0].state=="neutral")return w7;if(d[0].state=="chose-road")return x7}let c=s(t),l=c&&c(t);return{c(){e=_e("div"),Ue(n.$$.fragment),r=We(),l&&l.c(),Le(e,"slot","sidebar")},m(d,v){be(d,e,v),Be(n,e,null),te(e,r),l&&l.m(e,null),i=!0},p(d,v){c===(c=s(d))&&l?l.p(d,v):(l&&l.d(1),l=c&&c(d),l&&(l.c(),l.m(e,null)))},i(d){i||(se(n.$$.fragment,d),i=!0)},o(d){me(n.$$.fragment,d),i=!1},d(d){d&&ve(e),Ve(n),l&&l.d()}}}function E7(t){let e,n,r,i,s,c;return e=new No({props:{data:l1(JSON.parse(kr(t[2]).renderNeighbourhood())),$$slots:{default:[C7]},$$scope:{ctx:t}}}),r=new No({props:{data:t[0].gj.features[t[0].shortcutIndex],$$slots:{default:[T7]},$$scope:{ctx:t}}}),s=new No({props:{data:t[0].roadGj,$$slots:{default:[L7]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment),n=We(),Ue(r.$$.fragment),i=We(),Ue(s.$$.fragment)},m(l,d){Be(e,l,d),be(l,n,d),Be(r,l,d),be(l,i,d),Be(s,l,d),c=!0},p(l,d){const v={};d&4&&(v.data=l1(JSON.parse(kr(l[2]).renderNeighbourhood()))),d&8192&&(v.$$scope={dirty:d,ctx:l}),e.$set(v);const S={};d&1&&(S.data=l[0].gj.features[l[0].shortcutIndex]),d&8192&&(S.$$scope={dirty:d,ctx:l}),r.$set(S);const E={};d&1&&(E.data=l[0].roadGj),d&8192&&(E.$$scope={dirty:d,ctx:l}),s.$set(E)},i(l){c||(se(e.$$.fragment,l),se(r.$$.fragment,l),se(s.$$.fragment,l),c=!0)},o(l){me(e.$$.fragment,l),me(r.$$.fragment,l),me(s.$$.fragment,l),c=!1},d(l){l&&(ve(n),ve(i)),Ve(e,l),Ve(r,l),Ve(s,l)}}}function I7(t){let e,n;return e=new Sy({props:{gjInput:JSON.parse(kr(t[2]).renderNeighbourhood()),onClickLine:t[3],$$slots:{"line-popup":[M7]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&4&&(s.gjInput=JSON.parse(kr(r[2]).renderNeighbourhood())),i&8192&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function C7(t){let e,n;const r=[ai("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let i={};for(let s=0;s({12:i}),({props:i})=>i?4096:0]},$$scope:{ctx:t}}}),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","line-popup")},m(i,s){be(i,e,s),Be(n,e,null),r=!0},p(i,s){const c={};s&12288&&(c.$$scope={dirty:s,ctx:i}),n.$set(c)},i(i){r||(se(n.$$.fragment,i),r=!0)},o(i){me(n.$$.fragment,i),r=!1},d(i){i&&ve(e),Ve(n)}}}function A7(t){let e,n,r,i,s,c;const l=[I7,E7],d=[];function v(S,E){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(n=v(t))&&(r=d[n]=l[n](t)),s=new Ey({}),{c(){e=_e("div"),r&&r.c(),i=We(),Ue(s.$$.fragment),Le(e,"slot","map")},m(S,E){be(S,e,E),~n&&d[n].m(e,null),te(e,i),Be(s,e,null),c=!0},p(S,E){let C=n;n=v(S),n===C?~n&&d[n].p(S,E):(r&&(kn(),me(d[C],1,1,()=>{d[C]=null}),Dn()),~n?(r=d[n],r?r.p(S,E):(r=d[n]=l[n](S),r.c()),se(r,1),r.m(e,i)):r=null)},i(S){c||(se(r),se(s.$$.fragment,S),c=!0)},o(S){me(r),me(s.$$.fragment,S),c=!1},d(S){S&&ve(e),~n&&d[n].d(),Ve(s)}}}function k7(t){let e,n,r,i;return e=new xu({props:{$$slots:{map:[A7],sidebar:[S7],top:[b7]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment)},m(s,c){Be(e,s,c),n=!0,r||(i=Lt(g7,"keydown",t[4]),r=!0)},p(s,[c]){const l={};c&8199&&(l.$$scope={dirty:c,ctx:s}),e.$set(l)},i(s){n||(se(e.$$.fragment,s),n=!0)},o(s){me(e.$$.fragment,s),n=!1},d(s){Ve(e,s),r=!1,i()}}}function D7(t,e,n){let r,i,s;vt(t,bn,R=>n(1,r=R)),vt(t,uu,R=>n(11,i=R)),vt(t,Gi,R=>n(2,s=R));let c={state:"neutral"};function l(R,F){let U=JSON.parse(s.getShortcutsCrossingRoad(R.properties.id));if(U.features.length==0){window.alert("No shortcuts here");return}n(0,c={state:"chose-road",roadGj:R,gj:U,shortcutIndex:0})}$_(()=>{i==null||i.keyboard.disable()}),ro(()=>{i==null||i.keyboard.enable()});function d(R){c.state=="chose-road"&&(R.key=="ArrowLeft"&&c.shortcutIndex>0&&(R.stopPropagation(),n(0,c.shortcutIndex--,c)),R.key=="ArrowRight"&&(R.stopPropagation(),c.shortcutIndex!=c.gj.features.length-1&&n(0,c.shortcutIndex++,c)))}function v(){Bt(bn,r={mode:"neighbourhood"},r)}function S(){c.state=="chose-road"&&n(0,c.shortcutIndex--,c)}function E(){c.state=="chose-road"&&n(0,c.shortcutIndex++,c)}return[c,r,s,l,d,v,S,E,()=>n(0,c={state:"neutral"}),()=>Bt(bn,r={mode:"title"},r),()=>Bt(bn,r={mode:"network"},r)]}class R7 extends Zt{constructor(e){super(),Ht(this,e,D7,k7,Ut,{})}}function N7(t){let e,n,r,i,s,c,l,d,v;return i=new TB({}),{c(){e=_e("div"),n=_e("button"),n.innerHTML=`A/B Street logo`,r=We(),Ue(i.$$.fragment),s=We(),c=_e("span"),Le(n,"class","outline"),lr(c,"width","100%"),Le(e,"slot","top"),lr(e,"display","flex")},m(S,E){be(S,e,E),te(e,n),te(e,r),Be(i,e,null),te(e,s),te(e,c),t[19](c),l=!0,d||(v=Lt(n,"click",t[18]),d=!0)},p:Ct,i(S){l||(se(i.$$.fragment,S),l=!0)},o(S){me(i.$$.fragment,S),l=!1},d(S){S&&ve(e),Ve(i),t[19](null),d=!1,v()}}}function TE(t){let e,n,r,i,s,c;return r=new eF({props:{map:kr(t[6]),maptilerBasemap:t[7]}}),{c(){e=_e("button"),e.textContent="Zoom to fit study area",n=We(),Ue(r.$$.fragment),Le(e,"class","secondary")},m(l,d){be(l,e,d),be(l,n,d),Be(r,l,d),i=!0,s||(c=Lt(e,"click",t[10]),s=!0)},p(l,d){const v={};d&64&&(v.map=kr(l[6])),d&128&&(v.maptilerBasemap=l[7]),r.$set(v)},i(l){i||(se(r.$$.fragment,l),i=!0)},o(l){me(r.$$.fragment,l),i=!1},d(l){l&&(ve(e),ve(n)),Ve(r,l),s=!1,c()}}}function O7(t){let e,n,r,i,s,c,l=t[5]&&TE(t);return{c(){e=_e("div"),n=_e("div"),r=We(),i=_e("hr"),s=We(),l&&l.c(),Le(e,"slot","left")},m(d,v){be(d,e,v),te(e,n),t[17](n),te(e,r),te(e,i),te(e,s),l&&l.m(e,null),c=!0},p(d,v){d[5]?l?(l.p(d,v),v&32&&se(l,1)):(l=TE(d),l.c(),se(l,1),l.m(e,null)):l&&(kn(),me(l,1,1,()=>{l=null}),Dn())},i(d){c||(se(l),c=!0)},o(d){me(l),c=!1},d(d){d&&ve(e),t[17](null),l&&l.d()}}}function z7(t){let e,n;return e=new m7({}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p:Ct,i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function F7(t){let e,n;return e=new l7({props:{wasmReady:t[4]}}),{c(){Ue(e.$$.fragment)},m(r,i){Be(e,r,i),n=!0},p(r,i){const s={};i&16&&(s.wasmReady=r[4]),e.$set(s)},i(r){n||(se(e.$$.fragment,r),n=!0)},o(r){me(e.$$.fragment,r),n=!1},d(r){Ve(e,r)}}}function LE(t){let e,n,r,i,s,c;e=new No({props:{data:JSON.parse(t[5].getInvertedBoundary()),$$slots:{default:[B7]},$$scope:{ctx:t}}});const l=[H7,W7,q7,G7,j7,U7,V7],d=[];function v(S,E){return S[8].mode=="network"?0:S[8].mode=="set-boundary"?1:S[8].mode=="auto-boundaries"?2:S[8].mode=="neighbourhood"?3:S[8].mode=="view-shortcuts"?4:S[8].mode=="route"?5:S[8].mode=="debug"?6:-1}return~(r=v(t))&&(i=d[r]=l[r](t)),{c(){Ue(e.$$.fragment),n=We(),i&&i.c(),s=Pi()},m(S,E){Be(e,S,E),be(S,n,E),~r&&d[r].m(S,E),be(S,s,E),c=!0},p(S,E){const C={};E&32&&(C.data=JSON.parse(S[5].getInvertedBoundary())),E&2097152&&(C.$$scope={dirty:E,ctx:S}),e.$set(C);let M=r;r=v(S),r===M?~r&&d[r].p(S,E):(i&&(kn(),me(d[M],1,1,()=>{d[M]=null}),Dn()),~r?(i=d[r],i?i.p(S,E):(i=d[r]=l[r](S),i.c()),se(i,1),i.m(s.parentNode,s)):i=null)},i(S){c||(se(e.$$.fragment,S),se(i),c=!0)},o(S){me(e.$$.fragment,S),me(i),c=!1},d(S){S&&(ve(n),ve(s)),Ve(e,S),~r&&d[r].d(S)}}}function B7(t){let e,n;const r=[ai("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let i={};for(let s=0;s{C[z]=null}),Dn()),~s?(c=C[s],c?c.p(R,F):(c=C[s]=E[s](R),c.c()),se(c,1),c.m(l.parentNode,l)):c=null),R[5]?k?(k.p(R,F),F&32&&se(k,1)):(k=LE(R),k.c(),se(k,1),k.m(d.parentNode,d)):k&&(kn(),me(k,1,1,()=>{k=null}),Dn())},i(R){S||(se(e.$$.fragment,R),se(c),se(k),se(v.$$.fragment,R),S=!0)},o(R){me(e.$$.fragment,R),me(c),me(k),me(v.$$.fragment,R),S=!1},d(R){R&&(ve(n),ve(r),ve(i),ve(l),ve(d)),Ve(e,R),t[14](null),~s&&C[s].d(R),k&&k.d(R),Ve(v,R)}}}function X7(t){let e,n,r,i;function s(l){t[15](l)}let c={style:`https://api.maptiler.com/maps/${t[7]}/style.json?key=${Fv}`,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"},{id:"oneway-arrow",url:CR}],$$slots:{default:[Z7]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new mN({props:c}),si.push(()=>Il(n,"map",s)),n.$on("error",t[16]),{c(){e=_e("div"),Ue(n.$$.fragment),Le(e,"slot","main"),lr(e,"position","relative"),lr(e,"width","100%"),lr(e,"height","100%")},m(l,d){be(l,e,d),Be(n,e,null),i=!0},p(l,d){const v={};d&128&&(v.style=`https://api.maptiler.com/maps/${l[7]}/style.json?key=${Fv}`),d&2097465&&(v.$$scope={dirty:d,ctx:l}),!r&&d&1&&(r=!0,v.map=l[0],El(()=>r=!1)),n.$set(v)},i(l){i||(se(n.$$.fragment,l),i=!0)},o(l){me(n.$$.fragment,l),i=!1},d(l){l&&ve(e),Ve(n)}}}function $7(t){let e,n,r,i;return e=new IR({}),r=new Ez({props:{$$slots:{main:[X7],left:[O7],top:[N7]},$$scope:{ctx:t}}}),{c(){Ue(e.$$.fragment),n=We(),Ue(r.$$.fragment)},m(s,c){Be(e,s,c),be(s,n,c),Be(r,s,c),i=!0},p(s,[c]){const l={};c&2098175&&(l.$$scope={dirty:c,ctx:s}),r.$set(l)},i(s){i||(se(e.$$.fragment,s),se(r.$$.fragment,s),i=!0)},o(s){me(e.$$.fragment,s),me(r.$$.fragment,s),i=!1},d(s){s&&ve(n),Ve(e,s),Ve(r,s)}}}function Y7(t,e,n){let r,i,s,c,l,d,v,S,E;vt(t,a1,le=>n(11,r=le)),vt(t,s1,le=>n(12,i=le)),vt(t,o1,le=>n(13,s=le)),vt(t,Gi,le=>n(5,c=le)),vt(t,uu,le=>n(6,l=le)),vt(t,Jd,le=>n(20,d=le)),vt(t,Bv,le=>n(7,v=le)),vt(t,bn,le=>n(8,S=le)),vt(t,A_,le=>n(9,E=le));let C=!1;$_(async()=>{await GE(),await ZE(),n(4,C=!0);try{(await fetch("/osm/areas.json")).ok&&(Bt(Jd,d=!0,d),console.log("Using local cache, not od2net.org"))}catch{}});let M;function k(){l.fitBounds(Array.from(c.getBounds()),{animate:!1})}let R,F,U;function z(le){si[le?"unshift":"push"](()=>{U=le,n(3,U),n(11,r)})}function G(le){M=le,n(0,M)}const q=le=>{console.log(le.detail.error)};function X(le){si[le?"unshift":"push"](()=>{F=le,n(2,F),n(12,i)})}const de=()=>Bt(A_,E=!0,E);function ae(le){si[le?"unshift":"push"](()=>{R=le,n(1,R),n(13,s)})}return t.$$.update=()=>{t.$$.dirty&1&&M&&uu.set(M),t.$$.dirty&8194&&R&&s&&(n(1,R.innerHTML="",R),R.appendChild(s)),t.$$.dirty&4100&&F&&i&&(n(2,F.innerHTML="",F),F.appendChild(i)),t.$$.dirty&2056&&U&&r&&(n(3,U.innerHTML="",U),U.appendChild(r))},[M,R,F,U,C,c,l,v,S,E,k,r,i,s,z,G,q,X,de,ae]}class K7 extends Zt{constructor(e){super(),Ht(this,e,Y7,$7,Ut,{})}}new K7({target:document.getElementById("app")}); diff --git a/index.html b/index.html index f421f05..c71d138 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ The low-traffic neighbourhood (LTN) tool, v2 - +